RFR: 8357504: Refactor the assignment of loader bits in InstanceKlassFlags

Ioi Lam iklam at openjdk.org
Wed May 21 20:01:58 UTC 2025


These bits are renamed to


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 */ \


They are not set exactly once inside `ClassFileParser::fill_instance_klass()`, to avoid race conditions

Also, 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.

This RFE simplifies the bug fix in https://github.com/openjdk/jdk/pull/25171

For reviewers
- The first commit is strictly renaming. No functional changes
- The second commit moves the bit setting to `ClassFileParser::fill_instance_klass()`.

-------------

Commit messages:
 - assigned _defined_by_xxx_loader bits exactly once during class file parsing
 - Strict renaming of is_shared_boot_class, etc, to defined_by_boot_loader(), etc

Changes: https://git.openjdk.org/jdk/pull/25365/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25365&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8357504
  Stats: 139 lines in 25 files changed: 1 ins; 63 del; 75 mod
  Patch: https://git.openjdk.org/jdk/pull/25365.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25365/head:pull/25365

PR: https://git.openjdk.org/jdk/pull/25365


More information about the hotspot-dev mailing list