newruntime: only check for dangling refs when 'owned ref T' support is enabled
This commit is contained in:
parent
4c9a7e6f00
commit
3f4b9971fc
1 changed files with 8 additions and 7 deletions
|
|
@ -71,13 +71,14 @@ proc nimIncRef(p: pointer) {.compilerRtl, inl.} =
|
||||||
|
|
||||||
proc nimRawDispose(p: pointer) {.compilerRtl.} =
|
proc nimRawDispose(p: pointer) {.compilerRtl.} =
|
||||||
when not defined(nimscript):
|
when not defined(nimscript):
|
||||||
when hasThreadSupport:
|
when defined(nimOwnedEnabled):
|
||||||
let hasDanglingRefs = atomicLoadN(addr head(p).rc, ATOMIC_RELAXED) != 0
|
when hasThreadSupport:
|
||||||
else:
|
let hasDanglingRefs = atomicLoadN(addr head(p).rc, ATOMIC_RELAXED) != 0
|
||||||
let hasDanglingRefs = head(p).rc != 0
|
else:
|
||||||
if hasDanglingRefs:
|
let hasDanglingRefs = head(p).rc != 0
|
||||||
cstderr.rawWrite "[FATAL] dangling references exist\n"
|
if hasDanglingRefs:
|
||||||
quit 1
|
cstderr.rawWrite "[FATAL] dangling references exist\n"
|
||||||
|
quit 1
|
||||||
when defined(useMalloc):
|
when defined(useMalloc):
|
||||||
c_free(p -! sizeof(RefHeader))
|
c_free(p -! sizeof(RefHeader))
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue