Post-refactoring cleanup of baseline compiler
Categories
(Core :: JavaScript: WebAssembly, enhancement, P3)
Tracking
()
People
(Reporter: lth, Assigned: lth)
References
Details
Attachments
(9 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 |
Some things were intentionally delayed and some were unintentionally forgotten; let's clean them up (I expect multiple patches here).
Assignee | ||
Comment 1•3 years ago
|
||
Not moving createStackMap during the initial refactor was an
oversight. We take the opportunity to do some minor related cleanup.
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7c99e54438e7 Un-inline some stack map generator functions. r=jseward
Comment 3•3 years ago
|
||
bugherder |
Assignee | ||
Comment 4•3 years ago
|
||
Remove platform dependencies that depend only on whether the platform
has a HeapReg or not, by introducing a properly named #define for this
and rewriting the code slightly.
Introduce a RegIntptr alias to express integer-representing-pointer
appropriately on different platforms.
Introduce a templated move() method for register-to-register moves.
Drive-by cleanup:
Replace the overloaded free() methods for freeing registers with a
templated variant to match what we have for push, pop, need, and move.
Document the internal #defines that control the compiler.
Depends on D124446
Assignee | ||
Comment 5•3 years ago
|
||
WasmBCMemory.h held a class that was visible in WasmBCClass.h, but
this class can be internal to WasmBCMemory.cpp if some of the methods
on BaseCompiler are turned into static functions in the latter file.
Depends on D124642
Assignee | ||
Comment 6•3 years ago
|
||
No functional change, just grouping methods according to their area of
operation and adding separators to clarify.
Depends on D124643
Assignee | ||
Comment 7•3 years ago
|
||
This is a fairly large refactor without any change intended in
functionality or even (functionality-neutral) code generation.
Background:
Previously, atomic operations were split into several parts that lived
in different parts of WasmBaselineCompile.cpp and WasmBCMemory.cpp:
-
the "emitters" in WasmBaselineCompile.cpp which read bytecode and
called code generation functions in WasmBCMemory.cpp; -
the code generation drivers in WasmBCMemory.cpp such as atomicXchg();
-
the "poppers", which were RAII wrappers that would know about how to
do register allocation and assignment per-platform; -
a helper class for managing temp registers separately from the
poppers, defined in WasmBCMemory.h; and -
template functions that would drive the macroassembler given the
inputs from the above.
Historically these were scattered far apart in WasmBaselineCompile.cpp
because of the layering of that file; the recent refactor just moved
some of them to WasmBCMemory.cpp without doing anything more.
This patch changes the structure as follows:
-
the "emitters" stay where they are because they are clean and
because separating out the emitters is a good pattern we want to
continue to use; and -
the other parts have been brought together in WasmBCMemory.cpp and
ifdeffed in a way that keeps related code together.
In particular, the code generation drivers now have a common form,
where it explicitly calls pop/alloc, codegen, and dealloc methods, and
the methods for an operation on a platform are defined together. This
should make code significantly more maintainable, and it reduces the
ifdeffery in the file. Also it allows the file to be organized
better.
Depends on D124644
Assignee | ||
Comment 8•3 years ago
|
||
This gets rid of some more platform ifdefs and reorganizes the functions and comments
to more naturally reflect their functional group. No functional changes.
Depends on D124645
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b3e9c2ebd825 Remove some platform dependencies in WasmBCMemory. r=jseward https://hg.mozilla.org/integration/autoland/rev/e72165b3f9e2 Remove WasmBCMemory.h. r=jseward https://hg.mozilla.org/integration/autoland/rev/ff900e9ba3ff Rearrange WasmBCMemory.cpp. r=jseward https://hg.mozilla.org/integration/autoland/rev/ca7fabfacf78 Refactor atomic operations to make them maintainable. r=jseward https://hg.mozilla.org/integration/autoland/rev/dad808334868 Final post-refactor reorg and cleanup. r=jseward
Assignee | ||
Comment 10•3 years ago
|
||
Traditionally pointer values (tls, heap pointer) were represented as
RegI32 because we "know" that that is really a GPR, even if the GPR is
64-bit on 64-bit systems.
Later, we introduced RegPtr to hold pointer values that were not
reference values, but used only in some cases. Let's use RegPtr to
hold the tls and heapreg pointer values now, introducing better type
safety that will aid us in the memory64 work.
There's a wrinkle because RegPtr can't be stored on the value stack.
Recently a "RegIntptr" abstraction was introduced as part of the
cleanup of WasmBCMemory, but this is not necessary at this time: all
we need is a local conversion to RegI32 or RegI64 as appropriate for
the platform, in the one place where this is needed, to push a RegPtr
value. So simplify this code by removing RegIntptr again and adding
some local conversion functions.
Assignee | ||
Comment 11•3 years ago
|
||
This is needed for WASI, which has a weird configuration not previously tested.
Comment 12•3 years ago
|
||
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3cb1ad79d239 Add a 'none' case for some atomic ops. r=jseward
Assignee | ||
Comment 13•3 years ago
|
||
Updated•3 years ago
|
Comment 14•3 years ago
|
||
Pushed by ctuns@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0e6db6c31531 Make the 'none' case narrower, only wasi is affected. r=jseward CLOSED TREE
Comment 15•3 years ago
|
||
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f41a5f974305 Make the 'none' case narrower, only wasi is affected. r=jseward CLOSED TREE
Comment 17•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b3e9c2ebd825
https://hg.mozilla.org/mozilla-central/rev/e72165b3f9e2
https://hg.mozilla.org/mozilla-central/rev/ff900e9ba3ff
https://hg.mozilla.org/mozilla-central/rev/ca7fabfacf78
https://hg.mozilla.org/mozilla-central/rev/dad808334868
https://hg.mozilla.org/mozilla-central/rev/3cb1ad79d239
https://hg.mozilla.org/mozilla-central/rev/0e6db6c31531
Assignee | ||
Comment 18•3 years ago
|
||
Backout was resolved after some tweaking.
Comment 19•3 years ago
|
||
Comment 20•3 years ago
|
||
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/41a6e728e0be Make pointer values RegPtr. r=jseward
Comment 21•3 years ago
|
||
Backed out for causing spidermonkey failures on WasmBCMemory.cpp
Assignee | ||
Comment 22•3 years ago
|
||
There was a bug here (misspelling a function name) that CI did not find; good to get that fixed. CI caused a backout for a non-bug, not ifdeffing a static inline function that was unused in the tested configuration.
Comment 23•3 years ago
|
||
Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c67ff8ccba06 Make pointer values RegPtr. r=jseward
Comment 24•3 years ago
|
||
bugherder |
Assignee | ||
Comment 25•3 years ago
|
||
There may be more to do but for the purposes of unblocking memory64 we're done for now.
Description
•