src/hotspot/share/gc/z/zNMethodTable.hpp
changeset 50525 767cdb97f103
child 52939 9a8585f60c32
equal deleted inserted replaced
50524:04f4e983c2f7 50525:767cdb97f103
       
     1 /*
       
     2  * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     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_ZNMETHODTABLE_HPP
       
    25 #define SHARE_GC_Z_ZNMETHODTABLE_HPP
       
    26 
       
    27 #include "gc/z/zGlobals.hpp"
       
    28 #include "gc/z/zNMethodTableEntry.hpp"
       
    29 #include "memory/allocation.hpp"
       
    30 
       
    31 class ZNMethodTable : public AllStatic {
       
    32 private:
       
    33   static ZNMethodTableEntry* _table;
       
    34   static size_t              _size;
       
    35   static size_t              _nregistered;
       
    36   static size_t              _nunregistered;
       
    37   static volatile size_t     _claimed ATTRIBUTE_ALIGNED(ZCacheLineSize);
       
    38 
       
    39   static ZNMethodTableEntry create_entry(nmethod* nm);
       
    40   static void destroy_entry(ZNMethodTableEntry entry);
       
    41 
       
    42   static nmethod* method(ZNMethodTableEntry entry);
       
    43 
       
    44   static size_t first_index(const nmethod* nm, size_t size);
       
    45   static size_t next_index(size_t prev_index, size_t size);
       
    46 
       
    47   static bool register_entry(ZNMethodTableEntry* table, size_t size, ZNMethodTableEntry entry);
       
    48   static bool unregister_entry(ZNMethodTableEntry* table, size_t size, const nmethod* nm);
       
    49 
       
    50   static void rebuild(size_t new_size);
       
    51   static void rebuild_if_needed();
       
    52 
       
    53   static void log_register(const nmethod* nm, ZNMethodTableEntry entry);
       
    54   static void log_unregister(const nmethod* nm);
       
    55 
       
    56   static void entry_oops_do(ZNMethodTableEntry entry, OopClosure* cl);
       
    57 
       
    58 public:
       
    59   static size_t registered_nmethods();
       
    60   static size_t unregistered_nmethods();
       
    61 
       
    62   static void register_nmethod(nmethod* nm);
       
    63   static void unregister_nmethod(nmethod* nm);
       
    64 
       
    65   static void gc_prologue();
       
    66   static void gc_epilogue();
       
    67 
       
    68   static void oops_do(OopClosure* cl);
       
    69 };
       
    70 
       
    71 #endif // SHARE_GC_Z_ZNMETHODTABLE_HPP