ORC: critical bugfix for the cycle analyser, introduce -d:nimStressOrc for easier stress testing (#15572)

This commit is contained in:
Andreas Rumpf 2020-10-14 22:26:21 +02:00 • committed by GitHub
commit 644eb4dd54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 20 deletions

View file

@ -161,6 +161,12 @@ proc nimRawDispose(p: pointer) {.compilerRtl.} =
if head(p).rc >= rcIncrement:
cstderr.rawWrite "[FATAL] dangling references exist\n"
quit 1
when defined(gcOrc) and defined(nimArcDebug):
if (head(p).rc and 0b100) != 0:
cstderr.rawWrite "[FATAL] cycle root freed\n"
quit 1
when defined(nimArcDebug):
# we do NOT really free the memory here in order to reliably detect use-after-frees
if freedCells.data == nil: init(freedCells)