< prev index next >

src/hotspot/share/gc/parallel/psCompactionManager.cpp

Print this page
rev 50093 : [mq]: pp2_work


 183 
 184 template <class T>
 185 static void oop_pc_follow_contents_specialized(InstanceRefKlass* klass, oop obj, ParCompactionManager* cm) {
 186   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr_raw(obj);
 187   T heap_oop = RawAccess<>::oop_load(referent_addr);
 188   log_develop_trace(gc, ref)("InstanceRefKlass::oop_pc_follow_contents " PTR_FORMAT, p2i(obj));
 189   if (!CompressedOops::is_null(heap_oop)) {
 190     oop referent = CompressedOops::decode_not_null(heap_oop);
 191     if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) &&
 192         PSParallelCompact::ref_processor()->discover_reference(obj, klass->reference_type())) {
 193       // reference already enqueued, referent will be traversed later
 194       klass->InstanceKlass::oop_pc_follow_contents(obj, cm);
 195       log_develop_trace(gc, ref)("       Non NULL enqueued " PTR_FORMAT, p2i(obj));
 196       return;
 197     } else {
 198       // treat referent as normal oop
 199       log_develop_trace(gc, ref)("       Non NULL normal " PTR_FORMAT, p2i(obj));
 200       cm->mark_and_push(referent_addr);
 201     }
 202   }
 203   T* next_addr = (T*)java_lang_ref_Reference::next_addr_raw(obj);
 204   // Treat discovered as normal oop, if ref is not "active",
 205   // i.e. if next is non-NULL.
 206   T  next_oop = RawAccess<>::oop_load(next_addr);
 207   if (!CompressedOops::is_null(next_oop)) { // i.e. ref is not "active"
 208     T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
 209     log_develop_trace(gc, ref)("   Process discovered as normal " PTR_FORMAT, p2i(discovered_addr));
 210     cm->mark_and_push(discovered_addr);
 211   }
 212   cm->mark_and_push(next_addr);
 213   klass->InstanceKlass::oop_pc_follow_contents(obj, cm);
 214 }
 215 
 216 
 217 void InstanceRefKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
 218   if (UseCompressedOops) {
 219     oop_pc_follow_contents_specialized<narrowOop>(this, obj, cm);
 220   } else {
 221     oop_pc_follow_contents_specialized<oop>(this, obj, cm);
 222   }
 223 }
 224 
 225 void ObjArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
 226   cm->follow_klass(this);
 227 
 228   if (UseCompressedOops) {
 229     oop_pc_follow_contents_specialized<narrowOop>(objArrayOop(obj), 0, cm);
 230   } else {
 231     oop_pc_follow_contents_specialized<oop>(objArrayOop(obj), 0, cm);
 232   }




 183 
 184 template <class T>
 185 static void oop_pc_follow_contents_specialized(InstanceRefKlass* klass, oop obj, ParCompactionManager* cm) {
 186   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr_raw(obj);
 187   T heap_oop = RawAccess<>::oop_load(referent_addr);
 188   log_develop_trace(gc, ref)("InstanceRefKlass::oop_pc_follow_contents " PTR_FORMAT, p2i(obj));
 189   if (!CompressedOops::is_null(heap_oop)) {
 190     oop referent = CompressedOops::decode_not_null(heap_oop);
 191     if (PSParallelCompact::mark_bitmap()->is_unmarked(referent) &&
 192         PSParallelCompact::ref_processor()->discover_reference(obj, klass->reference_type())) {
 193       // reference already enqueued, referent will be traversed later
 194       klass->InstanceKlass::oop_pc_follow_contents(obj, cm);
 195       log_develop_trace(gc, ref)("       Non NULL enqueued " PTR_FORMAT, p2i(obj));
 196       return;
 197     } else {
 198       // treat referent as normal oop
 199       log_develop_trace(gc, ref)("       Non NULL normal " PTR_FORMAT, p2i(obj));
 200       cm->mark_and_push(referent_addr);
 201     }
 202   }
 203   // Treat discovered as normal oop.




 204   T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);

 205   cm->mark_and_push(discovered_addr);


 206   klass->InstanceKlass::oop_pc_follow_contents(obj, cm);
 207 }
 208 
 209 
 210 void InstanceRefKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
 211   if (UseCompressedOops) {
 212     oop_pc_follow_contents_specialized<narrowOop>(this, obj, cm);
 213   } else {
 214     oop_pc_follow_contents_specialized<oop>(this, obj, cm);
 215   }
 216 }
 217 
 218 void ObjArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
 219   cm->follow_klass(this);
 220 
 221   if (UseCompressedOops) {
 222     oop_pc_follow_contents_specialized<narrowOop>(objArrayOop(obj), 0, cm);
 223   } else {
 224     oop_pc_follow_contents_specialized<oop>(objArrayOop(obj), 0, cm);
 225   }


< prev index next >