comparison src/share/vm/asm/codeBuffer.cpp @ 7409:30866cd626b0

8004883: NPG: clean up anonymous class fix Summary: Add klass_holder() to return either mirror or class_loader depending on if the class is anonymous or not. Reviewed-by: stefank, jrose
author coleenp
date Wed, 12 Dec 2012 11:39:29 -0500
parents d2f8c38e543d
children 989155e2d07a a5de0cc2f91c
comparison
equal deleted inserted replaced
7396:4a2ed49abd51 7409:30866cd626b0
494 // Done calculating sections; did it come out to the right end? 494 // Done calculating sections; did it come out to the right end?
495 assert(buf_offset == total_content_size(), "sanity"); 495 assert(buf_offset == total_content_size(), "sanity");
496 dest->verify_section_allocation(); 496 dest->verify_section_allocation();
497 } 497 }
498 498
499 // Anonymous classes need mirror to keep the metadata alive but 499 // Append an oop reference that keeps the class alive.
500 // for regular classes, the class_loader is sufficient.
501 static void append_oop_references(GrowableArray<oop>* oops, Klass* k) { 500 static void append_oop_references(GrowableArray<oop>* oops, Klass* k) {
502 if (k->oop_is_instance()) { 501 oop cl = k->klass_holder();
503 InstanceKlass* ik = InstanceKlass::cast(k);
504 if (ik->is_anonymous()) {
505 oop o = ik->java_mirror();
506 assert (o != NULL, "should have a mirror");
507 if (!oops->contains(o)) {
508 oops->append(o);
509 }
510 return; // only need the mirror
511 }
512 }
513 oop cl = k->class_loader();
514 if (cl != NULL && !oops->contains(cl)) { 502 if (cl != NULL && !oops->contains(cl)) {
515 oops->append(cl); 503 oops->append(cl);
516 } 504 }
517 } 505 }
518 506