diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/HeapSnapshotVerifier.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/HeapSnapshotVerifier.java index 2f833d36c71c..5d071147c4e1 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/HeapSnapshotVerifier.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/HeapSnapshotVerifier.java @@ -187,7 +187,7 @@ private boolean verifyFieldValue(JavaConstant receiver, AnalysisField field, Jav verifyStaticFieldValue(typeData, field, fieldSnapshot, fieldValue, reason); } else { ImageHeapInstance receiverObject = (ImageHeapInstance) getSnapshot(receiver, reason); - if (receiverObject == null || (receiverObject.isInBaseLayer() && !bb.getUniverse().getImageLayerLoader().getRelinkedFields(receiverObject.getType()).contains(field.getPosition()))) { + if (receiverObject == null || (receiverObject.isInSharedLayer() && !bb.getUniverse().getImageLayerLoader().getRelinkedFields(receiverObject.getType()).contains(field.getPosition()))) { return false; } JavaConstant fieldSnapshot = receiverObject.readFieldValue(field); @@ -211,7 +211,7 @@ private void verifyStaticFieldValue(TypeData typeData, AnalysisField field, Java } private void verifyInstanceFieldValue(AnalysisField field, JavaConstant receiver, ImageHeapInstance receiverObject, JavaConstant fieldSnapshot, JavaConstant fieldValue, ScanReason reason) { - if (fieldSnapshot instanceof ImageHeapConstant ihc && ihc.isInBaseLayer() && ihc.getHostedObject() == null && !(ihc instanceof ImageHeapRelocatableConstant)) { + if (fieldSnapshot instanceof ImageHeapConstant ihc && ihc.isInSharedLayer() && ihc.getHostedObject() == null && !(ihc instanceof ImageHeapRelocatableConstant)) { /* * We cannot verify a base layer constant which doesn't have a backing hosted * object. Since the hosted object is missing the constant would be replaced with @@ -268,7 +268,7 @@ private boolean verifyArrayElementValue(JavaConstant elementValue, int index, Sc * the future, then compare the produced value. */ JavaConstant elementSnapshot = arrayObject.readElementValue(index); - if (elementSnapshot instanceof ImageHeapConstant ihc && ihc.isInBaseLayer() && ihc.getHostedObject() == null) { + if (elementSnapshot instanceof ImageHeapConstant ihc && ihc.isInSharedLayer() && ihc.getHostedObject() == null) { /* * We cannot verify a base layer constant which doesn't have a backing hosted * object. Since the hosted object is missing the constant would be replaced with diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeap.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeap.java index f5e4639d96de..26fce750dbe3 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeap.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeap.java @@ -84,7 +84,7 @@ public Object getSnapshot(JavaConstant constant) { * A base layer constant was in the objectsCache from the base image. It might not have * been put in the objectsCache of the extension image yet. */ - assert imageHeapConstant.getHostedObject() == null || imageHeapConstant.isInBaseLayer() || objectsCache.get(imageHeapConstant.getHostedObject()).equals(imageHeapConstant); + assert imageHeapConstant.getHostedObject() == null || imageHeapConstant.isInSharedLayer() || objectsCache.get(imageHeapConstant.getHostedObject()).equals(imageHeapConstant); return imageHeapConstant; } return objectsCache.get(uncompressed); diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapConstant.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapConstant.java index 7acc3e7b47e8..ca6edfc180a4 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapConstant.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapConstant.java @@ -93,12 +93,12 @@ abstract static class ConstantData { */ @SuppressWarnings("unused") private volatile Object isReachable; /** - * A boolean allowing to distinguish a constant that was persisted from a base layer and a + * A boolean allowing to distinguish a constant that was persisted from a shared layer and a * constant created in the current layer. */ - private boolean isInBaseLayer; + private boolean isInSharedLayer; /** - * A boolean telling if the constant was written in the image heap of the base layer. + * A boolean telling if the constant was written in the image heap of the shared layer. */ private boolean writtenInPreviousLayer; /** @@ -209,16 +209,16 @@ public int getIdentityHashCode() { return constantData.identityHashCode; } - public void markInBaseLayer() { - constantData.isInBaseLayer = true; + public void markInSharedLayer() { + constantData.isInSharedLayer = true; } - public boolean isInBaseLayer() { - return constantData.isInBaseLayer; + public boolean isInSharedLayer() { + return constantData.isInSharedLayer; } public void markWrittenInPreviousLayer() { - AnalysisError.guarantee(isInBaseLayer(), "Constant must be in base layer to be marked as written in the base layer."); + AnalysisError.guarantee(isInSharedLayer(), "Constant must be in base layer to be marked as written in the base layer."); constantData.writtenInPreviousLayer = true; } diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapInstance.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapInstance.java index a4b777b90d17..4e6617bccbbb 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapInstance.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapInstance.java @@ -145,7 +145,7 @@ public void setFieldValue(AnalysisField field, JavaConstant value) { * or the result of executing the task, i.e., a {@link JavaConstant}. */ public Object getFieldValue(AnalysisField field) { - if (isInBaseLayer()) { + if (isInSharedLayer()) { /* Base layer constants that are not relinked might not have field positions computed */ field.getType().getInstanceFields(true); } diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapScanner.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapScanner.java index c2eb2477809d..11623946607f 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapScanner.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/ImageHeapScanner.java @@ -732,7 +732,7 @@ public void rescanField(Object receiver, AnalysisField field, ScanReason reason) JavaConstant fieldSnapshot = receiverObject.readFieldValue(field); JavaConstant unwrappedSnapshot = ScanningObserver.maybeUnwrapSnapshot(fieldSnapshot, fieldValue instanceof ImageHeapConstant); - if (fieldSnapshot instanceof ImageHeapConstant ihc && ihc.isInBaseLayer() && ihc.getHostedObject() == null) { + if (fieldSnapshot instanceof ImageHeapConstant ihc && ihc.isInSharedLayer() && ihc.getHostedObject() == null) { /* * We cannot verify a base layer constant which doesn't have a backing * hosted object. Since the hosted object is missing the constant would be diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisField.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisField.java index 60061ad0b470..5fd6b6295574 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisField.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisField.java @@ -65,9 +65,13 @@ public abstract class AnalysisField extends AnalysisElement implements WrappedJa private static final AtomicReferenceFieldUpdater isUnsafeAccessedUpdater = AtomicReferenceFieldUpdater .newUpdater(AnalysisField.class, Object.class, "isUnsafeAccessed"); + /** + * Unique id assigned to each {@link AnalysisField}. This id is consistent across layers and can + * be used to load or match a field in an extension layer. + */ private final int id; - /** Marks a field loaded from a base layer. */ - private final boolean isInBaseLayer; + /** Marks a field loaded from a shared layer. */ + private final boolean isInSharedLayer; public final ResolvedJavaField wrapped; @@ -81,7 +85,10 @@ public abstract class AnalysisField extends AnalysisElement implements WrappedJa private ConcurrentMap readBy; private ConcurrentMap writtenBy; - /** Field's position in the list of declaring type's fields, including inherited fields. */ + /** + * Field's position in the list of declaring type's fields, including inherited fields. The + * position needs to be consistent across layers. + */ protected int position; protected final AnalysisType declaringClass; @@ -117,22 +124,22 @@ public AnalysisField(AnalysisUniverse universe, ResolvedJavaField wrappedField) declaringClass = universe.lookup(wrappedField.getDeclaringClass()); fieldType = getDeclaredType(universe, wrappedField); - if (universe.hostVM().buildingExtensionLayer() && declaringClass.isInBaseLayer()) { + if (universe.hostVM().buildingExtensionLayer() && declaringClass.isInSharedLayer()) { int fid = universe.getImageLayerLoader().lookupHostedFieldInBaseLayer(this); if (fid != -1) { /* - * This id is the actual link between the corresponding field from the base layer + * This id is the actual link between the corresponding field from the shared layer * and this new field. */ id = fid; - isInBaseLayer = true; + isInSharedLayer = true; } else { id = universe.computeNextFieldId(); - isInBaseLayer = false; + isInSharedLayer = false; } } else { id = universe.computeNextFieldId(); - isInBaseLayer = false; + isInSharedLayer = false; } isLayeredStaticField = isStatic() && universe.hostVM.buildingImageLayer(); } @@ -167,8 +174,8 @@ public int getId() { return id; } - public boolean isInBaseLayer() { - return isInBaseLayer; + public boolean isInSharedLayer() { + return isInSharedLayer; } public boolean installableInLayer() { diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisMethod.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisMethod.java index 3bd35348c7b9..42e5564bae39 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisMethod.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisMethod.java @@ -129,10 +129,16 @@ public record Signature(String name, AnalysisType[] parameterTypes) { public final ResolvedJavaMethod wrapped; + /** + * Unique id assigned to each {@link AnalysisMethod}. This id is consistent across layers and + * can be used to load or match a method in an extension layer. + */ private final int id; + /** True when the current layer built is a shared layer. */ private final boolean buildingSharedLayer; - /** Marks a method loaded from a base layer. */ - private final boolean isInBaseLayer; + /** Marks a method loaded from a shared layer. */ + private final boolean isInSharedLayer; + /** Marks a method analyzed in a prior layer. */ private final boolean analyzedInPriorLayer; private final boolean hasNeverInlineDirective; private final ExceptionHandler[] exceptionHandlers; @@ -228,24 +234,24 @@ protected AnalysisMethod(AnalysisUniverse universe, ResolvedJavaMethod wrapped, modifiers = wrapped.getModifiers(); buildingSharedLayer = hostVM.buildingSharedLayer(); - if (hostVM.buildingExtensionLayer() && declaringClass.isInBaseLayer()) { + if (hostVM.buildingExtensionLayer() && declaringClass.isInSharedLayer()) { int mid = universe.getImageLayerLoader().lookupHostedMethodInBaseLayer(this); if (mid != -1) { /* - * This id is the actual link between the corresponding method from the base layer + * This id is the actual link between the corresponding method from the shared layer * and this new method. */ id = mid; - isInBaseLayer = true; + isInSharedLayer = true; } else { id = universe.computeNextMethodId(); - isInBaseLayer = false; + isInSharedLayer = false; } } else { id = universe.computeNextMethodId(); - isInBaseLayer = false; + isInSharedLayer = false; } - analyzedInPriorLayer = isInBaseLayer && hostVM.analyzedInPriorLayer(this); + analyzedInPriorLayer = isInSharedLayer && hostVM.analyzedInPriorLayer(this); ExceptionHandler[] original = wrapped.getExceptionHandlers(); exceptionHandlers = new ExceptionHandler[original.length]; @@ -288,7 +294,7 @@ protected AnalysisMethod(AnalysisUniverse universe, ResolvedJavaMethod wrapped, LayeredCompilationBehavior behavior = AnnotationUtil.getAnnotation(wrapped, LayeredCompilationBehavior.class); if (behavior != null) { compilationBehavior = behavior.value(); - if (compilationBehavior == LayeredCompilationBehavior.Behavior.PINNED_TO_INITIAL_LAYER && universe.hostVM.buildingExtensionLayer() && !isInBaseLayer) { + if (compilationBehavior == LayeredCompilationBehavior.Behavior.PINNED_TO_INITIAL_LAYER && universe.hostVM.buildingExtensionLayer() && !isInSharedLayer) { var errorMessage = String.format("User methods with layered compilation behavior %s must be registered via %s in the initial layer", LayeredCompilationBehavior.Behavior.PINNED_TO_INITIAL_LAYER, LayeredCompilationSupport.class); throw AnalysisError.userError(errorMessage); @@ -303,7 +309,7 @@ protected AnalysisMethod(AnalysisMethod original, MultiMethodKey multiMethodKey) wrapped = original.wrapped; id = original.id; buildingSharedLayer = original.buildingSharedLayer; - isInBaseLayer = original.isInBaseLayer; + isInSharedLayer = original.isInSharedLayer; analyzedInPriorLayer = original.analyzedInPriorLayer; declaringClass = original.declaringClass; signature = original.signature; @@ -338,7 +344,7 @@ public void setCompilationBehavior(LayeredCompilationBehavior.Behavior compilati } private void setNewCompilationBehavior(LayeredCompilationBehavior.Behavior compilationBehavior) { - assert (!isInBaseLayer && this.compilationBehavior == LayeredCompilationBehavior.Behavior.DEFAULT) || this.compilationBehavior == compilationBehavior : "The method was already assigned " + + assert (!isInSharedLayer && this.compilationBehavior == LayeredCompilationBehavior.Behavior.DEFAULT) || this.compilationBehavior == compilationBehavior : "The method was already assigned " + this.compilationBehavior + ", but trying to assign " + compilationBehavior; setCompilationBehavior(compilationBehavior); } @@ -480,8 +486,8 @@ public int getId() { return id; } - public boolean isInBaseLayer() { - return isInBaseLayer; + public boolean isInSharedLayer() { + return isInSharedLayer; } public boolean analyzedInPriorLayer() { @@ -1169,7 +1175,7 @@ private AnalysisParsedGraph ensureGraphParsedHelper(BigBang bb, Stage stage, boo if (curState.isUnparsed(stage) || (forceReparse && curState.isStageParsed(stage))) { AnalysisParsedGraph graph; - if (isInBaseLayer && getUniverse().getImageLayerLoader().hasAnalysisParsedGraph(this)) { + if (isInSharedLayer && getUniverse().getImageLayerLoader().hasAnalysisParsedGraph(this)) { graph = getBaseLayerGraph(bb, curState); } else { graph = createAnalysisParsedGraph(bb, stage, curState, forceReparse); diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java index dfffddedd2b0..5f9bc3e1314b 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisType.java @@ -133,9 +133,13 @@ public abstract class AnalysisType extends AnalysisElement implements WrappedJav @SuppressWarnings("unused") private volatile Object subTypes; AnalysisType superClass; + /** + * Unique id assigned to each {@link AnalysisType}. This id is consistent across layers and can + * be used to load or match a type in an extension layer. + */ private final int id; - /** Marks a type loaded from a base layer. */ - private final boolean isInBaseLayer; + /** Marks a type loaded from a shared layer. */ + private final boolean isInSharedLayer; private final JavaKind storageKind; private final boolean isCloneableWithAllocation; @@ -302,24 +306,24 @@ public AnalysisType(AnalysisUniverse universe, ResolvedJavaType javaType, JavaKi int tid = universe.getImageLayerLoader().lookupHostedTypeInBaseLayer(this); if (tid != -1) { /* - * This id is the actual link between the corresponding type from the base layer and - * this new type. + * This id is the actual link between the corresponding type from the shared layer + * and this new type. */ this.id = tid; - this.isInBaseLayer = true; + this.isInSharedLayer = true; } else { this.id = universe.computeNextTypeId(); /* * If both the BaseLayerType and the complete type are created at the same time, - * there can be a race for the base layer id. It is possible that the complete type - * gets the base layer id even though the BaseLayerType is created. In this case, - * the AnalysisType should still be marked as isInBaseLayer. + * there can be a race for the shared layer id. It is possible that the complete + * type gets the shared layer id even though the BaseLayerType is created. In this + * case, the AnalysisType should still be marked as isInSharedLayer. */ - this.isInBaseLayer = wrapped instanceof BaseLayerType; + this.isInSharedLayer = wrapped instanceof BaseLayerType; } } else { this.id = universe.computeNextTypeId(); - this.isInBaseLayer = false; + this.isInSharedLayer = false; } /* @@ -398,8 +402,8 @@ public int getId() { return id; } - public boolean isInBaseLayer() { - return isInBaseLayer; + public boolean isInSharedLayer() { + return isInSharedLayer; } public AnalysisObject getContextInsensitiveAnalysisObject() { @@ -595,7 +599,7 @@ protected void onReachable(Object reason) { scheduledTypeReachableNotifications = futures; } - if (isInBaseLayer && !(wrapped instanceof BaseLayerType)) { + if (isInSharedLayer && !(wrapped instanceof BaseLayerType)) { /* * Since the analysis of the type is skipped, the fields have to be created manually to * ensure their flags are loaded from the base layer. Not creating the fields would diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisUniverse.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisUniverse.java index b50fba69a513..0c27e67ed496 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisUniverse.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/meta/AnalysisUniverse.java @@ -220,7 +220,7 @@ public JavaType lookupAllowUnresolved(JavaType rawType) { AnalysisType result = optionalLookup(type); if (result == null) { result = createType(type); - if (hostVM.buildingExtensionLayer() && result.isInBaseLayer()) { + if (hostVM.buildingExtensionLayer() && result.isInSharedLayer()) { imageLayerLoader.initializeBaseLayerType(result); } } @@ -387,14 +387,14 @@ private AnalysisField createField(ResolvedJavaField field) { } AnalysisField newValue = analysisFactory.createField(this, field); AnalysisField result = fields.computeIfAbsent(field, f -> { - if (newValue.isInBaseLayer()) { + if (newValue.isInSharedLayer()) { getImageLayerLoader().addBaseLayerField(newValue); } return newValue; }); if (result.equals(newValue)) { - if (newValue.isInBaseLayer()) { + if (newValue.isInSharedLayer()) { getImageLayerLoader().initializeBaseLayerField(newValue); } } @@ -441,7 +441,7 @@ private AnalysisMethod createMethod(ResolvedJavaMethod method) { } AnalysisMethod newValue = analysisFactory.createMethod(this, method); AnalysisMethod result = methods.computeIfAbsent(method, m -> { - if (newValue.isInBaseLayer()) { + if (newValue.isInSharedLayer()) { getImageLayerLoader().addBaseLayerMethod(newValue); } return newValue; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/LayeredModuleSingleton.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/LayeredModuleSingleton.java index e0a042d1fab8..2d80849e7b9d 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/LayeredModuleSingleton.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/LayeredModuleSingleton.java @@ -48,12 +48,37 @@ public abstract class LayeredModuleSingleton { public static final String ALL_UNNAMED_MODULE_NAME = "native-image-all-unnamed"; public static final String EVERYONE_MODULE_NAME = "native-image-everyone"; + /** + * Map containing all the {@code Module#openPackages} values for each module. The key is the + * module name and the value is the corresponding {@code Module#openPackages}. The name of the + * module is used instead of the Module object because the hashcode of the Module object is not + * consistent across layers. This is ensured by + * {@link LayeredModuleSingleton#setPackages(ResolvedJavaModule, EconomicMap, Map, String)}}. + */ protected final EconomicMap>> moduleOpenPackages; + + /** + * See {@link LayeredModuleSingleton#moduleOpenPackages}. + */ protected final EconomicMap>> moduleExportedPackages; + /** + * Keeps track of all the modules whose {@code Module#openPackages} and + * {@code Module#exportedPackages} are set by + * {@link LayeredModuleSingleton#setExportedPackages(ResolvedJavaModule, Map)} and + * {@link LayeredModuleSingleton#setOpenPackages(ResolvedJavaModule, Map)}. This also allows to + * ensure each module has a different name. + */ private final EconomicMap nameToModule = EconomicMap.create(); + /** + * The value of {@code Module.EVERYONE_MODULE}. + */ private ResolvedJavaModule everyoneModule; + + /** + * The value of {@code Module.ALL_UNNAMED_MODULE}. + */ private ResolvedJavaModule allUnnamedModule; public LayeredModuleSingleton() { @@ -82,6 +107,10 @@ public Map> getExportedPackages(ResolvedJavaModule module) { return moduleExportedPackages.get(module.getName()); } + /** + * Returns all the modules whose {@code Module#openPackages} and {@code Module#exportedPackages} + * are set. + */ public Iterable getModules() { return nameToModule.getValues(); } @@ -114,6 +143,10 @@ private void setPackages(ResolvedJavaModule module, EconomicMap modules = namesMap.computeIfAbsent(entry.getKey(), _ -> new HashSet<>()); modules.addAll(entry.getValue().stream().map(GraalAccess::lookupModule).map(ResolvedJavaModule::getName).toList()); modules.remove(null); + /* + * ALL_UNNAMED_MODULE and EVERYONE_MODULE don't have a name, so they need a special + * marker to track them. + */ if (entry.getValue().contains(OriginalModuleProvider.getJavaModule(allUnnamedModule))) { modules.add(ALL_UNNAMED_MODULE_NAME); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ModuleLayerFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ModuleLayerFeature.java index 0f84d0b320f0..918446b96c33 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ModuleLayerFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ModuleLayerFeature.java @@ -307,7 +307,7 @@ public void afterAnalysis(AfterAnalysisAccess access) { Set runtimeImageModules = accessImpl.getUniverse().getTypes() .stream() - .filter(t1 -> !t1.isInBaseLayer() && typeIsReachable(t1)) + .filter(t1 -> !t1.isInSharedLayer() && typeIsReachable(t1)) .map(t -> t.getJavaClass().getModule()) .collect(Collectors.toSet()); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/OpenTypeWorldFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/OpenTypeWorldFeature.java index 8ad94f2c3e92..2c04c0d72196 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/OpenTypeWorldFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/OpenTypeWorldFeature.java @@ -291,7 +291,7 @@ public static boolean validateTypeInfo(Collection types) { if (ImageLayerBuildingSupport.buildingExtensionLayer()) { var loader = HostedImageLayerBuildingSupport.singleton().getLoader(); for (HostedType type : types) { - if (type.getWrapped().isInBaseLayer()) { + if (type.getWrapped().isInSharedLayer()) { var priorInfo = getTypecheckInfo(loader, type); if (!priorInfo.installed()) { // no need to validate this hub, as it was not installed @@ -317,7 +317,7 @@ public static boolean validateTypeInfo(Collection types) { } static TypeCheckInfo getTypecheckInfo(SVMImageLayerLoader loader, HostedType hType) { - if (hType.getWrapped().isInBaseLayer()) { + if (hType.getWrapped().isInSharedLayer()) { var hubInfo = loader.getDynamicHubInfo(hType.getWrapped()); var valuesReader = hubInfo.getTypecheckSlotValues(); int[] typecheckSlots = new int[valuesReader.size()]; diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java index 51f7e63c9a57..7fc59afcf7bf 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java @@ -551,15 +551,15 @@ private void printAnalysisStatistics(AnalysisUniverse universe, Collection reportedReachableTypes(AnalysisUniverse universe) { - return reportedElements(universe, universe.getTypes(), AnalysisType::isReachable, t -> !t.isInBaseLayer()); + return reportedElements(universe, universe.getTypes(), AnalysisType::isReachable, t -> !t.isInSharedLayer()); } public static List reportedReachableFields(AnalysisUniverse universe) { - return reportedElements(universe, universe.getFields(), AnalysisField::isAccessed, f -> !f.isInBaseLayer()); + return reportedElements(universe, universe.getFields(), AnalysisField::isAccessed, f -> !f.isInSharedLayer()); } public static List reportedReachableMethods(AnalysisUniverse universe) { - return reportedElements(universe, universe.getMethods(), AnalysisMethod::isReachable, m -> !m.isInBaseLayer()); + return reportedElements(universe, universe.getMethods(), AnalysisMethod::isReachable, m -> !m.isInSharedLayer()); } private static List reportedElements(AnalysisUniverse universe, Collection elements, Predicate elementsFilter, Predicate baseLayerFilter) { diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SharedLayerBootLayerModulesSingleton.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SharedLayerBootLayerModulesSingleton.java index 2b57c0a302cf..c31e59ab5344 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SharedLayerBootLayerModulesSingleton.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SharedLayerBootLayerModulesSingleton.java @@ -49,6 +49,11 @@ import com.oracle.svm.hosted.imagelayer.SVMImageLayerSingletonLoader; import com.oracle.svm.hosted.imagelayer.SVMImageLayerWriter; +/** + * This singleton persists all the modules from the {@code bootLayer} of the shared layers and + * allows to loads them in the extension layers. This is needed for the {@code RuntimeModuleSupport} + * that contains the runtime bootLayer and is only installed in the application layer. + */ @Platforms(Platform.HOSTED_ONLY.class) @AutomaticallyRegisteredImageSingleton(onlyWith = BuildingInitialLayerPredicate.class) @SingletonTraits(access = BuildtimeAccessOnly.class, layeredCallbacks = SharedLayerBootLayerModulesSingleton.LayeredCallbacks.class, layeredInstallationKind = Independent.class) diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ameta/AnalysisConstantReflectionProvider.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ameta/AnalysisConstantReflectionProvider.java index bc1f2c4bdd4b..e4a597851724 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ameta/AnalysisConstantReflectionProvider.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ameta/AnalysisConstantReflectionProvider.java @@ -307,7 +307,7 @@ public JavaConstant readValue(AnalysisField field, JavaConstant receiver, boolea return null; } - if (receiver instanceof ImageHeapInstance imageHeapInstance && imageHeapInstance.isInBaseLayer() && imageHeapInstance.nullFieldValues()) { + if (receiver instanceof ImageHeapInstance imageHeapInstance && imageHeapInstance.isInSharedLayer() && imageHeapInstance.nullFieldValues()) { return null; } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/DynamicHubInitializer.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/DynamicHubInitializer.java index 2918526fa0c0..92c53a18ef3b 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/DynamicHubInitializer.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/DynamicHubInitializer.java @@ -179,7 +179,7 @@ public void initializeMetaData(ImageHeapScanner heapScanner, AnalysisType type) private boolean shouldRescanHub(ImageHeapScanner heapScanner, DynamicHub hub, ScanReason reason) { if (hostVM.buildingExtensionLayer()) { ImageHeapConstant hubConstant = (ImageHeapConstant) heapScanner.createImageHeapConstant(hub, reason); - return hubConstant == null || !hubConstant.isInBaseLayer(); + return hubConstant == null || !hubConstant.isInSharedLayer(); } return true; } @@ -263,7 +263,7 @@ private void buildClassInitializationInfo(ImageHeapScanner heapScanner, Analysis } else { info = buildRuntimeInitializationInfo(type, hasInitializer, typeReachedTracked); } - VMError.guarantee(!type.isInBaseLayer() || layerLoader.isInitializationInfoStable(type, info)); + VMError.guarantee(!type.isInSharedLayer() || layerLoader.isInitializationInfoStable(type, info)); } hub.setClassInitializationInfo(info); if (rescan) { diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/NativeImagePointsToAnalysis.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/NativeImagePointsToAnalysis.java index f2a2b5c267cd..d098ca582916 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/NativeImagePointsToAnalysis.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/analysis/NativeImagePointsToAnalysis.java @@ -130,7 +130,7 @@ public void onFieldAccessed(AnalysisField field) { public void onTypeReachable(AnalysisType type) { postTask(_ -> { type.getInitializeMetaDataTask().ensureDone(); - if (type.isInBaseLayer()) { + if (type.isInSharedLayer()) { /* * Since the rescanning of the hub is skipped for constants from the base layer to * avoid deadlocks, the hub needs to be rescanned manually after the metadata is @@ -138,7 +138,7 @@ public void onTypeReachable(AnalysisType type) { */ HostedImageLayerBuildingSupport.singleton().getLoader().rescanHub(type, ((SVMHost) hostVM).dynamicHub(type)); } - if (type.isArray() && type.getComponentType().isInBaseLayer()) { + if (type.isArray() && type.getComponentType().isInSharedLayer()) { /* Rescan the component hub. This will be simplified by GR-60254. */ HostedImageLayerBuildingSupport.singleton().getLoader().rescanHub(type.getComponentType(), ((SVMHost) hostVM).dynamicHub(type).getComponentHub()); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/SimulateClassInitializerSupport.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/SimulateClassInitializerSupport.java index 9bd7552842ad..e09a7d9f8236 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/SimulateClassInitializerSupport.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/SimulateClassInitializerSupport.java @@ -47,6 +47,7 @@ import com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder; import com.oracle.svm.core.classinitialization.EnsureClassInitializedNode; import com.oracle.svm.core.util.VMError; +import com.oracle.svm.hosted.AbstractAnalysisMetadataTrackingNode; import com.oracle.svm.hosted.SVMHost; import com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider; import com.oracle.svm.hosted.ameta.FieldValueInterceptionSupport; @@ -56,7 +57,6 @@ import com.oracle.svm.hosted.meta.HostedConstantReflectionProvider; import com.oracle.svm.hosted.meta.HostedType; import com.oracle.svm.hosted.phases.InlineBeforeAnalysisGraphDecoderImpl; -import com.oracle.svm.hosted.AbstractAnalysisMetadataTrackingNode; import com.oracle.svm.util.ClassUtil; import jdk.graal.compiler.core.common.spi.ConstantFieldProvider; @@ -367,7 +367,7 @@ private SimulateClassInitializerResult lookupPublishedSimulateClassInitializerRe if (!enabled) { return SimulateClassInitializerResult.NOT_SIMULATED_INITIALIZED; } - if (type.isInBaseLayer()) { + if (type.isInSharedLayer()) { if (type.getWrapped() instanceof BaseLayerType) { return SimulateClassInitializerResult.NOT_SIMULATED_INITIALIZED; } @@ -492,7 +492,7 @@ private void addClassInitializerDependencies(SimulateClassInitializerClusterMemb if (classInitializer == null) { return; } - VMError.guarantee(!classInitializer.isInBaseLayer(), "Trying to simulate a class initializer already simulated in a previous layer."); + VMError.guarantee(!classInitializer.isInSharedLayer(), "Trying to simulate a class initializer already simulated in a previous layer."); StructuredGraph graph; try { diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CEntryPointLiteralFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CEntryPointLiteralFeature.java index 632d4e6ce55e..6b88b66e73a7 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CEntryPointLiteralFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CEntryPointLiteralFeature.java @@ -77,7 +77,7 @@ public Object apply(Object source) { AnalysisMethod aStub = CEntryPointCallStubSupport.singleton().getStubForMethod(aMethod); HostedMethod hStub = (HostedMethod) metaAccess.getUniverse().lookup(aStub); assert hStub.wrapped.isNativeEntryPoint(); - assert hStub.isCompiled() || hStub.wrapped.isInBaseLayer(); + assert hStub.isCompiled() || hStub.wrapped.isInSharedLayer(); /* * Only during compilation and native image writing, we do the actual * replacement. diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java index 45eb46681417..135b920f320b 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java @@ -1264,7 +1264,7 @@ protected void ensureCompiled(HostedMethod method, CompileReason reason) { return; } if (ImageLayerBuildingSupport.buildingExtensionLayer() && !method.wrapped.reachableInCurrentLayer()) { - assert method.wrapped.isInBaseLayer(); + assert method.wrapped.isInSharedLayer(); /* * This method was reached and analyzed in the base layer, but it was not compiled in * that layer, e.g., because it was always inlined. It is referenced in the app layer, diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/RuntimeMetadataEncoderImpl.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/RuntimeMetadataEncoderImpl.java index b4979a643392..2e62103daa14 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/RuntimeMetadataEncoderImpl.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/RuntimeMetadataEncoderImpl.java @@ -800,7 +800,7 @@ public void encodeAllAndInstall() { */ continue; } - if (!declaringType.getWrapped().isInBaseLayer()) { + if (!declaringType.getWrapped().isInSharedLayer()) { int enclosingMethodInfoIndex = classMetadata.enclosingMethodInfo instanceof Throwable ? encodeErrorIndex((Throwable) classMetadata.enclosingMethodInfo) : addElement(buf, encodeEnclosingMethodInfo((Object[]) classMetadata.enclosingMethodInfo)); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/HostedDynamicLayerInfo.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/HostedDynamicLayerInfo.java index e12d36da9978..522fc3243c1a 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/HostedDynamicLayerInfo.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/HostedDynamicLayerInfo.java @@ -125,7 +125,7 @@ public PriorLayerMethodLocation getPriorLayerMethodLocation(SharedMethod sMethod assert ImageLayerBuildingSupport.buildingExtensionLayer() : "This should only be called within extension images. Within the initial layer the direct calls can be performed"; HostedMethod hMethod = (HostedMethod) sMethod; int compiledOffset = getPriorInstalledOffset(hMethod.getWrapped()); - assert hMethod.wrapped.isInBaseLayer() && compiledOffset != HostedMethod.INVALID_CODE_ADDRESS_OFFSET; + assert hMethod.wrapped.isInSharedLayer() && compiledOffset != HostedMethod.INVALID_CODE_ADDRESS_OFFSET; var basePointer = CGlobalDataFeature.singleton().registerAsAccessedOrGet(cGlobalData); return new PriorLayerMethodLocation(basePointer, compiledOffset); @@ -137,7 +137,7 @@ public boolean compiledInPriorLayer(AnalysisMethod aMethod) { } private int getPriorInstalledOffset(AnalysisMethod aMethod) { - if (aMethod.isInBaseLayer()) { + if (aMethod.isInSharedLayer()) { return priorInstalledOffsetCache.computeIfAbsent(aMethod, _ -> { var methodData = HostedImageLayerBuildingSupport.singleton().getLoader(); return methodData.getHostedMethodData(aMethod).getInstalledOffset(); @@ -148,7 +148,7 @@ private int getPriorInstalledOffset(AnalysisMethod aMethod) { } public static MethodNameInfo loadMethodNameInfo(AnalysisMethod aMethod) { - if (aMethod.isInBaseLayer()) { + if (aMethod.isInSharedLayer()) { var loader = HostedImageLayerBuildingSupport.singleton().getLoader(); var methodData = loader.getHostedMethodData(aMethod); return new MethodNameInfo(methodData.getHostedMethodName().toString(), methodData.getHostedMethodUniqueName().toString()); @@ -175,7 +175,7 @@ public void registerHostedMethod(HostedMethod hMethod) { assert !BuildPhaseProvider.isHostedUniverseBuilt(); AnalysisMethod aMethod = hMethod.getWrapped(); if (compiledInPriorLayer(aMethod)) { - assert aMethod.isInBaseLayer() : hMethod; + assert aMethod.isInSharedLayer() : hMethod; priorLayerMethodSymbols.add(localSymbolNameForMethod(hMethod)); hMethod.setCompiledInPriorLayer(); hMethod.setCodeAddressOffset(getPriorInstalledOffset(aMethod)); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredDispatchTableFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredDispatchTableFeature.java index b32607632657..0f0fbe62f614 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredDispatchTableFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredDispatchTableFeature.java @@ -208,7 +208,7 @@ private PriorDispatchTable createPriorDispatchTable(HostedType hType) { } private PriorDispatchTable getPriorDispatchTable(HostedType hType) { - if (hType.getWrapped().isInBaseLayer()) { + if (hType.getWrapped().isInSharedLayer()) { return priorDispatchTableCache.computeIfAbsent(hType, this::createPriorDispatchTable); } else { return null; @@ -340,7 +340,7 @@ public void registerNonArrayDispatchTable(HostedType type, boolean[] validTarget } private void injectPriorLayerInfo(HostedType type, HostedDispatchTable dispatchTable) { - if (type.getWrapped().isInBaseLayer()) { + if (type.getWrapped().isInSharedLayer()) { var priorInfo = getPriorDispatchTable(type); if (priorInfo != null) { compareTypeInfo(dispatchTable, priorInfo); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredFieldValueTransformerImpl.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredFieldValueTransformerImpl.java index 2caf8eb1edd2..dd8e6b74eb06 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredFieldValueTransformerImpl.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredFieldValueTransformerImpl.java @@ -34,11 +34,11 @@ import com.oracle.graal.pointsto.heap.ImageHeapConstant; import com.oracle.graal.pointsto.meta.AnalysisField; -import com.oracle.svm.util.GraalAccess; import com.oracle.svm.core.SubstrateUtil; import com.oracle.svm.core.fieldvaluetransformer.FieldValueTransformerWithReceiverBasedAvailability; import com.oracle.svm.core.layered.LayeredFieldValueTransformer; import com.oracle.svm.core.util.VMError; +import com.oracle.svm.util.GraalAccess; import jdk.graal.compiler.debug.Assertions; import jdk.vm.ci.meta.JavaConstant; @@ -135,7 +135,7 @@ boolean finalizeFieldValue(ImageHeapConstant ihc) { */ private TransformedValueState createValueStatue(Object canonicalReceiver, Object receiver) { boolean useUpdate = false; - if (receiver instanceof ImageHeapConstant ihc && ihc.isInBaseLayer()) { + if (receiver instanceof ImageHeapConstant ihc && ihc.isInSharedLayer()) { useUpdate = priorLayerReceiversWithUpdatableValues.contains(ImageHeapConstant.getConstantID(ihc)); } return new TransformedValueState(canonicalReceiver, useUpdate); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredFieldValueTransformerSupport.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredFieldValueTransformerSupport.java index 92eef23b66c2..4ddfc6c57ecb 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredFieldValueTransformerSupport.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredFieldValueTransformerSupport.java @@ -220,7 +220,7 @@ public LayeredFieldValueTransformerImpl createTransformer(AnalysisField aField, if (result != null) { return result; } - VMError.guarantee(!aField.isInBaseLayer() || !fieldsWithUpdatableValues.contains(aField.getId()), + VMError.guarantee(!aField.isInSharedLayer() || !fieldsWithUpdatableValues.contains(aField.getId()), "Field value transformer should have already been installed via setupUpdatableValueTransformers."); return createTransformer(aField, layeredFieldValue, Set.of()); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredStaticFieldSupport.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredStaticFieldSupport.java index 152974fc56f0..fe75d31f381c 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredStaticFieldSupport.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/LayeredStaticFieldSupport.java @@ -266,7 +266,7 @@ public LayerAssignmentStatus getAssignmentStatus(AnalysisField aField) { processAppLayerDeferredClassFilters(aField.getDeclaringClass()); } return assignmentStatusMap.computeIfAbsent(aField, _ -> { - if (!(inAppLayer && aField.isInBaseLayer())) { + if (!(inAppLayer && aField.isInSharedLayer())) { return LayerAssignmentStatus.UNSPECIFIED; } throw VMError.shouldNotReachHere(String.format("Base analysis field assignment status queried before it is initialized: %s", aField)); @@ -274,7 +274,7 @@ public LayerAssignmentStatus getAssignmentStatus(AnalysisField aField) { } public int getPriorInstalledLayerNum(AnalysisField analysisField) { - if (!(inAppLayer && analysisField.isInBaseLayer())) { + if (!(inAppLayer && analysisField.isInSharedLayer())) { return MultiLayeredImageSingleton.LAYER_NUM_UNINSTALLED; } @@ -298,7 +298,7 @@ public boolean installableInLayer(AnalysisField aField) { yield true; } case PRIOR_LAYER -> { - assert aField.isInBaseLayer(); + assert aField.isInSharedLayer(); yield false; } case APP_LAYER_REQUESTED, APP_LAYER_DEFERRED -> inAppLayer; diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SVMImageLayerLoader.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SVMImageLayerLoader.java index 35ea53566417..b260a1a54966 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SVMImageLayerLoader.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SVMImageLayerLoader.java @@ -679,7 +679,7 @@ public int lookupHostedTypeInBaseLayer(AnalysisType type) { } private static int getBaseLayerTypeId(AnalysisType type) { - VMError.guarantee(type.isInBaseLayer()); + VMError.guarantee(type.isInSharedLayer()); if (type.getWrapped() instanceof BaseLayerType baseLayerType) { return baseLayerType.getBaseLayerId(); } @@ -742,7 +742,7 @@ private void initializeBaseLayerTypeBeforePublishing(AnalysisType type, Persiste */ @Override public void initializeBaseLayerType(AnalysisType type) { - VMError.guarantee(type.isInBaseLayer()); + VMError.guarantee(type.isInSharedLayer()); PersistedAnalysisType.Reader td = findType(getBaseLayerTypeId(type)); postTask(td.getIsInstantiated(), _ -> type.registerAsInstantiated(PERSISTED)); postTask(td.getIsUnsafeAllocated(), _ -> type.registerAsUnsafeAllocated(PERSISTED)); @@ -1661,7 +1661,7 @@ private static AnalysisField getFieldFromIndex(ImageHeapInstance instance, int i private void addBaseLayerObject(int id, long objectOffset, Supplier imageHeapConstantSupplier) { constants.computeIfAbsent(id, _ -> { ImageHeapConstant heapObj = imageHeapConstantSupplier.get(); - heapObj.markInBaseLayer(); + heapObj.markInSharedLayer(); /* * Packages are normally rescanned when the DynamicHub is initialized. However, since * they are not relinked, the packages from the base layer will never be marked as @@ -1737,7 +1737,7 @@ private JavaConstant lookupHostedObject(PersistedConstant.Reader baseLayerConsta } private static boolean shouldRelinkField(AnalysisField field) { - VMError.guarantee(field.isInBaseLayer()); + VMError.guarantee(field.isInSharedLayer()); return !(field.getWrapped() instanceof BaseLayerField) && !AnnotationUtil.isAnnotationPresent(field, Delete.class); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/VTableBuilder.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/VTableBuilder.java index 80f5a4c6cca8..8cc4397bcd1a 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/VTableBuilder.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/VTableBuilder.java @@ -95,12 +95,12 @@ private static class OpenTypeWorldHubLayoutUtils { * See generateDispatchTable for the use of this filter. */ private boolean filterVTableMethods(HostedType type) { - return closedTypeWorld && !type.getWrapped().isInBaseLayer(); + return closedTypeWorld && !type.getWrapped().isInSharedLayer(); } private boolean shouldIncludeType(HostedType type) { if (closedTypeWorld) { - if (type.getWrapped().isInBaseLayer()) { + if (type.getWrapped().isInSharedLayer()) { /* * This check will be later removed. * @@ -114,7 +114,7 @@ private boolean shouldIncludeType(HostedType type) { * removed via graph strengthening. It is also always possible to see base layer * types. */ - return type.getWrapped().isReachable() || type.getWrapped().isInBaseLayer(); + return type.getWrapped().isReachable() || type.getWrapped().isInSharedLayer(); } else { /* * When using the open type world we are conservative and calculate metadata for all diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/option/RuntimeOptionFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/option/RuntimeOptionFeature.java index bac1370f9cfd..1685775c183c 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/option/RuntimeOptionFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/option/RuntimeOptionFeature.java @@ -189,7 +189,7 @@ private void collectOptionKeysExtension(DuringAnalysisAccess access, OptionKey> previousLayerRegisteredElements, AnalysisType declaringClass, int elementId) { Set previousLayerRegisteredElementIds = previousLayerRegisteredElements.get(declaringClass.getId()); - if (declaringClass.isInBaseLayer() && previousLayerRegisteredElementIds != null) { + if (declaringClass.isInSharedLayer() && previousLayerRegisteredElementIds != null) { return previousLayerRegisteredElementIds.contains(elementId); } return false;