destroysCallerSavedRegisters and register reference map in DebugInfo
Christian Thalinger
christian.thalinger at oracle.com
Thu Jul 25 09:07:38 PDT 2013
Yes, thanks, Christian, for summing it up here. I'm not sure yet how I get to callKillsRegisters; I might have to store it somewhere else. With having a register reference map the allocations are good now.
-- Chris
On Jul 25, 2013, at 12:59 AM, Doug Simon <doug.simon at oracle.com> wrote:
> Thanks Christian. I wasn't too sure about the right solution to handle SPARC correctly. We never got the SPARC backend done for C1X in Maxine so this is new territory for Graal.
>
> -Doug
>
> On Jul 25, 2013, at 4:03 AM, Christian Wimmer <christian.wimmer at oracle.com> wrote:
>
>> [summary of a chat with Chris today]
>>
>>>> Quick question about this code in LinearScan:
>>>>
>>>> private void computeDebugInfo(IntervalWalker iw, final LIRInstruction op, LIRFrameState info) {
>>>> BitSet registerRefMap = op.destroysCallerSavedRegisters() ? null : frameMap.initRegisterRefMap();
>>>> BitSet frameRefMap = frameMap.initFrameRefMap();
>>>> computeOopMap(iw, op, registerRefMap, frameRefMap);
>>>>
>>>> Why are we not creating a register reference map if we destroy caller saved registers?
>>>
>>> Because all live registers will be spilled around the call and so there are no live values in registers during the call.
>>
>> This is only true for X86, not for SPARC.
>>
>>>> I'm having trouble with this logic on SPARC because computeOopMap wants to store a register in the map (a local register).
>>>
>>> Wouldn't we just ensure that op.destroysCallerSavedRegisters() returns false for all SPARC ops (given that local registers are never killed by a callee)?
>>
>> This does not work. destroysCallerSavedRegisters is the trigger in the register allocator to spill before a call: A short temporary life range is generated for every caller save register for every LIR instruction that returns true. If you return false, no register will be saved at the call site.
>>
>>>> Would there be a downside if we always would create and empty map and just pass it on except a little bit of overhead?
>>
>> For SPARC, are register reference map is needed for every call site.
>>
>> So instead of
>>
>> BitSet registerRefMap = op.destroysCallerSavedRegisters() ? null : frameMap.initRegisterRefMap();
>>
>> you need something like
>>
>> BitSet registerRefMap = op.destroysCallerSavedRegisters() && callKillsRegisters ? null : frameMap.initRegisterRefMap();
>>
>> callKillsRegisters is defined in the LinearScanWalker, so that information is not too far away
>>
>>
>> -Christian
>
More information about the graal-dev
mailing list