RFR: 8320276: Improve class initialization barrier in TemplateTable::_new [v2]
David Holmes
dholmes at openjdk.org
Thu Dec 21 02:54:48 UTC 2023
On Wed, 20 Dec 2023 19:53:10 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:
>> The class initialization barrier in TemplateTable::_new fast path check ensures that the class being instantiated is fully initialized. It can be improved by introducing additional fast path check when current thread is initializer thread as MacroAssembler::clinit_barrier() does. It avoids repeated calls into interpreter runtime for classes being initialized. This patch adds a the optimization for x86 and aarch64. Verified with tier 1-5 tests.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
>
> David comments
The code itself seems fine. But I don't see any supporting evidence of how this optimisation performs. IIUC the only case it benefits is when a static initializer creates an instance of the class being initialized - how typical is that?
The definitions of `supports_fast_class_init_checks` all have the comment:
// ... supports fast class initialization checks for static methods.
which needs updating now it is not just for static methods. (Actually the comments became out-dated with [JDK-8223216](https://bugs.openjdk.org/browse/JDK-8223216) but it would be nice to fix them all.)
Would be nice to see this applied across all platforms too - or at least those that support fast_class_init - ppc and s390. Perhaps file follow-up RFE's for those platforms so this is not forgotten. I note that RISCV64 doesn't support fast_class_init at all yet.
Thanks
-------------
Changes requested by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/17006#pullrequestreview-1792072903
More information about the hotspot-dev
mailing list