changeset 27:8aded593a50f

fixed the missing class init status update for native clinits. Since we moved that to the clinit RETURN in r24, it has to be duplicated in NATIVERETURN for native clinits. Factoring out to DIRECTCALLRETURN is not an option since there is no good way to determine if the direct call included a clinit (we would have to look at the code, which is suboptimal performance- and change resilience-wise). Thanks to Franz Weitl for the report
author Peter Mehlitz <pcmehlitz@gmail.com>
date Mon, 11 May 2015 12:17:18 -0700
parents 4eb191cbb68c
children 7be90179bb3b
files src/main/gov/nasa/jpf/jvm/bytecode/NATIVERETURN.java src/main/gov/nasa/jpf/jvm/bytecode/RETURN.java
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/gov/nasa/jpf/jvm/bytecode/NATIVERETURN.java	Mon May 04 22:10:33 2015 -0700
+++ b/src/main/gov/nasa/jpf/jvm/bytecode/NATIVERETURN.java	Mon May 11 12:17:18 2015 -0700
@@ -59,6 +59,14 @@
       setReturnAttr(ti, retAttr);
     }
 
+    if (mi.isClinit()) {
+      // this is in the clinit RETURN insn for non-MJIs so we have to duplicate here
+      // Duplication could be avoided in DIRECTCALLRETURN, but there is no reliable
+      // way to check if the direct call did return from a clinit since the corresponding
+      // synthetic method could do anything
+      mi.getClassInfo().setInitialized();
+    }
+
     return frame.getPC().getNext();
   }
 
--- a/src/main/gov/nasa/jpf/jvm/bytecode/RETURN.java	Mon May 04 22:10:33 2015 -0700
+++ b/src/main/gov/nasa/jpf/jvm/bytecode/RETURN.java	Mon May 11 12:17:18 2015 -0700
@@ -49,6 +49,8 @@
       }
 
     } else if (mi.isClinit()) {
+      // this also needs to happen in NATIVERETURN for native clinits. See comment
+      // there why we can't refactor this into DIRECTCALLRETURN
       mi.getClassInfo().setInitialized();
     }