src/hotspot/share/runtime/tieredThresholdPolicy.hpp
changeset 58398 ff559f979c4b
parent 54647 c0d9bc9b4e1f
equal deleted inserted replaced
58397:2d40e6a7ce8e 58398:ff559f979c4b
   213 
   213 
   214   double _increase_threshold_at_ratio;
   214   double _increase_threshold_at_ratio;
   215 
   215 
   216   bool maybe_switch_to_aot(const methodHandle& mh, CompLevel cur_level, CompLevel next_level, JavaThread* thread);
   216   bool maybe_switch_to_aot(const methodHandle& mh, CompLevel cur_level, CompLevel next_level, JavaThread* thread);
   217 
   217 
   218 protected:
       
   219   int c1_count() const     { return _c1_count; }
   218   int c1_count() const     { return _c1_count; }
   220   int c2_count() const     { return _c2_count; }
   219   int c2_count() const     { return _c2_count; }
   221   void set_c1_count(int x) { _c1_count = x;    }
   220   void set_c1_count(int x) { _c1_count = x;    }
   222   void set_c2_count(int x) { _c2_count = x;    }
   221   void set_c2_count(int x) { _c2_count = x;    }
   223 
   222 
   224   enum EventType { CALL, LOOP, COMPILE, REMOVE_FROM_QUEUE, UPDATE_IN_QUEUE, REPROFILE, MAKE_NOT_ENTRANT };
   223   enum EventType { CALL, LOOP, COMPILE, REMOVE_FROM_QUEUE, UPDATE_IN_QUEUE, REPROFILE, MAKE_NOT_ENTRANT };
   225   void print_event(EventType type, const methodHandle& mh, const methodHandle& imh, int bci, CompLevel level);
   224   void print_event(EventType type, const methodHandle& mh, const methodHandle& imh, int bci, CompLevel level);
   226   // Print policy-specific information if necessary
   225   // Print policy-specific information if necessary
   227   virtual void print_specific(EventType type, const methodHandle& mh, const methodHandle& imh, int bci, CompLevel level);
   226   void print_specific(EventType type, const methodHandle& mh, const methodHandle& imh, int bci, CompLevel level);
   228   // Check if the method can be compiled, change level if necessary
   227   // Check if the method can be compiled, change level if necessary
   229   void compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
   228   void compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
   230   // Submit a given method for compilation
   229   // Submit a given method for compilation
   231   virtual void submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
   230   void submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
   232   // Simple methods are as good being compiled with C1 as C2.
   231   // Simple methods are as good being compiled with C1 as C2.
   233   // This function tells if it's such a function.
   232   // This function tells if it's such a function.
   234   inline static bool is_trivial(Method* method);
   233   inline static bool is_trivial(Method* method);
   235   // Force method to be compiled at CompLevel_simple?
   234   // Force method to be compiled at CompLevel_simple?
   236   inline static bool should_compile_at_level_simple(Method* method);
   235   inline static bool should_compile_at_level_simple(Method* method);
   240   template<CompLevel level> static inline bool call_predicate_helper(int i, int b, double scale, Method* method);
   239   template<CompLevel level> static inline bool call_predicate_helper(int i, int b, double scale, Method* method);
   241   template<CompLevel level> static inline bool loop_predicate_helper(int i, int b, double scale, Method* method);
   240   template<CompLevel level> static inline bool loop_predicate_helper(int i, int b, double scale, Method* method);
   242 
   241 
   243   // Get a compilation level for a given method.
   242   // Get a compilation level for a given method.
   244   static CompLevel comp_level(Method* method);
   243   static CompLevel comp_level(Method* method);
   245   virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee,
   244   void method_invocation_event(const methodHandle& method, const methodHandle& inlinee,
   246                                        CompLevel level, CompiledMethod* nm, JavaThread* thread);
   245                                CompLevel level, CompiledMethod* nm, JavaThread* thread);
   247   virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee,
   246   void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee,
   248                                         int bci, CompLevel level, CompiledMethod* nm, JavaThread* thread);
   247                                 int bci, CompLevel level, CompiledMethod* nm, JavaThread* thread);
   249 
   248 
   250   void set_increase_threshold_at_ratio() { _increase_threshold_at_ratio = 100 / (100 - (double)IncreaseFirstTierCompileThresholdAt); }
   249   void set_increase_threshold_at_ratio() { _increase_threshold_at_ratio = 100 / (100 - (double)IncreaseFirstTierCompileThresholdAt); }
   251   void set_start_time(jlong t) { _start_time = t;    }
   250   void set_start_time(jlong t) { _start_time = t;    }
   252   jlong start_time() const     { return _start_time; }
   251   jlong start_time() const     { return _start_time; }
   253 
   252