1.6 changes to make ARM work with gcc 4.1
Edward Nevill
ed at camswl.com
Wed Aug 26 05:56:25 PDT 2009
Hi all,
Below is a patch which will make the ARM interpreter build with gcc-4.1
series.
I am not sure whether this should go in the 1.6 release or not. On the
one hand it is a shame it does not build with 4.1, on the other hand
very few people build with 4.1.
The basic change is to inline those functions which were causing unresolved
symbols on gcc 4.1. The reason the symbols were unresolved was that
gcc 4.1 inlined these functions whereas gcc 4.4 did not. Therefore
when the assembler tried to call these functions they were unresolved
because they had been inlined.
Later vsns of gcc seem to get around this by putting the inlined functions
in a .comdat section. This is then excluded by ld if it is not referenced.
The inlining I have done is pretty much a cut and paste from the gcc 4.4
output.
Note that since it is now no longer dependant on the GCC_VERSION I have
removed that.
I have also reduced the code and data alignment from 64 byte alignment
to 8 byte alignment as earlier binutils had problems with 64 byte alignment.
This was only a very minor performance optimisation anyway.
As I say, I am in two minds whether this should go in 1.6 or not. Your
opinions please.
Regards,
Ed.
--- CUT HERE---------------------------------------------------------------
diff -ruNE icedtea6-1.6.orig/ports/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S icedtea6-1.6/ports/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S
--- icedtea6-1.6.orig/ports/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S 2009-08-25 17:59:12.000000000 +0100
+++ icedtea6-1.6/ports/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S 2009-08-25 18:07:37.000000000 +0100
@@ -5,15 +5,6 @@
#define ARMv4
-#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-
-// ECN: DOH!!! gcc 4.4 has changed the name mangling scheme!!!
-#if GCC_VERSION >= 40400
-#define oop_store _Z9oop_storeIP7oopDescEvPT_S1_
-#else
-#define oop_store _Z9oop_storeIP7oopDescEvPVT_S1_
-#endif
-
#define stack r4
#define jpc r5
#define dispatch r6
@@ -174,15 +165,15 @@
#define last_implemented_bytecode 248
.macro ALIGN_CODE
- .align 6
+ .align 3
.endm
.macro ALIGN_DATA
- .align 6
+ .align 3
.endm
.macro ALIGN_OPCODE
- .align 6
+ .align 3
.endm
.macro ALIGN_WORD
@@ -399,6 +390,237 @@
.text
+is_subtype_of:
+ ldr r2, [r1, #16]
+ add ip, r0, r2
+ ldr ip, [ip, #-8]
+ cmp ip, r1
+ moveq r0, #1
+ bxeq lr
+ cmp r2, #20
+ movne r0, #0
+ bxne lr
+ b _ZNK5Klass23search_secondary_supersEP12klassOopDesc
+
+HandleC:
+ stmfd sp!, {r4, r5, r6, lr}
+ ldr r3, HandleC_adcons
+ subs r5, r1, #0
+ mov r4, r0
+.HandleC_pic:
+ add r3, pc, r3
+ streq r5, [r0, #0]
+ beq 2f
+ ldr r2, HandleC_adcons+4
+ ldr r3, [r3, r2]
+ ldr r0, [r3, #0]
+ bl pthread_getspecific
+ ldr r3, [r0, #148]
+ ldr r0, [r3, #8]
+ ldr r1, [r3, #12]
+ add r2, r0, #4
+ cmp r2, r1
+ strls r2, [r3, #8]
+ bhi 3f
+1:
+ str r5, [r0, #0]
+ str r0, [r4, #0]
+2:
+ mov r0, r4
+ ldmfd sp!, {r4, r5, r6, pc}
+3:
+ mov r0, r3
+ mov r1, #4
+ bl _ZN5Arena4growEj
+ b 1b
+HandleC_adcons:
+ .word _GLOBAL_OFFSET_TABLE_-(.HandleC_pic+8)
+ .word _ZN18ThreadLocalStorage13_thread_indexE(GOT)
+
+HandleMarkCleanerD:
+ stmfd sp!, {r4, r5, r6, lr}
+ ldr r3, [r0, #0]
+ mov r6, r0
+ ldr r4, [r3, #40]
+ ldr r0, [r4, #8]
+ ldr r5, [r4, #4]
+ ldr r3, [r0, #0]
+ cmp r3, #0
+ beq 1f
+ bl _ZN5Chunk9next_chopEv
+ ldr r0, [r4, #8]
+1:
+ str r0, [r5, #4]
+ mov r0, r6
+ ldr r3, [r4, #12]
+ str r3, [r5, #8]
+ ldr r3, [r4, #16]
+ str r3, [r5, #12]
+ ldmfd sp!, {r4, r5, r6, pc}
+
+cmpxchg_ptr:
+ stmfd sp!, {r4, r5, r6, r7, r8, lr}
+ mov r6, #0xffffffc0
+ mov r4, r2
+ mov r7, r0
+ mov r5, r1
+ bic r6, r6, #0xf000
+ mov r8, r2
+1:
+ ldr r3, [r5, #0]
+ mov r0, r4
+ mov r1, r7
+ mov r2, r5
+ cmp r4, r3
+ bne 2f
+ blx r6
+ cmp r0, #0
+ bne 1b
+ mov r0, r8
+ ldmfd sp!, {r4, r5, r6, r7, r8, pc}
+2:
+ mov r8, r3
+ mov r0, r8
+ ldmfd sp!, {r4, r5, r6, r7, r8, pc}
+
+ThreadInVMfromJavaD:
+ stmfd sp!, {r4, r5, r6, lr}
+ ldr r5, ThreadInVMfromJavaD_adcons
+ ldr r3, ThreadInVMfromJavaD_adcons+4
+ mov r2, #7
+.ThreadInVMfromJavaD_pic:
+ add r5, pc, r5
+ ldr r6, [r0, #0]
+ mov r4, r0
+ ldr r3, [r5, r3]
+ str r2, [r6, #316]
+ ldr r3, [r3, #0]
+ cmp r3, #1
+ ble 1f
+ ldr r3, ThreadInVMfromJavaD_adcons+8
+ ldr r3, [r5, r3]
+ ldrb r3, [r3, #0] @ zero_extendqisi2
+ cmp r3, #0
+ bne 6f
+ ldr r3, ThreadInVMfromJavaD_adcons+12
+ mov r1, #1
+ ldr r2, ThreadInVMfromJavaD_adcons+16
+ ldr r3, [r5, r3]
+ ldr r2, [r5, r2]
+ ldr r3, [r3, #0]
+ ldr r2, [r2, #0]
+ and r3, r3, r6, lsr #3
+ str r1, [r2, r3]
+1:
+ ldr r3, ThreadInVMfromJavaD_adcons+20
+ ldr r3, [r5, r3]
+ ldr r3, [r3, #0]
+ cmp r3, #0
+ bne 5f
+2:
+ mov r3, #8
+ str r3, [r6, #316]
+ ldr r0, [r4, #0]
+ ldr r3, [r0, #308]
+ cmp r3, #0
+ bne 3f
+ ldr r3, [r0, #24]
+ tst r3, #536870912
+ beq 4f
+3:
+ mov r1, #1
+ bl _ZN10JavaThread37handle_special_runtime_exit_conditionEb
+ mov r0, r4
+ ldmfd sp!, {r4, r5, r6, pc}
+4:
+ ldr r3, [r0, #24]
+ tst r3, #268435456
+ bne 3b
+ mov r0, r4
+ ldmfd sp!, {r4, r5, r6, pc}
+5:
+ mov r0, r6
+ bl _ZN20SafepointSynchronize5blockEP10JavaThread
+ b 2b
+6:
+ mov r3, #0xffffffa0
+ bic r3, r3, #0xf000
+ blx r3
+ b 1b
+ThreadInVMfromJavaD_adcons:
+ .word _GLOBAL_OFFSET_TABLE_-(.ThreadInVMfromJavaD_pic+8)
+ .word _ZN2os16_processor_countE(GOT)
+ .word UseMembar(GOT)
+ .word _ZN2os20_serialize_page_maskE(GOT)
+ .word _ZN2os19_mem_serialize_pageE(GOT)
+ .word _ZN20SafepointSynchronize6_stateE(GOT)
+
+oop_store:
+ stmfd sp!, {r4, r5, r6, r7, r8, lr}
+ ldr r4, oop_store_adcons
+ ldr r3, oop_store_adcons+4
+ mov r5, r0
+.oop_store_pic:
+ add r4, pc, r4
+ mov r6, r1
+ ldr r3, [r4, r3]
+ ldrb r3, [r3, #0] @ zero_extendqisi2
+ cmp r3, #0
+ bne 3f
+ ldr r7, oop_store_adcons+8
+ ldr r3, [r4, r7]
+ ldr r3, [r3, #0]
+ ldr r2, [r3, #8]
+ cmp r2, #1
+ beq 1f
+ mov r0, r3
+ mov r1, r5
+ ldr r3, [r3, #0]
+ mov r2, r6
+ mov lr, pc
+ ldr pc, [r3, #48]
+1:
+ ldr r3, [r4, r7]
+ str r6, [r5, #0]
+ ldr r3, [r3, #0]
+ ldr r2, [r3, #8]
+ cmp r2, #1
+ beq 2f
+ mov r0, r3
+ mov r1, r5
+ mov r2, r6
+ ldr r3, [r3, #0]
+ mov lr, pc
+ ldr pc, [r3, #52]
+ ldmfd sp!, {r4, r5, r6, r7, r8, pc}
+2:
+ ldr r3, [r3, #76]
+ mov r2, #0
+ strb r2, [r3, r5, lsr #9]
+ ldmfd sp!, {r4, r5, r6, r7, r8, pc}
+3:
+ ldr r7, oop_store_adcons+8
+ ldr r3, [r4, r7]
+ ldr r3, [r3, #0]
+ ldr r2, [r3, #8]
+ cmp r2, #1
+ beq 4f
+ mov r0, r3
+ mov r1, r5
+ ldr r3, [r3, #0]
+ mov r2, r6
+ mov lr, pc
+ ldr pc, [r3, #48]
+4:
+ mov r3, #0xffffffa0
+ bic r3, r3, #0xf000
+ blx r3
+ b 1b
+oop_store_adcons:
+ .word _GLOBAL_OFFSET_TABLE_-(.oop_store_pic+8)
+ .word always_do_update_barrier(GOT)
+ .word _ZN7oopDesc3_bsE(GOT)
+
ALIGN_CODE
build_normal:
ldr ip, [r1, #24]
@@ -1750,7 +1972,7 @@
ldr r3, [istate, #ISTATE_THREAD]
mov r0, sp
str r3, [sp]
- bl _ZN17HandleMarkCleanerD1Ev
+ bl HandleMarkCleanerD
ldr r0, [istate, #ISTATE_THREAD]
str jpc, [istate, #ISTATE_BCP]
str stack, [istate, #ISTATE_STACK]
@@ -1917,7 +2139,7 @@
ldr r3, [istate, #ISTATE_THREAD]
mov r0, sp
str r3, [sp]
- bl _ZN17HandleMarkCleanerD1Ev
+ bl HandleMarkCleanerD
ldr r0, [istate, #ISTATE_THREAD]
str jpc, [istate, #ISTATE_BCP]
str stack, [istate, #ISTATE_STACK]
@@ -2487,7 +2709,7 @@
mov r2, tmp_xxx
mov r1, r0
mov r0, sl
- bl _ZN6Atomic11cmpxchg_ptrEPvPVvS0_
+ bl cmpxchg_ptr
cmp r0, tmp_xxx
bne .new_5
subs tmp_xxx, r0, #0
@@ -2650,7 +2872,7 @@
add tmp_xxx, r0, #8
mov r0, tmp_xxx
mov r1, tmp_vvv
- bl _ZNK5Klass13is_subtype_ofEP12klassOopDesc
+ bl is_subtype_of
cmp r0, #0
bne .checkcast_exit
mov r0, tmp_xxx
@@ -2685,7 +2907,7 @@
mov r0, ip
bl _ZN10Exceptions10_throw_msgEP6ThreadPKciP13symbolOopDescS3_
mov r0, sl
- bl _ZN18ThreadInVMfromJavaD1Ev
+ bl ThreadInVMfromJavaD
ldr r0, [sp, #112]
ldr r3, [r0, #0]
ldr stack, [istate, #ISTATE_STACK]
@@ -2761,7 +2983,7 @@
cmp r1, r0
beq .instanceof_2
add r0, r0, #8
- bl _ZNK5Klass13is_subtype_ofEP12klassOopDesc
+ bl is_subtype_of
cmp r0, #0
streq r0, [stack, #4]
beq .instanceof_exit
@@ -2802,7 +3024,7 @@
orr tmp1, r3, #1
mov r2, tmp1
str tmp1, [sl, #0]
- bl _ZN6Atomic11cmpxchg_ptrEPvPVvS0_
+ bl cmpxchg_ptr
cmp r0, tmp1
beq .monitorenter_exit
bic r1, tmp1, #3
@@ -2885,7 +3107,7 @@
orr tmp1, r2, #1
mov r2, tmp1
str tmp1, [sl, #0]
- bl _ZN6Atomic11cmpxchg_ptrEPvPVvS0_
+ bl cmpxchg_ptr
cmp r0, tmp1
beq .monitorenter_exit
bic r1, tmp1, #3
@@ -2941,7 +3163,7 @@
beq .monitorexit_exit
mov r1, sl
mov r2, tmp1
- bl _ZN6Atomic11cmpxchg_ptrEPvPVvS0_
+ bl cmpxchg_ptr
cmp tmp1, r0
beq .monitorexit_exit
str sl, [tmp1, #4]
@@ -2998,7 +3220,7 @@
cmp r0, r1
beq .aastore_exit
add r0, r0, #8
- bl _ZNK5Klass13is_subtype_ofEP12klassOopDesc
+ bl is_subtype_of
cmp r0, #0
moveq r0, #VMSYMBOLS_ArrayStoreException
beq raise_exception
@@ -3150,7 +3372,7 @@
ldr r3, [istate, #ISTATE_THREAD]
mov r0, sp
str r3, [sp]
- bl _ZN17HandleMarkCleanerD1Ev
+ bl HandleMarkCleanerD
ldr r0, [istate, #ISTATE_THREAD]
str jpc, [istate, #ISTATE_BCP]
str stack, [istate, #ISTATE_STACK]
@@ -3365,7 +3587,7 @@
mov r0, r2
mov r1, sl
mov r2, tmp_xxx
- bl _ZN6Atomic11cmpxchg_ptrEPvPVvS0_
+ bl cmpxchg_ptr
cmp tmp_xxx, r0
beq .normal_do_synchronisation_1
b do_execute_java_bytecodes_restore_locals
@@ -4141,7 +4363,7 @@
mov tmp_vvv, lr
mov r1, tmp1
mov r2, tmp2
- bl _ZN6Atomic11cmpxchg_ptrEPvPVvS0_
+ bl cmpxchg_ptr
cmp tmp2, r0
bxeq tmp_vvv
@@ -4221,7 +4443,7 @@
bl _ZN10Exceptions10_throw_msgEP6ThreadPKciP13symbolOopDescS3_
mov r0, sp
str tmp1, [sp]
- bl _ZN18ThreadInVMfromJavaD1Ev
+ bl ThreadInVMfromJavaD
b handle_exception_with_bcp
null_str:
.byte 0
@@ -4530,7 +4752,7 @@
beq .handle_exception_23
mov r1, sl
ldr r2, [sp, #92]
- bl _ZN6Atomic11cmpxchg_ptrEPvPVvS0_
+ bl cmpxchg_ptr
ldr r1, [sp, #92]
cmp r1, r0
beq .handle_exception_22
@@ -4552,7 +4774,7 @@
cmp r1, #0
beq .handle_exception_24
add r0, sp, #204
- bl _ZN6HandleC1EP7oopDesc
+ bl HandleC
ldr r1, [sp, #204]
ldr r0, [istate, #ISTATE_THREAD]
str r1, [sp, #44]
@@ -4595,7 +4817,7 @@
ldr r0, [sp, #24]
ldr r3, [istate, #ISTATE_THREAD]
ldr r1, [r3, #4]
- bl _ZN6HandleC1EP7oopDesc
+ bl HandleC
ldr r2, [sp, #212]
ldr r0, [istate, #ISTATE_THREAD]
str r2, [sp, #44]
@@ -4627,7 +4849,7 @@
ldr r3, [istate, #ISTATE_THREAD]
add r0, sp, #208
ldr r1, [r3, #4]
- bl _ZN6HandleC1EP7oopDesc
+ bl HandleC
ldr r2, [sp, #208]
ldr r0, [istate, #ISTATE_THREAD]
str r2, [sp, #44]
More information about the distro-pkg-dev
mailing list