more on continuation passsing

This commit is contained in:
andri lim 2019-04-04 15:21:24 +07:00
parent 60df7ea5e2
commit 039256de6a
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
4 changed files with 5 additions and 1 deletions

View File

@ -213,7 +213,6 @@ proc applyMessage*(computation: BaseComputation, opCode: static[Op]) =
postExecuteVM(computation)
executeOpcodes(computation)
computation.nextProc()
proc addChildComputation*(computation: BaseComputation, child: BaseComputation) =
if child.isError:

View File

@ -593,6 +593,7 @@ op create, inline = false, value, startPosition, size:
var childComp = setupCreate(computation, memPos, len, value)
if childComp.isNil: return
computation.child = childComp
continuation(childComp):
computation.addChildComputation(childComp)
@ -763,6 +764,7 @@ template genCall(callName: untyped, opCode: Op): untyped =
## STATICCALL, 0xfa, Static message-call into an account.
var childComp = `callName Setup`(computation, callName.astToStr)
computation.child = childComp
continuation(childComp):
addChildComputation(computation, childComp)

View File

@ -234,6 +234,7 @@ proc opTableToCaseStmt(opTable: array[Op, NimNode], computation: NimNode): NimNo
try:
let fork = `computation`.getFork
if `computation`.execPrecompiles(fork):
computation.nextProc()
return
if `computation`.tracingEnabled:
@ -248,6 +249,7 @@ proc opTableToCaseStmt(opTable: array[Op, NimNode], computation: NimNode): NimNo
let msg = getCurrentExceptionMsg()
let errorMsg = "Opcode Dispatch Error msg=" & msg & ", depth=" & $computation.msg.depth
`computation`.setError(errorMsg, true)
computation.nextProc()
macro genFrontierDispatch(computation: BaseComputation): untyped =
result = opTableToCaseStmt(FrontierOpDispatch, computation)

View File

@ -71,6 +71,7 @@ type
nextProc*: proc()
memOutLen*: int
memOutPos*: int
child*: BaseComputation
Error* = ref object
info*: string