hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp
changeset 32193 862a68285b1e
parent 32187 0891f3fa84fc
child 32360 86790204fc23
equal deleted inserted replaced
32190:acf684680d24 32193:862a68285b1e
   184   friend class VM_G1IncCollectionPause;
   184   friend class VM_G1IncCollectionPause;
   185   friend class VMStructs;
   185   friend class VMStructs;
   186   friend class MutatorAllocRegion;
   186   friend class MutatorAllocRegion;
   187   friend class SurvivorGCAllocRegion;
   187   friend class SurvivorGCAllocRegion;
   188   friend class OldGCAllocRegion;
   188   friend class OldGCAllocRegion;
   189   friend class G1Allocator;
       
   190   friend class G1ArchiveAllocator;
       
   191 
   189 
   192   // Closures used in implementation.
   190   // Closures used in implementation.
   193   friend class G1ParScanThreadState;
   191   friend class G1ParScanThreadState;
   194   friend class G1ParTask;
   192   friend class G1ParTask;
   195   friend class G1PLABAllocator;
   193   friend class G1PLABAllocator;
   532   // or not.
   530   // or not.
   533   HeapWord* attempt_allocation_at_safepoint(size_t word_size,
   531   HeapWord* attempt_allocation_at_safepoint(size_t word_size,
   534                                             AllocationContext_t context,
   532                                             AllocationContext_t context,
   535                                             bool expect_null_mutator_alloc_region);
   533                                             bool expect_null_mutator_alloc_region);
   536 
   534 
   537   // It dirties the cards that cover the block so that so that the post
       
   538   // write barrier never queues anything when updating objects on this
       
   539   // block. It is assumed (and in fact we assert) that the block
       
   540   // belongs to a young region.
       
   541   inline void dirty_young_block(HeapWord* start, size_t word_size);
       
   542 
       
   543   // These methods are the "callbacks" from the G1AllocRegion class.
   535   // These methods are the "callbacks" from the G1AllocRegion class.
   544 
   536 
   545   // For mutator alloc regions.
   537   // For mutator alloc regions.
   546   HeapRegion* new_mutator_alloc_region(size_t word_size, bool force);
   538   HeapRegion* new_mutator_alloc_region(size_t word_size, bool force);
   547   void retire_mutator_alloc_region(HeapRegion* alloc_region,
   539   void retire_mutator_alloc_region(HeapRegion* alloc_region,
   550   // For GC alloc regions.
   542   // For GC alloc regions.
   551   HeapRegion* new_gc_alloc_region(size_t word_size, uint count,
   543   HeapRegion* new_gc_alloc_region(size_t word_size, uint count,
   552                                   InCSetState dest);
   544                                   InCSetState dest);
   553   void retire_gc_alloc_region(HeapRegion* alloc_region,
   545   void retire_gc_alloc_region(HeapRegion* alloc_region,
   554                               size_t allocated_bytes, InCSetState dest);
   546                               size_t allocated_bytes, InCSetState dest);
   555 
       
   556   // Allocate the highest free region in the reserved heap. This will commit
       
   557   // regions as necessary.
       
   558   HeapRegion* alloc_highest_free_region();
       
   559 
   547 
   560   // - if explicit_gc is true, the GC is for a System.gc() or a heap
   548   // - if explicit_gc is true, the GC is for a System.gc() or a heap
   561   //   inspection request and should collect the entire heap
   549   //   inspection request and should collect the entire heap
   562   // - if clear_all_soft_refs is true, all soft references should be
   550   // - if clear_all_soft_refs is true, all soft references should be
   563   //   cleared during the GC
   551   //   cleared during the GC
   690   G1HRPrinter* hr_printer() { return &_hr_printer; }
   678   G1HRPrinter* hr_printer() { return &_hr_printer; }
   691 
   679 
   692   // Allocates a new heap region instance.
   680   // Allocates a new heap region instance.
   693   HeapRegion* new_heap_region(uint hrs_index, MemRegion mr);
   681   HeapRegion* new_heap_region(uint hrs_index, MemRegion mr);
   694 
   682 
       
   683   // Allocate the highest free region in the reserved heap. This will commit
       
   684   // regions as necessary.
       
   685   HeapRegion* alloc_highest_free_region();
       
   686 
   695   // Frees a non-humongous region by initializing its contents and
   687   // Frees a non-humongous region by initializing its contents and
   696   // adding it to the free list that's passed as a parameter (this is
   688   // adding it to the free list that's passed as a parameter (this is
   697   // usually a local list which will be appended to the master free
   689   // usually a local list which will be appended to the master free
   698   // list later). The used bytes of freed regions are accumulated in
   690   // list later). The used bytes of freed regions are accumulated in
   699   // pre_used. If par is true, the region's RSet will not be freed
   691   // pre_used. If par is true, the region's RSet will not be freed
   702   // care of proper synchronization. This may allow some optimizations.
   694   // care of proper synchronization. This may allow some optimizations.
   703   void free_region(HeapRegion* hr,
   695   void free_region(HeapRegion* hr,
   704                    FreeRegionList* free_list,
   696                    FreeRegionList* free_list,
   705                    bool par,
   697                    bool par,
   706                    bool locked = false);
   698                    bool locked = false);
       
   699 
       
   700   // It dirties the cards that cover the block so that the post
       
   701   // write barrier never queues anything when updating objects on this
       
   702   // block. It is assumed (and in fact we assert) that the block
       
   703   // belongs to a young region.
       
   704   inline void dirty_young_block(HeapWord* start, size_t word_size);
   707 
   705 
   708   // Frees a humongous region by collapsing it into individual regions
   706   // Frees a humongous region by collapsing it into individual regions
   709   // and calling free_region() for each of them. The freed regions
   707   // and calling free_region() for each of them. The freed regions
   710   // will be added to the free list that's passed as a parameter (this
   708   // will be added to the free list that's passed as a parameter (this
   711   // is usually a local list which will be appended to the master free
   709   // is usually a local list which will be appended to the master free
  1181       MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag);
  1179       MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag);
  1182       append_secondary_free_list();
  1180       append_secondary_free_list();
  1183     }
  1181     }
  1184   }
  1182   }
  1185 
  1183 
       
  1184   inline void old_set_add(HeapRegion* hr);
  1186   inline void old_set_remove(HeapRegion* hr);
  1185   inline void old_set_remove(HeapRegion* hr);
  1187 
  1186 
  1188   size_t non_young_capacity_bytes() {
  1187   size_t non_young_capacity_bytes() {
  1189     return _old_set.total_capacity_bytes() + _humongous_set.total_capacity_bytes();
  1188     return _old_set.total_capacity_bytes() + _humongous_set.total_capacity_bytes();
  1190   }
  1189   }