8218625: Remove dead code in relocInfo

Reviewed-by: kvn, thartmann
This commit is contained in:
Claes Redestad 2019-02-07 22:20:46 +01:00
parent d5e0b71435
commit 7049e4c443
11 changed files with 14 additions and 216 deletions

@ -352,7 +352,7 @@ void MachEpilogNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
// If this does safepoint polling, then do it here
if (do_polling() && ra_->C->is_method_compilation()) {
// mov_slow here is usually one or two instruction
__ mov_address(Rtemp, (address)os::get_polling_page(), symbolic_Relocation::polling_page_reference);
__ mov_address(Rtemp, (address)os::get_polling_page());
__ relocate(relocInfo::poll_return_type);
__ ldr(Rtemp, Address(Rtemp));
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2019, 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
@ -309,7 +309,7 @@ void LIR_Assembler::return_op(LIR_Opr result) {
__ remove_frame(initial_frame_size_in_bytes());
// mov_slow here is usually one or two instruction
__ mov_address(Rtemp, os::get_polling_page(), symbolic_Relocation::polling_page_reference);
__ mov_address(Rtemp, os::get_polling_page());
__ relocate(relocInfo::poll_return_type);
__ ldr(Rtemp, Address(Rtemp));
__ ret();
@ -317,7 +317,7 @@ void LIR_Assembler::return_op(LIR_Opr result) {
int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
__ mov_address(Rtemp, os::get_polling_page(), symbolic_Relocation::polling_page_reference);
__ mov_address(Rtemp, os::get_polling_page());
if (info != NULL) {
add_debug_info_for_branch(info);
}

@ -218,7 +218,7 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
const Register card_addr = tmp1;
assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
__ mov_address(tmp2, (address)ct->byte_map_base(), symbolic_Relocation::card_table_reference);
__ mov_address(tmp2, (address)ct->byte_map_base());
__ add(card_addr, tmp2, AsmOperand(store_addr, lsr, CardTable::card_shift));
__ ldrb(tmp2, Address(card_addr));

@ -167,7 +167,7 @@ void BarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register obj, Regi
bool load_const = VM_Version::supports_movw();
if (load_const) {
__ mov_address(top_addr, (address)Universe::heap()->top_addr(), symbolic_Relocation::eden_top_reference);
__ mov_address(top_addr, (address)Universe::heap()->top_addr());
} else {
__ ldr(top_addr, Address(Rthread, JavaThread::heap_top_addr_offset()));
}

@ -61,7 +61,7 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
__ sub(count, count, addr); // nb of cards
// warning: Rthread has not been preserved
__ mov_address(tmp, (address) ct->byte_map_base(), symbolic_Relocation::card_table_reference);
__ mov_address(tmp, (address) ct->byte_map_base());
__ add(addr,tmp, addr);
Register zero = __ zero_register(tmp);
@ -119,7 +119,7 @@ void CardTableBarrierSetAssembler::store_check_part1(MacroAssembler* masm, Regis
Possible cause is a cache miss (card table base address resides in a
rarely accessed area of thread descriptor).
*/
__ mov_address(card_table_base, (address)ct->byte_map_base(), symbolic_Relocation::card_table_reference);
__ mov_address(card_table_base, (address)ct->byte_map_base());
}
// The 2nd part of the store check.

@ -26,7 +26,6 @@
#define CPU_ARM_MACROASSEMBLER_ARM_HPP
#include "code/relocInfo.hpp"
#include "code/relocInfo_ext.hpp"
class BiasedLockingCounters;
@ -513,15 +512,13 @@ public:
}
}
// Runtime address that may vary from one execution to another. The
// symbolic_reference describes what the address is, allowing
// the address to be resolved in a different execution context.
// Runtime address that may vary from one execution to another.
// Warning: do not implement as a PC relative address.
void mov_address(Register rd, address addr, symbolic_Relocation::symbolic_reference t) {
void mov_address(Register rd, address addr) {
mov_address(rd, addr, RelocationHolder::none);
}
// rspec can be RelocationHolder::none (for ignored symbolic_Relocation).
// rspec can be RelocationHolder::none (for ignored symbolic Relocation).
// In that case, the address is absolute and the generated code need
// not be relocable.
void mov_address(Register rd, address addr, RelocationHolder const& rspec) {

@ -820,9 +820,9 @@ class StubGenerator: public StubCodeGenerator {
// Note: oop_mask and oop_bits must be updated if the code is saved/reused
const address oop_mask = (address) Universe::verify_oop_mask();
const address oop_bits = (address) Universe::verify_oop_bits();
__ mov_address(tmp1, oop_mask, symbolic_Relocation::oop_mask_reference);
__ mov_address(tmp1, oop_mask);
__ andr(tmp2, oop, tmp1);
__ mov_address(tmp1, oop_bits, symbolic_Relocation::oop_bits_reference);
__ mov_address(tmp1, oop_bits);
__ cmp(tmp2, tmp1);
__ b(error, ne);

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, 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
@ -92,18 +92,6 @@ void relocInfo::set_type(relocType t) {
assert(format()==old_format, "sanity check");
}
nmethod* RelocIterator::code_as_nmethod() const {
return _code->as_nmethod();
}
void relocInfo::set_format(int f) {
int old_offset = addr_offset();
assert((f & format_mask) == f, "wrong format");
_value = (_value & ~(format_mask << offset_width)) | (f << offset_width);
assert(addr_offset()==old_offset, "sanity check");
}
void relocInfo::change_reloc_info_for_address(RelocIterator *itr, address pc, relocType old_type, relocType new_type) {
bool found = false;
while (itr->next() && !found) {
@ -117,11 +105,6 @@ void relocInfo::change_reloc_info_for_address(RelocIterator *itr, address pc, re
}
void relocInfo::remove_reloc_info_for_address(RelocIterator *itr, address pc, relocType old_type) {
change_reloc_info_for_address(itr, pc, old_type, none);
}
// ----------------------------------------------------------------------------------------------------
// Implementation of RelocIterator
@ -179,14 +162,6 @@ RelocIterator::RelocIterator(CodeSection* cs, address begin, address limit) {
set_limits(begin, limit);
}
enum { indexCardSize = 128 };
struct RelocIndexEntry {
jint addr_offset; // offset from header_end of an addr()
jint reloc_offset; // offset from header_end of a relocInfo (prefix)
};
bool RelocIterator::addr_in_const() const {
const int n = CodeBuffer::SECT_CONSTS;
return section_start(n) <= addr() && addr() < section_end(n);
@ -215,12 +190,6 @@ void RelocIterator::set_limits(address begin, address limit) {
}
void RelocIterator::set_limit(address limit) {
address code_end = (address)code() + code()->size();
assert(limit == NULL || limit <= code_end, "in bounds");
_limit = limit;
}
// All the strange bit-encodings are in here.
// The idea is to encode relocation data which are small integers
// very efficiently (a single extra halfword). Larger chunks of
@ -622,14 +591,6 @@ void metadata_Relocation::fix_metadata_relocation() {
}
}
void metadata_Relocation::verify_metadata_relocation() {
if (!metadata_is_immediate()) {
// get the metadata from the pool, and re-insert it into the instruction:
verify_value(value());
}
}
address virtual_call_Relocation::cached_value() {
assert(_cached_value != NULL && _cached_value < addr(), "must precede ic_call");
return _cached_value;

@ -345,7 +345,6 @@ class relocInfo {
static int offset_limit() { return (1 << offset_width) * offset_unit; }
void set_type(relocType type);
void set_format(int format);
void remove() { set_type(none); }
@ -422,7 +421,6 @@ class relocInfo {
// (since code is dynamically patched, we also need to dynamically update the relocation info)
// Both methods takes old_type, so it is able to performe sanity checks on the information removed.
static void change_reloc_info_for_address(RelocIterator *itr, address pc, relocType old_type, relocType new_type);
static void remove_reloc_info_for_address(RelocIterator *itr, address pc, relocType old_type);
// Machine dependent stuff
#include CPU_HEADER(relocInfo)
@ -531,7 +529,6 @@ class RelocIterator : public StackObj {
short _databuf; // spare buffer for compressed data
short* _data; // pointer to the relocation's data
short _datalen; // number of halfwords in _data
char _format; // position within the instruction
// Base addresses needed to compute targets of section_word_type relocs.
address _section_start[SECT_LIMIT];
@ -588,23 +585,18 @@ class RelocIterator : public StackObj {
return false;
}
if (relocInfo::have_format) _format = current()->format();
return true;
}
// accessors
address limit() const { return _limit; }
void set_limit(address x);
relocType type() const { return current()->type(); }
int format() const { return (relocInfo::have_format) ? current()->format() : 0; }
address addr() const { return _addr; }
CompiledMethod* code() const { return _code; }
nmethod* code_as_nmethod() const;
short* data() const { return _data; }
int datalen() const { return _datalen; }
bool has_current() const { return _datalen >= 0; }
void set_addr(address addr) { _addr = addr; }
bool addr_in_const() const;
address section_start(int n) const {
@ -793,7 +785,6 @@ class Relocation {
// accessors which only make sense for a bound Relocation
address addr() const { return binding()->addr(); }
CompiledMethod* code() const { return binding()->code(); }
nmethod* code_as_nmethod() const { return binding()->code_as_nmethod(); }
bool addr_in_const() const { return binding()->addr_in_const(); }
protected:
short* data() const { return binding()->data(); }
@ -1002,8 +993,6 @@ class metadata_Relocation : public DataRelocation {
void fix_metadata_relocation(); // reasserts metadata value
void verify_metadata_relocation();
address value() { return (address) *metadata_addr(); }
bool metadata_is_immediate() { return metadata_index() == 0; }

@ -1,88 +0,0 @@
/*
* Copyright (c) 2015, 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
* 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.
*
*/
#include "precompiled.hpp"
#include "code/codeCache.hpp"
#include "code/relocInfo.hpp"
#include "code/relocInfo_ext.hpp"
#include "gc/shared/cardTable.hpp"
#include "gc/shared/cardTableBarrierSet.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "memory/universe.hpp"
#include "runtime/os.hpp"
#include "utilities/debug.hpp"
#ifdef COMPILER1
#include "c1/c1_globals.hpp"
#endif
address symbolic_Relocation::symbolic_value(symbolic_Relocation::symbolic_reference t) {
if (Universe::heap() == NULL) {
// the symbolic values are not needed so early
// (and most of them lead to errors if asked too early)
return NULL;
}
switch(t) {
case symbolic_Relocation::polling_page_reference: {
return os::get_polling_page();
}
case symbolic_Relocation::eden_top_reference: {
if (!Universe::heap()->supports_inline_contig_alloc()) {
return NULL;
}
return (address)Universe::heap()->top_addr();
}
case symbolic_Relocation::heap_end_reference: {
if (!Universe::heap()->supports_inline_contig_alloc()) {
return NULL;
}
return (address)Universe::heap()->end_addr();
}
case symbolic_Relocation::card_table_reference: {
BarrierSet* bs = BarrierSet::barrier_set();
CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
CardTable* ct = ctbs->card_table();
return (address)ct->byte_map_base();
}
case symbolic_Relocation::mark_bits_reference: {
return (address)Universe::verify_mark_bits();
}
case symbolic_Relocation::mark_mask_reference: {
return (address)Universe::verify_mark_mask();
}
case symbolic_Relocation::oop_bits_reference: {
return (address)Universe::verify_oop_bits();
}
case symbolic_Relocation::oop_mask_reference: {
return (address)Universe::verify_oop_mask();
}
case symbolic_Relocation::debug_string_reference: {
return (address)"<Lost debug string>";
}
default: {
// missing declaration
ShouldNotReachHere();
return NULL;
}
}
}

@ -1,61 +0,0 @@
/*
* Copyright (c) 2011, 2019, 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.
*
*/
#ifndef SHARE_CODE_RELOCINFO_EXT_HPP
#define SHARE_CODE_RELOCINFO_EXT_HPP
// symbolic_Relocation allows to anotate some addresses in the generated code.
//
// This class was initially defined using the last unused relocType. The
// new version tries to limit the impact on open source code changes.
//
// Without compiled code support, symbolic_Relocation need not be a real
// relocation. To avoid using the last unused relocType, the
// symbolic_Relocation::spec(<any symbolic type>) has been replaced
// by additional methods using directly the symbolic type.
//
// Note: the order of the arguments in some methods had to reversed
// to avoid confusion between the relocType enum and the
// symbolic_reference enum.
class symbolic_Relocation : AllStatic {
public:
enum symbolic_reference {
card_table_reference,
eden_top_reference,
heap_end_reference,
polling_page_reference,
mark_bits_reference,
mark_mask_reference,
oop_bits_reference,
oop_mask_reference,
debug_string_reference,
last_symbolic_reference
};
// get the new value for a given symbolic type
static address symbolic_value(symbolic_reference t);
};
#endif // SHARE_CODE_RELOCINFO_EXT_HPP