@@ -1265,64 +1265,66 @@ public static void initializeBigBang(Inflation bb, OptionValues options, Feature
12651265 * example.
12661266 */
12671267 private static void registerRootElements (Inflation bb ) {
1268- bb .addRootClass (Object .class , false , false ).registerAsInstantiated ("root class" );
1268+ String rootClassReason = "system class included unconditionally" ;
1269+ String rootMethodReason = "system method included unconditionally" ;
1270+ bb .addRootClass (Object .class , false , false ).registerAsInstantiated (rootClassReason );
12691271 bb .addRootField (DynamicHub .class , "vtable" );
1270- bb .addRootClass (String .class , false , false ).registerAsInstantiated ("root class" );
1271- bb .addRootClass (String [].class , false , false ).registerAsInstantiated ("root class" );
1272- bb .addRootField (String .class , "value" ).registerAsInstantiated ("root class" );
1273- bb .addRootClass (long [].class , false , false ).registerAsInstantiated ("root class" );
1274- bb .addRootClass (byte [].class , false , false ).registerAsInstantiated ("root class" );
1275- bb .addRootClass (byte [][].class , false , false ).registerAsInstantiated ("root class" );
1276- bb .addRootClass (Object [].class , false , false ).registerAsInstantiated ("root class" );
1277- bb .addRootClass (CFunctionPointer [].class , false , false ).registerAsInstantiated ("root class" );
1278- bb .addRootClass (PointerBase [].class , false , false ).registerAsInstantiated ("root class" );
1272+ bb .addRootClass (String .class , false , false ).registerAsInstantiated (rootClassReason );
1273+ bb .addRootClass (String [].class , false , false ).registerAsInstantiated (rootClassReason );
1274+ bb .addRootField (String .class , "value" ).registerAsInstantiated (rootClassReason );
1275+ bb .addRootClass (long [].class , false , false ).registerAsInstantiated (rootClassReason );
1276+ bb .addRootClass (byte [].class , false , false ).registerAsInstantiated (rootClassReason );
1277+ bb .addRootClass (byte [][].class , false , false ).registerAsInstantiated (rootClassReason );
1278+ bb .addRootClass (Object [].class , false , false ).registerAsInstantiated (rootClassReason );
1279+ bb .addRootClass (CFunctionPointer [].class , false , false ).registerAsInstantiated (rootClassReason );
1280+ bb .addRootClass (PointerBase [].class , false , false ).registerAsInstantiated (rootClassReason );
12791281
12801282 /* MethodRef can conceal use of MethodPointer and MethodOffset until after analysis. */
12811283 bb .addRootClass (MethodPointer .class , false , true );
12821284 if (SubstrateOptions .useRelativeCodePointers ()) {
12831285 bb .addRootClass (MethodOffset .class , false , true );
12841286 }
12851287
1286- bb .addRootMethod (ReflectionUtil .lookupMethod (SubstrateArraycopySnippets .class , "doArraycopy" , Object . class , int . class , Object . class , int . class , int . class ), true ,
1287- "Runtime support, registered in " + NativeImageGenerator .class );
1288- bb .addRootMethod (ReflectionUtil .lookupMethod (Object .class , "getClass" ), true , "Runtime support, registered in " + NativeImageGenerator . class );
1288+ bb .addRootMethod (ReflectionUtil .lookupMethod (SubstrateArraycopySnippets .class , "doArraycopy" ,
1289+ Object . class , int . class , Object . class , int . class , int .class ), true , rootMethodReason );
1290+ bb .addRootMethod (ReflectionUtil .lookupMethod (Object .class , "getClass" ), true , rootMethodReason );
12891291
12901292 for (JavaKind kind : JavaKind .values ()) {
12911293 if (kind .isPrimitive () && kind != JavaKind .Void ) {
12921294 bb .addRootClass (kind .toJavaClass (), false , true );
1293- bb .addRootClass (kind .toBoxedJavaClass (), false , true ).registerAsInstantiated ("root class" );
1295+ bb .addRootClass (kind .toBoxedJavaClass (), false , true ).registerAsInstantiated (rootClassReason );
12941296 bb .addRootField (kind .toBoxedJavaClass (), "value" );
1295- bb .addRootMethod (ReflectionUtil .lookupMethod (kind .toBoxedJavaClass (), "valueOf" , kind .toJavaClass ()), true , "Runtime support, registered in " + NativeImageGenerator . class );
1296- bb .addRootMethod (ReflectionUtil .lookupMethod (kind .toBoxedJavaClass (), kind .getJavaName () + "Value" ), true , "Runtime support, registered in " + NativeImageGenerator . class );
1297+ bb .addRootMethod (ReflectionUtil .lookupMethod (kind .toBoxedJavaClass (), "valueOf" , kind .toJavaClass ()), true , rootMethodReason );
1298+ bb .addRootMethod (ReflectionUtil .lookupMethod (kind .toBoxedJavaClass (), kind .getJavaName () + "Value" ), true , rootMethodReason );
12971299 /*
12981300 * Register the cache location as reachable.
12991301 * BoxingSnippets$Templates#getCacheLocation accesses the cache field.
13001302 */
13011303 Class <?>[] innerClasses = kind .toBoxedJavaClass ().getDeclaredClasses ();
13021304 if (innerClasses != null && innerClasses .length > 0 ) {
1303- bb .getMetaAccess ().lookupJavaType (innerClasses [0 ]).registerAsReachable ("inner class of root class" );
1305+ bb .getMetaAccess ().lookupJavaType (innerClasses [0 ]).registerAsReachable ("inner class of " + rootClassReason );
13041306 }
13051307 }
13061308 }
13071309 /* SubstrateTemplates#toLocationIdentity accesses the Counter.value field. */
1308- bb .getMetaAccess ().lookupJavaType (JavaKind .Void .toJavaClass ()).registerAsReachable ("root class" );
1309- bb .getMetaAccess ().lookupJavaType (com .oracle .svm .core .util .Counter .class ).registerAsReachable ("root class" );
1310- bb .getMetaAccess ().lookupJavaType (com .oracle .svm .core .allocationprofile .AllocationCounter .class ).registerAsReachable ("root class" );
1310+ bb .getMetaAccess ().lookupJavaType (JavaKind .Void .toJavaClass ()).registerAsReachable (rootClassReason );
1311+ bb .getMetaAccess ().lookupJavaType (com .oracle .svm .core .util .Counter .class ).registerAsReachable (rootClassReason );
1312+ bb .getMetaAccess ().lookupJavaType (com .oracle .svm .core .allocationprofile .AllocationCounter .class ).registerAsReachable (rootClassReason );
13111313 /*
13121314 * SubstrateAllocationProfilingData is not actually present in the image since it is only
13131315 * allocated at build time, is passed to snippets as a @ConstantParameter, and it only
13141316 * contains final fields that are constant-folded. However, since the profiling object is
13151317 * only allocated during lowering it is processed by the shadow heap after analysis, so its
13161318 * type needs to be already marked reachable at this point.
13171319 */
1318- bb .getMetaAccess ().lookupJavaType (com .oracle .svm .core .graal .snippets .SubstrateAllocationSnippets .SubstrateAllocationProfilingData .class ).registerAsReachable ("root class" );
1320+ bb .getMetaAccess ().lookupJavaType (com .oracle .svm .core .graal .snippets .SubstrateAllocationSnippets .SubstrateAllocationProfilingData .class ).registerAsReachable (rootClassReason );
13191321 /*
13201322 * Similarly to above, StackSlotIdentity only gets reachable during lowering, through build
13211323 * time allocated constants. It doesn't actually end up in the image heap since all its
13221324 * fields are final and are constant-folded, but the type becomes reachable, through the
13231325 * shadow heap processing, after analysis.
13241326 */
1325- bb .getMetaAccess ().lookupJavaType (com .oracle .svm .core .graal .stackvalue .StackValueNode .StackSlotIdentity .class ).registerAsReachable ("root class" );
1327+ bb .getMetaAccess ().lookupJavaType (com .oracle .svm .core .graal .stackvalue .StackValueNode .StackSlotIdentity .class ).registerAsReachable (rootClassReason );
13261328 }
13271329
13281330 public static void performSnippetGraphAnalysis (BigBang bb , SubstrateReplacements replacements , OptionValues options , Function <Object , Object > objectTransformer ) {
0 commit comments