# HG changeset patch # User brutisso # Date 1410874248 0 # Node ID bdd2310490aa24e804c4fba092090e7e4ac9013f # Parent 33acb0c42664a065e79bd3a9201f273892723d6f# Parent c02ec279b062056abceb66e011bdb3a10200f1a1 Merge diff -r c02ec279b062 -r bdd2310490aa src/share/vm/code/relocInfo.cpp --- a/src/share/vm/code/relocInfo.cpp Tue Sep 16 14:27:40 2014 +0200 +++ b/src/share/vm/code/relocInfo.cpp Tue Sep 16 13:30:48 2014 +0000 @@ -877,11 +877,7 @@ void internal_word_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { address target = _target; if (target == NULL) { - if (addr_in_const()) { - target = new_addr_for(*(address*)addr(), src, dest); - } else { - target = new_addr_for(pd_get_address_from_code(), src, dest); - } + target = new_addr_for(this->target(), src, dest); } set_value(target); } @@ -890,7 +886,11 @@ address internal_word_Relocation::target() { address target = _target; if (target == NULL) { - target = pd_get_address_from_code(); + if (addr_in_const()) { + target = *(address*)addr(); + } else { + target = pd_get_address_from_code(); + } } return target; } diff -r c02ec279b062 -r bdd2310490aa src/share/vm/runtime/sharedRuntime.cpp --- a/src/share/vm/runtime/sharedRuntime.cpp Tue Sep 16 14:27:40 2014 +0200 +++ b/src/share/vm/runtime/sharedRuntime.cpp Tue Sep 16 13:30:48 2014 +0000 @@ -1209,10 +1209,7 @@ (!is_virtual && invoke_code == Bytecodes::_invokedynamic) || ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode"); - // We do not patch the call site if the caller nmethod has been made non-entrant. - if (!caller_nm->is_in_use()) { - return callee_method; - } + assert(caller_nm->is_alive(), "It should be alive"); #ifndef PRODUCT // tracing/debugging/statistics @@ -1282,13 +1279,11 @@ // Now that we are ready to patch if the Method* was redefined then // don't update call site and let the caller retry. - // Don't update call site if caller nmethod has been made non-entrant - // as it is a waste of time. // Don't update call site if callee nmethod was unloaded or deoptimized. // Don't update call site if callee nmethod was replaced by an other nmethod // which may happen when multiply alive nmethod (tiered compilation) // will be supported. - if (!callee_method->is_old() && caller_nm->is_in_use() && + if (!callee_method->is_old() && (callee_nm == NULL || callee_nm->is_in_use() && (callee_method->code() == callee_nm))) { #ifdef ASSERT // We must not try to patch to jump to an already unloaded method. @@ -1489,14 +1484,12 @@ // out of scope. JvmtiDynamicCodeEventCollector event_collector; - // Update inline cache to megamorphic. Skip update if caller has been - // made non-entrant or we are called from interpreted. + // Update inline cache to megamorphic. Skip update if we are called from interpreted. { MutexLocker ml_patch (CompiledIC_lock); RegisterMap reg_map(thread, false); frame caller_frame = thread->last_frame().sender(®_map); CodeBlob* cb = caller_frame.cb(); - if (cb->is_nmethod() && ((nmethod*)cb)->is_in_use()) { - // Not a non-entrant nmethod, so find inline_cache + if (cb->is_nmethod()) { CompiledIC* inline_cache = CompiledIC_before(((nmethod*)cb), caller_frame.pc()); bool should_be_mono = false; if (inline_cache->is_optimized()) { @@ -1639,19 +1632,13 @@ // resolve is only done once. MutexLocker ml(CompiledIC_lock); - // - // We do not patch the call site if the nmethod has been made non-entrant - // as it is a waste of time - // - if (caller_nm->is_in_use()) { - if (is_static_call) { - CompiledStaticCall* ssc= compiledStaticCall_at(call_addr); - ssc->set_to_clean(); - } else { - // compiled, dispatched call (which used to call an interpreted method) - CompiledIC* inline_cache = CompiledIC_at(caller_nm, call_addr); - inline_cache->set_to_clean(); - } + if (is_static_call) { + CompiledStaticCall* ssc= compiledStaticCall_at(call_addr); + ssc->set_to_clean(); + } else { + // compiled, dispatched call (which used to call an interpreted method) + CompiledIC* inline_cache = CompiledIC_at(caller_nm, call_addr); + inline_cache->set_to_clean(); } } diff -r c02ec279b062 -r bdd2310490aa test/compiler/relocations/TestPrintRelocations.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/relocations/TestPrintRelocations.java Tue Sep 16 13:30:48 2014 +0000 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2014, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8044538 + * @summary assert hit while printing relocations for jump table entries + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:+PrintRelocations TestPrintRelocations + */ + +/** + * The test compiles all methods (-Xcomp) and prints their relocation + * entries (-XX:+PrintRelocations) to make sure the printing works. + */ +public class TestPrintRelocations { + + static public void main(String[] args) { } +}