Skip to content

Commit

Permalink
for example file
Browse files Browse the repository at this point in the history
  • Loading branch information
tutugordillo committed Nov 22, 2024
1 parent 619c7c1 commit c28e891
Show file tree
Hide file tree
Showing 5 changed files with 569 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/for/for-asm-json-importer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

{".code":[{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"202"},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"2"},{"begin":-1,"end":-1,"name":"SSTORE","source":-1},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"101"},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"1"},{"begin":-1,"end":-1,"name":"SSTORE","source":-1},{"begin":-1,"end":-1,"name":"PUSH [tag]","source":-1,"value":"1"},{"begin":-1,"end":-1,"name":"JUMP","source":-1},{"begin":-1,"end":-1,"name":"tag","source":-1,"value":"1"},{"begin":-1,"end":-1,"name":"JUMPDEST","source":-1},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"3"},{"begin":-1,"end":-1,"name":"SLOAD","source":-1},{"begin":-1,"end":-1,"name":"ISZERO","source":-1},{"begin":-1,"end":-1,"name":"PUSH [tag]","source":-1,"value":"2"},{"begin":-1,"end":-1,"name":"JUMPI","source":-1},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"404"},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"4"},{"begin":-1,"end":-1,"name":"SSTORE","source":-1},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"505"},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"5"},{"begin":-1,"end":-1,"name":"SSTORE","source":-1},{"begin":-1,"end":-1,"name":"PUSH [tag]","source":-1,"value":"1"},{"begin":-1,"end":-1,"name":"JUMP","source":-1},{"begin":-1,"end":-1,"name":"tag","source":-1,"value":"2"},{"begin":-1,"end":-1,"name":"JUMPDEST","source":-1},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"506"},{"begin":-1,"end":-1,"name":"PUSH","source":-1,"value":"6"},{"begin":-1,"end":-1,"name":"SSTORE","source":-1},{"begin":-1,"end":-1,"name":"STOP","source":-1}],"sourceList":["examples/for/for.cfg"]}
182 changes: 182 additions & 0 deletions examples/for/for-asm-solc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{
".code": [
{
"begin": 64,
"end": 70,
"name": "PUSH",
"source": -1,
"value": "101"
},
{
"begin": 58,
"end": 62,
"name": "PUSH",
"source": -1,
"value": "1"
},
{
"begin": 51,
"end": 71,
"name": "SSTORE",
"source": -1
},
{
"begin": 97,
"end": 103,
"name": "PUSH",
"source": -1,
"value": "202"
},
{
"begin": 91,
"end": 95,
"name": "PUSH",
"source": -1,
"value": "2"
},
{
"begin": 84,
"end": 104,
"name": "SSTORE",
"source": -1
},
{
"begin": 167,
"end": 268,
"name": "tag",
"source": -1,
"value": "1"
},
{
"begin": 167,
"end": 268,
"name": "JUMPDEST",
"source": -1
},
{
"begin": 201,
"end": 205,
"name": "PUSH",
"source": -1,
"value": "3"
},
{
"begin": 195,
"end": 206,
"name": "SLOAD",
"source": -1
},
{
"begin": 188,
"end": 207,
"name": "ISZERO",
"source": -1
},
{
"begin": 185,
"end": 217,
"name": "PUSH [tag]",
"source": -1,
"value": "2"
},
{
"begin": 185,
"end": 217,
"name": "JUMPI",
"source": -1
},
{
"begin": 247,
"end": 253,
"name": "PUSH",
"source": -1,
"value": "505"
},
{
"begin": 241,
"end": 245,
"name": "PUSH",
"source": -1,
"value": "5"
},
{
"begin": 234,
"end": 254,
"name": "SSTORE",
"source": -1
},
{
"begin": 145,
"end": 151,
"name": "PUSH",
"source": -1,
"value": "404"
},
{
"begin": 139,
"end": 143,
"name": "PUSH",
"source": -1,
"value": "4"
},
{
"begin": 132,
"end": 152,
"name": "SSTORE",
"source": -1
},
{
"begin": 130,
"end": 154,
"name": "PUSH [tag]",
"source": -1,
"value": "1"
},
{
"begin": 130,
"end": 154,
"name": "JUMP",
"source": -1
},
{
"begin": 208,
"end": 217,
"name": "tag",
"source": -1,
"value": "2"
},
{
"begin": 208,
"end": 217,
"name": "JUMPDEST",
"source": -1
},
{
"begin": 294,
"end": 300,
"name": "PUSH",
"source": -1,
"value": "506"
},
{
"begin": 288,
"end": 292,
"name": "PUSH",
"source": -1,
"value": "6"
},
{
"begin": 281,
"end": 301,
"name": "SSTORE",
"source": -1
},
{
"begin": 117,
"end": 268,
"name": "STOP",
"source": -1
}
],
"sourceList": []
}
136 changes: 136 additions & 0 deletions examples/for/for.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"object": {
"blocks": [
{
"exit": {
"targets": [
"Block2"
],
"type": "Jump"
},
"id": "Block0",
"instructions": [
{
"in": [
"0x0101",
"0x01"
],
"op": "sstore",
"out": []
},
{
"in": [
"0x0202",
"0x02"
],
"op": "sstore",
"out": []
}
],
"type": "BuiltinCall"
},
{
"exit": {
"cond": "v6",
"targets": [
"Block6",
"Block5"
],
"type": "ConditionalJump"
},
"id": "Block2",
"instructions": [
{
"in": [
"0x03"
],
"op": "sload",
"out": [
"v5"
]
},
{
"in": [
"v5"
],
"op": "iszero",
"out": [
"v6"
]
}
],
"type": "BuiltinCall"
},
{
"exit": {
"targets": [
"Block3"
],
"type": "Jump"
},
"id": "Block6",
"instructions": [
{
"in": [
"0x0505",
"0x05"
],
"op": "sstore",
"out": []
}
],
"type": "BuiltinCall"
},
{
"exit": {
"targets": [
"Block4"
],
"type": "Jump"
},
"id": "Block5",
"instructions": []
},
{
"exit": {
"targets": [
"Block2"
],
"type": "Jump"
},
"id": "Block3",
"instructions": [
{
"in": [
"0x0404",
"0x04"
],
"op": "sstore",
"out": []
}
],
"type": "BuiltinCall"
},
{
"exit": {
"type": "MainExit"
},
"id": "Block4",
"instructions": [
{
"in": [
"0x0506",
"0x06"
],
"op": "sstore",
"out": []
}
],
"type": "BuiltinCall"
}
],
"functions": {}
},
"subObjects": {},
"type": "Object"
}
51 changes: 51 additions & 0 deletions examples/for/for.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
sstore(0x01, 0x0101)
for { sstore(0x02, 0x0202) } sload(0x03) { sstore(0x04, 0x0404) } {
sstore(0x05, 0x0505)
}
sstore(0x06, 0x0506)
}
// ----
// digraph CFG {
// nodesep=0.7;
// node[shape=box];
//
// Entry [label="Entry"];
// Entry -> Block0;
// Block0 [label="\
// sstore: [ 0x0101 0x01 ] => [ ]\l\
// sstore: [ 0x0202 0x02 ] => [ ]\l\
// "];
// Block0 -> Block0Exit [arrowhead=none];
// Block0Exit [label="Jump" shape=oval];
// Block0Exit -> Block1;
//
// Block1 [label="\
// sload: [ 0x03 ] => [ TMP[sload, 0] ]\l\
// "];
// Block1 -> Block1Exit;
// Block1Exit [label="{ TMP[sload, 0]| { <0> Zero | <1> NonZero }}" shape=Mrecord];
// Block1Exit:0 -> Block2;
// Block1Exit:1 -> Block3;
//
// Block2 [label="\
// sstore: [ 0x0506 0x06 ] => [ ]\l\
// "];
// Block2Exit [label="MainExit"];
// Block2 -> Block2Exit;
//
// Block3 [label="\
// sstore: [ 0x0505 0x05 ] => [ ]\l\
// "];
// Block3 -> Block3Exit [arrowhead=none];
// Block3Exit [label="Jump" shape=oval];
// Block3Exit -> Block4;
//
// Block4 [label="\
// sstore: [ 0x0404 0x04 ] => [ ]\l\
// "];
// Block4 -> Block4Exit [arrowhead=none];
// Block4Exit [label="BackwardsJump" shape=oval];
// Block4Exit -> Block1;
//
// }
Loading

0 comments on commit c28e891

Please sign in to comment.