471 // Found it. Build a CI handle. |
471 // Found it. Build a CI handle. |
472 return get_object(found_klass())->as_klass(); |
472 return get_object(found_klass())->as_klass(); |
473 } |
473 } |
474 |
474 |
475 if (require_local) return NULL; |
475 if (require_local) return NULL; |
|
476 |
476 // Not yet loaded into the VM, or not governed by loader constraints. |
477 // Not yet loaded into the VM, or not governed by loader constraints. |
477 // Make a CI representative for it. |
478 // Make a CI representative for it. |
478 return get_unloaded_klass(accessing_klass, name); |
479 return get_unloaded_klass(accessing_klass, name); |
479 } |
480 } |
480 |
481 |
496 ciKlass* ciEnv::get_klass_by_index_impl(constantPoolHandle cpool, |
497 ciKlass* ciEnv::get_klass_by_index_impl(constantPoolHandle cpool, |
497 int index, |
498 int index, |
498 bool& is_accessible, |
499 bool& is_accessible, |
499 ciInstanceKlass* accessor) { |
500 ciInstanceKlass* accessor) { |
500 EXCEPTION_CONTEXT; |
501 EXCEPTION_CONTEXT; |
501 KlassHandle klass (THREAD, constantPoolOopDesc::klass_at_if_loaded(cpool, index)); |
502 KlassHandle klass(THREAD, constantPoolOopDesc::klass_at_if_loaded(cpool, index)); |
502 Symbol* klass_name = NULL; |
503 Symbol* klass_name = NULL; |
503 if (klass.is_null()) { |
504 if (klass.is_null()) { |
504 // The klass has not been inserted into the constant pool. |
505 // The klass has not been inserted into the constant pool. |
505 // Try to look it up by name. |
506 // Try to look it up by name. |
506 { |
507 { |
783 } |
784 } |
784 |
785 |
785 // Either the declared holder was not loaded, or the method could |
786 // Either the declared holder was not loaded, or the method could |
786 // not be found. Create a dummy ciMethod to represent the failed |
787 // not be found. Create a dummy ciMethod to represent the failed |
787 // lookup. |
788 // lookup. |
788 |
789 ciSymbol* name = get_symbol(name_sym); |
789 return get_unloaded_method(declared_holder, |
790 ciSymbol* signature = get_symbol(sig_sym); |
790 get_symbol(name_sym), |
791 return get_unloaded_method(declared_holder, name, signature, accessor); |
791 get_symbol(sig_sym)); |
|
792 } |
792 } |
793 |
793 |
794 |
794 |
795 // ------------------------------------------------------------------ |
795 // ------------------------------------------------------------------ |
796 // ciEnv::get_fake_invokedynamic_method_impl |
796 // ciEnv::get_fake_invokedynamic_method_impl |
797 ciMethod* ciEnv::get_fake_invokedynamic_method_impl(constantPoolHandle cpool, |
797 ciMethod* ciEnv::get_fake_invokedynamic_method_impl(constantPoolHandle cpool, |
798 int index, Bytecodes::Code bc) { |
798 int index, Bytecodes::Code bc, |
|
799 ciInstanceKlass* accessor) { |
799 // Compare the following logic with InterpreterRuntime::resolve_invokedynamic. |
800 // Compare the following logic with InterpreterRuntime::resolve_invokedynamic. |
800 assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic"); |
801 assert(bc == Bytecodes::_invokedynamic, "must be invokedynamic"); |
801 |
802 |
802 bool is_resolved = cpool->cache()->main_entry_at(index)->is_resolved(bc); |
803 bool is_resolved = cpool->cache()->main_entry_at(index)->is_resolved(bc); |
803 if (is_resolved && cpool->cache()->secondary_entry_at(index)->is_f1_null()) |
804 if (is_resolved && cpool->cache()->secondary_entry_at(index)->is_f1_null()) |
805 is_resolved = false; |
806 is_resolved = false; |
806 |
807 |
807 // Call site might not be resolved yet. We could create a real invoker method from the |
808 // Call site might not be resolved yet. We could create a real invoker method from the |
808 // compiler, but it is simpler to stop the code path here with an unlinked method. |
809 // compiler, but it is simpler to stop the code path here with an unlinked method. |
809 if (!is_resolved) { |
810 if (!is_resolved) { |
810 ciInstanceKlass* mh_klass = get_object(SystemDictionary::MethodHandle_klass())->as_instance_klass(); |
811 ciInstanceKlass* holder = get_object(SystemDictionary::MethodHandle_klass())->as_instance_klass(); |
811 ciSymbol* sig_sym = get_symbol(cpool->signature_ref_at(index)); |
812 ciSymbol* name = ciSymbol::invokeExact_name(); |
812 return get_unloaded_method(mh_klass, ciSymbol::invokeExact_name(), sig_sym); |
813 ciSymbol* signature = get_symbol(cpool->signature_ref_at(index)); |
|
814 return get_unloaded_method(holder, name, signature, accessor); |
813 } |
815 } |
814 |
816 |
815 // Get the invoker methodOop from the constant pool. |
817 // Get the invoker methodOop from the constant pool. |
816 oop f1_value = cpool->cache()->main_entry_at(index)->f1(); |
818 oop f1_value = cpool->cache()->main_entry_at(index)->f1(); |
817 methodOop signature_invoker = (methodOop) f1_value; |
819 methodOop signature_invoker = (methodOop) f1_value; |
848 // ciEnv::get_method_by_index |
850 // ciEnv::get_method_by_index |
849 ciMethod* ciEnv::get_method_by_index(constantPoolHandle cpool, |
851 ciMethod* ciEnv::get_method_by_index(constantPoolHandle cpool, |
850 int index, Bytecodes::Code bc, |
852 int index, Bytecodes::Code bc, |
851 ciInstanceKlass* accessor) { |
853 ciInstanceKlass* accessor) { |
852 if (bc == Bytecodes::_invokedynamic) { |
854 if (bc == Bytecodes::_invokedynamic) { |
853 GUARDED_VM_ENTRY(return get_fake_invokedynamic_method_impl(cpool, index, bc);) |
855 GUARDED_VM_ENTRY(return get_fake_invokedynamic_method_impl(cpool, index, bc, accessor);) |
854 } else { |
856 } else { |
855 GUARDED_VM_ENTRY(return get_method_by_index_impl(cpool, index, bc, accessor);) |
857 GUARDED_VM_ENTRY(return get_method_by_index_impl( cpool, index, bc, accessor);) |
856 } |
858 } |
857 } |
859 } |
858 |
860 |
859 |
861 |
860 // ------------------------------------------------------------------ |
862 // ------------------------------------------------------------------ |