Skip to content

Commit feccf3c

Browse files
committed
8235669: G1: Stack walking API can expose AS_NO_KEEPALIVE oops
Reviewed-by: kbarrett, tschatzl
1 parent 89f7e19 commit feccf3c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/hotspot/share/code/debugInfo.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ void DebugInfoWriteStream::write_metadata(Metadata* h) {
5151
}
5252

5353
oop DebugInfoReadStream::read_oop() {
54-
oop o = code()->oop_at(read_int());
54+
nmethod* nm = const_cast<CompiledMethod*>(code())->as_nmethod_or_null();
55+
oop o;
56+
if (nm != NULL) {
57+
// Despite these oops being found inside nmethods that are on-stack,
58+
// they are not kept alive by all GCs (e.g. G1 and Shenandoah).
59+
o = nm->oop_at_phantom(read_int());
60+
} else {
61+
o = code()->oop_at(read_int());
62+
}
5563
assert(oopDesc::is_oop_or_null(o), "oop only");
5664
return o;
5765
}

0 commit comments

Comments
 (0)