preparations for a generational GC
This commit is contained in:
parent
1c0c80ef2d
commit
5d119f61d1
6 changed files with 13 additions and 6 deletions
|
|
@ -16,7 +16,8 @@ const
|
||||||
# above X strings a hash-switch for strings is generated
|
# above X strings a hash-switch for strings is generated
|
||||||
|
|
||||||
proc registerGcRoot(p: BProc, v: PSym) =
|
proc registerGcRoot(p: BProc, v: PSym) =
|
||||||
if gSelectedGc == gcMarkAndSweep and containsGarbageCollectedRef(v.loc.t):
|
if gSelectedGc in {gcMarkAndSweep, gcGenerational} and
|
||||||
|
containsGarbageCollectedRef(v.loc.t):
|
||||||
# we register a specialized marked proc here; this has the advantage
|
# we register a specialized marked proc here; this has the advantage
|
||||||
# that it works out of the box for thread local storage then :-)
|
# that it works out of the box for thread local storage then :-)
|
||||||
let prc = genTraverseProcForGlobal(p.module, v)
|
let prc = genTraverseProcForGlobal(p.module, v)
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,7 @@ proc testCompileOptionArg*(switch, arg: string, info: TLineInfo): bool =
|
||||||
of "refc": result = gSelectedGC == gcRefc
|
of "refc": result = gSelectedGC == gcRefc
|
||||||
of "v2": result = gSelectedGC == gcV2
|
of "v2": result = gSelectedGC == gcV2
|
||||||
of "markandsweep": result = gSelectedGC == gcMarkAndSweep
|
of "markandsweep": result = gSelectedGC == gcMarkAndSweep
|
||||||
|
of "generational": result = gSelectedGC == gcGenerational
|
||||||
of "none": result = gSelectedGC == gcNone
|
of "none": result = gSelectedGC == gcNone
|
||||||
else: LocalError(info, errNoneBoehmRefcExpectedButXFound, arg)
|
else: LocalError(info, errNoneBoehmRefcExpectedButXFound, arg)
|
||||||
of "opt":
|
of "opt":
|
||||||
|
|
@ -280,6 +281,9 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) =
|
||||||
of "markandsweep":
|
of "markandsweep":
|
||||||
gSelectedGC = gcMarkAndSweep
|
gSelectedGC = gcMarkAndSweep
|
||||||
defineSymbol("gcmarkandsweep")
|
defineSymbol("gcmarkandsweep")
|
||||||
|
of "generational":
|
||||||
|
gSelectedGC = gcGenerational
|
||||||
|
defineSymbol("gcgenerational")
|
||||||
of "none":
|
of "none":
|
||||||
gSelectedGC = gcNone
|
gSelectedGC = gcNone
|
||||||
defineSymbol("nogc")
|
defineSymbol("nogc")
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ type # please make sure we have under 32 options
|
||||||
cmdRun # run the project via TCC backend
|
cmdRun # run the project via TCC backend
|
||||||
TStringSeq* = seq[string]
|
TStringSeq* = seq[string]
|
||||||
TGCMode* = enum # the selected GC
|
TGCMode* = enum # the selected GC
|
||||||
gcNone, gcBoehm, gcMarkAndSweep, gcRefc, gcV2
|
gcNone, gcBoehm, gcMarkAndSweep, gcRefc, gcV2, gcGenerational
|
||||||
|
|
||||||
const
|
const
|
||||||
ChecksOptions* = {optObjCheck, optFieldCheck, optRangeCheck, optNilCheck,
|
ChecksOptions* = {optObjCheck, optFieldCheck, optRangeCheck, optNilCheck,
|
||||||
|
|
@ -101,7 +101,7 @@ var
|
||||||
headerFile*: string = ""
|
headerFile*: string = ""
|
||||||
gVerbosity*: int # how verbose the compiler is
|
gVerbosity*: int # how verbose the compiler is
|
||||||
gNumberOfProcessors*: int # number of processors
|
gNumberOfProcessors*: int # number of processors
|
||||||
gWholeProject*: bool # for 'doc2': output any dependency
|
gWholeProject*: bool # for 'doc2': output any dependency
|
||||||
gEvalExpr* = "" # expression for idetools --eval
|
gEvalExpr* = "" # expression for idetools --eval
|
||||||
gLastCmdTime*: float # when caas is enabled, we measure each command
|
gLastCmdTime*: float # when caas is enabled, we measure each command
|
||||||
gListFullPaths*: bool
|
gListFullPaths*: bool
|
||||||
|
|
|
||||||
|
|
@ -754,7 +754,7 @@ proc replaceWord*(s, sub: string, by = ""): string {.noSideEffect,
|
||||||
else:
|
else:
|
||||||
add result, substr(s, i, j)
|
add result, substr(s, i, j)
|
||||||
i = j + 1
|
i = j + 1
|
||||||
# copy the rest:
|
# copy the rest:
|
||||||
add result, substr(s, i)
|
add result, substr(s, i)
|
||||||
|
|
||||||
proc delete*(s: var string, first, last: int) {.noSideEffect,
|
proc delete*(s: var string, first, last: int) {.noSideEffect,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Nimrod's Runtime Library
|
# Nimrod's Runtime Library
|
||||||
# (c) Copyright 2012 Andreas Rumpf
|
# (c) Copyright 2013 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -312,6 +312,8 @@ else:
|
||||||
elif defined(gcMarkAndSweep):
|
elif defined(gcMarkAndSweep):
|
||||||
# XXX use 'compileOption' here
|
# XXX use 'compileOption' here
|
||||||
include "system/gc_ms"
|
include "system/gc_ms"
|
||||||
|
elif defined(gcGenerational):
|
||||||
|
include "system/gc_genms"
|
||||||
else:
|
else:
|
||||||
include "system/gc"
|
include "system/gc"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
line: 22
|
line: 22
|
||||||
errormgs: "type mismatch"
|
errormsg: "type mismatch"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue