AOT uses these bits in InstanceKlassFlags to quickly find out the defining loader of a class, without having to query InstanceKlass::class_loader().
class InstanceKlassFlags {
#define IK_FLAGS_DO(flag) \
flag(is_shared_boot_class , 1 << 7) /* defining class loader is boot class loader */ \
flag(is_shared_platform_class , 1 << 8) /* defining class loader is platform class loader */ \
flag(is_shared_app_class , 1 << 9) /* defining class loader is app class loader */ \
However, there are several problems:
[1] The bits a mis-named. We assigned these bits even for classes that are loaded outside of the AOT cache. I.e., it's possible for this to be true:
!ik->is_shared() && is_shared_boot_class()
[2] These bits are assigned in multiple places, sometimes well after the class becomes visible, so there may be race conditions in reading these bits.
[3] These bits are used only inside INCLUDE_CDS, but they could be useful even when AOT/CDS is not used.
=======================
Proposal:
- Set these bits exactly once inside ClassFileParser::fill_instance_klass(), to avoid race conditions
- Set these flags even when AOT/CDS is not used -- the cost is trivial. That way, we don't need to worry if a code path might be invalid when AOT/CDS is disabled.
- Renamed the flags to the following
flag(defined_by_boot_loader , 1 << 7) /* defining class loader is boot class loader */ \
flag(defined_by_platform_loader , 1 << 8) /* defining class loader is platform class loader */ \
flag(defined_by_app_loader , 1 << 9) /* defining class loader is app class loader */ \
class InstanceKlassFlags {
#define IK_FLAGS_DO(flag) \
flag(is_shared_boot_class , 1 << 7) /* defining class loader is boot class loader */ \
flag(is_shared_platform_class , 1 << 8) /* defining class loader is platform class loader */ \
flag(is_shared_app_class , 1 << 9) /* defining class loader is app class loader */ \
However, there are several problems:
[1] The bits a mis-named. We assigned these bits even for classes that are loaded outside of the AOT cache. I.e., it's possible for this to be true:
!ik->is_shared() && is_shared_boot_class()
[2] These bits are assigned in multiple places, sometimes well after the class becomes visible, so there may be race conditions in reading these bits.
[3] These bits are used only inside INCLUDE_CDS, but they could be useful even when AOT/CDS is not used.
=======================
Proposal:
- Set these bits exactly once inside ClassFileParser::fill_instance_klass(), to avoid race conditions
- Set these flags even when AOT/CDS is not used -- the cost is trivial. That way, we don't need to worry if a code path might be invalid when AOT/CDS is disabled.
- Renamed the flags to the following
flag(defined_by_boot_loader , 1 << 7) /* defining class loader is boot class loader */ \
flag(defined_by_platform_loader , 1 << 8) /* defining class loader is platform class loader */ \
flag(defined_by_app_loader , 1 << 9) /* defining class loader is app class loader */ \
- blocks
-
JDK-8355236 AOT Assembly crash with unregistered class and -Xlog:cds+resolve=trace
-
- Resolved
-
- links to
-
Commit(master) openjdk/jdk/3bebb1fa
-
Review(master) openjdk/jdk/25365