8292910: Remove root to oop cast in HeapDumper
Reviewed-by: eosterlund, coleenp
This commit is contained in:
parent
f694f8a767
commit
4732abf7f4
@ -410,6 +410,9 @@ class AbstractDumpWriter : public StackObj {
|
||||
|
||||
// Returns true if we have enough room in the buffer for 'len' bytes.
|
||||
bool can_write_fast(size_t len);
|
||||
|
||||
void write_address(address a);
|
||||
|
||||
public:
|
||||
AbstractDumpWriter() :
|
||||
_buffer(NULL),
|
||||
@ -429,6 +432,7 @@ class AbstractDumpWriter : public StackObj {
|
||||
void write_u4(u4 x);
|
||||
void write_u8(u8 x);
|
||||
void write_objectID(oop o);
|
||||
void write_rootID(oop* p);
|
||||
void write_symbolID(Symbol* o);
|
||||
void write_classID(Klass* k);
|
||||
void write_id(u4 x);
|
||||
@ -511,8 +515,7 @@ void AbstractDumpWriter::write_u8(u8 x) {
|
||||
WRITE_KNOWN_TYPE(&v, 8);
|
||||
}
|
||||
|
||||
void AbstractDumpWriter::write_objectID(oop o) {
|
||||
address a = cast_from_oop<address>(o);
|
||||
void AbstractDumpWriter::write_address(address a) {
|
||||
#ifdef _LP64
|
||||
write_u8((u8)a);
|
||||
#else
|
||||
@ -520,13 +523,16 @@ void AbstractDumpWriter::write_objectID(oop o) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractDumpWriter::write_objectID(oop o) {
|
||||
write_address(cast_from_oop<address>(o));
|
||||
}
|
||||
|
||||
void AbstractDumpWriter::write_rootID(oop* p) {
|
||||
write_address((address)p);
|
||||
}
|
||||
|
||||
void AbstractDumpWriter::write_symbolID(Symbol* s) {
|
||||
address a = (address)((uintptr_t)s);
|
||||
#ifdef _LP64
|
||||
write_u8((u8)a);
|
||||
#else
|
||||
write_u4((u4)a);
|
||||
#endif
|
||||
write_address((address)((uintptr_t)s));
|
||||
}
|
||||
|
||||
void AbstractDumpWriter::write_id(u4 x) {
|
||||
@ -1581,7 +1587,7 @@ void JNIGlobalsDumper::do_oop(oop* obj_p) {
|
||||
u4 size = 1 + 2 * sizeof(address);
|
||||
writer()->start_sub_record(HPROF_GC_ROOT_JNI_GLOBAL, size);
|
||||
writer()->write_objectID(o);
|
||||
writer()->write_objectID((oopDesc*)obj_p); // global ref ID
|
||||
writer()->write_rootID(obj_p); // global ref ID
|
||||
writer()->end_sub_record();
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user