'parallel' statement works again

This commit is contained in:
Araq
2014-08-08 02:28:26 +02:00
parent 32197b7a13
commit 0914b489b3
4 changed files with 8 additions and 9 deletions

View File

@@ -1922,7 +1922,9 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
putLocIntoDest(p, d, sym.loc)
of skTemp:
if sym.loc.r == nil or sym.loc.t == nil:
internalError(n.info, "expr: temp not init " & sym.name.s)
#echo "FAILED FOR PRCO ", p.prc.name.s
#echo renderTree(p.prc.ast, {renderIds})
internalError(n.info, "expr: temp not init " & sym.name.s & "_" & $sym.id)
putLocIntoDest(p, d, sym.loc)
of skParam:
if sym.loc.r == nil or sym.loc.t == nil:

View File

@@ -218,7 +218,6 @@ proc addLocalVar(varSection, varInit: PNode; owner: PSym; typ: PType;
deepCopyCall.sons[0] = newSymNode(createMagic("deepCopy", mDeepCopy))
deepCopyCall.sons[1] = newSymNode(result)
deepCopyCall.sons[2] = v
deepCopyCall.typ = typ
varInit.add deepCopyCall
discard """
@@ -257,10 +256,10 @@ proc createWrapperProc(f: PNode; threadParam, argsParam: PSym;
var body = newNodeI(nkStmtList, f.info)
var threadLocalBarrier: PSym
if barrier != nil:
var varSection = newNodeI(nkVarSection, barrier.info)
threadLocalBarrier = addLocalVar(varSection, nil, argsParam.owner,
var varSection2 = newNodeI(nkVarSection, barrier.info)
threadLocalBarrier = addLocalVar(varSection2, nil, argsParam.owner,
barrier.typ, barrier)
body.add varSection
body.add varSection2
body.add callCodeGenProc("barrierEnter", threadLocalBarrier.newSymNode)
var threadLocalProm: PSym
if spawnKind == srByVar:
@@ -268,8 +267,7 @@ proc createWrapperProc(f: PNode; threadParam, argsParam: PSym;
elif fv != nil:
internalAssert fv.typ.kind == tyGenericInst
threadLocalProm = addLocalVar(varSection, nil, argsParam.owner, fv.typ, fv)
if barrier == nil:
body.add varSection
body.add varSection
body.add varInit
if fv != nil and spawnKind != srByVar:
# generate:

View File

@@ -592,7 +592,7 @@ proc analyseIfAddressTakenInCall(c: PContext, n: PNode) =
const
FakeVarParams = {mNew, mNewFinalize, mInc, ast.mDec, mIncl, mExcl,
mSetLengthStr, mSetLengthSeq, mAppendStrCh, mAppendStrStr, mSwap,
mAppendSeqElem, mNewSeq, mReset, mShallowCopy}
mAppendSeqElem, mNewSeq, mReset, mShallowCopy, mDeepCopy}
# get the real type of the callee
# it may be a proc var with a generic alias type, so we skip over them

View File

@@ -462,4 +462,3 @@ proc liftParallel*(owner: PSym; n: PNode): PNode =
result.add callCodeGenProc("openBarrier", barrier)
result.add transformSpawn(owner, body, barrier)
result.add callCodeGenProc("closeBarrier", barrier)