Open Bug 1442544 Opened 3 years ago Updated 1 year ago

Wasm's OffsetGuardLimit and HugeMappedSize can potentially be much smaller on ARM64


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





(Reporter: lth, Unassigned)


(Blocks 1 open bug)


(Whiteboard: [arm64:m4])

ARM64 is configured with WASM_HUGE_MEMORY but probably does not need a 6GB+64KB reservation.  This requires some in-depth investigation of the memory access instructions on the platform, but LDR, which is likely typical, essentially has two reg+imm forms, one with a signed nine-bit offset (used for preindex/postindex) and one with an unsigned twelve-bit offset.  The offsets are scaled by 4 or 8, so effectively we're looking at twelve-bit signed or fifteen-bit unsigned offsets.

The main effect here would be to reduce pressure on the memory mappings; that might be beneficial as some operating systems have historically had fairly low per-process limits on the combined size of the mappings.

Other than that, a smaller OffsetGuardLimit would tend to move the code that folds in the offset from MacroAssembler / Assembler (where BaseIndex is resolved) and into the compiler (where we perform an add with overflow check).  Since large offsets will be handled in the MacroAssembler by moving a constant to a register and then performing a register+register load (without overflow checking per se but the arithmetic is performed in a 64-bit space so this is OK) it's probably more or less a wash, performance-wise - we could investigate.
Priority: -- → P3
Component: JavaScript Engine: JIT → Javascript: Web Assembly
Whiteboard: [arm64:m4]
Depends on: 1590305
Blocks: 1590305
No longer depends on: 1590305
You need to log in before you can comment on or make changes to this bug.