81
82 // Get a compilation level for a given method.
83 static CompLevel comp_level(Method* method) {
84 nmethod *nm = method->code();
85 if (nm != NULL && nm->is_in_use()) {
86 return (CompLevel)nm->comp_level();
87 }
88 return CompLevel_none;
89 }
90 virtual void method_invocation_event(methodHandle method, methodHandle inlinee,
91 CompLevel level, nmethod* nm, JavaThread* thread);
92 virtual void method_back_branch_event(methodHandle method, methodHandle inlinee,
93 int bci, CompLevel level, nmethod* nm, JavaThread* thread);
94 public:
95 SimpleThresholdPolicy() : _c1_count(0), _c2_count(0) { }
96 virtual int compiler_count(CompLevel comp_level) {
97 if (is_c1_compile(comp_level)) return c1_count();
98 if (is_c2_compile(comp_level)) return c2_count();
99 return 0;
100 }
101 virtual CompLevel initial_compile_level() { return MIN2((CompLevel)TieredStopAtLevel, CompLevel_initial_compile); }
102 virtual void do_safepoint_work() { }
103 virtual void delay_compilation(Method* method) { }
104 virtual void disable_compilation(Method* method) { }
105 virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
106 virtual nmethod* event(methodHandle method, methodHandle inlinee,
107 int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
108 // Select task is called by CompileBroker. We should return a task or NULL.
109 virtual CompileTask* select_task(CompileQueue* compile_queue);
110 // Tell the runtime if we think a given method is adequately profiled.
111 virtual bool is_mature(Method* method);
112 // Initialize: set compiler thread count
113 virtual void initialize();
114 virtual bool should_not_inline(ciEnv* env, ciMethod* callee) {
115 return (env->comp_level() == CompLevel_limited_profile ||
116 env->comp_level() == CompLevel_full_profile) &&
117 callee->has_loops();
118 }
119 };
120
121 #endif // SHARE_VM_RUNTIME_SIMPLETHRESHOLDPOLICY_HPP
|
81
82 // Get a compilation level for a given method.
83 static CompLevel comp_level(Method* method) {
84 nmethod *nm = method->code();
85 if (nm != NULL && nm->is_in_use()) {
86 return (CompLevel)nm->comp_level();
87 }
88 return CompLevel_none;
89 }
90 virtual void method_invocation_event(methodHandle method, methodHandle inlinee,
91 CompLevel level, nmethod* nm, JavaThread* thread);
92 virtual void method_back_branch_event(methodHandle method, methodHandle inlinee,
93 int bci, CompLevel level, nmethod* nm, JavaThread* thread);
94 public:
95 SimpleThresholdPolicy() : _c1_count(0), _c2_count(0) { }
96 virtual int compiler_count(CompLevel comp_level) {
97 if (is_c1_compile(comp_level)) return c1_count();
98 if (is_c2_compile(comp_level)) return c2_count();
99 return 0;
100 }
101 virtual CompLevel initial_compile_level() { return MIN2((CompLevel)TieredStopAtLevel, (CompLevel)TieredStartAtLevel); }
102 virtual void do_safepoint_work() { }
103 virtual void delay_compilation(Method* method) { }
104 virtual void disable_compilation(Method* method) { }
105 virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
106 virtual nmethod* event(methodHandle method, methodHandle inlinee,
107 int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
108 // Select task is called by CompileBroker. We should return a task or NULL.
109 virtual CompileTask* select_task(CompileQueue* compile_queue);
110 // Tell the runtime if we think a given method is adequately profiled.
111 virtual bool is_mature(Method* method);
112 // Initialize: set compiler thread count
113 virtual void initialize();
114 virtual bool should_not_inline(ciEnv* env, ciMethod* callee) {
115 return (env->comp_level() == CompLevel_limited_profile ||
116 env->comp_level() == CompLevel_full_profile) &&
117 callee->has_loops();
118 }
119 };
120
121 #endif // SHARE_VM_RUNTIME_SIMPLETHRESHOLDPOLICY_HPP
|