@@ -1265,64 +1265,66 @@ public static void initializeBigBang(Inflation bb, OptionValues options, Feature
1265
1265
* example.
1266
1266
*/
1267
1267
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 );
1269
1271
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 );
1279
1281
1280
1282
/* MethodRef can conceal use of MethodPointer and MethodOffset until after analysis. */
1281
1283
bb .addRootClass (MethodPointer .class , false , true );
1282
1284
if (SubstrateOptions .useRelativeCodePointers ()) {
1283
1285
bb .addRootClass (MethodOffset .class , false , true );
1284
1286
}
1285
1287
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 );
1289
1291
1290
1292
for (JavaKind kind : JavaKind .values ()) {
1291
1293
if (kind .isPrimitive () && kind != JavaKind .Void ) {
1292
1294
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 );
1294
1296
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 );
1297
1299
/*
1298
1300
* Register the cache location as reachable.
1299
1301
* BoxingSnippets$Templates#getCacheLocation accesses the cache field.
1300
1302
*/
1301
1303
Class <?>[] innerClasses = kind .toBoxedJavaClass ().getDeclaredClasses ();
1302
1304
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 );
1304
1306
}
1305
1307
}
1306
1308
}
1307
1309
/* 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 );
1311
1313
/*
1312
1314
* SubstrateAllocationProfilingData is not actually present in the image since it is only
1313
1315
* allocated at build time, is passed to snippets as a @ConstantParameter, and it only
1314
1316
* contains final fields that are constant-folded. However, since the profiling object is
1315
1317
* only allocated during lowering it is processed by the shadow heap after analysis, so its
1316
1318
* type needs to be already marked reachable at this point.
1317
1319
*/
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 );
1319
1321
/*
1320
1322
* Similarly to above, StackSlotIdentity only gets reachable during lowering, through build
1321
1323
* time allocated constants. It doesn't actually end up in the image heap since all its
1322
1324
* fields are final and are constant-folded, but the type becomes reachable, through the
1323
1325
* shadow heap processing, after analysis.
1324
1326
*/
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 );
1326
1328
}
1327
1329
1328
1330
public static void performSnippetGraphAnalysis (BigBang bb , SubstrateReplacements replacements , OptionValues options , Function <Object , Object > objectTransformer ) {
0 commit comments