Skip to content

Commit 0d00ea8

Browse files
committed
Respect concurrent analysis accessor request for an additional analysis iteration.
1 parent 318a01c commit 0d00ea8

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,12 @@ public void requireAnalysisIteration() {
535535
if (bb.executorIsStarted()) {
536536
throw VMError.shouldNotReachHere("Calling DuringAnalysisAccessImpl.requireAnalysisIteration() is not necessary when running the reachability handlers concurrently during analysis.");
537537
}
538+
/*
539+
* While it may seem wrong that the concurrent analysis accessor can request an
540+
* additional analysis iteration this is necessary because the concurrent reachability
541+
* callbacks can be forced to run synchronously in the single-threaded "during analysis"
542+
* phase when elements are marked as reachable from Feature.duringAnalysis hooks.
543+
*/
538544
super.requireAnalysisIteration();
539545
}
540546

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,8 @@ protected boolean runPointsToAnalysis(String imageName, OptionValues options, De
843843
bb.getHostVM().notifyClassReachabilityListener(universe, config);
844844
featureHandler.forEachFeature(feature -> feature.duringAnalysis(config));
845845
}
846-
return !config.getAndResetRequireAnalysisIteration();
846+
/* Analysis is finished if no additional iteration was requested. */
847+
return !config.getAndResetRequireAnalysisIteration() && !concurrentConfig.getAndResetRequireAnalysisIteration();
847848
});
848849
} catch (Throwable t) {
849850
if (ImageSingletons.contains(RuntimeCompilationCallbacks.class)) {

substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleFeature.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
import com.oracle.svm.hosted.FeatureImpl;
132132
import com.oracle.svm.hosted.FeatureImpl.AfterAnalysisAccessImpl;
133133
import com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl;
134-
import com.oracle.svm.hosted.FeatureImpl.DuringAnalysisAccessImpl;
135134
import com.oracle.svm.hosted.FeatureImpl.DuringSetupAccessImpl;
136135
import com.oracle.svm.hosted.meta.HostedType;
137136
import com.oracle.svm.truffle.api.SubstrateThreadLocalHandshake;
@@ -447,7 +446,6 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
447446

448447
/* Support for deprecated bytecode osr frame transfer: GR-38296 */
449448
config.registerSubtypeReachabilityHandler((acc, klass) -> {
450-
DuringAnalysisAccessImpl impl = (DuringAnalysisAccessImpl) acc;
451449
/* Pass known reachable classes to the initializer: it will decide there what to do. */
452450
TruffleBaseFeature.invokeStaticMethod("com.oracle.truffle.runtime.BytecodeOSRRootNode", "initializeClassUsingDeprecatedFrameTransfer",
453451
Collections.singleton(Class.class), klass);

0 commit comments

Comments
 (0)