more on continuation passsing
This commit is contained in:
parent
60df7ea5e2
commit
039256de6a
|
@ -213,7 +213,6 @@ proc applyMessage*(computation: BaseComputation, opCode: static[Op]) =
|
||||||
postExecuteVM(computation)
|
postExecuteVM(computation)
|
||||||
|
|
||||||
executeOpcodes(computation)
|
executeOpcodes(computation)
|
||||||
computation.nextProc()
|
|
||||||
|
|
||||||
proc addChildComputation*(computation: BaseComputation, child: BaseComputation) =
|
proc addChildComputation*(computation: BaseComputation, child: BaseComputation) =
|
||||||
if child.isError:
|
if child.isError:
|
||||||
|
|
|
@ -593,6 +593,7 @@ op create, inline = false, value, startPosition, size:
|
||||||
var childComp = setupCreate(computation, memPos, len, value)
|
var childComp = setupCreate(computation, memPos, len, value)
|
||||||
if childComp.isNil: return
|
if childComp.isNil: return
|
||||||
|
|
||||||
|
computation.child = childComp
|
||||||
continuation(childComp):
|
continuation(childComp):
|
||||||
computation.addChildComputation(childComp)
|
computation.addChildComputation(childComp)
|
||||||
|
|
||||||
|
@ -763,6 +764,7 @@ template genCall(callName: untyped, opCode: Op): untyped =
|
||||||
## STATICCALL, 0xfa, Static message-call into an account.
|
## STATICCALL, 0xfa, Static message-call into an account.
|
||||||
var childComp = `callName Setup`(computation, callName.astToStr)
|
var childComp = `callName Setup`(computation, callName.astToStr)
|
||||||
|
|
||||||
|
computation.child = childComp
|
||||||
continuation(childComp):
|
continuation(childComp):
|
||||||
addChildComputation(computation, childComp)
|
addChildComputation(computation, childComp)
|
||||||
|
|
||||||
|
|
|
@ -234,6 +234,7 @@ proc opTableToCaseStmt(opTable: array[Op, NimNode], computation: NimNode): NimNo
|
||||||
try:
|
try:
|
||||||
let fork = `computation`.getFork
|
let fork = `computation`.getFork
|
||||||
if `computation`.execPrecompiles(fork):
|
if `computation`.execPrecompiles(fork):
|
||||||
|
computation.nextProc()
|
||||||
return
|
return
|
||||||
|
|
||||||
if `computation`.tracingEnabled:
|
if `computation`.tracingEnabled:
|
||||||
|
@ -248,6 +249,7 @@ proc opTableToCaseStmt(opTable: array[Op, NimNode], computation: NimNode): NimNo
|
||||||
let msg = getCurrentExceptionMsg()
|
let msg = getCurrentExceptionMsg()
|
||||||
let errorMsg = "Opcode Dispatch Error msg=" & msg & ", depth=" & $computation.msg.depth
|
let errorMsg = "Opcode Dispatch Error msg=" & msg & ", depth=" & $computation.msg.depth
|
||||||
`computation`.setError(errorMsg, true)
|
`computation`.setError(errorMsg, true)
|
||||||
|
computation.nextProc()
|
||||||
|
|
||||||
macro genFrontierDispatch(computation: BaseComputation): untyped =
|
macro genFrontierDispatch(computation: BaseComputation): untyped =
|
||||||
result = opTableToCaseStmt(FrontierOpDispatch, computation)
|
result = opTableToCaseStmt(FrontierOpDispatch, computation)
|
||||||
|
|
|
@ -71,6 +71,7 @@ type
|
||||||
nextProc*: proc()
|
nextProc*: proc()
|
||||||
memOutLen*: int
|
memOutLen*: int
|
||||||
memOutPos*: int
|
memOutPos*: int
|
||||||
|
child*: BaseComputation
|
||||||
|
|
||||||
Error* = ref object
|
Error* = ref object
|
||||||
info*: string
|
info*: string
|
||||||
|
|
Loading…
Reference in New Issue