Skip to content

Commit b4456bc

Browse files
Introduced popX method, removed useless clone in EVM abstract state
1 parent fe23531 commit b4456bc

File tree

2 files changed

+65
-111
lines changed

2 files changed

+65
-111
lines changed

src/main/java/it/unipr/analysis/AbstractStack.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,17 @@ public StackElement pop() {
220220
return result;
221221
}
222222

223+
public void popX(int pos) {
224+
// Shift all elements pos position to the right
225+
System.arraycopy(stack, 0, stack, pos, STACK_LIMIT - pos);
226+
227+
for (int i = 1; i < pos; i++)
228+
if (!stack[i].isTop())
229+
stack[i - 1] = StackElement.BOTTOM;
230+
else
231+
stack[i - 1] = StackElement.TOP;
232+
}
233+
223234
@Override
224235
public AbstractStack lubAux(AbstractStack other) throws SemanticException {
225236
throw new RuntimeException("lub on abstract stack should be never called");

0 commit comments

Comments
 (0)