call builtins due to ppc64 function descriptors (ELF ABI).
* src/vm/jit/powerpc64/codegen.c (createnativestub): Big endian
requires M_LLD and M_IST to copy s4 values from dseg to stack.
(codegen): gen_method needs to create function descriptor call.
* src/vm/jit/powerpc64/asmpart.S: When linking statically
non function descriptor calls are generated by compiler.
Some ifdefs added to fix static linking.
Changes: Christian Thalinger
Edwin Steiner
Changes: Christian Thalinger
Edwin Steiner
- $Id: asmpart.S 5279 2006-08-25 11:55:21Z tbfg $
+ $Id: asmpart.S 5282 2006-08-28 19:31:37Z tbfg $
/* export functions ***********************************************************/
/* export functions ***********************************************************/
.globl asm_vm_call_method
.globl asm_vm_call_method_int
.globl asm_vm_call_method_long
.globl asm_vm_call_method_float
.globl asm_vm_call_method_double
.globl asm_vm_call_method
.globl asm_vm_call_method_int
.globl asm_vm_call_method_long
.globl asm_vm_call_method_float
.globl asm_vm_call_method_double
+#else
+ .globl .asm_vm_call_method
+ .globl .asm_vm_call_method_int
+ .globl .asm_vm_call_method_long
+ .globl .asm_vm_call_method_float
+ .globl .asm_vm_call_method_double
+#endif
.globl asm_vm_call_method_exception_handler
.globl asm_call_jit_compiler
.globl asm_vm_call_method_exception_handler
.globl asm_call_jit_compiler
.globl .asm_cacheflush /* no function descriptor needed, only called direct */
.globl asm_criticalsections
.globl .asm_cacheflush /* no function descriptor needed, only called direct */
.globl asm_criticalsections
- .globl asm_getclassvalues_atomic
+ .globl .asm_getclassvalues_atomic
/* asm_vm_call_method **********************************************************
/* asm_vm_call_method **********************************************************
.long 0 /* frame size */
.long 0 /* codeinfo pointer */
.long 0 /* frame size */
.long 0 /* codeinfo pointer */
-.section ".opd","aw"
-.align 3
-
-asm_vm_call_method:
-asm_vm_call_method_int:
-asm_vm_call_method_long:
-asm_vm_call_method_float:
-asm_vm_call_method_double:
- .quad .asm_vm_call_method,.TOC.@tocbase,0
- .previous
- .size asm_vm_call_method, 24
- .type .asm_vm_call_method,@function
- .globl .asm_vm_call_method
+#ifdef ENABLE_LIBJVM
+ .section ".opd","aw"
+ .align 3
+
+ asm_vm_call_method:
+ asm_vm_call_method_int:
+ asm_vm_call_method_long:
+ asm_vm_call_method_float:
+ asm_vm_call_method_double:
+ .quad .asm_vm_call_method,.TOC.@tocbase,0
+ .previous
+ .size asm_vm_call_method, 24
+ .type .asm_vm_call_method,@function
+ .globl .asm_vm_call_method
+#else
+ asm_vm_call_method:
+ .globl asm_vm_call_method
+#endif
+.asm_vm_call_method_int:
+.asm_vm_call_method_long:
+.asm_vm_call_method_float:
+.asm_vm_call_method_double:
mflr r0
std r0,LA_LR_OFFSET(sp)
stdu sp,-40*8(sp)
mflr r0
std r0,LA_LR_OFFSET(sp)
stdu sp,-40*8(sp)
-asm_getclassvalues_atomic:
-.globl .asm_getclassvalues_atomic
+.asm_getclassvalues_atomic:
_crit_restart:
_crit_begin:
lwz r6,offbaseval(r3)
_crit_restart:
_crit_begin:
lwz r6,offbaseval(r3)
Christian Ullrich
Edwin Steiner
Christian Ullrich
Edwin Steiner
- $Id: codegen.c 5279 2006-08-25 11:55:21Z tbfg $
+ $Id: codegen.c 5282 2006-08-28 19:31:37Z tbfg $
disp = dseg_addaddress(cd, bte->fp);
d = md->returntype.type;
disp = dseg_addaddress(cd, bte->fp);
d = md->returntype.type;
- M_ALD(REG_PV, REG_PV, disp); /* pointer to built-in-function */
- M_MTCTR(REG_PV);
+ M_ALD(REG_PV, REG_PV, disp); /* pointer to built-in-function descriptor */
+ M_ALD(REG_ITMP1, REG_PV, 0); /* function entry point address */
+ M_ALD(REG_ITMP2, REG_PV, 8); /* TOC of callee */
+ M_MOV(REG_TOC, REG_ITMP2); /* load TOC for callee */
+ M_MTCTR(REG_ITMP1);
+ /* TODO: restore TOC */
disp = (s4) (cd->mcodeptr - cd->mcodebase);
M_MFLR(REG_ITMP1);
M_LDA(REG_PV, REG_ITMP1, -disp);
disp = (s4) (cd->mcodeptr - cd->mcodebase);
M_MFLR(REG_ITMP1);
M_LDA(REG_PV, REG_ITMP1, -disp);
/* move data segment displacement onto stack */
disp = dseg_addaddress(cd, pref->disp);
/* move data segment displacement onto stack */
disp = dseg_addaddress(cd, pref->disp);
- M_ILD(REG_ITMP3, REG_PV, disp);
+ M_LLD(REG_ITMP3, REG_PV, disp);
M_IST_INTERN(REG_ITMP3, REG_SP, 1 * 8);
/* move patcher function pointer onto stack */
M_IST_INTERN(REG_ITMP3, REG_SP, 1 * 8);
/* move patcher function pointer onto stack */
/* move data segment displacement onto stack */
/* move data segment displacement onto stack */
- disp = dseg_addaddress(cd, pref->disp);
- M_ILD(REG_ITMP3, REG_PV, disp);
+ disp = dseg_adds4(cd, pref->disp);
+ M_LLD(REG_ITMP3, REG_PV, disp);
M_IST(REG_ITMP3, REG_SP, 1 * 8);
/* move patcher function pointer onto stack */
M_IST(REG_ITMP3, REG_SP, 1 * 8);
/* move patcher function pointer onto stack */
- $Id: md-abi.h 5261 2006-08-22 15:49:25Z tbfg $
+ $Id: md-abi.h 5282 2006-08-28 19:31:37Z tbfg $
/* preallocated registers *****************************************************/
/* integer registers */
/* preallocated registers *****************************************************/
/* integer registers */
+
+#define REG_TOC 2 /* TOC (see function descriptors ELF ABI) */
#define REG_RESULT 3 /* to deliver method results */
#define REG_PV 14 /* procedure vector, must be provided by caller */
#define REG_RESULT 3 /* to deliver method results */
#define REG_PV 14 /* procedure vector, must be provided by caller */