From: tbfg Date: Mon, 28 Aug 2006 19:31:37 +0000 (+0000) Subject: * src/vm/jit/powerpc64/linux/md-abi.h: New REG_TOC name needed to X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=5776ee47a83333722cc82353dc9cb039cdd2457f;p=cacao.git * src/vm/jit/powerpc64/linux/md-abi.h: New REG_TOC name needed to 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. --- diff --git a/src/vm/jit/powerpc64/asmpart.S b/src/vm/jit/powerpc64/asmpart.S index 48e13c9a0..8f34f4859 100644 --- a/src/vm/jit/powerpc64/asmpart.S +++ b/src/vm/jit/powerpc64/asmpart.S @@ -31,7 +31,7 @@ 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 $ */ @@ -53,12 +53,19 @@ /* export functions ***********************************************************/ +#ifdef ENABLE_LIBJVM .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 @@ -75,7 +82,7 @@ .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 ********************************************************** @@ -108,21 +115,30 @@ .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: +.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) @@ -1395,8 +1411,7 @@ asm_cacheflush: blr -asm_getclassvalues_atomic: -.globl .asm_getclassvalues_atomic +.asm_getclassvalues_atomic: _crit_restart: _crit_begin: lwz r6,offbaseval(r3) diff --git a/src/vm/jit/powerpc64/codegen.c b/src/vm/jit/powerpc64/codegen.c index 65436188e..5b5b3903b 100644 --- a/src/vm/jit/powerpc64/codegen.c +++ b/src/vm/jit/powerpc64/codegen.c @@ -31,7 +31,7 @@ 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 $ */ @@ -2820,9 +2820,13 @@ gen_method: 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); M_JSR; + /* TODO: restore TOC */ disp = (s4) (cd->mcodeptr - cd->mcodebase); M_MFLR(REG_ITMP1); M_LDA(REG_PV, REG_ITMP1, -disp); @@ -3554,7 +3558,7 @@ gen_method: /* 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 */ @@ -4101,8 +4105,8 @@ u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd) /* 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 */ diff --git a/src/vm/jit/powerpc64/linux/md-abi.h b/src/vm/jit/powerpc64/linux/md-abi.h index 2e9718113..b48fdc1ef 100644 --- a/src/vm/jit/powerpc64/linux/md-abi.h +++ b/src/vm/jit/powerpc64/linux/md-abi.h @@ -28,7 +28,7 @@ Changes: - $Id: md-abi.h 5261 2006-08-22 15:49:25Z tbfg $ + $Id: md-abi.h 5282 2006-08-28 19:31:37Z tbfg $ */ @@ -39,7 +39,8 @@ /* 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 */