support set other GCs after mm = orc or mm = arc is set in the global config (#19455)
* support set other GCs after arc/orc in global config fix #15535 * set before
This commit is contained in:
parent
4b723c0f53
commit
6319b00ef7
1 changed files with 34 additions and 20 deletions
|
|
@ -497,6 +497,32 @@ proc specialDefine(conf: ConfigRef, key: string; pass: TCmdLinePass) =
|
||||||
optOverflowCheck, optAssert, optStackTrace, optLineTrace, optLineDir}
|
optOverflowCheck, optAssert, optStackTrace, optLineTrace, optLineDir}
|
||||||
conf.globalOptions.excl {optCDebug}
|
conf.globalOptions.excl {optCDebug}
|
||||||
|
|
||||||
|
proc registerArcOrc(pass: TCmdLinePass, conf: ConfigRef, isOrc: bool) =
|
||||||
|
if isOrc:
|
||||||
|
conf.selectedGC = gcOrc
|
||||||
|
defineSymbol(conf.symbols, "gcorc")
|
||||||
|
else:
|
||||||
|
conf.selectedGC = gcArc
|
||||||
|
defineSymbol(conf.symbols, "gcarc")
|
||||||
|
|
||||||
|
defineSymbol(conf.symbols, "gcdestructors")
|
||||||
|
incl conf.globalOptions, optSeqDestructors
|
||||||
|
incl conf.globalOptions, optTinyRtti
|
||||||
|
if pass in {passCmd2, passPP}:
|
||||||
|
defineSymbol(conf.symbols, "nimSeqsV2")
|
||||||
|
defineSymbol(conf.symbols, "nimV2")
|
||||||
|
if conf.exc == excNone and conf.backend != backendCpp:
|
||||||
|
conf.exc = excGoto
|
||||||
|
|
||||||
|
proc unregisterArcOrc(conf: ConfigRef) =
|
||||||
|
undefSymbol(conf.symbols, "gcdestructors")
|
||||||
|
undefSymbol(conf.symbols, "gcarc")
|
||||||
|
undefSymbol(conf.symbols, "gcorc")
|
||||||
|
undefSymbol(conf.symbols, "nimSeqsV2")
|
||||||
|
undefSymbol(conf.symbols, "nimV2")
|
||||||
|
excl conf.globalOptions, optSeqDestructors
|
||||||
|
excl conf.globalOptions, optTinyRtti
|
||||||
|
|
||||||
proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
conf: ConfigRef) =
|
conf: ConfigRef) =
|
||||||
var
|
var
|
||||||
|
|
@ -602,36 +628,21 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
if pass in {passCmd2, passPP}:
|
if pass in {passCmd2, passPP}:
|
||||||
case arg.normalize
|
case arg.normalize
|
||||||
of "boehm":
|
of "boehm":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
conf.selectedGC = gcBoehm
|
conf.selectedGC = gcBoehm
|
||||||
defineSymbol(conf.symbols, "boehmgc")
|
defineSymbol(conf.symbols, "boehmgc")
|
||||||
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)
|
||||||
conf.selectedGC = gcRefc
|
conf.selectedGC = gcRefc
|
||||||
of "markandsweep":
|
of "markandsweep":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
conf.selectedGC = gcMarkAndSweep
|
conf.selectedGC = gcMarkAndSweep
|
||||||
defineSymbol(conf.symbols, "gcmarkandsweep")
|
defineSymbol(conf.symbols, "gcmarkandsweep")
|
||||||
of "destructors", "arc":
|
of "destructors", "arc":
|
||||||
conf.selectedGC = gcArc
|
registerArcOrc(pass, conf, false)
|
||||||
defineSymbol(conf.symbols, "gcdestructors")
|
|
||||||
defineSymbol(conf.symbols, "gcarc")
|
|
||||||
incl conf.globalOptions, optSeqDestructors
|
|
||||||
incl conf.globalOptions, optTinyRtti
|
|
||||||
if pass in {passCmd2, passPP}:
|
|
||||||
defineSymbol(conf.symbols, "nimSeqsV2")
|
|
||||||
defineSymbol(conf.symbols, "nimV2")
|
|
||||||
if conf.exc == excNone and conf.backend != backendCpp:
|
|
||||||
conf.exc = excGoto
|
|
||||||
of "orc":
|
of "orc":
|
||||||
conf.selectedGC = gcOrc
|
registerArcOrc(pass, conf, true)
|
||||||
defineSymbol(conf.symbols, "gcdestructors")
|
|
||||||
defineSymbol(conf.symbols, "gcorc")
|
|
||||||
incl conf.globalOptions, optSeqDestructors
|
|
||||||
incl conf.globalOptions, optTinyRtti
|
|
||||||
if pass in {passCmd2, passPP}:
|
|
||||||
defineSymbol(conf.symbols, "nimSeqsV2")
|
|
||||||
defineSymbol(conf.symbols, "nimV2")
|
|
||||||
if conf.exc == excNone and conf.backend != backendCpp:
|
|
||||||
conf.exc = excGoto
|
|
||||||
of "hooks":
|
of "hooks":
|
||||||
conf.selectedGC = gcHooks
|
conf.selectedGC = gcHooks
|
||||||
defineSymbol(conf.symbols, "gchooks")
|
defineSymbol(conf.symbols, "gchooks")
|
||||||
|
|
@ -640,12 +651,15 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||||
if pass in {passCmd2, passPP}:
|
if pass in {passCmd2, passPP}:
|
||||||
defineSymbol(conf.symbols, "nimSeqsV2")
|
defineSymbol(conf.symbols, "nimSeqsV2")
|
||||||
of "go":
|
of "go":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
conf.selectedGC = gcGo
|
conf.selectedGC = gcGo
|
||||||
defineSymbol(conf.symbols, "gogc")
|
defineSymbol(conf.symbols, "gogc")
|
||||||
of "none":
|
of "none":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
conf.selectedGC = gcNone
|
conf.selectedGC = gcNone
|
||||||
defineSymbol(conf.symbols, "nogc")
|
defineSymbol(conf.symbols, "nogc")
|
||||||
of "stack", "regions":
|
of "stack", "regions":
|
||||||
|
unregisterArcOrc(conf)
|
||||||
conf.selectedGC = gcRegions
|
conf.selectedGC = gcRegions
|
||||||
defineSymbol(conf.symbols, "gcregions")
|
defineSymbol(conf.symbols, "gcregions")
|
||||||
of "v2": warningOptionNoop(arg)
|
of "v2": warningOptionNoop(arg)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue