diff src/main/gov/nasa/jpf/jvm/bytecode/NEW.java @ 23:db918c531e6d

streamlined class init, which was a mixed case of registerClass()/initializeClass() and pushRequiredClinits(). Now it is a single initializeClass(ti) method which combines the previous initializeClass(), pushRequiredClinits() and pushClinit() methods. The reason for combining these is the forthcoming replacement of separately locked clinits from different DirectCallStackFrames with a single synthetic frame that calls clinits from nested synchronized blocks. This is required to model hotspot, which does cause deadlocks with concurrent init of classes that cause subclass init during their clinit executions.
author Peter Mehlitz <Peter.C.Mehlitz@nasa.gov>
date Wed, 15 Apr 2015 22:40:21 -0700
parents 61d41facf527
children
line wrap: on
line diff
--- a/src/main/gov/nasa/jpf/jvm/bytecode/NEW.java	Tue Apr 14 15:01:25 2015 -0700
+++ b/src/main/gov/nasa/jpf/jvm/bytecode/NEW.java	Wed Apr 15 22:40:21 2015 -0700
@@ -57,16 +57,11 @@
       return ti.getPC();
     }
 
-    if (!ci.isRegistered()){
-      ci.registerClass(ti);
+    if (ci.initializeClass(ti)){
+      // continue with the topframe and re-exec this insn once the clinits are done
+      return ti.getPC();
     }
 
-    // we might have to execute clinits
-      if (ci.initializeClass(ti)) {
-        // continue with the topframe and re-exec this insn once the clinits are done
-        return ti.getPC();
-      }
-
     if (heap.isOutOfMemory()) { // simulate OutOfMemoryError
       return ti.createAndThrowException("java.lang.OutOfMemoryError",
                                         "trying to allocate new " + cname);