Closed Bug 1188124 Opened 10 years ago Closed 10 years ago

Use rootKind to find the right PersistentRooted list

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: terrence, Assigned: terrence)

References

Details

Attachments

(1 file)

At least in the PersistentRooted constructor. Finish and Trace both want a loop, which we will get to later. In the meantime we assert that only Traced and Finished lists are used.
Attachment #8639534 - Flags: review?(sphink)
Blocks: 1188129
Comment on attachment 8639534 [details] [diff] [review] use_rootKind_to_select_persistentrooted_list-v0.diff Steve is on PTO this week and next.
Attachment #8639534 - Flags: review?(sphink) → review?(jimb)
Comment on attachment 8639534 [details] [diff] [review] use_rootKind_to_select_persistentrooted_list-v0.diff Review of attachment 8639534 [details] [diff] [review]: ----------------------------------------------------------------- I'm not gone quite yet. I'll be around today (though I'll be shifting my hours a little.) ::: js/public/RootingAPI.h @@ +994,5 @@ > void registerWithRootLists(js::RootLists& roots) { > MOZ_ASSERT(!initialized()); > + js::ThingRootKind kind = js::RootKind<T>::rootKind(); > + reinterpret_cast<mozilla::LinkedList<JS::PersistentRooted<T>>&>(roots.heapRoots_[kind]) > + .insertBack(this); Wow, that's an awful looking cast! I almost wonder if it should be roots.typedHeapRoot<T>(kind).insertBack(this); but if this is going to be the only use, I'd rather not hide what's going on.
Attachment #8639534 - Flags: review?(jimb) → review+
(In reply to Steve Fink [:sfink, :s:] from comment #2) > Comment on attachment 8639534 [details] [diff] [review] > use_rootKind_to_select_persistentrooted_list-v0.diff > > Review of attachment 8639534 [details] [diff] [review]: > ----------------------------------------------------------------- > > I'm not gone quite yet. I'll be around today (though I'll be shifting my > hours a little.) > > ::: js/public/RootingAPI.h > @@ +994,5 @@ > > void registerWithRootLists(js::RootLists& roots) { > > MOZ_ASSERT(!initialized()); > > + js::ThingRootKind kind = js::RootKind<T>::rootKind(); > > + reinterpret_cast<mozilla::LinkedList<JS::PersistentRooted<T>>&>(roots.heapRoots_[kind]) > > + .insertBack(this); > > Wow, that's an awful looking cast! Turns out it breaks gcc's strict alias analysis because we're casting from void* to multiple unrelated T. We actually need to cast this to PersistentRooted<void*>*, which is a ton tamer.
Blocks: 1188620
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: