@@ -374,7 +374,7 @@ Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader
374
374
assert (class_name != nullptr && !Signature::is_array (class_name), " must be" );
375
375
if (Signature::has_envelope (class_name)) {
376
376
ResourceMark rm (THREAD);
377
- // Ignore wrapping L and ; (and Q and ; for value types) .
377
+ // Ignore wrapping L and ;.
378
378
TempNewSymbol name = SymbolTable::new_symbol (class_name->as_C_string () + 1 ,
379
379
class_name->utf8_length () - 2 );
380
380
return resolve_instance_class_or_null (name, class_loader, THREAD);
@@ -422,7 +422,8 @@ static inline void log_circularity_error(Symbol* name, PlaceholderEntry* probe)
422
422
}
423
423
424
424
// Must be called for any superclass or superinterface resolution
425
- // during class definition to allow class circularity checking
425
+ // during class definition, or may be called for inline field layout processing
426
+ // to detect class circularity errors.
426
427
// superinterface callers:
427
428
// parse_interfaces - from defineClass
428
429
// superclass callers:
@@ -435,10 +436,12 @@ static inline void log_circularity_error(Symbol* name, PlaceholderEntry* probe)
435
436
// If another thread is trying to resolve the class, it must do
436
437
// superclass checks on its own thread to catch class circularity and
437
438
// to avoid deadlock.
439
+ // inline field layout callers:
440
+ // The field's class must be loaded to determine layout.
438
441
//
439
442
// resolve_with_circularity_detection adds a DETECT_CIRCULARITY placeholder to the placeholder table before calling
440
443
// resolve_instance_class_or_null. ClassCircularityError is detected when a DETECT_CIRCULARITY or LOAD_INSTANCE
441
- // placeholder for the same thread, class, classloader is found.
444
+ // placeholder for the same thread, class, and classloader is found.
442
445
// This can be seen with logging option: -Xlog:class+load+placeholders=debug.
443
446
//
444
447
InstanceKlass* SystemDictionary::resolve_with_circularity_detection (Symbol* class_name,
@@ -473,7 +476,7 @@ InstanceKlass* SystemDictionary::resolve_with_circularity_detection(Symbol* clas
473
476
{
474
477
MutexLocker mu (THREAD, SystemDictionary_lock);
475
478
476
- // Must check ClassCircularity before resolving next_name (superclass or interface ).
479
+ // Must check ClassCircularity before resolving next_name (superclass, interface, field types or speculatively preloaded argument types ).
477
480
PlaceholderEntry* probe = PlaceholderTable::get_entry (class_name, loader_data);
478
481
if (probe != nullptr && probe->check_seen_thread (THREAD, PlaceholderTable::DETECT_CIRCULARITY)) {
479
482
log_circularity_error (class_name, probe);
@@ -497,7 +500,7 @@ InstanceKlass* SystemDictionary::resolve_with_circularity_detection(Symbol* clas
497
500
THROW_MSG_NULL (vmSymbols::java_lang_ClassCircularityError (), class_name->as_C_string ());
498
501
}
499
502
500
- // Resolve the superclass or superinterface, check results on return
503
+ // Resolve the superclass, superinterface, field type or speculatively preloaded argument types and check results on return.
501
504
InstanceKlass* superk =
502
505
SystemDictionary::resolve_instance_class_or_null (next_name,
503
506
class_loader,
@@ -1104,7 +1107,7 @@ bool SystemDictionary::preload_from_null_free_field(InstanceKlass* ik, Handle cl
1104
1107
log_info (class , preload)(" Preloading of class %s during loading of shared class %s. "
1105
1108
" Cause: a null-free non-static field is declared with this type" ,
1106
1109
name->as_C_string (), ik->name ()->as_C_string ());
1107
- InstanceKlass* real_k = SystemDictionary::resolve_with_circularity_detection_or_fail (ik->name (), name,
1110
+ InstanceKlass* real_k = SystemDictionary::resolve_with_circularity_detection (ik->name (), name,
1108
1111
class_loader, false , CHECK_false);
1109
1112
if (HAS_PENDING_EXCEPTION) {
1110
1113
log_warning (class , preload)(" Preloading of class %s during loading of class %s "
@@ -1142,7 +1145,7 @@ void SystemDictionary::try_preload_from_loadable_descriptors(InstanceKlass* ik,
1142
1145
log_info (class , preload)(" Preloading of class %s during loading of shared class %s. "
1143
1146
" Cause: field type in LoadableDescriptors attribute" ,
1144
1147
name->as_C_string (), ik->name ()->as_C_string ());
1145
- InstanceKlass* real_k = SystemDictionary::resolve_with_circularity_detection_or_fail (ik->name (), name,
1148
+ InstanceKlass* real_k = SystemDictionary::resolve_with_circularity_detection (ik->name (), name,
1146
1149
class_loader, false , THREAD);
1147
1150
if (HAS_PENDING_EXCEPTION) {
1148
1151
CLEAR_PENDING_EXCEPTION;
0 commit comments