mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
clean up gc:arc or gc:orc in docs and in error messages (#22408)
* clean up gc:arc/orc in docs * in error messages
This commit is contained in:
@@ -2621,7 +2621,7 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
|
||||
of mDeepCopy:
|
||||
if p.config.selectedGC in {gcArc, gcAtomicArc, gcOrc} and optEnableDeepCopy notin p.config.globalOptions:
|
||||
localError(p.config, e.info,
|
||||
"for --gc:arc|orc 'deepcopy' support has to be enabled with --deepcopy:on")
|
||||
"for --mm:arc|atomicArc|orc 'deepcopy' support has to be enabled with --deepcopy:on")
|
||||
|
||||
var a, b: TLoc = default(TLoc)
|
||||
let x = if e[1].kind in {nkAddr, nkHiddenAddr}: e[1][0] else: e[1]
|
||||
|
||||
@@ -111,7 +111,7 @@ template addAllNode(assignParam: NimNode, procParam: NimNode) =
|
||||
|
||||
macro toTask*(e: typed{nkCall | nkInfix | nkPrefix | nkPostfix | nkCommand | nkCallStrLit}): Task =
|
||||
## Converts the call and its arguments to `Task`.
|
||||
runnableExamples("--gc:orc"):
|
||||
runnableExamples:
|
||||
proc hello(a: int) = echo a
|
||||
|
||||
let b = toTask hello(13)
|
||||
@@ -259,7 +259,7 @@ macro toTask*(e: typed{nkCall | nkInfix | nkPrefix | nkPostfix | nkCommand | nkC
|
||||
when defined(nimTasksDebug):
|
||||
echo result.repr
|
||||
|
||||
runnableExamples("--gc:orc"):
|
||||
runnableExamples:
|
||||
block:
|
||||
var num = 0
|
||||
proc hello(a: int) = inc num, a
|
||||
|
||||
@@ -2565,7 +2565,7 @@ when hasAlloc and notJSnotNims:
|
||||
## This is also used by the code generator
|
||||
## for the implementation of `spawn`.
|
||||
##
|
||||
## For `--gc:arc` or `--gc:orc` deepcopy support has to be enabled
|
||||
## For `--mm:arc` or `--mm:orc` deepcopy support has to be enabled
|
||||
## via `--deepcopy:on`.
|
||||
discard
|
||||
|
||||
@@ -2811,7 +2811,7 @@ when notJSnotNims and not defined(nimSeqsV2):
|
||||
## String literals (e.g. "abc", etc) in the ARC/ORC mode are "copy on write",
|
||||
## therefore you should call `prepareMutation` before modifying the strings
|
||||
## via `addr`.
|
||||
runnableExamples("--gc:arc"):
|
||||
runnableExamples:
|
||||
var x = "abc"
|
||||
var y = "defgh"
|
||||
prepareMutation(y) # without this, you may get a `SIGBUS` or `SIGSEGV`
|
||||
|
||||
@@ -223,15 +223,15 @@ proc GC_ref*[T](x: ref T) =
|
||||
|
||||
when not defined(gcOrc):
|
||||
template GC_fullCollect* =
|
||||
## Forces a full garbage collection pass. With `--gc:arc` a nop.
|
||||
## Forces a full garbage collection pass. With `--mm:arc` a nop.
|
||||
discard
|
||||
|
||||
template setupForeignThreadGc* =
|
||||
## With `--gc:arc` a nop.
|
||||
## With `--mm:arc` a nop.
|
||||
discard
|
||||
|
||||
template tearDownForeignThreadGc* =
|
||||
## With `--gc:arc` a nop.
|
||||
## With `--mm:arc` a nop.
|
||||
discard
|
||||
|
||||
proc isObjDisplayCheck(source: PNimTypeV2, targetDepth: int16, token: uint32): bool {.compilerRtl, inl.} =
|
||||
|
||||
@@ -424,13 +424,13 @@ proc GC_runOrc* =
|
||||
orcAssert roots.len == 0, "roots not empty!"
|
||||
|
||||
proc GC_enableOrc*() =
|
||||
## Enables the cycle collector subsystem of `--gc:orc`. This is a `--gc:orc`
|
||||
## Enables the cycle collector subsystem of `--mm:orc`. This is a `--mm:orc`
|
||||
## specific API. Check with `when defined(gcOrc)` for its existence.
|
||||
when not defined(nimStressOrc):
|
||||
rootsThreshold = 0
|
||||
|
||||
proc GC_disableOrc*() =
|
||||
## Disables the cycle collector subsystem of `--gc:orc`. This is a `--gc:orc`
|
||||
## Disables the cycle collector subsystem of `--mm:orc`. This is a `--mm:orc`
|
||||
## specific API. Check with `when defined(gcOrc)` for its existence.
|
||||
when not defined(nimStressOrc):
|
||||
rootsThreshold = high(int)
|
||||
@@ -441,16 +441,16 @@ proc GC_partialCollect*(limit: int) =
|
||||
partialCollect(limit)
|
||||
|
||||
proc GC_fullCollect* =
|
||||
## Forces a full garbage collection pass. With `--gc:orc` triggers the cycle
|
||||
## Forces a full garbage collection pass. With `--mm:orc` triggers the cycle
|
||||
## collector. This is an alias for `GC_runOrc`.
|
||||
collectCycles()
|
||||
|
||||
proc GC_enableMarkAndSweep*() =
|
||||
## For `--gc:orc` an alias for `GC_enableOrc`.
|
||||
## For `--mm:orc` an alias for `GC_enableOrc`.
|
||||
GC_enableOrc()
|
||||
|
||||
proc GC_disableMarkAndSweep*() =
|
||||
## For `--gc:orc` an alias for `GC_disableOrc`.
|
||||
## For `--mm:orc` an alias for `GC_disableOrc`.
|
||||
GC_disableOrc()
|
||||
|
||||
const
|
||||
|
||||
@@ -30,7 +30,7 @@ const doNotUnmap = not (defined(amd64) or defined(i386)) or
|
||||
|
||||
when defined(nimAllocPagesViaMalloc):
|
||||
when not defined(gcArc) and not defined(gcOrc) and not defined(gcAtomicArc):
|
||||
{.error: "-d:nimAllocPagesViaMalloc is only supported with --gc:arc or --gc:orc".}
|
||||
{.error: "-d:nimAllocPagesViaMalloc is only supported with --mm:arc or --mm:atomicArc or --mm:orc".}
|
||||
|
||||
proc osTryAllocPages(size: int): pointer {.inline.} =
|
||||
let base = c_malloc(csize_t size + PageSize - 1 + sizeof(uint32))
|
||||
|
||||
Reference in New Issue
Block a user