# HG changeset patch # User Shinji KONO # Date 1513650083 -32400 # Node ID 49be04cc6389a4180dd2bcd4674a7bde240d7436 # Parent a0b1b1aa6cdf8de6a5d1b56931aecb3dc4aebc77 cyclic dependency ... diff -r a0b1b1aa6cdf -r 49be04cc6389 build.xml --- a/build.xml Tue Dec 19 09:05:20 2017 +0900 +++ b/build.xml Tue Dec 19 11:21:23 2017 +0900 @@ -119,7 +119,7 @@ - + @@ -127,8 +127,12 @@ + + - + + + diff -r a0b1b1aa6cdf -r 49be04cc6389 src/annotations/module-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/annotations/module-info.java Tue Dec 19 11:21:23 2017 +0900 @@ -0,0 +1,4 @@ +module gov.nasa.jpf.annotation { + exports gov.nasa.jpf.annotation; +} + diff -r a0b1b1aa6cdf -r 49be04cc6389 src/classes/module-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/classes/module-info.java Tue Dec 19 11:21:23 2017 +0900 @@ -0,0 +1,3 @@ +module java.base { + requires gov.nasa.jpf.annotation; +} diff -r a0b1b1aa6cdf -r 49be04cc6389 src/main/gov/nasa/jpf/vm/HashedAllocationContext.java --- a/src/main/gov/nasa/jpf/vm/HashedAllocationContext.java Tue Dec 19 09:05:20 2017 +0900 +++ b/src/main/gov/nasa/jpf/vm/HashedAllocationContext.java Tue Dec 19 11:21:23 2017 +0900 @@ -20,8 +20,11 @@ // see mixinJPFStack() comments //import sun.misc.SharedSecrets; //import sun.misc.JavaLangAccess; -import jdk.internal.misc.SharedSecrets; -import jdk.internal.misc.JavaLangAccess; +// import jdk.internal.misc.SharedSecrets; +// import jdk.internal.misc.JavaLangAccess; +import java.lang.StackWalker; +import java.util.stream.Stream; +import java.util.Optional; import gov.nasa.jpf.Config; import static gov.nasa.jpf.util.OATHash.*; @@ -84,7 +87,7 @@ * if (e.getClassName().equals("gov.nasa.jpf.vm.MJIEnv") && e.getMethodName().startsWith("new")){ .. */ - static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); + // static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); static final String ENV_CLSNAME = MJIEnv.class.getName(); // <2do> this method is problematic - we should not assume a fixed stack position @@ -94,7 +97,7 @@ // those are convenience methods used from a gazillion of places that might share // the same SUT state static int mixinJPFStack (int h) { - throwable.fillInStackTrace(); + // throwable.fillInStackTrace(); // we know the callstack is at least 4 levels deep: // 0: mixinJPFStack @@ -108,12 +111,17 @@ // this would create state leaks for allocations that are triggered by SUT threads and // have different native paths (e.g. Class object creation caused by different SUT thread context) - StackTraceElement e = JLA.getStackTraceElement(throwable, 4); // see note below regarding fixed call depth fragility + // StackTraceElement e = JLA.getStackTraceElement(throwable, 4); // see note below regarding fixed call depth fragility // <2do> this sucks - MJIEnv.newObject/newArray/newString are used from a gazillion of places that might not differ in SUT state - if (e.getClassName() == ENV_CLSNAME && e.getMethodName().startsWith("new")){ + // if (e.getClassName() == ENV_CLSNAME && e.getMethodName().startsWith("new")){ // there is not much use to loop, since we don't have a good end condition - e = JLA.getStackTraceElement(throwable, 5); - } + // e = JLA.getStackTraceElement(throwable, 5); + // } + + Optional o = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).walk(s -> + s.dropWhile(f -> f.getClassName() == ENV_CLSNAME && f.getMethodName().startsWith("new")) .findFirst()); + if (!o.isPresent()) return h; + StackWalker.StackFrame e = o.get(); // NOTE - this is fragile since it is implementation dependent and differs // between JPF runs diff -r a0b1b1aa6cdf -r 49be04cc6389 src/main/module-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/module-info.java Tue Dec 19 11:21:23 2017 +0900 @@ -0,0 +1,7 @@ +module gov.nasa.jpf { + requires jdk.unsupported; + requires java.logging; + requires java.management; + requires javafx.swing; + requires gov.nasa.jpf.annotation; +}