Closed Bug 1727084 Opened 3 months ago Closed 1 month ago

Wasm64: Implement basic functionality

Categories

(Core :: Javascript: WebAssembly, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: lth, Assigned: lth)

References

(Blocks 1 open bug)

Details

Attachments

(9 files, 1 obsolete file)

Implement all instructions with basic explicit bounds checking, memories still being limited to 4GB but pointers and offsets being 64 bits. (Initially we'll limit the offsets to 32 bits, as they are now.)

Depends on: 1726311
Summary: Wams64: Implement basic functionality → Wasm64: Implement basic functionality
Depends on: 1727477

Scaffolding: Add assertions everywhere execution currently depends on
a memory being a memory32. These assertions will disappear by and by.

Add some useful predicates and guard memory64 on !huge-memory.

Depends on D124808

Implement 64-bit memory.grow and memory.size.

Introduce the suffixes M32 and M64 on instance call signatures to
disambiguate them properly. Rewrite existing ad-hoc suffixes
(typically just '32') to use the new ones.

Differentiate 64-bit instance call methods from ditto 32-bit with the
'_m32' and '_m64' syntax. Rewrite some existing '_i32' and '_i64'
cases to use the new syntax.

Depends on D124887

Attachment #9239995 - Attachment description: WIP: Bug 1727084 - Memory64 - bulk memory ops → WIP: Bug 1727084 - Memory64 - Bulk memory operations

Bulk memory operations need better / more test cases but are otherwise considered done.

Attachment #9240512 - Attachment description: WIP: Bug 1727084 - Baseline operations, WIP → WIP: Bug 1727084 - Non-atomic-RMW baseline operations

Depends on D124888

Depends on D125524

Depends on: 1731555
Attachment #9240512 - Attachment description: WIP: Bug 1727084 - Non-atomic-RMW baseline operations → WIP: Bug 1727084 - Memory64 - Non-atomic-RMW baseline operations
Attachment #9241512 - Attachment description: WIP: Bug 1727084 - Atomic-rmw baseline operations → WIP: Bug 1727084 - Memory64 - Atomic-rmw baseline operations
Attachment #9241511 - Attachment is obsolete: true

Whether a memory is huge depends not just on whether huge memory
has been enabled in the process, but whether the memory's index
type allows the use of huge-memory optimization. (And in the
future it may depend on eg whether the memory, if it is i64,
has a declared maximum.) This fundamentally means that the
is-huge-memory attribute cannot be computed before compilation
starts but must be computed once the memory has been declared.

To make this simple, we parameterize IsHugeMemoryEnabled() by
the index type, and plumb the index type through the code where
we need it (not too many places). Features::hugeMemory can now
be removed.

The main issue with this is that IsHugeMemoryEnabled() becomes
fairly hot, yet it takes a multi-reader / single-writer lock
(that is never contended for writes, so should be fairly close
to optimal). If this becomes a bottleneck, we can read and
cache the value, or we can turn the lock into some relaxed
atomic, since the lock only controls a couple of bools and
everything would fit in a single word.

Depends on: 1732356

Depends on D125524

Status as of latest queue: Functionally complete and passes all tests on x64 + arm64. Missing Ion support for memory instructions on x86 and arm32.

Depends on: 1734642
Attachment #9243653 - Attachment description: WIP: Bug 1727084 - Memory64 - Test cases → WIP: Bug 1727084 - Memory64 - Test cases and testing code
Attachment #9242213 - Attachment description: WIP: Bug 1727084 - Memory64 - Huge-memory status depends on index type → Bug 1727084 - Memory64 - Huge-memory status depends on index type. r?yury
Attachment #9239994 - Attachment description: WIP: Bug 1727084 - Memory64 - Preliminaries → Bug 1727084 - Memory64 - Preliminaries. r?yury
Attachment #9242214 - Attachment description: WIP: Bug 1727084 - Memory64 - Allow larger-than-4GB allocations → Bug 1727084 - Memory64 - Allow larger-than-4GB allocations. r?yury
Attachment #9243652 - Attachment description: WIP: Bug 1727084 - Memory64 - Expose the index type via js-types → Bug 1727084 - Memory64 - Expose the index type via js-types. r?yury
Attachment #9239995 - Attachment description: WIP: Bug 1727084 - Memory64 - Bulk memory operations → Bug 1727084 - Memory64 - Bulk memory operations. r?yury
Attachment #9240512 - Attachment description: WIP: Bug 1727084 - Memory64 - Non-atomic-RMW baseline operations → Bug 1727084 - Memory64 - Non-atomic-RMW baseline operations. r?yury
Attachment #9241512 - Attachment description: WIP: Bug 1727084 - Memory64 - Atomic-rmw baseline operations → Bug 1727084 - Memory64 - Atomic-rmw baseline operations. r?yury
Attachment #9241513 - Attachment description: WIP: Bug 1727084 - Memory64 - Ion operations → Bug 1727084 - Memory64 - Ion operations. r?yury
Attachment #9243653 - Attachment description: WIP: Bug 1727084 - Memory64 - Test cases and testing code → Bug 1727084 - Memory64 - Test cases and testing code. r?yury
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5315e548b651
Memory64 - Huge-memory status depends on index type. r=yury
https://hg.mozilla.org/integration/autoland/rev/63ce829d63b4
Memory64 - Preliminaries. r=yury
https://hg.mozilla.org/integration/autoland/rev/d13d8c76693a
Memory64 - Allow larger-than-4GB allocations. r=yury
https://hg.mozilla.org/integration/autoland/rev/359e414a1d7f
Memory64 - Expose the index type via js-types. r=yury
https://hg.mozilla.org/integration/autoland/rev/b9d32ef0ad83
Memory64 - Bulk memory operations. r=yury
https://hg.mozilla.org/integration/autoland/rev/6089b4360edc
Memory64 - Non-atomic-RMW baseline operations. r=yury
https://hg.mozilla.org/integration/autoland/rev/1ab8383d17ee
Memory64 - Atomic-rmw baseline operations. r=yury
https://hg.mozilla.org/integration/autoland/rev/27db0e6a7010
Memory64 - Ion operations. r=yury
https://hg.mozilla.org/integration/autoland/rev/25456db35c17
Memory64 - Test cases and testing code. r=yury

That was a weird bug after so many try runs, but just a header file missing.

Flags: needinfo?(lhansen)
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/83e52246d0ea
Memory64 - Huge-memory status depends on index type. r=yury
https://hg.mozilla.org/integration/autoland/rev/339e37a04ca1
Memory64 - Preliminaries. r=yury
https://hg.mozilla.org/integration/autoland/rev/caca657178e4
Memory64 - Allow larger-than-4GB allocations. r=yury
https://hg.mozilla.org/integration/autoland/rev/b658cfe4b173
Memory64 - Expose the index type via js-types. r=yury
https://hg.mozilla.org/integration/autoland/rev/13ee9674ee35
Memory64 - Bulk memory operations. r=yury
https://hg.mozilla.org/integration/autoland/rev/fb02656bb788
Memory64 - Non-atomic-RMW baseline operations. r=yury
https://hg.mozilla.org/integration/autoland/rev/44b0c0bed8a6
Memory64 - Atomic-rmw baseline operations. r=yury
https://hg.mozilla.org/integration/autoland/rev/3e40bdd11ab5
Memory64 - Ion operations. r=yury
https://hg.mozilla.org/integration/autoland/rev/80388e7f335c
Memory64 - Test cases and testing code. r=yury
Regressions: 1736430
Regressions: 1736492
Regressions: 1736544
Regressions: 1736971
You need to log in before you can comment on or make changes to this bug.