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
commit fd9ab2ce6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -349,19 +349,36 @@ proc registerCycle(s: Cell; desc: PNimTypeV2) =
collectCycles() collectCycles()
#writeCell("[added root]", s) #writeCell("[added root]", s)
proc GC_fullCollect* = proc GC_runOrc* =
## Forces a full garbage collection pass. With ``--gc:orc`` triggers the cycle ## Forces a cycle collection pass.
## collector.
collectCycles() 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): when not defined(nimStressOrc):
rootsThreshold = defaultThreshold 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): when not defined(nimStressOrc):
rootsThreshold = high(int) 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.} = proc rememberCycle(isDestroyAction: bool; s: Cell; desc: PNimTypeV2) {.noinline.} =
if isDestroyAction: if isDestroyAction:
if (s.rc and isCycleCandidate) != 0: if (s.rc and isCycleCandidate) != 0: