comparison src/share/vm/opto/doCall.cpp @ 4117:a04a201f0f5a

7108383: JSR 292: JRuby bench_define_method_methods.rb: assert(slow_jvms != NULL) failed: miss path must not Reviewed-by: kvn, never
author twisti
date Thu, 17 Nov 2011 04:07:30 -0800
parents aa67216400d3
children b40ac3579043
comparison
equal deleted inserted replaced
4116:973293defacd 4117:a04a201f0f5a
60 #endif 60 #endif
61 61
62 CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, 62 CallGenerator* Compile::call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual,
63 JVMState* jvms, bool allow_inline, 63 JVMState* jvms, bool allow_inline,
64 float prof_factor) { 64 float prof_factor) {
65 CallGenerator* cg;
66 ciMethod* caller = jvms->method(); 65 ciMethod* caller = jvms->method();
67 int bci = jvms->bci(); 66 int bci = jvms->bci();
68 Bytecodes::Code bytecode = caller->java_code_at_bci(bci); 67 Bytecodes::Code bytecode = caller->java_code_at_bci(bci);
69 guarantee(call_method != NULL, "failed method resolution"); 68 guarantee(call_method != NULL, "failed method resolution");
70 69
108 // methods. If these methods are replaced with specialized code, 107 // methods. If these methods are replaced with specialized code,
109 // then we return it as the inlined version of the call. 108 // then we return it as the inlined version of the call.
110 // We do this before the strict f.p. check below because the 109 // We do this before the strict f.p. check below because the
111 // intrinsics handle strict f.p. correctly. 110 // intrinsics handle strict f.p. correctly.
112 if (allow_inline) { 111 if (allow_inline) {
113 cg = find_intrinsic(call_method, call_is_virtual); 112 CallGenerator* cg = find_intrinsic(call_method, call_is_virtual);
114 if (cg != NULL) return cg; 113 if (cg != NULL) return cg;
115 } 114 }
116 115
117 // Do method handle calls. 116 // Do method handle calls.
118 // NOTE: This must happen before normal inlining logic below since 117 // NOTE: This must happen before normal inlining logic below since
119 // MethodHandle.invoke* are native methods which obviously don't 118 // MethodHandle.invoke* are native methods which obviously don't
120 // have bytecodes and so normal inlining fails. 119 // have bytecodes and so normal inlining fails.
121 if (call_method->is_method_handle_invoke()) { 120 if (call_method->is_method_handle_invoke()) {
122 if (bytecode != Bytecodes::_invokedynamic) { 121 if (bytecode != Bytecodes::_invokedynamic) {
123 GraphKit kit(jvms); 122 GraphKit kit(jvms);
124 Node* n = kit.argument(0); 123 Node* method_handle = kit.argument(0);
125 124 return CallGenerator::for_method_handle_call(method_handle, jvms, caller, call_method, profile);
126 CallGenerator* cg = CallGenerator::for_method_handle_inline(n, jvms, caller, call_method, profile);
127 if (cg != NULL) {
128 return cg;
129 }
130 return CallGenerator::for_direct_call(call_method);
131 } 125 }
132 else { 126 else {
133 // Get the CallSite object. 127 return CallGenerator::for_invokedynamic_call(jvms, caller, call_method, profile);
134 ciMethod* caller_method = jvms->method();
135 ciBytecodeStream str(caller_method);
136 str.force_bci(jvms->bci()); // Set the stream to the invokedynamic bci.
137 ciCallSite* call_site = str.get_call_site();
138
139 CallGenerator* cg = CallGenerator::for_invokedynamic_inline(call_site, jvms, caller, call_method, profile);
140 if (cg != NULL) {
141 return cg;
142 }
143 // If something failed, generate a normal dynamic call.
144 return CallGenerator::for_dynamic_call(call_method);
145 } 128 }
146 } 129 }
147 130
148 // Do not inline strict fp into non-strict code, or the reverse 131 // Do not inline strict fp into non-strict code, or the reverse
149 bool caller_method_is_strict = jvms->method()->is_strict(); 132 if (caller->is_strict() ^ call_method->is_strict()) {
150 if( caller_method_is_strict ^ call_method->is_strict() ) {
151 allow_inline = false; 133 allow_inline = false;
152 } 134 }
153 135
154 // Attempt to inline... 136 // Attempt to inline...
155 if (allow_inline) { 137 if (allow_inline) {
256 // Whenever we inline, the dependency is added by Parse::Parse(). 238 // Whenever we inline, the dependency is added by Parse::Parse().
257 miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX); 239 miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
258 } 240 }
259 if (miss_cg != NULL) { 241 if (miss_cg != NULL) {
260 NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count)); 242 NOT_PRODUCT(trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count));
261 cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0)); 243 CallGenerator* cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0));
262 if (cg != NULL) return cg; 244 if (cg != NULL) return cg;
263 } 245 }
264 } 246 }
265 } 247 }
266 } 248 }