pkg/vm/compiler: update README

s/opdump/inspect/ and new sample output.
This commit is contained in:
Roman Khimov 2019-08-15 19:53:21 +03:00
parent 57c7df4dff
commit 1e09037902

View file

@ -68,24 +68,39 @@ By default the filename will be the name of your .go file with the .avm extensio
You can dump the opcodes generated by the compiler with the following command:
```
./bin/neo-go contract opdump -i mycontract.go
./bin/neo-go contract inspect -i mycontract.go
```
This will result in something like this:
```
INDEX OPCODE DESC
0 0x52 OpPush2
1 0xc5 OpNewArray
2 0x6b OpToAltStack
3 0x 0 OpPush0
4 0x6c OpFromAltStack
5 0x76 OpDup
6 0x6b OpToAltStack
7 0x 0 OpPush0
8 0x52 OpPush2
9 0x7a OpRoll
10 0xc4 OpSetItem
0 0x54 PUSH4
1 0xc5 NEWARRAY
2 0x6b TOALTSTACK
3 0x1 PUSHBYTES1
3 0x2a *
5 0x6a DUPFROMALTSTACK
6 0x0 PUSH0
7 0x52 PUSH2
8 0x7a ROLL
9 0xc4 SETITEM
10 0x6a DUPFROMALTSTACK
11 0x0 PUSH0
12 0xc3 PICKITEM
13 0x5a PUSH10
14 0xa2 GTE
15 0x64 JMPIFNOT
16 0x7 7
16 0x0 0
18 0x51 PUSH1
19 0x6c FROMALTSTACK
20 0x75 DROP
21 0x66 RET
22 0x0 PUSH0
23 0x6c FROMALTSTACK
24 0x75 DROP
25 0x66 RET
```
### Test invoke a compiled contract