* Updated to jitcache-arm-x86 branch d4f6023b26c5+d1b5b1c106ac
[cacao.git] / src / vm / jit / arm / codegen.c
index c62b078f730dcf2be55dc1496c0a60e6e6123c9c..efe6d3d746eac7d775dae8bc56eb9495294cb972 100644 (file)
 
 #include "mm/memory.h"
 
-#include "native/localref.h"
-#include "native/native.h"
+#include "native/localref.hpp"
+#include "native/native.hpp"
 
-#include "threads/lock-common.h"
+#include "threads/lock.hpp"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/exceptions.hpp"
 #include "vm/global.h"
-#include "vm/loader.h"
+#include "vm/loader.hpp"
 #include "vm/options.h"
 #include "vm/vm.hpp"
 
 #include "vm/jit/abi.h"
 #include "vm/jit/asmpart.h"
-#include "vm/jit/codegen-common.h"
+#include "vm/jit/codegen-common.hpp"
 #include "vm/jit/dseg.h"
-#include "vm/jit/emit-common.h"
-#include "vm/jit/jit.h"
+#include "vm/jit/emit-common.hpp"
+#include "vm/jit/jit.hpp"
 #include "vm/jit/jitcache.hpp"
-#include "vm/jit/linenumbertable.h"
+#include "vm/jit/linenumbertable.hpp"
 #include "vm/jit/methodheader.h"
 #include "vm/jit/parse.h"
-#include "vm/jit/patcher-common.h"
+#include "vm/jit/patcher-common.hpp"
 #include "vm/jit/reg.h"
 
 #if defined(ENABLE_LSRA)
@@ -1051,7 +1051,12 @@ bool codegen_emit(jitdata *jd)
 
                        s1 = emit_load_s1(jd, iptr, REG_ITMP1);
                        d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
+#if defined(__VFP_FP__)
+                       M_FMSR(s1, d);
+                       M_CVTIF(d, d);
+#else
                        M_CVTIF(s1, d);
+#endif
                        emit_store_dst(jd, iptr, d);
                        break;
 
@@ -1059,7 +1064,12 @@ bool codegen_emit(jitdata *jd)
 
                        s1 = emit_load_s1(jd, iptr, REG_ITMP1);
                        d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
+#if defined(__VFP_FP__)
+                       M_FMSR(s1, d);
+                       M_CVTID(d, d);
+#else
                        M_CVTID(s1, d);
+#endif
                        emit_store_dst(jd, iptr, d);
                        break;
 
@@ -1067,9 +1077,12 @@ bool codegen_emit(jitdata *jd)
 
                        s1 = emit_load_s1(jd, iptr, REG_FTMP1);
                        d = codegen_reg_of_dst(jd, iptr, REG_ITMP1);
+#if defined(__VFP_FP__)
+                       M_CVTFI(s1, REG_FTMP2);
+                       M_FMRS(REG_FTMP2, d);
+#else
                        /* this uses round towards zero, as Java likes it */
                        M_CVTFI(s1, d);
-#if !defined(__VFP_FP__)
                        /* this checks for NaN; to return zero as Java likes it */
                        M_FCMP(s1, 0x8);
                        M_MOVVS_IMM(0, d);
@@ -1081,9 +1094,12 @@ bool codegen_emit(jitdata *jd)
 
                        s1 = emit_load_s1(jd, iptr, REG_FTMP1);
                        d = codegen_reg_of_dst(jd, iptr, REG_ITMP1);
+#if defined(__VFP_FP__)
+                       M_CVTDI(s1, REG_FTMP2);
+                       M_FMRS(REG_FTMP2, d);
+#else
                        /* this uses round towards zero, as Java likes it */
                        M_CVTDI(s1, d);
-#if !defined(__VFP_FP__)
                        /* this checks for NaN; to return zero as Java likes it */
                        M_DCMP(s1, 0x8);
                        M_MOVVS_IMM(0, d);
@@ -2884,29 +2900,6 @@ bool codegen_emit(jitdata *jd)
 }
 
 
-/* codegen_emit_stub_compiler **************************************************
-
-   Emits a stub routine which calls the compiler.
-       
-*******************************************************************************/
-
-void codegen_emit_stub_compiler(jitdata *jd)
-{
-       methodinfo  *m;
-       codegendata *cd;
-
-       /* get required compiler data */
-
-       m  = jd->m;
-       cd = jd->cd;
-
-       /* code for the stub */
-
-       M_LDR_INTERN(REG_ITMP1, REG_PC, -(2 * 4 + 2 * SIZEOF_VOID_P));
-       M_LDR_INTERN(REG_PC, REG_PC, -(3 * 4 + 3 * SIZEOF_VOID_P));
-}
-
-
 /* codegen_emit_stub_native ****************************************************
 
    Emits a stub routine which calls a native method.