RFR: 8320276: Improve class initialization barrier in TemplateTable::_new

David Holmes dholmes at openjdk.org
Wed Dec 20 03:04:38 UTC 2023


On Wed, 6 Dec 2023 22:02:19 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.

src/hotspot/cpu/x86/templateTable_x86.cpp line 4052:

> 4050: 
> 4051:   // make sure klass is initialized
> 4052:   if (VM_Version::supports_fast_class_init_checks()) {

Maybe this should use conditional compilation and an assert rather than a dynamic runtime check, as we expect this to always, and only, be true on 64-bit.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17006#discussion_r1432197640


More information about the hotspot-dev mailing list