82 void init(); // sets state into original state
83 void set_state(State state); // sets state and initializes counter correspondingly
84 inline void set(State state, int count); // sets state and counter
85 inline void decay(); // decay counter (divide by two)
86 void set_carry(); // set the sticky carry bit
87 void set_carry_flag() { _counter |= carry_mask; }
88
89 int raw_counter() { return _counter; }
90
91 // Accessors
92 State state() const { return (State)(_counter & state_mask); }
93 bool carry() const { return (_counter & carry_mask) != 0; }
94 int limit() const { return CompileThreshold; }
95 Action action() const { return _action[state()]; }
96 int count() const { return _counter >> number_of_noncount_bits; }
97
98 int get_InvocationLimit() const { return InterpreterInvocationLimit >> number_of_noncount_bits; }
99 int get_BackwardBranchLimit() const { return InterpreterBackwardBranchLimit >> number_of_noncount_bits; }
100 int get_ProfileLimit() const { return InterpreterProfileLimit >> number_of_noncount_bits; }
101
102 // Test counter using scaled limits like the asm interpreter would do rather than doing
103 // the shifts to normalize the counter.
104
105 bool reached_InvocationLimit() const { return _counter >= (unsigned int) InterpreterInvocationLimit; }
106 bool reached_BackwardBranchLimit() const { return _counter >= (unsigned int) InterpreterBackwardBranchLimit; }
107
108 // Do this just like asm interpreter does for max speed
109 bool reached_ProfileLimit(InvocationCounter *back_edge_count) const {
110 return (_counter && count_mask) + back_edge_count->_counter >= (unsigned int) InterpreterProfileLimit;
111 }
112
113 void increment() { _counter += count_increment; }
114
115
116 // Printing
117 void print();
118 void print_short();
119
120 // Miscellaneous
121 static ByteSize counter_offset() { return byte_offset_of(InvocationCounter, _counter); }
122 static void reinitialize(bool delay_overflow);
123
124 private:
125 static int _init [number_of_states]; // the counter limits
126 static Action _action[number_of_states]; // the actions
127
128 static void def(State state, int init, Action action);
129 static const char* state_as_string(State state);
130 static const char* state_as_short_string(State state);
131 };
|
82 void init(); // sets state into original state
83 void set_state(State state); // sets state and initializes counter correspondingly
84 inline void set(State state, int count); // sets state and counter
85 inline void decay(); // decay counter (divide by two)
86 void set_carry(); // set the sticky carry bit
87 void set_carry_flag() { _counter |= carry_mask; }
88
89 int raw_counter() { return _counter; }
90
91 // Accessors
92 State state() const { return (State)(_counter & state_mask); }
93 bool carry() const { return (_counter & carry_mask) != 0; }
94 int limit() const { return CompileThreshold; }
95 Action action() const { return _action[state()]; }
96 int count() const { return _counter >> number_of_noncount_bits; }
97
98 int get_InvocationLimit() const { return InterpreterInvocationLimit >> number_of_noncount_bits; }
99 int get_BackwardBranchLimit() const { return InterpreterBackwardBranchLimit >> number_of_noncount_bits; }
100 int get_ProfileLimit() const { return InterpreterProfileLimit >> number_of_noncount_bits; }
101
102 #ifdef CC_INTERP
103 // Test counter using scaled limits like the asm interpreter would do rather than doing
104 // the shifts to normalize the counter.
105 // Checks sum of invocation_counter and backedge_counter as the template interpreter does.
106 bool reached_InvocationLimit(InvocationCounter *back_edge_count) const {
107 return (_counter & count_mask) + (back_edge_count->_counter & count_mask) >=
108 (unsigned int) InterpreterInvocationLimit;
109 }
110 bool reached_BackwardBranchLimit(InvocationCounter *back_edge_count) const {
111 return (_counter & count_mask) + (back_edge_count->_counter & count_mask) >=
112 (unsigned int) InterpreterBackwardBranchLimit;
113 }
114 // Do this just like asm interpreter does for max speed.
115 bool reached_ProfileLimit(InvocationCounter *back_edge_count) const {
116 return (_counter & count_mask) + (back_edge_count->_counter & count_mask) >=
117 (unsigned int) InterpreterProfileLimit;
118 }
119 #endif // CC_INTERP
120
121 void increment() { _counter += count_increment; }
122
123
124 // Printing
125 void print();
126 void print_short();
127
128 // Miscellaneous
129 static ByteSize counter_offset() { return byte_offset_of(InvocationCounter, _counter); }
130 static void reinitialize(bool delay_overflow);
131
132 private:
133 static int _init [number_of_states]; // the counter limits
134 static Action _action[number_of_states]; // the actions
135
136 static void def(State state, int init, Action action);
137 static const char* state_as_string(State state);
138 static const char* state_as_short_string(State state);
139 };
|