< prev index next >

src/hotspot/share/gc/z/zNMethodTable.hpp

Print this page




  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_ZNMETHODTABLE_HPP
  25 #define SHARE_GC_Z_ZNMETHODTABLE_HPP
  26 
  27 #include "gc/z/zArray.hpp"
  28 #include "gc/z/zGlobals.hpp"
  29 #include "gc/z/zLock.hpp"
  30 #include "gc/z/zNMethodTableEntry.hpp"
  31 #include "memory/allocation.hpp"
  32 
  33 class ZWorkers;
  34 
  35 class ZNMethodTableEntryClosure {
  36 public:
  37   virtual void do_nmethod_entry(ZNMethodTableEntry entry) = 0;
  38 };
  39 
  40 class ZNMethodTable : public AllStatic {
  41 private:
  42   static ZNMethodTableEntry* _table;
  43   static size_t              _size;
  44   static ZNMethodTableEntry* _iter_table;
  45   static size_t              _iter_table_size;
  46   static ZArray<void*>       _iter_deferred_deletes;
  47   static size_t              _nregistered;
  48   static size_t              _nunregistered;
  49   static volatile size_t     _claimed ATTRIBUTE_ALIGNED(ZCacheLineSize);
  50 
  51   static ZNMethodTableEntry create_entry(nmethod* nm);

  52 
  53   static size_t first_index(const nmethod* nm, size_t size);
  54   static size_t next_index(size_t prev_index, size_t size);
  55 
  56   static void wait_until_iteration_done();
  57 
  58   static bool register_entry(ZNMethodTableEntry* table, size_t size, ZNMethodTableEntry entry);
  59   static void unregister_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm);
  60 
  61   static void rebuild(size_t new_size);
  62   static void rebuild_if_needed();
  63 
  64   static void log_register(const nmethod* nm, ZNMethodTableEntry entry);
  65   static void log_unregister(const nmethod* nm);
  66 
  67 public:
  68   static void safe_delete(void* data);
  69 
  70   static size_t registered_nmethods();
  71   static size_t unregistered_nmethods();
  72 
  73   static void register_nmethod(nmethod* nm);
  74   static void unregister_nmethod(nmethod* nm);
  75   static void disarm_nmethod(nmethod* nm);
  76 
  77   static ZReentrantLock* lock_for_nmethod(nmethod* nm);
  78 
  79   static void oops_do(OopClosure* cl);
  80 
  81   static void entry_oops_do(ZNMethodTableEntry entry, OopClosure* cl);
  82 
  83   static void nmethod_entries_do_begin();
  84   static void nmethod_entries_do_end();
  85   static void nmethod_entries_do(ZNMethodTableEntryClosure* cl);
  86 
  87   static void unlink(ZWorkers* workers, bool unloading_occurred);
  88   static void purge(ZWorkers* workers);
  89 };
  90 
  91 #endif // SHARE_GC_Z_ZNMETHODTABLE_HPP


  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_ZNMETHODTABLE_HPP
  25 #define SHARE_GC_Z_ZNMETHODTABLE_HPP
  26 
  27 #include "gc/z/zArray.hpp"
  28 #include "gc/z/zGlobals.hpp"
  29 #include "gc/z/zLock.hpp"
  30 #include "gc/z/zNMethodTableEntry.hpp"
  31 #include "memory/allocation.hpp"
  32 
  33 class ZWorkers;
  34 
  35 class ZNMethodClosure {
  36 public:
  37   virtual void do_nmethod(nmethod* nm) = 0;
  38 };
  39 
  40 class ZNMethodTable : public AllStatic {
  41 private:
  42   static ZNMethodTableEntry* _table;
  43   static size_t              _size;
  44   static ZNMethodTableEntry* _iter_table;
  45   static size_t              _iter_table_size;
  46   static ZArray<void*>       _iter_deferred_deletes;
  47   static size_t              _nregistered;
  48   static size_t              _nunregistered;
  49   static volatile size_t     _claimed ATTRIBUTE_ALIGNED(ZCacheLineSize);
  50 
  51   static void attach_gc_data(nmethod* nm);
  52   static void detach_gc_data(nmethod* nm);
  53 
  54   static size_t first_index(const nmethod* nm, size_t size);
  55   static size_t next_index(size_t prev_index, size_t size);
  56 
  57   static void wait_until_iteration_done();
  58 
  59   static bool register_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm);
  60   static void unregister_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm);
  61 
  62   static void rebuild(size_t new_size);
  63   static void rebuild_if_needed();
  64 
  65   static void log_register(const nmethod* nm);
  66   static void log_unregister(const nmethod* nm);
  67 
  68 public:
  69   static void safe_delete(void* data);
  70 
  71   static size_t registered_nmethods();
  72   static size_t unregistered_nmethods();
  73 
  74   static void register_nmethod(nmethod* nm);
  75   static void unregister_nmethod(nmethod* nm);
  76   static void disarm_nmethod(nmethod* nm);
  77 
  78   static ZReentrantLock* lock_for_nmethod(nmethod* nm);
  79 
  80   static void oops_do(OopClosure* cl);
  81 
  82   static void oops_do(nmethod* nm, OopClosure* cl);
  83 
  84   static void nmethods_do_begin();
  85   static void nmethods_do_end();
  86   static void nmethods_do(ZNMethodClosure* cl);
  87 
  88   static void unlink(ZWorkers* workers, bool unloading_occurred);
  89   static void purge(ZWorkers* workers);
  90 };
  91 
  92 #endif // SHARE_GC_Z_ZNMETHODTABLE_HPP
< prev index next >