1 /* 2 * Copyright (c) 2017, 2019, 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 25 #ifndef SHARE_PRIMS_RESOLVEDMETHODTABLE_HPP 26 #define SHARE_PRIMS_RESOLVEDMETHODTABLE_HPP 27 28 #include "memory/allocation.hpp" 29 #include "oops/symbol.hpp" 30 #include "oops/weakHandle.hpp" 31 32 class ResolvedMethodTable; 33 class ResolvedMethodTableConfig; 34 35 class ResolvedMethodTable : public AllStatic { 36 friend class ResolvedMethodTableConfig; 37 38 static volatile bool _has_work; 39 static OopStorage* _oop_storage; 40 41 // Callback for GC to notify of changes that might require cleaning or resize. 42 static void gc_notification(size_t num_dead); 43 static void trigger_concurrent_work(); 44 45 static double get_load_factor(); 46 static double get_dead_factor(size_t num_dead); 47 48 static void grow(JavaThread* jt); 49 static void clean_dead_entries(JavaThread* jt); 50 51 public: 52 // Initialization 53 static void create_table(); 54 55 static size_t table_size(); 56 57 // Lookup and inserts 58 static oop find_method(const Method* method); 59 static oop add_method(const Method* method, Handle rmethod_name); 60 61 // Callbacks 62 static void item_added(); 63 static void item_removed(); 64 65 // Cleaning 66 static bool has_work(); 67 static void do_concurrent_work(JavaThread* jt); 68 69 70 // JVMTI Support - It is called at safepoint only for RedefineClasses 71 JVMTI_ONLY(static void adjust_method_entries(bool * trace_name_printed);) 72 73 // Debugging 74 static size_t items_count(); 75 static void verify(); 76 }; 77 78 #endif // SHARE_PRIMS_RESOLVEDMETHODTABLE_HPP 79