ORC and stdlib optimizations (#15362)

This commit is contained in:
Andreas Rumpf 2020-09-19 00:27:43 +02:00 • committed by GitHub
commit 9a34009f00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 45 additions and 29 deletions

View file

@ -68,7 +68,7 @@ const
when defined(nimArcDebug):
include cellsets
const traceId = 7739 # 1037
const traceId = 20 # 1037
var gRefId: int
var freedCells: CellSet
@ -90,6 +90,9 @@ proc nimNewObj(size: int): pointer {.compilerRtl.} =
when defined(nimArcDebug) or defined(nimArcIds):
head(result).refId = gRefId
atomicInc gRefId
if head(result).refId == traceId:
writeStackTrace()
cfprintf(cstderr, "[nimNewObj] %p %ld\n", result, head(result).rc shr rcShift)
when traceCollector:
cprintf("[Allocated] %p result: %p\n", result -! sizeof(RefHeader), result)
@ -112,6 +115,10 @@ proc nimNewObjUninit(size: int): pointer {.compilerRtl.} =
when defined(nimArcDebug):
head(result).refId = gRefId
atomicInc gRefId
if head(result).refId == traceId:
writeStackTrace()
cfprintf(cstderr, "[nimNewObjUninit] %p %ld\n", result, head(result).rc shr rcShift)
when traceCollector:
cprintf("[Allocated] %p result: %p\n", result -! sizeof(RefHeader), result)