fixes #235
This commit is contained in:
parent
7ff9a7f02e
commit
28245e92a2
|
@ -152,7 +152,9 @@ proc displayDecompiled*(c: CodeStream) =
|
||||||
for op in opcodes:
|
for op in opcodes:
|
||||||
echo op[0], " ", op[1], " ", op[2]
|
echo op[0], " ", op[1], " ", op[2]
|
||||||
|
|
||||||
|
|
||||||
proc hasSStore*(c: var CodeStream): bool =
|
proc hasSStore*(c: var CodeStream): bool =
|
||||||
let opcodes = c.decompile()
|
let opcodes = c.decompile()
|
||||||
result = opcodes.anyIt(it[1] == SSTORE)
|
result = opcodes.anyIt(it[1] == SSTORE)
|
||||||
|
|
||||||
|
proc atEnd*(c: CodeStream): bool =
|
||||||
|
result = c.pc >= c.bytes.len
|
||||||
|
|
|
@ -187,13 +187,17 @@ proc opTableToCaseStmt(opTable: array[Op, NimNode], computation: NimNode): NimNo
|
||||||
# Add a branch for each (opcode, proc) pair
|
# Add a branch for each (opcode, proc) pair
|
||||||
# We dispatch to the next instruction at the end of each branch
|
# We dispatch to the next instruction at the end of each branch
|
||||||
for op, opImpl in opTable.pairs:
|
for op, opImpl in opTable.pairs:
|
||||||
|
let asOp = quote do: Op(`op`) # TODO: unfortunately when passing to runtime, ops are transformed into int
|
||||||
let branchStmt = block:
|
let branchStmt = block:
|
||||||
if op == Stop:
|
if op == Stop:
|
||||||
quote do:
|
quote do:
|
||||||
trace "op: Stop"
|
trace "op: Stop"
|
||||||
|
if not `computation`.code.atEnd() and `computation`.tracingEnabled:
|
||||||
|
# we only trace `REAL STOP` and ignore `FAKE STOP`
|
||||||
|
let lastOpIndex = `computation`.traceOpCodeStarted(`asOp`)
|
||||||
|
`computation`.traceOpCodeEnded(`asOp`, lastOpIndex)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
let asOp = quote do: Op(`op`) # TODO: unfortunately when passing to runtime, ops are transformed into int
|
|
||||||
if BaseGasCosts[op].kind == GckFixed:
|
if BaseGasCosts[op].kind == GckFixed:
|
||||||
quote do:
|
quote do:
|
||||||
var lastOpIndex: int
|
var lastOpIndex: int
|
||||||
|
|
Loading…
Reference in New Issue