Closed Bug 897425 Opened 11 years ago Closed 5 years ago

Odinmonkey: consider hoisting the heap base pointer

Categories

(Core :: JavaScript: WebAssembly, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dougc, Unassigned)

References

(Blocks 1 open bug)

Details

The x86 currently uses an immediate constant for the heap base, and the x64 and ARM dedicate a register.  All heap access is currently relative to this heap base, taking advantage of instruction encoding support, but at the same time limiting the use of a range of instruction encodings for use by code.

It might be more efficient to hoist the heap base out of loops and add it to a pointer used within the loop.  For example see bug 895127.

Bounds checking and emulation of JS out-of-bounds array access might frustrate such attempts.  But perhaps there are some common patterns that could be handled by splitting the loop into sub-loops that deal with the different paths.

The use of high bit masking for safe heap access might also frustrate such attempts.  Aligning the heap base to the same alignment as the heap size might help.
Assignee: general → nobody
There was another bug similar to this with some discussion ??.

Hoisting the HeapBase+index started looking like more trouble than it was worth because the HeapBase needed to be subtracted back from this hoisted value when used in other ways and this could be common in a loop. It might work for some loops but it's rather fragile and probably a good deal of work to get it to work adequately.

Buffer-at-zero started looking much more attractive and avoids the need to do this optimization, and there are wip patches for x64 and ARM which could at least show best performance gain that the optimization in this bug might achieve.
(In reply to Douglas Crosher [:dougc] from comment #1)
> There was another bug similar to this with some discussion ??.

bug 984478
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
Status: RESOLVED → REOPENED
Resolution: INACTIVE → ---
Component: JavaScript Engine → Javascript: WebAssembly

Closing, bug 984478 mentions similar ideas, and I seem to recall that experimentation with letting the heap register in the hands of register allocation has been done and not proven fruitful.

Status: REOPENED → RESOLVED
Closed: 6 years ago5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.