diff --git a/src/cpu/x86/vm/interp_masm_x86_32.cpp b/src/cpu/x86/vm/interp_masm_x86_32.cpp index 8a132c12fcaf33a9f01a316714bdecd6774193f1..84cdc94dd19b1f9b4a77b9c265f7015ec972dfc3 100644 --- a/src/cpu/x86/vm/interp_masm_x86_32.cpp +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1445,5 +1445,7 @@ void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, incrementl(scratch, increment); movl(counter_addr, scratch); andl(scratch, mask); - jcc(cond, *where); + if (where != NULL) { + jcc(cond, *where); + } } diff --git a/src/cpu/x86/vm/interp_masm_x86_64.cpp b/src/cpu/x86/vm/interp_masm_x86_64.cpp index 693ac795815bf7891f071b51ad61f3dbdc5916d5..727207ec13ea9cfddf3e7d24c8017af5cf3b6707 100644 --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1505,5 +1505,7 @@ void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr, incrementl(scratch, increment); movl(counter_addr, scratch); andl(scratch, mask); - jcc(cond, *where); + if (where != NULL) { + jcc(cond, *where); + } } diff --git a/src/cpu/x86/vm/templateTable_x86_32.cpp b/src/cpu/x86/vm/templateTable_x86_32.cpp index df497868b6f99f93767b013ab065f20b974ded89..5d33addcc432f82a7e2fe33af117ddc08944be80 100644 --- a/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1640,15 +1640,16 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { // Increment the MDO backedge counter const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) + in_bytes(InvocationCounter::counter_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); // Increment backedge counter in MethodCounters* __ movptr(rcx, Address(rcx, Method::method_counters_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 { // increment counter __ movptr(rcx, Address(rcx, Method::method_counters_offset())); diff --git a/src/cpu/x86/vm/templateTable_x86_64.cpp b/src/cpu/x86/vm/templateTable_x86_64.cpp index 301acb440212a1e1b0778c3ace91628395e41336..a619f44d66cdaec61b463352c3c039b7b11dc083 100644 --- a/src/cpu/x86/vm/templateTable_x86_64.cpp +++ b/src/cpu/x86/vm/templateTable_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1665,15 +1665,16 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { // Increment the MDO backedge counter const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) + in_bytes(InvocationCounter::counter_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); // Increment backedge counter in MethodCounters* __ movptr(rcx, Address(rcx, Method::method_counters_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 { // increment counter __ movptr(rcx, Address(rcx, Method::method_counters_offset())); diff --git a/src/share/vm/asm/assembler.hpp b/src/share/vm/asm/assembler.hpp index ec8ec5eb435f9e38b0e60b78ee7f4930167d24c6..ac39e6ac4e2ccbb35b25fb64d0d0fa82a3d408b5 100644 --- a/src/share/vm/asm/assembler.hpp +++ b/src/share/vm/asm/assembler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -169,6 +169,14 @@ class Label VALUE_OBJ_CLASS_SPEC { 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 union type for code which has to assemble both constant and diff --git a/src/share/vm/c1/c1_LIRAssembler.cpp b/src/share/vm/c1/c1_LIRAssembler.cpp index 3447e0703e292a905e2660ecbee70221b2f586bb..a2cf5f26996f595199a82b94e58305f4caeb315c 100644 --- a/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/src/share/vm/c1/c1_LIRAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -128,6 +128,9 @@ LIR_Assembler::LIR_Assembler(Compilation* c): LIR_Assembler::~LIR_Assembler() { + // The unwind handler label may be unbound if this destructor is invoked because of a bail-out. + // Reset it here to avoid an assertion. + _unwind_handler_entry.reset(); }