* src/vm/jit/arm/codegen.c: Remove hack for return value in float registers.
[cacao.git] / src / vm / jit / intrp / java.vmg
index a8ee027eec611778a0b25980e7162f9ed00b7af1..597d23077990256e7e8952ab1d2eea08a8dfd62a 100644 (file)
@@ -54,6 +54,7 @@
 \E s" u1 *"                single data-stack type-prefix addr
 \E s" functionptr"         single data-stack type-prefix af
 \E s" methodinfo *"        single data-stack type-prefix am
+\E s" fieldinfo *"         single data-stack type-prefix afi
 \E s" Cell *"              single data-stack type-prefix acell
 \E s" Inst *"              single data-stack type-prefix ainst
 \E s" unresolved_field *"  single data-stack type-prefix auf
@@ -853,7 +854,7 @@ LOOKUPSWITCH ( #iNpairs #addrSegment #iOffset #ainstDefault iKey -- ) 0xab
 IRETURN ( #vOffsetFP ... vValue -- vResult ) 0xac
 {
   Inst *new_ip;
-  Cell *currentsp = sp;
+  MAYBE_UNUSED Cell *currentsp = sp;
   new_ip = (Inst *) access_local_cell(vOffsetFP - SIZEOF_VOID_P);
   sp = fp + 1;
   fp = (Cell *) access_local_cell(vOffsetFP);
@@ -865,7 +866,7 @@ IRETURN ( #vOffsetFP ... vValue -- vResult ) 0xac
 LRETURN ( #vOffsetFP ... lValue -- lResult ) 0xad
 {
   Inst *new_ip;
-  Cell *currentsp = sp;
+  MAYBE_UNUSED Cell *currentsp = sp;
   new_ip = (Inst *) access_local_cell(vOffsetFP - SIZEOF_VOID_P);
   sp = fp + 1;
   fp = (Cell *) access_local_cell(vOffsetFP);
@@ -877,7 +878,7 @@ LRETURN ( #vOffsetFP ... lValue -- lResult ) 0xad
 RETURN ( #vOffsetFP ... -- ) 0xb1
 {
   Inst *new_ip;
-  Cell *currentsp = sp;
+  MAYBE_UNUSED Cell *currentsp = sp;
   new_ip = (Inst *) access_local_cell(vOffsetFP - SIZEOF_VOID_P);
   sp = fp + 1;
   fp = (Cell *) access_local_cell(vOffsetFP);
@@ -991,7 +992,7 @@ INVOKEVIRTUAL ( #vOffset #iNargs #am ... -- ... acelloldfp ainstoldip ) 0xd8
   acelloldfp = fp;
   ainstoldip = IP;
   fp = sp - 1 + iNargs;
-  sp = fp - MAXLOCALS(stub) + 1;
+  sp = fp - FRAMESIZE(stub) + 1;
   SET_IP(target);
 }
 
@@ -1002,7 +1003,7 @@ INVOKESTATIC ( #aaTarget #iNargs #am ... -- ... acelloldfp ainstoldip ) 0xb8
   acelloldfp = fp;
   ainstoldip = IP;
   fp = sp - 1 + iNargs; /* !! scale nargs at translation time */
-  sp = fp - MAXLOCALS(aaTarget) + 1;
+  sp = fp - FRAMESIZE(aaTarget) + 1;
   SET_IP(target);
 }
 
@@ -1015,7 +1016,7 @@ INVOKESPECIAL ( #aaTarget #iNargs #am ... -- ... acelloldfp ainstoldip ) 0xb7
   acelloldfp = fp;
   ainstoldip = IP;
   fp = sp - 1 + iNargs; /* !! scale nargs at translation time */
-  sp = fp - MAXLOCALS(aaTarget) + 1;
+  sp = fp - FRAMESIZE(aaTarget) + 1;
   SET_IP(target);
 }
 
@@ -1035,7 +1036,7 @@ INVOKEINTERFACE ( #iInterfaceOffset #vOffset #iNargs #am ... -- ... acelloldfp a
   acelloldfp = fp;
   ainstoldip = IP;
   fp = sp - 1 + iNargs;
-  sp = fp - MAXLOCALS(stub) + 1;
+  sp = fp - FRAMESIZE(stub) + 1;
   SET_IP(target);
 }
 
@@ -1247,16 +1248,21 @@ ARRAYINSTANCEOF ( aRef aClass  -- iResult )
 MONITORENTER ( aRef -- )
 {
 #if defined(ENABLE_THREADS)
-  /* CHECK_NULL_PTR(aRef); is now done explicitly */
-  lock_monitor_enter(aRef);
+  /* CHECK_NULL_PTR(aRef); is now done explicitly inside lock_monitor_enter */
+  global_sp = sp;
+  if (!lock_monitor_enter(aRef))
+       THROW0;
+  CLEAR_global_sp;
 #endif
 }
 
 MONITOREXIT ( aRef -- )
 {
 #if defined(ENABLE_THREADS)
-  /* CHECK_NULL_PTR(aRef); cannot happen */
-  lock_monitor_exit(aRef);
+  global_sp = sp;
+  if (!lock_monitor_exit(aRef))
+       THROW0;
+  CLEAR_global_sp;
 #endif
 }
 
@@ -1826,14 +1832,13 @@ Cell v = sp[0];
 float f;
 vm_Cell2f(v,f);
 #if !defined(NDEBUG)
-builtin_displaymethodstop(am, (s8) v, f, f);
+builtin_verbosecall_exit((s8) v, f, f, am);
 #endif
 }
 if (*exceptionptr)
   THROW0;
 
 PATCHER_NATIVECALL ( #am #af #addrcif ... -- )
-#if !defined(WITH_STATIC_CLASSPATH)
 stackframeinfo sfi;
 bool result;
 global_sp = sp;
@@ -1847,40 +1852,64 @@ STORE_ORDER_BARRIER();
 IP[-4] = opt_verbosecall ? INST_ADDR(TRACENATIVECALL) : INST_ADDR(NATIVECALL);
 SET_IP(IP - 4);
 patchersuper_rewrite(IP);
-#else
-assert(false);
-#endif
 
 TRACECALL ( #am -- )
 #if !defined(NDEBUG)
-builtin_trace_args(
-       access_local_cell(0 * -SIZEOF_VOID_P),
-       access_local_cell(1 * -SIZEOF_VOID_P),
-       access_local_cell(2 * -SIZEOF_VOID_P),
-       access_local_cell(3 * -SIZEOF_VOID_P),
+#if SIZEOF_VOID_P == 4
+{
+    s8 args[TRACE_ARGS_NUM];
+    int i;
+    int ofs = 0;
+    typedesc *params = am->parseddesc->paramtypes;
+    for (i=0; i < TRACE_ARGS_NUM; ++i, ++params) {
+        if (IS_2_WORD_TYPE(params->type)) {
+            vm_twoCell2l(access_local_cell(ofs), access_local_cell(ofs - SIZEOF_VOID_P), args[i]);
+            ofs -= 2*SIZEOF_VOID_P;
+        }
+        else {
+            args[i] = access_local_cell(ofs);
+            ofs -= SIZEOF_VOID_P;
+        }
+    }
+    builtin_verbosecall_enter(args[0], args[1], args[2], args[3],  
+#if TRACE_ARGS_NUM > 4
+                              args[4], args[5],
+#endif
+#if TRACE_ARGS_NUM == 8
+                              args[6], args[7],
+#endif
+                              am);
+}
+#else /* SIZEOF_VOID_P */
+    builtin_verbosecall_enter(
+        access_local_cell(0 * -SIZEOF_VOID_P),
+        access_local_cell(1 * -SIZEOF_VOID_P),
+        access_local_cell(2 * -SIZEOF_VOID_P),
+        access_local_cell(3 * -SIZEOF_VOID_P),
 #if TRACE_ARGS_NUM > 4
-       access_local_cell(4 * -SIZEOF_VOID_P),
-       access_local_cell(5 * -SIZEOF_VOID_P),
+        access_local_cell(4 * -SIZEOF_VOID_P),
+        access_local_cell(5 * -SIZEOF_VOID_P),
 #endif
 #if TRACE_ARGS_NUM == 8
-       access_local_cell(6 * -SIZEOF_VOID_P),
-       access_local_cell(7 * -SIZEOF_VOID_P),
+        access_local_cell(6 * -SIZEOF_VOID_P),
+        access_local_cell(7 * -SIZEOF_VOID_P),
 #endif
-       am);
+        am);
+#endif /* SIZEOF_VOID_P */
 #endif /* !defined(NDEBUG) */
 
 TRACERETURN ( #am v -- v )
 float f;
 vm_Cell2f(v,f);
 #if !defined(NDEBUG)
-builtin_displaymethodstop(am, (s8) v, f, f);
+builtin_verbosecall_exit((s8) v, f, f, am);
 #endif
 
 TRACELRETURN ( #am l -- l )
 Double_Store ds;
 ds.l = l;
 #if !defined(NDEBUG)
-builtin_displaymethodstop(am, l, ds.d, ds.d);
+builtin_verbosecall_exit(l, ds.d, ds.d, am);
 #endif
 
 END ( ... -- )