ARM: Adjust stack pointer at return
Andrew Haley
aph at redhat.com
Thu Jan 19 04:19:14 PST 2012
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.
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