RFR: 8369296: Add fast class init checks in interpreter for resolving ConstantPool entries for static field [v6]

Vladimir Kozlov kvn at openjdk.org
Thu Oct 9 15:54:40 UTC 2025


On Thu, 9 Oct 2025 15:36:05 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:

>> This patch adds fast clinit barrier in the interpreter when resolving cp entry for a static field.
>> 
>> Testing: tested x86-64 by running `hotspot_runtime` group
>> Specifically, `runtime/clinit/ClassInitBarrier.java` fails if the block for adding `clinit_barrier` is commented out in `TemplateTable::resolve_cache_and_index_for_field`
>
> Ashutosh Mehra has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix missing branch
>   
>   Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp line 2296:

> 2294:   } else {
> 2295:     __ b(Ldone);
> 2296:   }

I don't like 2 branches for non-static case. I suggest to move first branch inside checks:


if (VM_Version::supports_fast_class_init_checks() && bytecode() == Bytecodes::_invokestatic) {
    __ br(Assembler::NE, Lclinit_barrier_slow);
    __ ldr(temp, Address(Rcache, in_bytes(ResolvedMethodEntry::method_offset())));
    __ load_method_holder(temp, temp);
    __ clinit_barrier(temp, rscratch1, &Ldone, /*L_slow_path*/ nullptr);
    __ bind(Lclinit_barrier_slow);
  } else {
    __ br(Assembler::EQ, Ldone);
  }

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp line 2348:

> 2346:   } else {
> 2347:     __ b(Ldone);
> 2348:   }

The same here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27676#discussion_r2417222617
PR Review Comment: https://git.openjdk.org/jdk/pull/27676#discussion_r2417223673


More information about the hotspot-dev mailing list