OpenJDK / jdk / jdk
changeset 51178:416a76fe8067
8206075: On x86, assert on unbound assembler Labels used as branch targets
Reviewed-by: kvn, mdoerr, phh
Contributed-by: xxinliu@amazon.com
author | kvn |
---|---|
date | Fri, 20 Jul 2018 11:55:05 -0700 |
parents | ae39ec0b0502 |
children | 516acf6956a2 |
files | src/hotspot/cpu/x86/interp_masm_x86.cpp src/hotspot/cpu/x86/templateTable_x86.cpp src/hotspot/share/asm/assembler.hpp src/hotspot/share/c1/c1_LIRAssembler.hpp |
diffstat | 4 files changed, 20 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/cpu/x86/interp_masm_x86.cpp Wed Jul 18 00:23:06 2018 -0700 +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp Fri Jul 20 11:55:05 2018 -0700 @@ -1963,7 +1963,9 @@ incrementl(scratch, increment); movl(counter_addr, scratch); andl(scratch, mask); - jcc(cond, *where); + if (where != NULL) { + jcc(cond, *where); + } } void InterpreterMacroAssembler::notify_method_entry() {
--- a/src/hotspot/cpu/x86/templateTable_x86.cpp Wed Jul 18 00:23:06 2018 -0700 +++ b/src/hotspot/cpu/x86/templateTable_x86.cpp Fri Jul 20 11:55:05 2018 -0700 @@ -2227,8 +2227,8 @@ const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) + in_bytes(InvocationCounter::counter_offset())); const Address mask(rbx, in_bytes(MethodData::backedge_mask_offset())); - __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, - rax, false, Assembler::zero, &backedge_counter_overflow); + __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, rax, false, Assembler::zero, + UseOnStackReplacement ? &backedge_counter_overflow : NULL); __ jmp(dispatch); } __ bind(no_mdo); @@ -2236,7 +2236,8 @@ __ movptr(rcx, Address(rcx, Method::method_counters_offset())); const Address mask(rcx, in_bytes(MethodCounters::backedge_mask_offset())); __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask, - rax, false, Assembler::zero, &backedge_counter_overflow); + rax, false, Assembler::zero, + UseOnStackReplacement ? &backedge_counter_overflow : NULL); } else { // not TieredCompilation // increment counter __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
--- a/src/hotspot/share/asm/assembler.hpp Wed Jul 18 00:23:06 2018 -0700 +++ b/src/hotspot/share/asm/assembler.hpp Fri Jul 20 11:55:05 2018 -0700 @@ -159,6 +159,14 @@ Label() { init(); } + + ~Label() { + assert(is_bound() || is_unused(), "Label was never bound to a location, but it was used as a jmp target"); + } + + void reset() { + init(); //leave _patch_overflow because it points to CodeBuffer. + } }; // A NearLabel must be bound to a location near its users. Users can
--- a/src/hotspot/share/c1/c1_LIRAssembler.hpp Wed Jul 18 00:23:06 2018 -0700 +++ b/src/hotspot/share/c1/c1_LIRAssembler.hpp Fri Jul 20 11:55:05 2018 -0700 @@ -71,7 +71,11 @@ void record_non_safepoint_debug_info(); // unified bailout support - void bailout(const char* msg) const { compilation()->bailout(msg); } + void bailout(const char* msg) { + // reset the label in case it hits assertion in destructor. + _unwind_handler_entry.reset(); + compilation()->bailout(msg); + } bool bailed_out() const { return compilation()->bailed_out(); } // code emission patterns and accessors