equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
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 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 private: // bit no: |31 3| 2 | 1 0 | |
44 private: // bit no: |31 3| 2 | 1 0 | |
44 unsigned int _counter; // format: [count|carry|state] |
45 unsigned int _counter; // format: [count|carry|state] |
45 |
46 |
46 enum PrivateConstants { |
47 enum PrivateConstants { |
47 number_of_state_bits = 2, |
48 number_of_state_bits = 2, |
82 void set_state(State state); // sets state and initializes counter correspondingly |
83 void set_state(State state); // sets state and initializes counter correspondingly |
83 inline void set(State state, int count); // sets state and counter |
84 inline void set(State state, int count); // sets state and counter |
84 inline void decay(); // decay counter (divide by two) |
85 inline void decay(); // decay counter (divide by two) |
85 void set_carry(); // set the sticky carry bit |
86 void set_carry(); // set the sticky carry bit |
86 void set_carry_flag() { _counter |= carry_mask; } |
87 void set_carry_flag() { _counter |= carry_mask; } |
|
88 |
|
89 int raw_counter() { return _counter; } |
87 |
90 |
88 // Accessors |
91 // Accessors |
89 State state() const { return (State)(_counter & state_mask); } |
92 State state() const { return (State)(_counter & state_mask); } |
90 bool carry() const { return (_counter & carry_mask) != 0; } |
93 bool carry() const { return (_counter & carry_mask) != 0; } |
91 int limit() const { return CompileThreshold; } |
94 int limit() const { return CompileThreshold; } |