tdisjoint_slice2 works

This commit is contained in:
Araq 2014-05-31 01:16:16 +02:00
commit 9953e0bbca
5 changed files with 27 additions and 7 deletions

View file

@ -86,7 +86,7 @@ proc openArrayLoc(p: BProc, n: PNode): PRope =
initLocExpr(p, q[2], b) initLocExpr(p, q[2], b)
initLocExpr(p, q[3], c) initLocExpr(p, q[3], c)
let fmt = let fmt =
case skipTypes(a.t, abstractVar).kind case skipTypes(a.t, abstractVar+{tyPtr}).kind
of tyOpenArray, tyVarargs, tyArray, tyArrayConstr: of tyOpenArray, tyVarargs, tyArray, tyArrayConstr:
"($1)+($2), ($3)-($2)+1" "($1)+($2), ($3)-($2)+1"
of tyString, tySequence: of tyString, tySequence:

View file

@ -752,6 +752,14 @@ proc pleViaModelRec(m: var TModel; a, b: PNode): TImplication =
if ple(m, a, x) == impYes: if ple(m, a, x) == impYes:
if ple(m, y, b) == impYes: return impYes if ple(m, y, b) == impYes: return impYes
#if pleViaModelRec(m, y, b): return impYes #if pleViaModelRec(m, y, b): return impYes
# fact: 16 <= i
# x y
# question: i <= 15? no!
result = impliesLe(fact, a, b)
if result != impUnknown: return result
if sameTree(y, a):
result = ple(m, x, b)
if result != impUnknown: return result
proc pleViaModel(model: TModel; aa, bb: PNode): TImplication = proc pleViaModel(model: TModel; aa, bb: PNode): TImplication =
# compute replacements: # compute replacements:

View file

@ -338,7 +338,7 @@ proc setupArgsForParallelism(n: PNode; objType: PType; scratchObj: PSym;
objType.addField(fieldB) objType.addField(fieldB)
if getMagic(n) == mSlice: if getMagic(n) == mSlice:
let a = genAddrOf(n[0]) let a = genAddrOf(n[1])
field.typ = a.typ field.typ = a.typ
objType.addField(field) objType.addField(field)
result.add newFastAsgnStmt(newDotExpr(scratchObj, field), a) result.add newFastAsgnStmt(newDotExpr(scratchObj, field), a)

View file

@ -166,7 +166,7 @@ proc overlap(m: TModel; x,y,c,d: PNode) =
of impUnknown: of impUnknown:
localError(x.info, localError(x.info,
"cannot prove: $# > $#; required for ($#)..($#) disjoint from ($#)..($#)" % "cannot prove: $# > $#; required for ($#)..($#) disjoint from ($#)..($#)" %
[?y, ?d, ?x, ?y, ?c, ?d]) [?c, ?y, ?x, ?y, ?c, ?d])
of impYes: of impYes:
localError(x.info, "($#)..($#) not disjoint from ($#)..($#)" % [?x, ?y, ?c, ?d]) localError(x.info, "($#)..($#) not disjoint from ($#)..($#)" % [?x, ?y, ?c, ?d])
of impNo: discard of impNo: discard

View file

@ -1,3 +1,15 @@
discard """
output: '''0
1
2
3
4
5
6
7
8'''
sortoutput: true
"""
import threadpool import threadpool
@ -7,12 +19,12 @@ proc f(a: openArray[int]) =
proc f(a: int) = echo a proc f(a: int) = echo a
proc main() = proc main() =
var a: array[0..30, int] var a: array[0..9, int] = [0,1,2,3,4,5,6,7,8,9]
parallel: parallel:
spawn f(a[0..15]) spawn f(a[0..2])
#spawn f(a[16..30]) #spawn f(a[16..30])
var i = 16 var i = 3
while i <= 29: while i <= 8:
spawn f(a[i]) spawn f(a[i])
spawn f(a[i+1]) spawn f(a[i+1])
inc i, 2 inc i, 2