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

src/share/vm/ci/ciEnv.cpp

Print this page
rev 421 : [mq]: anonk.patch


 467 // ------------------------------------------------------------------
 468 // ciEnv::get_constant_by_index_impl
 469 //
 470 // Implementation of get_constant_by_index().
 471 ciConstant ciEnv::get_constant_by_index_impl(ciInstanceKlass* accessor,
 472                                              int index) {
 473   EXCEPTION_CONTEXT;
 474   instanceKlass* ik_accessor = accessor->get_instanceKlass();
 475   assert(ik_accessor->is_linked(), "must be linked before accessing constant pool");
 476   constantPoolOop cpool = ik_accessor->constants();
 477   constantTag tag = cpool->tag_at(index);
 478   if (tag.is_int()) {
 479     return ciConstant(T_INT, (jint)cpool->int_at(index));
 480   } else if (tag.is_long()) {
 481     return ciConstant((jlong)cpool->long_at(index));
 482   } else if (tag.is_float()) {
 483     return ciConstant((jfloat)cpool->float_at(index));
 484   } else if (tag.is_double()) {
 485     return ciConstant((jdouble)cpool->double_at(index));
 486   } else if (tag.is_string() || tag.is_unresolved_string()) {
 487     oop string = cpool->string_at(index, THREAD);




 488     if (HAS_PENDING_EXCEPTION) {
 489       CLEAR_PENDING_EXCEPTION;
 490       record_out_of_memory_failure();
 491       return ciConstant();
 492     }

 493     ciObject* constant = get_object(string);
 494     assert (constant->is_instance(), "must be an instance, or not? ");
 495     return ciConstant(T_OBJECT, constant);
 496   } else if (tag.is_klass() || tag.is_unresolved_klass()) {
 497     // 4881222: allow ldc to take a class type
 498     bool ignore;
 499     ciKlass* klass = get_klass_by_index_impl(accessor, index, ignore);
 500     if (HAS_PENDING_EXCEPTION) {
 501       CLEAR_PENDING_EXCEPTION;
 502       record_out_of_memory_failure();
 503       return ciConstant();
 504     }
 505     assert (klass->is_instance_klass() || klass->is_array_klass(),
 506             "must be an instance or array klass ");
 507     return ciConstant(T_OBJECT, klass);
 508   } else {
 509     ShouldNotReachHere();
 510     return ciConstant();
 511   }
 512 }




 467 // ------------------------------------------------------------------
 468 // ciEnv::get_constant_by_index_impl
 469 //
 470 // Implementation of get_constant_by_index().
 471 ciConstant ciEnv::get_constant_by_index_impl(ciInstanceKlass* accessor,
 472                                              int index) {
 473   EXCEPTION_CONTEXT;
 474   instanceKlass* ik_accessor = accessor->get_instanceKlass();
 475   assert(ik_accessor->is_linked(), "must be linked before accessing constant pool");
 476   constantPoolOop cpool = ik_accessor->constants();
 477   constantTag tag = cpool->tag_at(index);
 478   if (tag.is_int()) {
 479     return ciConstant(T_INT, (jint)cpool->int_at(index));
 480   } else if (tag.is_long()) {
 481     return ciConstant((jlong)cpool->long_at(index));
 482   } else if (tag.is_float()) {
 483     return ciConstant((jfloat)cpool->float_at(index));
 484   } else if (tag.is_double()) {
 485     return ciConstant((jdouble)cpool->double_at(index));
 486   } else if (tag.is_string() || tag.is_unresolved_string()) {
 487     oop string = NULL;
 488     if (cpool->is_pseudo_string_at(index)) {
 489       string = cpool->pseudo_string_at(index);
 490     } else {
 491       string = cpool->string_at(index, THREAD);
 492       if (HAS_PENDING_EXCEPTION) {
 493         CLEAR_PENDING_EXCEPTION;
 494         record_out_of_memory_failure();
 495         return ciConstant();
 496       }
 497     }
 498     ciObject* constant = get_object(string);
 499     assert (constant->is_instance(), "must be an instance, or not? ");
 500     return ciConstant(T_OBJECT, constant);
 501   } else if (tag.is_klass() || tag.is_unresolved_klass()) {
 502     // 4881222: allow ldc to take a class type
 503     bool ignore;
 504     ciKlass* klass = get_klass_by_index_impl(accessor, index, ignore);
 505     if (HAS_PENDING_EXCEPTION) {
 506       CLEAR_PENDING_EXCEPTION;
 507       record_out_of_memory_failure();
 508       return ciConstant();
 509     }
 510     assert (klass->is_instance_klass() || klass->is_array_klass(),
 511             "must be an instance or array klass ");
 512     return ciConstant(T_OBJECT, klass);
 513   } else {
 514     ShouldNotReachHere();
 515     return ciConstant();
 516   }
 517 }


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