RFR: 8369296: Add fast class init checks in interpreter for resolving ConstantPool entries for static field [v4]
Ashutosh Mehra
asmehra at openjdk.org
Thu Oct 9 15:30:56 UTC 2025
On Thu, 9 Oct 2025 14:48:24 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:
>>> @TheRealMDoerr with your patch `isync` is bypassed after `InterpreterRuntime::resolve_from_cache` call. Is it intentional?
>>
>> Thanks for pointing this out. It is ok because the same thread has performed the resolution. So, no need for a memory barrier in this case because we didn't read values written by another thread.
>> And even if another thread has done it, we already have enough memory barriers because `resolve_from_cache` contains a thread state switch (at least for PPC64 which uses lwsync).
>
>> @TheRealMDoerr thanks for the patch. In my last commit I have updated the code to move the fast clinit check before the call to `resolve_from_cache`. I felt this simplifies the flow of logic and makes it easier to read. @iwanowww what do you think about this?
>
> That looks better. However, seems like for forgot a small detail (PPC64 example):
>
> diff --git a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
> index 14fdbfe0884..8657356de4a 100644
> --- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
> +++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
> @@ -2203,6 +2203,8 @@ void TemplateTable::resolve_cache_and_index_for_method(int byte_no, Register Rca
> __ ld(method, in_bytes(ResolvedMethodEntry::method_offset()), Rcache);
> __ load_method_holder(klass, method);
> __ clinit_barrier(klass, R16_thread, &Ldone, /*L_slow_path*/ nullptr);
> + } else {
> + __ b(Ldone);
> }
>
> // Class initialization barrier slow path lands here as well.
> @@ -2247,6 +2249,8 @@ void TemplateTable::resolve_cache_and_index_for_field(int byte_no, Register Rcac
> // (ordered by compare-branch-isync).
> __ ld(field_holder, ResolvedFieldEntry::field_holder_offset(), Rcache);
> __ clinit_barrier(field_holder, R16_thread, &Ldone, /*L_slow_path*/ nullptr);
> + } else {
> + __ b(Ldone);
> }
>
> // resolve first time through
I pushed the commit to add the missing jump as suggested by @TheRealMDoerr but strangely it is not reflecting in the PR. I can see the commit in my branch here https://github.com/openjdk/jdk/compare/master...ashu-mehra:jdk:fast-clinit-barrier-static-fields. Something amiss here.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27676#issuecomment-3386278179
More information about the hotspot-dev
mailing list