31 #include "ci/ciInstance.hpp"
32
33 // ciField
34 //
35 // This class represents the result of a field lookup in the VM.
36 // The lookup may not succeed, in which case the information in
37 // the ciField will be incomplete.
38 class ciField : public ResourceObj {
39 CI_PACKAGE_ACCESS
40 friend class ciEnv;
41 friend class ciInstanceKlass;
42
43 private:
44 ciFlags _flags;
45 ciInstanceKlass* _holder;
46 ciSymbol* _name;
47 ciSymbol* _signature;
48 ciType* _type;
49 int _offset;
50 bool _is_constant;
51 ciMethod* _known_to_link_with_put;
52 ciInstanceKlass* _known_to_link_with_get;
53 ciConstant _constant_value;
54
55 ciType* compute_type();
56 ciType* compute_type_impl();
57
58 ciField(ciInstanceKlass* klass, int index);
59 ciField(fieldDescriptor* fd);
60 ciField(ciField* field, ciInstanceKlass* holder, int offset, bool is_final);
61
62 // shared constructor code
63 void initialize_from(fieldDescriptor* fd);
64
65 public:
66 ciFlags flags() const { return _flags; }
67
68 // Of which klass is this field a member?
69 //
70 // Usage note: the declared holder of a field is the class
157 // Check for link time errors. Accessing a field from a
158 // certain method via a certain bytecode may or may not be legal.
159 // This call checks to see if an exception may be raised by
160 // an access of this field.
161 //
162 // Usage note: if the same field is accessed multiple times
163 // in the same compilation, will_link will need to be checked
164 // at each point of access.
165 bool will_link(ciMethod* accessing_method,
166 Bytecodes::Code bc);
167
168 // Java access flags
169 bool is_public () const { return flags().is_public(); }
170 bool is_private () const { return flags().is_private(); }
171 bool is_protected () const { return flags().is_protected(); }
172 bool is_static () const { return flags().is_static(); }
173 bool is_final () const { return flags().is_final(); }
174 bool is_stable () const { return flags().is_stable(); }
175 bool is_volatile () const { return flags().is_volatile(); }
176 bool is_transient () const { return flags().is_transient(); }
177 // The field is modified outside of instance initializer methods
178 // (or class/initializer methods if the field is static).
179 bool has_initialized_final_update() const { return flags().has_initialized_final_update(); }
180
181 bool is_call_site_target() {
182 ciInstanceKlass* callsite_klass = CURRENT_ENV->CallSite_klass();
183 if (callsite_klass == NULL)
184 return false;
185 return (holder()->is_subclass_of(callsite_klass) && (name() == ciSymbol::target_name()));
186 }
187
188 bool is_autobox_cache() {
189 ciSymbol* klass_name = holder()->name();
190 return (name() == ciSymbol::cache_field_name() &&
191 holder()->uses_default_loader() &&
192 (klass_name == ciSymbol::java_lang_Character_CharacterCache() ||
193 klass_name == ciSymbol::java_lang_Byte_ByteCache() ||
194 klass_name == ciSymbol::java_lang_Short_ShortCache() ||
195 klass_name == ciSymbol::java_lang_Integer_IntegerCache() ||
196 klass_name == ciSymbol::java_lang_Long_LongCache()));
|
31 #include "ci/ciInstance.hpp"
32
33 // ciField
34 //
35 // This class represents the result of a field lookup in the VM.
36 // The lookup may not succeed, in which case the information in
37 // the ciField will be incomplete.
38 class ciField : public ResourceObj {
39 CI_PACKAGE_ACCESS
40 friend class ciEnv;
41 friend class ciInstanceKlass;
42
43 private:
44 ciFlags _flags;
45 ciInstanceKlass* _holder;
46 ciSymbol* _name;
47 ciSymbol* _signature;
48 ciType* _type;
49 int _offset;
50 bool _is_constant;
51 bool _is_flattened;
52 ciMethod* _known_to_link_with_put;
53 ciInstanceKlass* _known_to_link_with_get;
54 ciConstant _constant_value;
55
56 ciType* compute_type();
57 ciType* compute_type_impl();
58
59 ciField(ciInstanceKlass* klass, int index);
60 ciField(fieldDescriptor* fd);
61 ciField(ciField* field, ciInstanceKlass* holder, int offset, bool is_final);
62
63 // shared constructor code
64 void initialize_from(fieldDescriptor* fd);
65
66 public:
67 ciFlags flags() const { return _flags; }
68
69 // Of which klass is this field a member?
70 //
71 // Usage note: the declared holder of a field is the class
158 // Check for link time errors. Accessing a field from a
159 // certain method via a certain bytecode may or may not be legal.
160 // This call checks to see if an exception may be raised by
161 // an access of this field.
162 //
163 // Usage note: if the same field is accessed multiple times
164 // in the same compilation, will_link will need to be checked
165 // at each point of access.
166 bool will_link(ciMethod* accessing_method,
167 Bytecodes::Code bc);
168
169 // Java access flags
170 bool is_public () const { return flags().is_public(); }
171 bool is_private () const { return flags().is_private(); }
172 bool is_protected () const { return flags().is_protected(); }
173 bool is_static () const { return flags().is_static(); }
174 bool is_final () const { return flags().is_final(); }
175 bool is_stable () const { return flags().is_stable(); }
176 bool is_volatile () const { return flags().is_volatile(); }
177 bool is_transient () const { return flags().is_transient(); }
178 bool is_flattened () const { return _is_flattened; }
179 // The field is modified outside of instance initializer methods
180 // (or class/initializer methods if the field is static).
181 bool has_initialized_final_update() const { return flags().has_initialized_final_update(); }
182
183 bool is_call_site_target() {
184 ciInstanceKlass* callsite_klass = CURRENT_ENV->CallSite_klass();
185 if (callsite_klass == NULL)
186 return false;
187 return (holder()->is_subclass_of(callsite_klass) && (name() == ciSymbol::target_name()));
188 }
189
190 bool is_autobox_cache() {
191 ciSymbol* klass_name = holder()->name();
192 return (name() == ciSymbol::cache_field_name() &&
193 holder()->uses_default_loader() &&
194 (klass_name == ciSymbol::java_lang_Character_CharacterCache() ||
195 klass_name == ciSymbol::java_lang_Byte_ByteCache() ||
196 klass_name == ciSymbol::java_lang_Short_ShortCache() ||
197 klass_name == ciSymbol::java_lang_Integer_IntegerCache() ||
198 klass_name == ciSymbol::java_lang_Long_LongCache()));
|