src/share/vm/ci/ciEnv.cpp

Print this page
rev 3 : [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);




 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->pseudo_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);