You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If a class declares a method that uses an inline class as an argument
1046
-
// type or return inline type, this inline class must be loaded during the
1047
-
// linking of this class because size and properties of the inline class
1048
-
// must be known in order to be able to perform inline type optimizations.
1049
-
// The implementation below is an approximation of this rule, the code
1050
-
// iterates over all methods of the current class (including overridden
1051
-
// methods), not only the methods declared by this class. This
1052
-
// approximation makes the code simpler, and doesn't change the semantic
1053
-
// because classes declaring methods overridden by the current class are
1054
-
// linked (and have performed their own pre-loading) before the linking
1055
-
// of the current class.
1056
-
1057
-
1058
-
// Note:
1059
-
// Inline class types are loaded during
1060
-
// the loading phase (see ClassFileParser::post_process_parsed_stream()).
1061
-
// Inline class types used as element types for array creation
1062
-
// are not pre-loaded. Their loading is triggered by either anewarray
1063
-
// or multianewarray bytecodes.
1064
-
1065
-
// Could it be possible to do the following processing only if the
1066
-
// class uses inline types?
1067
1082
if (EnableValhalla) {
1068
-
ResourceMark rm(THREAD);
1069
-
for (AllFieldStream fs(this); !fs.done(); fs.next()) {
1070
-
if (fs.is_null_free_inline_type() && fs.access_flags().is_static()) {
1071
-
assert(fs.access_flags().is_strict(), "null-free fields must be strict");
1072
-
Symbol* sig = fs.signature();
1073
-
TempNewSymbol s = Signature::strip_envelope(sig);
1074
-
if (s != name()) {
1075
-
log_info(class, preload)("Preloading of class %s during linking of class %s. Cause: a null-free static field is declared with this type", s->as_C_string(), name()->as_C_string());
1076
-
Klass* klass = SystemDictionary::resolve_or_fail(s,
1077
-
Handle(THREAD, class_loader()), true,
1078
-
CHECK_false);
1079
-
if (HAS_PENDING_EXCEPTION) {
1080
-
log_warning(class, preload)("Preloading of class %s during linking of class %s (cause: null-free static field) failed: %s",
log_info(class, preload)("Preloading of class %s during linking of class %s because of the class is listed in the LoadableDescriptors attribute", sig->as_C_string(), name()->as_C_string());
1126
-
oop loader = class_loader();
1127
-
Klass* klass = SystemDictionary::resolve_or_null(class_name,
1128
-
Handle(THREAD, loader), THREAD);
1129
-
if (HAS_PENDING_EXCEPTION) {
1130
-
CLEAR_PENDING_EXCEPTION;
1131
-
}
1132
-
if (klass != nullptr) {
1133
-
log_info(class, preload)("Preloading of class %s during linking of class %s (cause: LoadableDescriptors attribute) succeeded", class_name->as_C_string(), name()->as_C_string());
1134
-
if (!klass->is_inline_klass()) {
1135
-
// Non value class are allowed by the current spec, but it could be an indication of an issue so let's log a warning
1136
-
log_warning(class, preload)("Preloading of class %s during linking of class %s (cause: LoadableDescriptors attribute) but loaded class is not a value class", class_name->as_C_string(), name()->as_C_string());
1137
-
}
1138
-
} else {
1139
-
log_warning(class, preload)("Preloading of class %s during linking of class %s (cause: LoadableDescriptors attribute) failed", class_name->as_C_string(), name()->as_C_string());
1140
-
}
1141
-
}
1142
-
}
1084
+
// so inline classes can be scalarized in the calling conventions computed below
out.shouldContain("java.lang.IncompatibleClassChangeError: Class PreloadCircularityTest$Class9a expects class PreloadCircularityTest$Class9b to be a value class, but it is an identity class");
297
297
}
298
298
299
-
staticvalueclassClass10a {
300
-
@Strict
301
-
@NullRestricted
302
-
Class10bvb = newClass10b();
303
-
}
304
-
305
-
staticvalueclassClass10b { }
306
-
307
-
// void test_10() throws Exception {
308
-
// OutputAnalyzer out = tryLoadingClass("PreloadCircularityTest$Class10a");
309
-
// out.shouldHaveExitValue(1);
310
-
// out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class10b during loading of class PreloadCircularityTest$Class10a. Cause: a null-free non-static field is declared with this type");
311
-
// out.shouldContain("java.lang.IncompatibleClassChangeError: class PreloadCircularityTest$Class10b is not implicitly constructible and it is used in a null restricted non-static field (not supported)");
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class51b during linking of class PreloadCircularityTest$Class51a. Cause: a null-free static field is declared with this type");
354
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class51b during linking of class PreloadCircularityTest$Class51a (cause: null-free static field) succeeded");
355
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class51c during linking of class PreloadCircularityTest$Class51a. Cause: a null-free static field is declared with this type");
356
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class51a during loading of class PreloadCircularityTest$Class51c. Cause: a null-free non-static field is declared with this type");
357
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class51a during loading of class PreloadCircularityTest$Class51c (cause: null-free non-static field) succeeded");
358
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class51c during linking of class PreloadCircularityTest$Class51a (cause: null-free static field) succeeded");
359
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class51a during linking of class PreloadCircularityTest$Class51b. Cause: a null-free static field is declared with this type");
360
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class51a during linking of class PreloadCircularityTest$Class51b (cause: null-free static field) succeeded");
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class52b during linking of class PreloadCircularityTest$Class52a. Cause: a null-free static field is declared with this type");
385
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class52c during loading of class PreloadCircularityTest$Class52b. Cause: a null-free non-static field is declared with this type");
386
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class52b during loading of class PreloadCircularityTest$Class52c. Cause: a null-free non-static field is declared with this type");
387
-
out.shouldContain("[warning][class,preload] Preloading of class PreloadCircularityTest$Class52b during loading of class PreloadCircularityTest$Class52c (cause: null-free non-static field) failed: java/lang/ClassCircularityError");
388
-
out.shouldContain("[warning][class,preload] Preloading of class PreloadCircularityTest$Class52c during loading of class PreloadCircularityTest$Class52b (cause: null-free non-static field) failed: java/lang/ClassCircularityError");
389
-
}
390
-
391
-
staticvalueclassClass53a {
392
-
Class53bvb = newClass53b();
393
-
394
-
@Strict
395
-
@NullRestricted
396
-
staticClass53bsb = newClass53b();
397
-
}
398
-
399
-
staticvalueclassClass53b {
400
-
@Strict
401
-
@NullRestricted
402
-
Class53ava = newClass53a();
403
-
}
404
-
405
-
// In the following test, Class53a fails to optimistically load Class53b at load time, but successfully loads it at link time
406
-
407
-
// void test_53() throws Exception {
408
-
// OutputAnalyzer out = tryLoadingClass("PreloadCircularityTest$Class53a");
409
-
// out.shouldHaveExitValue(0);
410
-
// out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class53b during loading of class PreloadCircularityTest$Class53a. Cause: field type in LoadableDescriptors attribute");
411
-
// out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class53a during loading of class PreloadCircularityTest$Class53b. Cause: a null-free non-static field is declared with this type");
412
-
// out.shouldContain("[warning][class,preload] Preloading of class PreloadCircularityTest$Class53a during loading of class PreloadCircularityTest$Class53b (cause: null-free non-static field) failed: java/lang/ClassCircularityError");
413
-
// out.shouldContain("[warning][class,preload] Preloading of class PreloadCircularityTest$Class53b during loading of class PreloadCircularityTest$Class53a (cause: field type in LoadableDescriptors attribute) failed : java/lang/ClassCircularityError");
414
-
// out.shouldContain("[info ][class,preload] Preloading of class PreloadCircularityTest$Class53b during linking of class PreloadCircularityTest$Class53a. Cause: a null-free static field is declared with this type");
415
-
// out.shouldContain("[info ][class,preload] Preloading of class PreloadCircularityTest$Class53a during loading of class PreloadCircularityTest$Class53b. Cause: a null-free non-static field is declared with this type");
416
-
// out.shouldContain("[info ][class,preload] Preloading of class PreloadCircularityTest$Class53a during loading of class PreloadCircularityTest$Class53b (cause: null-free non-static field) succeeded");
417
-
// out.shouldContain("[info ][class,preload] Preloading of class PreloadCircularityTest$Class53b during linking of class PreloadCircularityTest$Class53a (cause: null-free static field) succeeded");
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class54b during linking of class PreloadCircularityTest$Class54a. Cause: a null-free static field is declared with this type");
432
-
out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class54b during linking of class PreloadCircularityTest$Class54a (cause: null-free static field) succeeded");
433
-
out.shouldContain("java.lang.IncompatibleClassChangeError: class PreloadCircularityTest$Class54a expects class PreloadCircularityTest$Class54b to be a value class but it is an identity class");
434
-
}
435
-
436
-
staticclassClass55a {
437
-
@Strict
438
-
@NullRestricted
439
-
staticClass55bsb = newClass55b();
440
-
}
441
-
442
-
staticvalueclassClass55b { }
443
-
444
-
// void test_55() throws Exception {
445
-
// OutputAnalyzer out = tryLoadingClass("PreloadCircularityTest$Class55a");
446
-
// out.shouldHaveExitValue(1);
447
-
// out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class55b during linking of class PreloadCircularityTest$Class55a. Cause: a null-free static field is declared with this type");
448
-
// out.shouldContain("[info][class,preload] Preloading of class PreloadCircularityTest$Class55b during linking of class PreloadCircularityTest$Class55a (cause: null-free static field) succeeded");
449
-
// out.shouldContain("java.lang.IncompatibleClassChangeError: class PreloadCircularityTest$Class55b is not implicitly constructible and it is used in a null restricted static field (not supported)");
0 commit comments