MIPS repair work
authorStefan Ring <stefan@complang.tuwien.ac.at>
Thu, 17 Sep 2009 13:36:04 +0000 (15:36 +0200)
committerStefan Ring <stefan@complang.tuwien.ac.at>
Thu, 17 Sep 2009 13:36:04 +0000 (15:36 +0200)
* src/vm/jit/mips/codegen.c: Make it compile.
* src/vm/jit/mips/codegen.h: Added M_ALD_DSEG.
* src/vm/jit/mips/linux/md-os.c: Fixes.
* src/vm/jit/mips/md.c: Fixed includes.
* src/vm/jit/mips/md.h: Likewise.

src/vm/jit/mips/codegen.c
src/vm/jit/mips/codegen.h
src/vm/jit/mips/linux/md-os.c
src/vm/jit/mips/md.c
src/vm/jit/mips/md.h

index cf207a347b1c06c9ed197af441edacd916ae05fb..ebc4b52172093d61a1fbf92ef2cec8ce1e1665f4 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/mips/codegen.c - machine code generator for MIPS
 
-   Copyright (C) 1996-2005, 2006, 2007, 2008
+   Copyright (C) 1996-2005, 2006, 2007, 2008, 2009
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 #include "vm/jit/emit-common.hpp"
 #include "vm/jit/jit.hpp"
 #include "vm/jit/linenumbertable.hpp"
+#include "vm/jit/parse.hpp"
 #include "vm/jit/patcher-common.hpp"
 #include "vm/jit/reg.h"
+#include "vm/jit/stacktrace.hpp"
 #include "vm/jit/trap.hpp"
 
-#if defined(ENABLE_LSRA)
-# include "vm/jit/allocator/lsra.h"
-#endif
-
-
-/* codegen_emit ****************************************************************
-
-   Generates machine code.
-
-*******************************************************************************/
-
-bool codegen_emit(jitdata *jd)
-{
-
-
-       savedregs_num = code_is_leafmethod(code) ? 0 : 1; /* space to save the RA */
-
-
-#if defined(ENABLE_THREADS)
-       /* space to save argument of monitor_enter */
-
-       if (checksync && code_is_synchronized(code)) {
-# if SIZEOF_VOID_P == 8
-               cd->stackframesize++;
-# else
-               rd->memuse++;
-               cd->stackframesize += 2;
-# endif
-       }
-#endif
-
-       /* keep stack 16-byte aligned */
-
-       if (cd->stackframesize & 1)
-               cd->stackframesize++;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 /**
  * Generates machine code for the method prolog.
@@ -266,7 +217,7 @@ void codegen_emit_epilog(jitdata* jd)
        /* deallocate stack and return */
 
        if (cd->stackframesize) {
-               int32_t lo, hi;
+               int32_t lo, hi, disp;
 
                disp = cd->stackframesize * 8;
                lo = (short) (disp);
@@ -2698,19 +2649,6 @@ void codegen_emit_instruction(jitdata* jd, instruction* iptr)
 
 
 
-XXX
-                               else {
-                                       s1 = codegen_reg_of_dst(jd, iptr, REG_FRESULT);
-                                       if (IS_2_WORD_TYPE(d))
-                                               M_DMOV(REG_FRESULT, s1);
-                                       else
-                                               M_FMOV(REG_FRESULT, s1);
-                               }
-                               emit_store_dst(jd, iptr, s1);
-                       }
-                       break;
-
-
                case ICMD_CHECKCAST:  /* ..., objectref ==> ..., objectref            */
 
                        if (!(iptr->flags.bits & INS_FLAG_ARRAY)) {
@@ -2953,10 +2891,8 @@ XXX
 
                        if ((super == NULL) || (super->flags & ACC_INTERFACE)) {
                                if (super == NULL) {
-                                       constant_classref * iptr->sx.s23.s3.c.ref;
-
                                        patcher_add_patch_ref(jd, PATCHER_instanceof_interface,
-                                                                                 cr, 0);
+                                                                                 iptr->sx.s23.s3.c.ref, 0);
                                }
                                else {
                                        emit_label_beqz(cd, BRANCH_LABEL_3, s1);
index 8c215be81ac7c56419eedc46eb3c4b6fc7d89cea..91024c9404bc2601873472c700699c9effa09f8e 100644 (file)
 
 #define M_ALD_INTERN(a,b,disp)  M_LLD_INTERN(a,b,disp)
 #define M_ALD(a,b,disp)         M_LLD(a,b,disp)
+#define M_ALD_DSEG(a,disp)      M_LLD(a,REG_PV,disp)
 #define M_AST_INTERN(a,b,disp)  M_LST_INTERN(a,b,disp)
 #define M_AST(a,b,disp)         M_LST(a,b,disp)
 #define M_AADD(a,b,c)           M_LADD(a,b,c)
 
 #define M_ALD_INTERN(a,b,disp)  M_ILD_INTERN(a,b,disp)
 #define M_ALD(a,b,disp)         M_ILD(a,b,disp)
+#define M_ALD_DSEG(a,disp)      M_ILD(a,REG_PV,disp)
 #define M_AST_INTERN(a,b,disp)  M_IST_INTERN(a,b,disp)
 #define M_AST(a,b,disp)         M_IST(a,b,disp)
 #define M_AADD(a,b,c)           M_IADD(a,b,c)
index 02c978b795ae6dd54c22735d4b5d5efa9ecc24f6..2fec3a5bf1b66c97d2a5236058f92b4eaedaf9fb 100644 (file)
@@ -83,7 +83,7 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
        ucontext_t* _uc = (struct ucontext *) _p;
        mcontext_t* _mc = &_uc->uc_mcontext;
 
-       void* xpc = (void*) _mc->pc;
+       void* xpc = (void*) (_mc->pc - 4);
 
        // Handle the trap.
        trap_handle(TRAP_SIGSEGV, xpc, _p);
@@ -98,7 +98,7 @@ void md_signal_handler_sigill(int sig, siginfo_t* siginfo, void* _p)
        ucontext_t* _uc = (struct ucontext *) _p;
        mcontext_t* _mc = &_uc->uc_mcontext;
 
-       void* xpc = (void*) _mc->pc;
+       void* xpc = (void*) (_mc->pc - 4);
 
        // Handle the trap.
        trap_handle(TRAP_SIGILL, xpc, _p);
@@ -129,8 +129,6 @@ void md_executionstate_read(executionstate_t* es, void* context)
        greg_t*     _gregs;
        int         i;
 
-       vm_abort("md_executionstate_read: PLEASE REVISE ME!");
-
        _uc = (ucontext_t*) context;
        _mc = &_uc->uc_mcontext;
 
@@ -184,11 +182,15 @@ void md_executionstate_write(executionstate_t* es, void* context)
        greg_t*     _gregs;
        int         i;
 
-       vm_abort("md_executionstate_write: PLEASE REVISE ME!");
-
        _uc = (ucontext_t *) context;
        _mc = &_uc->uc_mcontext;
 
+#if defined(__UCLIBC__)
+       _gregs = _mc->gpregs;
+#else  
+       _gregs = _mc->gregs;
+#endif
+
        /* Write integer registers. */
 
        for (i = 0; i < INT_REG_CNT; i++)
index 639c1cfd5226dd3da572c34d25736eb09e148d4c..329d29bef4a9a2e4936284a913c16d8e995d4317 100644 (file)
 
 #include "config.h"
 
-#include <assert.h>
 #include <stdint.h>
+#include <ucontext.h>
 
-#include "vm/types.h"
-
+#include "vm/jit/mips/codegen.h"
 #include "vm/jit/mips/md.h"
 
-#include "vm/global.h"
-#include "vm/vm.hpp"
-
+#include "vm/jit/asmpart.h"
 #include "vm/jit/jit.hpp"
+#include "vm/jit/trap.hpp"
 
 
 /* md_jit_method_patch_address *************************************************
index 67bb24cdc8100045f0c891c2028abf2dc3ddacd5..bdc59a0f28bc8133d486a75fe7f8871ecc28f644 100644 (file)
 
 #include <assert.h>
 #include <stdint.h>
-#include <unistd.h>
 #include <sys/cachectl.h>
 
-#include "vm/types.h"
-
+#include "vm/global.h"
 #include "vm/vm.hpp"
 
+#include "vm/jit/asmpart.h"
+#include "vm/jit/codegen-common.hpp"
 
 /**
  * Returns the size (in bytes) of the current stackframe, specified by