Mercurial > hg > truffle
comparison src/share/vm/ci/ciEnv.cpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 82af018d61db 1d7922586cf6 |
children | c38f13903fdf |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
48 #include "oops/methodDataOop.hpp" | 48 #include "oops/methodDataOop.hpp" |
49 #include "oops/objArrayKlass.hpp" | 49 #include "oops/objArrayKlass.hpp" |
50 #include "oops/oop.inline.hpp" | 50 #include "oops/oop.inline.hpp" |
51 #include "oops/oop.inline2.hpp" | 51 #include "oops/oop.inline2.hpp" |
52 #include "prims/jvmtiExport.hpp" | 52 #include "prims/jvmtiExport.hpp" |
53 #include "prims/methodHandleWalk.hpp" | |
54 #include "runtime/init.hpp" | 53 #include "runtime/init.hpp" |
55 #include "runtime/reflection.hpp" | 54 #include "runtime/reflection.hpp" |
56 #include "runtime/sharedRuntime.hpp" | 55 #include "runtime/sharedRuntime.hpp" |
57 #include "utilities/dtrace.hpp" | 56 #include "utilities/dtrace.hpp" |
58 #ifdef COMPILER1 | 57 #ifdef COMPILER1 |
579 int index = pool_index; | 578 int index = pool_index; |
580 if (cache_index >= 0) { | 579 if (cache_index >= 0) { |
581 assert(index < 0, "only one kind of index at a time"); | 580 assert(index < 0, "only one kind of index at a time"); |
582 ConstantPoolCacheEntry* cpc_entry = cpool->cache()->entry_at(cache_index); | 581 ConstantPoolCacheEntry* cpc_entry = cpool->cache()->entry_at(cache_index); |
583 index = cpc_entry->constant_pool_index(); | 582 index = cpc_entry->constant_pool_index(); |
584 oop obj = cpc_entry->f1(); | 583 oop obj = cpc_entry->f1_as_instance(); |
585 if (obj != NULL) { | 584 if (obj != NULL) { |
586 assert(obj->is_instance() || obj->is_array(), "must be a Java reference"); | 585 assert(obj->is_instance() || obj->is_array(), "must be a Java reference"); |
587 ciObject* ciobj = get_object(obj); | 586 ciObject* ciobj = get_object(obj); |
588 return ciConstant(T_OBJECT, ciobj); | 587 return ciConstant(T_OBJECT, ciobj); |
589 } | 588 } |
747 Symbol* name_sym = cpool->name_ref_at(index); | 746 Symbol* name_sym = cpool->name_ref_at(index); |
748 Symbol* sig_sym = cpool->signature_ref_at(index); | 747 Symbol* sig_sym = cpool->signature_ref_at(index); |
749 | 748 |
750 if (cpool->has_preresolution() | 749 if (cpool->has_preresolution() |
751 || (holder == ciEnv::MethodHandle_klass() && | 750 || (holder == ciEnv::MethodHandle_klass() && |
752 methodOopDesc::is_method_handle_invoke_name(name_sym))) { | 751 MethodHandles::is_signature_polymorphic_name(holder->get_klassOop(), name_sym))) { |
753 // Short-circuit lookups for JSR 292-related call sites. | 752 // Short-circuit lookups for JSR 292-related call sites. |
754 // That is, do not rely only on name-based lookups, because they may fail | 753 // That is, do not rely only on name-based lookups, because they may fail |
755 // if the names are not resolvable in the boot class loader (7056328). | 754 // if the names are not resolvable in the boot class loader (7056328). |
756 switch (bc) { | 755 switch (bc) { |
757 case Bytecodes::_invokevirtual: | 756 case Bytecodes::_invokevirtual: |
758 case Bytecodes::_invokeinterface: | 757 case Bytecodes::_invokeinterface: |
759 case Bytecodes::_invokespecial: | 758 case Bytecodes::_invokespecial: |
760 case Bytecodes::_invokestatic: | 759 case Bytecodes::_invokestatic: |
761 { | 760 { |
762 methodOop m = constantPoolOopDesc::method_at_if_loaded(cpool, index, bc); | 761 oop appendix_oop = NULL; |
762 methodOop m = constantPoolOopDesc::method_at_if_loaded(cpool, index); | |
763 if (m != NULL) { | 763 if (m != NULL) { |
764 return get_object(m)->as_method(); | 764 return get_object(m)->as_method(); |
765 } | 765 } |
766 } | 766 } |
767 break; | |
767 } | 768 } |
768 } | 769 } |
769 | 770 |
770 if (holder_is_accessible) { // Our declared holder is loaded. | 771 if (holder_is_accessible) { // Our declared holder is loaded. |
771 instanceKlass* lookup = declared_holder->get_instanceKlass(); | 772 instanceKlass* lookup = declared_holder->get_instanceKlass(); |
797 int index, Bytecodes::Code bc, | 798 int index, Bytecodes::Code bc, |
798 ciInstanceKlass* accessor) { | 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 ConstantPoolCacheEntry* secondary_entry = cpool->cache()->secondary_entry_at(index); |
803 if (is_resolved && cpool->cache()->secondary_entry_at(index)->is_f1_null()) | 804 bool is_resolved = !secondary_entry->is_f1_null(); |
804 // FIXME: code generation could allow for null (unlinked) call site | 805 // FIXME: code generation could allow for null (unlinked) call site |
805 is_resolved = false; | 806 // The call site could be made patchable as follows: |
806 | 807 // Load the appendix argument from the constant pool. |
807 // Call site might not be resolved yet. We could create a real invoker method from the | 808 // Test the appendix argument and jump to a known deopt routine if it is null. |
808 // compiler, but it is simpler to stop the code path here with an unlinked method. | 809 // Jump through a patchable call site, which is initially a deopt routine. |
810 // Patch the call site to the nmethod entry point of the static compiled lambda form. | |
811 // As with other two-component call sites, both values must be independently verified. | |
812 | |
813 // Call site might not be resolved yet. | |
814 // Stop the code path here with an unlinked method. | |
809 if (!is_resolved) { | 815 if (!is_resolved) { |
810 ciInstanceKlass* holder = get_object(SystemDictionary::MethodHandle_klass())->as_instance_klass(); | 816 ciInstanceKlass* holder = get_object(SystemDictionary::MethodHandle_klass())->as_instance_klass(); |
811 ciSymbol* name = ciSymbol::invokeExact_name(); | 817 ciSymbol* name = ciSymbol::invokeBasic_name(); |
812 ciSymbol* signature = get_symbol(cpool->signature_ref_at(index)); | 818 ciSymbol* signature = get_symbol(cpool->signature_ref_at(index)); |
813 return get_unloaded_method(holder, name, signature, accessor); | 819 return get_unloaded_method(holder, name, signature, accessor); |
814 } | 820 } |
815 | 821 |
816 // Get the invoker methodOop from the constant pool. | 822 // Get the invoker methodOop and the extra argument from the constant pool. |
817 oop f1_value = cpool->cache()->main_entry_at(index)->f1(); | 823 methodOop adapter = secondary_entry->f2_as_vfinal_method(); |
818 methodOop signature_invoker = (methodOop) f1_value; | 824 return get_object(adapter)->as_method(); |
819 assert(signature_invoker != NULL && signature_invoker->is_method() && signature_invoker->is_method_handle_invoke(), | |
820 "correct result from LinkResolver::resolve_invokedynamic"); | |
821 | |
822 return get_object(signature_invoker)->as_method(); | |
823 } | 825 } |
824 | 826 |
825 | 827 |
826 // ------------------------------------------------------------------ | 828 // ------------------------------------------------------------------ |
827 // ciEnv::get_instance_klass_for_declared_method_holder | 829 // ciEnv::get_instance_klass_for_declared_method_holder |
1129 } | 1131 } |
1130 | 1132 |
1131 // ------------------------------------------------------------------ | 1133 // ------------------------------------------------------------------ |
1132 // ciEnv::notice_inlined_method() | 1134 // ciEnv::notice_inlined_method() |
1133 void ciEnv::notice_inlined_method(ciMethod* method) { | 1135 void ciEnv::notice_inlined_method(ciMethod* method) { |
1134 _num_inlined_bytecodes += method->code_size(); | 1136 _num_inlined_bytecodes += method->code_size_for_inlining(); |
1135 } | 1137 } |
1136 | 1138 |
1137 // ------------------------------------------------------------------ | 1139 // ------------------------------------------------------------------ |
1138 // ciEnv::num_inlined_bytecodes() | 1140 // ciEnv::num_inlined_bytecodes() |
1139 int ciEnv::num_inlined_bytecodes() const { | 1141 int ciEnv::num_inlined_bytecodes() const { |