defines the gcRefc symbol which allows writing specific code for refc (#20009)
* define gcRefc symbols * add comments * add a changelog item * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * Update changelog.md Co-authored-by: Yardanico <tiberiumk12@gmail.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: Yardanico <tiberiumk12@gmail.com>
This commit is contained in:
parent
0d8bec6956
commit
01ad0cdc52
3 changed files with 9 additions and 1 deletions
|
|
@ -110,6 +110,8 @@ becomes an alias for `addr`.
|
||||||
In the command line, this is defined as `-d:a.b.c`. Older versions can
|
In the command line, this is defined as `-d:a.b.c`. Older versions can
|
||||||
use accents as in ``defined(`a.b.c`)`` to access such defines.
|
use accents as in ``defined(`a.b.c`)`` to access such defines.
|
||||||
|
|
||||||
|
- Defines the `gcRefc` symbol which allows writing specific code for the refc GC.
|
||||||
|
|
||||||
## Compiler changes
|
## Compiler changes
|
||||||
|
|
||||||
- `nim` can now compile version 1.4.0 as follows: `nim c --lib:lib --stylecheck:off compiler/nim`,
|
- `nim` can now compile version 1.4.0 as follows: `nim c --lib:lib --stylecheck:off compiler/nim`,
|
||||||
|
|
|
||||||
|
|
@ -542,6 +542,7 @@ proc processMemoryManagementOption(switch, arg: string, pass: TCmdLinePass,
|
||||||
incl conf.globalOptions, optTlsEmulation # Boehm GC doesn't scan the real TLS
|
incl conf.globalOptions, optTlsEmulation # Boehm GC doesn't scan the real TLS
|
||||||
of "refc":
|
of "refc":
|
||||||
unregisterArcOrc(conf)
|
unregisterArcOrc(conf)
|
||||||
|
defineSymbol(conf.symbols, "gcrefc")
|
||||||
conf.selectedGC = gcRefc
|
conf.selectedGC = gcRefc
|
||||||
of "markandsweep":
|
of "markandsweep":
|
||||||
unregisterArcOrc(conf)
|
unregisterArcOrc(conf)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
|
discard """
|
||||||
|
matrix: "--gc:refc; --gc:orc"
|
||||||
|
"""
|
||||||
|
|
||||||
import "$lib/.." / compiler/strutils2
|
import "$lib/.." / compiler/strutils2
|
||||||
|
|
||||||
block: # setLen
|
block: # setLen
|
||||||
var a = "abc"
|
var a = "abc"
|
||||||
a.setLen 0
|
a.setLen 0
|
||||||
a.setLen 3, isInit = false
|
a.setLen 3, isInit = false
|
||||||
doAssert a[1] == 'b'
|
when defined(gcRefc): # bug #19763
|
||||||
|
doAssert a[1] == 'b'
|
||||||
a.setLen 0
|
a.setLen 0
|
||||||
a.setLen 3, isInit = true
|
a.setLen 3, isInit = true
|
||||||
doAssert a[1] == '\0'
|
doAssert a[1] == '\0'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue