hotspot/src/share/vm/interpreter/invocationCounter.hpp
changeset 28650 772aaab2582f
parent 22836 e7e511228518
child 41684 f02a4153a27a
equal deleted inserted replaced
28649:eb561bd1bc3c 28650:772aaab2582f
    34 // routine of InvocationCounters.
    34 // routine of InvocationCounters.
    35 //
    35 //
    36 // Implementation notes: For space reasons, state & counter are both encoded in one word,
    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
    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
    38 // more significant bits. The counter is incremented before a method is activated and an
    39 // action is triggered when when count() > limit().
    39 // action is triggered when count() > limit().
    40 
    40 
    41 class InvocationCounter VALUE_OBJ_CLASS_SPEC {
    41 class InvocationCounter VALUE_OBJ_CLASS_SPEC {
    42   friend class VMStructs;
    42   friend class VMStructs;
    43   friend class ciReplay;
    43   friend class ciReplay;
    44  private:                             // bit no: |31  3|  2  | 1 0 |
    44  private:                             // bit no: |31  3|  2  | 1 0 |
    46 
    46 
    47   enum PrivateConstants {
    47   enum PrivateConstants {
    48     number_of_state_bits = 2,
    48     number_of_state_bits = 2,
    49     number_of_carry_bits = 1,
    49     number_of_carry_bits = 1,
    50     number_of_noncount_bits = number_of_state_bits + number_of_carry_bits,
    50     number_of_noncount_bits = number_of_state_bits + number_of_carry_bits,
    51     number_of_count_bits = BitsPerInt - number_of_noncount_bits,
       
    52     state_limit          = nth_bit(number_of_state_bits),
    51     state_limit          = nth_bit(number_of_state_bits),
    53     count_grain          = nth_bit(number_of_state_bits + number_of_carry_bits),
    52     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,
    53     carry_mask           = right_n_bits(number_of_carry_bits) << number_of_state_bits,
    55     state_mask           = right_n_bits(number_of_state_bits),
    54     state_mask           = right_n_bits(number_of_state_bits),
    56     status_mask          = right_n_bits(number_of_state_bits + number_of_carry_bits),
    55     status_mask          = right_n_bits(number_of_state_bits + number_of_carry_bits),
    66 
    65 
    67   enum PublicConstants {
    66   enum PublicConstants {
    68     count_increment      = count_grain,          // use this value to increment the 32bit _counter word
    67     count_increment      = count_grain,          // use this value to increment the 32bit _counter word
    69     count_mask_value     = count_mask,           // use this value to mask the backedge counter
    68     count_mask_value     = count_mask,           // use this value to mask the backedge counter
    70     count_shift          = number_of_noncount_bits,
    69     count_shift          = number_of_noncount_bits,
       
    70     number_of_count_bits = BitsPerInt - number_of_noncount_bits,
    71     count_limit          = nth_bit(number_of_count_bits - 1)
    71     count_limit          = nth_bit(number_of_count_bits - 1)
    72   };
    72   };
    73 
    73 
    74   enum State {
    74   enum State {
    75     wait_for_nothing,                            // do nothing when count() > limit()
    75     wait_for_nothing,                            // do nothing when count() > limit()