more gcsafe pragmas for Nim HEAD

This commit is contained in:
Ștefan Talpalaru 2019-04-26 00:18:51 +02:00
parent b4de80b8a2
commit 29a226da1e
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
6 changed files with 14 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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`

View File

@ -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:

View File

@ -70,7 +70,7 @@ type
instr*: Op
opIndex*: int
# continuation helpers
nextProc*: proc()
nextProc*: proc() {.gcsafe.}
memOutLen*: int
memOutPos*: int
child*: BaseComputation

2
vendor/nim-json-rpc vendored

@ -1 +1 @@
Subproject commit 2d3db88137ccf62a3d9fcbcecefd32f6a86bec91
Subproject commit 92a7b78f4a2b13bd56260694c0035f7c71f10cb5