Closed
Bug 1274612
Opened 9 years ago
Closed 9 years ago
Check callers have the exclusive access lock at compile time
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla49
| Tracking | Status | |
|---|---|---|
| firefox49 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
Details
Attachments
(2 files)
|
67.04 KB,
patch
|
terrence
:
review+
|
Details | Diff | Splinter Review |
|
19.79 KB,
patch
|
terrence
:
review+
|
Details | Diff | Splinter Review |
There are a few places in the runtime where the exclusive access lock is required. This is currently checked with assertions, but we can make these methods take an AutoLockForExclusiveAccess& parameter and enforce this at compile time.
| Assignee | ||
Comment 1•9 years ago
|
||
Require lock for JSRuntime::atoms, atomsCompartment and symbolRegistry.
Mostly straightforward, but annoyingly I had to make ComponentFinder use CRTP so we could pass around a reference to the lock with it as ZoneComponentFinder.
Reading this, AutoLockForExclusiveAccess seems rather unwieldy. I was wondering about changing it to something more pithy, maybe AutoLockExclusiveAccess or even just AutoLockExclusive. What do you think?
Attachment #8754884 -
Flags: review?(terrence)
| Assignee | ||
Comment 2•9 years ago
|
||
Do the same for JSRuntime::parseMapPool, addActiveCompilation, removeActiveCompilation and scriptDataTable.
Attachment #8754885 -
Flags: review?(terrence)
Comment 3•9 years ago
|
||
Comment on attachment 8754884 [details] [diff] [review]
require-exclusive-lock
Review of attachment 8754884 [details] [diff] [review]:
-----------------------------------------------------------------
This is great! I'm also in favor of shortening the lock name. Even better would be to move all of the shared state under an ExclusiveData, but that might be too big a bridge to cross at this point.
I suppose we could just make the SCC algorithm take the lock itself, given that it's only used in one place right now. I'm not sure if that's actually cleaner than the CRTP though.
::: js/src/gc/GCRuntime.h
@@ +638,5 @@
> TraceRuntime,
> MarkRuntime
> };
> + void markRuntime(JSTracer* trc, TraceOrMarkRuntime traceOrMark,
> + AutoLockForExclusiveAccess& lock);
Are these not const because they actually unlock or because it's too cumbersome?
Attachment #8754884 -
Flags: review?(terrence) → review+
Comment 4•9 years ago
|
||
Comment on attachment 8754885 [details] [diff] [review]
require-exclusive-lock-2
Review of attachment 8754885 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/vm/Runtime.cpp
@@ -430,5 @@
> finishSelfHosting();
>
> MOZ_ASSERT(!exclusiveAccessOwner);
>
> - // Avoid bogus asserts during teardown.
O_O
Attachment #8754885 -
Flags: review?(terrence) → review+
Comment 7•9 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/99d94b060b63
https://hg.mozilla.org/mozilla-central/rev/3908a77903cf
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in
before you can comment on or make changes to this bug.
Description
•