195 // a final non-static field of a trusted class ({java,sun}.dyn). 196 if (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 klassOop k = _holder->get_klassOop(); 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 _is_constant = true; 228 switch(type()->basic_type()) { 229 case T_BYTE: 230 _constant_value = ciConstant(type()->basic_type(), k->byte_field(_offset)); 231 break; 232 case T_CHAR: 233 _constant_value = ciConstant(type()->basic_type(), k->char_field(_offset)); 234 break; 235 case T_SHORT: 236 _constant_value = ciConstant(type()->basic_type(), k->short_field(_offset)); 237 break; | 195 // a final non-static field of a trusted class ({java,sun}.dyn). 196 if (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 Handle k = _holder->get_klassOop(); 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 _is_constant = true; 228 switch(type()->basic_type()) { 229 case T_BYTE: 230 _constant_value = ciConstant(type()->basic_type(), k->byte_field(_offset)); 231 break; 232 case T_CHAR: 233 _constant_value = ciConstant(type()->basic_type(), k->char_field(_offset)); 234 break; 235 case T_SHORT: 236 _constant_value = ciConstant(type()->basic_type(), k->short_field(_offset)); 237 break; |