JDK-8306474 : Move InstanceKlass read-only flags
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 21
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-04-19
  • Updated: 2023-04-27
  • Resolved: 2023-04-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21 b20Fixed
Description
Move the three read-only InstanceKlass flags that don't require access through generated or compiler generated code.

    JVM_ACC_HAS_MIRANDA_METHODS     = 0x10000000,     // True if this class has miranda methods in it's vtable
    JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000,     // True if klass has a vanilla default constructor
    JVM_ACC_HAS_FINAL_METHOD        = 0x01000000,     // True if klass has final method

These are set during class file parsing.
Comments
These 4 access lags are used by generated code in the compilers and interpreters. // Klass* flags JVM_ACC_HAS_FINALIZER = 0x40000000, // True if klass has a non-empty finalize() method JVM_ACC_IS_CLONEABLE_FAST = (int)0x80000000,// True if klass implements the Cloneable interface and can be optimized in generated code JVM_ACC_IS_HIDDEN_CLASS = 0x04000000, // True if klass is hidden JVM_ACC_IS_VALUE_BASED_CLASS = 0x08000000, // True if klass is marked as a ValueBased class For the HAS_FINALIZER flag for instance: __ load_klass(rdi, robj, rscratch1); __ movl(rdi, Address(rdi, Klass::access_flags_offset())); __ testl(rdi, JVM_ACC_HAS_FINALIZER); Label skip_register_finalizer; __ jcc(Assembler::zero, skip_register_finalizer); __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), robj); It could be moved to InstanceKlassFlags::flags_offset(), and assume that load_klass will return an InstanceKlass in this case and not a Klass. Asserting from assembly code is awkward though. IS_VALUE_BASED_CLASS also follows the same pattern. HAS_FINALIZER, IS_CLONEABLE_FAST and IS_HIDDEN_CLASS are used by generated code for InstanceKlass in c2 code. These are bigger changes so not included with this RFE.
20-04-2023

Changeset: f6336231 Author: Coleen Phillimore <coleenp@openjdk.org> Date: 2023-04-20 19:20:03 +0000 URL: https://git.openjdk.org/jdk/commit/f63362310e17ba5c3e415ef3c5bd5f9bd65fd67c
20-04-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/13545 Date: 2023-04-19 22:46:55 +0000
19-04-2023