--- old/src/hotspot/cpu/x86/interp_masm_x86.cpp 2018-07-20 11:33:56.000000000 -0700 +++ new/src/hotspot/cpu/x86/interp_masm_x86.cpp 2018-07-20 11:33:56.000000000 -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() { --- old/src/hotspot/cpu/x86/templateTable_x86.cpp 2018-07-20 11:33:58.000000000 -0700 +++ new/src/hotspot/cpu/x86/templateTable_x86.cpp 2018-07-20 11:33:57.000000000 -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())); --- old/src/hotspot/share/asm/assembler.hpp 2018-07-20 11:33:59.000000000 -0700 +++ new/src/hotspot/share/asm/assembler.hpp 2018-07-20 11:33:59.000000000 -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 --- old/src/hotspot/share/c1/c1_LIRAssembler.hpp 2018-07-20 11:34:00.000000000 -0700 +++ new/src/hotspot/share/c1/c1_LIRAssembler.hpp 2018-07-20 11:34:00.000000000 -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