Skip to content

Commit

Permalink
MOD: trace for program
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyuanyang-uu committed Nov 27, 2023
1 parent c161f1f commit 8da1a1e
Show file tree
Hide file tree
Showing 26 changed files with 314 additions and 196 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 46 additions & 6 deletions assembler/test_data/asm/sccall/sccall_callee.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"program": "setVars:\n.LBL0_0:\n add r9 r9 1\n mov r8 r1\n mstore [r9,-1] r8\n mload r8 [r9,-1]\n mov r5 0\n mov r6 0\n mov r7 0\n mov r8 r8\n mov r1 0\n mov r2 0\n mov r3 0\n mov r4 0\n sstore \n add r9 r9 -1\n ret\nadd:\n.LBL1_0:\n add r9 r9 2\n mov r8 r1\n mov r7 r2\n mstore [r9,-2] r8\n mstore [r9,-1] r7\n mload r8 [r9,-2]\n mload r7 [r9,-1]\n add r0 r8 r7\n range r0\n add r9 r9 -2\n ret\nfunction_dispatch:\n.LBL2_0:\n add r9 r9 3\n mstore [r9,-2] r9\n mov r8 r1\n mov r7 r2\n mov r6 r3\n eq r1 r8 2371037854\n cjmp r1 .LBL2_2\n eq r1 r8 2062500454\n cjmp r1 .LBL2_7\n jmp .LBL2_1\n.LBL2_1:\n ret\n.LBL2_2:\n mov r8 1\n gte r8 r7 r8\n cjmp r8 .LBL2_3\n jmp .LBL2_4\n.LBL2_3:\n mload r1 [r6]\n mov r8 1\n gte r6 r7 r8\n neq r8 r8 r7\n and r6 r6 r8\n cjmp r6 .LBL2_5\n jmp .LBL2_6\n.LBL2_4:\n ret\n.LBL2_5:\n ret\n.LBL2_6:\n call setVars\n add r9 r9 -3\n ret\n.LBL2_7:\n mov r8 2\n gte r8 r7 r8\n cjmp r8 .LBL2_8\n jmp .LBL2_9\n.LBL2_8:\n mload r1 [r6]\n mload r2 [r6,+1]\n mov r8 2\n gte r6 r7 r8\n neq r8 r8 r7\n and r6 r6 r8\n cjmp r6 .LBL2_10\n jmp .LBL2_11\n.LBL2_9:\n ret\n.LBL2_10:\n ret\n.LBL2_11:\n call add\n mov r8 r0\n mov r1 2\n.PROPHET2_0:\n mov r0 psp\n mload r0 [r0]\n mov r6 r0\n not r7 2\n add r7 r7 1\n add r7 r6 r7\n mstore [r9,-3] r7\n mload r7 [r9,-3]\n mstore [r7] r8\n mov r8 1\n mstore [r7,+1] r8\n mload r8 [r9,-3]\n tstore r8 2\n add r9 r9 -3\n ret\nmain:\n.LBL3_0:\n add r9 r9 2\n mstore [r9,-2] r9\n mov r1 13\n.PROPHET3_0:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n not r7 13\n add r7 r7 1\n add r8 r1 r7\n mov r7 1\n tload r8 r7 13\n mload r8 [r8]\n mov r1 14\n.PROPHET3_1:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n not r7 14\n add r7 r7 1\n add r6 r1 r7\n mov r7 1\n tload r6 r7 14\n mov r7 r6\n mload r2 [r7]\n add r5 r2 14\n mov r1 r5\n.PROPHET3_2:\n mov r0 psp\n mload r0 [r0]\n mov r6 r0\n not r7 r5\n add r7 r7 1\n add r3 r6 r7\n mov r7 1\n tload r3 r7 r5\n mov r1 r8\n call function_dispatch\n add r9 r9 -2\n end\n",
"program": "memcpy:\n.LBL15_0:\n add r9 r9 4\n mstore [r9,-4] r1\n mload r1 [r9,-4]\n mstore [r9,-3] r2\n mload r2 [r9,-3]\n mstore [r9,-2] r3\n mload r3 [r9,-2]\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL15_1\n.LBL15_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL15_2\n jmp .LBL15_3\n.LBL15_2:\n mload r6 [r1,r4]\n mstore [r2,r4] r6\n add r5 r4 1\n mstore [r9,-1] r5\n jmp .LBL15_1\n.LBL15_3:\n add r9 r9 -4\n ret\nmemcmp:\n.LBL16_0:\n add r9 r9 5\n mstore [r9,-4] r1\n mload r1 [r9,-4]\n mstore [r9,-3] r2\n mload r2 [r9,-3]\n mstore [r9,-2] r3\n mload r3 [r9,-2]\n mov r4 0\n mstore [r9,-1] r4\n jmp .LBL16_1\n.LBL16_1:\n mload r4 [r9,-1]\n gte r5 r3 r4\n neq r6 r4 r3\n and r5 r5 r6\n cjmp r5 .LBL16_2\n jmp .LBL16_3\n.LBL16_2:\n mload r6 [r1,r4]\n mload r7 [r2,r4]\n mstore [r9,-5] r7\n mload r7 [r9,-5]\n eq r6 r6 r7\n cjmp r6 .LBL16_2\n jmp .LBL16_4\n add r5 r4 1\n mstore [r9,-1] r5\n jmp .LBL16_1\n.LBL16_3:\n add r9 r9 -5\n ret\n.LBL16_4:\n mov r0 0\n add r9 r9 -5\n ret\nsetVars:\n.LBL17_0:\n add r9 r9 1\n mstore [r9,-1] r1\n mload r4 [r9,-1]\n mov r1 4\n.PROPHET17_0:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n not r7 4\n add r7 r7 1\n add r2 r1 r7\n mov r1 0\n mstore [r2] r1\n mov r1 0\n mstore [r2,+1] r1\n mov r1 0\n mstore [r2,+2] r1\n mov r1 0\n mstore [r2,+3] r1\n mov r1 4\n.PROPHET17_1:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n not r7 4\n add r7 r7 1\n add r3 r1 r7\n mov r1 r3\n mstore [r1] r4\n mov r3 0\n mstore [r1,+1] r3\n mov r3 0\n mstore [r1,+2] r3\n mov r3 0\n mstore [r1,+3] r3\n sstore r2 r1\n add r9 r9 -1\n ret\nadd:\n.LBL18_0:\n add r9 r9 2\n mstore [r9,-2] r1\n mstore [r9,-1] r2\n mload r1 [r9,-2]\n mload r2 [r9,-1]\n add r0 r1 r2\n range r0\n add r9 r9 -2\n ret\nfunction_dispatch:\n.LBL19_0:\n add r9 r9 4\n mstore [r9,-2] r9\n mov r4 r1\n mov r1 r2\n mov r1 r3\n mstore [r9,-3] r1\n mload r1 [r9,-3]\n eq r1 r4 2371037854\n cjmp r1 .LBL19_2\n eq r1 r4 2062500454\n cjmp r1 .LBL19_3\n jmp .LBL19_1\n.LBL19_1:\n ret\n.LBL19_2:\n mload r1 [r1]\n call setVars\n add r9 r9 -4\n ret\n.LBL19_3:\n mov r3 r1\n mload r3 [r3]\n add r2 r1 1\n mov r1 r2\n mload r2 [r1]\n mov r1 r3\n call add\n mov r2 r0\n mov r1 2\n.PROPHET19_0:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n not r7 2\n add r7 r7 1\n add r1 r1 r7\n mstore [r9,-4] r1\n mload r1 [r9,-4]\n mstore [r1] r2\n mov r2 1\n mstore [r1,+1] r2\n mload r1 [r9,-4]\n tstore r1 2\n add r9 r9 -4\n ret\nmain:\n.LBL20_0:\n add r9 r9 2\n mstore [r9,-2] r9\n mov r1 13\n.PROPHET20_0:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n mov r6 1\n not r7 13\n add r7 r7 1\n add r2 r1 r7\n tload r2 r6 13\n mov r1 r2\n mload r6 [r1]\n mov r1 14\n.PROPHET20_1:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n mov r2 1\n not r7 14\n add r7 r7 1\n add r3 r1 r7\n tload r3 r2 14\n mov r1 r3\n mload r2 [r1]\n add r4 r2 14\n mov r1 r4\n.PROPHET20_2:\n mov r0 psp\n mload r0 [r0]\n mov r1 r0\n mov r3 1\n not r7 r4\n add r7 r7 1\n add r5 r1 r7\n tload r5 r3 r4\n mov r3 r5\n mov r1 r6\n call function_dispatch\n add r9 r9 -2\n end\n",
"prophets": [
{
"label": ".PROPHET2_0",
"label": ".PROPHET17_0",
"code": "%{\n entry() {\n cid.addr = malloc(cid.len);\n }\n%}",
"inputs": [
{
Expand All @@ -22,7 +22,7 @@
]
},
{
"label": ".PROPHET3_0",
"label": ".PROPHET17_1",
"code": "%{\n entry() {\n cid.addr = malloc(cid.len);\n }\n%}",
"inputs": [
{
Expand All @@ -42,7 +42,7 @@
]
},
{
"label": ".PROPHET3_1",
"label": ".PROPHET19_0",
"code": "%{\n entry() {\n cid.addr = malloc(cid.len);\n }\n%}",
"inputs": [
{
Expand All @@ -62,7 +62,47 @@
]
},
{
"label": ".PROPHET3_2",
"label": ".PROPHET20_0",
"code": "%{\n entry() {\n cid.addr = malloc(cid.len);\n }\n%}",
"inputs": [
{
"name": "cid.len",
"length": 1,
"is_ref": false,
"is_input_output": false
}
],
"outputs": [
{
"name": "cid.addr",
"length": 1,
"is_ref": false,
"is_input_output": false
}
]
},
{
"label": ".PROPHET20_1",
"code": "%{\n entry() {\n cid.addr = malloc(cid.len);\n }\n%}",
"inputs": [
{
"name": "cid.len",
"length": 1,
"is_ref": false,
"is_input_output": false
}
],
"outputs": [
{
"name": "cid.addr",
"length": 1,
"is_ref": false,
"is_input_output": false
}
]
},
{
"label": ".PROPHET20_2",
"code": "%{\n entry() {\n cid.addr = malloc(cid.len);\n }\n%}",
"inputs": [
{
Expand All @@ -82,4 +122,4 @@
]
}
]
}
}
Loading

0 comments on commit 8da1a1e

Please sign in to comment.