threads compile again; attempt to fix serious code gen issue (except + return)
This commit is contained in:
parent
c8d270268a
commit
728328eec2
4 changed files with 25 additions and 17 deletions
|
|
@ -25,7 +25,7 @@ type
|
|||
ready: bool
|
||||
region: TMemRegion
|
||||
PRawChannel = ptr TRawChannel
|
||||
TLoadStoreMode = enum mStore, mLoad
|
||||
TLoadStoreMode = enum mStore, mLoad
|
||||
TChannel*[TMsg] = TRawChannel ## a channel for thread communication
|
||||
|
||||
const ChannelDeadMask = -2
|
||||
|
|
@ -45,7 +45,7 @@ proc deinitRawChannel(p: pointer) =
|
|||
deinitSys(c.lock)
|
||||
deinitSysCond(c.cond)
|
||||
|
||||
proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel,
|
||||
proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel,
|
||||
mode: TLoadStoreMode)
|
||||
proc storeAux(dest, src: Pointer, n: ptr TNimNode, t: PRawChannel,
|
||||
mode: TLoadStoreMode) =
|
||||
|
|
@ -62,14 +62,14 @@ proc storeAux(dest, src: Pointer, n: ptr TNimNode, t: PRawChannel,
|
|||
n.typ.size)
|
||||
var m = selectBranch(src, n)
|
||||
if m != nil: storeAux(dest, src, m, t, mode)
|
||||
of nkNone: sysAssert(false)
|
||||
of nkNone: sysAssert(false, "storeAux")
|
||||
|
||||
proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel,
|
||||
mode: TLoadStoreMode) =
|
||||
var
|
||||
d = cast[TAddress](dest)
|
||||
s = cast[TAddress](src)
|
||||
sysAssert(mt != nil)
|
||||
sysAssert(mt != nil, "mt == nil")
|
||||
case mt.Kind
|
||||
of tyString:
|
||||
if mode == mStore:
|
||||
|
|
@ -100,7 +100,7 @@ proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel,
|
|||
else:
|
||||
unsureAsgnRef(x, nil)
|
||||
else:
|
||||
sysAssert(dest != nil)
|
||||
sysAssert(dest != nil, "dest == nil")
|
||||
if mode == mStore:
|
||||
x[] = Alloc(t.region, seq.len *% mt.base.size +% GenericSeqSize)
|
||||
else:
|
||||
|
|
@ -140,8 +140,8 @@ proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel,
|
|||
if mode == mStore:
|
||||
x[] = Alloc(t.region, mt.base.size)
|
||||
else:
|
||||
# XXX we should use the dynamic type here too, but that is not stored
|
||||
# in the inbox at all --> use source[]'s object type? but how? we need
|
||||
# XXX we should use the dynamic type here too, but that is not stored
|
||||
# in the inbox at all --> use source[]'s object type? but how? we need
|
||||
# a tyRef to the object!
|
||||
var obj = newObj(mt.base, mt.base.size)
|
||||
unsureAsgnRef(x, obj)
|
||||
|
|
@ -237,8 +237,8 @@ proc close*[TMsg](c: var TChannel[TMsg]) =
|
|||
deinitRawChannel(addr(c))
|
||||
|
||||
proc ready*[TMsg](c: var TChannel[TMsg]): bool =
|
||||
## returns true iff some thread is waiting on the channel `c` for
|
||||
## returns true iff some thread is waiting on the channel `c` for
|
||||
## new messages.
|
||||
var q = cast[PRawChannel](addr(c))
|
||||
result = q.ready
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue