ARM: Adjust stack pointer at return

Xerxes Rånby xerxes at zafena.se
Thu Jan 19 06:29:07 PST 2012


2012-01-19 13:19, Andrew Haley skrev:
> I moved the safepoint code so that it executes before popping
> the stack at a return instruction.  However, I didn't allow for
> the fact that this requires a stack pointer adjustment in the
> safepoint code.
> 
> Andrew.

OK!

This fixed the safepoint/gc unreachable, stack corruption, bug seen on the armv7 armel buildbot.
#  Internal Error (frame_zero.inline.hpp:64), pid=18861, tid=1677345904
#  Error: ShouldNotReachHere()

When re-testing with this fix applied then "make check-langtools" pass on armv7 armel
Test results: passed: 1,417
I am in favour for this fix to go into icedtea6 HEAD and icedtea6-1.11 release branch.

Xerxes

> 
> 
> 2012-01-19  Andrew Haley  <aph at redhat.com>
> 
> 	* openjdk-ecj/hotspot/src/cpu/zero/vm/thumb2.cpp
> 	(Thumb2_Safepoint): Add comment.
> 	(Thumb2_Return): Pass stackdepth to Thumb2_Safepoint.
> 	(Thumb2_codegen): Pass stackdepth to Thumb2_Return.
> 
> diff -r 876219858298 -r 7783ee7c13b2 arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp
> --- a/arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp	Wed Jan 18 12:03:17 2012 +0000
> +++ b/arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp	Thu Jan 19 07:16:03 2012 -0500
> @@ -4354,6 +4354,10 @@
>    ldr_imm(jinfo->codebuf, r_tmp, r_tmp, 0, 0, 0);
>    cmp_imm(jinfo->codebuf, r_tmp, SafepointSynchronize::_synchronizing);
>    {
> +    // FIXME: If we are at a return instruction there is no point
> +    // saving and restoring locals: no-one cares about them any more
> +    // and we could safely ignore them.  However, this generic
> +    // safepoint code also handles branches within a method.
>      unsigned loc = forward_16(jinfo->codebuf);
>    Thumb2_save_locals(jinfo, stackdepth);
>      mov_imm(jinfo->codebuf, ARM_R1, bci+CONSTMETHOD_CODEOFFSET);
> @@ -4402,9 +4406,9 @@
>      return -1;
>  }
> 
> -void Thumb2_Return(Thumb2_Info *jinfo, unsigned opcode, int bci)
> -{
> -  Thumb2_Safepoint(jinfo, 0, bci);
> +void Thumb2_Return(Thumb2_Info *jinfo, unsigned opcode, int bci, int stackdepth)
> +{
> +  Thumb2_Safepoint(jinfo, stackdepth, bci);
> 
>    Reg r_lo, r;
>    Thumb2_Stack *jstack = jinfo->jstack;
> @@ -6358,7 +6362,7 @@
>        case opc_ireturn:
>        case opc_freturn:
>        case opc_areturn:
> -	Thumb2_Return(jinfo, opcode, bci);
> +	Thumb2_Return(jinfo, opcode, bci, stackdepth);
>  	if (!jinfo->compiled_return) jinfo->compiled_return = bci;
>  	break;
> 
> @@ -6393,7 +6397,7 @@
>  	it(jinfo->codebuf, COND_NE, IT_MASK_T);
>  	bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION]);
>  	bcc_patch(jinfo->codebuf, COND_EQ, loc_eq);
> -	Thumb2_Return(jinfo, opc_return, bci);
> +	Thumb2_Return(jinfo, opc_return, bci, stackdepth);
>  	break;
>        }
> 
> 




More information about the distro-pkg-dev mailing list