Open Bug 856493 Opened 11 years ago Updated 2 years ago

IonMonkey: Spill double registers before general purpose registers on the stack

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

People

(Reporter: nrc, Unassigned)

References

Details

Attachments

(3 files)

For relative addressing on ARM, integers can be addressed over a much longer range than doubles. By putting doubles on the stack, before ints we increase the number of registers we can address in a single instruction. Should be optional do to this, rather than the current first come first served spilling.
I am not sure to understand what you mean precisely, are you suggesting to spill Values first, as they occupy 2 registers instead of one?

Doubles are stored in other registers, and I don't see how spilling doubles might help unless you are referring to spilling int registers to double registers.
(In reply to Nicolas B. Pierron [:nbp] from comment #1)
> I am not sure to understand what you mean precisely, are you suggesting to
> spill Values first, as they occupy 2 registers instead of one?
>

No, I am suggesting spilling the double registers before the int regsiters. Before in terms of the stack frame ordering.
 
> Doubles are stored in other registers, and I don't see how spilling doubles
> might help unless you are referring to spilling int registers to double
> registers.

It helps because the ARM instruction to read a double from memory has less bits available to use as an offset than the int equivalent. So, by storing doubles closer to the stack pointer, we increase the chances of being able to identify them using the offset and thus loading them in a single instruction instead of two or more.
Attached patch WIP part 1Splinter Review
Attached patch WIP part 2Splinter Review
Attached patch WIP patch 3Splinter Review
Sorry I've been a bit quiet on this - I did a bunch of work, then dropped the ball when other work got too busy. I attached the patches I did, they are rought WIP and pretty old so I bet they are well bit-rotted. Not sure if there is anything worth salvaging or how difficult it would be to make this approach work.

The approach is to use an LStackSlot rather than an int to represent a slot on the stack. Then when we have done generating code (and know how many doubles we need to make space for) we go back and reify the abstract slots into concrete offsets (like they were before this work). One problem with this is we don't keep a list of all uses of stack slots, so we have to add a loop which iterates over every operand in every instruction, which is a large overhead. I did some work so we could avoid this work for x86 builds and only do it for ARM, but it would still some extra time to code generation. However, the big problem I had is that it didn't work and I couldn't work out why. Because the slots were ints before, it is impossible to do a search or to get any compiler help so I am not sure I changed everywhere I needed to change. There might be other bugs too - I was failing tests, but couldn't work out why for the life of me.

Maybe someone who knows the register allocator better might be able to make more headway with this, but I think it is too difficult for me to do in a sane amount of time.
Assignee: ncameron → general
Assignee: general → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: