< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp

Print this page

26 #define SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_HPP
27 
28 #include "memory/allocation.hpp"
29 #include "memory/virtualspace.hpp"
30 #include "gc/shenandoah/shenandoahHeap.hpp"
31 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
32 #include "gc/shenandoah/shenandoahPadding.hpp"
33 
34 class ShenandoahCollectionSet : public CHeapObj<mtGC> {
35   friend class ShenandoahHeap;
36 private:
37   size_t const          _map_size;
38   size_t const          _region_size_bytes_shift;
39   ReservedSpace         _map_space;
40   char* const           _cset_map;
41   // Bias cset map's base address for fast test if an oop is in cset
42   char* const           _biased_cset_map;
43 
44   ShenandoahHeap* const _heap;
45 

46   size_t                _garbage;
47   size_t                _used;
48   size_t                _region_count;
49 
50   shenandoah_padding(0);
51   volatile size_t       _current_index;
52   shenandoah_padding(1);
53 
54 public:
55   ShenandoahCollectionSet(ShenandoahHeap* heap, ReservedSpace space, char* heap_base);
56 
57   // Add region to collection set
58   void add_region(ShenandoahHeapRegion* r);
59 
60   // MT version
61   ShenandoahHeapRegion* claim_next();
62 
63   // Single-thread version
64   ShenandoahHeapRegion* next();
65 
66   size_t count()  const { return _region_count; }
67   bool is_empty() const { return _region_count == 0; }
68 
69   void clear_current_index() {
70     _current_index = 0;
71   }
72 
73   inline bool is_in(ShenandoahHeapRegion* r) const;
74   inline bool is_in(size_t region_idx)       const;
75   inline bool is_in(oop obj)                 const;
76   inline bool is_in_loc(void* loc)           const;
77 
78   void print_on(outputStream* out) const;
79 
80   size_t used()      const { return _used; }
81   size_t garbage()   const { return _garbage;   }


82   void clear();
83 
84 private:
85   char* map_address() const {
86     return _cset_map;
87   }
88   char* biased_map_address() const {
89     return _biased_cset_map;
90   }
91 };
92 
93 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_HPP

26 #define SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_HPP
27 
28 #include "memory/allocation.hpp"
29 #include "memory/virtualspace.hpp"
30 #include "gc/shenandoah/shenandoahHeap.hpp"
31 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
32 #include "gc/shenandoah/shenandoahPadding.hpp"
33 
34 class ShenandoahCollectionSet : public CHeapObj<mtGC> {
35   friend class ShenandoahHeap;
36 private:
37   size_t const          _map_size;
38   size_t const          _region_size_bytes_shift;
39   ReservedSpace         _map_space;
40   char* const           _cset_map;
41   // Bias cset map's base address for fast test if an oop is in cset
42   char* const           _biased_cset_map;
43 
44   ShenandoahHeap* const _heap;
45 
46   bool                  _has_old_regions;
47   size_t                _garbage;
48   size_t                _used;
49   size_t                _region_count;
50 
51   shenandoah_padding(0);
52   volatile size_t       _current_index;
53   shenandoah_padding(1);
54 
55 public:
56   ShenandoahCollectionSet(ShenandoahHeap* heap, ReservedSpace space, char* heap_base);
57 
58   // Add region to collection set
59   void add_region(ShenandoahHeapRegion* r);
60 
61   // MT version
62   ShenandoahHeapRegion* claim_next();
63 
64   // Single-thread version
65   ShenandoahHeapRegion* next();
66 
67   size_t count()  const { return _region_count; }
68   bool is_empty() const { return _region_count == 0; }
69 
70   void clear_current_index() {
71     _current_index = 0;
72   }
73 
74   inline bool is_in(ShenandoahHeapRegion* r) const;
75   inline bool is_in(size_t region_idx)       const;
76   inline bool is_in(oop obj)                 const;
77   inline bool is_in_loc(void* loc)           const;
78 
79   void print_on(outputStream* out) const;
80 
81   bool has_old_regions() const { return _has_old_regions; }
82   size_t used()          const { return _used; }
83 
84   size_t garbage()       const { return _garbage; }
85   void clear();
86 
87 private:
88   char* map_address() const {
89     return _cset_map;
90   }
91   char* biased_map_address() const {
92     return _biased_cset_map;
93   }
94 };
95 
96 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_HPP
< prev index next >