From 9cf820b5472925acb1f36b3b4520351e5844dc2b Mon Sep 17 00:00:00 2001 From: thartmann Date: Wed, 11 Jun 2014 09:16:19 +0200 Subject: [PATCH] 8044538: assert(which != imm_operand) failed: instruction is not a movq reg, imm64 Summary: Fixed internal_word_Relocation::target() to not retrieve target address from code if relocation points into the constant section. Added test. Reviewed-by: kvn --- src/share/vm/code/relocInfo.cpp | 12 +++--- .../relocations/TestPrintRelocations.java | 38 +++++++++++++++++++ 2 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 test/compiler/relocations/TestPrintRelocations.java diff --git a/src/share/vm/code/relocInfo.cpp b/src/share/vm/code/relocInfo.cpp index aa0ef6b10..174a615de 100644 --- a/src/share/vm/code/relocInfo.cpp +++ b/src/share/vm/code/relocInfo.cpp @@ -877,11 +877,7 @@ address external_word_Relocation::target() { 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 @@ void internal_word_Relocation::fix_relocation_after_move(const CodeBuffer* src, 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 --git a/test/compiler/relocations/TestPrintRelocations.java b/test/compiler/relocations/TestPrintRelocations.java new file mode 100644 index 000000000..2cfb038b8 --- /dev/null +++ b/test/compiler/relocations/TestPrintRelocations.java @@ -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) { } +} -- GitLab