* src/vm/jit/powerpc64/linux/md-abi.h: New REG_TOC name needed to
authortbfg <none@none>
Mon, 28 Aug 2006 19:31:37 +0000 (19:31 +0000)
committertbfg <none@none>
Mon, 28 Aug 2006 19:31:37 +0000 (19:31 +0000)
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.

src/vm/jit/powerpc64/asmpart.S
src/vm/jit/powerpc64/codegen.c
src/vm/jit/powerpc64/linux/md-abi.h

index 48e13c9a0ed29db0b06b2bf0f49884e0f01f7a3f..8f34f48597dc9442523c5c2c413c9c391aafa3ca 100644 (file)
@@ -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 $
 
 */
 
 
 /* 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 **********************************************************
        .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)
index 65436188e208022b61f29fbbebba9d6de329bf29..5b5b3903bc9223dfa834b522b084bac6e1765060 100644 (file)
@@ -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 */
index 2e9718113a269b7670e3fc5659864ec07f84f22e..b48fdc1efad4b4b495fc4170dcdb0748a31c1683 100644 (file)
@@ -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  */