/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "memory/allocation.hpp"
#include "runtime/handles.hpp"
#include "utilities/exceptions.hpp"
// InvocationCounters are used to trigger actions when a limit (threshold) is reached.
// For different states, different limits and actions can be defined in the initialization
// routine of InvocationCounters.
//
// Implementation notes: For space reasons, state & counter are both encoded in one word,
// The state is encoded using some of the least significant bits, the counter is using the
// more significant bits. The counter is incremented before a method is activated and an
// action is triggered when when count() > limit().
friend class VMStructs;
private: // bit no: |31 3| 2 | 1 0 |
enum PrivateConstants {
};
public:
enum PublicConstants {
};
enum State {
};
// Manipulation
void reset(); // sets state to wait state
void init(); // sets state into original state
inline void decay(); // decay counter (divide by two)
void set_carry(); // set the sticky carry bit
// Accessors
int get_BackwardBranchLimit() const { return InterpreterBackwardBranchLimit >> number_of_noncount_bits; }
// Test counter using scaled limits like the asm interpreter would do rather than doing
// the shifts to normalize the counter.
bool reached_InvocationLimit() const { return _counter >= (unsigned int) InterpreterInvocationLimit; }
bool reached_BackwardBranchLimit() const { return _counter >= (unsigned int) InterpreterBackwardBranchLimit; }
// Do this just like asm interpreter does for max speed
return (_counter && count_mask) + back_edge_count->_counter >= (unsigned int) InterpreterProfileLimit;
}
// Printing
void print();
void print_short();
// Miscellaneous
static void reinitialize(bool delay_overflow);
private:
};
}
int c = count();
// prevent from going to zero, to distinguish from never-executed methods
}
#endif // SHARE_VM_INTERPRETER_INVOCATIONCOUNTER_HPP