actors compile again

This commit is contained in:
Araq 2014-04-20 12:10:23 +02:00
commit c80d563afb
9 changed files with 68 additions and 30 deletions

View file

@ -162,6 +162,7 @@ proc wrapProcForSpawn*(owner: PSym; n: PNode): PNode =
argsParam.typ = ptrType
argsParam.position = 1
var objType = createObj(owner, n.info)
incl(objType.flags, tfFinal)
let castExpr = createCastExpr(argsParam, objType)
var scratchObj = newSym(skVar, getIdent"scratch", owner, n.info)

View file

@ -71,7 +71,7 @@ type
init: seq[int] # list of initialized variables
guards: TModel # nested guards
locked: seq[PNode] # locked locations
gcUnsafe: bool
gcUnsafe, isRecursive: bool
PEffects = var TEffects
proc isLocalVar(a: PEffects, s: PSym): bool =
@ -502,7 +502,9 @@ proc track(tracked: PEffects, n: PNode) =
# are indistinguishable from normal procs (both have tyProc type) and
# we can detect them only by checking for attached nkEffectList.
if op != nil and op.kind == tyProc and op.n.sons[0].kind == nkEffectList:
if notGcSafe(op) and not importedFromC(a):
if a.kind == nkSym and a.sym == tracked.owner:
tracked.isRecursive = true
elif notGcSafe(op) and not importedFromC(a):
message(n.info, warnGcUnsafe, renderTree(n))
tracked.gcUnsafe = true
var effectList = op.n.sons[0]

View file

@ -148,6 +148,9 @@ proc sumGeneric(t: PType): int =
result = ord(t.kind == tyGenericInvokation)
for i in 0 .. <t.len: result += t.sons[i].sumGeneric
break
of tyProc:
# proc matche proc better than 'stmt' to disambiguate 'spawn'
return 1
of tyGenericParam, tyExpr, tyStatic, tyStmt, tyTypeDesc: break
else: return 0

View file

@ -342,9 +342,10 @@ proc canFormAcycleAux(marker: var TIntSet, typ: PType, startId: int): bool =
result = t.id == startId
# Inheritance can introduce cyclic types, however this is not relevant
# as the type that is passed to 'new' is statically known!
#if t.kind == tyObject and tfFinal notin t.flags:
# # damn inheritance may introduce cycles:
# result = true
# er but we use it also for the write barrier ...
if t.kind == tyObject and tfFinal notin t.flags:
# damn inheritance may introduce cycles:
result = true
of tyProc: result = typ.callConv == ccClosure
else: discard