1 /* |
1 /* |
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
63 ciInstance* _java_mirror; |
63 ciInstance* _java_mirror; |
64 |
64 |
65 ciConstantPoolCache* _field_cache; // cached map index->field |
65 ciConstantPoolCache* _field_cache; // cached map index->field |
66 GrowableArray<ciField*>* _nonstatic_fields; |
66 GrowableArray<ciField*>* _nonstatic_fields; |
67 |
67 |
68 enum { implementors_limit = instanceKlass::implementors_limit }; |
68 // The possible values of the _implementor fall into following three cases: |
69 ciInstanceKlass* _implementors[implementors_limit]; |
69 // NULL: no implementor. |
70 jint _nof_implementors; |
70 // A ciInstanceKlass that's not itself: one implementor. |
|
71 // Itsef: more than one implementors. |
|
72 ciInstanceKlass* _implementor; |
71 |
73 |
72 GrowableArray<ciField*>* _non_static_fields; |
74 GrowableArray<ciField*>* _non_static_fields; |
73 |
75 |
74 protected: |
76 protected: |
75 ciInstanceKlass(KlassHandle h_k); |
77 ciInstanceKlass(KlassHandle h_k); |
95 |
97 |
96 bool is_shared() { return _is_shared; } |
98 bool is_shared() { return _is_shared; } |
97 |
99 |
98 void compute_shared_init_state(); |
100 void compute_shared_init_state(); |
99 bool compute_shared_has_subklass(); |
101 bool compute_shared_has_subklass(); |
100 int compute_shared_nof_implementors(); |
|
101 int compute_nonstatic_fields(); |
102 int compute_nonstatic_fields(); |
102 GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields); |
103 GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields); |
103 |
104 |
104 // Update the init_state for shared klasses |
105 // Update the init_state for shared klasses |
105 void update_if_shared(instanceKlass::ClassState expected) { |
106 void update_if_shared(instanceKlass::ClassState expected) { |
156 return _has_nonstatic_fields; } |
157 return _has_nonstatic_fields; } |
157 jint nonstatic_oop_map_size() { |
158 jint nonstatic_oop_map_size() { |
158 assert(is_loaded(), "must be loaded"); |
159 assert(is_loaded(), "must be loaded"); |
159 return _nonstatic_oop_map_size; } |
160 return _nonstatic_oop_map_size; } |
160 ciInstanceKlass* super(); |
161 ciInstanceKlass* super(); |
161 jint nof_implementors() { |
162 jint nof_implementors() { |
162 assert(is_loaded(), "must be loaded"); |
163 ciInstanceKlass* impl; |
163 if (_is_shared) return compute_shared_nof_implementors(); |
164 assert(is_loaded(), "must be loaded"); |
164 return _nof_implementors; |
165 impl = implementor(); |
|
166 if (impl == NULL) { |
|
167 return 0; |
|
168 } else if (impl != this) { |
|
169 return 1; |
|
170 } else { |
|
171 return 2; |
|
172 } |
165 } |
173 } |
166 |
174 |
167 ciInstanceKlass* get_canonical_holder(int offset); |
175 ciInstanceKlass* get_canonical_holder(int offset); |
168 ciField* get_field_by_offset(int field_offset, bool is_static); |
176 ciField* get_field_by_offset(int field_offset, bool is_static); |
169 ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static); |
177 ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static); |
205 ciMethod* find_method(ciSymbol* name, ciSymbol* signature); |
213 ciMethod* find_method(ciSymbol* name, ciSymbol* signature); |
206 // Note: To find a method from name and type strings, use ciSymbol::make, |
214 // Note: To find a method from name and type strings, use ciSymbol::make, |
207 // but consider adding to vmSymbols.hpp instead. |
215 // but consider adding to vmSymbols.hpp instead. |
208 |
216 |
209 bool is_leaf_type(); |
217 bool is_leaf_type(); |
210 ciInstanceKlass* implementor(int n); |
218 ciInstanceKlass* implementor(); |
211 |
219 |
212 // Is the defining class loader of this class the default loader? |
220 // Is the defining class loader of this class the default loader? |
213 bool uses_default_loader(); |
221 bool uses_default_loader(); |
214 |
222 |
215 bool is_java_lang_Object(); |
223 bool is_java_lang_Object(); |