* src/vm/jit/s390/codegen.c: Fixed build.
authorStefan Ring <stefan@complang.tuwien.ac.at>
Sat, 7 Aug 2010 20:03:09 +0000 (22:03 +0200)
committerStefan Ring <stefan@complang.tuwien.ac.at>
Sat, 7 Aug 2010 20:03:09 +0000 (22:03 +0200)
* src/vm/jit/s390/codegen.h: Added missing defines.
* src/vm/jit/s390/emit.c: Fixed build.
* src/vm/jit/s390/md-abi.h: Renamed REG_ITMP2_XPC and REG_ITMP1_XPTR for
consistency with the other archs. Fixed copyright header.

src/vm/jit/s390/codegen.c
src/vm/jit/s390/codegen.h
src/vm/jit/s390/emit.c
src/vm/jit/s390/md-abi.h

index 334dbada29be73b8e25c770490be75e2ae706381..fc6c142d8ffd5fa94cc31baa7c17054a4401e35f 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/s390/codegen.c - machine code generator for s390
 
-   Copyright (C) 1996-2005, 2006, 2007, 2008, 2009
+   Copyright (C) 1996-2005, 2006, 2007, 2008, 2009, 2010
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
@@ -123,7 +123,7 @@ void codegen_emit_prolog(jitdata* jd)
 {
        varinfo*    var;
        methoddesc* md;
-       int32_t     s1;
+       int32_t     s1, s2;
        int32_t     p, t, l;
        int32_t     varindex;
        int         i;
@@ -298,7 +298,7 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr)
        fieldinfo*          fi;
        unresolved_field*   uf;
        int32_t             fieldtype;
-       int32_t             s1, s2, s3, d;
+       int32_t             s1, s2, s3, d, dd;
        int32_t             disp;
 
        // Get required compiler data.
@@ -699,7 +699,6 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr)
                case ICMD_LREM:       /* ..., val1, val2  ==> ..., val1 % val2        */
 
                        bte = iptr->sx.s23.s3.bte;
-                       md  = bte->md;
 
                        /* test s2 for zero */
 
@@ -1759,6 +1758,7 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr)
                case ICMD_PUTFIELD:   /* ..., objectref, value  ==> ...               */
                        {
                        u1 *ref;
+                       patchref_t *pr;
 
                        s1 = emit_load_s1(jd, iptr, REG_ITMP1);
                        emit_nullpointer_check(cd, iptr, s1);
@@ -1784,7 +1784,7 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr)
                         */
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               patcher_add_patch_ref(jd, PATCHER_get_putfield, uf, 0);
+                               pr = patcher_add_patch_ref(jd, PATCHER_get_putfield, uf, 0);
                                ref = cd->mcodeptr;
                        }
 
@@ -1799,7 +1799,7 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr)
                        }
 
                        if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
-                               ((patchref_t *)list_first(jd->code->patchers))->disp = (cd->mcodeptr - ref);
+                               pr->disp = (cd->mcodeptr - ref);
                        }
 
                        switch (fieldtype) {
@@ -1830,7 +1830,7 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr)
 
                        disp = dseg_add_functionptr(cd, asm_handle_exception);
                        M_ALD_DSEG(REG_ITMP1, disp);
-                       M_JMP(REG_ITMP1_XPC, REG_ITMP1);
+                       M_JMP(REG_ITMP2_XPC, REG_ITMP1);
                        M_NOP;
 
                        break;
@@ -2888,7 +2888,7 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f, int s
        M_ALD_DSEG(REG_ITMP1, disp);
        M_CALL(REG_ITMP1);
 
-       M_MOV(REG_RESULT, REG_ITMP3_XPTR);
+       M_MOV(REG_RESULT, REG_ITMP1_XPTR);
 
        /* restore return value */
 
@@ -2929,15 +2929,15 @@ void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f, int s
 
        /* check for exception */
 
-       M_TEST(REG_ITMP3_XPTR);
+       M_TEST(REG_ITMP1_XPTR);
        M_BNE(SZ_BRC + SZ_BCR);                     /* if no exception then return        */
 
        M_RET;
 
        /* handle exception */
 
-       M_MOV(REG_RA, REG_ITMP1_XPC);
-       M_ASUB_IMM(2, REG_ITMP1_XPC);
+       M_MOV(REG_RA, REG_ITMP2_XPC);
+       M_ASUB_IMM(2, REG_ITMP2_XPC);
 
        disp = dseg_add_functionptr(cd, asm_handle_nat_exception);
        M_ALD_DSEG(REG_ITMP2, disp);
index 2cce3c6356254d9534a9d22ece2b878ff681d419..28ceb970a57084a1d28714a3ca681c376a393345 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/s390/codegen.h - code generation macros for s390
 
-   Copyright (C) 1996-2005, 2006, 2007, 2008
+   Copyright (C) 1996-2005, 2006, 2007, 2008, 2010
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
             codegen_increase(cd); \
     } while (0)
 
+#define ALIGNCODENOP \
+    do { \
+        while (((ptrint) cd->mcodeptr) & 2) { \
+            M_NOP2; \
+        } \
+        while (((ptrint) cd->mcodeptr) & 4) { \
+            M_NOP; \
+        } \
+    } while (0)
+
 /* some patcher defines *******************************************************/
 
 #define PATCHER_CALL_SIZE    2          /* size in bytes of a patcher call    */
@@ -690,6 +700,7 @@ static inline uint8_t N_ILL_GET_TYPE(uint8_t *instrp) {
 
 #define M_MOV(a, b) N_LR(b, a)
 #define M_FMOV(a, b) N_LDR(b, a)
+#define M_DMOV(a, b) M_FMOV((a), (b))
 #define M_DST(r, b, d) _IFNEG(d, assert(0), N_STD(r, d, RN, b))
 #define M_FST(r, b, d) _IFNEG(d, assert(0), N_STE(r, d, RN, b))
 #define M_IST(r, b, d) _IFNEG( \
index f933634352742f1d78cfc21a0d899ed56ca87376..f01ddf983097945cea769b638bdad20223c302ae 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/s390/emit.c - s390 code emitter functions
 
-   Copyright (C) 1996-2005, 2006, 2007, 2008
+   Copyright (C) 1996-2005, 2006, 2007, 2008, 2010
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
@@ -227,13 +227,13 @@ void emit_icmp_imm(codegendata* cd, int reg, int32_t value)
        if (N_VALID_IMM(value)) {
                M_ICMP_IMM(reg, value);
        } else {
-               disp = dseg_add_s4(cd, iptr->sx.val.i);
+               disp = dseg_add_s4(cd, value);
                if (N_VALID_DSEG_DISP(disp)) {
-                       N_C(s1, N_DSEG_DISP(disp), RN, REG_PV);
+                       N_C(reg, N_DSEG_DISP(disp), RN, REG_PV);
                } else {
                        assert(reg != REG_ITMP2);
                        ICONST(REG_ITMP2, disp);
-                       N_C(s1, -N_PV_OFFSET, REG_ITMP2, REG_PV);
+                       N_C(reg, -N_PV_OFFSET, REG_ITMP2, REG_PV);
                }
        }
 }
index fb15d5b389fd5cc9adf3035707f2c6be737ea9fb..5d25d2037f509ebd4b178cb59f137b575c3ab2cb 100644 (file)
@@ -1,9 +1,7 @@
-/* src/vm/jit/x86_64/md-abi.h - defines for x86_64 Linux ABI
+/* src/vm/jit/s390/md-abi.h - defines for s390 Linux ABI
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
-   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
-   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
-   J. Wenninger, Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2010
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-
-   Changes:
-
 */
 
 
@@ -95,8 +87,8 @@
 
 #define REG_NULL        -1       /* used for reg_of_var where d is not needed */
 
-#define REG_ITMP3_XPTR  REG_ITMP3/* exception pointer = temporary register 3  */
-#define REG_ITMP1_XPC   REG_ITMP1/* exception pc = temporary register 1       */
+#define REG_ITMP1_XPTR  REG_ITMP3/* exception pointer = temporary register 3  */
+#define REG_ITMP2_XPC   REG_ITMP1/* exception pc = temporary register 1       */
 
 #define REG_SP          R15      /* stack pointer                             */
 #define REG_RA          R14      /* same as itmp3 */