* src/vm/jit/intrp/engine.c (THROW_CLASSCASTEXCEPTION): Really throw a
authoredwin <none@none>
Wed, 4 Oct 2006 18:23:19 +0000 (18:23 +0000)
committeredwin <none@none>
Wed, 4 Oct 2006 18:23:19 +0000 (18:23 +0000)
ClassCastException, not a NullPointerException.

* src/vm/jit/intrp/asmpart.c (intrp_asm_handle_exception): Set
global_sp, in case the resolving of the catchtype involves the
execution of Java code.

* src/vm/jit/intrp/java.vmg (MONITORENTER): Check for exception.
(MONITOREXIT): Likewise.

src/vm/jit/intrp/asmpart.c
src/vm/jit/intrp/engine.c
src/vm/jit/intrp/java.vmg

index 288fa7c3a96673bbf9b590a34c3cf6da826c227e..ac13697f33a19b61e4a6438241efec505ab100cc 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes:
 
-   $Id: asmpart.c 5668 2006-10-04 16:01:53Z edwin $
+   $Id: asmpart.c 5670 2006-10-04 18:23:19Z edwin $
 
 */
 
@@ -217,6 +217,11 @@ Inst *intrp_asm_handle_exception(Inst *ip, java_objectheader *o, Cell *fp, Cell
                                  /* might fail, even if the result of the resolution would   */
                                  /* be an already loaded class.                              */
 
+                                 /* The resolving may involve Java code, so we need a usable */
+                                 /* global_sp. XXX is this a correct value for global_sp?    */
+
+                                 global_sp = (Cell *)(((u1 *)fp) - framesize - SIZEOF_VOID_P);
+
                                  c = resolve_classref_eager(cr.ref);
 
                                  if (c == NULL) {
index 0b163d3c84b13915b2e04b582ebad29f2f6446f0..1f617ee4f13654696bf77706eb438b54f874078c 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes:
 
-   $Id: engine.c 5666 2006-10-04 15:04:52Z twisti $
+   $Id: engine.c 5670 2006-10-04 18:23:19Z edwin $
 */
 
 
 #define THROW_CLASSCASTEXCEPTION(o) \
     { \
                classcastexception_object = o; \
-        THROW(nullpointerexception); \
+        THROW(classcastexception); \
        }
 
 #define CHECK_OUT_OF_BOUNDS(_array, _idx)              \
index a8ee027eec611778a0b25980e7162f9ed00b7af1..e32bb61bf18cea0113b6e2ea93c9d9ce5f23856a 100644 (file)
@@ -1247,16 +1247,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
 }