mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 00:54:38 +02:00
8004883: NPG: clean up anonymous class fix
Add klass_holder() to return either mirror or class_loader depending on if the class is anonymous or not. Reviewed-by: stefank, jrose
This commit is contained in:
parent
ba2a5a260d
commit
54bbf614e8
6 changed files with 24 additions and 40 deletions
|
@ -496,21 +496,9 @@ void CodeBuffer::compute_final_layout(CodeBuffer* dest) const {
|
|||
dest->verify_section_allocation();
|
||||
}
|
||||
|
||||
// Anonymous classes need mirror to keep the metadata alive but
|
||||
// for regular classes, the class_loader is sufficient.
|
||||
// Append an oop reference that keeps the class alive.
|
||||
static void append_oop_references(GrowableArray<oop>* oops, Klass* k) {
|
||||
if (k->oop_is_instance()) {
|
||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
||||
if (ik->is_anonymous()) {
|
||||
oop o = ik->java_mirror();
|
||||
assert (o != NULL, "should have a mirror");
|
||||
if (!oops->contains(o)) {
|
||||
oops->append(o);
|
||||
}
|
||||
return; // only need the mirror
|
||||
}
|
||||
}
|
||||
oop cl = k->class_loader();
|
||||
oop cl = k->klass_holder();
|
||||
if (cl != NULL && !oops->contains(cl)) {
|
||||
oops->append(cl);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue