8240528: OopMap cleanup
Reviewed-by: kvn, thartmann
This commit is contained in:
parent
3ddd7b86c8
commit
78982f7c11
@ -660,7 +660,6 @@ private:
|
||||
bool _legacy_mode_vl;
|
||||
bool _legacy_mode_vlbw;
|
||||
bool _is_managed;
|
||||
bool _vector_masking; // For stub code use only
|
||||
|
||||
class InstructionAttr *_attributes;
|
||||
|
||||
@ -872,7 +871,6 @@ private:
|
||||
_legacy_mode_vl = (VM_Version::supports_avx512vl() == false);
|
||||
_legacy_mode_vlbw = (VM_Version::supports_avx512vlbw() == false);
|
||||
_is_managed = false;
|
||||
_vector_masking = false;
|
||||
_attributes = NULL;
|
||||
}
|
||||
|
||||
|
@ -168,86 +168,25 @@ void OopMap::set_derived_oop(VMReg reg, VMReg derived_from_local_register ) {
|
||||
|
||||
// OopMapSet
|
||||
|
||||
OopMapSet::OopMapSet() {
|
||||
set_om_size(MinOopMapAllocation);
|
||||
set_om_count(0);
|
||||
OopMap** temp = NEW_RESOURCE_ARRAY(OopMap*, om_size());
|
||||
set_om_data(temp);
|
||||
}
|
||||
|
||||
|
||||
void OopMapSet::grow_om_data() {
|
||||
int new_size = om_size() * 2;
|
||||
OopMap** new_data = NEW_RESOURCE_ARRAY(OopMap*, new_size);
|
||||
memcpy(new_data,om_data(),om_size() * sizeof(OopMap*));
|
||||
set_om_size(new_size);
|
||||
set_om_data(new_data);
|
||||
}
|
||||
OopMapSet::OopMapSet() : _list(MinOopMapAllocation) {}
|
||||
|
||||
void OopMapSet::add_gc_map(int pc_offset, OopMap *map ) {
|
||||
assert(om_size() != -1,"Cannot grow a fixed OopMapSet");
|
||||
|
||||
if(om_count() >= om_size()) {
|
||||
grow_om_data();
|
||||
}
|
||||
map->set_offset(pc_offset);
|
||||
|
||||
#ifdef ASSERT
|
||||
if(om_count() > 0) {
|
||||
OopMap* last = at(om_count()-1);
|
||||
if(_list.length() > 0) {
|
||||
OopMap* last = _list.last();
|
||||
if (last->offset() == map->offset() ) {
|
||||
fatal("OopMap inserted twice");
|
||||
}
|
||||
if(last->offset() > map->offset()) {
|
||||
if (last->offset() > map->offset()) {
|
||||
tty->print_cr( "WARNING, maps not sorted: pc[%d]=%d, pc[%d]=%d",
|
||||
om_count(),last->offset(),om_count()+1,map->offset());
|
||||
_list.length(),last->offset(),_list.length()+1,map->offset());
|
||||
}
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
||||
set(om_count(),map);
|
||||
increment_count();
|
||||
}
|
||||
|
||||
|
||||
int OopMapSet::heap_size() const {
|
||||
// The space we use
|
||||
int size = sizeof(OopMap);
|
||||
int align = sizeof(void *) - 1;
|
||||
size = ((size+align) & ~align);
|
||||
size += om_count() * sizeof(OopMap*);
|
||||
|
||||
// Now add in the space needed for the indivdiual OopMaps
|
||||
for(int i=0; i < om_count(); i++) {
|
||||
size += at(i)->heap_size();
|
||||
}
|
||||
// We don't need to align this, it will be naturally pointer aligned
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
OopMap* OopMapSet::singular_oop_map() {
|
||||
guarantee(om_count() == 1, "Make sure we only have a single gc point");
|
||||
return at(0);
|
||||
}
|
||||
|
||||
|
||||
OopMap* OopMapSet::find_map_at_offset(int pc_offset) const {
|
||||
int i, len = om_count();
|
||||
assert( len > 0, "must have pointer maps" );
|
||||
|
||||
// Scan through oopmaps. Stop when current offset is either equal or greater
|
||||
// than the one we are looking for.
|
||||
for( i = 0; i < len; i++) {
|
||||
if( at(i)->offset() >= pc_offset )
|
||||
break;
|
||||
}
|
||||
|
||||
assert( i < len, "oopmap not found" );
|
||||
|
||||
OopMap* m = at(i);
|
||||
assert( m->offset() == pc_offset, "oopmap not found" );
|
||||
return m;
|
||||
add(map);
|
||||
}
|
||||
|
||||
static void add_derived_oop(oop* base, oop* derived) {
|
||||
@ -302,7 +241,6 @@ void OopMapSet::all_do(const frame *fr, const RegisterMap *reg_map,
|
||||
|
||||
NOT_PRODUCT(if (TraceCodeBlobStacks) trace_codeblob_maps(fr, reg_map);)
|
||||
|
||||
const ImmutableOopMapSet* maps = cb->oop_maps();
|
||||
const ImmutableOopMap* map = cb->oop_map_for_return_address(fr->pc());
|
||||
assert(map != NULL, "no ptr map found");
|
||||
|
||||
@ -516,7 +454,7 @@ void ImmutableOopMapSet::print_on(outputStream* st) const {
|
||||
void ImmutableOopMapSet::print() const { print_on(tty); }
|
||||
|
||||
void OopMapSet::print_on(outputStream* st) const {
|
||||
const int len = om_count();
|
||||
const int len = _list.length();
|
||||
|
||||
st->print_cr("OopMapSet contains %d OopMaps", len);
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "code/vmreg.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "oops/oopsHierarchy.hpp"
|
||||
#include "utilities/growableArray.hpp"
|
||||
|
||||
// Interface for generating the frame map for compiled code. A frame map
|
||||
// describes for a specific pc whether each register and frame stack slot is:
|
||||
@ -129,13 +130,9 @@ public:
|
||||
|
||||
VMReg content_reg() const { return VMRegImpl::as_VMReg(_content_reg, true); }
|
||||
|
||||
// Physical location queries
|
||||
bool is_register_loc() { return reg()->is_reg(); }
|
||||
bool is_stack_loc() { return reg()->is_stack(); }
|
||||
|
||||
// Returns offset from sp.
|
||||
int stack_offset() {
|
||||
assert(is_stack_loc(), "must be stack location");
|
||||
assert(reg()->is_stack(), "must be stack location");
|
||||
return reg()->reg2stack();
|
||||
}
|
||||
|
||||
@ -177,9 +174,6 @@ class OopMap: public ResourceObj {
|
||||
int data_size() const { return write_stream()->position(); }
|
||||
address data() const { return write_stream()->buffer(); }
|
||||
|
||||
// Check to avoid double insertion
|
||||
debug_only(OopMapValue::oop_types locs_used( int indx ) { return _locs_used[indx]; })
|
||||
|
||||
// Construction
|
||||
// frame_size units are stack-slots (4 bytes) NOT intptr_t; we can name odd
|
||||
// slots to hold 4-byte values like ints and floats in the LP64 build.
|
||||
@ -206,40 +200,21 @@ class OopMap: public ResourceObj {
|
||||
class OopMapSet : public ResourceObj {
|
||||
friend class VMStructs;
|
||||
private:
|
||||
int _om_count;
|
||||
int _om_size;
|
||||
OopMap** _om_data;
|
||||
GrowableArray<OopMap*> _list;
|
||||
|
||||
int om_count() const { return _om_count; }
|
||||
void set_om_count(int value) { _om_count = value; }
|
||||
void increment_count() { _om_count++; }
|
||||
int om_size() const { return _om_size; }
|
||||
void set_om_size(int value) { _om_size = value; }
|
||||
OopMap** om_data() const { return _om_data; }
|
||||
void set_om_data(OopMap** value) { _om_data = value; }
|
||||
void grow_om_data();
|
||||
void set(int index,OopMap* value) { assert((index == 0) || ((index > 0) && (index < om_size())),"bad index"); _om_data[index] = value; }
|
||||
void add(OopMap* value) { _list.append(value); }
|
||||
|
||||
public:
|
||||
OopMapSet();
|
||||
|
||||
// returns the number of OopMaps in this OopMapSet
|
||||
int size() const { return _om_count; }
|
||||
int size() const { return _list.length(); }
|
||||
// returns the OopMap at a given index
|
||||
OopMap* at(int index) const { assert((index >= 0) && (index <= om_count()),"bad index"); return _om_data[index]; }
|
||||
OopMap* at(int index) const { return _list.at(index); }
|
||||
|
||||
// Collect OopMaps.
|
||||
void add_gc_map(int pc, OopMap* map);
|
||||
|
||||
// Returns the only oop map. Used for reconstructing
|
||||
// Adapter frames during deoptimization
|
||||
OopMap* singular_oop_map();
|
||||
|
||||
// returns OopMap in that is anchored to the pc
|
||||
OopMap* find_map_at_offset(int pc_offset) const;
|
||||
|
||||
int heap_size() const;
|
||||
|
||||
// Methods oops_do() and all_do() filter out NULL oops and
|
||||
// oop == CompressedOops::base() before passing oops
|
||||
// to closures.
|
||||
|
@ -603,7 +603,6 @@ class Compile : public Phase {
|
||||
ExceptionHandlerTable _handler_table; // Table of native-code exception handlers
|
||||
ImplicitExceptionTable _inc_table; // Table of implicit null checks in native code
|
||||
OopMapSet* _oop_map_set; // Table of oop maps (one for each safepoint location)
|
||||
static int _CompiledZap_count; // counter compared against CompileZap[First/Last]
|
||||
BufferBlob* _scratch_buffer_blob; // For temporary code buffers.
|
||||
relocInfo* _scratch_locs_memory; // For temporary code buffers.
|
||||
int _scratch_const_size; // For temporary code buffers.
|
||||
@ -1164,7 +1163,6 @@ class Compile : public Phase {
|
||||
OopMapSet* oop_map_set() { return _oop_map_set; }
|
||||
DebugInformationRecorder* debug_info() { return env()->debug_info(); }
|
||||
Dependencies* dependencies() { return env()->dependencies(); }
|
||||
static int CompiledZap_count() { return _CompiledZap_count; }
|
||||
BufferBlob* scratch_buffer_blob() { return _scratch_buffer_blob; }
|
||||
void init_scratch_buffer_blob(int const_size);
|
||||
void clear_scratch_buffer_blob();
|
||||
|
@ -791,16 +791,9 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
|
||||
volatile_nonstatic_field(OSThread, _state, ThreadState) \
|
||||
\
|
||||
/************************/ \
|
||||
/* OopMap and OopMapSet */ \
|
||||
/* ImmutableOopMap */ \
|
||||
/************************/ \
|
||||
\
|
||||
nonstatic_field(OopMap, _pc_offset, int) \
|
||||
nonstatic_field(OopMap, _omv_count, int) \
|
||||
nonstatic_field(OopMap, _write_stream, CompressedWriteStream*) \
|
||||
nonstatic_field(OopMapSet, _om_count, int) \
|
||||
nonstatic_field(OopMapSet, _om_size, int) \
|
||||
nonstatic_field(OopMapSet, _om_data, OopMap**) \
|
||||
\
|
||||
nonstatic_field(ImmutableOopMapSet, _count, int) \
|
||||
nonstatic_field(ImmutableOopMapSet, _size, int) \
|
||||
\
|
||||
@ -1449,11 +1442,9 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
|
||||
declare_toplevel_type(Deoptimization::UnrollBlock) \
|
||||
\
|
||||
/************************/ \
|
||||
/* OopMap and OopMapSet */ \
|
||||
/* ImmutableOopMap */ \
|
||||
/************************/ \
|
||||
\
|
||||
declare_toplevel_type(OopMap) \
|
||||
declare_toplevel_type(OopMapSet) \
|
||||
declare_toplevel_type(ImmutableOopMapSet) \
|
||||
declare_toplevel_type(ImmutableOopMapPair) \
|
||||
declare_toplevel_type(ImmutableOopMap) \
|
||||
@ -1994,9 +1985,7 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
|
||||
declare_toplevel_type(ObjectMonitor*) \
|
||||
declare_toplevel_type(PaddedObjectMonitor*) \
|
||||
declare_toplevel_type(oop*) \
|
||||
declare_toplevel_type(OopMap**) \
|
||||
declare_toplevel_type(OopMapCache*) \
|
||||
declare_toplevel_type(OopMapSet*) \
|
||||
declare_toplevel_type(VMReg) \
|
||||
declare_toplevel_type(OSThread*) \
|
||||
declare_integer_type(ReferenceType) \
|
||||
|
Loading…
Reference in New Issue
Block a user