diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp index 5fea0b8d925..ca359fea9da 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp @@ -1418,8 +1418,7 @@ void InterpreterMacroAssembler::notify_method_entry() { bind(L); } - { - SkipIfEqual skip(this, &DTraceMethodProbes, false); + if (DTraceMethodProbes) { get_method(c_rarg1); call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), rthread, c_rarg1); @@ -1458,8 +1457,7 @@ void InterpreterMacroAssembler::notify_method_exit( pop(state); } - { - SkipIfEqual skip(this, &DTraceMethodProbes, false); + if (DTraceMethodProbes) { push(state); get_method(c_rarg1); call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), diff --git a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp index a2600825622..bb2554e65ce 100644 --- a/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp @@ -1754,11 +1754,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, __ set_last_Java_frame(sp, noreg, native_return, rscratch1); Label dtrace_method_entry, dtrace_method_entry_done; - { - uint64_t offset; - __ adrp(rscratch1, ExternalAddress((address)&DTraceMethodProbes), offset); - __ ldrb(rscratch1, Address(rscratch1, offset)); - __ cbnzw(rscratch1, dtrace_method_entry); + if (DTraceMethodProbes) { + __ b(dtrace_method_entry); __ bind(dtrace_method_entry_done); } @@ -1990,11 +1987,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, } Label dtrace_method_exit, dtrace_method_exit_done; - { - uint64_t offset; - __ adrp(rscratch1, ExternalAddress((address)&DTraceMethodProbes), offset); - __ ldrb(rscratch1, Address(rscratch1, offset)); - __ cbnzw(rscratch1, dtrace_method_exit); + if (DTraceMethodProbes) { + __ b(dtrace_method_exit); __ bind(dtrace_method_exit_done); } @@ -2138,37 +2132,38 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, } // SLOW PATH dtrace support - { - __ block_comment("dtrace entry {"); - __ bind(dtrace_method_entry); + if (DTraceMethodProbes) { + { + __ block_comment("dtrace entry {"); + __ bind(dtrace_method_entry); - // We have all of the arguments setup at this point. We must not touch any register - // argument registers at this point (what if we save/restore them there are no oop? + // We have all of the arguments setup at this point. We must not touch any register + // argument registers at this point (what if we save/restore them there are no oop? - save_args(masm, total_c_args, c_arg, out_regs); - __ mov_metadata(c_rarg1, method()); - __ call_VM_leaf( - CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), - rthread, c_rarg1); - restore_args(masm, total_c_args, c_arg, out_regs); - __ b(dtrace_method_entry_done); - __ block_comment("} dtrace entry"); + save_args(masm, total_c_args, c_arg, out_regs); + __ mov_metadata(c_rarg1, method()); + __ call_VM_leaf( + CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), + rthread, c_rarg1); + restore_args(masm, total_c_args, c_arg, out_regs); + __ b(dtrace_method_entry_done); + __ block_comment("} dtrace entry"); + } + + { + __ block_comment("dtrace exit {"); + __ bind(dtrace_method_exit); + save_native_result(masm, ret_type, stack_slots); + __ mov_metadata(c_rarg1, method()); + __ call_VM_leaf( + CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), + rthread, c_rarg1); + restore_native_result(masm, ret_type, stack_slots); + __ b(dtrace_method_exit_done); + __ block_comment("} dtrace exit"); + } } - { - __ block_comment("dtrace exit {"); - __ bind(dtrace_method_exit); - save_native_result(masm, ret_type, stack_slots); - __ mov_metadata(c_rarg1, method()); - __ call_VM_leaf( - CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), - rthread, c_rarg1); - restore_native_result(masm, ret_type, stack_slots); - __ b(dtrace_method_exit_done); - __ block_comment("} dtrace exit"); - } - - __ flush(); nmethod *nm = nmethod::new_native_nmethod(method, diff --git a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp index f32a4ee7372..f7cf9938157 100644 --- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp @@ -3648,8 +3648,7 @@ void TemplateTable::_new() { __ store_klass_gap(r0, zr); // zero klass gap for compressed oops __ store_klass(r0, r4); // store klass last - { - SkipIfEqual skip(_masm, &DTraceAllocProbes, false); + if (DTraceAllocProbes) { // Trigger dtrace event for fastpath __ push(atos); // save the return value __ call_VM_leaf( diff --git a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp index 770b2bfa68f..0ee9348dde8 100644 --- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp @@ -3859,10 +3859,11 @@ void TemplateTable::_new() { __ store_klass(RallocatedObject, RinstanceKlass, Rscratch); // klass (last for cms) // Check and trigger dtrace event. - SkipIfEqualZero::skip_to_label_if_equal_zero(_masm, Rscratch, &DTraceAllocProbes, Ldone); - __ push(atos); - __ call_VM_leaf(CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc))); - __ pop(atos); + if (DTraceAllocProbes) { + __ push(atos); + __ call_VM_leaf(CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc))); + __ pop(atos); + } __ b(Ldone); } diff --git a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp index c5f97b60c42..af6d043d1d6 100644 --- a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp +++ b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp @@ -1467,8 +1467,7 @@ void InterpreterMacroAssembler::notify_method_entry() { bind(L); } - { - SkipIfEqual skip(this, &DTraceMethodProbes, false); + if (DTraceMethodProbes) { get_method(c_rarg1); call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), xthread, c_rarg1); @@ -1506,8 +1505,7 @@ void InterpreterMacroAssembler::notify_method_exit( pop(state); } - { - SkipIfEqual skip(this, &DTraceMethodProbes, false); + if (DTraceMethodProbes) { push(state); get_method(c_rarg1); call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), diff --git a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp index 9e6c8ce2e5e..3af203a95b0 100644 --- a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp +++ b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp @@ -1638,14 +1638,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, __ set_last_Java_frame(sp, noreg, native_return, t0); Label dtrace_method_entry, dtrace_method_entry_done; - { - ExternalAddress target((address)&DTraceMethodProbes); - __ relocate(target.rspec(), [&] { - int32_t offset; - __ la(t0, target.target(), offset); - __ lbu(t0, Address(t0, offset)); - }); - __ bnez(t0, dtrace_method_entry); + if (DTraceMethodProbes) { + __ j(dtrace_method_entry); __ bind(dtrace_method_entry_done); } @@ -1861,14 +1855,8 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, } Label dtrace_method_exit, dtrace_method_exit_done; - { - ExternalAddress target((address)&DTraceMethodProbes); - __ relocate(target.rspec(), [&] { - int32_t offset; - __ la(t0, target.target(), offset); - __ lbu(t0, Address(t0, offset)); - }); - __ bnez(t0, dtrace_method_exit); + if (DTraceMethodProbes) { + __ j(dtrace_method_exit); __ bind(dtrace_method_exit_done); } @@ -2009,34 +1997,36 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, } // SLOW PATH dtrace support - { - __ block_comment("dtrace entry {"); - __ bind(dtrace_method_entry); + if (DTraceMethodProbes) { + { + __ block_comment("dtrace entry {"); + __ bind(dtrace_method_entry); - // We have all of the arguments setup at this point. We must not touch any register - // argument registers at this point (what if we save/restore them there are no oop? + // We have all of the arguments setup at this point. We must not touch any register + // argument registers at this point (what if we save/restore them there are no oop? - save_args(masm, total_c_args, c_arg, out_regs); - __ mov_metadata(c_rarg1, method()); - __ call_VM_leaf( - CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), - xthread, c_rarg1); - restore_args(masm, total_c_args, c_arg, out_regs); - __ j(dtrace_method_entry_done); - __ block_comment("} dtrace entry"); - } + save_args(masm, total_c_args, c_arg, out_regs); + __ mov_metadata(c_rarg1, method()); + __ call_VM_leaf( + CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), + xthread, c_rarg1); + restore_args(masm, total_c_args, c_arg, out_regs); + __ j(dtrace_method_entry_done); + __ block_comment("} dtrace entry"); + } - { - __ block_comment("dtrace exit {"); - __ bind(dtrace_method_exit); - save_native_result(masm, ret_type, stack_slots); - __ mov_metadata(c_rarg1, method()); - __ call_VM_leaf( - CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), - xthread, c_rarg1); - restore_native_result(masm, ret_type, stack_slots); - __ j(dtrace_method_exit_done); - __ block_comment("} dtrace exit"); + { + __ block_comment("dtrace exit {"); + __ bind(dtrace_method_exit); + save_native_result(masm, ret_type, stack_slots); + __ mov_metadata(c_rarg1, method()); + __ call_VM_leaf( + CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), + xthread, c_rarg1); + restore_native_result(masm, ret_type, stack_slots); + __ j(dtrace_method_exit_done); + __ block_comment("} dtrace exit"); + } } __ flush(); diff --git a/src/hotspot/cpu/riscv/templateTable_riscv.cpp b/src/hotspot/cpu/riscv/templateTable_riscv.cpp index 5c72ddc9f81..fa542343949 100644 --- a/src/hotspot/cpu/riscv/templateTable_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateTable_riscv.cpp @@ -3592,8 +3592,7 @@ void TemplateTable::_new() { __ store_klass_gap(x10, zr); // zero klass gap for compressed oops __ store_klass(x10, x14); // store klass last - { - SkipIfEqual skip(_masm, &DTraceAllocProbes, false); + if (DTraceAllocProbes) { // Trigger dtrace event for fastpath __ push(atos); // save the return value __ call_VM_leaf(CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), x10); diff --git a/src/hotspot/cpu/s390/templateTable_s390.cpp b/src/hotspot/cpu/s390/templateTable_s390.cpp index 02b9405ad31..ef68a5ac83a 100644 --- a/src/hotspot/cpu/s390/templateTable_s390.cpp +++ b/src/hotspot/cpu/s390/templateTable_s390.cpp @@ -3976,8 +3976,7 @@ void TemplateTable::_new() { __ store_klass_gap(Rzero, RallocatedObject); // Zero klass gap for compressed oops. __ store_klass(iklass, RallocatedObject); // Store klass last. - { - SkipIfEqual skip(_masm, &DTraceAllocProbes, false, Z_ARG5 /*scratch*/); + if (DTraceAllocProbes) { // Trigger dtrace event for fastpath. __ push(atos); // Save the return value. __ call_VM_leaf(CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), RallocatedObject); diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index 4329b0b6411..57d77bafd4b 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -1955,8 +1955,7 @@ void InterpreterMacroAssembler::notify_method_entry() { bind(L); } - { - SkipIfEqual skip(this, &DTraceMethodProbes, false, rscratch1); + if (DTraceMethodProbes) { NOT_LP64(get_thread(rthread);) get_method(rarg); call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), @@ -2000,8 +1999,7 @@ void InterpreterMacroAssembler::notify_method_exit( pop(state); } - { - SkipIfEqual skip(this, &DTraceMethodProbes, false, rscratch1); + if (DTraceMethodProbes) { push(state); NOT_LP64(get_thread(rthread);) get_method(rarg); diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp index 79a573763dc..6303c279195 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_32.cpp @@ -1612,8 +1612,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // We have all of the arguments setup at this point. We must not touch any register // argument registers at this point (what if we save/restore them there are no oop? - { - SkipIfEqual skip_if(masm, &DTraceMethodProbes, 0, noreg); + if (DTraceMethodProbes) { __ mov_metadata(rax, method()); __ call_VM_leaf( CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), @@ -1857,8 +1856,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, __ bind(fast_done); } - { - SkipIfEqual skip_if(masm, &DTraceMethodProbes, 0, noreg); + if (DTraceMethodProbes) { // Tell dtrace about this method exit save_native_result(masm, ret_type, stack_slots); __ mov_metadata(rax, method()); diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index 4029e486c9c..decaa9d1ee9 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -2200,8 +2200,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // We have all of the arguments setup at this point. We must not touch any register // argument registers at this point (what if we save/restore them there are no oop? - { - SkipIfEqual skip(masm, &DTraceMethodProbes, false, rscratch1); + if (DTraceMethodProbes) { // protect the args we've loaded save_args(masm, total_c_args, c_arg, out_regs); __ mov_metadata(c_rarg1, method()); @@ -2439,8 +2438,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, __ bind(fast_done); } - { - SkipIfEqual skip(masm, &DTraceMethodProbes, false, rscratch1); + if (DTraceMethodProbes) { save_native_result(masm, ret_type, stack_slots); __ mov_metadata(c_rarg1, method()); __ call_VM_leaf( diff --git a/src/hotspot/cpu/x86/templateTable_x86.cpp b/src/hotspot/cpu/x86/templateTable_x86.cpp index 248055337d8..6446ec65987 100644 --- a/src/hotspot/cpu/x86/templateTable_x86.cpp +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp @@ -4123,8 +4123,7 @@ void TemplateTable::_new() { #endif __ store_klass(rax, rcx, rscratch1); // klass - { - SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0, rscratch1); + if (DTraceAllocProbes) { // Trigger dtrace event for fastpath __ push(atos); __ call_VM_leaf(