Skip to content

Commit 5c25763

Browse files
yzhang90daejunpark
authored andcommitted
[kevm debugging] lightweight toString
1 parent ea52152 commit 5c25763

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

java-backend/src/main/java/org/kframework/backend/java/kil/BuiltinMap.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.google.common.collect.Lists;
77
import org.apache.commons.collections4.map.UnmodifiableMap;
88
import org.apache.commons.lang3.tuple.Triple;
9+
import org.kframework.backend.java.builtins.IntToken;
910
import org.kframework.backend.java.symbolic.Transformer;
1011
import org.kframework.backend.java.symbolic.Visitor;
1112
import org.kframework.backend.java.util.Constants;
@@ -120,6 +121,12 @@ public String toString() {
120121

121122
private String toString(String operator, String mapsTo, String identity) {
122123
if (!isEmpty()) {
124+
IntToken key1 = IntToken.of(0);
125+
IntToken key2 = IntToken.of(2);
126+
if(entries.containsKey(key1) && entries.get(key1).toString().equals("PUSH(Int(#\"1\"),, Int(#\"0\"))") &&
127+
entries.containsKey(key2) && entries.get(key2).toString().equals("CALLDATALOAD_EVM(.KList)")) {
128+
return "CodeMap(" + entries.size() + ")";
129+
}
123130
return Joiner.on(operator).join(
124131
Joiner.on(operator).withKeyValueSeparator(mapsTo).join(entries),
125132
Joiner.on(operator).join(collectionPatterns),

java-backend/src/main/java/org/kframework/backend/java/kil/KItem.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.kframework.backend.java.util.Constants;
1616
import org.kframework.builtin.KLabels;
1717
import org.kframework.kil.Attribute;
18+
import org.kframework.kore.mini.KVariable;
1819
import org.kframework.main.GlobalOptions;
1920
import org.kframework.backend.java.utils.BitSet;
2021
import org.kframework.utils.errorsystem.KException.ExceptionType;
@@ -706,7 +707,21 @@ protected int computeHash() {
706707

707708
@Override
708709
public String toString() {
709-
return kLabel + "(" + kList.toString() + ")";
710+
String label = kLabel.toString();
711+
if(label.equals("<programBytes>") || label.equals("<code>")) {
712+
return kLabel + "(" + ((KList)kList).getContents().size() + ")";
713+
} else if (label.equals("#mkCall__________EVM")) {
714+
return kLabel + "()";
715+
} else if(label.equals("{_|_|_|_|_|_|_|_|_|_|_|_|_}_EVM")) {
716+
return kLabel + "()";
717+
} else if(label.equals("{_|_}_EVM")) {
718+
return kLabel + "()";
719+
} else if(label.equals("<callState>-fragment")){
720+
return kLabel + "()";
721+
}
722+
else {
723+
return kLabel + "(" + kList.toString() + ")";
724+
}
710725
}
711726

712727
@Override

java-backend/src/main/java/org/kframework/backend/java/symbolic/SymbolicRewriter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ public List<ConstrainedTerm> proveRule(
675675
guarded = true;
676676
}
677677

678+
System.out.println("Prove steps: " + step);
678679
return proofResults;
679680
}
680681

0 commit comments

Comments
 (0)