From a1d65eb6d87ff9019a9a92a775213be2a8b60fd1 Mon Sep 17 00:00:00 2001 From: Gui Cao Date: Tue, 30 Jan 2024 02:07:20 +0000 Subject: [PATCH] 8324125: Improve class initialization barrier in TemplateTable::_new for RISC-V Reviewed-by: fyang, rehn --- src/hotspot/cpu/riscv/templateTable_riscv.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hotspot/cpu/riscv/templateTable_riscv.cpp b/src/hotspot/cpu/riscv/templateTable_riscv.cpp index 73b4d1e28cc..58f57f32b2f 100644 --- a/src/hotspot/cpu/riscv/templateTable_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateTable_riscv.cpp @@ -3547,11 +3547,10 @@ void TemplateTable::_new() { // get InstanceKlass __ load_resolved_klass_at_offset(x14, x13, x14, t0); - // make sure klass is initialized & doesn't have finalizer - // make sure klass is fully initialized - __ lbu(t0, Address(x14, InstanceKlass::init_state_offset())); - __ sub(t1, t0, (u1)InstanceKlass::fully_initialized); - __ bnez(t1, slow_case); + // make sure klass is initialized + assert(VM_Version::supports_fast_class_init_checks(), + "Optimization requires support for fast class initialization checks"); + __ clinit_barrier(x14, t0, nullptr /*L_fast_path*/, &slow_case); // get instance_size in InstanceKlass (scaled to a count of bytes) __ lwu(x13, Address(x14, Klass::layout_helper_offset()));