< prev index next >

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

Print this page

13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHMARK_HPP
26 #define SHARE_GC_SHENANDOAH_SHENANDOAHMARK_HPP
27 
28 #include "gc/shared/stringdedup/stringDedup.hpp"
29 #include "gc/shared/taskTerminator.hpp"
30 #include "gc/shenandoah/shenandoahOopClosures.hpp"
31 #include "gc/shenandoah/shenandoahTaskqueue.hpp"
32 
33 class ShenandoahCMDrainMarkingStackClosure;
34 
35 // Base class for mark
36 // Mark class does not maintain states. Instead, mark states are
37 // maintained by task queues, mark bitmap and SATB buffers (concurrent mark)
38 class ShenandoahMark: public StackObj {
39   friend class ShenandoahCMDrainMarkingStackClosure;
40 
41 protected:

42   ShenandoahObjToScanQueueSet* const _task_queues;

43 
44 protected:
45   ShenandoahMark();
46 
47 public:
48   template<class T>
49   static inline void mark_through_ref(T* p, ShenandoahObjToScanQueue* q, ShenandoahMarkingContext* const mark_context, bool weak);
50 
51   static void clear();
52 
53   // Helpers
54   inline ShenandoahObjToScanQueueSet* task_queues() const;




55   inline ShenandoahObjToScanQueue* get_queue(uint index) const;



56 
57 // ---------- Marking loop and tasks
58 private:
59   template <class T, StringDedupMode STRING_DEDUP>
60   inline void do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveData* live_data, StringDedup::Requests* const req, ShenandoahMarkTask* task);
61 
62   template <class T>
63   inline void do_chunked_array_start(ShenandoahObjToScanQueue* q, T* cl, oop array, bool weak);
64 
65   template <class T>
66   inline void do_chunked_array(ShenandoahObjToScanQueue* q, T* cl, oop array, int chunk, int pow, bool weak);
67 
68   inline void count_liveness(ShenandoahLiveData* live_data, oop obj);
69 
70   template <class T, bool CANCELLABLE,StringDedupMode STRING_DEDUP>
71   void mark_loop_work(T* cl, ShenandoahLiveData* live_data, uint worker_id, TaskTerminator *t, StringDedup::Requests* const req);
72 
73   template <bool CANCELLABLE, StringDedupMode STRING_DEDUP>
74   void mark_loop_prework(uint worker_id, TaskTerminator *terminator, ShenandoahReferenceProcessor *rp, StringDedup::Requests* const req);







75 
76   template <StringDedupMode STRING_DEDUP>
77   inline void dedup_string(oop obj, StringDedup::Requests* const req);
78 protected:
79   void mark_loop(uint worker_id, TaskTerminator* terminator, ShenandoahReferenceProcessor *rp,




80                  bool cancellable, StringDedupMode dedup_mode, StringDedup::Requests* const req);
81 };
82 
83 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHMARK_HPP
84 

13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHMARK_HPP
26 #define SHARE_GC_SHENANDOAH_SHENANDOAHMARK_HPP
27 
28 #include "gc/shared/stringdedup/stringDedup.hpp"
29 #include "gc/shared/taskTerminator.hpp"
30 #include "gc/shenandoah/shenandoahOopClosures.hpp"
31 #include "gc/shenandoah/shenandoahTaskqueue.hpp"
32 


33 // Base class for mark
34 // Mark class does not maintain states. Instead, mark states are
35 // maintained by task queues, mark bitmap and SATB buffers (concurrent mark)
36 class ShenandoahMark: public StackObj {

37 
38 protected:
39   ShenandoahGeneration* const _generation;
40   ShenandoahObjToScanQueueSet* const _task_queues;
41   ShenandoahObjToScanQueueSet* const _old_gen_task_queues;
42 
43 protected:
44   ShenandoahMark(ShenandoahGeneration* generation);
45 
46 public:
47   template<class T, GenerationMode GENERATION>
48   static inline void mark_through_ref(T* p, ShenandoahObjToScanQueue* q, ShenandoahObjToScanQueue* old, ShenandoahMarkingContext* const mark_context, bool weak);


49 
50   // Helpers
51   inline ShenandoahObjToScanQueueSet* task_queues() const;
52   ShenandoahObjToScanQueueSet* old_task_queues() {
53     return _old_gen_task_queues;
54   }
55 
56   inline ShenandoahObjToScanQueue* get_queue(uint index) const;
57   inline ShenandoahObjToScanQueue* get_old_queue(uint index) const;
58 
59   inline ShenandoahGeneration* generation() { return _generation; };
60 
61 // ---------- Marking loop and tasks
62 private:
63   template <class T, StringDedupMode STRING_DEDUP>
64   inline void do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveData* live_data, StringDedup::Requests* const req, ShenandoahMarkTask* task);
65 
66   template <class T>
67   inline void do_chunked_array_start(ShenandoahObjToScanQueue* q, T* cl, oop array, bool weak);
68 
69   template <class T>
70   inline void do_chunked_array(ShenandoahObjToScanQueue* q, T* cl, oop array, int chunk, int pow, bool weak);
71 
72   inline void count_liveness(ShenandoahLiveData* live_data, oop obj);
73 
74   template <class T, GenerationMode GENERATION, bool CANCELLABLE, StringDedupMode STRING_DEDUP>
75   void mark_loop_work(T* cl, ShenandoahLiveData* live_data, uint worker_id, TaskTerminator *t, StringDedup::Requests* const req);
76 
77   template <GenerationMode GENERATION, bool CANCELLABLE, StringDedupMode STRING_DEDUP>
78   void mark_loop_prework(uint worker_id, TaskTerminator *terminator, ShenandoahReferenceProcessor *rp, StringDedup::Requests* const req, bool update_refs);
79 
80   template <GenerationMode GENERATION>
81   static bool in_generation(oop obj);
82 
83   static void mark_ref(ShenandoahObjToScanQueue* q,
84                        ShenandoahMarkingContext* const mark_context,
85                        bool weak, oop obj);
86 
87   template <StringDedupMode STRING_DEDUP>
88   inline void dedup_string(oop obj, StringDedup::Requests* const req);
89 protected:
90   template<bool CANCELLABLE, StringDedupMode STRING_DEDUP>
91   void mark_loop(GenerationMode generation, uint worker_id, TaskTerminator* terminator, ShenandoahReferenceProcessor *rp,
92                  StringDedup::Requests* const req);
93 
94   void mark_loop(GenerationMode generation, uint worker_id, TaskTerminator* terminator, ShenandoahReferenceProcessor *rp,
95                  bool cancellable, StringDedupMode dedup_mode, StringDedup::Requests* const req);
96 };
97 
98 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHMARK_HPP
99 
< prev index next >