RFA: Exhume the ARM port [PR icedtea/484, 323]
Andrew Haley
aph at redhat.com
Tue Oct 25 04:25:35 PDT 2011
This is what I'm testing:
diff -r 13009e3bdf2c arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S
--- a/arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S Thu Oct 20 16:14:29 2011 +0100
+++ b/arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S Tue Oct 25 07:24:18 2011 -0400
@@ -914,7 +914,8 @@
ALIGN_CODE
native_entry:
stmfd arm_sp!, {regset, lr}
- bl fast_native_entry
+ bl fast_native_entry
+ mov r0, #0 @ deoptimized_frames = 0
ldmia sp!, {regset, pc}
ALIGN_CODE
@@ -972,6 +973,7 @@
blt .fast_native_entry_throw_stack_overflow
cmp r5, #0
bne .fast_native_entry_got_handleraddr
+ str r5, [r9, #THREAD_LAST_JAVA_SP] @ r5 is zero at this point
str r0, [r9, #THREAD_LAST_JAVA_FP]
ldr r0, [r9, #THREAD_JAVA_SP]
str r0, [r9, #THREAD_LAST_JAVA_SP]
@@ -980,8 +982,8 @@
bl _ZN18InterpreterRuntime19prepare_native_callEP10JavaThreadP13methodOopDesc
ldr r11, [r9, #THREAD_TOP_ZERO_FRAME]
ldr r1, [r9, #THREAD_PENDING_EXC]
- str r5, [r9, #THREAD_LAST_JAVA_FP] @ r5 is zero at this point
- str r5, [r9, #THREAD_LAST_JAVA_SP]
+ str r5, [r9, #THREAD_LAST_JAVA_SP] @ r5 is zero at this point
+ str r5, [r9, #THREAD_LAST_JAVA_FP]
ldr r5, [r9, #THREAD_JAVA_SP]
str r5, [r9, #THREAD_LAST_JAVA_SP]
ldr r11, [r11, #-72 + ISTATE_METHOD]
@@ -994,6 +996,7 @@
bne .fast_native_entry_get_handler
ldr r3, [r9, #THREAD_TOP_ZERO_FRAME]
mov r2, #0
+ str r2, [r9, #THREAD_LAST_JAVA_SP]
mov r0, r9
str r3, [r9, #THREAD_LAST_JAVA_FP]
ldr r3, [r9, #THREAD_JAVA_SP]
@@ -1153,6 +1156,9 @@
ldr r0, [r9, #THREAD_TOP_ZERO_FRAME]
mov r2, #_thread_in_native
+ mov ip, #0
+ str ip, [r9, #THREAD_LAST_JAVA_SP]
+
str r0, [r9, #THREAD_LAST_JAVA_FP]
str r2, [r9, #THREAD_STATE]
@@ -1233,6 +1239,7 @@
fsts s1, [r5, #-4]
add r5, #-8
str r5, [r9, #THREAD_JAVA_SP]
+ mov r0, #0 @ deoptimized_frames = 0
ldmfd arm_sp!, {fast_regset, pc}
.fast_native_return_float:
fsts s0, [r5, #-4]
@@ -1240,6 +1247,7 @@
str tmp1, [ip, #JNIHANDLEBLOCK_TOP]
add r5, #-4
str r5, [r9, #THREAD_JAVA_SP]
+ mov r0, #0 @ deoptimized_frames = 0
ldmfd arm_sp!, {fast_regset, pc}
#endif
.fast_native_return_dw:
@@ -1256,6 +1264,7 @@
str tmp1, [ip, #JNIHANDLEBLOCK_TOP]
str r0, [r5, #-4]!
str r5, [r9, #THREAD_JAVA_SP]
+ mov r0, #0 @ deoptimized_frames = 0
ldmfd arm_sp!, {fast_regset, pc}
.fast_native_return_char:
mov r0, r0, lsl #16
@@ -1264,6 +1273,7 @@
str tmp1, [ip, #JNIHANDLEBLOCK_TOP]
str r0, [r5, #-4]!
str r5, [r9, #THREAD_JAVA_SP]
+ mov r0, #0 @ deoptimized_frames = 0
ldmfd arm_sp!, {fast_regset, pc}
.fast_native_return_bool:
ands r0, r0, #255
@@ -1272,6 +1282,7 @@
str tmp1, [ip, #JNIHANDLEBLOCK_TOP]
str r0, [r5, #-4]!
str r5, [r9, #THREAD_JAVA_SP]
+ mov r0, #0 @ deoptimized_frames = 0
ldmfd arm_sp!, {fast_regset, pc}
.fast_native_return_obj:
cmp r0, #0
@@ -1280,6 +1291,7 @@
str lr, [r9, #THREAD_TOP_ZERO_FRAME]
str tmp1, [ip, #JNIHANDLEBLOCK_TOP]
str r5, [r9, #THREAD_JAVA_SP]
+ mov r0, #0 @ deoptimized_frames = 0
ldmfd arm_sp!, {fast_regset, pc}
.fast_native_return_short:
mov r0, r0, lsl #16
@@ -1291,6 +1303,7 @@
str tmp1, [ip, #JNIHANDLEBLOCK_TOP]
.fast_native_exit:
str r5, [r9, #THREAD_JAVA_SP]
+ mov r0, #0 @ deoptimized_frames = 0
ldmfd arm_sp!, {fast_regset, pc}
.fast_native_entry_throw_stack_overflow:
@@ -1605,6 +1618,7 @@
mov lr, pc
ldr pc, [tmp1]
+ mov r0, #0 @ deoptimized_frames = 0
ldmfd arm_sp!, {fast_regset, pc}
#endif // THUMB2EE
@@ -2224,12 +2238,13 @@
str r3, [istate, #ISTATE_STACK_LIMIT]
str r0, [r1, #4]
ldr r1, [istate, #ISTATE_THREAD]
- @ I think this is right, but I do not know why monitorenter needs
- @ to save the FP at this point.
- ldr r3, [r1, #THREAD_JAVA_SP]
- str r3, [r1, #THREAD_LAST_JAVA_SP]
+
+ str r0, [r1, #THREAD_LAST_JAVA_SP] @ set SP to zero before setting FP
ldr r3, [r1, #THREAD_TOP_ZERO_FRAME]
str r3, [r1, #THREAD_LAST_JAVA_FP]
+ ldr r3, [r1, #THREAD_JAVA_SP]
+ str r3, [r1, #THREAD_LAST_JAVA_SP]
+
CACHE_STACK
ldr sl, [istate, #ISTATE_STACK_BASE]
ldr r3, [stack, #4]
@@ -2634,7 +2649,11 @@
add r0, r0, ip
str tmp_vvv, [tmp1, #THREAD_TOP_ZERO_FRAME]
@ CACHE_JPC
+ mov r2, #0 @ set SP to zero before setting FP
+ str r2, [tmp1, #THREAD_LAST_JAVA_SP]
str tmp_vvv, [tmp1, #THREAD_LAST_JAVA_FP]
+ ldr r3, [tmp1, #THREAD_JAVA_SP]
+ str r3, [tmp1, #THREAD_LAST_JAVA_SP]
add dispatch, r1, r0
ldr r0, [istate, #ISTATE_METHOD]
ldr r3, [r0, #METHOD_ACCESSFLAGS]
@@ -2779,8 +2798,8 @@
ldr ip, [tmp2, #METHOD_FROM_INTERPRETED]
mov r1, #0
str ip, [istate, #36]
+ str r1, [tmp1, #THREAD_LAST_JAVA_FP]
str r1, [tmp1, #THREAD_LAST_JAVA_SP]
- str r1, [tmp1, #THREAD_LAST_JAVA_FP]
add stack, stack, #4
str stack, [tmp1, #THREAD_JAVA_SP]
@@ -2808,13 +2827,12 @@
ldr r2, [istate, #ISTATE_STACK_LIMIT]
sub stack, stack, #4
-
- ldr r1, [ip, #THREAD_JAVA_SP]
+ mov r1, #0
str r1, [ip, #THREAD_LAST_JAVA_SP]
ldr r1, [ip, #THREAD_TOP_ZERO_FRAME]
+ str r1, [ip, #THREAD_LAST_JAVA_FP]
add r2, r2, #4
str r2, [ip, #THREAD_JAVA_SP]
- str r1, [ip, #THREAD_LAST_JAVA_FP]
DISPATCH_START 5
ldr r3, [ip, #4]
DISPATCH_NEXT
@@ -2962,6 +2980,7 @@
ldr r1, [ip, #THREAD_TOP_ZERO_FRAME]
add r2, r2, #4
+ mov r3, #0
str r2, [ip, #THREAD_JAVA_SP]
str r1, [ip, #THREAD_LAST_JAVA_FP]
str r2, [ip, #THREAD_LAST_JAVA_SP]
@@ -3127,6 +3146,8 @@
ldr constpool, [constpool, #CONSTANTPOOL_CACHE]
str ip, [tmp1, #THREAD_TOP_ZERO_FRAME]
USEC ldr r3, [r10, #METHOD_INVOCATIONCOUNTER]
+ mov r1, #0
+ str r1, [tmp1, #THREAD_LAST_JAVA_SP]
str ip, [tmp1, #THREAD_LAST_JAVA_FP]
ldr ip, [tmp1, #THREAD_JAVA_SP]
str ip, [tmp1, #THREAD_LAST_JAVA_SP]
@@ -3233,19 +3254,23 @@
@ ----------------------------------------------------------------------------------------
stack_overflow_no_frame:
mov r0, tmp1
- ldr ip, [r0, #THREAD_JAVA_SP]
+ mov ip, #0
str ip, [r0, #THREAD_LAST_JAVA_SP]
ldr ip, [r0, #THREAD_TOP_ZERO_FRAME]
str ip, [r0, #THREAD_LAST_JAVA_FP]
+ ldr ip, [r0, #THREAD_JAVA_SP]
+ str ip, [r0, #THREAD_LAST_JAVA_SP]
bl _ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
ldmfd arm_sp!, {regset, pc}
stack_overflow_before_frame:
mov r0, tmp1
- ldr ip, [r0, #THREAD_JAVA_SP]
+ mov ip, #0
str ip, [r0, #THREAD_LAST_JAVA_SP]
ldr ip, [r0, #THREAD_TOP_ZERO_FRAME]
str ip, [r0, #THREAD_LAST_JAVA_FP]
+ ldr ip, [r0, #THREAD_JAVA_SP]
+ str ip, [r0, #THREAD_LAST_JAVA_SP]
bl _ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
ldmfd arm_sp!, {fast_regset, pc}
@@ -5210,9 +5235,11 @@
ldr r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
add r2, r2, #4
+ ldr r0, #0
+ str r0, [Rthread, #THREAD_LAST_JAVA_SP]
str r2, [Rthread, #THREAD_JAVA_SP]
+ str r1, [Rthread, #THREAD_LAST_JAVA_FP]
str r2, [Rthread, #THREAD_LAST_JAVA_SP]
- str r1, [Rthread, #THREAD_LAST_JAVA_FP]
ldr r3, [Rthread, #4]
cmp r3, #0
bne istub_exception
@@ -5329,12 +5356,13 @@
ldr stack, [Rthread, #THREAD_JAVA_SP]
ldr r2, [istate, #ISTATE_STACK_LIMIT]
- ldr r1, [Rthread, #THREAD_JAVA_SP]
- str r1, [Rthread, #THREAD_LAST_JAVA_SP]
+ ldr r0, #0
+ str r0, [Rthread, #THREAD_LAST_JAVA_SP]
ldr r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
add r2, r2, #4
str r2, [Rthread, #THREAD_JAVA_SP]
str r1, [Rthread, #THREAD_LAST_JAVA_FP]
+ str r2, [Rthread, #THREAD_LAST_JAVA_SP]
ldr r3, [Rthread, #4]
cmp r3, #0
bne istub_exception
@@ -5399,12 +5427,15 @@
ldr r1, [Rthread, #THREAD_TOP_ZERO_FRAME]
add r2, r2, #4
+ mov r3, #0
+ str r3, [Rthread, #THREAD_LAST_JAVA_SP]
+ str r1, [Rthread, #THREAD_LAST_JAVA_FP]
str r2, [Rthread, #THREAD_JAVA_SP]
str r2, [Rthread, #THREAD_LAST_JAVA_SP]
- str r1, [Rthread, #THREAD_LAST_JAVA_FP]
ldr r3, [Rthread, #4]
cmp r3, #0
bne istub_exception
+ mov r0, #0
ldmia sp!, {ip, pc}
isstub_resolve:
@@ -6565,9 +6596,13 @@
Thumb2_Stack_Overflow:
mov r0, r2
+ mov r2, #0
+ str r2, [r0, #THREAD_LAST_JAVA_SP]
ldr ip, [r0, #THREAD_TOP_ZERO_FRAME]
- str ip, [r0, #THREAD_LAST_JAVA_SP]
+ ldr r2, [r0, #THREAD_JAVA_SP]
+ str r2, [r0, #THREAD_LAST_JAVA_SP]
bl _ZN18InterpreterRuntime24throw_StackOverflowErrorEP10JavaThread
+ mov r0, #0
ldmfd arm_sp!, {fast_regset, pc}
.global Thumb2_Exit_To_Interpreter
diff -r 13009e3bdf2c arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp
--- a/arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp Thu Oct 20 16:14:29 2011 +0100
+++ b/arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp Tue Oct 25 07:24:18 2011 -0400
@@ -4670,7 +4670,10 @@
str_imm(jinfo->codebuf, Ristate, Ristate, ISTATE_MONITOR_BASE, 1, 0);
add_imm(jinfo->codebuf, ARM_R3, Ristate, ISTATE_NEXT_FRAME);
- str_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_TOP_ZERO_FRAME, 1, 0);
+
+ mov_imm(jinfo->codebuf, ARM_LR, 0); // set last SP to zero before
+ // setting FP
+ str_imm(jinfo->codebuf, ARM_LR, ARM_R2, THREAD_LAST_JAVA_SP, 1, 0);
str_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_LAST_JAVA_FP, 1, 0);
ldr_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_JAVA_SP, 1, 0);
str_imm(jinfo->codebuf, ARM_R3, ARM_R2, THREAD_LAST_JAVA_SP, 1, 0);
@@ -5889,9 +5892,14 @@
ldr_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_TOP_ZERO_FRAME, 1, 0);
add_imm(jinfo->codebuf, ARM_R2, ARM_R2, 4);
ldr_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_PENDING_EXC, 1, 0);
+
+ mov_imm(jinfo->codebuf, ARM_LR, 0); // set last SP to zero
+ // before setting FP
+ str_imm(jinfo->codebuf, ARM_LR, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
+ str_imm(jinfo->codebuf, ARM_R3, Rthread, THREAD_LAST_JAVA_FP, 1, 0);
str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_JAVA_SP, 1, 0);
str_imm(jinfo->codebuf, ARM_R2, Rthread, THREAD_LAST_JAVA_SP, 1, 0);
- str_imm(jinfo->codebuf, ARM_R1, Rthread, THREAD_LAST_JAVA_FP, 1, 0);
+
cmp_imm(jinfo->codebuf, ARM_R3, 0);
it(jinfo->codebuf, COND_NE, IT_MASK_T);
bl(jinfo->codebuf, handlers[H_HANDLE_EXCEPTION_NO_REGS]);
diff -r 13009e3bdf2c patches/arm.patch
--- a/patches/arm.patch Thu Oct 20 16:14:29 2011 +0100
+++ b/patches/arm.patch Tue Oct 25 07:24:18 2011 -0400
@@ -78,7 +78,7 @@
+ def(_dmac, "dmac", "b_", NULL, T_DOUBLE, -16, false, _dmul);
+
+ def(_iload_iload, "iload_iload", "bi_i",NULL, T_INT, 2, false, _iload);
-+ def(_iload_iload_N, "ilaod_iload_N", "bi_", NULL, T_INT, 2, false, _iload);
++ def(_iload_iload_N, "iload_iload_N", "bi_", NULL, T_INT, 2, false, _iload);
+
+ def(_iload_0_iconst_N, "iload_0_iconst_N", "b_", NULL, T_INT, 2, false, _iload_0);
+ def(_iload_1_iconst_N, "iload_1_iconst_N", "b_", NULL, T_INT, 2, false, _iload_1);
More information about the distro-pkg-dev
mailing list