Path: blob/master/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp
40960 views
/*1* Copyright (c) 2017, 2020, Red Hat, Inc. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCODEROOTS_HPP25#define SHARE_GC_SHENANDOAH_SHENANDOAHCODEROOTS_HPP2627#include "code/codeCache.hpp"28#include "gc/shenandoah/shenandoahSharedVariables.hpp"29#include "gc/shenandoah/shenandoahLock.hpp"30#include "gc/shenandoah/shenandoahPadding.hpp"31#include "memory/allocation.hpp"32#include "memory/iterator.hpp"33#include "utilities/globalDefinitions.hpp"3435class ShenandoahHeap;36class ShenandoahHeapRegion;37class ShenandoahNMethodTable;38class ShenandoahNMethodTableSnapshot;39class WorkGang;4041class ShenandoahParallelCodeHeapIterator {42friend class CodeCache;43private:44CodeHeap* _heap;45shenandoah_padding(0);46volatile int _claimed_idx;47volatile bool _finished;48shenandoah_padding(1);49public:50ShenandoahParallelCodeHeapIterator(CodeHeap* heap);51void parallel_blobs_do(CodeBlobClosure* f);52};5354class ShenandoahParallelCodeCacheIterator {55friend class CodeCache;56private:57ShenandoahParallelCodeHeapIterator* _iters;58int _length;5960NONCOPYABLE(ShenandoahParallelCodeCacheIterator);6162public:63ShenandoahParallelCodeCacheIterator(const GrowableArray<CodeHeap*>* heaps);64~ShenandoahParallelCodeCacheIterator();65void parallel_blobs_do(CodeBlobClosure* f);66};6768class ShenandoahCodeRootsIterator {69friend class ShenandoahCodeRoots;70protected:71ShenandoahParallelCodeCacheIterator _par_iterator;72ShenandoahSharedFlag _seq_claimed;73ShenandoahNMethodTableSnapshot* _table_snapshot;7475public:76ShenandoahCodeRootsIterator();77~ShenandoahCodeRootsIterator();7879void possibly_parallel_blobs_do(CodeBlobClosure *f);80};8182class ShenandoahCodeRoots : public AllStatic {83friend class ShenandoahHeap;84friend class ShenandoahCodeRootsIterator;8586public:87static void initialize();88static void register_nmethod(nmethod* nm);89static void unregister_nmethod(nmethod* nm);90static void flush_nmethod(nmethod* nm);9192static ShenandoahNMethodTable* table() {93return _nmethod_table;94}9596// Concurrent nmethod unloading support97static void unlink(WorkGang* workers, bool unloading_occurred);98static void purge(WorkGang* workers);99static void arm_nmethods();100static void disarm_nmethods();101static int disarmed_value() { return _disarmed_value; }102static int* disarmed_value_address() { return &_disarmed_value; }103104private:105static ShenandoahNMethodTable* _nmethod_table;106static int _disarmed_value;107};108109#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCODEROOTS_HPP110111112