797 KeepAliveClosure(ParCompactionManager* cm) : _compaction_manager(cm) { } |
797 KeepAliveClosure(ParCompactionManager* cm) : _compaction_manager(cm) { } |
798 virtual void do_oop(oop* p); |
798 virtual void do_oop(oop* p); |
799 virtual void do_oop(narrowOop* p); |
799 virtual void do_oop(narrowOop* p); |
800 }; |
800 }; |
801 |
801 |
802 // Current unused |
|
803 class FollowRootClosure: public OopsInGenClosure { |
|
804 private: |
|
805 ParCompactionManager* _compaction_manager; |
|
806 public: |
|
807 FollowRootClosure(ParCompactionManager* cm) : _compaction_manager(cm) { } |
|
808 virtual void do_oop(oop* p); |
|
809 virtual void do_oop(narrowOop* p); |
|
810 }; |
|
811 |
|
812 class FollowStackClosure: public VoidClosure { |
802 class FollowStackClosure: public VoidClosure { |
813 private: |
803 private: |
814 ParCompactionManager* _compaction_manager; |
804 ParCompactionManager* _compaction_manager; |
815 public: |
805 public: |
816 FollowStackClosure(ParCompactionManager* cm) : _compaction_manager(cm) { } |
806 FollowStackClosure(ParCompactionManager* cm) : _compaction_manager(cm) { } |
817 virtual void do_void(); |
807 virtual void do_void(); |
818 }; |
808 }; |
819 |
809 |
820 class AdjustPointerClosure: public OopClosure { |
810 class AdjustPointerClosure: public OopClosure { |
821 private: |
|
822 bool _is_root; |
|
823 public: |
811 public: |
824 AdjustPointerClosure(bool is_root) : _is_root(is_root) { } |
|
825 virtual void do_oop(oop* p); |
812 virtual void do_oop(oop* p); |
826 virtual void do_oop(narrowOop* p); |
813 virtual void do_oop(narrowOop* p); |
827 // do not walk from thread stacks to the code cache on this phase |
814 // do not walk from thread stacks to the code cache on this phase |
828 virtual void do_code_blob(CodeBlob* cb) const { } |
815 virtual void do_code_blob(CodeBlob* cb) const { } |
829 }; |
816 }; |
836 friend class KeepAliveClosure; |
823 friend class KeepAliveClosure; |
837 friend class FollowStackClosure; |
824 friend class FollowStackClosure; |
838 friend class AdjustPointerClosure; |
825 friend class AdjustPointerClosure; |
839 friend class AdjustKlassClosure; |
826 friend class AdjustKlassClosure; |
840 friend class FollowKlassClosure; |
827 friend class FollowKlassClosure; |
841 friend class FollowRootClosure; |
|
842 friend class InstanceClassLoaderKlass; |
828 friend class InstanceClassLoaderKlass; |
843 friend class RefProcTaskProxy; |
829 friend class RefProcTaskProxy; |
844 |
830 |
845 private: |
831 private: |
846 static elapsedTimer _accumulated_time; |
832 static elapsedTimer _accumulated_time; |
851 static ParMarkBitMap _mark_bitmap; |
837 static ParMarkBitMap _mark_bitmap; |
852 static ParallelCompactData _summary_data; |
838 static ParallelCompactData _summary_data; |
853 static IsAliveClosure _is_alive_closure; |
839 static IsAliveClosure _is_alive_closure; |
854 static SpaceInfo _space_info[last_space_id]; |
840 static SpaceInfo _space_info[last_space_id]; |
855 static bool _print_phases; |
841 static bool _print_phases; |
856 static AdjustPointerClosure _adjust_root_pointer_closure; |
|
857 static AdjustPointerClosure _adjust_pointer_closure; |
842 static AdjustPointerClosure _adjust_pointer_closure; |
858 static AdjustKlassClosure _adjust_klass_closure; |
843 static AdjustKlassClosure _adjust_klass_closure; |
859 |
844 |
860 // Reference processing (used in ...follow_contents) |
845 // Reference processing (used in ...follow_contents) |
861 static ReferenceProcessor* _ref_processor; |
846 static ReferenceProcessor* _ref_processor; |
886 static void post_compact(); |
871 static void post_compact(); |
887 |
872 |
888 // Mark live objects |
873 // Mark live objects |
889 static void marking_phase(ParCompactionManager* cm, |
874 static void marking_phase(ParCompactionManager* cm, |
890 bool maximum_heap_compaction); |
875 bool maximum_heap_compaction); |
891 |
|
892 template <class T> static inline void adjust_pointer(T* p, bool is_root); |
|
893 static void adjust_root_pointer(oop* p) { adjust_pointer(p, true); } |
|
894 |
876 |
895 template <class T> |
877 template <class T> |
896 static inline void follow_root(ParCompactionManager* cm, T* p); |
878 static inline void follow_root(ParCompactionManager* cm, T* p); |
897 |
879 |
898 // Compute the dense prefix for the designated space. This is an experimental |
880 // Compute the dense prefix for the designated space. This is an experimental |
1044 // in the event of a failure. |
1026 // in the event of a failure. |
1045 static bool initialize(); |
1027 static bool initialize(); |
1046 |
1028 |
1047 // Closure accessors |
1029 // Closure accessors |
1048 static OopClosure* adjust_pointer_closure() { return (OopClosure*)&_adjust_pointer_closure; } |
1030 static OopClosure* adjust_pointer_closure() { return (OopClosure*)&_adjust_pointer_closure; } |
1049 static OopClosure* adjust_root_pointer_closure() { return (OopClosure*)&_adjust_root_pointer_closure; } |
|
1050 static KlassClosure* adjust_klass_closure() { return (KlassClosure*)&_adjust_klass_closure; } |
1031 static KlassClosure* adjust_klass_closure() { return (KlassClosure*)&_adjust_klass_closure; } |
1051 static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&_is_alive_closure; } |
1032 static BoolObjectClosure* is_alive_closure() { return (BoolObjectClosure*)&_is_alive_closure; } |
1052 |
1033 |
1053 // Public accessors |
1034 // Public accessors |
1054 static elapsedTimer* accumulated_time() { return &_accumulated_time; } |
1035 static elapsedTimer* accumulated_time() { return &_accumulated_time; } |
1065 static inline bool mark_obj(oop obj); |
1046 static inline bool mark_obj(oop obj); |
1066 static inline bool is_marked(oop obj); |
1047 static inline bool is_marked(oop obj); |
1067 // Check mark and maybe push on marking stack |
1048 // Check mark and maybe push on marking stack |
1068 template <class T> static inline void mark_and_push(ParCompactionManager* cm, |
1049 template <class T> static inline void mark_and_push(ParCompactionManager* cm, |
1069 T* p); |
1050 T* p); |
|
1051 template <class T> static inline void adjust_pointer(T* p); |
1070 |
1052 |
1071 static void follow_klass(ParCompactionManager* cm, Klass* klass); |
1053 static void follow_klass(ParCompactionManager* cm, Klass* klass); |
1072 static void adjust_klass(ParCompactionManager* cm, Klass* klass); |
1054 static void adjust_klass(ParCompactionManager* cm, Klass* klass); |
1073 |
1055 |
1074 static void follow_class_loader(ParCompactionManager* cm, |
1056 static void follow_class_loader(ParCompactionManager* cm, |
1148 // Update the deferred objects in the space. |
1130 // Update the deferred objects in the space. |
1149 static void update_deferred_objects(ParCompactionManager* cm, SpaceId id); |
1131 static void update_deferred_objects(ParCompactionManager* cm, SpaceId id); |
1150 |
1132 |
1151 static ParMarkBitMap* mark_bitmap() { return &_mark_bitmap; } |
1133 static ParMarkBitMap* mark_bitmap() { return &_mark_bitmap; } |
1152 static ParallelCompactData& summary_data() { return _summary_data; } |
1134 static ParallelCompactData& summary_data() { return _summary_data; } |
1153 |
|
1154 static inline void adjust_pointer(oop* p) { adjust_pointer(p, false); } |
|
1155 static inline void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); } |
|
1156 |
1135 |
1157 // Reference Processing |
1136 // Reference Processing |
1158 static ReferenceProcessor* const ref_processor() { return _ref_processor; } |
1137 static ReferenceProcessor* const ref_processor() { return _ref_processor; } |
1159 |
1138 |
1160 // Return the SpaceId for the given address. |
1139 // Return the SpaceId for the given address. |
1228 } |
1207 } |
1229 } |
1208 } |
1230 } |
1209 } |
1231 |
1210 |
1232 template <class T> |
1211 template <class T> |
1233 inline void PSParallelCompact::adjust_pointer(T* p, bool isroot) { |
1212 inline void PSParallelCompact::adjust_pointer(T* p) { |
1234 T heap_oop = oopDesc::load_heap_oop(p); |
1213 T heap_oop = oopDesc::load_heap_oop(p); |
1235 if (!oopDesc::is_null(heap_oop)) { |
1214 if (!oopDesc::is_null(heap_oop)) { |
1236 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
1215 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); |
1237 oop new_obj = (oop)summary_data().calc_new_pointer(obj); |
1216 oop new_obj = (oop)summary_data().calc_new_pointer(obj); |
1238 assert(new_obj != NULL, // is forwarding ptr? |
1217 assert(new_obj != NULL, // is forwarding ptr? |