src/share/vm/ci/ciField.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/ci

src/share/vm/ci/ciField.cpp

Print this page
rev 5732 : [mq]: comments2


 184   _flags = ciFlags(fd->access_flags());
 185   _offset = fd->offset();
 186   _holder = CURRENT_ENV->get_instance_klass(fd->field_holder());
 187 
 188   // Check to see if the field is constant.
 189   bool is_final = this->is_final();
 190   bool is_stable = FoldStableValues && this->is_stable();
 191   if (_holder->is_initialized() && (is_final || is_stable)) {
 192     if (!this->is_static()) {
 193       // A field can be constant if it's a final static field or if
 194       // it's a final non-static field of a trusted class (classes in
 195       // java.lang.invoke and sun.invoke packages and subpackages).
 196       if (is_stable || trust_final_non_static_fields(_holder)) {
 197         _is_constant = true;
 198         return;
 199       }
 200       _is_constant = false;
 201       return;
 202     }
 203 
 204     // This field just may be constant.  The only cases where it will
 205     // not be constant are:
 206     //
 207     // 1. The field holds a non-perm-space oop.  The field is, strictly
 208     //    speaking, constant but we cannot embed non-perm-space oops into
 209     //    generated code.  For the time being we need to consider the
 210     //    field to be not constant.
 211     // 2. The field is a *special* static&final field whose value
 212     //    may change.  The three examples are java.lang.System.in,
 213     //    java.lang.System.out, and java.lang.System.err.
 214 
 215     KlassHandle k = _holder->get_Klass();
 216     assert( SystemDictionary::System_klass() != NULL, "Check once per vm");
 217     if( k() == SystemDictionary::System_klass() ) {
 218       // Check offsets for case 2: System.in, System.out, or System.err
 219       if( _offset == java_lang_System::in_offset_in_bytes()  ||
 220           _offset == java_lang_System::out_offset_in_bytes() ||
 221           _offset == java_lang_System::err_offset_in_bytes() ) {
 222         _is_constant = false;
 223         return;
 224       }
 225     }
 226 
 227     Handle mirror = k->java_mirror();
 228 
 229     switch(type()->basic_type()) {
 230     case T_BYTE:
 231       _constant_value = ciConstant(type()->basic_type(), mirror->byte_field(_offset));
 232       break;




 184   _flags = ciFlags(fd->access_flags());
 185   _offset = fd->offset();
 186   _holder = CURRENT_ENV->get_instance_klass(fd->field_holder());
 187 
 188   // Check to see if the field is constant.
 189   bool is_final = this->is_final();
 190   bool is_stable = FoldStableValues && this->is_stable();
 191   if (_holder->is_initialized() && (is_final || is_stable)) {
 192     if (!this->is_static()) {
 193       // A field can be constant if it's a final static field or if
 194       // it's a final non-static field of a trusted class (classes in
 195       // java.lang.invoke and sun.invoke packages and subpackages).
 196       if (is_stable || trust_final_non_static_fields(_holder)) {
 197         _is_constant = true;
 198         return;
 199       }
 200       _is_constant = false;
 201       return;
 202     }
 203 
 204     // This field just may be constant.  The only case where it will
 205     // not be constant is when the field is a *special* static&final field
 206     // whose value may change.  The three examples are java.lang.System.in,






 207     // java.lang.System.out, and java.lang.System.err.
 208 
 209     KlassHandle k = _holder->get_Klass();
 210     assert( SystemDictionary::System_klass() != NULL, "Check once per vm");
 211     if( k() == SystemDictionary::System_klass() ) {
 212       // Check offsets for case 2: System.in, System.out, or System.err
 213       if( _offset == java_lang_System::in_offset_in_bytes()  ||
 214           _offset == java_lang_System::out_offset_in_bytes() ||
 215           _offset == java_lang_System::err_offset_in_bytes() ) {
 216         _is_constant = false;
 217         return;
 218       }
 219     }
 220 
 221     Handle mirror = k->java_mirror();
 222 
 223     switch(type()->basic_type()) {
 224     case T_BYTE:
 225       _constant_value = ciConstant(type()->basic_type(), mirror->byte_field(_offset));
 226       break;


src/share/vm/ci/ciField.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File