< prev index next >

src/share/vm/runtime/simpleThresholdPolicy.hpp

Print this page




  34 class CompileQueue;
  35 
  36 class SimpleThresholdPolicy : public CompilationPolicy {
  37   int _c1_count, _c2_count;
  38 
  39   // Check if the counter is big enough and set carry (effectively infinity).
  40   inline void set_carry_if_necessary(InvocationCounter *counter);
  41   // Set carry flags in the counters (in Method* and MDO).
  42   inline void handle_counter_overflow(Method* method);
  43   // Call and loop predicates determine whether a transition to a higher compilation
  44   // level should be performed (pointers to predicate functions are passed to common_TF().
  45   // Predicates also take compiler load into account.
  46   typedef bool (SimpleThresholdPolicy::*Predicate)(int i, int b, CompLevel cur_level, Method* method);
  47   bool call_predicate(int i, int b, CompLevel cur_level, Method* method);
  48   bool loop_predicate(int i, int b, CompLevel cur_level, Method* method);
  49   // Common transition function. Given a predicate determines if a method should transition to another level.
  50   CompLevel common(Predicate p, Method* method, CompLevel cur_level);
  51   // Transition functions.
  52   // call_event determines if a method should be compiled at a different
  53   // level with a regular invocation entry.
  54   CompLevel call_event(Method* method, CompLevel cur_level);
  55   // loop_event checks if a method should be OSR compiled at a different
  56   // level.
  57   CompLevel loop_event(Method* method, CompLevel cur_level);
  58   void print_counters(const char* prefix, methodHandle mh);
  59 protected:
  60   int c1_count() const     { return _c1_count; }
  61   int c2_count() const     { return _c2_count; }
  62   void set_c1_count(int x) { _c1_count = x;    }
  63   void set_c2_count(int x) { _c2_count = x;    }
  64 
  65   enum EventType { CALL, LOOP, COMPILE, REMOVE_FROM_QUEUE, UPDATE_IN_QUEUE, REPROFILE, MAKE_NOT_ENTRANT };
  66   void print_event(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level);
  67   // Print policy-specific information if necessary
  68   virtual void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level) { }
  69   // Check if the method can be compiled, change level if necessary
  70   void compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
  71   // Submit a given method for compilation
  72   virtual void submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
  73   // Simple methods are as good being compiled with C1 as C2.
  74   // This function tells if it's such a function.
  75   inline bool is_trivial(Method* method);
  76 
  77   // Predicate helpers are used by .*_predicate() methods as well as others.




  34 class CompileQueue;
  35 
  36 class SimpleThresholdPolicy : public CompilationPolicy {
  37   int _c1_count, _c2_count;
  38 
  39   // Check if the counter is big enough and set carry (effectively infinity).
  40   inline void set_carry_if_necessary(InvocationCounter *counter);
  41   // Set carry flags in the counters (in Method* and MDO).
  42   inline void handle_counter_overflow(Method* method);
  43   // Call and loop predicates determine whether a transition to a higher compilation
  44   // level should be performed (pointers to predicate functions are passed to common_TF().
  45   // Predicates also take compiler load into account.
  46   typedef bool (SimpleThresholdPolicy::*Predicate)(int i, int b, CompLevel cur_level, Method* method);
  47   bool call_predicate(int i, int b, CompLevel cur_level, Method* method);
  48   bool loop_predicate(int i, int b, CompLevel cur_level, Method* method);
  49   // Common transition function. Given a predicate determines if a method should transition to another level.
  50   CompLevel common(Predicate p, Method* method, CompLevel cur_level);
  51   // Transition functions.
  52   // call_event determines if a method should be compiled at a different
  53   // level with a regular invocation entry.
  54   CompLevel call_event(Method* method, CompLevel cur_level, JavaThread* thread);
  55   // loop_event checks if a method should be OSR compiled at a different
  56   // level.
  57   CompLevel loop_event(Method* method, CompLevel cur_level, JavaThread* thread);
  58   void print_counters(const char* prefix, methodHandle mh);
  59 protected:
  60   int c1_count() const     { return _c1_count; }
  61   int c2_count() const     { return _c2_count; }
  62   void set_c1_count(int x) { _c1_count = x;    }
  63   void set_c2_count(int x) { _c2_count = x;    }
  64 
  65   enum EventType { CALL, LOOP, COMPILE, REMOVE_FROM_QUEUE, UPDATE_IN_QUEUE, REPROFILE, MAKE_NOT_ENTRANT };
  66   void print_event(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level);
  67   // Print policy-specific information if necessary
  68   virtual void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level) { }
  69   // Check if the method can be compiled, change level if necessary
  70   void compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
  71   // Submit a given method for compilation
  72   virtual void submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
  73   // Simple methods are as good being compiled with C1 as C2.
  74   // This function tells if it's such a function.
  75   inline bool is_trivial(Method* method);
  76 
  77   // Predicate helpers are used by .*_predicate() methods as well as others.


< prev index next >