Repository navigation
Add support for Memory64 in WebAssembly in IPInt Tier - #52155
webkit-commit-queue merged 1 commit into
Conversation
|
EWS run on previous version of this PR (hash 5673b2b) Details |
Constellation
left a comment
There was a problem hiding this comment.
Note that memory64 requires a lot of compiler work.
- You need to make wasm bound checking compiler code work for memory64
- Bound checking code has various optimizations in B3 compiler as well. So you need to update and/or add new optimizations to allow B3 compiler to remove these checks when possible.
- You need to ensure that fast memory is not used for memory64 since page fault based handling does not work
- You need to change wasm address calculation code for memory64 in all tiers since they have strong assumption that input is 32bit
5673b2b to
ddf4911
Compare
|
EWS run on previous version of this PR (hash ddf4911) Details |
ddf4911 to
68a4577
Compare
|
EWS run on previous version of this PR (hash 68a4577) Details |
68a4577 to
10b4aa5
Compare
|
EWS run on previous version of this PR (hash 10b4aa5) Details
|
10b4aa5 to
b0b7f9e
Compare
|
EWS run on previous version of this PR (hash b0b7f9e) Details |
b0b7f9e to
3712a5c
Compare
|
EWS run on previous version of this PR (hash 3712a5c) Details
|
3712a5c to
5497b4e
Compare
5497b4e to
92c2f24
Compare
|
EWS run on previous version of this PR (hash 92c2f24) Details
|
Constellation
left a comment
There was a problem hiding this comment.
We need to disable this via Options since it is not having BBQ and OMG.
92c2f24 to
b78edc8
Compare
|
EWS run on previous version of this PR (hash b78edc8) Details
|
| ipintOp(_i32_load_mem, macro() | ||
| # i32.load | ||
| # pop index | ||
| popMemoryIndex(t0, t2) | ||
| loadi IPInt::Const32Metadata::value[MC], t2 | ||
| loadMemoryOffsetAndAdvanceMC(t2, t3, t4) |
There was a problem hiding this comment.
indentation looks wonky; maybe tabs vs. spaces IDE thing?
b78edc8 to
e726370
Compare
|
EWS run on previous version of this PR (hash e726370) Details
|
| @@ -658,6 +658,7 @@ bool hasCapacityToUseLargeGigacage(); | |||
| v(Bool, useWasmSIMD, true, Normal, "Allow the new simd instructions and types from the wasm simd spec."_s) \ | |||
| v(Bool, useWasmRelaxedSIMD, false, Normal, "Allow the relaxed simd instructions and types from the wasm relaxed simd spec."_s) \ | |||
| v(Bool, useWasmTailCalls, true, Normal, "Allow the new instructions from the wasm tail calls spec."_s) \ | |||
| v(Bool, useWasmMemory64, false, Normal, "Allow the Memory64 proposal for WebAssembly. This feature is currently only supported in the IPInt tier."_s) \ | |||
There was a problem hiding this comment.
Drive-by comment: let's keep these sorted alphabetically for ease of future maintenance.
| { | ||
| WASM_RETURN_TWO(reinterpret_cast<void*>(Wasm::growMemory(instance, delta)), 0); | ||
| } | ||
|
|
||
| WASM_IPINT_EXTERN_CPP_DECL(memory_init, int32_t dataIndex, IPIntStackEntry* sp) | ||
| WASM_IPINT_EXTERN_CPP_DECL(memory_init, int64_t dataIndex, IPIntStackEntry* sp) |
There was a problem hiding this comment.
Does dataIndex need to be widened to int64_t? The proposal maintains dataidx as a u32, and downstream logic in Wasm::memoryInit() is unchanged.
There was a problem hiding this comment.
You're right. I updated it!
e726370 to
6cf5981
Compare
|
EWS run on previous version of this PR (hash 6cf5981) Details
|
6cf5981 to
aba3343
Compare
|
EWS run on previous version of this PR (hash aba3343) Details
|
aba3343 to
23b2bd5
Compare
|
EWS run on previous version of this PR (hash 23b2bd5) Details
|
kmiller68
left a comment
There was a problem hiding this comment.
r=me with some comments.
| loadb JSWebAssemblyInstance::m_cachedIsMemory64[wasmInstance], tmpReg | ||
| btiz tmpReg, .memory32 | ||
| loadq IPInt::Const64Metadata::value[MC], dstReg | ||
| loadb IPInt::Const64Metadata::instructionLength[MC], instrLenReg |
There was a problem hiding this comment.
Spacing seems off on this line?
| jmp .done | ||
| .memory32: | ||
| loadi IPInt::Const32Metadata::value[MC], dstReg | ||
| loadb IPInt::Const32Metadata::instructionLength[MC], instrLenReg |
| bool isShared = false; | ||
| PartialResult limits = parseResizableLimits(initial, maximum, isShared, LimitsType::Table); | ||
| bool isTable64; | ||
| PartialResult limits = parseResizableLimits<LimitsType::Table>(initial, maximum, isShared, isTable64); |
There was a problem hiding this comment.
Can we add an ASSERT(!isShared);
| if (!limits) [[unlikely]] | ||
| return makeUnexpected(WTFMove(limits.error())); | ||
| WASM_PARSER_FAIL_IF(isShared && !maximum, "shared memory must have a maximum size"_s); |
There was a problem hiding this comment.
We should keep this in parseResizableLimits since when wasm inevitably adds shared tables this requirement will be required there too.
| @@ -0,0 +1,63 @@ | |||
| //@ skip if $addressBits <= 32 | |||
| //@ runDefaultWasm("-m", "--useJIT=0", "--useWasmMemory64=1") | |||
There was a problem hiding this comment.
Nit: These could be --useBBQJIT=0 for slightly more coverage.
23b2bd5 to
7041740
Compare
|
EWS run on current version of this PR (hash 7041740) Details
|
https://bugs.webkit.org/show_bug.cgi?id=300539 rdar://162406385 Reviewed by Keith Miller. This patch allows the WasmFunctionParser to accept 64 bit pointers while performing memory operations. This includes all the load and store operations, the bulk memory operations, and the size and grow operations. Test: JSTests/wasm/stress/load-and-store-with-64-bit-address.js * JSTests/wasm/stress/memory64-bulk-memory.js: Added. (async test): * JSTests/wasm/stress/memory64-grow-and-size.js: Added. (async test): (async testGrowByZero): (async testNoMaximum): (async testLargeGrowValue): * JSTests/wasm/stress/memory64-load-and-store.js: Added. (getWasmTypeWidth): (let.wat.module): (join): (async test): * Source/JavaScriptCore/llint/InPlaceInterpreter64.asm: * Source/JavaScriptCore/runtime/OptionsList.h: * Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.cpp: (JSC::Wasm::FunctionIPIntMetadataGenerator::addLEB128ConstantInt64AndLength): * Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h: * Source/JavaScriptCore/wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParser<Context>::load): (JSC::Wasm::FunctionParser<Context>::store): (JSC::Wasm::FunctionParser<Context>::parseExpression): (JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression): * Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp: (JSC::Wasm::IPIntGenerator::load): (JSC::Wasm::IPIntGenerator::store): * Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.cpp: (JSC::IPInt::WASM_IPINT_EXTERN_CPP_DECL): * Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.h: * Source/JavaScriptCore/wasm/WasmMemory.cpp: (JSC::Wasm::Memory::init): * Source/JavaScriptCore/wasm/WasmMemory.h: * Source/JavaScriptCore/wasm/WasmMemoryInformation.cpp: (JSC::Wasm::MemoryInformation::MemoryInformation): * Source/JavaScriptCore/wasm/WasmMemoryInformation.h: (JSC::Wasm::MemoryInformation::isMemory64 const): * Source/JavaScriptCore/wasm/WasmOperationsInlines.h: (JSC::Wasm::memoryInit): * Source/JavaScriptCore/wasm/WasmSectionParser.cpp: (JSC::Wasm::limitsFlagIsValid): (JSC::Wasm::SectionParser::parseResizableLimits): (JSC::Wasm::SectionParser::parseTableHelper): (JSC::Wasm::SectionParser::parseMemoryHelper): * Source/JavaScriptCore/wasm/WasmSectionParser.h: * Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.cpp: (JSC::JSWebAssemblyInstance::memoryInit): * Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h: Canonical link: https://commits.webkit.org/304075@main
7041740 to
26868df
Compare
|
Committed 304075@main (26868df): https://commits.webkit.org/304075@main Reviewed commits have been landed. Closing PR #52155 and removing active labels. |
🧪 ios-wk2
🧪 mac-AS-debug-wk2
26868df
7041740