comparison src/share/vm/runtime/sharedRuntime.cpp @ 1149:0579c695832f

Merge
author ysr
date Sat, 09 Jan 2010 09:01:41 -0800
parents 4ce7240d622c
children cf0685d550f1
comparison
equal deleted inserted replaced
1148:05b775309e59 1149:0579c695832f
800 assert (receiver.is_null() || receiver->is_oop(), "wrong receiver"); 800 assert (receiver.is_null() || receiver->is_oop(), "wrong receiver");
801 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle)); 801 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle));
802 802
803 #ifdef ASSERT 803 #ifdef ASSERT
804 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls 804 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls
805 if (bc != Bytecodes::_invokestatic) { 805 if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic) {
806 assert(receiver.not_null(), "should have thrown exception"); 806 assert(receiver.not_null(), "should have thrown exception");
807 KlassHandle receiver_klass (THREAD, receiver->klass()); 807 KlassHandle receiver_klass (THREAD, receiver->klass());
808 klassOop rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); 808 klassOop rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle));
809 // klass is already loaded 809 // klass is already loaded
810 KlassHandle static_receiver_klass (THREAD, rk); 810 KlassHandle static_receiver_klass (THREAD, rk);
858 methodHandle callee_method; 858 methodHandle callee_method;
859 callee_method = resolve_sub_helper(thread, is_virtual, is_optimized, THREAD); 859 callee_method = resolve_sub_helper(thread, is_virtual, is_optimized, THREAD);
860 if (JvmtiExport::can_hotswap_or_post_breakpoint()) { 860 if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
861 int retry_count = 0; 861 int retry_count = 0;
862 while (!HAS_PENDING_EXCEPTION && callee_method->is_old() && 862 while (!HAS_PENDING_EXCEPTION && callee_method->is_old() &&
863 callee_method->method_holder() != SystemDictionary::object_klass()) { 863 callee_method->method_holder() != SystemDictionary::Object_klass()) {
864 // If has a pending exception then there is no need to re-try to 864 // If has a pending exception then there is no need to re-try to
865 // resolve this method. 865 // resolve this method.
866 // If the method has been redefined, we need to try again. 866 // If the method has been redefined, we need to try again.
867 // Hack: we have no way to update the vtables of arrays, so don't 867 // Hack: we have no way to update the vtables of arrays, so don't
868 // require that java.lang.Object has been updated. 868 // require that java.lang.Object has been updated.
1025 // safepoint is possible and have trouble gc'ing the compiled args. 1025 // safepoint is possible and have trouble gc'ing the compiled args.
1026 RegisterMap reg_map(thread, false); 1026 RegisterMap reg_map(thread, false);
1027 frame stub_frame = thread->last_frame(); 1027 frame stub_frame = thread->last_frame();
1028 assert(stub_frame.is_runtime_frame(), "sanity check"); 1028 assert(stub_frame.is_runtime_frame(), "sanity check");
1029 frame caller_frame = stub_frame.sender(&reg_map); 1029 frame caller_frame = stub_frame.sender(&reg_map);
1030 if (caller_frame.is_interpreted_frame() || caller_frame.is_entry_frame() ) { 1030
1031 // MethodHandle invokes don't have a CompiledIC and should always
1032 // simply redispatch to the callee_target.
1033 address sender_pc = caller_frame.pc();
1034 CodeBlob* sender_cb = caller_frame.cb();
1035 nmethod* sender_nm = sender_cb->as_nmethod_or_null();
1036
1037 if (caller_frame.is_interpreted_frame() ||
1038 caller_frame.is_entry_frame() ||
1039 (sender_nm != NULL && sender_nm->is_method_handle_return(sender_pc))) {
1031 methodOop callee = thread->callee_target(); 1040 methodOop callee = thread->callee_target();
1032 guarantee(callee != NULL && callee->is_method(), "bad handshake"); 1041 guarantee(callee != NULL && callee->is_method(), "bad handshake");
1033 thread->set_vm_result(callee); 1042 thread->set_vm_result(callee);
1034 thread->set_callee_target(NULL); 1043 thread->set_callee_target(NULL);
1035 return callee->get_c2i_entry(); 1044 return callee->get_c2i_entry();
1527 } 1536 }
1528 1537
1529 oop SharedRuntime::wrong_method_type_is_for_single_argument(JavaThread* thr, 1538 oop SharedRuntime::wrong_method_type_is_for_single_argument(JavaThread* thr,
1530 oopDesc* required) { 1539 oopDesc* required) {
1531 if (required == NULL) return NULL; 1540 if (required == NULL) return NULL;
1532 if (required->klass() == SystemDictionary::class_klass()) 1541 if (required->klass() == SystemDictionary::Class_klass())
1533 return required; 1542 return required;
1534 if (required->is_klass()) 1543 if (required->is_klass())
1535 return Klass::cast(klassOop(required))->java_mirror(); 1544 return Klass::cast(klassOop(required))->java_mirror();
1536 return NULL; 1545 return NULL;
1537 } 1546 }
2134 // Return argument 0 register. In the LP64 build pointers 2143 // Return argument 0 register. In the LP64 build pointers
2135 // take 2 registers, but the VM wants only the 'main' name. 2144 // take 2 registers, but the VM wants only the 'main' name.
2136 return regs.first(); 2145 return regs.first();
2137 } 2146 }
2138 2147
2139 VMRegPair *SharedRuntime::find_callee_arguments(symbolOop sig, bool is_static, int* arg_size) { 2148 VMRegPair *SharedRuntime::find_callee_arguments(symbolOop sig, bool has_receiver, int* arg_size) {
2140 // This method is returning a data structure allocating as a 2149 // This method is returning a data structure allocating as a
2141 // ResourceObject, so do not put any ResourceMarks in here. 2150 // ResourceObject, so do not put any ResourceMarks in here.
2142 char *s = sig->as_C_string(); 2151 char *s = sig->as_C_string();
2143 int len = (int)strlen(s); 2152 int len = (int)strlen(s);
2144 *s++; len--; // Skip opening paren 2153 *s++; len--; // Skip opening paren
2146 while( *(--t) != ')' ) ; // Find close paren 2155 while( *(--t) != ')' ) ; // Find close paren
2147 2156
2148 BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, 256 ); 2157 BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, 256 );
2149 VMRegPair *regs = NEW_RESOURCE_ARRAY( VMRegPair, 256 ); 2158 VMRegPair *regs = NEW_RESOURCE_ARRAY( VMRegPair, 256 );
2150 int cnt = 0; 2159 int cnt = 0;
2151 if (!is_static) { 2160 if (has_receiver) {
2152 sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature 2161 sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
2153 } 2162 }
2154 2163
2155 while( s < t ) { 2164 while( s < t ) {
2156 switch( *s++ ) { // Switch on signature character 2165 switch( *s++ ) { // Switch on signature character