author | coleenp |
Thu, 27 Jun 2019 11:40:18 -0400 | |
changeset 55513 | be05771cdfdf |
parent 54150 | 5529640c5f67 |
child 58177 | 4932dce35882 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51197
diff
changeset
|
2 |
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51197
diff
changeset
|
25 |
#ifndef SHARE_CI_CIOBJECTFACTORY_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51197
diff
changeset
|
26 |
#define SHARE_CI_CIOBJECTFACTORY_HPP |
7397 | 27 |
|
28 |
#include "ci/ciClassList.hpp" |
|
29 |
#include "ci/ciObject.hpp" |
|
30 |
#include "utilities/growableArray.hpp" |
|
31 |
||
1 | 32 |
// ciObjectFactory |
33 |
// |
|
34 |
// This class handles requests for the creation of new instances |
|
35 |
// of ciObject and its subclasses. It contains a caching mechanism |
|
36 |
// which ensures that for each oop, at most one ciObject is created. |
|
37 |
// This invariant allows efficient implementation of ciObject. |
|
38 |
class ciObjectFactory : public ResourceObj { |
|
10547 | 39 |
friend class VMStructs; |
40 |
friend class ciEnv; |
|
41 |
||
1 | 42 |
private: |
43 |
static volatile bool _initialized; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10734
diff
changeset
|
44 |
static GrowableArray<ciMetadata*>* _shared_ci_metadata; |
1 | 45 |
static ciSymbol* _shared_ci_symbols[]; |
46 |
static int _shared_ident_limit; |
|
47 |
||
48 |
Arena* _arena; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10734
diff
changeset
|
49 |
GrowableArray<ciMetadata*>* _ci_metadata; |
1 | 50 |
GrowableArray<ciMethod*>* _unloaded_methods; |
51 |
GrowableArray<ciKlass*>* _unloaded_klasses; |
|
5882 | 52 |
GrowableArray<ciInstance*>* _unloaded_instances; |
1 | 53 |
GrowableArray<ciReturnAddress*>* _return_addresses; |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
54 |
GrowableArray<ciSymbol*>* _symbols; // keep list of symbols created |
1 | 55 |
int _next_ident; |
56 |
||
57 |
public: |
|
58 |
struct NonPermObject : public ResourceObj { |
|
59 |
ciObject* _object; |
|
60 |
NonPermObject* _next; |
|
61 |
||
62 |
inline NonPermObject(NonPermObject* &bucket, oop key, ciObject* object); |
|
63 |
ciObject* object() { return _object; } |
|
64 |
NonPermObject* &next() { return _next; } |
|
65 |
}; |
|
66 |
private: |
|
67 |
enum { NON_PERM_BUCKETS = 61 }; |
|
68 |
NonPermObject* _non_perm_bucket[NON_PERM_BUCKETS]; |
|
69 |
int _non_perm_count; |
|
70 |
||
36315
150a415079ae
8007986: GrowableArray should implement binary search
roland
parents:
27644
diff
changeset
|
71 |
static int metadata_compare(Metadata* const& key, ciMetadata* const& elt); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10734
diff
changeset
|
72 |
|
1 | 73 |
ciObject* create_new_object(oop o); |
27644
f4aa22a934e4
8060147: SIGSEGV in Metadata::mark_on_stack() while marking metadata in ciEnv
vlivanov
parents:
25492
diff
changeset
|
74 |
ciMetadata* create_new_metadata(Metadata* o); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10734
diff
changeset
|
75 |
|
1 | 76 |
static bool is_equal(NonPermObject* p, oop key) { |
51197
3a6be93c9660
8204970: Remaing object comparisons need to use oopDesc::equals()
rkennke
parents:
47887
diff
changeset
|
77 |
return oopDesc::equals(p->object()->get_oop(), key); |
1 | 78 |
} |
79 |
||
80 |
NonPermObject* &find_non_perm(oop key); |
|
81 |
void insert_non_perm(NonPermObject* &where, oop key, ciObject* obj); |
|
82 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10734
diff
changeset
|
83 |
void init_ident_of(ciBaseObject* obj); |
1 | 84 |
|
85 |
Arena* arena() { return _arena; } |
|
86 |
||
87 |
void print_contents_impl(); |
|
88 |
||
5882 | 89 |
ciInstance* get_unloaded_instance(ciInstanceKlass* klass); |
90 |
||
1 | 91 |
public: |
92 |
static bool is_initialized() { return _initialized; } |
|
93 |
||
94 |
static void initialize(); |
|
95 |
void init_shared_objects(); |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
96 |
void remove_symbols(); |
1 | 97 |
|
98 |
ciObjectFactory(Arena* arena, int expected_size); |
|
99 |
||
100 |
// Get the ciObject corresponding to some oop. |
|
101 |
ciObject* get(oop key); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10734
diff
changeset
|
102 |
ciMetadata* get_metadata(Metadata* key); |
53278
4b469f5f4bf2
8215889: assert(!_unloading) failed: This oop is not available to unloading class loader data with ZGC
eosterlund
parents:
51197
diff
changeset
|
103 |
ciMetadata* cached_metadata(Metadata* key); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
104 |
ciSymbol* get_symbol(Symbol* key); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
105 |
|
1 | 106 |
// Get the ciSymbol corresponding to one of the vmSymbols. |
107 |
static ciSymbol* vm_symbol_at(int index); |
|
108 |
||
109 |
// Get the ciMethod representing an unloaded/unfound method. |
|
110 |
ciMethod* get_unloaded_method(ciInstanceKlass* holder, |
|
111 |
ciSymbol* name, |
|
10734
065435337883
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
10547
diff
changeset
|
112 |
ciSymbol* signature, |
065435337883
7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents:
10547
diff
changeset
|
113 |
ciInstanceKlass* accessor); |
1 | 114 |
|
115 |
// Get a ciKlass representing an unloaded klass. |
|
116 |
ciKlass* get_unloaded_klass(ciKlass* accessing_klass, |
|
117 |
ciSymbol* name, |
|
118 |
bool create_if_not_found); |
|
119 |
||
5882 | 120 |
// Get a ciInstance representing an unresolved klass mirror. |
121 |
ciInstance* get_unloaded_klass_mirror(ciKlass* type); |
|
122 |
||
123 |
// Get a ciInstance representing an unresolved method handle constant. |
|
124 |
ciInstance* get_unloaded_method_handle_constant(ciKlass* holder, |
|
125 |
ciSymbol* name, |
|
126 |
ciSymbol* signature, |
|
127 |
int ref_kind); |
|
128 |
||
129 |
// Get a ciInstance representing an unresolved method type constant. |
|
130 |
ciInstance* get_unloaded_method_type_constant(ciSymbol* signature); |
|
131 |
||
1 | 132 |
|
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
14477
diff
changeset
|
133 |
ciInstance* get_unloaded_object_constant(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
14477
diff
changeset
|
134 |
|
1 | 135 |
// Get the ciMethodData representing the methodData for a method |
136 |
// with none. |
|
137 |
ciMethodData* get_empty_methodData(); |
|
138 |
||
139 |
ciReturnAddress* get_return_address(int bci); |
|
140 |
||
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
13728
diff
changeset
|
141 |
GrowableArray<ciMetadata*>* get_ci_metadata() const { return _ci_metadata; } |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10734
diff
changeset
|
142 |
// RedefineClasses support |
54150
5529640c5f67
8220512: Deoptimize redefinition functions that have dirty ICs
coleenp
parents:
53293
diff
changeset
|
143 |
void metadata_do(MetadataClosure* f); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10734
diff
changeset
|
144 |
|
1 | 145 |
void print_contents(); |
146 |
void print(); |
|
147 |
}; |
|
7397 | 148 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51197
diff
changeset
|
149 |
#endif // SHARE_CI_CIOBJECTFACTORY_HPP |