8044538: assert(which != imm_operand) failed: instruction is not a movq reg, imm64

Fixed internal_word_Relocation::target() to not retrieve target address from code if relocation points into the constant section. Added test.

Reviewed-by: kvn, twisti, dlong
This commit is contained in:
Tobias Hartmann 2014-06-11 09:16:19 +02:00
parent 01645fc449
commit 83fc2acbd7
2 changed files with 44 additions and 6 deletions

View File

@ -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;
}

View File

@ -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) { }
}