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.
|
// Returns true if we have enough room in the buffer for 'len' bytes.
|
||||||
bool can_write_fast(size_t len);
|
bool can_write_fast(size_t len);
|
||||||
|
|
||||||
|
void write_address(address a);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AbstractDumpWriter() :
|
AbstractDumpWriter() :
|
||||||
_buffer(NULL),
|
_buffer(NULL),
|
||||||
@ -429,6 +432,7 @@ class AbstractDumpWriter : public StackObj {
|
|||||||
void write_u4(u4 x);
|
void write_u4(u4 x);
|
||||||
void write_u8(u8 x);
|
void write_u8(u8 x);
|
||||||
void write_objectID(oop o);
|
void write_objectID(oop o);
|
||||||
|
void write_rootID(oop* p);
|
||||||
void write_symbolID(Symbol* o);
|
void write_symbolID(Symbol* o);
|
||||||
void write_classID(Klass* k);
|
void write_classID(Klass* k);
|
||||||
void write_id(u4 x);
|
void write_id(u4 x);
|
||||||
@ -511,8 +515,7 @@ void AbstractDumpWriter::write_u8(u8 x) {
|
|||||||
WRITE_KNOWN_TYPE(&v, 8);
|
WRITE_KNOWN_TYPE(&v, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractDumpWriter::write_objectID(oop o) {
|
void AbstractDumpWriter::write_address(address a) {
|
||||||
address a = cast_from_oop<address>(o);
|
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
write_u8((u8)a);
|
write_u8((u8)a);
|
||||||
#else
|
#else
|
||||||
@ -520,13 +523,16 @@ void AbstractDumpWriter::write_objectID(oop o) {
|
|||||||
#endif
|
#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) {
|
void AbstractDumpWriter::write_symbolID(Symbol* s) {
|
||||||
address a = (address)((uintptr_t)s);
|
write_address((address)((uintptr_t)s));
|
||||||
#ifdef _LP64
|
|
||||||
write_u8((u8)a);
|
|
||||||
#else
|
|
||||||
write_u4((u4)a);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractDumpWriter::write_id(u4 x) {
|
void AbstractDumpWriter::write_id(u4 x) {
|
||||||
@ -1581,7 +1587,7 @@ void JNIGlobalsDumper::do_oop(oop* obj_p) {
|
|||||||
u4 size = 1 + 2 * sizeof(address);
|
u4 size = 1 + 2 * sizeof(address);
|
||||||
writer()->start_sub_record(HPROF_GC_ROOT_JNI_GLOBAL, size);
|
writer()->start_sub_record(HPROF_GC_ROOT_JNI_GLOBAL, size);
|
||||||
writer()->write_objectID(o);
|
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();
|
writer()->end_sub_record();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user