harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r593136 [2/2] - in /harmony/enhanced/drlvm/trunk/vm: include/ jitrino/src/codegenerator/ia32/ jitrino/src/codegenerator/ipf/ jitrino/src/jet/ port/include/ port/src/lil/ia32/pim/ vmcore/include/ vmcore/src/class_support/ vmcore/src/exceptio...
Date Thu, 08 Nov 2007 12:01:15 GMT
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp?rev=593136&r1=593135&r2=593136&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp Thu Nov  8 04:01:07
2007
@@ -126,7 +126,7 @@
     static NativeCodePtr addr = NULL;
 
     if (!addr) {
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed::ref;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall::ref;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -195,7 +195,7 @@
 
     if (!addr) {
         ManagedObject* (*p_instantiate_ref)(Class*,unsigned) = rth_ldc_ref_helper;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:g4,pint:ref;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:pint,g4:ref;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -203,9 +203,7 @@
         }
         cs = lil_parse_onto_end(cs,
             "push_m2n 0, %0i;"
-            "out platform:pint,g4:ref;"
-            "o0=i1;"
-            "o1=i0;"
+            "in2out platform:ref;"
             "call %1i;"
             "pop_m2n;"
             "ret;",
@@ -406,7 +404,7 @@
     static NativeCodePtr addr = NULL;
 
     if (!addr) {
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:ref,pint:ref;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:ref,pint:ref;");
 
 #ifdef VM_STATS
         if (dyn_count) {
@@ -435,7 +433,7 @@
     static NativeCodePtr addr = NULL;
 
     if (!addr) {
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:ref,pint:g4;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:ref,pint:g4;");
 #ifdef VM_STATS
         assert(dyn_count);
         cs = lil_parse_onto_end(cs, "inc [%0i:pint]; in2out platform:void; call %1i;", dyn_count,
rth_update_instanceof_stats);
@@ -458,7 +456,7 @@
 
 // Store a reference into an array at a given index and return NULL,
 // or return the Class* for the exception to throw.
-static Class* rth_aastore(ManagedObject* elem, int idx, Vector_Handle array)
+static Class* rth_aastore(Vector_Handle array, int idx, ManagedObject* elem)
 {
 #ifdef VM_STATS
     VM_Statistics::get_vm_stats().num_aastore ++;
@@ -507,9 +505,9 @@
     static NativeCodePtr addr = NULL;
 
     if (!addr) {
-        Class* (*p_aastore)(ManagedObject*, int, Vector_Handle) = rth_aastore;
-        // The args are the element ref to store, the index, and the array to store into\n"
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:ref,pint,ref:void;");
+        Class* (*p_aastore)(Vector_Handle, int, ManagedObject*) = rth_aastore;
+        // The args are the array to store into, the index, and the element ref to store\n"
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:ref,pint,ref:void;");
 #ifdef VM_STATS
         assert(dyn_count);
         cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -583,7 +581,7 @@
     if (!addr) {
         bool (*p_aastore_test)(ManagedObject*, Vector_Handle) = rth_aastore_test;
         // The args are the element ref to store and the array to store into\n
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:ref,ref:void;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:ref,ref:void;");
         assert(cs);
 #ifdef VM_STATS
         assert(dyn_count);
@@ -620,7 +618,7 @@
     if (!addr) {
         void (*p_throw_linking_error)(Class_Handle ch, unsigned index, unsigned opcode) =
             vm_rt_class_throw_linking_error;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:pint,g4,g4:void;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:pint,g4,g4:void;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -661,7 +659,7 @@
 
     if (!addr) {
         void* (*p_get_ivtable)(ManagedObject*, Class*) = rth_get_interface_vtable;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:ref,pint:pint;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:ref,pint:pint;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -734,7 +732,7 @@
         POINTER_SIZE_INT (*p_is_inited)(Class*) = is_class_initialized;
         void (*p_init)(Class*) = class_initialize;
         void (*p_rethrow)() = exn_rethrow;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:pint:void;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:pint:void;");
         assert(cs);
 #ifdef VM_STATS
         assert(dyn_count);
@@ -801,7 +799,7 @@
 
     if (!addr) {
         int32 (*p_f2i)(float) = f2i;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:f4:g4;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:f4:g4;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -854,7 +852,7 @@
 
     if (!addr) {
         int64 (*p_f2l)(float) = f2l;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:f4:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:f4:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -899,7 +897,7 @@
 
     if (!addr) {
         int32 (*p_d2i)(double) = d2i;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:f8:g4;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:f8:g4;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -952,7 +950,7 @@
 
     if (!addr) {
         int64 (*p_d2l)(double) = d2l;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:f8:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:f8:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -985,7 +983,7 @@
 
     if (!addr) {
         int64 (*p_lshl)(int64, int32) = lshl;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:g8,g4:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g8,g4:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1018,7 +1016,7 @@
 
     if (!addr) {
         int64 (*p_lshr)(int64, int32) = lshr;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:g8,g4:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g8,g4:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1051,7 +1049,7 @@
 
     if (!addr) {
         uint64 (*p_lushr)(uint64, uint32) = lushr;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:g8,g4:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g8,g4:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1084,7 +1082,7 @@
 
     if (!addr) {
         int64 (*p_lmul)(int64, int64) = lmul;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:g8,g8:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g8,g8:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1118,7 +1116,7 @@
 
     if (!addr) {
         int64 (*p_lrem)(int64, int64) = lrem;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:g8,g8:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g8,g8:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1155,7 +1153,7 @@
 
     if (!addr) {
         int64 (*p_ldiv)(int64, int64) = ldiv;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:g8,g8:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g8,g8:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1192,7 +1190,7 @@
 
     if (!addr) {
         uint64 (*p_ludiv)(uint64, uint64) = ludiv;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:g8,g8:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g8,g8:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1225,7 +1223,7 @@
         // This constant must be kept in sync with MAGIC in ir.cpp
         POINTER_SIZE_INT divisor_offset = 40;
         int64 (*p_ldiv)(int64, int64) = ldiv;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:g8,pint:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g8,pint:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1257,7 +1255,7 @@
         // This constant must be kept in sync with MAGIC in ir.cpp
         POINTER_SIZE_INT divisor_offset = 40;
         int64 (*p_lrem)(int64, int64) = lrem;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:g8,pint:g8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g8,pint:g8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1292,7 +1290,7 @@
 
     if (!addr) {
         int32 (*p_imul)(int32, int32) = imul;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:g4,g4:g4;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g4,g4:g4;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1326,7 +1324,7 @@
 
     if (!addr) {
         int32 (*p_irem)(int32, int32) = irem;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:g4,g4:g4;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g4,g4:g4;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1363,7 +1361,7 @@
 
     if (!addr) {
         int32 (*p_idiv)(int32, int32) = idiv;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:g4,g4:g4;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g4,g4:g4;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1430,7 +1428,7 @@
 
     if (!addr) {
         float (*p_frem)(float, float) = frem;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:rth:f4,f4:f4;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:f4,f4:f4;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1463,7 +1461,7 @@
 
     if (!addr) {
         float (*p_fdiv)(float, float) = fdiv;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:f4,f4:f4;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:f4,f4:f4;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1496,7 +1494,7 @@
 
     if (!addr) {
         double (*p_drem)(double, double) = my_drem;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:f8,f8:f8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:f8,f8:f8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1529,7 +1527,7 @@
 
     if (!addr) {
         double (*p_ddiv)(double, double) = ddiv;
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:f8,f8:f8;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:f8,f8:f8;");
         assert(cs);
         if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1567,7 +1565,7 @@
     if (wrappers.lookup(stub, &_junk, &wrapper)) return wrapper;
 
     LilCodeStub* cs = lil_parse_code_stub(
-        "entry 0:managed:arbitrary;"
+        "entry 0:stdcall:arbitrary;"
         "inc [%0i:g4];"
         "tailcall %1i;",
         dyncount, lil_npc_to_fp(stub));
@@ -1591,7 +1589,7 @@
         return addr;
     }
     void (*hythread_safe_point_ptr)() = jvmti_safe_point;
-    LilCodeStub* cs = lil_parse_code_stub("entry 0:managed::void;");
+    LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall::void;");
     assert(cs);
     if (dyn_count) {
         cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1624,7 +1622,7 @@
             return addr;
     }
     void (*jvmti_method_enter_callback_ptr)(Method_Handle) = jvmti_method_enter_callback;
-    LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:pint:void;");
+    LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:pint:void;");
     assert(cs);
     if (dyn_count) {
             cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1653,7 +1651,7 @@
         return addr;
     }
     void (*jvmti_method_exit_callback_ptr)(Method_Handle, jvalue *) = jvmti_method_exit_callback;
-    LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:pint,pint:void;");
+    LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:pint,pint:void;");
     assert(cs);
     if (dyn_count) {
         cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1661,14 +1659,7 @@
     }
     cs = lil_parse_onto_end(cs,
         "push_m2n 0, %0i;"
-        "out platform:pint,pint:void;"
-#ifdef _EM64T_
-        "o0=i0;"
-        "o1=i1;"
-#else
-        "o0=i1;"
-        "o1=i0;"
-#endif
+        "in2out platform:void;"
         "call %1i;"
         "pop_m2n;"
         "ret;",
@@ -1691,7 +1682,7 @@
     void (*jvmti_field_access_callback_ptr)(Field_Handle, Method_Handle,
             jlocation, ManagedObject*) = jvmti_field_access_callback;
 
-    LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:pint,pint,g8,pint:void;");
+    LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:pint,pint,g8,pint:void;");
     assert(cs);
     if (dyn_count) {
         cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1718,7 +1709,7 @@
     //        return addr;
     //    }
     //LilCodeStub* cs = lil_parse_code_stub(
-    //    "entry 0:managed:pint,pint,g8,pint:void;"
+    //    "entry 0:stdcall:pint,pint,g8,pint:void;"
     //    "push_m2n 0, 0;"
     //    "in2out platform:void;"
     //    "call %0i;"
@@ -1738,7 +1729,7 @@
         }
     void (*jvmti_field_modification_callback_ptr)(Field_Handle, Method_Handle,
             jlocation, ManagedObject*, jvalue*) = jvmti_field_modification_callback;
-    LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:pint,pint,g8,pint,pint:void;");
+    LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:pint,pint,g8,pint,pint:void;");
     assert(cs);
     if (dyn_count) {
         cs = lil_parse_onto_end(cs, "inc [%0i:pint];", dyn_count);
@@ -1765,7 +1756,7 @@
     //    return addr;
     //}
     //LilCodeStub* cs = lil_parse_code_stub(
-    //    "entry 0:managed:pint,pint,g8,pint,pint:void;"
+    //    "entry 0:stdcall:pint,pint,g8,pint,pint:void;"
     //    "push_m2n 0, 0;"
     //    "in2out platform:void;"
     //    "call %0i;"
@@ -1797,11 +1788,11 @@
     LilCodeStub* cs = NULL;
     const char* in2out = NULL;
     if (type == ResolveResType_Unmanaged) {
-        cs = lil_parse_code_stub("entry 0:rth:pint,pint:pint;");
+        cs = lil_parse_code_stub("entry 0:stdcall:pint,pint:pint;");
         in2out = "in2out platform:pint;";
     } else {
         assert(type == ResolveResType_Managed);
-        cs = lil_parse_code_stub("entry 0:rth:pint,pint:ref;");
+        cs = lil_parse_code_stub("entry 0:stdcall:pint,pint:ref;");
         in2out = "in2out platform:ref;";
     }
     assert(cs);
@@ -1836,11 +1827,11 @@
     LilCodeStub* cs = NULL;
     const char* in2out = NULL;
     if (type == ResolveResType_Unmanaged) {
-        cs = lil_parse_code_stub("entry 0:rth:pint,pint,ref:pint;");
+        cs = lil_parse_code_stub("entry 0:stdcall:pint,pint,ref:pint;");
         in2out = "in2out platform:pint;";
     } else {
         assert(type == ResolveResType_Managed);
-        cs = lil_parse_code_stub("entry 0:rth:pint,pint,ref:ref;");
+        cs = lil_parse_code_stub("entry 0:stdcall:pint,pint,ref:ref;");
         in2out = "in2out platform:ref;";
     }
 
@@ -1875,11 +1866,11 @@
     LilCodeStub* cs = NULL;
     const char* in2out = NULL;
     if (type == ResolveResType_Unmanaged) {
-        cs = lil_parse_code_stub("entry 0:rth:pint,pint,pint:pint;");
+        cs = lil_parse_code_stub("entry 0:stdcall:pint,pint,pint:pint;");
         in2out = "in2out platform:pint;";
     } else {
         assert(type == ResolveResType_Managed);
-        cs = lil_parse_code_stub("entry 0:rth:pint,pint,pint:ref;");
+        cs = lil_parse_code_stub("entry 0:stdcall:pint,pint,pint:ref;");
         in2out = "in2out platform:ref;";
     }
 
@@ -2909,7 +2900,7 @@
     if (is_checkcast) {
         // args: ManagedObject *obj, Class *super; returns a ManagedObject*
         cs = lil_parse_code_stub
-        ("entry 0:rth:ref,pint:ref;"
+        ("entry 0:stdcall:ref,pint:ref;"
          "jc i0!=%0i:ref,nonnull;"
          "r=i0;"  // return obj if obj==NULL
          "ret;",
@@ -2918,7 +2909,7 @@
     else {
         // args: ManagedObject *obj, Class *super; returns a boolean
         cs = lil_parse_code_stub
-        ("entry 0:rth:ref,pint:g4;"
+        ("entry 0:stdcall:ref,pint:g4;"
          "jc i0!=%0i:ref,nonnull;"
          "r=0:g4;"  // return FALSE if obj==NULL
          "ret;",
@@ -2969,7 +2960,7 @@
     if (is_checkcast) {
         // args: ManagedObject *obj, Class *super; returns a ManagedObject*
         cs = lil_parse_code_stub
-        ("entry 0:rth:ref,pint:ref;"
+        ("entry 0:stdcall:ref,pint:ref;"
          "jc i0!=%0i,nonnull;"
          "r=i0;"  // return obj if obj==NULL
          "ret;",
@@ -2978,7 +2969,7 @@
     else {
         // args: ManagedObject *obj, Class *super; returns a boolean
         cs = lil_parse_code_stub
-        ("entry 0:rth:ref,pint:g4;"
+        ("entry 0:stdcall:ref,pint:g4;"
          "jc i0!=%0i,nonnull;"
          "r=0:g4;"  // return FALSE if obj==NULL
          "ret;",
@@ -3235,7 +3226,7 @@
 // 20030505 This JIT support routine expects to be called directly from managed code. 
 // The return value is either NULL or the ClassHandle for an exception to throw.
 void * __stdcall
-vm_rt_aastore(ManagedObject *elem, int idx, Vector_Handle array)
+vm_rt_aastore(Vector_Handle array, int idx, ManagedObject *elem)
 {
 #ifdef VM_STATS
     VM_Statistics::get_vm_stats().num_aastore ++;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp?rev=593136&r1=593135&r2=593136&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/rt_helper_info.cpp Thu Nov  8 04:01:07
2007
@@ -57,7 +57,7 @@
     {VM_RT_ARRAY_STORE_EXCEPTION,              "VM_RT_ARRAY_STORE_EXCEPTION",
             INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0},
     {VM_RT_THROW_LINKING_EXCEPTION,            "VM_RT_THROW_LINKING_EXCEPTION",
-            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_DRL,                  0},
+            INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              0},
     {VM_RT_THROW_SET_STACK_TRACE,              "VM_RT_THROW_SET_STACK_TRACE",
             INTERRUPTIBLE_ALWAYS,              CALLING_CONVENTION_STDCALL,              1},
 
@@ -137,11 +137,11 @@
     {VM_RT_D2L,                                "VM_RT_D2L",
             INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              1},
     {VM_RT_LSHL,                               "VM_RT_LSHL",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_DRL,                  2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
     {VM_RT_LSHR,                               "VM_RT_LSHR",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_DRL,                  2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
     {VM_RT_LUSHR,                              "VM_RT_LUSHR",
-            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_DRL,                  2},
+            INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
     {VM_RT_LMUL,                               "VM_RT_LMUL",
             INTERRUPTIBLE_NEVER,               CALLING_CONVENTION_STDCALL,              2},
 #ifdef VM_LONG_OPT

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/ini_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/ini_em64t.cpp?rev=593136&r1=593135&r2=593136&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/ini_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/ini_em64t.cpp Thu Nov  8 04:01:07
2007
@@ -39,6 +39,7 @@
 #include "encoder.h"
 #include "ini.h"
 #include "lil_code_generator_utils.h"
+#include "jit_runtime_support_common.h"
 
 #define LOG_DOMAIN "vm.helpers"
 #include "cxxlog.h"
@@ -111,6 +112,8 @@
     func = (invoke_managed_func_int_t) stub;
     stub = push(stub, rbp_opnd);
     stub = mov(stub, rbp_opnd, rsp_opnd);
+
+    assert(MANAGED_STACK_ALIGNMENT == STACK_ALIGN_HALF16);
 
     // align stack pointer if required (rsp % 16 == 0)
     stub = alu(stub, and_opc, rsp_opnd, Imm_Opnd(0xfffffff0));

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp?rev=593136&r1=593135&r2=593136&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp
Thu Nov  8 04:01:07 2007
@@ -348,7 +348,7 @@
         return addr;
     }    
 
-    LilCodeStub * cs = lil_parse_code_stub("entry 0:managed:pint:void;");
+    LilCodeStub * cs = lil_parse_code_stub("entry 0:stdcall:pint:void;");
 #ifdef VM_STATS
 //    int * value = VM_Statistics::get_vm_stats().rt_function_calls.lookup_or_add((void*)VM_RT_MONITOR_ENTER_STATIC,
0, NULL);
 //    cs = lil_parse_onto_end(cs, "inc [%0i:pint];", value);
@@ -383,7 +383,7 @@
         return addr;
     }    
 
-    LilCodeStub * cs = lil_parse_code_stub("entry 0:managed:ref:void;");
+    LilCodeStub * cs = lil_parse_code_stub("entry 0:stdcall:ref:void;");
 
 #ifdef VM_STATS
 //    int * value = VM_Statistics::get_vm_stats().rt_function_calls.lookup_or_add((void*)VM_RT_MONITOR_ENTER,
0, NULL);
@@ -406,7 +406,7 @@
     // throw NullPointerException
     cs = lil_parse_onto_end(cs,
         ":throw_null_pointer;"
-        "out managed::void;"
+        "out stdcall::void;"
         "call.noret %0i;",
         lil_npc_to_fp(exn_get_rth_throw_null_pointer())
     );
@@ -429,7 +429,7 @@
     }    
 
     LilCodeStub * cs = lil_parse_code_stub(
-        "entry 0:managed:ref:void;"
+        "entry 0:stdcall:ref:void;"
         "locals 1;"
         "l0 = i0;"
     );    
@@ -476,7 +476,7 @@
             "jc r!=%1i, illegal_monitor;"
             "ret;"
             ":illegal_monitor;"
-            "out managed::void;"
+            "out stdcall::void;"
             "call.noret %2i;",
             vm_monitor_try_exit,
             (POINTER_SIZE_INT)TM_ERROR_NONE,
@@ -491,7 +491,7 @@
         return addr;
     }    
 
-    LilCodeStub * cs = lil_parse_code_stub("entry 0:managed:pint:void;");
+    LilCodeStub * cs = lil_parse_code_stub("entry 0:stdcall:pint:void;");
 #ifdef VM_STATS
 //    int * value = VM_Statistics::get_vm_stats().rt_function_calls.lookup_or_add((void*)VM_RT_MONITOR_EXIT_STATIC,
0, NULL);
 //    cs = lil_parse_onto_end(cs, "inc [%0i:pint];", value);
@@ -527,7 +527,7 @@
         return addr;
     }    
 
-    LilCodeStub * cs = lil_parse_code_stub("entry 0:managed:ref:void;");
+    LilCodeStub * cs = lil_parse_code_stub("entry 0:stdcall:ref:void;");
 
 #ifdef VM_STATS
 //    int * value = VM_Statistics::get_vm_stats().rt_function_calls.lookup_or_add((void*)VM_RT_MONITOR_EXIT,
0, NULL);
@@ -550,7 +550,7 @@
     // throw NullPointerException
     cs = lil_parse_onto_end(cs,
         ":throw_null_pointer;"
-        "out managed::void;"
+        "out stdcall::void;"
         "call.noret %0i;",
         lil_npc_to_fp(exn_get_rth_throw_null_pointer())
     );
@@ -573,7 +573,7 @@
     }    
 
     LilCodeStub * cs = lil_parse_code_stub(
-        "entry 0:managed:ref:void;"
+        "entry 0:stdcall:ref:void;"
         "in2out platform:g4;"
     );    
     assert(cs);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_runtime_support_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_runtime_support_em64t.cpp?rev=593136&r1=593135&r2=593136&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_runtime_support_em64t.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_runtime_support_em64t.cpp
Thu Nov  8 04:01:07 2007
@@ -83,7 +83,7 @@
         return addr;
     }
 
-    LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:g4,pint:ref;");
+    LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g4,pint:ref;");
     assert(cs);
 
 #ifdef VM_STATS
@@ -114,7 +114,7 @@
         return addr;
     }
 
-    LilCodeStub* cs = lil_parse_code_stub("entry 0:managed:g4,pint:ref;");
+    LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall:g4,pint:ref;");
     assert(cs);
 
 #ifdef VM_STATS

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp?rev=593136&r1=593135&r2=593136&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp Thu Nov  8 04:01:07
2007
@@ -19,8 +19,6 @@
  * @version $Revision: 1.1.2.1.4.3 $
  */  
 
-
-
 //MVM
 #include <iostream>
 
@@ -33,6 +31,7 @@
 #include "Class.h"
 #include "exceptions.h"
 #include "vm_threads.h"
+#include "jit_runtime_support_common.h"
 
 #include "compile.h"
 #include "nogc.h"
@@ -41,6 +40,7 @@
 #include "environment.h"
 #include "lil.h"
 #include "lil_code_generator.h"
+#include "lil_code_generator_utils.h"
 
 #include "interpreter.h"
 
@@ -49,62 +49,107 @@
 #define LOG_DOMAIN "invoke"
 #include "cxxlog.h"
 
-#ifdef _WIN32
-static int64 __declspec(naked) __stdcall
-vm_invoke_native_array_stub(uint32 *args,
-                            int sz,
-                            void* f)
-{
-    __asm {
-        push ebp
-        mov ebp, esp
-        push ebx // FIXME: check jit calling conventions,
-        push esi // is it necessary to save the registers here
-        push edi
-
-        mov eax, [ebp+8]
-        mov ecx, [ebp+12]
-        lea eax, [eax+ecx*4-4]
-        sub eax, esp
-        or ecx, ecx
-        je e
-        l:
-        push [esp+eax]
-        loop l
-        e:
-        mov eax, [ebp+16]
-        call eax
-        lea esp, [ebp-12]
-        pop edi
-        pop esi
-        pop ebx
-        leave
-        ret
+#include "dump.h"
+
+typedef double (*DoubleFuncPtr)(uint32* args, int args_size, void* func);
+typedef ManagedObject* (*RefFuncPtr)(uint32* args, int args_size, void* func);
+typedef float (*FloatFuncPtr)(uint32* args, int args_size, void* func);
+typedef int32 (*IntFuncPtr)(uint32* args, int args_size, void* func);
+
+static IntFuncPtr gen_invoke_managed_func() {
+    static IntFuncPtr func = NULL;
+    
+    if (func) {
+        return func;
     }
-}
-#else /* Linux */
-extern "C" {
-    int64 vm_invoke_native_array_stub(uint32 *args,
-                                      int sz,
-                                      void *func);
-}
 
+    // Defines stack alignment on managed function enter.
+    const int32 STACK_ALIGNMENT = MANAGED_STACK_ALIGNMENT;
+    const int32 STACK_ALIGNMENT_MASK = ~(STACK_ALIGNMENT - 1);
+    const char * LOOP_BEGIN = "loop_begin";
+    const char * LOOP_END = "loop_end";
+
+    // [ebp + 8] - args
+    // [ebp + 12] - size
+    // [ebp + 16] - func
+    const int32 STACK_ARGS_OFFSET = 8;
+    const int32 STACK_NARGS_OFFSET = 12;
+    const int32 STACK_FUNC_OFFSET = 16;
+    const int32 STACK_CALLEE_SAVED_OFFSET = -12;
+    
+    const int STUB_SIZE = 124;
+    char * stub = (char *) malloc_fixed_code_for_jit(STUB_SIZE,
+        DEFAULT_CODE_ALIGNMENT, CODE_BLOCK_HEAT_DEFAULT, CAA_Allocate);
+#ifdef _DEBUG
+    memset(stub, 0xcc /*int 3*/, STUB_SIZE);
 #endif
+    
+    tl::MemoryPool pool;
+    LilCguLabelAddresses labels(&pool, stub);
+    
+    func = (IntFuncPtr) stub;
+
+    // Initialize ebp-based stack frame.
+    stub = push(stub, ebp_opnd);
+    stub = mov(stub, ebp_opnd, esp_opnd);
+    
+    // Preserve callee-saved registers.
+    stub = push(stub, ebx_opnd);
+    stub = push(stub, esi_opnd);
+    stub = push(stub, edi_opnd);
+
+    // Load an array of arguments ('args') and its size from the stack.
+    stub = mov(stub, eax_opnd, M_Base_Opnd(ebp_reg, STACK_ARGS_OFFSET));
+    stub = mov(stub, ecx_opnd, M_Base_Opnd(ebp_reg, STACK_NARGS_OFFSET));
+    
+
+    // Align memory stack.
+    stub = lea(stub, ebx_opnd, M_Index_Opnd(n_reg, ecx_reg, 4, 4));
+    stub = mov(stub, esi_opnd, ebx_opnd);
+    stub = neg(stub, esi_opnd);
+    stub = alu(stub, add_opc, esi_opnd, esp_opnd);
+    stub = alu(stub, and_opc, esi_opnd, Imm_Opnd(size_32, STACK_ALIGNMENT_MASK));
+    stub = alu(stub, add_opc, ebx_opnd, esi_opnd);
+    stub = mov(stub, esp_opnd, ebx_opnd);
+    
+    // Load a pointer to the last argument of 'args' array.
+    stub = lea(stub, eax_opnd, M_Index_Opnd(eax_reg, ecx_reg, -4, 4));
+    stub = alu(stub, sub_opc, eax_opnd, esp_opnd);
+    stub = alu(stub, or_opc, ecx_opnd, ecx_opnd);
+    stub = branch8(stub, Condition_Z, Imm_Opnd(size_8, 0));
+    labels.add_patch_to_label(LOOP_END, stub - 1, LPT_Rel8);
+    
+// LOOP_BEGIN:
+    // Push inputs on the stack.
+    labels.define_label(LOOP_BEGIN, stub, false);
+    
+    stub = push(stub, M_Index_Opnd(esp_reg, eax_reg, 0, 1));
+    stub = loop(stub, Imm_Opnd(size_8, 0));
+    labels.add_patch_to_label(LOOP_BEGIN, stub - 1, LPT_Rel8);
+
+// LOOP_END:    
+    labels.define_label(LOOP_END, stub, false);
+    
+    // Call target function.
+    stub = mov(stub, eax_opnd, M_Base_Opnd(ebp_reg, STACK_FUNC_OFFSET));
+    stub = call(stub, eax_opnd);
+    
+    // Restore callee-saved registers from the stack.
+    stub = lea(stub, esp_opnd, M_Base_Opnd(ebp_reg, STACK_CALLEE_SAVED_OFFSET));
+    stub = pop(stub, edi_opnd);
+    stub = pop(stub, esi_opnd);
+    stub = pop(stub, ebx_opnd);
+    
+    // Leave current frame.
+    stub = pop(stub, ebp_opnd);
+    stub = ret(stub);
+    
+    assert(stub - (char *)func <= STUB_SIZE);
 
-typedef double (*DoubleFuncPtr)(uint32*,int,void*);
-typedef ManagedObject* (*RefFuncPtr)(uint32*,int,void*);
-typedef float (*FloatFuncPtr)(uint32*,int,void*);
-typedef int32 (*IntFuncPtr)(uint32*,int,void*);
-
-DoubleFuncPtr vm_invoke_native_array_stub_double =
-        (DoubleFuncPtr) vm_invoke_native_array_stub;
-RefFuncPtr vm_invoke_native_array_stub_ref =
-        (RefFuncPtr) vm_invoke_native_array_stub;
-IntFuncPtr vm_invoke_native_array_stub_int =
-        (IntFuncPtr) vm_invoke_native_array_stub;
-FloatFuncPtr vm_invoke_native_array_stub_float =
-        (FloatFuncPtr) vm_invoke_native_array_stub;
+    DUMP_STUB(func, "invoke_managed_func", stub - (char *)func);
 
+    return func;
+}
 
 void
 JIT_execute_method_default(JIT_Handle jit, jmethodID methodID, jvalue *return_value, jvalue
*args) {
@@ -117,6 +162,8 @@
 
 //    fprintf(stderr, "Not implemented\n");
 
+    static const IntFuncPtr invoke_managed_func = gen_invoke_managed_func();
+
     Method *method = (Method*) methodID;
     TRACE("enter method "
             << method->get_class()->get_name()->bytes << " "
@@ -196,14 +243,14 @@
 
     switch(ret_type) {
         case JAVA_TYPE_VOID:
-            vm_invoke_native_array_stub(arg_words, argId, meth_addr);
+            invoke_managed_func(arg_words, argId, meth_addr);
             break;
 
         case JAVA_TYPE_CLASS:
         case JAVA_TYPE_ARRAY:
         case JAVA_TYPE_STRING:
             {
-                ManagedObject *ref = vm_invoke_native_array_stub_ref(arg_words, argId, meth_addr);
+                ManagedObject *ref = ((RefFuncPtr)invoke_managed_func)(arg_words, argId,
meth_addr);
                 ObjectHandle h = oh_allocate_local_handle();
 
                 if (ref != NULL) {
@@ -220,19 +267,19 @@
         case JAVA_TYPE_CHAR:
         case JAVA_TYPE_SHORT:
         case JAVA_TYPE_INT:
-            resultPtr->i = vm_invoke_native_array_stub_int(arg_words, argId, meth_addr);
+            resultPtr->i = ((IntFuncPtr)invoke_managed_func)(arg_words, argId, meth_addr);
             break;
 
         case JAVA_TYPE_FLOAT:
-            resultPtr->f = vm_invoke_native_array_stub_float(arg_words, argId, meth_addr);
+            resultPtr->f = ((FloatFuncPtr)invoke_managed_func)(arg_words, argId, meth_addr);
             break;
 
         case JAVA_TYPE_LONG:
-            resultPtr->j = vm_invoke_native_array_stub(arg_words, argId, meth_addr);
+            resultPtr->j = ((IntFuncPtr)invoke_managed_func)(arg_words, argId, meth_addr);
             break;
 
         case JAVA_TYPE_DOUBLE:
-            resultPtr->d = vm_invoke_native_array_stub_double(arg_words, argId, meth_addr);
+            resultPtr->d = ((DoubleFuncPtr)invoke_managed_func)(arg_words, argId, meth_addr);
             break;
 
         default:

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp?rev=593136&r1=593135&r2=593136&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
Thu Nov  8 04:01:07 2007
@@ -232,7 +232,7 @@
 
     if (VM_Global_State::loader_env->use_lil_stubs) {
         LilCodeStub* cs = lil_parse_code_stub(
-            "entry 0:managed:pint:void;   // The single argument is a Class_Handle \n"
+            "entry 0:stdcall:pint:void;   // The single argument is a Class_Handle \n"
             "locals 3;\
              in2out platform:pint; \
              call %0i; \
@@ -495,16 +495,16 @@
 
 
 static void *__stdcall
-aastore_ia32(volatile ManagedObject *elem,
+aastore_ia32(Vector_Handle array,
              int idx,
-             Vector_Handle array);
+             volatile ManagedObject *elem);
 
 
 // 20030321 This JIT support routine expects to be called directly from managed code. 
 static void *__stdcall
-aastore_ia32(volatile ManagedObject *elem,
+aastore_ia32(Vector_Handle array,
             int idx,
-            Vector_Handle array)
+            volatile ManagedObject *elem)
 {
 #ifdef REFS_RUNTIME_OR_COMPRESSED
     REFS_RUNTIME_SWITCH_IF
@@ -578,8 +578,8 @@
     }
 
     LilCodeStub* cs = lil_parse_code_stub(
-        "entry 0:managed:ref,pint,ref:void;   // The args are the element ref to store, the
index, and the array to store into\n"
-        "in2out managed:pint; "
+        "entry 0:stdcall:ref,pint,ref:void;   // The args are the array to store into, the
index, and the element ref to store\n"
+        "in2out stdcall:pint; "
         "call %0i;                            // vm_rt_aastore either returns NULL or the
ClassHandle of an exception to throw \n"
         "jc r!=0,aastore_failed; \
          ret; \

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp?rev=593136&r1=593135&r2=593136&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp Thu
Nov  8 04:01:07 2007
@@ -566,7 +566,7 @@
     }
 
     if (VM_Global_State::loader_env->use_lil_stubs) {
-        LilCodeStub* cs = lil_parse_code_stub("entry 0:managed::ref;");
+        LilCodeStub* cs = lil_parse_code_stub("entry 0:stdcall::ref;");
         assert(cs);
         cs = lil_parse_onto_end(cs,
             "push_m2n 0, 0;"
@@ -818,7 +818,7 @@
     // Allocate frame, save pfs, b0, and gp
     int out0, save_pfs, save_b0, save_gp;
     const int num_in_args = 3, num_out_args = 3;
-    void *(*p_vm_rt_aastore)(ManagedObject *elem, int idx, Vector_Handle array);
+    void *(*p_vm_rt_aastore)(Vector_Handle array, int idx, ManagedObject *elem);
     p_vm_rt_aastore = vm_rt_aastore;
     emit_alloc_for_single_call(emitter, num_in_args, num_out_args,
         (void **)p_vm_rt_aastore,



Mime
View raw message