ARM: Enable safepoints for JIT-compiled code

Andrew Haley aph at redhat.com
Tue Jan 10 09:15:29 PST 2012


On 01/10/2012 05:11 PM, Xerxes Rånby wrote:
> 2012-01-10 15:31, Andrew Haley skrev:
>> I've found the bug that broke safepoints.  It turns out that safepoints
>> do not convert a PC address to a bytecode index, so you have to set the
>> bytecode pointer explicitly whenever at a safepoint.  I'm intend to apply
>> this to trunk and branch, given RM approval.
>>
>> Andrew.
> 
> Thank you for making the garbage collector happy.
> one question and one suggestion inline below:
> 
>>
>> 2012-01-09  Andrew Haley  <aph at redhat.com>
> ...
>>
>> 	* arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S
>> 	(method_entry_freq_count_overflow): Make sure self_link is set
>> 	when re-entering JIT-compiled code.
> 
>> diff -r 4d6b4215b78f -r 57ae0e361acf arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S
>> --- a/arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S	Thu Dec 22 11:54:40 2011 -0500
>> +++ b/arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S	Mon Jan 09 13:34:27 2012 -0500
>> @@ -3371,6 +3371,7 @@
>>  #ifdef THUMB2EE
>>  #define THUMB2_MAXLOCALS 1000
>>  call_thumb2:
>> +	str	istate, [istate, #ISTATE_SELF_LINK]
> 
> What makes the self-link un-set?

I have no idea.  There are so many paths into compiled code, and not
all of them set it.

>> @@ -4342,9 +4346,8 @@
>>
>>  // Insert code to poll the SafepointSynchronize state and call
>>  // Helper_SafePoint.
>> -void Thumb2_Safepoint(Thumb2_Info *jinfo, int stackdepth)
>> -{
>> -#if 0  // Causes maysterious segfaults
>> +void Thumb2_Safepoint(Thumb2_Info *jinfo, int stackdepth, int bci)
>> +{
>>    Thumb2_Flush(jinfo);
>>    int r_tmp = Thumb2_Tmp(jinfo, 0);
>>    mov_imm(jinfo->codebuf, r_tmp, (u32)SafepointSynchronize::address_of_state());
>> @@ -4353,11 +4356,11 @@
>>    {
>>      unsigned loc = forward_16(jinfo->codebuf);
>>    Thumb2_save_locals(jinfo, stackdepth);
>> +    mov_imm(jinfo->codebuf, ARM_R1, bci+CONSTMETHOD_CODEOFFSET);
> 
> Can we improve this part and calculate bci+CONSTMETHOD_CODEOFFSET+METHOD_CONSTMETHOD here?

No.  METHOD_CONSTMETHOD is an offset into the method structure;
it's not added to the bci.

>> @@ -7742,11 +7746,20 @@
>>  // H_SAFEPOINT
>>    handlers[H_SAFEPOINT] = out_pos(&codebuf);
>>    stm(&codebuf, (1<<ARM_LR), ARM_SP, PUSH_FD, 1);
>> +
>> +  // Set up BytecodeInterpreter->_bcp for the GC
>> +  // bci+CONSTMETHOD_CODEOFFSET is passed in ARM_R1
>> +  ldr_imm(&codebuf, ARM_R0, Ristate, ISTATE_METHOD, 1, 0);
> 
>> +  ldr_imm(&codebuf, ARM_R0, ARM_R0, METHOD_CONSTMETHOD, 1, 0);
>> +  add_reg(&codebuf, ARM_R0, ARM_R0, ARM_R1);
> 
> since METHOD_CONSTMETHOD are constant and generaded by the asm_helper
> can we move this ldr_imm and add_reg to the Thumb2_Safepoint c++ function?

No, as above.

Andrew.




More information about the distro-pkg-dev mailing list