1 /*
 2  * Copyright (c) 2017, 2020, 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_ZNMETHOD_HPP
25 #define SHARE_GC_Z_ZNMETHOD_HPP
26 
27 #include "memory/allocation.hpp"
28 
29 class nmethod;
30 class NMethodClosure;
31 class ZReentrantLock;
32 class ZWorkers;
33 
34 class ZNMethod : public AllStatic {
35 private:
36   static void attach_gc_data(nmethod* nm);
37 
38   static void log_register(const nmethod* nm);
39   static void log_unregister(const nmethod* nm);
40 
41 public:
42   static void register_nmethod(nmethod* nm);
43   static void unregister_nmethod(nmethod* nm);
44   static void flush_nmethod(nmethod* nm);
45 
46   static bool supports_entry_barrier(nmethod* nm);
47 
48   static bool is_armed(nmethod* nm);
49   static void disarm(nmethod* nm);
50 
51   static void nmethod_oops_do(nmethod* nm, OopClosure* cl);
52   static void nmethod_oops_do_inner(nmethod* nm, OopClosure* cl);
53 
54   static void nmethod_oops_barrier(nmethod* nm);
55 
56   static void nmethods_do_begin();
57   static void nmethods_do_end();
58   static void nmethods_do(NMethodClosure* cl);
59 
60   static ZReentrantLock* lock_for_nmethod(nmethod* nm);
61 
62   static void unlink(ZWorkers* workers, bool unloading_occurred);
63   static void purge(ZWorkers* workers);
64 };
65 
66 #endif // SHARE_GC_Z_ZNMETHOD_HPP