author | stefank |
Thu, 15 Mar 2018 21:29:36 +0100 | |
changeset 49593 | 4dd58ecc9912 |
parent 48615 | 31cd0c16f4d2 |
child 49818 | e57e6addb978 |
permissions | -rw-r--r-- |
46505 | 1 |
/* |
2 |
* Copyright (c) 2017, 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_VM_PRIMS_RESOLVEDMETHOD_HPP |
|
26 |
#define SHARE_VM_PRIMS_RESOLVEDMETHOD_HPP |
|
27 |
||
28 |
#include "oops/symbol.hpp" |
|
29 |
#include "utilities/hashtable.hpp" |
|
30 |
||
31 |
// Hashtable to record Method* used in ResolvedMethods, via. ResolvedMethod oops. |
|
32 |
// This is needed for redefinition to replace Method* with redefined versions. |
|
33 |
||
34 |
// Entry in a ResolvedMethodTable, mapping a single oop of java_lang_invoke_ResolvedMethodName which |
|
35 |
// holds JVM Method* in vmtarget. |
|
36 |
||
37 |
class ResolvedMethodEntry : public HashtableEntry<oop, mtClass> { |
|
38 |
public: |
|
39 |
ResolvedMethodEntry* next() const { |
|
40 |
return (ResolvedMethodEntry*)HashtableEntry<oop, mtClass>::next(); |
|
41 |
} |
|
42 |
||
43 |
ResolvedMethodEntry** next_addr() { |
|
44 |
return (ResolvedMethodEntry**)HashtableEntry<oop, mtClass>::next_addr(); |
|
45 |
} |
|
46 |
||
48615
31cd0c16f4d2
8191904: Refactor weak oops in ResolvedMethodTable to use the Access API
eosterlund
parents:
47216
diff
changeset
|
47 |
oop object(); |
31cd0c16f4d2
8191904: Refactor weak oops in ResolvedMethodTable to use the Access API
eosterlund
parents:
47216
diff
changeset
|
48 |
oop object_no_keepalive(); |
31cd0c16f4d2
8191904: Refactor weak oops in ResolvedMethodTable to use the Access API
eosterlund
parents:
47216
diff
changeset
|
49 |
|
46505 | 50 |
void print_on(outputStream* st) const; |
51 |
}; |
|
52 |
||
53 |
class ResolvedMethodTable : public Hashtable<oop, mtClass> { |
|
54 |
enum Constants { |
|
55 |
_table_size = 1007 |
|
56 |
}; |
|
57 |
||
58 |
static int _oops_removed; |
|
59 |
static int _oops_counted; |
|
60 |
||
61 |
static ResolvedMethodTable* _the_table; |
|
62 |
private: |
|
63 |
ResolvedMethodEntry* bucket(int i) { |
|
64 |
return (ResolvedMethodEntry*) Hashtable<oop, mtClass>::bucket(i); |
|
65 |
} |
|
66 |
||
67 |
ResolvedMethodEntry** bucket_addr(int i) { |
|
68 |
return (ResolvedMethodEntry**) Hashtable<oop, mtClass>::bucket_addr(i); |
|
69 |
} |
|
70 |
||
71 |
unsigned int compute_hash(Method* method); |
|
72 |
||
73 |
// need not be locked; no state change |
|
74 |
oop lookup(int index, unsigned int hash, Method* method); |
|
75 |
oop lookup(Method* method); |
|
76 |
||
77 |
// must be done under ResolvedMethodTable_lock |
|
78 |
oop basic_add(Method* method, oop rmethod_name); |
|
79 |
||
80 |
public: |
|
81 |
ResolvedMethodTable(); |
|
82 |
||
83 |
static void create_table() { |
|
84 |
assert(_the_table == NULL, "One symbol table allowed."); |
|
85 |
_the_table = new ResolvedMethodTable(); |
|
86 |
} |
|
87 |
||
88 |
// Called from java_lang_invoke_ResolvedMethodName |
|
89 |
static oop find_method(Method* method); |
|
90 |
static oop add_method(Handle rmethod_name); |
|
91 |
||
92 |
#if INCLUDE_JVMTI |
|
93 |
// It is called at safepoint only for RedefineClasses |
|
94 |
static void adjust_method_entries(bool * trace_name_printed); |
|
95 |
#endif // INCLUDE_JVMTI |
|
96 |
||
97 |
// Cleanup cleared entries |
|
98 |
static void unlink(BoolObjectClosure* is_alive); |
|
99 |
static void oops_do(OopClosure* f); |
|
100 |
||
101 |
#ifndef PRODUCT |
|
102 |
void print(); |
|
103 |
#endif |
|
104 |
void verify(); |
|
105 |
}; |
|
106 |
||
107 |
#endif // SHARE_VM_PRIMS_RESOLVEDMETHOD_HPP |