Closed
Bug 1500167
Opened 6 years ago
Closed 6 years ago
Support multiple tables
Categories
(Core :: JavaScript: WebAssembly, enhancement, P2)
Core
JavaScript: WebAssembly
Tracking
()
RESOLVED
FIXED
mozilla65
Tracking | Status | |
---|---|---|
firefox65 | --- | fixed |
People
(Reporter: lth, Assigned: lth)
References
Details
Attachments
(1 file, 4 obsolete files)
138.49 KB,
patch
|
lth
:
review+
|
Details | Diff | Splinter Review |
Now that we have table-of-anyref and instructions to operate on those, generalize everywhere so that we can have more than one table.
Assignee | ||
Comment 1•6 years ago
|
||
Nearly complete, I'm running out of things to test. But I think I left behind some minor FIXMEs that need attention. And possibly I need some negative tests to test range checking.
Assignee | ||
Comment 2•6 years ago
|
||
Attachment #9021888 -
Attachment is obsolete: true
Attachment #9022658 -
Flags: review?(luke)
Assignee | ||
Comment 3•6 years ago
|
||
Added and adjusted several test cases; no functional changes.
Attachment #9022658 -
Attachment is obsolete: true
Attachment #9022658 -
Flags: review?(luke)
Attachment #9022864 -
Flags: review?(luke)
Assignee | ||
Comment 4•6 years ago
|
||
Assignee | ||
Comment 5•6 years ago
|
||
Assignee | ||
Comment 6•6 years ago
|
||
Incorporate fixes for fairly obscure bugs discovered by try runs.
Attachment #9022864 -
Attachment is obsolete: true
Attachment #9022864 -
Flags: review?(luke)
Attachment #9023008 -
Flags: review?(luke)
Assignee | ||
Comment 7•6 years ago
|
||
Comment 8•6 years ago
|
||
Comment on attachment 9023008 [details] [diff] [review]
bug1500167-multiple-tables-v4.patch
Review of attachment 9023008 [details] [diff] [review]:
-----------------------------------------------------------------
Glad to see things mostly sortof slotted into place, even though it was a rather large amount of total work. Great job!
::: js/src/wasm/WasmConstants.h
@@ +588,5 @@
> // These limits are agreed upon with other engines for consistency.
>
> static const unsigned MaxTypes = 1000000;
> static const unsigned MaxFuncs = 1000000;
> +static const unsigned MaxTables = 100000; // NOT IN ANY SPEC!
nit: The uppercase makes it look like we're doing something bad here ;) How about a lower case "// TODO: get in shared limits spec"?
::: js/src/wasm/WasmInstance.cpp
@@ +1328,5 @@
> + // Ergo we must go through the entire list of tables in the instance here
> + // and check for the table in all the cached-data slots; we can't exit after
> + // the first hit.
> +
> + for (uint32_t i=0; i < tables_.length(); i++) {
prediction: in 10 years, O(n) loop will show up as part of some O(n^2) pathological testcase and we'll have to register (Instance*,tableIndex) pairs on the Table like we do for Instance::deoptimizeImportExit() :P
::: js/src/wasm/WasmModule.cpp
@@ +1278,3 @@
> SharedTableVector tables;
> + uint32_t tableIndex = 0;
> + for (const TableDesc& td : metadata().tables) {
nit: Module::instantiate() is a bit large and I try to keep it a high-level sequence of operations, so could you perhaps reintroduce instantiateTable() and push the loop into that (similar to, e.g., instantiateGlobals())? Given that instantiate{Imported,Local}Table share a tail, I think it'd be fine to just inline them into instantiateTable().
::: js/src/wasm/WasmModule.h
@@ +91,5 @@
> + bool instantiateImportedTable(JSContext* cx,
> + const TableDesc& td,
> + Handle<WasmTableObject*> table,
> + WasmTableObjectVector& tableObjs,
> + SharedTableVector* tables) const;
nit: could you take 'tableObjs' by pointer (as the outparam convention)?
::: js/src/wasm/WasmTable.h
@@ +31,5 @@
> //
> +// A table of AnyFunction holds FunctionTableElems, which are (instance*,index)
> +// pairs, where the instance must be traced. An earlier optimization avoiding
> +// the instance* for local tables does not interact well with multiple tables
> +// and the table.copy instruction.
nit: While it's true, the latter sentence seems like it'll be get increasingly stale (if not clobbered by bug 1340235) so I'd leave it out.
Attachment #9023008 -
Flags: review?(luke) → review+
Assignee | ||
Comment 9•6 years ago
|
||
This addresses all comments and further fleshes out the stress test case. I did not fold the two instantiate routines out into the now broken-out instantiate loop because the logic is clearer the way it is. I have however cleaned up the representation of the function array further since there's a single representation now. And I've simplified the API to Table somewhat; the arrays are no longer available externally to the Table code.
Carrying the r+, though there's some fresh code here.
Attachment #9023008 -
Attachment is obsolete: true
Attachment #9024793 -
Flags: review+
Assignee | ||
Comment 10•6 years ago
|
||
Assignee | ||
Comment 11•6 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ea1da7c247ea61c752334deca1c2c060eeb971e8
Bug 1500167 - Support multiple tables in wasm. r=luke
Comment 12•6 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Comment 13•6 years ago
|
||
Need to update table descriptions in the docs in light of this.
Keywords: dev-doc-needed
Assignee | ||
Comment 14•6 years ago
|
||
Note this is nightly-only until the feature has been fully specced.
Comment 15•6 years ago
|
||
Thanks LTH; I'll not add a note to the Fx65 rel notes, but I'll document this when I get ot the actual docs stage.
Updated•4 years ago
|
Keywords: dev-doc-needed
You need to log in
before you can comment on or make changes to this bug.
Description
•