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 #ifndef SHARE_GC_Z_ZROOTSITERATOR_HPP 25 #define SHARE_GC_Z_ZROOTSITERATOR_HPP 26 27 #include "gc/shared/oopStorageParState.hpp" 28 #include "memory/allocation.hpp" 29 #include "memory/iterator.hpp" 30 #include "utilities/globalDefinitions.hpp" 31 32 template <typename T, void (T::*F)(OopClosure*)> 33 class ZSerialOopsDo VALUE_OBJ_CLASS_SPEC { 34 private: 35 T* const _iter; 36 volatile bool _claimed; 37 38 public: 39 ZSerialOopsDo(T* iter); 40 void oops_do(OopClosure* cl); 41 }; 42 43 template <typename T, void (T::*F)(OopClosure*)> 44 class ZParallelOopsDo VALUE_OBJ_CLASS_SPEC { 45 private: 46 T* const _iter; 47 volatile bool _completed; 48 49 public: 50 ZParallelOopsDo(T* iter); 51 void oops_do(OopClosure* cl); 52 }; 53 54 template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)> 55 class ZSerialUnlinkOrOopsDo VALUE_OBJ_CLASS_SPEC { 56 private: 57 T* const _iter; 58 volatile bool _claimed; 59 60 public: 61 ZSerialUnlinkOrOopsDo(T* iter); 62 void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* cl); 63 }; 64 65 template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)> 66 class ZParallelUnlinkOrOopsDo VALUE_OBJ_CLASS_SPEC { 67 private: 68 T* const _iter; 69 volatile bool _completed; 70 71 public: 72 ZParallelUnlinkOrOopsDo(T* iter); 73 void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* cl); 74 }; 75 76 class ZRootsIterator VALUE_OBJ_CLASS_SPEC { 77 private: 78 void do_universe(OopClosure* cl); 79 void do_jni_handles(OopClosure* cl); 80 void do_jni_weak_handles(OopClosure* cl); 81 void do_object_synchronizer(OopClosure* cl); 82 void do_management(OopClosure* cl); 83 void do_jvmti_export(OopClosure* cl); 84 void do_jvmti_weak_export(OopClosure* cl); 85 void do_trace(OopClosure* cl); 86 void do_system_dictionary(OopClosure* cl); 87 void do_class_loader_data_graph(OopClosure* cl); 88 void do_threads(OopClosure* cl); 89 void do_code_cache(OopClosure* cl); 90 void do_string_table(OopClosure* cl); 91 92 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe> _universe; 93 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jni_handles> _jni_handles; 94 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jni_weak_handles> _jni_weak_handles; 95 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer; 96 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management; 97 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export> _jvmti_export; 98 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export; 99 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_trace> _trace; 100 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_system_dictionary> _system_dictionary; 101 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_class_loader_data_graph> _class_loader_data_graph; 102 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_threads> _threads; 103 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache> _code_cache; 104 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_string_table> _string_table; 105 106 public: 107 ZRootsIterator(); 108 ~ZRootsIterator(); 109 110 void oops_do(OopClosure* cl, bool visit_jvmti_weak_export = false); 111 }; 112 113 class ZWeakRootsIterator VALUE_OBJ_CLASS_SPEC { 114 private: 115 void do_jni_weak_handles(BoolObjectClosure* is_alive, OopClosure* cl); 116 void do_jvmti_weak_export(BoolObjectClosure* is_alive, OopClosure* cl); 117 void do_trace(BoolObjectClosure* is_alive, OopClosure* cl); 118 void do_symbol_table(BoolObjectClosure* is_alive, OopClosure* cl); 119 void do_string_table(BoolObjectClosure* is_alive, OopClosure* cl); 120 121 ZSerialUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jni_weak_handles> _jni_weak_handles; 122 ZSerialUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jvmti_weak_export> _jvmti_weak_export; 123 ZSerialUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_trace> _trace; 124 ZParallelUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_symbol_table> _symbol_table; 125 ZParallelUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_string_table> _string_table; 126 127 public: 128 ZWeakRootsIterator(); 129 ~ZWeakRootsIterator(); 130 131 void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* cl); 132 void oops_do(OopClosure* cl); 133 }; 134 135 class ZConcurrentWeakRootsIterator VALUE_OBJ_CLASS_SPEC { 136 private: 137 OopStorage::ParState<true /* concurrent */, false /* is_const */> _par_state; 138 139 void do_jni_weak_handles(OopClosure* cl); 140 141 ZParallelOopsDo<ZConcurrentWeakRootsIterator, &ZConcurrentWeakRootsIterator::do_jni_weak_handles> _jni_weak_handles; 142 143 public: 144 ZConcurrentWeakRootsIterator(); 145 146 void oops_do(OopClosure* cl); 147 }; 148 149 class ZThreadRootsIterator VALUE_OBJ_CLASS_SPEC { 150 private: 151 void do_threads(OopClosure* cl); 152 153 ZParallelOopsDo<ZThreadRootsIterator, &ZThreadRootsIterator::do_threads> _threads; 154 155 public: 156 ZThreadRootsIterator(); 157 ~ZThreadRootsIterator(); 158 159 void oops_do(OopClosure* cl); 160 }; 161 162 #endif // SHARE_GC_Z_ZROOTSITERATOR_HPP | 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 #ifndef SHARE_GC_Z_ZROOTSITERATOR_HPP 25 #define SHARE_GC_Z_ZROOTSITERATOR_HPP 26 27 #include "gc/shared/oopStorageParState.hpp" 28 #include "memory/allocation.hpp" 29 #include "memory/iterator.hpp" 30 #include "utilities/globalDefinitions.hpp" 31 32 template <typename T, void (T::*F)(OopClosure*)> 33 class ZSerialOopsDo { 34 private: 35 T* const _iter; 36 volatile bool _claimed; 37 38 public: 39 ZSerialOopsDo(T* iter); 40 void oops_do(OopClosure* cl); 41 }; 42 43 template <typename T, void (T::*F)(OopClosure*)> 44 class ZParallelOopsDo { 45 private: 46 T* const _iter; 47 volatile bool _completed; 48 49 public: 50 ZParallelOopsDo(T* iter); 51 void oops_do(OopClosure* cl); 52 }; 53 54 template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)> 55 class ZSerialUnlinkOrOopsDo { 56 private: 57 T* const _iter; 58 volatile bool _claimed; 59 60 public: 61 ZSerialUnlinkOrOopsDo(T* iter); 62 void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* cl); 63 }; 64 65 template <typename T, void (T::*F)(BoolObjectClosure*, OopClosure*)> 66 class ZParallelUnlinkOrOopsDo { 67 private: 68 T* const _iter; 69 volatile bool _completed; 70 71 public: 72 ZParallelUnlinkOrOopsDo(T* iter); 73 void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* cl); 74 }; 75 76 class ZRootsIterator { 77 private: 78 void do_universe(OopClosure* cl); 79 void do_jni_handles(OopClosure* cl); 80 void do_jni_weak_handles(OopClosure* cl); 81 void do_object_synchronizer(OopClosure* cl); 82 void do_management(OopClosure* cl); 83 void do_jvmti_export(OopClosure* cl); 84 void do_jvmti_weak_export(OopClosure* cl); 85 void do_trace(OopClosure* cl); 86 void do_system_dictionary(OopClosure* cl); 87 void do_class_loader_data_graph(OopClosure* cl); 88 void do_threads(OopClosure* cl); 89 void do_code_cache(OopClosure* cl); 90 void do_string_table(OopClosure* cl); 91 92 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe> _universe; 93 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jni_handles> _jni_handles; 94 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jni_weak_handles> _jni_weak_handles; 95 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer; 96 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management; 97 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export> _jvmti_export; 98 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export; 99 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_trace> _trace; 100 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_system_dictionary> _system_dictionary; 101 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_class_loader_data_graph> _class_loader_data_graph; 102 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_threads> _threads; 103 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache> _code_cache; 104 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_string_table> _string_table; 105 106 public: 107 ZRootsIterator(); 108 ~ZRootsIterator(); 109 110 void oops_do(OopClosure* cl, bool visit_jvmti_weak_export = false); 111 }; 112 113 class ZWeakRootsIterator { 114 private: 115 void do_jni_weak_handles(BoolObjectClosure* is_alive, OopClosure* cl); 116 void do_jvmti_weak_export(BoolObjectClosure* is_alive, OopClosure* cl); 117 void do_trace(BoolObjectClosure* is_alive, OopClosure* cl); 118 void do_symbol_table(BoolObjectClosure* is_alive, OopClosure* cl); 119 void do_string_table(BoolObjectClosure* is_alive, OopClosure* cl); 120 121 ZSerialUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jni_weak_handles> _jni_weak_handles; 122 ZSerialUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_jvmti_weak_export> _jvmti_weak_export; 123 ZSerialUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_trace> _trace; 124 ZParallelUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_symbol_table> _symbol_table; 125 ZParallelUnlinkOrOopsDo<ZWeakRootsIterator, &ZWeakRootsIterator::do_string_table> _string_table; 126 127 public: 128 ZWeakRootsIterator(); 129 ~ZWeakRootsIterator(); 130 131 void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* cl); 132 void oops_do(OopClosure* cl); 133 }; 134 135 class ZConcurrentWeakRootsIterator { 136 private: 137 OopStorage::ParState<true /* concurrent */, false /* is_const */> _par_state; 138 139 void do_jni_weak_handles(OopClosure* cl); 140 141 ZParallelOopsDo<ZConcurrentWeakRootsIterator, &ZConcurrentWeakRootsIterator::do_jni_weak_handles> _jni_weak_handles; 142 143 public: 144 ZConcurrentWeakRootsIterator(); 145 146 void oops_do(OopClosure* cl); 147 }; 148 149 class ZThreadRootsIterator { 150 private: 151 void do_threads(OopClosure* cl); 152 153 ZParallelOopsDo<ZThreadRootsIterator, &ZThreadRootsIterator::do_threads> _threads; 154 155 public: 156 ZThreadRootsIterator(); 157 ~ZThreadRootsIterator(); 158 159 void oops_do(OopClosure* cl); 160 }; 161 162 #endif // SHARE_GC_Z_ZROOTSITERATOR_HPP |