int klassKlass::oop_oop_iterate(oop obj, OopClosure* blk) { // Get size before changing pointers int size = oop_size(obj); Klass* k = Klass::cast(klassOop(obj)); blk->do_oop(k->adr_super()); for (juint i = 0; i < Klass::primary_super_limit(); i++) blk->do_oop(k->adr_primary_supers()+i); blk->do_oop(k->adr_secondary_super_cache()); blk->do_oop(k->adr_secondary_supers()); blk->do_oop(k->adr_java_mirror()); blk->do_oop(k->adr_name()); // The following are in the perm gen and are treated // specially in a later phase of a perm gen collection; ... assert(oop(k)->is_perm(), "should be in perm"); assert(oop(k->subklass())->is_perm_or_null(), "should be in perm"); assert(oop(k->next_sibling())->is_perm_or_null(), "should be in perm"); // ... don't scan them normally, but remember this klassKlass // for later (see, for instance, oop_follow_contents above // for what MarkSweep does with it. if (blk->should_remember_klasses()) { blk->remember_klass(k); } obj->oop_iterate_header(blk); return size; }
int klassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { // Get size before changing pointers int size = oop_size(obj); Klass* k = Klass::cast(klassOop(obj)); oop* adr; adr = k->adr_super(); if (mr.contains(adr)) blk->do_oop(adr); for (juint i = 0; i < Klass::primary_super_limit(); i++) { adr = k->adr_primary_supers()+i; if (mr.contains(adr)) blk->do_oop(adr); } adr = k->adr_secondary_super_cache(); if (mr.contains(adr)) blk->do_oop(adr); adr = k->adr_secondary_supers(); if (mr.contains(adr)) blk->do_oop(adr); adr = k->adr_java_mirror(); if (mr.contains(adr)) blk->do_oop(adr); adr = k->adr_name(); if (mr.contains(adr)) blk->do_oop(adr); // The following are "weak links" in the perm gen and are // treated specially in a later phase of a perm gen collection. assert(oop(k)->is_perm(), "should be in perm"); assert(oop(k->adr_subklass())->is_perm(), "should be in perm"); assert(oop(k->adr_next_sibling())->is_perm(), "should be in perm"); if (blk->should_remember_klasses() && (mr.contains(k->adr_subklass()) || mr.contains(k->adr_next_sibling()))) { blk->remember_klass(k); } obj->oop_iterate_header(blk, mr); return size; }
int compiledICHolderKlass::oop_oop_iterate(oop obj, OopClosure* blk) { assert(obj->is_compiledICHolder(), "must be compiledICHolder"); compiledICHolderOop c = compiledICHolderOop(obj); // Get size before changing pointers. // Don't call size() or oop_size() since that is a virtual call. int size = c->object_size(); obj->oop_iterate_header(blk); blk->do_oop(c->adr_holder_method()); blk->do_oop(c->adr_holder_klass()); return size; }
int methodDataKlass::oop_oop_iterate(oop obj, OopClosure* blk) { assert (obj->is_methodData(), "object must be method data"); methodDataOop m = methodDataOop(obj); // Get size before changing pointers // Don't call size() or oop_size() since that is a virtual call. int size = m->object_size(); obj->oop_iterate_header(blk); blk->do_oop(m->adr_method()); ResourceMark rm; for (ProfileData* data = m->first_data(); m->is_valid(data); data = m->next_data(data)) { data->oop_iterate(blk); } return size; }
int compiledICHolderKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { assert(obj->is_compiledICHolder(), "must be compiledICHolder"); compiledICHolderOop c = compiledICHolderOop(obj); // Get size before changing pointers. // Don't call size() or oop_size() since that is a virtual call. int size = c->object_size(); obj->oop_iterate_header(blk, mr); oop* adr; adr = c->adr_holder_method(); if (mr.contains(adr)) blk->do_oop(adr); adr = c->adr_holder_klass(); if (mr.contains(adr)) blk->do_oop(adr); return size; }
void do_object(oop obj) { obj->oop_iterate_header(&resolve); obj->oop_iterate(&resolve); assert(obj->klass()->is_shared(), "Klass not pointing into shared space."); // If the object is a Java object or class which might (in the // future) contain a reference to a young gen object, add it to the // list. if (obj->is_klass() || obj->is_instance()) { if (obj->is_klass() || obj->is_a(SystemDictionary::Class_klass()) || obj->is_a(SystemDictionary::Throwable_klass())) { // Do nothing } else if (obj->is_a(SystemDictionary::String_klass())) { // immutable objects. } else { // someone added an object we hadn't accounted for. ShouldNotReachHere(); } } }