--- old/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp 2019-09-30 11:40:15.760992230 +0000 +++ new/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp 2019-09-30 11:40:15.196972118 +0000 @@ -371,6 +371,7 @@ nop(); } + nop(); // build frame // verify_FPU(0, "method_entry"); } @@ -388,6 +389,7 @@ nop(); } + nop(); // verify_FPU(0, "method_entry"); assert(ValueTypePassFieldsAsArgs, "sanity"); --- old/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp 2019-09-30 11:40:17.201043578 +0000 +++ new/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp 2019-09-30 11:40:16.637023467 +0000 @@ -3693,7 +3693,7 @@ ldr(holder, Address(holder, ConstantPool::pool_holder_offset_in_bytes())); // InstanceKlass* } -void MacroAssembler::load_klass(Register dst, Register src) { +void MacroAssembler::load_metadata(Register dst, Register src) { if (UseCompressedClassPointers) { ldrw(dst, Address(src, oopDesc::klass_offset_in_bytes())); } else { @@ -5912,10 +5912,6 @@ build_frame(framesize); - if (NotifySimulator) { - notify(Assembler::method_entry); - } - if (VerifyStackAtCalls) { Unimplemented(); } --- old/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp 2019-09-30 11:40:19.057109759 +0000 +++ new/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp 2019-09-30 11:40:18.397086225 +0000 @@ -576,7 +576,7 @@ __ mov(c_rarg2, (int64_t)alloc_value_receiver); __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::allocate_value_types))); - __ blrt(rscratch1, 3, 0, 1); + __ blr(rscratch1); oop_maps->add_gc_map((int)(__ pc() - start), map); __ reset_last_Java_frame(false); @@ -885,19 +885,7 @@ __ br(rscratch1); } -// --------------------------------------------------------------- -AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm, - int total_args_passed, - int comp_args_on_stack, - const BasicType *sig_bt, - const VMRegPair *regs, - AdapterFingerPrint* fingerprint) { - address i2c_entry = __ pc(); - - gen_i2c_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs); - - address c2i_unverified_entry = __ pc(); - Label skip_fixup; +static void gen_inline_cache_check(MacroAssembler *masm, Label& skip_fixup) { Label ok; @@ -919,7 +907,7 @@ __ load_klass(rscratch1, receiver); __ ldr(tmp, Address(holder, CompiledICHolder::holder_klass_offset())); __ cmp(rscratch1, tmp); - __ ldr(rmethod, Address(holder, CompiledICHolder::holder_metadata_offset())); + __ ldr(rmethod, Address(holder, CompiledICHolder::holder_metadata_offset())); __ br(Assembler::EQ, ok); __ far_jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub())); @@ -927,13 +915,14 @@ // Method might have been compiled since the call site was patched to // interpreted; if that is the case treat it as a miss so we can get // the call site corrected. - __ ldr(rscratch1, Address(rmethod, in_bytes(Method::code_offset()))); + __ ldr(rscratch1, Address(rmethod, in_bytes(Method::code_offset()))); __ cbz(rscratch1, skip_fixup); __ far_jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub())); __ block_comment("} c2i_unverified_entry"); } } + // --------------------------------------------------------------- AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm, int comp_args_on_stack, @@ -952,7 +941,6 @@ address c2i_unverified_entry = __ pc(); Label skip_fixup; - gen_inline_cache_check(masm, skip_fixup); OopMapSet* oop_maps = new OopMapSet(); @@ -970,9 +958,32 @@ // Scalarized c2i adapter address c2i_entry = __ pc(); - // Not implemented - // BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); - // bs->c2i_entry_barrier(masm); + // Class initialization barrier for static methods + address c2i_no_clinit_check_entry = NULL; + + if (VM_Version::supports_fast_class_init_checks()) { + Label L_skip_barrier; + { // Bypass the barrier for non-static methods + Register flags = rscratch1; + __ ldrw(flags, Address(rmethod, Method::access_flags_offset())); + __ tst(flags, JVM_ACC_STATIC); + __ br(Assembler::NE, L_skip_barrier); // non-static + } + + Register klass = rscratch1; + __ load_method_holder(klass, rmethod); + // We pass rthread to this function on x86 + __ clinit_barrier(klass, rscratch2, &L_skip_barrier /*L_fast_path*/); + + __ far_jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub())); // slow path + + __ bind(L_skip_barrier); + c2i_no_clinit_check_entry = __ pc(); + } + +// FIXME: Not Implemented +// BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); +// bs->c2i_entry_barrier(masm); gen_c2i_adapter(masm, sig_cc, regs_cc, skip_fixup, i2c_entry, oop_maps, frame_complete, frame_size_in_words, true); @@ -990,10 +1001,6 @@ gen_c2i_adapter(masm, sig, regs, value_entry_skip_fixup, i2c_entry, oop_maps, frame_complete, frame_size_in_words, false); } - // TODO fix this - // Class initialization barrier for static methods - address c2i_no_clinit_check_entry = NULL; - __ flush(); // The c2i adapter might safepoint and trigger a GC. The caller must make sure that --- old/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp 2019-09-30 11:40:20.621165528 +0000 +++ new/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp 2019-09-30 11:40:20.061145560 +0000 @@ -5797,7 +5797,7 @@ BLOCK_COMMENT("call runtime_entry"); __ mov(rscratch1, destination); - __ blrt(rscratch1, 2 /* number_of_arguments */, 0, 1); + __ blr(rscratch1); oop_maps->add_gc_map(the_pc - start, map);