annotate src/share/vm/ci/ciObjectFactory.hpp @ 6972:bd7a7ce2e264

6830717: replay of compilations would help with debugging Summary: When java process crashed in compiler thread, repeat the compilation process will help finding root cause. This is done with using SA dump application class data and replay data from core dump, then use debug version of jvm to recompile the problematic java method. Reviewed-by: kvn, twisti, sspitsyn Contributed-by: yumin.qi@oracle.com
author minqi
date Mon, 12 Nov 2012 14:03:53 -0800
parents da91efe96a93
children 2cb439954abf f98f5d48f511
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
25 #ifndef SHARE_VM_CI_CIOBJECTFACTORY_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
26 #define SHARE_VM_CI_CIOBJECTFACTORY_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
28 #include "ci/ciClassList.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
29 #include "ci/ciObject.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
30 #include "utilities/growableArray.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
31
0
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // ciObjectFactory
a61af66fc99e Initial load
duke
parents:
diff changeset
33 //
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // This class handles requests for the creation of new instances
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // of ciObject and its subclasses. It contains a caching mechanism
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // which ensures that for each oop, at most one ciObject is created.
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // This invariant allows efficient implementation of ciObject.
a61af66fc99e Initial load
duke
parents:
diff changeset
38 class ciObjectFactory : public ResourceObj {
3939
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents: 2426
diff changeset
39 friend class VMStructs;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents: 2426
diff changeset
40 friend class ciEnv;
f6f3bb0ee072 7088955: add C2 IR support to the SA
never
parents: 2426
diff changeset
41
0
a61af66fc99e Initial load
duke
parents:
diff changeset
42 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
43 static volatile bool _initialized;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
44 static GrowableArray<ciMetadata*>* _shared_ci_metadata;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
45 static ciSymbol* _shared_ci_symbols[];
a61af66fc99e Initial load
duke
parents:
diff changeset
46 static int _shared_ident_limit;
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 Arena* _arena;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
49 GrowableArray<ciMetadata*>* _ci_metadata;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
50 GrowableArray<ciMethod*>* _unloaded_methods;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 GrowableArray<ciKlass*>* _unloaded_klasses;
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
52 GrowableArray<ciInstance*>* _unloaded_instances;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
53 GrowableArray<ciReturnAddress*>* _return_addresses;
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
54 GrowableArray<ciSymbol*>* _symbols; // keep list of symbols created
0
a61af66fc99e Initial load
duke
parents:
diff changeset
55 int _next_ident;
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
58 struct NonPermObject : public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 ciObject* _object;
a61af66fc99e Initial load
duke
parents:
diff changeset
60 NonPermObject* _next;
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 inline NonPermObject(NonPermObject* &bucket, oop key, ciObject* object);
a61af66fc99e Initial load
duke
parents:
diff changeset
63 ciObject* object() { return _object; }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 NonPermObject* &next() { return _next; }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 };
a61af66fc99e Initial load
duke
parents:
diff changeset
66 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
67 enum { NON_PERM_BUCKETS = 61 };
a61af66fc99e Initial load
duke
parents:
diff changeset
68 NonPermObject* _non_perm_bucket[NON_PERM_BUCKETS];
a61af66fc99e Initial load
duke
parents:
diff changeset
69 int _non_perm_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
70
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
71 int find(Metadata* key, GrowableArray<ciMetadata*>* objects);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
72 bool is_found_at(int index, Metadata* key, GrowableArray<ciMetadata*>* objects);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
73 void insert(int index, ciMetadata* obj, GrowableArray<ciMetadata*>* objects);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
74
0
a61af66fc99e Initial load
duke
parents:
diff changeset
75 ciObject* create_new_object(oop o);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
76 ciMetadata* create_new_object(Metadata* o);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
77
0
a61af66fc99e Initial load
duke
parents:
diff changeset
78 static bool is_equal(NonPermObject* p, oop key) {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 return p->object()->get_oop() == key;
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 NonPermObject* &find_non_perm(oop key);
a61af66fc99e Initial load
duke
parents:
diff changeset
83 void insert_non_perm(NonPermObject* &where, oop key, ciObject* obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
84
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
85 void init_ident_of(ciBaseObject* obj);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 Arena* arena() { return _arena; }
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void print_contents_impl();
a61af66fc99e Initial load
duke
parents:
diff changeset
90
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
91 ciInstance* get_unloaded_instance(ciInstanceKlass* klass);
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
92
0
a61af66fc99e Initial load
duke
parents:
diff changeset
93 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
94 static bool is_initialized() { return _initialized; }
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 static void initialize();
a61af66fc99e Initial load
duke
parents:
diff changeset
97 void init_shared_objects();
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
98 void remove_symbols();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 ciObjectFactory(Arena* arena, int expected_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // Get the ciObject corresponding to some oop.
a61af66fc99e Initial load
duke
parents:
diff changeset
103 ciObject* get(oop key);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
104 ciMetadata* get_metadata(Metadata* key);
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
105 ciSymbol* get_symbol(Symbol* key);
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
106
0
a61af66fc99e Initial load
duke
parents:
diff changeset
107 // Get the ciSymbol corresponding to one of the vmSymbols.
a61af66fc99e Initial load
duke
parents:
diff changeset
108 static ciSymbol* vm_symbol_at(int index);
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // Get the ciMethod representing an unloaded/unfound method.
a61af66fc99e Initial load
duke
parents:
diff changeset
111 ciMethod* get_unloaded_method(ciInstanceKlass* holder,
a61af66fc99e Initial load
duke
parents:
diff changeset
112 ciSymbol* name,
4001
5eb9169b1a14 7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents: 3939
diff changeset
113 ciSymbol* signature,
5eb9169b1a14 7092712: JSR 292: unloaded invokedynamic call sites can lead to a crash with signature types not on BCP
twisti
parents: 3939
diff changeset
114 ciInstanceKlass* accessor);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Get a ciKlass representing an unloaded klass.
a61af66fc99e Initial load
duke
parents:
diff changeset
117 ciKlass* get_unloaded_klass(ciKlass* accessing_klass,
a61af66fc99e Initial load
duke
parents:
diff changeset
118 ciSymbol* name,
a61af66fc99e Initial load
duke
parents:
diff changeset
119 bool create_if_not_found);
a61af66fc99e Initial load
duke
parents:
diff changeset
120
1602
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
121 // Get a ciInstance representing an unresolved klass mirror.
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
122 ciInstance* get_unloaded_klass_mirror(ciKlass* type);
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
123
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
124 // Get a ciInstance representing an unresolved method handle constant.
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
125 ciInstance* get_unloaded_method_handle_constant(ciKlass* holder,
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
126 ciSymbol* name,
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
127 ciSymbol* signature,
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
128 int ref_kind);
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
129
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
130 // Get a ciInstance representing an unresolved method type constant.
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
131 ciInstance* get_unloaded_method_type_constant(ciSymbol* signature);
136b78722a08 6939203: JSR 292 needs method handle constants
jrose
parents: 1552
diff changeset
132
0
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // Get the ciMethodData representing the methodData for a method
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // with none.
a61af66fc99e Initial load
duke
parents:
diff changeset
136 ciMethodData* get_empty_methodData();
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 ciReturnAddress* get_return_address(int bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
139
6972
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents: 6725
diff changeset
140 GrowableArray<ciMetadata*>* get_ci_metadata() const { return _ci_metadata; }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
141 // RedefineClasses support
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
142 void metadata_do(void f(Metadata*));
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 4001
diff changeset
143
0
a61af66fc99e Initial load
duke
parents:
diff changeset
144 void print_contents();
a61af66fc99e Initial load
duke
parents:
diff changeset
145 void print();
a61af66fc99e Initial load
duke
parents:
diff changeset
146 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
147
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1602
diff changeset
148 #endif // SHARE_VM_CI_CIOBJECTFACTORY_HPP