Open Bug 1329576 Opened 3 years ago Updated 4 months ago

Wasm baseline: On platforms with HeapReg, always use known-constant heap address as offset


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






(Reporter: lth, Unassigned)


(Blocks 1 open bug)


Bug 1316831 recognizes constant heap addresses and folds any offset into the pointer, leaving a (frequently non-bounds-checked) access via the known address.  On architectures with a HeapReg (every platform except x86) we may be able to use this known address as an offset immediate for the load or store instruction itself.  On x64, which has large immediates, this will always be possible; on other platforms, only if the immediate is fairly small or has certain forms.  But in the worst case on those platforms we'll fall back to loading the address into a temp, which is no worse (and probably better) than the current situation.

(Even on x86 this may yield some improvements, since the known address may be embeddable in the patched heap pointer.  TBD.)

This is an instruction-selection micro-optimization, we should hold off on it until we've completed any work we'll do on bounds check elimination.  Bug 1313576 tracks remaining work on that.
Actually, on x64, displacement immediates are only 4 bytes (even for 64-bit accesses) so you'd need a two-instruction mov-immediate64;load to handle the full 64-bit address space.  On x86, though, you can hit the whole 32-bit address space with one 4-byte immediate.
Priority: -- → P5
Per policy at If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Closed: Last year
Resolution: --- → INACTIVE
Resolution: INACTIVE → ---
Component: JavaScript Engine: JIT → Javascript: Web Assembly
Type: defect → enhancement
You need to log in before you can comment on or make changes to this bug.