26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPARALLELCOMPACT_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPARALLELCOMPACT_HPP |
27 |
27 |
28 #include "gc_implementation/parallelScavenge/objectStartArray.hpp" |
28 #include "gc_implementation/parallelScavenge/objectStartArray.hpp" |
29 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
29 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
30 #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp" |
30 #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp" |
31 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp" |
|
32 #include "gc_implementation/shared/collectorCounters.hpp" |
31 #include "gc_implementation/shared/collectorCounters.hpp" |
33 #include "gc_implementation/shared/mutableSpace.hpp" |
32 #include "gc_implementation/shared/mutableSpace.hpp" |
34 #include "gc_interface/collectedHeap.hpp" |
33 #include "gc_interface/collectedHeap.hpp" |
35 #include "oops/oop.hpp" |
34 #include "oops/oop.hpp" |
36 |
35 |
931 class IsAliveClosure: public BoolObjectClosure { |
930 class IsAliveClosure: public BoolObjectClosure { |
932 public: |
931 public: |
933 virtual bool do_object_b(oop p); |
932 virtual bool do_object_b(oop p); |
934 }; |
933 }; |
935 |
934 |
936 class FollowStackClosure: public VoidClosure { |
|
937 private: |
|
938 ParCompactionManager* _compaction_manager; |
|
939 public: |
|
940 FollowStackClosure(ParCompactionManager* cm) : _compaction_manager(cm) { } |
|
941 virtual void do_void(); |
|
942 }; |
|
943 |
|
944 class AdjustPointerClosure: public ExtendedOopClosure { |
935 class AdjustPointerClosure: public ExtendedOopClosure { |
945 public: |
936 public: |
946 template <typename T> void do_oop_nv(T* p); |
937 template <typename T> void do_oop_nv(T* p); |
947 virtual void do_oop(oop* p); |
938 virtual void do_oop(oop* p); |
948 virtual void do_oop(narrowOop* p); |
939 virtual void do_oop(narrowOop* p); |
954 class AdjustKlassClosure : public KlassClosure { |
945 class AdjustKlassClosure : public KlassClosure { |
955 public: |
946 public: |
956 void do_klass(Klass* klass); |
947 void do_klass(Klass* klass); |
957 }; |
948 }; |
958 |
949 |
959 friend class FollowStackClosure; |
|
960 friend class AdjustPointerClosure; |
950 friend class AdjustPointerClosure; |
961 friend class AdjustKlassClosure; |
951 friend class AdjustKlassClosure; |
962 friend class FollowKlassClosure; |
|
963 friend class InstanceClassLoaderKlass; |
|
964 friend class RefProcTaskProxy; |
952 friend class RefProcTaskProxy; |
965 |
953 |
966 private: |
954 private: |
967 static STWGCTimer _gc_timer; |
955 static STWGCTimer _gc_timer; |
968 static ParallelOldTracer _gc_tracer; |
956 static ParallelOldTracer _gc_tracer; |
1125 |
1113 |
1126 // Reset time since last full gc |
1114 // Reset time since last full gc |
1127 static void reset_millis_since_last_gc(); |
1115 static void reset_millis_since_last_gc(); |
1128 |
1116 |
1129 public: |
1117 public: |
1130 class MarkAndPushClosure: public ExtendedOopClosure { |
|
1131 private: |
|
1132 ParCompactionManager* _compaction_manager; |
|
1133 public: |
|
1134 MarkAndPushClosure(ParCompactionManager* cm) : _compaction_manager(cm) { } |
|
1135 |
|
1136 template <typename T> void do_oop_nv(T* p); |
|
1137 virtual void do_oop(oop* p); |
|
1138 virtual void do_oop(narrowOop* p); |
|
1139 |
|
1140 // This closure provides its own oop verification code. |
|
1141 debug_only(virtual bool should_verify_oops() { return false; }) |
|
1142 }; |
|
1143 |
|
1144 // The one and only place to start following the classes. |
|
1145 // Should only be applied to the ClassLoaderData klasses list. |
|
1146 class FollowKlassClosure : public KlassClosure { |
|
1147 private: |
|
1148 MarkAndPushClosure* _mark_and_push_closure; |
|
1149 public: |
|
1150 FollowKlassClosure(MarkAndPushClosure* mark_and_push_closure) : |
|
1151 _mark_and_push_closure(mark_and_push_closure) { } |
|
1152 void do_klass(Klass* klass); |
|
1153 }; |
|
1154 |
1118 |
1155 PSParallelCompact(); |
1119 PSParallelCompact(); |
1156 |
1120 |
1157 static void invoke(bool maximum_heap_compaction); |
1121 static void invoke(bool maximum_heap_compaction); |
1158 static bool invoke_no_policy(bool maximum_heap_compaction); |
1122 static bool invoke_no_policy(bool maximum_heap_compaction); |
1180 static GCTaskManager* const gc_task_manager(); |
1144 static GCTaskManager* const gc_task_manager(); |
1181 |
1145 |
1182 // Marking support |
1146 // Marking support |
1183 static inline bool mark_obj(oop obj); |
1147 static inline bool mark_obj(oop obj); |
1184 static inline bool is_marked(oop obj); |
1148 static inline bool is_marked(oop obj); |
1185 // Check mark and maybe push on marking stack |
1149 |
1186 template <class T> static inline void mark_and_push(ParCompactionManager* cm, |
|
1187 T* p); |
|
1188 template <class T> static inline void adjust_pointer(T* p); |
1150 template <class T> static inline void adjust_pointer(T* p); |
1189 |
|
1190 static inline void follow_klass(ParCompactionManager* cm, Klass* klass); |
|
1191 |
|
1192 static void follow_class_loader(ParCompactionManager* cm, |
|
1193 ClassLoaderData* klass); |
|
1194 |
1151 |
1195 // Compaction support. |
1152 // Compaction support. |
1196 // Return true if p is in the range [beg_addr, end_addr). |
1153 // Return true if p is in the range [beg_addr, end_addr). |
1197 static inline bool is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr); |
1154 static inline bool is_in(HeapWord* p, HeapWord* beg_addr, HeapWord* end_addr); |
1198 static inline bool is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr); |
1155 static inline bool is_in(oop* p, HeapWord* beg_addr, HeapWord* end_addr); |