188 // Compute the weight of the method for the compilation scheduling 189 inline double weight(Method* method); 190 // Apply heuristics and return true if x should be compiled before y 191 inline bool compare_methods(Method* x, Method* y); 192 // Compute event rate for a given method. The rate is the number of event (invocations + backedges) 193 // per millisecond. 194 inline void update_rate(jlong t, Method* m); 195 // Compute threshold scaling coefficient 196 inline double threshold_scale(CompLevel level, int feedback_k); 197 // If a method is old enough and is still in the interpreter we would want to 198 // start profiling without waiting for the compiled method to arrive. This function 199 // determines whether we should do that. 200 inline bool should_create_mdo(Method* method, CompLevel cur_level); 201 // Create MDO if necessary. 202 void create_mdo(methodHandle mh, JavaThread* thread); 203 // Is method profiled enough? 204 bool is_method_profiled(Method* method); 205 206 double _increase_threshold_at_ratio; 207 208 protected: 209 void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level); 210 211 void set_increase_threshold_at_ratio() { _increase_threshold_at_ratio = 100 / (100 - (double)IncreaseFirstTierCompileThresholdAt); } 212 void set_start_time(jlong t) { _start_time = t; } 213 jlong start_time() const { return _start_time; } 214 215 // Submit a given method for compilation (and update the rate). 216 virtual void submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread); 217 // event() from SimpleThresholdPolicy would call these. 218 virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee, 219 CompLevel level, CompiledMethod* nm, JavaThread* thread); 220 virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee, 221 int bci, CompLevel level, CompiledMethod* nm, JavaThread* thread); 222 public: 223 AdvancedThresholdPolicy() : _start_time(0) { } 224 // Select task is called by CompileBroker. We should return a task or NULL. 225 virtual CompileTask* select_task(CompileQueue* compile_queue); 226 virtual void initialize(); 227 virtual bool should_not_inline(ciEnv* env, ciMethod* callee); | 188 // Compute the weight of the method for the compilation scheduling 189 inline double weight(Method* method); 190 // Apply heuristics and return true if x should be compiled before y 191 inline bool compare_methods(Method* x, Method* y); 192 // Compute event rate for a given method. The rate is the number of event (invocations + backedges) 193 // per millisecond. 194 inline void update_rate(jlong t, Method* m); 195 // Compute threshold scaling coefficient 196 inline double threshold_scale(CompLevel level, int feedback_k); 197 // If a method is old enough and is still in the interpreter we would want to 198 // start profiling without waiting for the compiled method to arrive. This function 199 // determines whether we should do that. 200 inline bool should_create_mdo(Method* method, CompLevel cur_level); 201 // Create MDO if necessary. 202 void create_mdo(methodHandle mh, JavaThread* thread); 203 // Is method profiled enough? 204 bool is_method_profiled(Method* method); 205 206 double _increase_threshold_at_ratio; 207 208 bool maybe_switch_to_aot(methodHandle mh, CompLevel cur_level, CompLevel next_level, JavaThread* thread); 209 210 protected: 211 void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level); 212 213 void set_increase_threshold_at_ratio() { _increase_threshold_at_ratio = 100 / (100 - (double)IncreaseFirstTierCompileThresholdAt); } 214 void set_start_time(jlong t) { _start_time = t; } 215 jlong start_time() const { return _start_time; } 216 217 // Submit a given method for compilation (and update the rate). 218 virtual void submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread); 219 // event() from SimpleThresholdPolicy would call these. 220 virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee, 221 CompLevel level, CompiledMethod* nm, JavaThread* thread); 222 virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee, 223 int bci, CompLevel level, CompiledMethod* nm, JavaThread* thread); 224 public: 225 AdvancedThresholdPolicy() : _start_time(0) { } 226 // Select task is called by CompileBroker. We should return a task or NULL. 227 virtual CompileTask* select_task(CompileQueue* compile_queue); 228 virtual void initialize(); 229 virtual bool should_not_inline(ciEnv* env, ciMethod* callee); |