use of com.oracle.svm.hosted.classinitialization.InitKind.RUN_TIME in project graal by oracle.
the class ClassInitializationFeature method initializeSafeDelayedClasses.
/**
* Initializes all classes that are considered delayed by the system. Classes specified by the
* user will not be delayed.
*/
private Set<Class<?>> initializeSafeDelayedClasses(TypeInitializerGraph initGraph) {
Set<Class<?>> provenSafe = new HashSet<>();
classInitializationSupport.setConfigurationSealed(false);
classInitializationSupport.classesWithKind(RUN_TIME).stream().filter(t -> metaAccess.optionalLookupJavaType(t).isPresent()).filter(t -> metaAccess.lookupJavaType(t).isReachable()).filter(t -> classInitializationSupport.canBeProvenSafe(t)).forEach(c -> {
AnalysisType type = metaAccess.lookupJavaType(c);
if (!initGraph.isUnsafe(type)) {
classInitializationSupport.forceInitializeHosted(c, "proven safe to initialize", true);
/*
* See if initialization worked--it can fail due to implicit
* exceptions.
*/
if (!classInitializationSupport.shouldInitializeAtRuntime(c)) {
provenSafe.add(c);
ClassInitializationInfo initializationInfo = type.getClassInitializer() == null ? ClassInitializationInfo.NO_INITIALIZER_INFO_SINGLETON : ClassInitializationInfo.INITIALIZED_INFO_SINGLETON;
DynamicHub hub = ((SVMHost) universe.hostVM()).dynamicHub(type);
hub.setClassInitializationInfo(initializationInfo);
universe.getHeapScanner().rescanField(hub, dynamicHubClassInitializationInfoField);
}
}
});
return provenSafe;
}
Aggregations