mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-23 07:10:56 +00:00
maybe now
This commit is contained in:
@@ -1286,24 +1286,15 @@ proc produceSym(g: ModuleGraph; c: PContext; typ: PType; kind: TTypeAttachedOp;
|
||||
tk = tyNone # no special casing for strings and seqs
|
||||
case tk
|
||||
of tySequence:
|
||||
fillSeqOp(a, typ, result.ast[bodyPos], d, src)
|
||||
# YRC: topology-changing seq ops must hold the mutator (read) lock
|
||||
if g.config.selectedGC == gcYrc and
|
||||
let needsYrcLock = g.config.selectedGC == gcYrc and
|
||||
kind in {attachedDestructor, attachedSink, attachedAsgn, attachedDeepCopy, attachedDup} and
|
||||
types.canFormAcycle(g, skipped.elementType):
|
||||
let acquireSym = getSysSym(g, info, "acquireMutatorLock")
|
||||
let releaseSym = getSysSym(g, info, "releaseMutatorLock")
|
||||
if acquireSym != nil and releaseSym != nil and acquireSym.kind != skError and releaseSym.kind != skError:
|
||||
let acquireCall = newNodeI(nkCall, info)
|
||||
acquireCall.add newSymNode(acquireSym)
|
||||
let releaseCall = newNodeI(nkCall, info)
|
||||
releaseCall.add newSymNode(releaseSym)
|
||||
let oldBody = result.ast[bodyPos]
|
||||
result.ast[bodyPos] = newTree(nkStmtList,
|
||||
acquireCall,
|
||||
newTree(nkTryStmt,
|
||||
oldBody,
|
||||
newTree(nkFinally, newTree(nkStmtList, releaseCall))))
|
||||
types.canFormAcycle(g, skipped.elementType)
|
||||
# YRC: topology-changing seq ops must hold the mutator (read) lock
|
||||
if needsYrcLock:
|
||||
result.ast[bodyPos].add callCodegenProc(g, "acquireMutatorLock", info)
|
||||
fillSeqOp(a, typ, result.ast[bodyPos], d, src)
|
||||
if needsYrcLock:
|
||||
result.ast[bodyPos].add callCodegenProc(g, "releaseMutatorLock", info)
|
||||
of tyString:
|
||||
fillStrOp(a, typ, result.ast[bodyPos], d, src)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user