Skip to content

Commit

Permalink
Some possible optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
VincenzoArceri committed Mar 4, 2024
1 parent 99b009a commit a73c329
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
16 changes: 1 addition & 15 deletions src/main/java/it/unipr/analysis/AbstractStackSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,7 @@ public boolean isBottom() {
public int size() {
return this.elements().size();
}

@Override
public AbstractStackSet clone() {
if (isTop())
return TOP;
else if (isBottom())
return BOTTOM;
return new AbstractStackSet(new HashSet<>(this.elements), false);

// AbstractStackSet result = new AbstractStackSet(new HashSet<AbstractStack>(), false);
// for (AbstractStack stack : elements())
// result.add(stack.clone());
// return result;
}


@Override
public AbstractStackSet lubAux(AbstractStackSet other) throws SemanticException {
AbstractStackSet lubAux = super.lubAux(other);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/it/unipr/analysis/EVMAbstractState.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public EVMAbstractState(AbstractStackSet stacks, Memory memory, Memory storage,
* @return A cloned copy of the stack or null if the original stack is null.
*/
public AbstractStackSet getStacks() {
return stacks.clone();
return stacks;
}

/**
Expand Down Expand Up @@ -1925,31 +1925,31 @@ public boolean isEmpty() {

@Override
public EVMAbstractState wideningAux(EVMAbstractState other) throws SemanticException {
return new EVMAbstractState(stacks.widening(other.getStacks()),
return new EVMAbstractState(stacks.widening(other.stacks),
memory.widening(other.getMemory()),
storage.widening(other.storage),
mu_i.widening(other.getMu_i()));
}

@Override
public EVMAbstractState lubAux(EVMAbstractState other) throws SemanticException {
return new EVMAbstractState(stacks.lubAux(other.getStacks()),
return new EVMAbstractState(stacks.lubAux(other.stacks),
memory.lub(other.getMemory()),
storage.lub(other.storage),
mu_i.lub(other.getMu_i()));
}

@Override
public EVMAbstractState glbAux(EVMAbstractState other) throws SemanticException {
return new EVMAbstractState(stacks.glbAux(other.getStacks()),
return new EVMAbstractState(stacks.glbAux(other.stacks),
memory.glb(other.getMemory()),
storage.glb(other.storage),
mu_i.glb(other.getMu_i()));
}

@Override
public boolean lessOrEqualAux(EVMAbstractState other) throws SemanticException {
return stacks.lessOrEqual(other.getStacks()) &&
return stacks.lessOrEqual(other.stacks) &&
memory.lessOrEqual(other.getMemory()) &&
mu_i.lessOrEqual(other.getMu_i());
}
Expand Down

0 comments on commit a73c329

Please sign in to comment.