diff --git a/nimbus/vm/computation.nim b/nimbus/vm/computation.nim index 9e21055d5..04c27c081 100644 --- a/nimbus/vm/computation.nim +++ b/nimbus/vm/computation.nim @@ -131,7 +131,7 @@ proc getFork*(computation: BaseComputation): Fork = else: computation.vmState.blockNumber.toFork -proc writeContract*(computation: BaseComputation, fork: Fork): bool = +proc writeContract*(computation: BaseComputation, fork: Fork): bool {.gcsafe.} = result = true let contractCode = computation.output @@ -172,11 +172,11 @@ template continuation*(comp: BaseComputation, body: untyped) = # this is a helper template to implement continuation # passing and convert all recursion into tail call var tmpNext = comp.nextProc - comp.nextProc = proc() = + comp.nextProc = proc() {.gcsafe.} = body tmpNext() -proc postExecuteVM(computation: BaseComputation, opCode: static[Op]) = +proc postExecuteVM(computation: BaseComputation, opCode: static[Op]) {.gcsafe.} = when opCode == Create: if computation.isSuccess: let fork = computation.getFork diff --git a/nimbus/vm/interpreter/gas_costs.nim b/nimbus/vm/interpreter/gas_costs.nim index 63a6a4d6d..4ba2fd8f1 100644 --- a/nimbus/vm/interpreter/gas_costs.nim +++ b/nimbus/vm/interpreter/gas_costs.nim @@ -96,11 +96,11 @@ type of GckFixed: cost*: GasInt of GckDynamic: - d_handler*: proc(value: Uint256): GasInt {.nimcall.} + d_handler*: proc(value: Uint256): GasInt {.nimcall, gcsafe.} of GckMemExpansion: - m_handler*: proc(currentMemSize, memOffset, memLength: Natural): GasInt {.nimcall.} + m_handler*: proc(currentMemSize, memOffset, memLength: Natural): GasInt {.nimcall, gcsafe.} of GckComplex: - c_handler*: proc(value: Uint256, gasParams: GasParams): GasResult {.nimcall.} + c_handler*: proc(value: Uint256, gasParams: GasParams): GasResult {.nimcall, gcsafe.} # We use gasCost/gasRefund for: # - Properly log and order cost and refund (for Sstore especially) # - Allow to use unsigned integer in the future @@ -362,13 +362,13 @@ template gasCosts(fork: Fork, prefix, ResultGasCostsName: untyped) = func fixed(gasFeeKind: static[GasFeeKind]): GasCost = GasCost(kind: GckFixed, cost: static(FeeSchedule[gasFeeKind])) - func dynamic(handler: proc(value: Uint256): GasInt {.nimcall.}): GasCost = + func dynamic(handler: proc(value: Uint256): GasInt {.nimcall, gcsafe.}): GasCost = GasCost(kind: GckDynamic, d_handler: handler) - func memExpansion(handler: proc(currentMemSize, memOffset, memLength: Natural): GasInt {.nimcall.}): GasCost = + func memExpansion(handler: proc(currentMemSize, memOffset, memLength: Natural): GasInt {.nimcall, gcsafe.}): GasCost = GasCost(kind: GckMemExpansion, m_handler: handler) - func complex(handler: proc(value: Uint256, gasParams: GasParams): GasResult {.nimcall.}): GasCost = + func complex(handler: proc(value: Uint256, gasParams: GasParams): GasResult {.nimcall, gcsafe.}): GasCost = GasCost(kind: GckComplex, c_handler: handler) # Returned value diff --git a/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim b/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim index 612c5becd..476fa8686 100644 --- a/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim +++ b/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim @@ -64,7 +64,7 @@ macro op*(procname: untyped, inline: static[bool], stackParams_body: varargs[unt `body` else: result = quote do: - proc `procname`*(`computation`: BaseComputation) = + proc `procname`*(`computation`: BaseComputation) {.gcsafe.} = `popStackStmt` `body` diff --git a/nimbus/vm/interpreter_dispatch.nim b/nimbus/vm/interpreter_dispatch.nim index 008be60b2..b1e9f41fd 100644 --- a/nimbus/vm/interpreter_dispatch.nim +++ b/nimbus/vm/interpreter_dispatch.nim @@ -272,10 +272,10 @@ proc homesteadVM(computation: BaseComputation) = proc tangerineVM(computation: BaseComputation) = genTangerineDispatch(computation) -proc spuriousVM(computation: BaseComputation) = +proc spuriousVM(computation: BaseComputation) {.gcsafe.} = genSpuriousDispatch(computation) -proc selectVM(computation: BaseComputation, fork: Fork) = +proc selectVM(computation: BaseComputation, fork: Fork) {.gcsafe.} = # TODO: Optimise getting fork and updating opCodeExec only when necessary case fork of FkFrontier..FkThawing: diff --git a/nimbus/vm_types.nim b/nimbus/vm_types.nim index 354925e4c..10899b100 100644 --- a/nimbus/vm_types.nim +++ b/nimbus/vm_types.nim @@ -70,7 +70,7 @@ type instr*: Op opIndex*: int # continuation helpers - nextProc*: proc() + nextProc*: proc() {.gcsafe.} memOutLen*: int memOutPos*: int child*: BaseComputation diff --git a/vendor/nim-json-rpc b/vendor/nim-json-rpc index 2d3db8813..92a7b78f4 160000 --- a/vendor/nim-json-rpc +++ b/vendor/nim-json-rpc @@ -1 +1 @@ -Subproject commit 2d3db88137ccf62a3d9fcbcecefd32f6a86bec91 +Subproject commit 92a7b78f4a2b13bd56260694c0035f7c71f10cb5