Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.hpp
38921 views
/*1* Copyright (c) 2014, Oracle and/or its affiliates. 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_VM_GC_IMPLEMENTATION_G1_G1CODECACHEREMSET_HPP25#define SHARE_VM_GC_IMPLEMENTATION_G1_G1CODECACHEREMSET_HPP2627#include "memory/allocation.hpp"2829class CodeBlobClosure;30class CodeRootSetTable;31class HeapRegion;32class nmethod;3334// Implements storage for a set of code roots.35// All methods that modify the set are not thread-safe except if otherwise noted.36class G1CodeRootSet VALUE_OBJ_CLASS_SPEC {37friend class G1CodeRootSetTest;38private:3940const static size_t SmallSize = 32;41const static size_t Threshold = 24;42const static size_t LargeSize = 512;4344CodeRootSetTable* _table;45CodeRootSetTable* load_acquire_table();4647size_t _length;4849void move_to_large();50void allocate_small_table();5152public:53G1CodeRootSet() : _table(NULL), _length(0) {}54~G1CodeRootSet();5556static void purge();5758static size_t static_mem_size();5960void add(nmethod* method);6162bool remove(nmethod* method);6364// Safe to call without synchronization, but may return false negatives.65bool contains(nmethod* method);6667void clear();6869void nmethods_do(CodeBlobClosure* blk) const;7071// Remove all nmethods which no longer contain pointers into our "owner" region72void clean(HeapRegion* owner);7374bool is_empty() {75bool empty = length() == 0;76assert(empty == (_table == NULL), "is empty only if table is deallocated");77return empty;78}7980// Length in elements81size_t length() const { return _length; }8283// Memory size in bytes taken by this set.84size_t mem_size();8586};8788#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1CODECACHEREMSET_HPP899091