--- old/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp 2019-05-01 16:15:24.000000000 -0700 +++ new/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp 2019-05-01 16:15:24.000000000 -0700 @@ -970,6 +970,27 @@ address c2i_entry = __ pc(); + // Class initialization barrier for static methods + if (UseFastClassInitChecks) { + Label L_skip_barrier; + Register method = rbx; + + { // Bypass the barrier for non-static methods + Register flags = rscratch1; + __ movl(flags, Address(method, Method::access_flags_offset())); + __ testl(flags, JVM_ACC_STATIC); + __ jcc(Assembler::zero, L_skip_barrier); // non-static + } + + Register klass = rscratch1; + __ load_method_holder(klass, method); + __ clinit_barrier(klass, r15_thread, &L_skip_barrier /*L_fast_path*/); + + __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path + + __ bind(L_skip_barrier); + } + gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup); __ flush(); @@ -2137,6 +2158,17 @@ int vep_offset = ((intptr_t)__ pc()) - start; + if (UseFastClassInitChecks && method->needs_clinit_barrier()) { + Label L_skip_barrier; + Register klass = r10; + __ mov_metadata(klass, method->method_holder()); // InstanceKlass* + __ clinit_barrier(klass, r15_thread, &L_skip_barrier /*L_fast_path*/); + + __ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path + + __ bind(L_skip_barrier); + } + #ifdef COMPILER1 // For Object.hashCode, System.identityHashCode try to pull hashCode from object header if available. if ((InlineObjectHash && method->intrinsic_id() == vmIntrinsics::_hashCode) || (method->intrinsic_id() == vmIntrinsics::_identityHashCode)) {