Simplify JitContext a bit
Categories
(Core :: JavaScript Engine: JIT, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox105 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
Details
Attachments
(10 files, 2 obsolete files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
JitContext has some complexity, for example multiple contexts can be nested.
Last week I wrote some patches to simplify this to prepare for bug 1774178, but then went with a different approach for that bug. We should still land the JitContext parts though.
| Assignee | ||
Comment 1•3 years ago
|
||
A long time ago, JitContext was also used for entering JIT code, but now we only
use it for the compiler backend where we don't need to support nesting.
This requires some minor changes to avoid having multiple active contexts on the
stack, but makes it easier to reason about.
| Assignee | ||
Comment 2•3 years ago
|
||
One of the MacroAssembler constructors instantiates a JitContext lazily, but
it's simpler to require the callers to create a JitContext.
Depends on D152762
| Assignee | ||
Comment 3•3 years ago
|
||
With this patch we always pass a non-null allocator to the JitContext constructor,
and then never change it. Use references instead of pointers to make this clearer.
This lets us clean up more code: AutoJitContextAlloc can be removed and the
MacroAssembler no longer needs the constructor to optionally instantiate that
class.
Depends on D152763
| Assignee | ||
Comment 4•3 years ago
|
||
Depends on D152765
| Assignee | ||
Comment 5•3 years ago
|
||
The MacroAssembler is the main place where we still do TLS lookups for JitContext.
We can avoid that by caching the JitContext in the MacroAssembler.
This works because we now always instantiate the JitContext before we create the assembler.
Exceptions are Wasm compilations where we currently don't need the JitContext, and off-thread
JIT compilations where we can reset the context manually.
Depends on D152766
| Assignee | ||
Comment 6•3 years ago
|
||
Depends on D152767
Updated•3 years ago
|
| Assignee | ||
Comment 7•3 years ago
|
||
This removes some old code to tag debug spew with an ID per assembler, based on a
counter stored in JitContext. Usually there's only one assembler per JitContext and
we were also not using this for Wasm compilations (it always used id 0), so this
patch removes it.
Depends on D152766
Updated•3 years ago
|
| Assignee | ||
Comment 8•3 years ago
|
||
This follows the Wasm code and prepares for (a) removing the second MacroAssembler
constructor and (b) removing the allocator from JitContext.
Depends on D152846
| Assignee | ||
Comment 9•3 years ago
|
||
MacroAssembler now has a single constructor, instead of three different ones
before this patch stack.
Depends on D152847
| Assignee | ||
Comment 10•3 years ago
|
||
Depends on D152848
| Assignee | ||
Comment 11•3 years ago
|
||
This lets us replace relatively slow TLS lookups with a simple dereference.
This also removes the realm from JitContext. The runtime still has a few uses
in the MIR backend.
Depends on D152849
| Assignee | ||
Comment 12•3 years ago
|
||
Depends on D152850
Comment 13•3 years ago
|
||
Comment 14•3 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/80977afb9edc
https://hg.mozilla.org/mozilla-central/rev/bbf8fe85e541
https://hg.mozilla.org/mozilla-central/rev/090af82e2597
https://hg.mozilla.org/mozilla-central/rev/8de9467effb2
https://hg.mozilla.org/mozilla-central/rev/83749da6cc3c
https://hg.mozilla.org/mozilla-central/rev/175d3849180d
https://hg.mozilla.org/mozilla-central/rev/322cae63ed26
https://hg.mozilla.org/mozilla-central/rev/28f6e56b0ebb
https://hg.mozilla.org/mozilla-central/rev/371648da494c
https://hg.mozilla.org/mozilla-central/rev/b1526450d444
Description
•