Mercurial > hg > truffle
comparison src/share/vm/interpreter/invocationCounter.hpp @ 1783:d5d065957597
6953144: Tiered compilation
Summary: Infrastructure for tiered compilation support (interpreter + c1 + c2) for 32 and 64 bit. Simple tiered policy implementation.
Reviewed-by: kvn, never, phh, twisti
author | iveresov |
---|---|
date | Fri, 03 Sep 2010 17:51:07 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
comparison
equal
deleted
inserted
replaced
1782:f353275af40e | 1783:d5d065957597 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2010, 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. |
41 number_of_carry_bits = 1, | 41 number_of_carry_bits = 1, |
42 number_of_noncount_bits = number_of_state_bits + number_of_carry_bits, | 42 number_of_noncount_bits = number_of_state_bits + number_of_carry_bits, |
43 number_of_count_bits = BitsPerInt - number_of_noncount_bits, | 43 number_of_count_bits = BitsPerInt - number_of_noncount_bits, |
44 state_limit = nth_bit(number_of_state_bits), | 44 state_limit = nth_bit(number_of_state_bits), |
45 count_grain = nth_bit(number_of_state_bits + number_of_carry_bits), | 45 count_grain = nth_bit(number_of_state_bits + number_of_carry_bits), |
46 count_limit = nth_bit(number_of_count_bits - 1), | |
47 carry_mask = right_n_bits(number_of_carry_bits) << number_of_state_bits, | 46 carry_mask = right_n_bits(number_of_carry_bits) << number_of_state_bits, |
48 state_mask = right_n_bits(number_of_state_bits), | 47 state_mask = right_n_bits(number_of_state_bits), |
49 status_mask = right_n_bits(number_of_state_bits + number_of_carry_bits), | 48 status_mask = right_n_bits(number_of_state_bits + number_of_carry_bits), |
50 count_mask = ((int)(-1) ^ status_mask) | 49 count_mask = ((int)(-1) ^ status_mask) |
51 }; | 50 }; |
52 | 51 |
53 public: | 52 public: |
54 static int InterpreterInvocationLimit; // CompileThreshold scaled for interpreter use | 53 static int InterpreterInvocationLimit; // CompileThreshold scaled for interpreter use |
55 static int Tier1InvocationLimit; // CompileThreshold scaled for tier1 use | |
56 static int Tier1BackEdgeLimit; // BackEdgeThreshold scaled for tier1 use | |
57 | |
58 static int InterpreterBackwardBranchLimit; // A separate threshold for on stack replacement | 54 static int InterpreterBackwardBranchLimit; // A separate threshold for on stack replacement |
59 | |
60 static int InterpreterProfileLimit; // Profiling threshold scaled for interpreter use | 55 static int InterpreterProfileLimit; // Profiling threshold scaled for interpreter use |
61 | 56 |
62 typedef address (*Action)(methodHandle method, TRAPS); | 57 typedef address (*Action)(methodHandle method, TRAPS); |
63 | 58 |
64 enum PublicConstants { | 59 enum PublicConstants { |
65 count_increment = count_grain, // use this value to increment the 32bit _counter word | 60 count_increment = count_grain, // use this value to increment the 32bit _counter word |
66 count_mask_value = count_mask // use this value to mask the backedge counter | 61 count_mask_value = count_mask, // use this value to mask the backedge counter |
62 count_shift = number_of_noncount_bits, | |
63 count_limit = nth_bit(number_of_count_bits - 1) | |
67 }; | 64 }; |
68 | 65 |
69 enum State { | 66 enum State { |
70 wait_for_nothing, // do nothing when count() > limit() | 67 wait_for_nothing, // do nothing when count() > limit() |
71 wait_for_compile, // introduce nmethod when count() > limit() | 68 wait_for_compile, // introduce nmethod when count() > limit() |
77 void init(); // sets state into original state | 74 void init(); // sets state into original state |
78 void set_state(State state); // sets state and initializes counter correspondingly | 75 void set_state(State state); // sets state and initializes counter correspondingly |
79 inline void set(State state, int count); // sets state and counter | 76 inline void set(State state, int count); // sets state and counter |
80 inline void decay(); // decay counter (divide by two) | 77 inline void decay(); // decay counter (divide by two) |
81 void set_carry(); // set the sticky carry bit | 78 void set_carry(); // set the sticky carry bit |
79 void set_carry_flag() { _counter |= carry_mask; } | |
82 | 80 |
83 // Accessors | 81 // Accessors |
84 State state() const { return (State)(_counter & state_mask); } | 82 State state() const { return (State)(_counter & state_mask); } |
85 bool carry() const { return (_counter & carry_mask) != 0; } | 83 bool carry() const { return (_counter & carry_mask) != 0; } |
86 int limit() const { return CompileThreshold; } | 84 int limit() const { return CompileThreshold; } |
133 int new_count = c >> 1; | 131 int new_count = c >> 1; |
134 // prevent from going to zero, to distinguish from never-executed methods | 132 // prevent from going to zero, to distinguish from never-executed methods |
135 if (c > 0 && new_count == 0) new_count = 1; | 133 if (c > 0 && new_count == 0) new_count = 1; |
136 set(state(), new_count); | 134 set(state(), new_count); |
137 } | 135 } |
136 |