Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up gc:arc or gc:orc in docs and in error messages #22408

Merged
merged 2 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/ccgexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2617,7 +2617,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]
Expand Down
4 changes: 2 additions & 2 deletions lib/std/tasks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/system.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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`
Expand Down
6 changes: 3 additions & 3 deletions lib/system/arc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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.} =
Expand Down
10 changes: 5 additions & 5 deletions lib/system/orc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/system/osalloc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down