1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
70 state_as_string(state()));
71 }
72
73 void InvocationCounter::print_short() {
74 tty->print(" [%d%s;%s]", count(), carry()?"+carry":"", state_as_short_string(state()));
75 }
76
77 // Initialization
78
79 int InvocationCounter::_init [InvocationCounter::number_of_states];
80 InvocationCounter::Action InvocationCounter::_action[InvocationCounter::number_of_states];
81 int InvocationCounter::InterpreterInvocationLimit;
82 int InvocationCounter::InterpreterBackwardBranchLimit;
83 int InvocationCounter::InterpreterProfileLimit;
84
85
86 const char* InvocationCounter::state_as_string(State state) {
87 switch (state) {
88 case wait_for_nothing : return "wait_for_nothing";
89 case wait_for_compile : return "wait_for_compile";
90 }
91 ShouldNotReachHere();
92 return NULL;
93 }
94
95 const char* InvocationCounter::state_as_short_string(State state) {
96 switch (state) {
97 case wait_for_nothing : return "not comp.";
98 case wait_for_compile : return "compileable";
99 }
100 ShouldNotReachHere();
101 return NULL;
102 }
103
104
105 static address do_nothing(methodHandle method, TRAPS) {
106 // dummy action for inactive invocation counters
107 MethodCounters* mcs = method->method_counters();
108 assert(mcs != NULL, "");
109 mcs->invocation_counter()->set_carry();
110 mcs->invocation_counter()->set_state(InvocationCounter::wait_for_nothing);
111 return NULL;
112 }
113
114
115 static address do_decay(methodHandle method, TRAPS) {
116 // decay invocation counters so compilation gets delayed
117 MethodCounters* mcs = method->method_counters();
118 assert(mcs != NULL, "");
119 mcs->invocation_counter()->decay();
120 return NULL;
121 }
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
70 state_as_string(state()));
71 }
72
73 void InvocationCounter::print_short() {
74 tty->print(" [%d%s;%s]", count(), carry()?"+carry":"", state_as_short_string(state()));
75 }
76
77 // Initialization
78
79 int InvocationCounter::_init [InvocationCounter::number_of_states];
80 InvocationCounter::Action InvocationCounter::_action[InvocationCounter::number_of_states];
81 int InvocationCounter::InterpreterInvocationLimit;
82 int InvocationCounter::InterpreterBackwardBranchLimit;
83 int InvocationCounter::InterpreterProfileLimit;
84
85
86 const char* InvocationCounter::state_as_string(State state) {
87 switch (state) {
88 case wait_for_nothing : return "wait_for_nothing";
89 case wait_for_compile : return "wait_for_compile";
90 default:
91 ShouldNotReachHere();
92 return NULL;
93 }
94 }
95
96 const char* InvocationCounter::state_as_short_string(State state) {
97 switch (state) {
98 case wait_for_nothing : return "not comp.";
99 case wait_for_compile : return "compileable";
100 default:
101 ShouldNotReachHere();
102 return NULL;
103 }
104 }
105
106
107 static address do_nothing(methodHandle method, TRAPS) {
108 // dummy action for inactive invocation counters
109 MethodCounters* mcs = method->method_counters();
110 assert(mcs != NULL, "");
111 mcs->invocation_counter()->set_carry();
112 mcs->invocation_counter()->set_state(InvocationCounter::wait_for_nothing);
113 return NULL;
114 }
115
116
117 static address do_decay(methodHandle method, TRAPS) {
118 // decay invocation counters so compilation gets delayed
119 MethodCounters* mcs = method->method_counters();
120 assert(mcs != NULL, "");
121 mcs->invocation_counter()->decay();
122 return NULL;
123 }
|