|
20 | 20 | import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem; |
21 | 21 | import io.quarkus.deployment.builditem.nativeimage.UnsafeAccessedFieldBuildItem; |
22 | 22 | import io.quarkus.deployment.pkg.NativeConfig; |
23 | | -import io.quarkus.gizmo.AssignableResultHandle; |
24 | 23 | import io.quarkus.gizmo.BranchResult; |
25 | 24 | import io.quarkus.gizmo.BytecodeCreator; |
26 | 25 | import io.quarkus.gizmo.CatchBlockCreator; |
@@ -51,11 +50,6 @@ public class NativeImageFeatureStep { |
51 | 50 | "initializeAtRunTime", void.class, Class[].class); |
52 | 51 | private static final MethodDescriptor INITIALIZE_PACKAGES_AT_RUN_TIME = ofMethod(RuntimeClassInitialization.class, |
53 | 52 | "initializeAtRunTime", void.class, String[].class); |
54 | | - public static final String RUNTIME_CLASS_INITIALIZATION_SUPPORT = "org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport"; |
55 | | - private static final MethodDescriptor RERUN_INITIALIZATION = ofMethod( |
56 | | - RUNTIME_CLASS_INITIALIZATION_SUPPORT, |
57 | | - "rerunInitialization", void.class, Class.class, String.class); |
58 | | - |
59 | 53 | static final String BEFORE_ANALYSIS_ACCESS = Feature.BeforeAnalysisAccess.class.getName(); |
60 | 54 |
|
61 | 55 | @BuildStep |
@@ -198,29 +192,7 @@ public void write(String s, byte[] bytes) { |
198 | 192 | runtimeReinitializedClasses.returnValue(classesArray); |
199 | 193 |
|
200 | 194 | ResultHandle classes = overallCatch.invokeStaticMethod(runtimeReinitializedClasses.getMethodDescriptor()); |
201 | | - |
202 | | - ResultHandle graalVMVersion = overallCatch.invokeStaticMethod(GRAALVM_VERSION_GET_CURRENT); |
203 | | - BranchResult graalVm23_1Test = overallCatch |
204 | | - .ifGreaterEqualZero(overallCatch.invokeVirtualMethod(GRAALVM_VERSION_COMPARE_TO, graalVMVersion, |
205 | | - overallCatch.marshalAsArray(int.class, overallCatch.load(23), overallCatch.load(1)))); |
206 | | - /* GraalVM >= 23.1 */ |
207 | | - try (BytecodeCreator greaterEqual23_1 = graalVm23_1Test.trueBranch()) { |
208 | | - greaterEqual23_1.invokeStaticMethod(INITIALIZE_CLASSES_AT_RUN_TIME, classes); |
209 | | - } |
210 | | - /* GraalVM < 23.1 */ |
211 | | - try (BytecodeCreator less23_1 = graalVm23_1Test.falseBranch()) { |
212 | | - ResultHandle quarkus = less23_1.load("Quarkus"); |
213 | | - ResultHandle imageSingleton = less23_1.invokeStaticMethod(IMAGE_SINGLETONS_LOOKUP, |
214 | | - less23_1.loadClassFromTCCL(RUNTIME_CLASS_INITIALIZATION_SUPPORT)); |
215 | | - ResultHandle arraySize = less23_1.arrayLength(classes); |
216 | | - AssignableResultHandle index = less23_1.createVariable(int.class); |
217 | | - less23_1.assign(index, less23_1.load(0)); |
218 | | - try (BytecodeCreator loop = less23_1.whileLoop(c -> c.ifIntegerLessThan(index, arraySize)).block()) { |
219 | | - loop.invokeInterfaceMethod(RERUN_INITIALIZATION, imageSingleton, loop.readArrayValue(classes, index), |
220 | | - quarkus); |
221 | | - loop.assign(index, loop.increment(index)); |
222 | | - } |
223 | | - } |
| 195 | + overallCatch.invokeStaticMethod(INITIALIZE_CLASSES_AT_RUN_TIME, classes); |
224 | 196 | } |
225 | 197 |
|
226 | 198 | // Ensure registration of fields being accessed through unsafe is done last to ensure that the class |
|
0 commit comments