src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp

Print this page
rev 2591 : 6814390: G1: remove the concept of non-generational G1
Summary: Removed the possibility to turn off generational mode for G1.
Reviewed-by: johnc, ysr, tonyp


1246 
1247   virtual bool card_mark_must_follow_store() const {
1248     return true;
1249   }
1250 
1251   bool is_in_young(const oop obj) {
1252     HeapRegion* hr = heap_region_containing(obj);
1253     return hr != NULL && hr->is_young();
1254   }
1255 
1256 #ifdef ASSERT
1257   virtual bool is_in_partial_collection(const void* p);
1258 #endif
1259 
1260   virtual bool is_scavengable(const void* addr);
1261 
1262   // We don't need barriers for initializing stores to objects
1263   // in the young gen: for the SATB pre-barrier, there is no
1264   // pre-value that needs to be remembered; for the remembered-set
1265   // update logging post-barrier, we don't maintain remembered set
1266   // information for young gen objects. Note that non-generational
1267   // G1 does not have any "young" objects, should not elide
1268   // the rs logging barrier and so should always answer false below.
1269   // However, non-generational G1 (-XX:-G1Gen) appears to have
1270   // bit-rotted so was not tested below.
1271   virtual bool can_elide_initializing_store_barrier(oop new_obj) {
1272     // Re 6920090, 6920109 above.
1273     assert(ReduceInitialCardMarksForG1, "Else cannot be here");
1274     assert(G1Gen || !is_in_young(new_obj),
1275            "Non-generational G1 should never return true below");
1276     return is_in_young(new_obj);
1277   }
1278 
1279   // Can a compiler elide a store barrier when it writes
1280   // a permanent oop into the heap?  Applies when the compiler
1281   // is storing x to the heap, where x->is_perm() is true.
1282   virtual bool can_elide_permanent_oop_store_barriers() const {
1283     // At least until perm gen collection is also G1-ified, at
1284     // which point this should return false.
1285     return true;
1286   }
1287 
1288   // Returns "true" iff the given word_size is "very large".
1289   static bool isHumongous(size_t word_size) {
1290     // Note this has to be strictly greater-than as the TLABs
1291     // are capped at the humongous thresold and we want to
1292     // ensure that we don't try to allocate a TLAB as
1293     // humongous and that we don't allocate a humongous
1294     // object in a TLAB.
1295     return word_size > _humongous_object_threshold_in_words;


1371 
1372   YoungList* young_list() { return _young_list; }
1373 
1374   // debugging
1375   bool check_young_list_well_formed() {
1376     return _young_list->check_list_well_formed();
1377   }
1378 
1379   bool check_young_list_empty(bool check_heap,
1380                               bool check_sample = true);
1381 
1382   // *** Stuff related to concurrent marking.  It's not clear to me that so
1383   // many of these need to be public.
1384 
1385   // The functions below are helper functions that a subclass of
1386   // "CollectedHeap" can use in the implementation of its virtual
1387   // functions.
1388   // This performs a concurrent marking of the live objects in a
1389   // bitmap off to the side.
1390   void doConcurrentMark();
1391 
1392   // Do a full concurrent marking, synchronously.
1393   void do_sync_mark();
1394 
1395   bool isMarkedPrev(oop obj) const;
1396   bool isMarkedNext(oop obj) const;
1397 
1398   // vo == UsePrevMarking -> use "prev" marking information,
1399   // vo == UseNextMarking -> use "next" marking information,
1400   // vo == UseMarkWord    -> use mark word from object header
1401   bool is_obj_dead_cond(const oop obj,
1402                         const HeapRegion* hr,
1403                         const VerifyOption vo) const {
1404 
1405     switch (vo) {
1406       case VerifyOption_G1UsePrevMarking:
1407         return is_obj_dead(obj, hr);
1408       case VerifyOption_G1UseNextMarking:
1409         return is_obj_ill(obj, hr);
1410       default:
1411         assert(vo == VerifyOption_G1UseMarkWord, "must be");
1412         return !obj->is_gc_marked();
1413     }




1246 
1247   virtual bool card_mark_must_follow_store() const {
1248     return true;
1249   }
1250 
1251   bool is_in_young(const oop obj) {
1252     HeapRegion* hr = heap_region_containing(obj);
1253     return hr != NULL && hr->is_young();
1254   }
1255 
1256 #ifdef ASSERT
1257   virtual bool is_in_partial_collection(const void* p);
1258 #endif
1259 
1260   virtual bool is_scavengable(const void* addr);
1261 
1262   // We don't need barriers for initializing stores to objects
1263   // in the young gen: for the SATB pre-barrier, there is no
1264   // pre-value that needs to be remembered; for the remembered-set
1265   // update logging post-barrier, we don't maintain remembered set
1266   // information for young gen objects.




1267   virtual bool can_elide_initializing_store_barrier(oop new_obj) {
1268     // Re 6920090, 6920109 above.
1269     assert(ReduceInitialCardMarksForG1, "Else cannot be here");


1270     return is_in_young(new_obj);
1271   }
1272 
1273   // Can a compiler elide a store barrier when it writes
1274   // a permanent oop into the heap?  Applies when the compiler
1275   // is storing x to the heap, where x->is_perm() is true.
1276   virtual bool can_elide_permanent_oop_store_barriers() const {
1277     // At least until perm gen collection is also G1-ified, at
1278     // which point this should return false.
1279     return true;
1280   }
1281 
1282   // Returns "true" iff the given word_size is "very large".
1283   static bool isHumongous(size_t word_size) {
1284     // Note this has to be strictly greater-than as the TLABs
1285     // are capped at the humongous thresold and we want to
1286     // ensure that we don't try to allocate a TLAB as
1287     // humongous and that we don't allocate a humongous
1288     // object in a TLAB.
1289     return word_size > _humongous_object_threshold_in_words;


1365 
1366   YoungList* young_list() { return _young_list; }
1367 
1368   // debugging
1369   bool check_young_list_well_formed() {
1370     return _young_list->check_list_well_formed();
1371   }
1372 
1373   bool check_young_list_empty(bool check_heap,
1374                               bool check_sample = true);
1375 
1376   // *** Stuff related to concurrent marking.  It's not clear to me that so
1377   // many of these need to be public.
1378 
1379   // The functions below are helper functions that a subclass of
1380   // "CollectedHeap" can use in the implementation of its virtual
1381   // functions.
1382   // This performs a concurrent marking of the live objects in a
1383   // bitmap off to the side.
1384   void doConcurrentMark();



1385 
1386   bool isMarkedPrev(oop obj) const;
1387   bool isMarkedNext(oop obj) const;
1388 
1389   // vo == UsePrevMarking -> use "prev" marking information,
1390   // vo == UseNextMarking -> use "next" marking information,
1391   // vo == UseMarkWord    -> use mark word from object header
1392   bool is_obj_dead_cond(const oop obj,
1393                         const HeapRegion* hr,
1394                         const VerifyOption vo) const {
1395 
1396     switch (vo) {
1397       case VerifyOption_G1UsePrevMarking:
1398         return is_obj_dead(obj, hr);
1399       case VerifyOption_G1UseNextMarking:
1400         return is_obj_ill(obj, hr);
1401       default:
1402         assert(vo == VerifyOption_G1UseMarkWord, "must be");
1403         return !obj->is_gc_marked();
1404     }