mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
tdisjoint_slice2 works
This commit is contained in:
@@ -86,7 +86,7 @@ proc openArrayLoc(p: BProc, n: PNode): PRope =
|
||||
initLocExpr(p, q[2], b)
|
||||
initLocExpr(p, q[3], c)
|
||||
let fmt =
|
||||
case skipTypes(a.t, abstractVar).kind
|
||||
case skipTypes(a.t, abstractVar+{tyPtr}).kind
|
||||
of tyOpenArray, tyVarargs, tyArray, tyArrayConstr:
|
||||
"($1)+($2), ($3)-($2)+1"
|
||||
of tyString, tySequence:
|
||||
|
||||
@@ -752,6 +752,14 @@ proc pleViaModelRec(m: var TModel; a, b: PNode): TImplication =
|
||||
if ple(m, a, x) == impYes:
|
||||
if ple(m, y, b) == impYes: 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 =
|
||||
# compute replacements:
|
||||
|
||||
@@ -338,7 +338,7 @@ proc setupArgsForParallelism(n: PNode; objType: PType; scratchObj: PSym;
|
||||
objType.addField(fieldB)
|
||||
|
||||
if getMagic(n) == mSlice:
|
||||
let a = genAddrOf(n[0])
|
||||
let a = genAddrOf(n[1])
|
||||
field.typ = a.typ
|
||||
objType.addField(field)
|
||||
result.add newFastAsgnStmt(newDotExpr(scratchObj, field), a)
|
||||
|
||||
@@ -166,7 +166,7 @@ proc overlap(m: TModel; x,y,c,d: PNode) =
|
||||
of impUnknown:
|
||||
localError(x.info,
|
||||
"cannot prove: $# > $#; required for ($#)..($#) disjoint from ($#)..($#)" %
|
||||
[?y, ?d, ?x, ?y, ?c, ?d])
|
||||
[?c, ?y, ?x, ?y, ?c, ?d])
|
||||
of impYes:
|
||||
localError(x.info, "($#)..($#) not disjoint from ($#)..($#)" % [?x, ?y, ?c, ?d])
|
||||
of impNo: discard
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
discard """
|
||||
output: '''0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8'''
|
||||
sortoutput: true
|
||||
"""
|
||||
|
||||
import threadpool
|
||||
|
||||
@@ -7,12 +19,12 @@ proc f(a: openArray[int]) =
|
||||
proc f(a: int) = echo a
|
||||
|
||||
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:
|
||||
spawn f(a[0..15])
|
||||
spawn f(a[0..2])
|
||||
#spawn f(a[16..30])
|
||||
var i = 16
|
||||
while i <= 29:
|
||||
var i = 3
|
||||
while i <= 8:
|
||||
spawn f(a[i])
|
||||
spawn f(a[i+1])
|
||||
inc i, 2
|
||||
|
||||
Reference in New Issue
Block a user