Merge
This commit is contained in:
commit
657d7d0eea
@ -927,7 +927,7 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
|||||||
if (curVFrame.isCompiledFrame()) {
|
if (curVFrame.isCompiledFrame()) {
|
||||||
CodeBlob cb = VM.getVM().getCodeCache().findBlob(curFrame.getPC());
|
CodeBlob cb = VM.getVM().getCodeCache().findBlob(curFrame.getPC());
|
||||||
ImmutableOopMapSet maps = cb.getOopMaps();
|
ImmutableOopMapSet maps = cb.getOopMaps();
|
||||||
if ((maps == null) || (maps.getSize() == 0)) {
|
if ((maps == null) || (maps.getCount() == 0)) {
|
||||||
shouldSkipOopMaps = true;
|
shouldSkipOopMaps = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,4 +71,8 @@ public class ImmutableOopMapPair {
|
|||||||
offsetField = type.getCIntegerField("_oopmap_offset");
|
offsetField = type.getCIntegerField("_oopmap_offset");
|
||||||
classSize = type.getSize();
|
classSize = type.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "Pair{pc_offset = " + getPC() + ", data_offset = " + getOffset() + "}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,19 +106,19 @@ public class ImmutableOopMapSet extends VMObject {
|
|||||||
/**
|
/**
|
||||||
* Returns the number of OopMaps in this ImmutableOopMapSet
|
* Returns the number of OopMaps in this ImmutableOopMapSet
|
||||||
*/
|
*/
|
||||||
public long getSize() {
|
|
||||||
return countField.getValue(addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() { return (int) countField.getValue(addr); }
|
public int getCount() { return (int) countField.getValue(addr); }
|
||||||
|
|
||||||
private Address dataStart() {
|
private Address dataStart() {
|
||||||
return (addr.addOffsetTo(ImmutableOopMapSet.classSize * getCount()));
|
return (pairStart().addOffsetTo(ImmutableOopMapPair.classSize() * getCount()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Address pairStart() {
|
||||||
|
return addr.addOffsetTo(ImmutableOopMapSet.classSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableOopMapPair pairAt(int index) {
|
public ImmutableOopMapPair pairAt(int index) {
|
||||||
Assert.that((index >= 0) && (index < getCount()), "bad index");
|
Assert.that((index >= 0) && (index < getCount()), "bad index");
|
||||||
return new ImmutableOopMapPair(addr.addOffsetTo(index * ImmutableOopMapPair.classSize()));
|
return new ImmutableOopMapPair(pairStart().addOffsetTo(index * ImmutableOopMapPair.classSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,7 +126,7 @@ public class ImmutableOopMapSet extends VMObject {
|
|||||||
*/
|
*/
|
||||||
public ImmutableOopMap getMapAt(int index) {
|
public ImmutableOopMap getMapAt(int index) {
|
||||||
if (Assert.ASSERTS_ENABLED) {
|
if (Assert.ASSERTS_ENABLED) {
|
||||||
Assert.that((index >= 0) && (index <= getSize()), "bad index");
|
Assert.that((index >= 0) && (index <= getCount()), "bad index");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableOopMapPair immutableOopMapPair = pairAt(index);
|
ImmutableOopMapPair immutableOopMapPair = pairAt(index);
|
||||||
@ -135,7 +135,7 @@ public class ImmutableOopMapSet extends VMObject {
|
|||||||
|
|
||||||
public ImmutableOopMap findMapAtOffset(long pcOffset, boolean debugging) {
|
public ImmutableOopMap findMapAtOffset(long pcOffset, boolean debugging) {
|
||||||
int i;
|
int i;
|
||||||
int len = (int) getSize();
|
int len = getCount();
|
||||||
if (Assert.ASSERTS_ENABLED) {
|
if (Assert.ASSERTS_ENABLED) {
|
||||||
Assert.that(len > 0, "must have pointer maps");
|
Assert.that(len > 0, "must have pointer maps");
|
||||||
}
|
}
|
||||||
@ -253,14 +253,14 @@ public class ImmutableOopMapSet extends VMObject {
|
|||||||
if (!VM.getVM().isDebugging()) {
|
if (!VM.getVM().isDebugging()) {
|
||||||
if (Assert.ASSERTS_ENABLED) {
|
if (Assert.ASSERTS_ENABLED) {
|
||||||
ImmutableOopMapSet maps = cb.getOopMaps();
|
ImmutableOopMapSet maps = cb.getOopMaps();
|
||||||
Assert.that((maps != null) && (maps.getSize() > 0), "found null or empty ImmutableOopMapSet for CodeBlob");
|
Assert.that((maps != null) && (maps.getCount() > 0), "found null or empty ImmutableOopMapSet for CodeBlob");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Hack for some topmost frames that have been found with empty
|
// Hack for some topmost frames that have been found with empty
|
||||||
// OopMapSets. (Actually have not seen the null case, but don't
|
// OopMapSets. (Actually have not seen the null case, but don't
|
||||||
// want to take any chances.) See HSDB.showThreadStackMemory().
|
// want to take any chances.) See HSDB.showThreadStackMemory().
|
||||||
ImmutableOopMapSet maps = cb.getOopMaps();
|
ImmutableOopMapSet maps = cb.getOopMaps();
|
||||||
if ((maps == null) || (maps.getSize() == 0)) {
|
if ((maps == null) || (maps.getCount() == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,8 +311,28 @@ public class ImmutableOopMapSet extends VMObject {
|
|||||||
return pairAt(index);
|
return pairAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getSize() {
|
||||||
|
return (int) sizeField.getValue(addr);
|
||||||
|
}
|
||||||
|
|
||||||
public ImmutableOopMap getMap(ImmutableOopMapPair pair) {
|
public ImmutableOopMap getMap(ImmutableOopMapPair pair) {
|
||||||
Assert.that(pair.getOffset() < (int) sizeField.getValue(), "boundary check");
|
Assert.that(pair.getOffset() < getSize(), "boundary check: this: " + this + " offset: " + pair);
|
||||||
return new ImmutableOopMap(dataStart().addOffsetTo(pair.getOffset()));
|
return new ImmutableOopMap(dataStart().addOffsetTo(pair.getOffset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("Set{ ")
|
||||||
|
.append("addr = ").append(addr)
|
||||||
|
.append(", count = ").append(getCount())
|
||||||
|
.append(", size = ").append(getSize())
|
||||||
|
.append(", pairs = [");
|
||||||
|
|
||||||
|
for (int i = 0; i < getCount(); ++i) {
|
||||||
|
builder.append(getPairAt(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1236,7 +1236,7 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
|
|||||||
|
|
||||||
protected String genOopMapInfo(NMethod nmethod, PCDesc pcDesc) {
|
protected String genOopMapInfo(NMethod nmethod, PCDesc pcDesc) {
|
||||||
ImmutableOopMapSet mapSet = nmethod.getOopMaps();
|
ImmutableOopMapSet mapSet = nmethod.getOopMaps();
|
||||||
if (mapSet == null || (mapSet.getSize() <= 0))
|
if (mapSet == null || (mapSet.getCount() <= 0))
|
||||||
return "";
|
return "";
|
||||||
int pcOffset = pcDesc.getPCOffset();
|
int pcOffset = pcDesc.getPCOffset();
|
||||||
ImmutableOopMap map = mapSet.findMapAtOffset(pcOffset, VM.getVM().isDebugging());
|
ImmutableOopMap map = mapSet.findMapAtOffset(pcOffset, VM.getVM().isDebugging());
|
||||||
|
@ -596,6 +596,17 @@ ImmutableOopMap::ImmutableOopMap(const OopMap* oopmap) : _count(oopmap->count())
|
|||||||
oopmap->copy_data_to(addr);
|
oopmap->copy_data_to(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ASSERT
|
||||||
|
int ImmutableOopMap::nr_of_bytes() const {
|
||||||
|
OopMapStream oms(this);
|
||||||
|
|
||||||
|
while (!oms.is_done()) {
|
||||||
|
oms.next();
|
||||||
|
}
|
||||||
|
return sizeof(ImmutableOopMap) + oms.stream_position();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class ImmutableOopMapBuilder {
|
class ImmutableOopMapBuilder {
|
||||||
private:
|
private:
|
||||||
class Mapping;
|
class Mapping;
|
||||||
@ -652,7 +663,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
void verify(address buffer, int size);
|
void verify(address buffer, int size, const ImmutableOopMapSet* set);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool has_empty() const {
|
bool has_empty() const {
|
||||||
@ -660,8 +671,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int size_for(const OopMap* map) const;
|
int size_for(const OopMap* map) const;
|
||||||
void fill_pair(ImmutableOopMapPair* pair, const OopMap* map, int offset);
|
void fill_pair(ImmutableOopMapPair* pair, const OopMap* map, int offset, const ImmutableOopMapSet* set);
|
||||||
int fill_map(ImmutableOopMapPair* pair, const OopMap* map, int offset);
|
int fill_map(ImmutableOopMapPair* pair, const OopMap* map, int offset, const ImmutableOopMapSet* set);
|
||||||
void fill(ImmutableOopMapSet* set, int size);
|
void fill(ImmutableOopMapSet* set, int size);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -711,12 +722,13 @@ int ImmutableOopMapBuilder::heap_size() {
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImmutableOopMapBuilder::fill_pair(ImmutableOopMapPair* pair, const OopMap* map, int offset) {
|
void ImmutableOopMapBuilder::fill_pair(ImmutableOopMapPair* pair, const OopMap* map, int offset, const ImmutableOopMapSet* set) {
|
||||||
|
assert(offset < set->nr_of_bytes(), "check");
|
||||||
new ((address) pair) ImmutableOopMapPair(map->offset(), offset);
|
new ((address) pair) ImmutableOopMapPair(map->offset(), offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ImmutableOopMapBuilder::fill_map(ImmutableOopMapPair* pair, const OopMap* map, int offset) {
|
int ImmutableOopMapBuilder::fill_map(ImmutableOopMapPair* pair, const OopMap* map, int offset, const ImmutableOopMapSet* set) {
|
||||||
fill_pair(pair, map, offset);
|
fill_pair(pair, map, offset, set);
|
||||||
address addr = (address) pair->get_from(_new_set); // location of the ImmutableOopMap
|
address addr = (address) pair->get_from(_new_set); // location of the ImmutableOopMap
|
||||||
|
|
||||||
new (addr) ImmutableOopMap(map);
|
new (addr) ImmutableOopMap(map);
|
||||||
@ -732,9 +744,9 @@ void ImmutableOopMapBuilder::fill(ImmutableOopMapSet* set, int sz) {
|
|||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
if (_mapping[i]._kind == Mapping::OOPMAP_NEW) {
|
if (_mapping[i]._kind == Mapping::OOPMAP_NEW) {
|
||||||
size = fill_map(&pairs[i], map, _mapping[i]._offset);
|
size = fill_map(&pairs[i], map, _mapping[i]._offset, set);
|
||||||
} else if (_mapping[i]._kind == Mapping::OOPMAP_DUPLICATE || _mapping[i]._kind == Mapping::OOPMAP_EMPTY) {
|
} else if (_mapping[i]._kind == Mapping::OOPMAP_DUPLICATE || _mapping[i]._kind == Mapping::OOPMAP_EMPTY) {
|
||||||
fill_pair(&pairs[i], map, _mapping[i]._offset);
|
fill_pair(&pairs[i], map, _mapping[i]._offset, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImmutableOopMap* nv = set->find_map_at_offset(map->offset());
|
const ImmutableOopMap* nv = set->find_map_at_offset(map->offset());
|
||||||
@ -743,10 +755,18 @@ void ImmutableOopMapBuilder::fill(ImmutableOopMapSet* set, int sz) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
void ImmutableOopMapBuilder::verify(address buffer, int size) {
|
void ImmutableOopMapBuilder::verify(address buffer, int size, const ImmutableOopMapSet* set) {
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
assert(buffer[size - 8 + i] == (unsigned char) 0xff, "overwritten memory check");
|
assert(buffer[size - 8 + i] == (unsigned char) 0xff, "overwritten memory check");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < set->count(); ++i) {
|
||||||
|
const ImmutableOopMapPair* pair = set->pair_at(i);
|
||||||
|
assert(pair->oopmap_offset() < set->nr_of_bytes(), "check size");
|
||||||
|
const ImmutableOopMap* map = pair->get_from(set);
|
||||||
|
int nr_of_bytes = map->nr_of_bytes();
|
||||||
|
assert(pair->oopmap_offset() + nr_of_bytes <= set->nr_of_bytes(), "check size + size");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -760,7 +780,7 @@ ImmutableOopMapSet* ImmutableOopMapBuilder::build() {
|
|||||||
_new_set = new (buffer) ImmutableOopMapSet(_set, required);
|
_new_set = new (buffer) ImmutableOopMapSet(_set, required);
|
||||||
fill(_new_set, required);
|
fill(_new_set, required);
|
||||||
|
|
||||||
DEBUG_ONLY(verify(buffer, required));
|
DEBUG_ONLY(verify(buffer, required, _new_set));
|
||||||
|
|
||||||
return _new_set;
|
return _new_set;
|
||||||
}
|
}
|
||||||
|
@ -273,6 +273,9 @@ public:
|
|||||||
|
|
||||||
bool has_derived_pointer() const PRODUCT_RETURN0;
|
bool has_derived_pointer() const PRODUCT_RETURN0;
|
||||||
int count() const { return _count; }
|
int count() const { return _count; }
|
||||||
|
#ifdef ASSERT
|
||||||
|
int nr_of_bytes() const; // this is an expensive operation, only used in debug builds
|
||||||
|
#endif
|
||||||
|
|
||||||
// Printing
|
// Printing
|
||||||
void print_on(outputStream* st) const;
|
void print_on(outputStream* st) const;
|
||||||
@ -346,6 +349,9 @@ class OopMapStream : public StackObj {
|
|||||||
bool is_done() { if(!_valid_omv) { find_next(); } return !_valid_omv; }
|
bool is_done() { if(!_valid_omv) { find_next(); } return !_valid_omv; }
|
||||||
void next() { find_next(); }
|
void next() { find_next(); }
|
||||||
OopMapValue current() { return _omv; }
|
OopMapValue current() { return _omv; }
|
||||||
|
#ifdef ASSERT
|
||||||
|
int stream_position() const { return _stream->position(); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user