< prev index next >

src/share/vm/memory/referenceProcessor.cpp

Print this page




1179   HeapWord* const discovered_addr = java_lang_ref_Reference::discovered_addr(obj);
1180   const oop  discovered = java_lang_ref_Reference::discovered(obj);
1181   assert(discovered->is_oop_or_null(), "bad discovered field");
1182   if (discovered != NULL) {
1183     // The reference has already been discovered...
1184     if (TraceReferenceGC) {
1185       gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)",
1186                              (void *)obj, obj->klass()->internal_name());
1187     }
1188     if (RefDiscoveryPolicy == ReferentBasedDiscovery) {
1189       // assumes that an object is not processed twice;
1190       // if it's been already discovered it must be on another
1191       // generation's discovered list; so we won't discover it.
1192       return false;
1193     } else {
1194       assert(RefDiscoveryPolicy == ReferenceBasedDiscovery,
1195              "Unrecognized policy");
1196       // Check assumption that an object is not potentially
1197       // discovered twice except by concurrent collectors that potentially
1198       // trace the same Reference object twice.
1199       assert(UseConcMarkSweepGC || UseG1GC,
1200              "Only possible with a concurrent marking collector");
1201       return true;
1202     }
1203   }
1204 
1205   if (RefDiscoveryPolicy == ReferentBasedDiscovery) {
1206     verify_referent(obj);
1207     // Discover if and only if EITHER:
1208     // .. reference is in our span, OR
1209     // .. we are an atomic collector and referent is in our span
1210     if (_span.contains(obj_addr) ||
1211         (discovery_is_atomic() &&
1212          _span.contains(java_lang_ref_Reference::referent(obj)))) {
1213       // should_enqueue = true;
1214     } else {
1215       return false;
1216     }
1217   } else {
1218     assert(RefDiscoveryPolicy == ReferenceBasedDiscovery &&
1219            _span.contains(obj_addr), "code inconsistency");




1179   HeapWord* const discovered_addr = java_lang_ref_Reference::discovered_addr(obj);
1180   const oop  discovered = java_lang_ref_Reference::discovered(obj);
1181   assert(discovered->is_oop_or_null(), "bad discovered field");
1182   if (discovered != NULL) {
1183     // The reference has already been discovered...
1184     if (TraceReferenceGC) {
1185       gclog_or_tty->print_cr("Already discovered reference (" INTPTR_FORMAT ": %s)",
1186                              (void *)obj, obj->klass()->internal_name());
1187     }
1188     if (RefDiscoveryPolicy == ReferentBasedDiscovery) {
1189       // assumes that an object is not processed twice;
1190       // if it's been already discovered it must be on another
1191       // generation's discovered list; so we won't discover it.
1192       return false;
1193     } else {
1194       assert(RefDiscoveryPolicy == ReferenceBasedDiscovery,
1195              "Unrecognized policy");
1196       // Check assumption that an object is not potentially
1197       // discovered twice except by concurrent collectors that potentially
1198       // trace the same Reference object twice.
1199       assert(UseConcMarkSweepGC || UseG1GC || UseShenandoahGC,
1200              "Only possible with a concurrent marking collector");
1201       return true;
1202     }
1203   }
1204 
1205   if (RefDiscoveryPolicy == ReferentBasedDiscovery) {
1206     verify_referent(obj);
1207     // Discover if and only if EITHER:
1208     // .. reference is in our span, OR
1209     // .. we are an atomic collector and referent is in our span
1210     if (_span.contains(obj_addr) ||
1211         (discovery_is_atomic() &&
1212          _span.contains(java_lang_ref_Reference::referent(obj)))) {
1213       // should_enqueue = true;
1214     } else {
1215       return false;
1216     }
1217   } else {
1218     assert(RefDiscoveryPolicy == ReferenceBasedDiscovery &&
1219            _span.contains(obj_addr), "code inconsistency");


< prev index next >