189 }
190 return false;
191 }
192 return true;
193 }
194
195
196 // negative filter: should callee NOT be inlined?
197 bool InlineTree::should_not_inline(ciMethod *callee_method,
198 ciMethod* caller_method,
199 JVMState* jvms,
200 WarmCallInfo* wci_result) {
201
202 const char* fail_msg = NULL;
203
204 // First check all inlining restrictions which are required for correctness
205 if ( callee_method->is_abstract()) {
206 fail_msg = "abstract method"; // // note: we allow ik->is_abstract()
207 } else if (!callee_method->holder()->is_initialized() &&
208 // access allowed in the context of static initializer
209 !C->is_compiling_clinit_for(callee_method->holder())) {
210 fail_msg = "method holder not initialized";
211 } else if ( callee_method->is_native()) {
212 fail_msg = "native method";
213 } else if ( callee_method->dont_inline()) {
214 fail_msg = "don't inline by annotation";
215 }
216
217 // one more inlining restriction
218 if (fail_msg == NULL && callee_method->has_unloaded_classes_in_signature()) {
219 fail_msg = "unloaded signature classes";
220 }
221
222 if (fail_msg != NULL) {
223 set_msg(fail_msg);
224 return true;
225 }
226
227 // ignore heuristic controls on inlining
228 if (C->directive()->should_inline(callee_method)) {
229 set_msg("force inline by CompileCommand");
464 set_msg("size > DesiredMethodLimit");
465 return false;
466 } else if (!C->inlining_incrementally()) {
467 should_delay = true;
468 }
469 }
470
471 // ok, inline this method
472 return true;
473 }
474
475 //------------------------------pass_initial_checks----------------------------
476 bool InlineTree::pass_initial_checks(ciMethod* caller_method, int caller_bci, ciMethod* callee_method) {
477 ciInstanceKlass *callee_holder = callee_method ? callee_method->holder() : NULL;
478 // Check if a callee_method was suggested
479 if( callee_method == NULL ) return false;
480 // Check if klass of callee_method is loaded
481 if( !callee_holder->is_loaded() ) return false;
482 if( !callee_holder->is_initialized() &&
483 // access allowed in the context of static initializer
484 !C->is_compiling_clinit_for(callee_holder)) {
485 return false;
486 }
487 if( !UseInterpreter ) /* running Xcomp */ {
488 // Checks that constant pool's call site has been visited
489 // stricter than callee_holder->is_initialized()
490 ciBytecodeStream iter(caller_method);
491 iter.force_bci(caller_bci);
492 Bytecodes::Code call_bc = iter.cur_bc();
493 // An invokedynamic instruction does not have a klass.
494 if (call_bc != Bytecodes::_invokedynamic) {
495 int index = iter.get_index_u2_cpcache();
496 if (!caller_method->is_klass_loaded(index, true)) {
497 return false;
498 }
499 // Try to do constant pool resolution if running Xcomp
500 if( !caller_method->check_call(index, call_bc == Bytecodes::_invokestatic) ) {
501 return false;
502 }
503 }
504 }
|
189 }
190 return false;
191 }
192 return true;
193 }
194
195
196 // negative filter: should callee NOT be inlined?
197 bool InlineTree::should_not_inline(ciMethod *callee_method,
198 ciMethod* caller_method,
199 JVMState* jvms,
200 WarmCallInfo* wci_result) {
201
202 const char* fail_msg = NULL;
203
204 // First check all inlining restrictions which are required for correctness
205 if ( callee_method->is_abstract()) {
206 fail_msg = "abstract method"; // // note: we allow ik->is_abstract()
207 } else if (!callee_method->holder()->is_initialized() &&
208 // access allowed in the context of static initializer
209 C->needs_clinit_barrier(callee_method, caller_method)) {
210 fail_msg = "method holder not initialized";
211 } else if ( callee_method->is_native()) {
212 fail_msg = "native method";
213 } else if ( callee_method->dont_inline()) {
214 fail_msg = "don't inline by annotation";
215 }
216
217 // one more inlining restriction
218 if (fail_msg == NULL && callee_method->has_unloaded_classes_in_signature()) {
219 fail_msg = "unloaded signature classes";
220 }
221
222 if (fail_msg != NULL) {
223 set_msg(fail_msg);
224 return true;
225 }
226
227 // ignore heuristic controls on inlining
228 if (C->directive()->should_inline(callee_method)) {
229 set_msg("force inline by CompileCommand");
464 set_msg("size > DesiredMethodLimit");
465 return false;
466 } else if (!C->inlining_incrementally()) {
467 should_delay = true;
468 }
469 }
470
471 // ok, inline this method
472 return true;
473 }
474
475 //------------------------------pass_initial_checks----------------------------
476 bool InlineTree::pass_initial_checks(ciMethod* caller_method, int caller_bci, ciMethod* callee_method) {
477 ciInstanceKlass *callee_holder = callee_method ? callee_method->holder() : NULL;
478 // Check if a callee_method was suggested
479 if( callee_method == NULL ) return false;
480 // Check if klass of callee_method is loaded
481 if( !callee_holder->is_loaded() ) return false;
482 if( !callee_holder->is_initialized() &&
483 // access allowed in the context of static initializer
484 C->needs_clinit_barrier(callee_method, caller_method)) {
485 return false;
486 }
487 if( !UseInterpreter ) /* running Xcomp */ {
488 // Checks that constant pool's call site has been visited
489 // stricter than callee_holder->is_initialized()
490 ciBytecodeStream iter(caller_method);
491 iter.force_bci(caller_bci);
492 Bytecodes::Code call_bc = iter.cur_bc();
493 // An invokedynamic instruction does not have a klass.
494 if (call_bc != Bytecodes::_invokedynamic) {
495 int index = iter.get_index_u2_cpcache();
496 if (!caller_method->is_klass_loaded(index, true)) {
497 return false;
498 }
499 // Try to do constant pool resolution if running Xcomp
500 if( !caller_method->check_call(index, call_bc == Bytecodes::_invokestatic) ) {
501 return false;
502 }
503 }
504 }
|