Closed Bug 676389 Opened 13 years ago Closed 13 years ago

IonMonkey: Add a "COPY" policy to LUse

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dvander, Unassigned)

References

Details

Attachments

(2 files, 1 obsolete file)

We're starting to see a pattern where we need a temporary register that contains the value of a virtual register. For example, LBoxDouble on x86:

    const LAllocation *in = box->getOperand(0);
    const LDefinition *temp = box->getTemp(0);
    masm.movsd(ToFloatRegister(in), ToFloatRegister(temp));

If this is the last use of |in|, we can't re-use that register, and get:
      addsd      %xmm7, %xmm6
      movsd      %xmm6, %xmm7
      movd       %xmm7, %edx

This also came up for Hannes with LTableSwitch. I'm proposing a COPY policy for LUse which would either:
   (1) If this is the last use, use or allocate an existing register.
   (2) Otherwise, allocate a temporary register, and insert a move.

For the greedy allocator, this should be straightforward:
  * If last use, give register.
  * If no regs free, evict.
  * Otherwise, allocate reg and move.

Andrew, could you discuss what would be needed on the LSRA end?
I think the cleanest solution I can come up with for this would be kind of invasive. If the linear scan algorithm can tolerate "bogus" intervals which don't correspond to a use or a def, then when I see a COPY in liveness analysis I can just shove in a little interval that forces an interval split. For calls later, calls can inject a bunch of little fixed intervals that force splits for other spilled registers.
Attached patch refreshSplinter Review
Attachment #550533 - Attachment is obsolete: true
Adds support for the copy policy and does a substantial amount of refactoring -- hints need to be rerefactored, but that can be a separate issue.
Attachment #554249 - Flags: review?(dvander)
Attachment #554249 - Flags: review?(dvander) → review+
Attachment #553650 - Flags: review+
You need to log in before you can comment on or make changes to this bug.