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

src/share/vm/ci/ciEnv.cpp

Print this page
rev 1021 : 6858164: invokedynamic code needs some cleanup (post-6655638)
Note: The bug ID for this change set was erroneously used to call for review of 6815692.
Summary: Fix several crashers, remove needless paths for boxed-style bootstrap method call, refactor & simplify APIs for rewriter constantPoolOop, remove sun.dyn.CallSiteImpl
Reviewed-by: ?
rev 1025 : imported patch indy.compiler.patch
rev 1026 : imported patch indy.compiler.inline.patch

*** 418,433 **** // ------------------------------------------------------------------ // ciEnv::get_klass_by_index_impl // // Implementation of get_klass_by_index. ! ciKlass* ciEnv::get_klass_by_index_impl(ciInstanceKlass* accessor, int index, ! bool& is_accessible) { ! assert(accessor->get_instanceKlass()->is_linked(), "must be linked before accessing constant pool"); EXCEPTION_CONTEXT; - constantPoolHandle cpool(THREAD, accessor->get_instanceKlass()->constants()); KlassHandle klass (THREAD, constantPoolOopDesc::klass_at_if_loaded(cpool, index)); symbolHandle klass_name; if (klass.is_null()) { // The klass has not been inserted into the constant pool. // Try to look it up by name. --- 418,432 ---- // ------------------------------------------------------------------ // ciEnv::get_klass_by_index_impl // // Implementation of get_klass_by_index. ! ciKlass* ciEnv::get_klass_by_index_impl(constantPoolHandle cpool, int index, ! bool& is_accessible, ! ciInstanceKlass* accessor) { EXCEPTION_CONTEXT; KlassHandle klass (THREAD, constantPoolOopDesc::klass_at_if_loaded(cpool, index)); symbolHandle klass_name; if (klass.is_null()) { // The klass has not been inserted into the constant pool. // Try to look it up by name.
*** 485,510 **** // ------------------------------------------------------------------ // ciEnv::get_klass_by_index // // Get a klass from the constant pool. ! ciKlass* ciEnv::get_klass_by_index(ciInstanceKlass* accessor, int index, ! bool& is_accessible) { ! GUARDED_VM_ENTRY(return get_klass_by_index_impl(accessor, index, is_accessible);) } // ------------------------------------------------------------------ // ciEnv::get_constant_by_index_impl // // Implementation of get_constant_by_index(). ! ciConstant ciEnv::get_constant_by_index_impl(ciInstanceKlass* accessor, ! int index) { EXCEPTION_CONTEXT; - instanceKlass* ik_accessor = accessor->get_instanceKlass(); - assert(ik_accessor->is_linked(), "must be linked before accessing constant pool"); - constantPoolOop cpool = ik_accessor->constants(); constantTag tag = cpool->tag_at(index); if (tag.is_int()) { return ciConstant(T_INT, (jint)cpool->int_at(index)); } else if (tag.is_long()) { return ciConstant((jlong)cpool->long_at(index)); --- 484,508 ---- // ------------------------------------------------------------------ // ciEnv::get_klass_by_index // // Get a klass from the constant pool. ! ciKlass* ciEnv::get_klass_by_index(constantPoolHandle cpool, int index, ! bool& is_accessible, ! ciInstanceKlass* accessor) { ! GUARDED_VM_ENTRY(return get_klass_by_index_impl(cpool, index, is_accessible, accessor);) } // ------------------------------------------------------------------ // ciEnv::get_constant_by_index_impl // // Implementation of get_constant_by_index(). ! ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool, ! int index, ! ciInstanceKlass* accessor) { EXCEPTION_CONTEXT; constantTag tag = cpool->tag_at(index); if (tag.is_int()) { return ciConstant(T_INT, (jint)cpool->int_at(index)); } else if (tag.is_long()) { return ciConstant((jlong)cpool->long_at(index));
*** 528,546 **** assert (constant->is_instance(), "must be an instance, or not? "); return ciConstant(T_OBJECT, constant); } else if (tag.is_klass() || tag.is_unresolved_klass()) { // 4881222: allow ldc to take a class type bool ignore; ! ciKlass* klass = get_klass_by_index_impl(accessor, index, ignore); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; record_out_of_memory_failure(); return ciConstant(); } assert (klass->is_instance_klass() || klass->is_array_klass(), "must be an instance or array klass "); return ciConstant(T_OBJECT, klass); } else { ShouldNotReachHere(); return ciConstant(); } } --- 526,549 ---- assert (constant->is_instance(), "must be an instance, or not? "); return ciConstant(T_OBJECT, constant); } else if (tag.is_klass() || tag.is_unresolved_klass()) { // 4881222: allow ldc to take a class type bool ignore; ! ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore, accessor); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; record_out_of_memory_failure(); return ciConstant(); } assert (klass->is_instance_klass() || klass->is_array_klass(), "must be an instance or array klass "); return ciConstant(T_OBJECT, klass); + } else if (tag.is_object()) { + oop obj = cpool->object_at(index); + assert(obj->is_instance(), "must be an instance"); + ciObject* ciobj = get_object(obj); + return ciConstant(T_OBJECT, ciobj); } else { ShouldNotReachHere(); return ciConstant(); } }
*** 573,585 **** // ciEnv::get_constant_by_index // // Pull a constant out of the constant pool. How appropriate. // // Implementation note: this query is currently in no way cached. ! ciConstant ciEnv::get_constant_by_index(ciInstanceKlass* accessor, ! int index) { ! GUARDED_VM_ENTRY(return get_constant_by_index_impl(accessor, index); ) } // ------------------------------------------------------------------ // ciEnv::is_unresolved_string // --- 576,589 ---- // ciEnv::get_constant_by_index // // Pull a constant out of the constant pool. How appropriate. // // Implementation note: this query is currently in no way cached. ! ciConstant ciEnv::get_constant_by_index(constantPoolHandle cpool, ! int index, ! ciInstanceKlass* accessor) { ! GUARDED_VM_ENTRY(return get_constant_by_index_impl(cpool, index, accessor);) } // ------------------------------------------------------------------ // ciEnv::is_unresolved_string //
*** 677,695 **** } // ------------------------------------------------------------------ // ciEnv::get_method_by_index_impl ! ciMethod* ciEnv::get_method_by_index_impl(ciInstanceKlass* accessor, ! int index, Bytecodes::Code bc) { ! // Get the method's declared holder. ! ! assert(accessor->get_instanceKlass()->is_linked(), "must be linked before accessing constant pool"); ! constantPoolHandle cpool = accessor->get_instanceKlass()->constants(); int holder_index = cpool->klass_ref_index_at(index); bool holder_is_accessible; ! ciKlass* holder = get_klass_by_index_impl(accessor, holder_index, holder_is_accessible); ciInstanceKlass* declared_holder = get_instance_klass_for_declared_method_holder(holder); // Get the method's name and signature. symbolOop name_sym = cpool->name_ref_at(index); symbolOop sig_sym = cpool->signature_ref_at(index); --- 681,696 ---- } // ------------------------------------------------------------------ // ciEnv::get_method_by_index_impl ! ciMethod* ciEnv::get_method_by_index_impl(constantPoolHandle cpool, ! int index, Bytecodes::Code bc, ! ciInstanceKlass* accessor) { int holder_index = cpool->klass_ref_index_at(index); bool holder_is_accessible; ! ciKlass* holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor); ciInstanceKlass* declared_holder = get_instance_klass_for_declared_method_holder(holder); // Get the method's name and signature. symbolOop name_sym = cpool->name_ref_at(index); symbolOop sig_sym = cpool->signature_ref_at(index);
*** 713,727 **** } // ------------------------------------------------------------------ // ciEnv::get_fake_invokedynamic_method_impl ! ciMethod* ciEnv::get_fake_invokedynamic_method_impl(ciInstanceKlass* accessor, int index, Bytecodes::Code bc) { assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic"); - assert(accessor->get_instanceKlass()->is_linked(), "must be linked before accessing constant pool"); - constantPoolHandle cpool = accessor->get_instanceKlass()->constants(); // Get the CallSite from the constant pool cache. ConstantPoolCacheEntry* cpc_entry = cpool->cache()->secondary_entry_at(index); assert(cpc_entry != NULL && cpc_entry->is_secondary_entry(), "sanity"); Handle call_site = cpc_entry->f1(); --- 714,726 ---- } // ------------------------------------------------------------------ // ciEnv::get_fake_invokedynamic_method_impl ! ciMethod* ciEnv::get_fake_invokedynamic_method_impl(constantPoolHandle cpool, int index, Bytecodes::Code bc) { assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic"); // Get the CallSite from the constant pool cache. ConstantPoolCacheEntry* cpc_entry = cpool->cache()->secondary_entry_at(index); assert(cpc_entry != NULL && cpc_entry->is_secondary_entry(), "sanity"); Handle call_site = cpc_entry->f1();
*** 764,779 **** } // ------------------------------------------------------------------ // ciEnv::get_method_by_index ! ciMethod* ciEnv::get_method_by_index(ciInstanceKlass* accessor, ! int index, Bytecodes::Code bc) { if (bc == Bytecodes::_invokedynamic) { ! GUARDED_VM_ENTRY(return get_fake_invokedynamic_method_impl(accessor, index, bc);) } else { ! GUARDED_VM_ENTRY(return get_method_by_index_impl(accessor, index, bc);) } } // ------------------------------------------------------------------ --- 763,779 ---- } // ------------------------------------------------------------------ // ciEnv::get_method_by_index ! ciMethod* ciEnv::get_method_by_index(constantPoolHandle cpool, ! int index, Bytecodes::Code bc, ! ciInstanceKlass* accessor) { if (bc == Bytecodes::_invokedynamic) { ! GUARDED_VM_ENTRY(return get_fake_invokedynamic_method_impl(cpool, index, bc);) } else { ! GUARDED_VM_ENTRY(return get_method_by_index_impl(cpool, index, bc, accessor);) } } // ------------------------------------------------------------------
src/share/vm/ci/ciEnv.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File