Make ./koch temp --gc:arc work (#14186)

This commit is contained in:
Clyybber
2020-05-01 20:25:18 +02:00
committed by GitHub
parent 9c33bcac5c
commit 1f1e4de3bc
8 changed files with 26 additions and 11 deletions

View File

@@ -1824,7 +1824,10 @@ template injectG() {.dirty.} =
graph.backend = newModuleList(graph)
let g = BModuleList(graph.backend)
proc myOpen(graph: ModuleGraph; module: PSym): PPassContext =
when not defined(nimHasSinkInference):
{.pragma: nosinks.}
proc myOpen(graph: ModuleGraph; module: PSym): PPassContext {.nosinks.} =
injectG()
result = newModule(g, module, graph.config)
if optGenIndex in graph.config.globalOptions and g.generatedHeader == nil:

View File

@@ -51,7 +51,10 @@ proc generateDot*(graph: ModuleGraph; project: AbsoluteFile) =
rope(project.splitFile.name), b.dotGraph],
changeFileExt(project, "dot"))
proc myOpen(graph: ModuleGraph; module: PSym): PPassContext =
when not defined(nimHasSinkInference):
{.pragma: nosinks.}
proc myOpen(graph: ModuleGraph; module: PSym): PPassContext {.nosinks.} =
var g: PGen
new(g)
g.module = module

View File

@@ -377,6 +377,9 @@ proc semExprFlagDispatched(c: PContext, n: PNode, flags: TExprFlags): PNode =
evaluated = evalAtCompileTime(c, result)
if evaluated != nil: return evaluated
when not defined(nimHasSinkInference):
{.pragma: nosinks.}
include hlo, seminst, semcall
when false:
@@ -501,7 +504,7 @@ proc addCodeForGenerics(c: PContext, n: PNode) =
n.add prc.ast
c.lastGenericIdx = c.generics.len
proc myOpen(graph: ModuleGraph; module: PSym): PPassContext =
proc myOpen(graph: ModuleGraph; module: PSym): PPassContext {.nosinks.} =
var c = newContext(graph, module)
if c.p != nil: internalError(graph.config, module.info, "sem.myOpen")
c.semConstExpr = semConstExpr
@@ -592,7 +595,7 @@ proc recoverContext(c: PContext) =
while getCurrOwner(c).kind != skModule: popOwner(c)
while c.p != nil and c.p.owner.kind != skModule: c.p = c.p.next
proc myProcess(context: PPassContext, n: PNode): PNode =
proc myProcess(context: PPassContext, n: PNode): PNode {.nosinks.} =
var c = PContext(context)
# no need for an expensive 'try' if we stop after the first error anyway:
if c.config.errorMax <= 1:

View File

@@ -549,7 +549,7 @@ proc tryDeref(n: PNode): PNode =
result.add n
proc semOverloadedCall(c: PContext, n, nOrig: PNode,
filter: TSymKinds, flags: TExprFlags): PNode =
filter: TSymKinds, flags: TExprFlags): PNode {.nosinks.} =
var errors: CandidateErrors = @[] # if efExplain in flags: @[] else: nil
var r = resolveOverloads(c, n, nOrig, filter, flags, errors, efExplain in flags)
if r.state == csMatch:

View File

@@ -320,7 +320,7 @@ proc instantiateProcType(c: PContext, pt: TIdTable,
popInfoContext(c.config)
proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
info: TLineInfo): PSym =
info: TLineInfo): PSym {.nosinks.} =
## Generates a new instance of a generic procedure.
## The `pt` parameter is a type-unsafe mapping table used to link generic
## parameters to their concrete types within the generic instance.

View File

@@ -1594,7 +1594,7 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode =
if optOwnedRefs in c.config.globalOptions:
result.typ = makeVarType(c, result.typ, tyOwned)
proc semInferredLambda(c: PContext, pt: TIdTable, n: PNode): PNode =
proc semInferredLambda(c: PContext, pt: TIdTable, n: PNode): PNode {.nosinks.} =
var n = n
let original = n[namePos].sym

View File

@@ -2584,8 +2584,11 @@ proc argtypeMatches*(c: PContext, f, a: PType, fromHlo = false): bool =
# pattern templates do not allow for conversions except from int literal
res != nil and m.convMatches == 0 and m.intConvMatches in [0, 256]
when not defined(nimHasSinkInference):
{.pragma: nosinks.}
proc instTypeBoundOp*(c: PContext; dc: PSym; t: PType; info: TLineInfo;
op: TTypeAttachedOp; col: int): PSym =
op: TTypeAttachedOp; col: int): PSym {.nosinks.} =
var m = newCandidate(c, dc.typ)
if col >= dc.typ.len:
localError(c.config, info, "cannot instantiate: '" & dc.name.s & "'")

View File

@@ -527,6 +527,9 @@ template maybeHandlePtr(node2: PNode, reg: TFullReg, isAssign2: bool): bool =
else:
false
when not defined(nimHasSinkInference):
{.pragma: nosinks.}
proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
var pc = start
var tos = tos
@@ -1722,7 +1725,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
var error: string
let ast = parseString(regs[rb].node.strVal, c.cache, c.config,
toFullPath(c.config, c.debug[pc]), c.debug[pc].line.int,
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) =
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) {.nosinks.} =
if error.len == 0 and msg <= errMax:
error = formatMsg(conf, info, msg, arg))
if error.len > 0:
@@ -1737,7 +1740,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
var error: string
let ast = parseString(regs[rb].node.strVal, c.cache, c.config,
toFullPath(c.config, c.debug[pc]), c.debug[pc].line.int,
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) =
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) {.nosinks.} =
if error.len == 0 and msg <= errMax:
error = formatMsg(conf, info, msg, arg))
if error.len > 0:
@@ -2137,7 +2140,7 @@ proc setupGlobalCtx*(module: PSym; graph: ModuleGraph) =
else:
refresh(PCtx graph.vm, module)
proc myOpen(graph: ModuleGraph; module: PSym): PPassContext =
proc myOpen(graph: ModuleGraph; module: PSym): PPassContext {.nosinks.} =
#var c = newEvalContext(module, emRepl)
#c.features = {allowCast, allowInfiniteLoops}
#pushStackFrame(c, newStackFrame())