190 // Trust Atomic*FieldUpdaters: they are very important for performance, and make up one
191 // more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483.
192 if (holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() ||
193 holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater() ||
194 holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater() ||
195 holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl()) {
196 return true;
197 }
198 return TrustFinalNonStaticFields;
199 }
200
201 void ciField::initialize_from(fieldDescriptor* fd) {
202 // Get the flags, offset, and canonical holder of the field.
203 _flags = ciFlags(fd->access_flags());
204 _offset = fd->offset();
205 _holder = CURRENT_ENV->get_instance_klass(fd->field_holder());
206
207 // Check to see if the field is constant.
208 bool is_final = this->is_final();
209 bool is_stable = FoldStableValues && this->is_stable();
210 if (_holder->is_initialized() && (is_final || is_stable)) {
211 if (!this->is_static()) {
212 // A field can be constant if it's a final static field or if
213 // it's a final non-static field of a trusted class (classes in
214 // java.lang.invoke and sun.invoke packages and subpackages).
215 if (is_stable || trust_final_non_static_fields(_holder)) {
216 _is_constant = true;
217 return;
218 }
219 _is_constant = false;
220 return;
221 }
222
223 // This field just may be constant. The only cases where it will
224 // not be constant are:
225 //
226 // 1. The field holds a non-perm-space oop. The field is, strictly
227 // speaking, constant but we cannot embed non-perm-space oops into
228 // generated code. For the time being we need to consider the
229 // field to be not constant.
230 // 2. The field is a *special* static&final field whose value
|
190 // Trust Atomic*FieldUpdaters: they are very important for performance, and make up one
191 // more reason not to use Unsafe, if their final fields are trusted. See more in JDK-8140483.
192 if (holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_Impl() ||
193 holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_CASUpdater() ||
194 holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicLongFieldUpdater_LockedUpdater() ||
195 holder->name() == ciSymbol::java_util_concurrent_atomic_AtomicReferenceFieldUpdater_Impl()) {
196 return true;
197 }
198 return TrustFinalNonStaticFields;
199 }
200
201 void ciField::initialize_from(fieldDescriptor* fd) {
202 // Get the flags, offset, and canonical holder of the field.
203 _flags = ciFlags(fd->access_flags());
204 _offset = fd->offset();
205 _holder = CURRENT_ENV->get_instance_klass(fd->field_holder());
206
207 // Check to see if the field is constant.
208 bool is_final = this->is_final();
209 bool is_stable = FoldStableValues && this->is_stable();
210 if (_holder->is_initialized() && ((is_final && !has_initialized_final_update()) || is_stable)) {
211 if (!this->is_static()) {
212 // A field can be constant if it's a final static field or if
213 // it's a final non-static field of a trusted class (classes in
214 // java.lang.invoke and sun.invoke packages and subpackages).
215 if (is_stable || trust_final_non_static_fields(_holder)) {
216 _is_constant = true;
217 return;
218 }
219 _is_constant = false;
220 return;
221 }
222
223 // This field just may be constant. The only cases where it will
224 // not be constant are:
225 //
226 // 1. The field holds a non-perm-space oop. The field is, strictly
227 // speaking, constant but we cannot embed non-perm-space oops into
228 // generated code. For the time being we need to consider the
229 // field to be not constant.
230 // 2. The field is a *special* static&final field whose value
|