src/share/vm/runtime/compilationPolicy.hpp

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 









  25 // The CompilationPolicy selects which method (if any) should be compiled.
  26 // It also decides which methods must always be compiled (i.e., are never
  27 // interpreted).
  28 class CompileTask;
  29 class CompileQueue;
  30 
  31 class CompilationPolicy : public CHeapObj {
  32   static CompilationPolicy* _policy;
  33   // Accumulated time
  34   static elapsedTimer       _accumulated_time;
  35 
  36   static bool               _in_vm_startup;
  37 public:
  38   static  void set_in_vm_startup(bool in_vm_startup) { _in_vm_startup = in_vm_startup; }
  39   static  void completed_vm_startup();
  40   static  bool delay_compilation_during_startup()    { return _in_vm_startup; }
  41 
  42   // m must be compiled before executing it
  43   static bool must_be_compiled(methodHandle m, int comp_level = CompLevel_all);
  44   // m is allowed to be compiled


 109 class StackWalkCompPolicy : public NonTieredCompPolicy {
 110  public:
 111   virtual void method_invocation_event(methodHandle m, TRAPS);
 112   virtual void method_back_branch_event(methodHandle m, int bci, TRAPS);
 113 
 114  private:
 115   RFrame* findTopInlinableFrame(GrowableArray<RFrame*>* stack);
 116   RFrame* senderOf(RFrame* rf, GrowableArray<RFrame*>* stack);
 117 
 118   // the following variables hold values computed by the last inlining decision
 119   // they are used for performance debugging only (print better messages)
 120   static const char* _msg;            // reason for not inlining
 121 
 122   static const char* shouldInline   (methodHandle callee, float frequency, int cnt);
 123   // positive filter: should send be inlined?  returns NULL (--> yes) or rejection msg
 124   static const char* shouldNotInline(methodHandle callee);
 125   // negative filter: should send NOT be inlined?  returns NULL (--> inline) or rejection msg
 126 
 127 };
 128 #endif




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_COMPILATIONPOLICY_HPP
  26 #define SHARE_VM_RUNTIME_COMPILATIONPOLICY_HPP
  27 
  28 #include "code/nmethod.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "runtime/vm_operations.hpp"
  32 #include "utilities/growableArray.hpp"
  33 
  34 // The CompilationPolicy selects which method (if any) should be compiled.
  35 // It also decides which methods must always be compiled (i.e., are never
  36 // interpreted).
  37 class CompileTask;
  38 class CompileQueue;
  39 
  40 class CompilationPolicy : public CHeapObj {
  41   static CompilationPolicy* _policy;
  42   // Accumulated time
  43   static elapsedTimer       _accumulated_time;
  44 
  45   static bool               _in_vm_startup;
  46 public:
  47   static  void set_in_vm_startup(bool in_vm_startup) { _in_vm_startup = in_vm_startup; }
  48   static  void completed_vm_startup();
  49   static  bool delay_compilation_during_startup()    { return _in_vm_startup; }
  50 
  51   // m must be compiled before executing it
  52   static bool must_be_compiled(methodHandle m, int comp_level = CompLevel_all);
  53   // m is allowed to be compiled


 118 class StackWalkCompPolicy : public NonTieredCompPolicy {
 119  public:
 120   virtual void method_invocation_event(methodHandle m, TRAPS);
 121   virtual void method_back_branch_event(methodHandle m, int bci, TRAPS);
 122 
 123  private:
 124   RFrame* findTopInlinableFrame(GrowableArray<RFrame*>* stack);
 125   RFrame* senderOf(RFrame* rf, GrowableArray<RFrame*>* stack);
 126 
 127   // the following variables hold values computed by the last inlining decision
 128   // they are used for performance debugging only (print better messages)
 129   static const char* _msg;            // reason for not inlining
 130 
 131   static const char* shouldInline   (methodHandle callee, float frequency, int cnt);
 132   // positive filter: should send be inlined?  returns NULL (--> yes) or rejection msg
 133   static const char* shouldNotInline(methodHandle callee);
 134   // negative filter: should send NOT be inlined?  returns NULL (--> inline) or rejection msg
 135 
 136 };
 137 #endif
 138 
 139 #endif // SHARE_VM_RUNTIME_COMPILATIONPOLICY_HPP