annotate graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java @ 2565:cc1f1d396288

Remove inlining (3rd part)
author Gilles Duboscq <gilles.duboscq@oracle.com>
date Fri, 29 Apr 2011 16:46:30 +0200
parents 274360f98f97
children 46586c77b129
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1 /*
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
4 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
7 * published by the Free Software Foundation.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
8 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
13 * accompanied this code).
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
14 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
18 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
21 * questions.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
22 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
23 package com.sun.c1x.value;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
24
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
25 import java.util.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
26
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
27 import com.sun.c1x.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
28 import com.sun.c1x.graph.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
29 import com.sun.c1x.ir.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
30 import com.sun.cri.ci.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
31
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
32 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
33 * The {@code FrameState} class encapsulates the frame state (i.e. local variables and
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
34 * operand stack) at a particular point in the abstract interpretation.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
35 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
36 * @author Ben L. Titzer
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
37 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
38 public abstract class FrameState {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
39
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
40 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
41 * The operand stack and local variables.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
42 * The local variables occupy the index range {@code [0 .. maxLocals)}.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
43 * The operand stack occupies the index range {@code [maxLocals .. values.length)}.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
44 * The top of the operand stack is at index {@code maxLocals + stackIndex}.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
45 * This does not include the operand stack or local variables of parent frames.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
46 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
47 * {@linkplain CiKind#isDoubleWord() Double-word} local variables and
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
48 * operand stack values occupy 2 slots in this array with the second slot
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
49 * being {@code null}.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
50 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
51 protected final Value[] values;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
52
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
53 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
54 * The depth of the operand stack.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
55 * The top of stack value is in {@code values[maxLocals + stackIndex]}.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
56 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
57 protected int stackIndex;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
58
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
59 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
60 * The number of local variables.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
61 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
62 protected final int maxLocals;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
63
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
64 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
65 * The bytecode index to which this frame state applies. This will be {@code -1}
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
66 * iff this state is mutable.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
67 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
68 public final int bci;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
69
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
70 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
71 * The list of locks held by this frame state.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
72 * This does not include locks held by parent frames.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
73 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
74 protected ArrayList<Value> locks;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
75
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
76 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
77 * The number of minimum stack slots required for doing IR wrangling during
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
78 * {@linkplain GraphBuilder bytecode parsing}. While this may hide stack
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
79 * overflow issues in the original bytecode, the assumption is that such
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
80 * issues must be caught by the verifier.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
81 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
82 private static final int MINIMUM_STACK_SLOTS = 1;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
83
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
84 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
85 * Creates a {@code FrameState} for the given scope and maximum number of stack and local variables.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
86 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
87 * @param irScope the inlining context of the method
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
88 * @param bci the bytecode index of the frame state
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
89 * @param maxLocals maximum number of locals
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
90 * @param maxStack maximum size of the stack
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
91 */
2565
cc1f1d396288 Remove inlining (3rd part)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2564
diff changeset
92 public FrameState(int bci, int maxLocals, int maxStack) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
93 this.bci = bci;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
94 this.values = new Value[maxLocals + Math.max(maxStack, MINIMUM_STACK_SLOTS)];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
95 this.maxLocals = maxLocals;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
96 C1XMetrics.FrameStatesCreated++;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
97 C1XMetrics.FrameStateValuesCreated += this.values.length;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
98 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
99
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
100 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
101 * Copies the contents of this frame state so that further updates to either stack aren't reflected in the other.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
102 * @param bci the bytecode index of the copy
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
103 * @param withLocals indicates whether to copy the local state
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
104 * @param withStack indicates whether to copy the stack state
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
105 * @param withLocks indicates whether to copy the lock state
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
106 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
107 * @return a new frame state with the specified components
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
108 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
109 public MutableFrameState copy(int bci, boolean withLocals, boolean withStack, boolean withLocks) {
2565
cc1f1d396288 Remove inlining (3rd part)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2564
diff changeset
110 final MutableFrameState other = new MutableFrameState(bci, localsSize(), maxStackSize());
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
111 if (withLocals && withStack) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
112 // fast path: use array copy
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
113 int valuesSize = valuesSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
114 assert other.values.length >= valuesSize : "array size: " + other.values.length + ", valuesSize: " + valuesSize + ", maxStackSize: " + maxStackSize() + ", localsSize: " + localsSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
115 assert values.length >= valuesSize : "array size: " + values.length + ", valuesSize: " + valuesSize + ", maxStackSize: " + maxStackSize() + ", localsSize: " + localsSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
116 System.arraycopy(values, 0, other.values, 0, valuesSize);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
117 other.stackIndex = stackIndex;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
118 } else {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
119 if (withLocals) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
120 other.replaceLocals(this);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
121 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
122 if (withStack) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
123 other.replaceStack(this);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
124 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
125 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
126 if (withLocks) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
127 other.replaceLocks(this);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
128 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
129 return other;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
130 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
131
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
132 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
133 * Gets a mutable copy ({@link MutableFrameState}) of this frame state.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
134 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
135 public MutableFrameState copy() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
136 return copy(bci, true, true, true);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
137 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
138
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
139 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
140 * Gets an immutable copy of this frame state but without the stack.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
141 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
142 public FrameState immutableCopyWithEmptyStack() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
143 return copy(bci, true, false, true);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
144 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
145
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
146 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
147 * Gets an immutable copy of this frame state but without the frame info.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
148 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
149 public FrameState immutableCopyCodePosOnly() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
150 return copy(bci, false, false, false);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
151 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
152
2565
cc1f1d396288 Remove inlining (3rd part)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2564
diff changeset
153 public boolean isSame(FrameState other) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
154 assert stackSize() == other.stackSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
155 assert localsSize() == other.localsSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
156 assert locksSize() == other.locksSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
157 for (int i = 0; i < stackIndex; i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
158 Value x = stackAt(i);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
159 Value y = other.stackAt(i);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
160 if (x != y && typeMismatch(x, y)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
161 return false;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
162 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
163 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
164 if (locks != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
165 for (int i = 0; i < locks.size(); i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
166 if (lockAt(i) != other.lockAt(i)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
167 return false;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
168 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
169 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
170 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
171 return true;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
172 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
173
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
174 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
175 * Returns the size of the local variables.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
176 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
177 * @return the size of the local variables
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
178 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
179 public int localsSize() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
180 return maxLocals;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
181 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
182
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
183 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
184 * Gets number of locks held by this frame state.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
185 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
186 public int locksSize() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
187 return locks == null ? 0 : locks.size();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
188 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
189
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
190 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
191 * Gets the current size (height) of the stack.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
192 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
193 public int stackSize() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
194 return stackIndex;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
195 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
196
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
197 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
198 * Gets the maximum size (height) of the stack.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
199 ] */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
200 public int maxStackSize() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
201 return values.length - maxLocals;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
202 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
203
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
204 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
205 * Checks whether the stack is empty.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
206 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
207 * @return {@code true} the stack is currently empty
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
208 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
209 public boolean stackEmpty() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
210 return stackIndex == 0;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
211 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
212
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
213 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
214 * Invalidates the local variable at the specified index. If the specified index refers to a doubleword local, then
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
215 * invalidates the high word as well.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
216 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
217 * @param i the index of the local to invalidate
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
218 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
219 public void invalidateLocal(int i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
220 // note that for double word locals, the high slot should already be null
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
221 // unless the local is actually dead and the high slot is being reused;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
222 // in either case, it is not necessary to null the high slot
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
223 values[i] = null;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
224 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
225
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
226 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
227 * Loads the local variable at the specified index.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
228 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
229 * @param i the index of the local variable to load
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
230 * @return the instruction that produced the specified local
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
231 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
232 public Value loadLocal(int i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
233 assert i < maxLocals : "local variable index out of range: " + i;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
234 Value x = values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
235 if (x != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
236 if (x.isIllegal()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
237 return null;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
238 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
239 assert x.kind.isSingleWord() || values[i + 1] == null || values[i + 1] instanceof Phi;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
240 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
241 return x;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
242 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
243
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
244 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
245 * Stores a given local variable at the specified index. If the value is a {@linkplain CiKind#isDoubleWord() double word},
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
246 * then the next local variable index is also overwritten.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
247 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
248 * @param i the index at which to store
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
249 * @param x the instruction which produces the value for the local
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
250 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
251 public void storeLocal(int i, Value x) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
252 assert i < maxLocals : "local variable index out of range: " + i;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
253 invalidateLocal(i);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
254 values[i] = x;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
255 if (isDoubleWord(x)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
256 // (tw) if this was a double word then kill i+1
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
257 values[i + 1] = null;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
258 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
259 if (i > 0) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
260 // if there was a double word at i - 1, then kill it
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
261 Value p = values[i - 1];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
262 if (isDoubleWord(p)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
263 values[i - 1] = null;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
264 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
265 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
266 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
267
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
268 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
269 * Get the value on the stack at the specified stack index.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
270 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
271 * @param i the index into the stack, with {@code 0} being the bottom of the stack
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
272 * @return the instruction at the specified position in the stack
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
273 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
274 public final Value stackAt(int i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
275 assert i < stackIndex;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
276 return values[i + maxLocals];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
277 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
278
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
279 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
280 * Gets the value in the local variables at the specified index.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
281 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
282 * @param i the index into the locals
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
283 * @return the instruction that produced the value for the specified local
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
284 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
285 public final Value localAt(int i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
286 assert i < maxLocals : "local variable index out of range: " + i;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
287 return values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
288 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
289
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
290 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
291 * Retrieves the lock at the specified index in the lock stack.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
292 * @param i the index into the lock stack
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
293 * @return the instruction which produced the object at the specified location in the lock stack
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
294 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
295 public final Value lockAt(int i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
296 return locks.get(i);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
297 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
298
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
299 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
300 * Inserts a phi statement into the stack at the specified stack index.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
301 * @param block the block begin for which we are creating the phi
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
302 * @param i the index into the stack for which to create a phi
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
303 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
304 public void setupPhiForStack(BlockBegin block, int i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
305 Value p = stackAt(i);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
306 if (p != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
307 if (p instanceof Phi) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
308 Phi phi = (Phi) p;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
309 if (phi.block() == block && phi.isOnStack() && phi.stackIndex() == i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
310 return;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
311 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
312 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
313 values[maxLocals + i] = new Phi(p.kind, block, -i - 1);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
314 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
315 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
316
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
317 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
318 * Inserts a phi statement for the local at the specified index.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
319 * @param block the block begin for which we are creating the phi
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
320 * @param i the index of the local variable for which to create the phi
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
321 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
322 public void setupPhiForLocal(BlockBegin block, int i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
323 Value p = values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
324 if (p instanceof Phi) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
325 Phi phi = (Phi) p;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
326 if (phi.block() == block && phi.isLocal() && phi.localIndex() == i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
327 return;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
328 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
329 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
330 storeLocal(i, new Phi(p.kind, block, i));
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
331 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
332
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
333 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
334 * Gets the value at a specified index in the set of operand stack and local values represented by this frame.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
335 * This method should only be used to iterate over all the values in this frame, irrespective of whether
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
336 * they are on the stack or in local variables.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
337 * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
338 * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
339 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
340 * @param i a value in the range {@code [0 .. valuesSize()]}
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
341 * @return the value at index {@code i} which may be {@code null}
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
342 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
343 public final Value valueAt(int i) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
344 return values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
345 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
346
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
347 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
348 * The number of operand stack slots and local variables in this frame.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
349 * This method should typically only be used in conjunction with {@link #valueAt(int)}.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
350 * To iterate the stack slots, the {@link #stackAt(int)} and {@link #stackSize()} methods should be used.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
351 * To iterate the local variables, the {@link #localAt(int)} and {@link #localsSize()} methods should be used.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
352 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
353 * @return the number of local variables in this frame
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
354 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
355 public final int valuesSize() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
356 return maxLocals + stackIndex;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
357 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
358
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
359 public void checkPhis(BlockBegin block, FrameState other) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
360 checkSize(other);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
361 final int max = valuesSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
362 for (int i = 0; i < max; i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
363 Value x = values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
364 Value y = other.values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
365 if (x != null && x != y) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
366 if (x instanceof Phi) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
367 Phi phi = (Phi) x;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
368 if (phi.block() == block) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
369 for (int j = 0; j < phi.inputCount(); j++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
370 if (phi.inputIn(other) == null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
371 throw new CiBailout("phi " + phi + " has null operand at new predecessor");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
372 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
373 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
374 continue;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
375 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
376 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
377 throw new CiBailout("instruction is not a phi or null at " + i);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
378 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
379 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
380 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
381
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
382 private void checkSize(FrameState other) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
383 if (other.stackIndex != stackIndex) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
384 throw new CiBailout("stack sizes do not match");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
385 } else if (other.maxLocals != maxLocals) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
386 throw new CiBailout("local sizes do not match");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
387 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
388 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
389
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
390 public void merge(BlockBegin block, FrameState other) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
391 checkSize(other);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
392 for (int i = 0; i < valuesSize(); i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
393 Value x = values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
394 if (x != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
395 Value y = other.values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
396 if (x != y) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
397 if (typeMismatch(x, y)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
398 if (x instanceof Phi) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
399 Phi phi = (Phi) x;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
400 if (phi.block() == block) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
401 phi.makeDead();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
402 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
403 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
404 values[i] = null;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
405 continue;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
406 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
407 if (i < maxLocals) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
408 // this a local
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
409 setupPhiForLocal(block, i);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
410 } else {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
411 // this is a stack slot
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
412 setupPhiForStack(block, i - maxLocals);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
413 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
414 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
415 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
416 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
417 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
418
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
419 private static boolean typeMismatch(Value x, Value y) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
420 return y == null || x.kind != y.kind;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
421 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
422
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
423 private static boolean isDoubleWord(Value x) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
424 return x != null && x.kind.isDoubleWord();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
425 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
426
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
427 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
428 * The interface implemented by a client of {@link FrameState#forEachPhi(BlockBegin, PhiProcedure)} and
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
429 * {@link FrameState#forEachLivePhi(BlockBegin, PhiProcedure)}.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
430 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
431 public static interface PhiProcedure {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
432 boolean doPhi(Phi phi);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
433 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
434
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
435 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
436 * Traverses all {@linkplain Phi phis} of a given block in this frame state.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
437 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
438 * @param block only phis {@linkplain Phi#block() associated} with this block are traversed
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
439 * @param proc the call back invoked for each live phi traversed
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
440 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
441 public boolean forEachPhi(BlockBegin block, PhiProcedure proc) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
442 int max = this.valuesSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
443 for (int i = 0; i < max; i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
444 Value instr = values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
445 if (instr instanceof Phi && !instr.isDeadPhi()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
446 Phi phi = (Phi) instr;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
447 if (block == null || phi.block() == block) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
448 if (!proc.doPhi(phi)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
449 return false;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
450 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
451 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
452 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
453 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
454 return true;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
455 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
456
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
457 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
458 * Traverses all live {@linkplain Phi phis} of a given block in this frame state.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
459 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
460 * @param block only phis {@linkplain Phi#block() associated} with this block are traversed
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
461 * @param proc the call back invoked for each live phi traversed
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
462 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
463 public final boolean forEachLivePhi(BlockBegin block, PhiProcedure proc) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
464 int max = this.valuesSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
465 for (int i = 0; i < max; i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
466 Value instr = values[i];
2546
e1b3db8031ee Removed liveness marking.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2509
diff changeset
467 if (instr instanceof Phi && !instr.isDeadPhi()) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
468 Phi phi = (Phi) instr;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
469 if (block == null || phi.block() == block) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
470 if (!proc.doPhi(phi)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
471 return false;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
472 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
473 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
474 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
475 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
476 return true;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
477 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
478
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
479 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
480 * Checks whether this frame state has any {@linkplain Phi phi} statements.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
481 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
482 public boolean hasPhis() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
483 int max = valuesSize();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
484 for (int i = 0; i < max; i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
485 Value value = values[i];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
486 if (value instanceof Phi) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
487 return true;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
488 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
489 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
490 return false;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
491 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
492
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
493 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
494 * Iterates over all the values in this frame state and its callers, including the stack, locals, and locks.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
495 * @param closure the closure to apply to each value
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
496 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
497 public void valuesDo(ValueClosure closure) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
498 valuesDo(this, closure);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
499 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
500
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
501 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
502 * Iterates over all the values of a given frame state and its callers, including the stack, locals, and locks.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
503 * @param closure the closure to apply to each value
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
504 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
505 public static void valuesDo(FrameState state, ValueClosure closure) {
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
506 final int max = state.valuesSize();
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
507 for (int i = 0; i < max; i++) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
508 if (state.values[i] != null) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
509 Value newValue = closure.apply(state.values[i]);
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
510 state.values[i] = newValue;
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
511 }
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
512 }
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
513 if (state.locks != null) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
514 for (int i = 0; i < state.locks.size(); i++) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
515 Value instr = state.locks.get(i);
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
516 if (instr != null) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
517 state.locks.set(i, closure.apply(instr));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
518 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
519 }
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
520 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
521 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
522
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
523 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
524 * The interface implemented by a client of {@link FrameState#forEachLiveStateValue(ValueProcedure)}.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
525 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
526 public static interface ValueProcedure {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
527 void doValue(Value value);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
528 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
529
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
530 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
531 * Traverses all {@linkplain Value#isLive() live values} of this frame state and it's callers.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
532 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
533 * @param proc the call back called to process each live value traversed
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
534 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
535 public final void forEachLiveStateValue(ValueProcedure proc) {
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
536 final int max = this.valuesSize();
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
537 for (int i = 0; i < max; i++) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
538 Value value = this.values[i];
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
539 if (value != null) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
540 proc.doValue(value);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
541 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
542 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
543 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
544
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
545 @Override
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
546 public String toString() {
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
547 StringBuilder sb = new StringBuilder();
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
548 String nl = String.format("%n");
2565
cc1f1d396288 Remove inlining (3rd part)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2564
diff changeset
549 sb.append("[bci: ").append(this.bci).append("]").append(nl);
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
550 for (int i = 0; i < this.localsSize(); ++i) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
551 Value value = this.localAt(i);
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
552 sb.append(String.format(" local[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value));
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
553 }
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
554 for (int i = 0; i < this.stackSize(); ++i) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
555 Value value = this.stackAt(i);
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
556 sb.append(String.format(" stack[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value));
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
557 }
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
558 for (int i = 0; i < this.locksSize(); ++i) {
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
559 Value value = this.lockAt(i);
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
560 sb.append(String.format(" lock[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value));
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
561 }
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2546
diff changeset
562 return sb.toString();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
563 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
564 }