comparison src/share/vm/ci/ciField.cpp @ 2376:c7f3d0b4570f

7017732: move static fields into Class to prepare for perm gen removal Reviewed-by: kvn, coleenp, twisti, stefank
author never
date Fri, 18 Mar 2011 16:00:34 -0700
parents 8033953d67ff
children 0654ee04b214 81d815b05abb
comparison
equal deleted inserted replaced
2375:d673ef06fe96 2376:c7f3d0b4570f
211 // field to be not constant. 211 // field to be not constant.
212 // 2. The field is a *special* static&final field whose value 212 // 2. The field is a *special* static&final field whose value
213 // may change. The three examples are java.lang.System.in, 213 // may change. The three examples are java.lang.System.in,
214 // java.lang.System.out, and java.lang.System.err. 214 // java.lang.System.out, and java.lang.System.err.
215 215
216 Handle k = _holder->get_klassOop(); 216 KlassHandle k = _holder->get_klassOop();
217 assert( SystemDictionary::System_klass() != NULL, "Check once per vm"); 217 assert( SystemDictionary::System_klass() != NULL, "Check once per vm");
218 if( k() == SystemDictionary::System_klass() ) { 218 if( k() == SystemDictionary::System_klass() ) {
219 // Check offsets for case 2: System.in, System.out, or System.err 219 // Check offsets for case 2: System.in, System.out, or System.err
220 if( _offset == java_lang_System::in_offset_in_bytes() || 220 if( _offset == java_lang_System::in_offset_in_bytes() ||
221 _offset == java_lang_System::out_offset_in_bytes() || 221 _offset == java_lang_System::out_offset_in_bytes() ||
223 _is_constant = false; 223 _is_constant = false;
224 return; 224 return;
225 } 225 }
226 } 226 }
227 227
228 Handle mirror = k->java_mirror();
229
228 _is_constant = true; 230 _is_constant = true;
229 switch(type()->basic_type()) { 231 switch(type()->basic_type()) {
230 case T_BYTE: 232 case T_BYTE:
231 _constant_value = ciConstant(type()->basic_type(), k->byte_field(_offset)); 233 _constant_value = ciConstant(type()->basic_type(), mirror->byte_field(_offset));
232 break; 234 break;
233 case T_CHAR: 235 case T_CHAR:
234 _constant_value = ciConstant(type()->basic_type(), k->char_field(_offset)); 236 _constant_value = ciConstant(type()->basic_type(), mirror->char_field(_offset));
235 break; 237 break;
236 case T_SHORT: 238 case T_SHORT:
237 _constant_value = ciConstant(type()->basic_type(), k->short_field(_offset)); 239 _constant_value = ciConstant(type()->basic_type(), mirror->short_field(_offset));
238 break; 240 break;
239 case T_BOOLEAN: 241 case T_BOOLEAN:
240 _constant_value = ciConstant(type()->basic_type(), k->bool_field(_offset)); 242 _constant_value = ciConstant(type()->basic_type(), mirror->bool_field(_offset));
241 break; 243 break;
242 case T_INT: 244 case T_INT:
243 _constant_value = ciConstant(type()->basic_type(), k->int_field(_offset)); 245 _constant_value = ciConstant(type()->basic_type(), mirror->int_field(_offset));
244 break; 246 break;
245 case T_FLOAT: 247 case T_FLOAT:
246 _constant_value = ciConstant(k->float_field(_offset)); 248 _constant_value = ciConstant(mirror->float_field(_offset));
247 break; 249 break;
248 case T_DOUBLE: 250 case T_DOUBLE:
249 _constant_value = ciConstant(k->double_field(_offset)); 251 _constant_value = ciConstant(mirror->double_field(_offset));
250 break; 252 break;
251 case T_LONG: 253 case T_LONG:
252 _constant_value = ciConstant(k->long_field(_offset)); 254 _constant_value = ciConstant(mirror->long_field(_offset));
253 break; 255 break;
254 case T_OBJECT: 256 case T_OBJECT:
255 case T_ARRAY: 257 case T_ARRAY:
256 { 258 {
257 oop o = k->obj_field(_offset); 259 oop o = mirror->obj_field(_offset);
258 260
259 // A field will be "constant" if it is known always to be 261 // A field will be "constant" if it is known always to be
260 // a non-null reference to an instance of a particular class, 262 // a non-null reference to an instance of a particular class,
261 // or to a particular array. This can happen even if the instance 263 // or to a particular array. This can happen even if the instance
262 // or array is not perm. In such a case, an "unloaded" ciArray 264 // or array is not perm. In such a case, an "unloaded" ciArray