# HG changeset patch # User kvn # Date 1532112905 25200 # Node ID 416a76fe806783c04a272af5d6f6cb838bc86007 # Parent ae39ec0b050251934240936dfb0a9c16bfb8836f 8206075: On x86, assert on unbound assembler Labels used as branch targets Reviewed-by: kvn, mdoerr, phh Contributed-by: xxinliu@amazon.com diff -r ae39ec0b0502 -r 416a76fe8067 src/hotspot/cpu/x86/interp_masm_x86.cpp --- 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() { diff -r ae39ec0b0502 -r 416a76fe8067 src/hotspot/cpu/x86/templateTable_x86.cpp --- 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())); diff -r ae39ec0b0502 -r 416a76fe8067 src/hotspot/share/asm/assembler.hpp --- 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 diff -r ae39ec0b0502 -r 416a76fe8067 src/hotspot/share/c1/c1_LIRAssembler.hpp --- 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