8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 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 "gc/shared/suspendibleThreadSet.hpp" 29 #include "memory/allocation.hpp" 30 #include "memory/iterator.hpp" 31 #include "runtime/thread.hpp" 32 #include "runtime/threadSMR.hpp" 33 #include "utilities/globalDefinitions.hpp" 34 35 class ZRootsIteratorClosure; 36 37 typedef OopStorage::ParState<true /* concurrent */, false /* is_const */> ZOopStorageIterator; 38 39 template <typename T, void (T::*F)(ZRootsIteratorClosure*)> 40 class ZSerialOopsDo { 41 private: 42 T* const _iter; 43 volatile bool _claimed; 44 45 public: 46 ZSerialOopsDo(T* iter); 47 void oops_do(ZRootsIteratorClosure* cl); 48 }; 49 50 template <typename T, void (T::*F)(ZRootsIteratorClosure*)> 51 class ZParallelOopsDo { 52 private: 53 T* const _iter; 54 volatile bool _completed; 55 56 public: 57 ZParallelOopsDo(T* iter); 117 void do_code_cache(ZRootsIteratorClosure* cl); 118 119 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe> _universe; 120 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer; 121 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management; 122 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export> _jvmti_export; 123 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export; 124 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_vm_thread> _vm_thread; 125 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_java_threads> _java_threads; 126 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache> _code_cache; 127 128 public: 129 ZRootsIterator(bool visit_jvmti_weak_export = false); 130 ~ZRootsIterator(); 131 132 void oops_do(ZRootsIteratorClosure* cl); 133 }; 134 135 class ZConcurrentRootsIterator { 136 private: 137 ZOopStorageIterator _jni_handles_iter; 138 ZOopStorageIterator _vm_handles_iter; 139 const int _cld_claim; 140 141 void do_jni_handles(ZRootsIteratorClosure* cl); 142 void do_vm_handles(ZRootsIteratorClosure* cl); 143 void do_class_loader_data_graph(ZRootsIteratorClosure* cl); 144 145 ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_jni_handles> _jni_handles; 146 ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_vm_handles> _vm_handles; 147 ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_class_loader_data_graph> _class_loader_data_graph; 148 149 public: 150 ZConcurrentRootsIterator(int cld_claim); 151 ~ZConcurrentRootsIterator(); 152 153 void oops_do(ZRootsIteratorClosure* cl); 154 }; 155 156 class ZConcurrentRootsIteratorClaimStrong : public ZConcurrentRootsIterator { 157 public: 158 ZConcurrentRootsIteratorClaimStrong() : 159 ZConcurrentRootsIterator(ClassLoaderData::_claim_strong) {} 160 }; 161 162 class ZConcurrentRootsIteratorClaimOther : public ZConcurrentRootsIterator { 163 public: 164 ZConcurrentRootsIteratorClaimOther() : 165 ZConcurrentRootsIterator(ClassLoaderData::_claim_other) {} 166 }; | 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 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 "gc/shared/oopStorageSetParState.hpp" 29 #include "gc/shared/suspendibleThreadSet.hpp" 30 #include "memory/allocation.hpp" 31 #include "memory/iterator.hpp" 32 #include "runtime/thread.hpp" 33 #include "runtime/threadSMR.hpp" 34 #include "utilities/globalDefinitions.hpp" 35 36 class ZRootsIteratorClosure; 37 38 typedef OopStorage::ParState<true /* concurrent */, false /* is_const */> ZOopStorageIterator; 39 typedef OopStorageSetStrongParState<true /* concurrent */, false /* is_const */> ZOopStorageSetIterator; 40 41 template <typename T, void (T::*F)(ZRootsIteratorClosure*)> 42 class ZSerialOopsDo { 43 private: 44 T* const _iter; 45 volatile bool _claimed; 46 47 public: 48 ZSerialOopsDo(T* iter); 49 void oops_do(ZRootsIteratorClosure* cl); 50 }; 51 52 template <typename T, void (T::*F)(ZRootsIteratorClosure*)> 53 class ZParallelOopsDo { 54 private: 55 T* const _iter; 56 volatile bool _completed; 57 58 public: 59 ZParallelOopsDo(T* iter); 119 void do_code_cache(ZRootsIteratorClosure* cl); 120 121 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe> _universe; 122 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer; 123 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management; 124 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export> _jvmti_export; 125 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export; 126 ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_vm_thread> _vm_thread; 127 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_java_threads> _java_threads; 128 ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache> _code_cache; 129 130 public: 131 ZRootsIterator(bool visit_jvmti_weak_export = false); 132 ~ZRootsIterator(); 133 134 void oops_do(ZRootsIteratorClosure* cl); 135 }; 136 137 class ZConcurrentRootsIterator { 138 private: 139 ZOopStorageSetIterator _oop_storage_set_iter; 140 const int _cld_claim; 141 142 void do_oop_storage_set(ZRootsIteratorClosure* cl); 143 void do_class_loader_data_graph(ZRootsIteratorClosure* cl); 144 145 ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_oop_storage_set> _oop_storage_set; 146 ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_class_loader_data_graph> _class_loader_data_graph; 147 148 public: 149 ZConcurrentRootsIterator(int cld_claim); 150 ~ZConcurrentRootsIterator(); 151 152 void oops_do(ZRootsIteratorClosure* cl); 153 }; 154 155 class ZConcurrentRootsIteratorClaimStrong : public ZConcurrentRootsIterator { 156 public: 157 ZConcurrentRootsIteratorClaimStrong() : 158 ZConcurrentRootsIterator(ClassLoaderData::_claim_strong) {} 159 }; 160 161 class ZConcurrentRootsIteratorClaimOther : public ZConcurrentRootsIterator { 162 public: 163 ZConcurrentRootsIteratorClaimOther() : 164 ZConcurrentRootsIterator(ClassLoaderData::_claim_other) {} 165 }; |