Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java @ 2666:6ca76b891d31
duplicateModified helper method
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 12 May 2011 11:00:31 +0200 |
parents | 8c02ca1e9eb1 |
children | 32e8315bb6e4 |
comparison
equal
deleted
inserted
replaced
2665:b101099de4c8 | 2666:6ca76b891d31 |
---|---|
84 this(bci, locals.length, stackSize, locks.size(), graph); | 84 this(bci, locals.length, stackSize, locks.size(), graph); |
85 for (int i = 0; i < locals.length; i++) { | 85 for (int i = 0; i < locals.length; i++) { |
86 inputs().set(i, locals[i]); | 86 inputs().set(i, locals[i]); |
87 } | 87 } |
88 for (int i = 0; i < stackSize; i++) { | 88 for (int i = 0; i < stackSize; i++) { |
89 inputs().set(i + localsSize, stack[i]); | 89 inputs().set(localsSize + i, stack[i]); |
90 } | 90 } |
91 for (int i = 0; i < locks.size(); i++) { | 91 for (int i = 0; i < locks.size(); i++) { |
92 inputs().set(locals.length + stackSize + i, locks.get(i)); | 92 inputs().set(locals.length + stackSize + i, locks.get(i)); |
93 } | 93 } |
94 } | 94 } |
107 */ | 107 */ |
108 public FrameState duplicateWithEmptyStack() { | 108 public FrameState duplicateWithEmptyStack() { |
109 FrameState other = new FrameState(bci, localsSize, 0, locksSize(), graph()); | 109 FrameState other = new FrameState(bci, localsSize, 0, locksSize(), graph()); |
110 for (int i = 0; i < localsSize; i++) { | 110 for (int i = 0; i < localsSize; i++) { |
111 other.inputs().set(i, localAt(i)); | 111 other.inputs().set(i, localAt(i)); |
112 } | |
113 for (int i = 0; i < locksSize; i++) { | |
114 other.inputs().set(localsSize + i, lockAt(i)); | |
115 } | |
116 return other; | |
117 } | |
118 | |
119 /** | |
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. | |
122 */ | |
123 public FrameState duplicateModified(int bci, CiKind popKind, Value... pushedValues) { | |
124 int popSlots = popKind.sizeInSlots(); | |
125 int pushSlots = 0; | |
126 for (Value v : pushedValues) { | |
127 pushSlots += v.kind.sizeInSlots(); | |
128 } | |
129 FrameState other = new FrameState(bci, localsSize, stackSize - popSlots + pushSlots, locksSize(), graph()); | |
130 for (int i = 0; i < localsSize; i++) { | |
131 other.inputs().set(i, localAt(i)); | |
132 } | |
133 for (int i = 0; i < stackSize - popSlots; i++) { | |
134 other.inputs().set(localsSize + i, stackAt(i)); | |
135 } | |
136 int slot = stackSize - popSlots; | |
137 for (Value v : pushedValues) { | |
138 assert v.kind.sizeInSlots() > 0; | |
139 if (v.kind.sizeInSlots() == 2) { | |
140 other.inputs().set(localsSize + slot++, null); | |
141 } | |
142 other.inputs().set(localsSize + slot++, v); | |
112 } | 143 } |
113 for (int i = 0; i < locksSize; i++) { | 144 for (int i = 0; i < locksSize; i++) { |
114 other.inputs().set(localsSize + i, lockAt(i)); | 145 other.inputs().set(localsSize + i, lockAt(i)); |
115 } | 146 } |
116 return other; | 147 return other; |