IonMonkey: Use push & pop for saveLive and restoreLive.

RESOLVED DUPLICATE of bug 871811

Status

()

Core
JavaScript Engine
RESOLVED DUPLICATE of bug 871811
5 years ago
5 years ago

People

(Reporter: nbp, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Unexpected calls have to be surrounded by saveLive & restoreLive to save all live register and restore all live register.  This is the case of side-effect free operations such as math functions, and also the case of out-of-line VM calls, etc.

Currently, for a simple out of line VM call we will produce something like:

                        ; saveLive {
   0x7fffeee881a4:      sub    $0x40,%rsp
   0x7fffeee881a8:      mov    %r9,0x38(%rsp)
   0x7fffeee881ad:      mov    %r8,0x30(%rsp)
   0x7fffeee881b2:      mov    %rdi,0x28(%rsp)
   0x7fffeee881b7:      mov    %rsi,0x20(%rsp)
   0x7fffeee881bc:      mov    %rbp,0x18(%rsp)
   0x7fffeee881c1:      mov    %rbx,0x10(%rsp)
   0x7fffeee881c6:      mov    %rcx,0x8(%rsp)
   0x7fffeee881cb:      mov    %rax,(%rsp)
                        ; }
                        ; pushArg(…)
   0x7fffeee881cf:      push   %rbx
                        ; pushArg(…)
   0x7fffeee881d0:      pushq  $0x8
                        ; push(descriptor)
   0x7fffeee881d5:      pushq  $0x5c0
                        ; call(vmwrapper)
   0x7fffeee881da:      callq  0x7ffff7fbab08
                        ; storeValueTo(rdx)
   0x7fffeee881df:      mov    %rcx,%rdx
                        ; restoreLiveIgnore(rdx) {
   0x7fffeee881e2:      mov    0x38(%rsp),%r9
   0x7fffeee881e7:      mov    0x30(%rsp),%r8
   0x7fffeee881ec:      mov    0x28(%rsp),%rdi
   0x7fffeee881f1:      mov    0x20(%rsp),%rsi
   0x7fffeee881f6:      mov    0x18(%rsp),%rbp
   0x7fffeee881fb:      mov    0x10(%rsp),%rbx
   0x7fffeee88200:      mov    0x8(%rsp),%rcx
   0x7fffeee88205:      mov    (%rsp),%rax
   0x7fffeee88209:      add    $0x40,%rsp
                        ; }

At the moment these functions are shifting the stack pointer and writing at locations reserved by moving the stack pointer.  These blocks of instructions can be replaced by smaller one by using push & pop instructions in the same order as the current moves.
Hello, 
Yesterday I have take a look to the bug, and I'm wondering if I have just to replace storeDouble and storePtr (store32) to fix it or what else ?
Thanks
It seems that storing is implemented diffrently for every architecture I guess I should consider this
saveLive/restoreLiveIgnore use PushRegsInMask/PopRegsInMaskIgnore, so it looks like the patch in bug 871811 would fix this.
(In reply to Dan Gohman from comment #3)
> saveLive/restoreLiveIgnore use PushRegsInMask/PopRegsInMaskIgnore, so it
> looks like the patch in bug 871811 would fix this.

indeed.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 871811
You need to log in before you can comment on or make changes to this bug.