Closed
Bug 1188124
Opened 10 years ago
Closed 10 years ago
Use rootKind to find the right PersistentRooted list
Categories
(Core :: JavaScript: GC, defect)
Core
JavaScript: GC
Tracking
()
RESOLVED
FIXED
mozilla42
| Tracking | Status | |
|---|---|---|
| firefox42 | --- | fixed |
People
(Reporter: terrence, Assigned: terrence)
References
Details
Attachments
(1 file)
|
1.55 KB,
patch
|
sfink
:
review+
|
Details | Diff | Splinter Review |
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)
| Assignee | ||
Comment 1•10 years ago
|
||
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 2•10 years ago
|
||
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+
| Assignee | ||
Comment 3•10 years ago
|
||
(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.
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.
Description
•