comparison src/share/vm/runtime/sharedRuntime.cpp @ 12160:f98f5d48f511

7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked Summary: Do patching rather bailing out for unlinked call with appendix Reviewed-by: twisti, kvn
author roland
date Wed, 21 Aug 2013 13:34:45 +0200
parents 9ba41a4a71ff
children 891687731b59 190899198332
comparison
equal deleted inserted replaced
12159:b17d8f6d9ed7 12160:f98f5d48f511
1049 bc = bytecode.invoke_code(); 1049 bc = bytecode.invoke_code();
1050 int bytecode_index = bytecode.index(); 1050 int bytecode_index = bytecode.index();
1051 1051
1052 // Find receiver for non-static call 1052 // Find receiver for non-static call
1053 if (bc != Bytecodes::_invokestatic && 1053 if (bc != Bytecodes::_invokestatic &&
1054 bc != Bytecodes::_invokedynamic) { 1054 bc != Bytecodes::_invokedynamic &&
1055 bc != Bytecodes::_invokehandle) {
1055 // This register map must be update since we need to find the receiver for 1056 // This register map must be update since we need to find the receiver for
1056 // compiled frames. The receiver might be in a register. 1057 // compiled frames. The receiver might be in a register.
1057 RegisterMap reg_map2(thread); 1058 RegisterMap reg_map2(thread);
1058 frame stubFrame = thread->last_frame(); 1059 frame stubFrame = thread->last_frame();
1059 // Caller-frame is a compiled frame 1060 // Caller-frame is a compiled frame
1076 assert(receiver.is_null() || receiver->is_oop(), "wrong receiver"); 1077 assert(receiver.is_null() || receiver->is_oop(), "wrong receiver");
1077 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle)); 1078 LinkResolver::resolve_invoke(callinfo, receiver, constants, bytecode_index, bc, CHECK_(nullHandle));
1078 1079
1079 #ifdef ASSERT 1080 #ifdef ASSERT
1080 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls 1081 // Check that the receiver klass is of the right subtype and that it is initialized for virtual calls
1081 if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic) { 1082 if (bc != Bytecodes::_invokestatic && bc != Bytecodes::_invokedynamic && bc != Bytecodes::_invokehandle) {
1082 assert(receiver.not_null(), "should have thrown exception"); 1083 assert(receiver.not_null(), "should have thrown exception");
1083 KlassHandle receiver_klass(THREAD, receiver->klass()); 1084 KlassHandle receiver_klass(THREAD, receiver->klass());
1084 Klass* rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle)); 1085 Klass* rk = constants->klass_ref_at(bytecode_index, CHECK_(nullHandle));
1085 // klass is already loaded 1086 // klass is already loaded
1086 KlassHandle static_receiver_klass(THREAD, rk); 1087 KlassHandle static_receiver_klass(THREAD, rk);
1238 #ifdef ASSERT 1239 #ifdef ASSERT
1239 address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below 1240 address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below
1240 #endif 1241 #endif
1241 1242
1242 if (is_virtual) { 1243 if (is_virtual) {
1243 assert(receiver.not_null(), "sanity check"); 1244 assert(receiver.not_null() || invoke_code == Bytecodes::_invokehandle, "sanity check");
1244 bool static_bound = call_info.resolved_method()->can_be_statically_bound(); 1245 bool static_bound = call_info.resolved_method()->can_be_statically_bound();
1245 KlassHandle h_klass(THREAD, receiver->klass()); 1246 KlassHandle h_klass(THREAD, invoke_code == Bytecodes::_invokehandle ? NULL : receiver->klass());
1246 CompiledIC::compute_monomorphic_entry(callee_method, h_klass, 1247 CompiledIC::compute_monomorphic_entry(callee_method, h_klass,
1247 is_optimized, static_bound, virtual_call_info, 1248 is_optimized, static_bound, virtual_call_info,
1248 CHECK_(methodHandle())); 1249 CHECK_(methodHandle()));
1249 } else { 1250 } else {
1250 // static call 1251 // static call