refactoring: orc can use getThreadId() (#19123)

* refactoring: orc can use getThreadId()

* progress
This commit is contained in:
Andreas Rumpf 2021-11-11 19:07:08 +01:00 • committed by GitHub
commit cde83d90aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 110 additions and 96 deletions

View file

@ -79,10 +79,12 @@ proc trace(s: Cell; desc: PNimTypeV2; j: var GcEnv) {.inline.} =
var p = s +! sizeof(RefHeader)
cast[TraceProc](desc.traceImpl)(p, addr(j))
include threadids
when logOrc:
proc writeCell(msg: cstring; s: Cell; desc: PNimTypeV2) =
cfprintf(cstderr, "%s %s %ld root index: %ld; RC: %ld; color: %ld\n",
msg, desc.name, s.refId, s.rootIdx, s.rc shr rcShift, s.color)
cfprintf(cstderr, "%s %s %ld root index: %ld; RC: %ld; color: %ld; thread: %ld\n",
msg, desc.name, s.refId, s.rootIdx, s.rc shr rcShift, s.color, getThreadId())
proc free(s: Cell; desc: PNimTypeV2) {.inline.} =
when traceCollector:
@ -419,6 +421,7 @@ proc registerCycle(s: Cell; desc: PNimTypeV2) =
proc GC_runOrc* =
## Forces a cycle collection pass.
collectCycles()
orcAssert roots.len == 0, "roots not empty!"
proc GC_enableOrc*() =
## Enables the cycle collector subsystem of `--gc:orc`. This is a `--gc:orc`