122 }
123
124 // Is this field shared?
125 bool is_shared() {
126 // non-static fields of shared holders are cached
127 return _holder->is_shared() && !is_static();
128 }
129
130 // Is this field a constant?
131 //
132 // Clarification: A field is considered constant if:
133 // 1. The field is both static and final
134 // 2. The canonical holder of the field has undergone
135 // static initialization.
136 // 3. If the field is an object or array, then the oop
137 // in question is allocated in perm space.
138 // 4. The field is not one of the special static/final
139 // non-constant fields. These are java.lang.System.in
140 // and java.lang.System.out. Abomination.
141 //
142 // Note: the check for case 4 is not yet implemented.
143 bool is_constant() { return _is_constant; }
144
145 // Get the constant value of this field.
146 ciConstant constant_value() {
147 assert(is_static() && is_constant(), "illegal call to constant_value()");
148 return _constant_value;
149 }
150
151 // Get the constant value of non-static final field in the given
152 // object.
153 ciConstant constant_value_of(ciObject* object) {
154 assert(!is_static() && is_constant(), "only if field is non-static constant");
155 assert(object->is_instance(), "must be instance");
156 return object->as_instance()->field_value(this);
157 }
158
159 // Check for link time errors. Accessing a field from a
160 // certain class via a certain bytecode may or may not be legal.
161 // This call checks to see if an exception may be raised by
162 // an access of this field.
163 //
164 // Usage note: if the same field is accessed multiple times
165 // in the same compilation, will_link will need to be checked
166 // at each point of access.
167 bool will_link(ciInstanceKlass* accessing_klass,
168 Bytecodes::Code bc);
169
170 // Java access flags
171 bool is_public () { return flags().is_public(); }
172 bool is_private () { return flags().is_private(); }
173 bool is_protected () { return flags().is_protected(); }
174 bool is_static () { return flags().is_static(); }
175 bool is_final () { return flags().is_final(); }
176 bool is_volatile () { return flags().is_volatile(); }
177 bool is_transient () { return flags().is_transient(); }
178
179 bool is_call_site_target() {
180 ciInstanceKlass* callsite_klass = CURRENT_ENV->CallSite_klass();
181 if (callsite_klass == NULL)
182 return false;
183 return (holder()->is_subclass_of(callsite_klass) && (name() == ciSymbol::target_name()));
184 }
185
186 // Debugging output
187 void print();
188 void print_name_on(outputStream* st);
189 };
190
191 #endif // SHARE_VM_CI_CIFIELD_HPP
|
122 }
123
124 // Is this field shared?
125 bool is_shared() {
126 // non-static fields of shared holders are cached
127 return _holder->is_shared() && !is_static();
128 }
129
130 // Is this field a constant?
131 //
132 // Clarification: A field is considered constant if:
133 // 1. The field is both static and final
134 // 2. The canonical holder of the field has undergone
135 // static initialization.
136 // 3. If the field is an object or array, then the oop
137 // in question is allocated in perm space.
138 // 4. The field is not one of the special static/final
139 // non-constant fields. These are java.lang.System.in
140 // and java.lang.System.out. Abomination.
141 //
142 // A field is also considered constant if it is marked @Stable
143 // and is non-null (or non-zero, if a primitive).
144 // For non-static fields, the null/zero check must be
145 // arranged by the user, as constant_value().is_null_or_zero().
146 bool is_constant() { return _is_constant; }
147
148 // Get the constant value of this field.
149 ciConstant constant_value() {
150 assert(is_static() && is_constant(), "illegal call to constant_value()");
151 return _constant_value;
152 }
153
154 // Get the constant value of non-static final field in the given
155 // object.
156 ciConstant constant_value_of(ciObject* object) {
157 assert(!is_static() && is_constant(), "only if field is non-static constant");
158 assert(object->is_instance(), "must be instance");
159 return object->as_instance()->field_value(this);
160 }
161
162 // Check for link time errors. Accessing a field from a
163 // certain class via a certain bytecode may or may not be legal.
164 // This call checks to see if an exception may be raised by
165 // an access of this field.
166 //
167 // Usage note: if the same field is accessed multiple times
168 // in the same compilation, will_link will need to be checked
169 // at each point of access.
170 bool will_link(ciInstanceKlass* accessing_klass,
171 Bytecodes::Code bc);
172
173 // Java access flags
174 bool is_public () { return flags().is_public(); }
175 bool is_private () { return flags().is_private(); }
176 bool is_protected () { return flags().is_protected(); }
177 bool is_static () { return flags().is_static(); }
178 bool is_final () { return flags().is_final(); }
179 bool is_stable () { return flags().is_stable(); }
180 bool is_volatile () { return flags().is_volatile(); }
181 bool is_transient () { return flags().is_transient(); }
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 // Debugging output
191 void print();
192 void print_name_on(outputStream* st);
193 };
194
195 #endif // SHARE_VM_CI_CIFIELD_HPP
|