annotate src/share/vm/c1/c1_ValueStack.cpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 #include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 #include "incls/_c1_ValueStack.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // Implementation of ValueStack
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 ValueStack::ValueStack(IRScope* scope, int locals_size, int max_stack_size)
a61af66fc99e Initial load
duke
parents:
diff changeset
32 : _scope(scope)
a61af66fc99e Initial load
duke
parents:
diff changeset
33 , _locals(locals_size, NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
34 , _stack(max_stack_size)
a61af66fc99e Initial load
duke
parents:
diff changeset
35 , _lock_stack(false)
a61af66fc99e Initial load
duke
parents:
diff changeset
36 , _locks(1)
a61af66fc99e Initial load
duke
parents:
diff changeset
37 {
a61af66fc99e Initial load
duke
parents:
diff changeset
38 assert(scope != NULL, "scope must exist");
a61af66fc99e Initial load
duke
parents:
diff changeset
39 }
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 ValueStack* ValueStack::copy() {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 ValueStack* s = new ValueStack(scope(), locals_size(), max_stack_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
43 s->_stack.appendAll(&_stack);
a61af66fc99e Initial load
duke
parents:
diff changeset
44 s->_locks.appendAll(&_locks);
a61af66fc99e Initial load
duke
parents:
diff changeset
45 s->replace_locals(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 return s;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 }
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 ValueStack* ValueStack::copy_locks() {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 int sz = scope()->lock_stack_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
52 if (stack_size() == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
53 sz = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 }
a61af66fc99e Initial load
duke
parents:
diff changeset
55 ValueStack* s = new ValueStack(scope(), locals_size(), sz);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 s->_lock_stack = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 s->_locks.appendAll(&_locks);
a61af66fc99e Initial load
duke
parents:
diff changeset
58 s->replace_locals(this);
a61af66fc99e Initial load
duke
parents:
diff changeset
59 if (sz > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
60 assert(sz <= stack_size(), "lock stack underflow");
a61af66fc99e Initial load
duke
parents:
diff changeset
61 for (int i = 0; i < sz; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
62 s->_stack.append(_stack[i]);
a61af66fc99e Initial load
duke
parents:
diff changeset
63 }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 return s;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 }
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 bool ValueStack::is_same(ValueStack* s) {
a61af66fc99e Initial load
duke
parents:
diff changeset
69 assert(s != NULL, "state must exist");
a61af66fc99e Initial load
duke
parents:
diff changeset
70 assert(scope () == s->scope (), "scopes must correspond");
a61af66fc99e Initial load
duke
parents:
diff changeset
71 assert(locals_size() == s->locals_size(), "locals sizes must correspond");
a61af66fc99e Initial load
duke
parents:
diff changeset
72 return is_same_across_scopes(s);
a61af66fc99e Initial load
duke
parents:
diff changeset
73 }
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 bool ValueStack::is_same_across_scopes(ValueStack* s) {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 assert(s != NULL, "state must exist");
a61af66fc99e Initial load
duke
parents:
diff changeset
78 assert(stack_size () == s->stack_size (), "stack sizes must correspond");
a61af66fc99e Initial load
duke
parents:
diff changeset
79 assert(locks_size () == s->locks_size (), "locks sizes must correspond");
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // compare each stack element with the corresponding stack element of s
a61af66fc99e Initial load
duke
parents:
diff changeset
81 int index;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 Value value;
a61af66fc99e Initial load
duke
parents:
diff changeset
83 for_each_stack_value(this, index, value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 if (value->type()->tag() != s->stack_at(index)->type()->tag()) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
85 }
a61af66fc99e Initial load
duke
parents:
diff changeset
86 for_each_lock_value(this, index, value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 if (value != s->lock_at(index)) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 }
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 ValueStack* ValueStack::caller_state() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 return scope()->caller_state();
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 void ValueStack::clear_locals() {
a61af66fc99e Initial load
duke
parents:
diff changeset
99 for (int i = _locals.length() - 1; i >= 0; i--) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 _locals.at_put(i, NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 void ValueStack::replace_locals(ValueStack* with) {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 assert(locals_size() == with->locals_size(), "number of locals must match");
a61af66fc99e Initial load
duke
parents:
diff changeset
107 for (int i = locals_size() - 1; i >= 0; i--) {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 _locals.at_put(i, with->_locals.at(i));
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 void ValueStack::pin_stack_for_linear_scan() {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 for_each_state_value(this, v,
a61af66fc99e Initial load
duke
parents:
diff changeset
114 if (v->as_Constant() == NULL && v->as_Local() == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 v->pin(Instruction::PinStackForStateSplit);
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117 );
a61af66fc99e Initial load
duke
parents:
diff changeset
118 }
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // apply function to all values of a list; factored out from values_do(f)
a61af66fc99e Initial load
duke
parents:
diff changeset
122 void ValueStack::apply(Values list, void f(Value*)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 for (int i = 0; i < list.length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
124 Value* va = list.adr_at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
125 Value v0 = *va;
a61af66fc99e Initial load
duke
parents:
diff changeset
126 if (v0 != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
127 if (!v0->type()->is_illegal()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
128 assert(v0->as_HiWord() == NULL, "should never see HiWord during traversal");
a61af66fc99e Initial load
duke
parents:
diff changeset
129 f(va);
a61af66fc99e Initial load
duke
parents:
diff changeset
130 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
131 Value v1 = *va;
a61af66fc99e Initial load
duke
parents:
diff changeset
132 if (v0 != v1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
133 assert(v1->type()->is_illegal() || v0->type()->tag() == v1->type()->tag(), "types must match");
a61af66fc99e Initial load
duke
parents:
diff changeset
134 if (v0->type()->is_double_word()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 list.at_put(i + 1, v0->hi_word());
a61af66fc99e Initial load
duke
parents:
diff changeset
136 }
a61af66fc99e Initial load
duke
parents:
diff changeset
137 }
a61af66fc99e Initial load
duke
parents:
diff changeset
138 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
139 if (v0->type()->is_double_word()) i++;
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141 }
a61af66fc99e Initial load
duke
parents:
diff changeset
142 }
a61af66fc99e Initial load
duke
parents:
diff changeset
143 }
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 void ValueStack::values_do(void f(Value*)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
147 apply(_stack, f);
a61af66fc99e Initial load
duke
parents:
diff changeset
148 apply(_locks, f);
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 ValueStack* state = this;
a61af66fc99e Initial load
duke
parents:
diff changeset
151 for_each_state(state) {
a61af66fc99e Initial load
duke
parents:
diff changeset
152 apply(state->_locals, f);
a61af66fc99e Initial load
duke
parents:
diff changeset
153 }
a61af66fc99e Initial load
duke
parents:
diff changeset
154 }
a61af66fc99e Initial load
duke
parents:
diff changeset
155
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157 Values* ValueStack::pop_arguments(int argument_size) {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 assert(stack_size() >= argument_size, "stack too small or too many arguments");
a61af66fc99e Initial load
duke
parents:
diff changeset
159 int base = stack_size() - argument_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 Values* args = new Values(argument_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
161 for (int i = base; i < stack_size();) args->push(stack_at_inc(i));
a61af66fc99e Initial load
duke
parents:
diff changeset
162 truncate_stack(base);
a61af66fc99e Initial load
duke
parents:
diff changeset
163 return args;
a61af66fc99e Initial load
duke
parents:
diff changeset
164 }
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167 int ValueStack::lock(IRScope* scope, Value obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 _locks.push(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
169 scope->set_min_number_of_locks(locks_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
170 return locks_size() - 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
171 }
a61af66fc99e Initial load
duke
parents:
diff changeset
172
a61af66fc99e Initial load
duke
parents:
diff changeset
173
a61af66fc99e Initial load
duke
parents:
diff changeset
174 int ValueStack::unlock() {
a61af66fc99e Initial load
duke
parents:
diff changeset
175 _locks.pop();
a61af66fc99e Initial load
duke
parents:
diff changeset
176 return locks_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179
a61af66fc99e Initial load
duke
parents:
diff changeset
180 ValueStack* ValueStack::push_scope(IRScope* scope) {
a61af66fc99e Initial load
duke
parents:
diff changeset
181 assert(scope->caller() == _scope, "scopes must have caller/callee relationship");
a61af66fc99e Initial load
duke
parents:
diff changeset
182 ValueStack* res = new ValueStack(scope,
a61af66fc99e Initial load
duke
parents:
diff changeset
183 scope->method()->max_locals(),
a61af66fc99e Initial load
duke
parents:
diff changeset
184 max_stack_size() + scope->method()->max_stack());
a61af66fc99e Initial load
duke
parents:
diff changeset
185 // Preserves stack and monitors.
a61af66fc99e Initial load
duke
parents:
diff changeset
186 res->_stack.appendAll(&_stack);
a61af66fc99e Initial load
duke
parents:
diff changeset
187 res->_locks.appendAll(&_locks);
a61af66fc99e Initial load
duke
parents:
diff changeset
188 assert(res->_stack.size() <= res->max_stack_size(), "stack overflow");
a61af66fc99e Initial load
duke
parents:
diff changeset
189 return res;
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
191
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 ValueStack* ValueStack::pop_scope() {
a61af66fc99e Initial load
duke
parents:
diff changeset
194 assert(_scope->caller() != NULL, "scope must have caller");
a61af66fc99e Initial load
duke
parents:
diff changeset
195 IRScope* scope = _scope->caller();
a61af66fc99e Initial load
duke
parents:
diff changeset
196 int max_stack = max_stack_size() - _scope->method()->max_stack();
a61af66fc99e Initial load
duke
parents:
diff changeset
197 assert(max_stack >= 0, "stack underflow");
a61af66fc99e Initial load
duke
parents:
diff changeset
198 ValueStack* res = new ValueStack(scope,
a61af66fc99e Initial load
duke
parents:
diff changeset
199 scope->method()->max_locals(),
a61af66fc99e Initial load
duke
parents:
diff changeset
200 max_stack);
a61af66fc99e Initial load
duke
parents:
diff changeset
201 // Preserves stack and monitors. Restores local and store state from caller scope.
a61af66fc99e Initial load
duke
parents:
diff changeset
202 res->_stack.appendAll(&_stack);
a61af66fc99e Initial load
duke
parents:
diff changeset
203 res->_locks.appendAll(&_locks);
a61af66fc99e Initial load
duke
parents:
diff changeset
204 ValueStack* caller = caller_state();
a61af66fc99e Initial load
duke
parents:
diff changeset
205 if (caller != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
206 for (int i = 0; i < caller->_locals.length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
207 res->_locals.at_put(i, caller->_locals.at(i));
a61af66fc99e Initial load
duke
parents:
diff changeset
208 }
a61af66fc99e Initial load
duke
parents:
diff changeset
209 assert(res->_locals.length() == res->scope()->method()->max_locals(), "just checking");
a61af66fc99e Initial load
duke
parents:
diff changeset
210 }
a61af66fc99e Initial load
duke
parents:
diff changeset
211 assert(res->_stack.size() <= res->max_stack_size(), "stack overflow");
a61af66fc99e Initial load
duke
parents:
diff changeset
212 return res;
a61af66fc99e Initial load
duke
parents:
diff changeset
213 }
a61af66fc99e Initial load
duke
parents:
diff changeset
214
a61af66fc99e Initial load
duke
parents:
diff changeset
215
a61af66fc99e Initial load
duke
parents:
diff changeset
216 void ValueStack::setup_phi_for_stack(BlockBegin* b, int index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
217 assert(stack_at(index)->as_Phi() == NULL || stack_at(index)->as_Phi()->block() != b, "phi function already created");
a61af66fc99e Initial load
duke
parents:
diff changeset
218
a61af66fc99e Initial load
duke
parents:
diff changeset
219 ValueType* t = stack_at(index)->type();
a61af66fc99e Initial load
duke
parents:
diff changeset
220 Value phi = new Phi(t, b, -index - 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
221 _stack[index] = phi;
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
224 if (t->is_double_word()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
225 _stack[index + 1] = phi->hi_word();
a61af66fc99e Initial load
duke
parents:
diff changeset
226 }
a61af66fc99e Initial load
duke
parents:
diff changeset
227 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
228 }
a61af66fc99e Initial load
duke
parents:
diff changeset
229
a61af66fc99e Initial load
duke
parents:
diff changeset
230 void ValueStack::setup_phi_for_local(BlockBegin* b, int index) {
a61af66fc99e Initial load
duke
parents:
diff changeset
231 assert(local_at(index)->as_Phi() == NULL || local_at(index)->as_Phi()->block() != b, "phi function already created");
a61af66fc99e Initial load
duke
parents:
diff changeset
232
a61af66fc99e Initial load
duke
parents:
diff changeset
233 ValueType* t = local_at(index)->type();
a61af66fc99e Initial load
duke
parents:
diff changeset
234 Value phi = new Phi(t, b, index);
a61af66fc99e Initial load
duke
parents:
diff changeset
235 store_local(index, phi);
a61af66fc99e Initial load
duke
parents:
diff changeset
236 }
a61af66fc99e Initial load
duke
parents:
diff changeset
237
a61af66fc99e Initial load
duke
parents:
diff changeset
238 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
239 void ValueStack::print() {
a61af66fc99e Initial load
duke
parents:
diff changeset
240 if (stack_is_empty()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
241 tty->print_cr("empty stack");
a61af66fc99e Initial load
duke
parents:
diff changeset
242 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
243 InstructionPrinter ip;
a61af66fc99e Initial load
duke
parents:
diff changeset
244 for (int i = 0; i < stack_size();) {
a61af66fc99e Initial load
duke
parents:
diff changeset
245 Value t = stack_at_inc(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
246 tty->print("%2d ", i);
a61af66fc99e Initial load
duke
parents:
diff changeset
247 ip.print_instr(t);
a61af66fc99e Initial load
duke
parents:
diff changeset
248 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
249 }
a61af66fc99e Initial load
duke
parents:
diff changeset
250 }
a61af66fc99e Initial load
duke
parents:
diff changeset
251 if (!no_active_locks()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
252 InstructionPrinter ip;
a61af66fc99e Initial load
duke
parents:
diff changeset
253 for (int i = 0; i < locks_size(); i--) {
a61af66fc99e Initial load
duke
parents:
diff changeset
254 Value t = lock_at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
255 tty->print("lock %2d ", i);
a61af66fc99e Initial load
duke
parents:
diff changeset
256 if (t == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
257 tty->print("this");
a61af66fc99e Initial load
duke
parents:
diff changeset
258 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
259 ip.print_instr(t);
a61af66fc99e Initial load
duke
parents:
diff changeset
260 }
a61af66fc99e Initial load
duke
parents:
diff changeset
261 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
262 }
a61af66fc99e Initial load
duke
parents:
diff changeset
263 }
a61af66fc99e Initial load
duke
parents:
diff changeset
264 if (locals_size() > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
265 InstructionPrinter ip;
a61af66fc99e Initial load
duke
parents:
diff changeset
266 for (int i = 0; i < locals_size();) {
a61af66fc99e Initial load
duke
parents:
diff changeset
267 Value l = _locals[i];
a61af66fc99e Initial load
duke
parents:
diff changeset
268 tty->print("local %d ", i);
a61af66fc99e Initial load
duke
parents:
diff changeset
269 if (l == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
270 tty->print("null");
a61af66fc99e Initial load
duke
parents:
diff changeset
271 i ++;
a61af66fc99e Initial load
duke
parents:
diff changeset
272 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
273 ip.print_instr(l);
a61af66fc99e Initial load
duke
parents:
diff changeset
274 if (l->type()->is_illegal() || l->type()->is_single_word()) i ++; else i += 2;
a61af66fc99e Initial load
duke
parents:
diff changeset
275 }
a61af66fc99e Initial load
duke
parents:
diff changeset
276 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
277 }
a61af66fc99e Initial load
duke
parents:
diff changeset
278 }
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280
a61af66fc99e Initial load
duke
parents:
diff changeset
281
a61af66fc99e Initial load
duke
parents:
diff changeset
282 void ValueStack::verify() {
a61af66fc99e Initial load
duke
parents:
diff changeset
283 Unimplemented();
a61af66fc99e Initial load
duke
parents:
diff changeset
284 }
a61af66fc99e Initial load
duke
parents:
diff changeset
285 #endif // PRODUCT