|
89 | 89 | import com.oracle.svm.core.layeredimagesingleton.LayeredImageSingleton;
|
90 | 90 | import com.oracle.svm.core.layeredimagesingleton.LayeredImageSingletonBuilderFlags;
|
91 | 91 | import com.oracle.svm.core.layeredimagesingleton.LayeredImageSingletonSupport;
|
| 92 | +import com.oracle.svm.core.layeredimagesingleton.MultiLayeredImageSingleton; |
92 | 93 | import com.oracle.svm.core.option.HostedOptionKey;
|
93 | 94 | import com.oracle.svm.core.snippets.KnownIntrinsics;
|
94 | 95 | import com.oracle.svm.core.util.UserError;
|
@@ -1125,6 +1126,18 @@ private static void registerVMConfigurationPlugins(InvocationPlugins plugins) {
|
1125 | 1126 | public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unused, ValueNode classNode) {
|
1126 | 1127 | Class<?> key = constantObjectParameter(b, targetMethod, 0, Class.class, classNode);
|
1127 | 1128 | boolean result = ImageSingletons.contains(key);
|
| 1129 | + if (!result && ImageLayerBuildingSupport.buildingImageLayer()) { |
| 1130 | + if (ApplicationLayerOnlyImageSingleton.class.isAssignableFrom(key) || MultiLayeredImageSingleton.class.isAssignableFrom(key)) { |
| 1131 | + /* |
| 1132 | + * ApplicationLayerOnlyImageSingletons and the array representation of a |
| 1133 | + * MultiLayeredImageSingleton will only be created in the final layer. |
| 1134 | + * However, we assume they exist in all layers. If lookup/getAllLayers is |
| 1135 | + * called on this key, then our infrastructure will ensure it is either |
| 1136 | + * created in the application layer or produce a buildtime error. |
| 1137 | + */ |
| 1138 | + result = true; |
| 1139 | + } |
| 1140 | + } |
1128 | 1141 | b.addPush(JavaKind.Boolean, ConstantNode.forBoolean(result));
|
1129 | 1142 | return true;
|
1130 | 1143 | }
|
|
0 commit comments