Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java @ 2668:32e8315bb6e4
fixed slot encoding in duplicateModified
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 12 May 2011 12:13:17 +0200 |
parents | 6ca76b891d31 |
children | 7ed72769d51a |
comparison
equal
deleted
inserted
replaced
2667:c4922e69711e | 2668:32e8315bb6e4 |
---|---|
116 return other; | 116 return other; |
117 } | 117 } |
118 | 118 |
119 /** | 119 /** |
120 * Creates a copy of this frame state with one stack element of type popKind popped from the stack and the | 120 * Creates a copy of this frame state with one stack element of type popKind popped from the stack and the |
121 * values in pushedValues pushed on the stack. | 121 * values in pushedValues pushed on the stack. The pushedValues are expected to be in slot encoding: a long |
122 * or double is followed by a null slot. | |
122 */ | 123 */ |
123 public FrameState duplicateModified(int bci, CiKind popKind, Value... pushedValues) { | 124 public FrameState duplicateModified(int bci, CiKind popKind, Value... pushedValues) { |
124 int popSlots = popKind.sizeInSlots(); | 125 int popSlots = popKind.sizeInSlots(); |
125 int pushSlots = 0; | 126 int pushSlots = pushedValues.length; |
126 for (Value v : pushedValues) { | |
127 pushSlots += v.kind.sizeInSlots(); | |
128 } | |
129 FrameState other = new FrameState(bci, localsSize, stackSize - popSlots + pushSlots, locksSize(), graph()); | 127 FrameState other = new FrameState(bci, localsSize, stackSize - popSlots + pushSlots, locksSize(), graph()); |
130 for (int i = 0; i < localsSize; i++) { | 128 for (int i = 0; i < localsSize; i++) { |
131 other.inputs().set(i, localAt(i)); | 129 other.inputs().set(i, localAt(i)); |
132 } | 130 } |
133 for (int i = 0; i < stackSize - popSlots; i++) { | 131 for (int i = 0; i < stackSize - popSlots; i++) { |
134 other.inputs().set(localsSize + i, stackAt(i)); | 132 other.inputs().set(localsSize + i, stackAt(i)); |
135 } | 133 } |
136 int slot = stackSize - popSlots; | 134 int slot = localsSize + stackSize - popSlots; |
137 for (Value v : pushedValues) { | 135 for (int i = 0; i < pushSlots; i++) { |
138 assert v.kind.sizeInSlots() > 0; | 136 other.inputs().set(slot++, pushedValues[i]); |
139 if (v.kind.sizeInSlots() == 2) { | |
140 other.inputs().set(localsSize + slot++, null); | |
141 } | |
142 other.inputs().set(localsSize + slot++, v); | |
143 } | 137 } |
144 for (int i = 0; i < locksSize; i++) { | 138 for (int i = 0; i < locksSize; i++) { |
145 other.inputs().set(localsSize + i, lockAt(i)); | 139 other.inputs().set(localsSize + other.stackSize + i, lockAt(i)); |
146 } | 140 } |
147 return other; | 141 return other; |
148 } | 142 } |
149 | 143 |
150 public boolean isCompatibleWith(FrameStateAccess other) { | 144 public boolean isCompatibleWith(FrameStateAccess other) { |