'let' within 'parallel' now works
This commit is contained in:
parent
1a3b730bf5
commit
8930ba50b9
4 changed files with 21 additions and 6 deletions
|
|
@ -335,7 +335,7 @@ proc analyse(c: var AnalysisCtx; n: PNode) =
|
||||||
localError(n.info, "invalid control flow for 'parallel'")
|
localError(n.info, "invalid control flow for 'parallel'")
|
||||||
# 'break' that leaves the 'parallel' section is not valid either
|
# 'break' that leaves the 'parallel' section is not valid either
|
||||||
# or maybe we should generate a 'try' XXX
|
# or maybe we should generate a 'try' XXX
|
||||||
of nkVarSection:
|
of nkVarSection, nkLetSection:
|
||||||
for it in n:
|
for it in n:
|
||||||
let value = it.lastSon
|
let value = it.lastSon
|
||||||
if value.kind != nkEmpty:
|
if value.kind != nkEmpty:
|
||||||
|
|
@ -396,7 +396,7 @@ proc transformSpawnSons(owner: PSym; n, barrier: PNode): PNode =
|
||||||
|
|
||||||
proc transformSpawn(owner: PSym; n, barrier: PNode): PNode =
|
proc transformSpawn(owner: PSym; n, barrier: PNode): PNode =
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkVarSection:
|
of nkVarSection, nkLetSection:
|
||||||
result = nil
|
result = nil
|
||||||
for it in n:
|
for it in n:
|
||||||
let b = it.lastSon
|
let b = it.lastSon
|
||||||
|
|
|
||||||
|
|
@ -599,7 +599,7 @@ proc track(tracked: PEffects, n: PNode) =
|
||||||
addAsgnFact(tracked.guards, n.sons[0], n.sons[1])
|
addAsgnFact(tracked.guards, n.sons[0], n.sons[1])
|
||||||
notNilCheck(tracked, n.sons[1], n.sons[0].typ)
|
notNilCheck(tracked, n.sons[1], n.sons[0].typ)
|
||||||
when false: cstringCheck(tracked, n)
|
when false: cstringCheck(tracked, n)
|
||||||
of nkVarSection:
|
of nkVarSection, nkLetSection:
|
||||||
for child in n:
|
for child in n:
|
||||||
let last = lastSon(child)
|
let last = lastSon(child)
|
||||||
if child.kind == nkIdentDefs and last.kind != nkEmpty:
|
if child.kind == nkIdentDefs and last.kind != nkEmpty:
|
||||||
|
|
|
||||||
14
tests/parallel/tlet_spawn.nim
Normal file
14
tests/parallel/tlet_spawn.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
import threadpool
|
||||||
|
|
||||||
|
proc foo(): int = 999
|
||||||
|
|
||||||
|
# test that the disjoint checker deals with 'a = spawn f(); g = spawn f()':
|
||||||
|
|
||||||
|
proc main =
|
||||||
|
parallel:
|
||||||
|
let f = spawn foo()
|
||||||
|
let b = spawn foo()
|
||||||
|
echo "done", f, " ", b
|
||||||
|
|
||||||
|
main()
|
||||||
7
todo.txt
7
todo.txt
|
|
@ -2,10 +2,12 @@ version 0.10
|
||||||
============
|
============
|
||||||
|
|
||||||
- Test nimfix on various babel packages
|
- Test nimfix on various babel packages
|
||||||
- Pegs do not work at compile-time
|
|
||||||
- deprecate recursive tuples; tuple needs laxer type checking
|
- deprecate recursive tuples; tuple needs laxer type checking
|
||||||
- string case should require an 'else'
|
- string case should require an 'else'
|
||||||
- # echo type.int
|
- # echo type.int
|
||||||
|
- VM: try does not work at all
|
||||||
|
- VM: Pegs do not work at compile-time
|
||||||
|
- VM: ptr/ref T cannot work in general
|
||||||
|
|
||||||
version 0.9.6
|
version 0.9.6
|
||||||
=============
|
=============
|
||||||
|
|
@ -22,7 +24,6 @@ Concurrency
|
||||||
generics *when the type is constructed*
|
generics *when the type is constructed*
|
||||||
- test 'deepCopy'
|
- test 'deepCopy'
|
||||||
|
|
||||||
- the disjoint checker needs to deal with 'a = spawn f(); g = spawn f()'
|
|
||||||
- implement 'foo[1..4] = spawn(f[4..7])'
|
- implement 'foo[1..4] = spawn(f[4..7])'
|
||||||
- document the new 'spawn' and 'parallel' statements
|
- document the new 'spawn' and 'parallel' statements
|
||||||
|
|
||||||
|
|
@ -30,7 +31,7 @@ Low priority:
|
||||||
- support for exception propagation? (hard to implement)
|
- support for exception propagation? (hard to implement)
|
||||||
- the copying of the 'ref Promise' into the thead local storage only
|
- the copying of the 'ref Promise' into the thead local storage only
|
||||||
happens to work due to the write barrier's implementation
|
happens to work due to the write barrier's implementation
|
||||||
- implement lock levels --> first without the more complex race avoidance
|
- implement lock levels
|
||||||
|
|
||||||
|
|
||||||
Misc
|
Misc
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue