Skip to content

Commit 9b96761

Browse files
committed
Make ConcurrentAnalysisAccessImpl available before-analysis.
1 parent 1a8bb87 commit 9b96761

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapScanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ protected void onObjectReachable(ImageHeapConstant imageHeapConstant, ScanReason
608608
* conditions, e.g., a started Thread should never be added to the image heap, but
609609
* the structure of the object is valid, as ensured by the validity check above.
610610
*/
611-
objectType.notifyObjectReachable(universe.getConcurrentAnalysisAccess(), object, reason);
611+
objectType.notifyObjectReachable(object, reason);
612612
} catch (UnsupportedFeatureException e) {
613613
/* Enhance the unsupported feature message with the object trace and rethrow. */
614614
StringBuilder backtrace = new StringBuilder();

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisField.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,9 @@ public JavaConstant getConstantValue() {
517517
}
518518

519519
/**
520-
* Ensure that all reachability handler that were present at the time the declaring type was
521-
* marked as reachable are executed before accessing field values. This allows field value
522-
* transformer to be installed reliably in reachability handler.
520+
* Ensure that all reachability handlers that were present at the time the declaring type was
521+
* marked as reachable are executed before accessing field values. This allows a field value
522+
* transformer to be installed reliably in a reachability handler.
523523
*/
524524
public void beforeFieldValueAccess() {
525525
declaringClass.registerAsReachable(this);

substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,9 @@ public <T> void registerObjectReachableCallback(ObjectReachableCallback<T> callb
700700
});
701701
}
702702

703-
public <T> void notifyObjectReachable(DuringAnalysisAccess access, T object, ScanReason reason) {
704-
ConcurrentLightHashSet.forEach(this, objectReachableCallbacksUpdater, (ObjectReachableCallback<T> c) -> c.doCallback(access, object, reason));
703+
public <T> void notifyObjectReachable(T object, ScanReason reason) {
704+
ConcurrentLightHashSet.forEach(this, objectReachableCallbacksUpdater,
705+
(ObjectReachableCallback<T> c) -> c.doCallback(universe.getConcurrentAnalysisAccess(), object, reason));
705706
}
706707

707708
public void registerInstantiatedCallback(Consumer<DuringAnalysisAccess> callback) {

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,13 @@ protected void createAbstractImage(NativeImageKind k, List<HostedMethod> hostedE
811811
@SuppressWarnings("try")
812812
protected boolean runPointsToAnalysis(String imageName, OptionValues options, DebugContext debug) {
813813
try (Indent ignored = debug.logAndIndent("run analysis")) {
814+
/*
815+
* Set the ConcurrentAnalysisAccessImpl before Feature.beforeAnalysis is executed. Some
816+
* features may already execute some pre-analysis tasks, e.g., reading a hosted field
817+
* value, that can trigger reachability callbacks.
818+
*/
819+
ConcurrentAnalysisAccessImpl concurrentConfig = new ConcurrentAnalysisAccessImpl(featureHandler, loader, bb, nativeLibraries, debug);
820+
aUniverse.setConcurrentAnalysisAccess(concurrentConfig);
814821
try (Indent ignored1 = debug.logAndIndent("process analysis initializers")) {
815822
BeforeAnalysisAccessImpl config = new BeforeAnalysisAccessImpl(featureHandler, loader, bb, nativeLibraries, debug);
816823
ServiceCatalogSupport.singleton().enableServiceCatalogMapTransformer(config);
@@ -828,8 +835,6 @@ protected boolean runPointsToAnalysis(String imageName, OptionValues options, De
828835
try (ReporterClosable c = ProgressReporter.singleton().printAnalysis(bb.getUniverse(), nativeLibraries.getLibraries())) {
829836
DuringAnalysisAccessImpl config = new DuringAnalysisAccessImpl(featureHandler, loader, bb, nativeLibraries, debug);
830837
try {
831-
ConcurrentAnalysisAccessImpl concurrentConfig = new ConcurrentAnalysisAccessImpl(featureHandler, loader, bb, nativeLibraries, debug);
832-
aUniverse.setConcurrentAnalysisAccess(concurrentConfig);
833838
if (ImageLayerBuildingSupport.buildingExtensionLayer()) {
834839
/*
835840
* All the field value transformers should be installed by this point.

0 commit comments

Comments
 (0)