< prev index next >

src/hotspot/share/interpreter/invocationCounter.hpp

Print this page




  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_INTERPRETER_INVOCATIONCOUNTER_HPP
  26 #define SHARE_VM_INTERPRETER_INVOCATIONCOUNTER_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/handles.hpp"
  30 #include "utilities/exceptions.hpp"
  31 
  32 // InvocationCounters are used to trigger actions when a limit (threshold) is reached.
  33 // For different states, different limits and actions can be defined in the initialization
  34 // routine of InvocationCounters.
  35 //
  36 // Implementation notes: For space reasons, state & counter are both encoded in one word,
  37 // The state is encoded using some of the least significant bits, the counter is using the
  38 // more significant bits. The counter is incremented before a method is activated and an
  39 // action is triggered when count() > limit().
  40 
  41 class InvocationCounter VALUE_OBJ_CLASS_SPEC {
  42   friend class VMStructs;
  43   friend class JVMCIVMStructs;
  44   friend class ciReplay;
  45  private:                             // bit no: |31  3|  2  | 1 0 |
  46   unsigned int _counter;              // format: [count|carry|state]
  47 
  48   enum PrivateConstants {
  49     number_of_state_bits = 2,
  50     number_of_carry_bits = 1,
  51     number_of_noncount_bits = number_of_state_bits + number_of_carry_bits,
  52     state_limit          = nth_bit(number_of_state_bits),
  53     count_grain          = nth_bit(number_of_state_bits + number_of_carry_bits),
  54     carry_mask           = right_n_bits(number_of_carry_bits) << number_of_state_bits,
  55     state_mask           = right_n_bits(number_of_state_bits),
  56     status_mask          = right_n_bits(number_of_state_bits + number_of_carry_bits),
  57     count_mask           = ((int)(-1) ^ status_mask)
  58   };
  59 
  60  public:
  61   static int InterpreterInvocationLimit;        // CompileThreshold scaled for interpreter use




  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_INTERPRETER_INVOCATIONCOUNTER_HPP
  26 #define SHARE_VM_INTERPRETER_INVOCATIONCOUNTER_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/handles.hpp"
  30 #include "utilities/exceptions.hpp"
  31 
  32 // InvocationCounters are used to trigger actions when a limit (threshold) is reached.
  33 // For different states, different limits and actions can be defined in the initialization
  34 // routine of InvocationCounters.
  35 //
  36 // Implementation notes: For space reasons, state & counter are both encoded in one word,
  37 // The state is encoded using some of the least significant bits, the counter is using the
  38 // more significant bits. The counter is incremented before a method is activated and an
  39 // action is triggered when count() > limit().
  40 
  41 class InvocationCounter {
  42   friend class VMStructs;
  43   friend class JVMCIVMStructs;
  44   friend class ciReplay;
  45  private:                             // bit no: |31  3|  2  | 1 0 |
  46   unsigned int _counter;              // format: [count|carry|state]
  47 
  48   enum PrivateConstants {
  49     number_of_state_bits = 2,
  50     number_of_carry_bits = 1,
  51     number_of_noncount_bits = number_of_state_bits + number_of_carry_bits,
  52     state_limit          = nth_bit(number_of_state_bits),
  53     count_grain          = nth_bit(number_of_state_bits + number_of_carry_bits),
  54     carry_mask           = right_n_bits(number_of_carry_bits) << number_of_state_bits,
  55     state_mask           = right_n_bits(number_of_state_bits),
  56     status_mask          = right_n_bits(number_of_state_bits + number_of_carry_bits),
  57     count_mask           = ((int)(-1) ^ status_mask)
  58   };
  59 
  60  public:
  61   static int InterpreterInvocationLimit;        // CompileThreshold scaled for interpreter use


< prev index next >