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 oop mirror = k->java_mirror(); 228 229 _is_constant = true; 230 switch(type()->basic_type()) { 231 case T_BYTE: 232 _constant_value = ciConstant(type()->basic_type(), mirror->byte_field(_offset)); 233 break; 234 case T_CHAR: 235 _constant_value = ciConstant(type()->basic_type(), mirror->char_field(_offset)); 236 break; 237 case T_SHORT: 238 _constant_value = ciConstant(type()->basic_type(), mirror->short_field(_offset)); 239 break; 240 case T_BOOLEAN: 241 _constant_value = ciConstant(type()->basic_type(), mirror->bool_field(_offset)); 242 break; 243 case T_INT: 244 _constant_value = ciConstant(type()->basic_type(), mirror->int_field(_offset)); 245 break; 246 case T_FLOAT: 247 _constant_value = ciConstant(mirror->float_field(_offset)); | 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 KlassHandle 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 Handle mirror = k->java_mirror(); 228 229 _is_constant = true; 230 switch(type()->basic_type()) { 231 case T_BYTE: 232 _constant_value = ciConstant(type()->basic_type(), mirror->byte_field(_offset)); 233 break; 234 case T_CHAR: 235 _constant_value = ciConstant(type()->basic_type(), mirror->char_field(_offset)); 236 break; 237 case T_SHORT: 238 _constant_value = ciConstant(type()->basic_type(), mirror->short_field(_offset)); 239 break; 240 case T_BOOLEAN: 241 _constant_value = ciConstant(type()->basic_type(), mirror->bool_field(_offset)); 242 break; 243 case T_INT: 244 _constant_value = ciConstant(type()->basic_type(), mirror->int_field(_offset)); 245 break; 246 case T_FLOAT: 247 _constant_value = ciConstant(mirror->float_field(_offset)); |