equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2016, 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. |
33 ValueStack::ValueStack(IRScope* scope, ValueStack* caller_state) |
33 ValueStack::ValueStack(IRScope* scope, ValueStack* caller_state) |
34 : _scope(scope) |
34 : _scope(scope) |
35 , _caller_state(caller_state) |
35 , _caller_state(caller_state) |
36 , _bci(-99) |
36 , _bci(-99) |
37 , _kind(Parsing) |
37 , _kind(Parsing) |
38 , _locals(scope->method()->max_locals(), NULL) |
38 , _locals(scope->method()->max_locals(), scope->method()->max_locals(), NULL) |
39 , _stack(scope->method()->max_stack()) |
39 , _stack(scope->method()->max_stack()) |
40 , _locks() |
40 , _locks() |
41 { |
41 { |
42 verify(); |
42 verify(); |
43 } |
43 } |
176 void ValueStack::setup_phi_for_stack(BlockBegin* b, int index) { |
176 void ValueStack::setup_phi_for_stack(BlockBegin* b, int index) { |
177 assert(stack_at(index)->as_Phi() == NULL || stack_at(index)->as_Phi()->block() != b, "phi function already created"); |
177 assert(stack_at(index)->as_Phi() == NULL || stack_at(index)->as_Phi()->block() != b, "phi function already created"); |
178 |
178 |
179 ValueType* t = stack_at(index)->type(); |
179 ValueType* t = stack_at(index)->type(); |
180 Value phi = new Phi(t, b, -index - 1); |
180 Value phi = new Phi(t, b, -index - 1); |
181 _stack[index] = phi; |
181 _stack.at_put(index, phi); |
182 |
182 |
183 assert(!t->is_double_word() || _stack.at(index + 1) == NULL, "hi-word of doubleword value must be NULL"); |
183 assert(!t->is_double_word() || _stack.at(index + 1) == NULL, "hi-word of doubleword value must be NULL"); |
184 } |
184 } |
185 |
185 |
186 void ValueStack::setup_phi_for_local(BlockBegin* b, int index) { |
186 void ValueStack::setup_phi_for_local(BlockBegin* b, int index) { |
223 } |
223 } |
224 } |
224 } |
225 if (locals_size() > 0) { |
225 if (locals_size() > 0) { |
226 InstructionPrinter ip; |
226 InstructionPrinter ip; |
227 for (int i = 0; i < locals_size();) { |
227 for (int i = 0; i < locals_size();) { |
228 Value l = _locals[i]; |
228 Value l = _locals.at(i); |
229 tty->print("local %d ", i); |
229 tty->print("local %d ", i); |
230 if (l == NULL) { |
230 if (l == NULL) { |
231 tty->print("null"); |
231 tty->print("null"); |
232 i ++; |
232 i ++; |
233 } else { |
233 } else { |