From d37d7fa6a5ad3f918458bc2d2a0379b5e9b73e4a Mon Sep 17 00:00:00 2001 From: andri lim Date: Thu, 4 Apr 2019 17:23:28 +0700 Subject: [PATCH] remove computedGoto pragma --- nimbus/vm/interpreter_dispatch.nim | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nimbus/vm/interpreter_dispatch.nim b/nimbus/vm/interpreter_dispatch.nim index baadcfd96..ee5ce8469 100644 --- a/nimbus/vm/interpreter_dispatch.nim +++ b/nimbus/vm/interpreter_dispatch.nim @@ -211,7 +211,6 @@ proc opTableToCaseStmt(opTable: array[Op, NimNode], computation: NimNode): NimNo `opImpl`(`computation`) if `computation`.tracingEnabled: `computation`.traceOpCodeEnded(`asOp`, `computation`.opIndex) - `instr` = `computation`.code.next() else: quote do: if `computation`.tracingEnabled: @@ -221,8 +220,6 @@ proc opTableToCaseStmt(opTable: array[Op, NimNode], computation: NimNode): NimNo `computation`.traceOpCodeEnded(`asOp`, `computation`.opIndex) when `asOp` in {Return, Revert, SelfDestruct}: break - else: - `instr` = `computation`.code.next() result.add nnkOfBranch.newTree( newIdentNode($op), @@ -233,9 +230,11 @@ proc opTableToCaseStmt(opTable: array[Op, NimNode], computation: NimNode): NimNo result = quote do: if `computation`.tracingEnabled: `computation`.prepareTracer() - `computation`.instr = `computation`.code.next() while true: - {.computedGoto.} + `instr` = `computation`.code.next() + #{.computedGoto.} + # computed goto causing stack overflow, it consumes a lot of space + # we could use manual jump table instead # TODO lots of macro magic here to unravel, with chronicles... # `computation`.logger.log($`computation`.stack & "\n\n", fgGreen) `result`