Skip to content

Commit 301de8d

Browse files
nick-armTobiHartmann
authored andcommittedApr 15, 2021
8265184: [lworld] [AArch64] Broken fast class init barrier for static calls in c2i adapter
Reviewed-by: thartmann
1 parent 2e6c276 commit 301de8d

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed
 

‎src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

+7-11
Original file line numberDiff line numberDiff line change
@@ -988,22 +988,18 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
988988

989989
// Class initialization barrier for static methods
990990
address c2i_no_clinit_check_entry = NULL;
991-
992991
if (VM_Version::supports_fast_class_init_checks()) {
993992
Label L_skip_barrier;
993+
994994
{ // Bypass the barrier for non-static methods
995-
Register flags = rscratch1;
996-
__ ldrw(flags, Address(rmethod, Method::access_flags_offset()));
997-
__ tst(flags, JVM_ACC_STATIC);
998-
__ br(Assembler::NE, L_skip_barrier); // non-static
995+
__ ldrw(rscratch1, Address(rmethod, Method::access_flags_offset()));
996+
__ andsw(zr, rscratch1, JVM_ACC_STATIC);
997+
__ br(Assembler::EQ, L_skip_barrier); // non-static
999998
}
1000999

1001-
Register klass = rscratch1;
1002-
__ load_method_holder(klass, rmethod);
1003-
// We pass rthread to this function on x86
1004-
__ clinit_barrier(klass, rscratch2, &L_skip_barrier /*L_fast_path*/);
1005-
1006-
__ far_jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path
1000+
__ load_method_holder(rscratch2, rmethod);
1001+
__ clinit_barrier(rscratch2, rscratch1, &L_skip_barrier);
1002+
__ far_jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub()));
10071003

10081004
__ bind(L_skip_barrier);
10091005
c2i_no_clinit_check_entry = __ pc();

0 commit comments

Comments
 (0)