Closed
Bug 929314
Opened 11 years ago
Closed 10 years ago
Remove all uses of Handle::repoint
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla32
People
(Reporter: jimb, Assigned: jonco)
References
Details
Attachments
(2 files, 1 obsolete file)
(deleted),
patch
|
terrence
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
As Waldo points out, Handle::repoint is a footgun, as it allows us to create Handles that refer to things that have a *shorter* lifetime than the handle, which we couldn't otherwise:
Handle h1 = something;
{
Rooted r(cx, blech);
Handle h2 = r;
h1.repoint(h2);
}
/* h1 is garbage */
There are only a few uses of Handle::repoint: CompileOptions, C1Spewer, and IonSpewer. All of those can be changed to use different things, perhaps the AutoRooter type proposed in bug 892643.
Reporter | ||
Updated•11 years ago
|
Reporter | ||
Comment 2•10 years ago
|
||
As long as there exist uses of Handle<T>::repoint, then this bug is valid. It looks like C1Spewer and IonSpewer are the ones that still exist.
Flags: needinfo?(jimb)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → jcoppeard
Assignee | ||
Comment 3•10 years ago
|
||
I though it would be simple to replace the handles that we call repoint() on with PersistentRooteds, which can simply be assigned to. However I ended up having to refactor IonSpewer so that it's stored as a pointer in the JitRuntime so that it can be initialised after we're created a JSRuntime.
This has the additional advantage of not using a global to store this state, which presumable didn't work if there were multiple runtimes.
Attachment #8424894 -
Flags: review?(jdemooij)
Assignee | ||
Comment 4•10 years ago
|
||
And now we can just kill Handle::repoint()
Attachment #8424896 -
Flags: review?(terrence)
Comment 5•10 years ago
|
||
Comment on attachment 8424894 [details] [diff] [review]
1 - refactor-ion-spewer
Review of attachment 8424894 [details] [diff] [review]:
-----------------------------------------------------------------
IonSpewer::function is unused, looks like. I just removed it and I can compile a debug shell; can you do that instead?
Attachment #8424894 -
Flags: review?(jdemooij)
Comment 6•10 years ago
|
||
(In reply to Jon Coppeard (:jonco) from comment #3)
> This has the additional advantage of not using a global to store this state,
> which presumable didn't work if there were multiple runtimes.
Good point. The spewer is mostly used in the shell though where it's not a problem, and IIUC even with the spewer-per-runtime we'll still fopen the same file for writing from multiple threads (not sure what will happen there). As the spewer is just a debug-only thing, I think it's fine to leave it as a singleton for now until people actually run into problems with it.
Comment 7•10 years ago
|
||
Comment on attachment 8424896 [details] [diff] [review]
2 - remove-repoint
Review of attachment 8424896 [details] [diff] [review]:
-----------------------------------------------------------------
\o/ r=me
Attachment #8424896 -
Flags: review?(terrence) → review+
Assignee | ||
Comment 8•10 years ago
|
||
Thanks, I should have spotted that! This is much simpler.
Attachment #8424894 -
Attachment is obsolete: true
Attachment #8425345 -
Flags: review?(jdemooij)
Comment 9•10 years ago
|
||
Comment on attachment 8425345 [details] [diff] [review]
1 - refector-ion-spewer v2
Review of attachment 8425345 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks!
Attachment #8425345 -
Flags: review?(jdemooij) → review+
Assignee | ||
Comment 10•10 years ago
|
||
Comment 11•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/179d30a83cb5
https://hg.mozilla.org/mozilla-central/rev/687938abd5de
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in
before you can comment on or make changes to this bug.
Description
•