Restructuring of wasm-gc allocation methods in preparation for work on inline allocation
Categories
(Core :: JavaScript: WebAssembly, enhancement)
Tracking
()
People
(Reporter: jseward, Assigned: jseward)
References
Details
Attachments
(6 files)
|
6.89 KB,
patch
|
Details | Diff | Splinter Review | |
|
12.53 KB,
patch
|
Details | Diff | Splinter Review | |
|
18.99 KB,
patch
|
Details | Diff | Splinter Review | |
|
29.94 KB,
patch
|
Details | Diff | Splinter Review | |
|
8.60 KB,
application/octet-stream
|
Details | |
|
2.51 KB,
patch
|
Details | Diff | Splinter Review |
As preliminary work for implementing inline wasm-gc object allocation, this
bug contains restructuring to make it easier to see what needs to be
implemented inline. Currently there are four patches:
-
one to move WasmStructObject::createStruct from WasmGcObject.h to
WasmGcObject.cpp, since that's where all the other allocation methods are.
This gives a small performance loss. -
one that removes WasmGcObject::create, and manually inlines and specialises
it into its callers. -
one that renames various names of the form
StructNewtoStructNewInit,
so as to be consistent with existing namesStructNewUninit, and so as to
reduce confusion in the next patch. Ditto forArrayNew. -
one that splits the
StructNewInitandStructNewUninitmethods into two
variants each, hence:StructNewInitIL,StructNewInitOOL,
StructNewUninitIL,StructNewUninitOOL. The IL/OOL variants produce
objects with inline-only storage or outline-storage respectively. They
remove the existing check at run time about whether this is necessary,
because that's known at compile time.
This results in new function StructNewUninitIL (uninit, inline only) being
considerably simpler, and something we could consider writing macroassembler
methods for, in the style of existing (for JS)
MacroAssembler::allocateObject. Possibly also for StructNewInitIL.
Even if we don't do that they are a nice cleanup, and more or less
performance-neutral.
| Assignee | ||
Comment 1•2 years ago
|
||
| Assignee | ||
Comment 2•2 years ago
|
||
| Assignee | ||
Comment 3•2 years ago
|
||
| Assignee | ||
Comment 4•2 years ago
|
||
| Assignee | ||
Comment 5•2 years ago
|
||
Here's another refinement. It caches the required structure size in
struct TypeDefData, so that the allocator doesn't need to chase from
TypeDefData to TypeDef to find the size. Hence removes a dependent
load in the allocation path, but more importantly removes the need
for allocation of structs to look at the TypeDef at all, which seems
like a useful simplification in advance of inline allocation.
| Assignee | ||
Comment 6•2 years ago
|
||
We could really use a sixth patch here, which ensures that the
inline-storage size of a WasmStructObject is always an integral
number of machine words; currently it isn't, for some strange reason.
This would somewhat improve/simplify the zeroing-out code
for that area required by an inline implementation of
WasmStructObject::createStructIL.
| Assignee | ||
Comment 7•2 years ago
|
||
Patch as per comment 6. This seems to marginally improve performance
on Barista-3, possibly by reducing the amount of branch misprediction
induced by memset-zero-ing the inline storage areas.
| Assignee | ||
Comment 8•2 years ago
|
||
Closing this bug in favour of bug 1839598, which supersedes it.
Description
•