< prev index next >

src/hotspot/share/opto/bytecodeInfo.cpp

Print this page
rev 54728 : force inline of iterator() methods for better scalar replacement of iterators


  60     // Keep a private copy of the caller_jvms:
  61     _caller_jvms = new (C) JVMState(caller_jvms->method(), caller_tree->caller_jvms());
  62     _caller_jvms->set_bci(caller_jvms->bci());
  63     assert(!caller_jvms->should_reexecute(), "there should be no reexecute bytecode with inlining");
  64   }
  65   assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS");
  66   assert((caller_tree == NULL ? 0 : caller_tree->stack_depth() + 1) == stack_depth(), "correct (redundant) depth parameter");
  67   assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter");
  68   // Update hierarchical counts, count_inline_bcs() and count_inlines()
  69   InlineTree *caller = (InlineTree *)caller_tree;
  70   for( ; caller != NULL; caller = ((InlineTree *)(caller->caller_tree())) ) {
  71     caller->_count_inline_bcs += count_inline_bcs();
  72     NOT_PRODUCT(caller->_count_inlines++;)
  73   }
  74 }
  75 
  76 /**
  77  *  Return true when EA is ON and a java constructor is called or
  78  *  a super constructor is called from an inlined java constructor.
  79  *  Also return true for boxing methods.

  80  */
  81 static bool is_init_with_ea(ciMethod* callee_method,
  82                             ciMethod* caller_method, Compile* C) {
  83   if (!C->do_escape_analysis() || !EliminateAllocations) {
  84     return false; // EA is off
  85   }
  86   if (callee_method->is_initializer()) {
  87     return true; // constuctor
  88   }
  89   if (caller_method->is_initializer() &&
  90       caller_method != C->method() &&
  91       caller_method->holder()->is_subclass_of(callee_method->holder())) {
  92     return true; // super constructor is called from inlined constructor
  93   }
  94   if (C->eliminate_boxing() && callee_method->is_boxing_method()) {
  95     return true;






  96   }
  97   return false;
  98 }
  99 
 100 /**
 101  *  Force inlining unboxing accessor.
 102  */
 103 static bool is_unboxing_method(ciMethod* callee_method, Compile* C) {
 104   return C->eliminate_boxing() && callee_method->is_unboxing_method();
 105 }
 106 
 107 // positive filter: should callee be inlined?
 108 bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
 109                                int caller_bci, ciCallProfile& profile,
 110                                WarmCallInfo* wci_result) {
 111   // Allows targeted inlining
 112   if (C->directive()->should_inline(callee_method)) {
 113     *wci_result = *(WarmCallInfo::always_hot());
 114     if (C->print_inlining() && Verbose) {
 115       CompileTask::print_inline_indent(inline_level());




  60     // Keep a private copy of the caller_jvms:
  61     _caller_jvms = new (C) JVMState(caller_jvms->method(), caller_tree->caller_jvms());
  62     _caller_jvms->set_bci(caller_jvms->bci());
  63     assert(!caller_jvms->should_reexecute(), "there should be no reexecute bytecode with inlining");
  64   }
  65   assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS");
  66   assert((caller_tree == NULL ? 0 : caller_tree->stack_depth() + 1) == stack_depth(), "correct (redundant) depth parameter");
  67   assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter");
  68   // Update hierarchical counts, count_inline_bcs() and count_inlines()
  69   InlineTree *caller = (InlineTree *)caller_tree;
  70   for( ; caller != NULL; caller = ((InlineTree *)(caller->caller_tree())) ) {
  71     caller->_count_inline_bcs += count_inline_bcs();
  72     NOT_PRODUCT(caller->_count_inlines++;)
  73   }
  74 }
  75 
  76 /**
  77  *  Return true when EA is ON and a java constructor is called or
  78  *  a super constructor is called from an inlined java constructor.
  79  *  Also return true for boxing methods.
  80  *  Also return true for Iterable::iterator() invocation that is essential for forall-loops performance.
  81  */
  82 static bool is_init_with_ea(ciMethod* callee_method,
  83                             ciMethod* caller_method, Compile* C) {
  84   if (!C->do_escape_analysis() || !EliminateAllocations) {
  85     return false; // EA is off
  86   }
  87   if (callee_method->is_initializer()) {
  88     return true; // constuctor
  89   }
  90   if (caller_method->is_initializer() &&
  91       caller_method != C->method() &&
  92       caller_method->holder()->is_subclass_of(callee_method->holder())) {
  93     return true; // super constructor is called from inlined constructor
  94   }
  95   if (C->eliminate_boxing() && callee_method->is_boxing_method()) {
  96     return true;
  97   }
  98   if (callee_method->name() == ciSymbol::iterator_name()) {
  99     ciType *retType = callee_method->signature()->return_type();
 100     if(retType->is_klass() && retType->as_klass()->is_subtype_of(C->env()->Iterator_klass())) {
 101       return true;
 102     }
 103   }
 104   return false;
 105 }
 106 
 107 /**
 108  *  Force inlining unboxing accessor.
 109  */
 110 static bool is_unboxing_method(ciMethod* callee_method, Compile* C) {
 111   return C->eliminate_boxing() && callee_method->is_unboxing_method();
 112 }
 113 
 114 // positive filter: should callee be inlined?
 115 bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
 116                                int caller_bci, ciCallProfile& profile,
 117                                WarmCallInfo* wci_result) {
 118   // Allows targeted inlining
 119   if (C->directive()->should_inline(callee_method)) {
 120     *wci_result = *(WarmCallInfo::always_hot());
 121     if (C->print_inlining() && Verbose) {
 122       CompileTask::print_inline_indent(inline_level());


< prev index next >