src/hotspot/share/gc/g1/g1EdenRegions.hpp
changeset 54467 0c5d713cf43f
parent 53244 9807daeb47c4
child 59062 6530de931b8e
equal deleted inserted replaced
54466:58751415d5f8 54467:0c5d713cf43f
    29 #include "runtime/globals.hpp"
    29 #include "runtime/globals.hpp"
    30 #include "utilities/debug.hpp"
    30 #include "utilities/debug.hpp"
    31 
    31 
    32 class G1EdenRegions {
    32 class G1EdenRegions {
    33 private:
    33 private:
    34   int _length;
    34   int    _length;
       
    35   // Sum of used bytes from all retired eden regions.
       
    36   // I.e. updated when mutator regions are retired.
       
    37   volatile size_t _used_bytes;
    35 
    38 
    36 public:
    39 public:
    37   G1EdenRegions() : _length(0) {}
    40   G1EdenRegions() : _length(0), _used_bytes(0) { }
    38 
    41 
    39   void add(HeapRegion* hr) {
    42   void add(HeapRegion* hr) {
    40     assert(!hr->is_eden(), "should not already be set");
    43     assert(!hr->is_eden(), "should not already be set");
    41     _length++;
    44     _length++;
    42   }
    45   }
    43 
    46 
    44   void clear() { _length = 0; }
    47   void clear() { _length = 0; _used_bytes = 0; }
    45 
    48 
    46   uint length() const { return _length; }
    49   uint length() const { return _length; }
       
    50 
       
    51   size_t used_bytes() const { return _used_bytes; }
       
    52 
       
    53   void add_used_bytes(size_t used_bytes) {
       
    54     _used_bytes += used_bytes;
       
    55   }
    47 };
    56 };
    48 
    57 
    49 #endif // SHARE_GC_G1_G1EDENREGIONS_HPP
    58 #endif // SHARE_GC_G1_G1EDENREGIONS_HPP