ORC: API extensions for 1.4 (#15581)

This commit is contained in:
Andreas Rumpf
2020-10-15 11:51:40 +02:00
committed by GitHub
parent 1bbc20010e
commit fd9ab2ce6d

View File

@@ -349,19 +349,36 @@ proc registerCycle(s: Cell; desc: PNimTypeV2) =
collectCycles()
#writeCell("[added root]", s)
proc GC_fullCollect* =
## Forces a full garbage collection pass. With ``--gc:orc`` triggers the cycle
## collector.
proc GC_runOrc* =
## Forces a cycle collection pass.
collectCycles()
proc GC_enableMarkAndSweep*() =
proc GC_enableOrc*() =
## Enables the cycle collector subsystem of ``--gc:orc``. This is a ``--gc:orc``
## specific API. Check with ``when defined(gcOrc)`` for its existence.
when not defined(nimStressOrc):
rootsThreshold = defaultThreshold
proc GC_disableMarkAndSweep*() =
proc GC_disableOrc*() =
## Disables the cycle collector subsystem of ``--gc:orc``. This is a ``--gc:orc``
## specific API. Check with ``when defined(gcOrc)`` for its existence.
when not defined(nimStressOrc):
rootsThreshold = high(int)
proc GC_fullCollect* =
## Forces a full garbage collection pass. With ``--gc:orc`` triggers the cycle
## collector. This is an alias for ``GC_runOrc``.
collectCycles()
proc GC_enableMarkAndSweep*() =
## For ``--gc:orc`` an alias for ``GC_enableOrc``.
GC_enableOrc()
proc GC_disableMarkAndSweep*() =
## For ``--gc:orc`` an alias for ``GC_disableOrc``.
GC_disableOrc()
proc rememberCycle(isDestroyAction: bool; s: Cell; desc: PNimTypeV2) {.noinline.} =
if isDestroyAction:
if (s.rc and isCycleCandidate) != 0: