revert to old GC; use --gc:v2 to activate the new GC
This commit is contained in:
parent
2a2b630757
commit
65fdd641a9
6 changed files with 1067 additions and 1169 deletions
|
|
@ -427,6 +427,7 @@ proc resetMemory =
|
||||||
# XXX: detect config reloading (implement as error/require restart)
|
# XXX: detect config reloading (implement as error/require restart)
|
||||||
# XXX: options are appended (they will accumulate over time)
|
# XXX: options are appended (they will accumulate over time)
|
||||||
# vis = visimpl
|
# vis = visimpl
|
||||||
|
when compileOption("gc", "v2"):
|
||||||
gcDebugging = true
|
gcDebugging = true
|
||||||
echo "COLLECT 1"
|
echo "COLLECT 1"
|
||||||
GC_fullCollect()
|
GC_fullCollect()
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,11 @@ proc HandleCmdLine() =
|
||||||
changeFileExt(gProjectFull, exeExt).prependCurDir)
|
changeFileExt(gProjectFull, exeExt).prependCurDir)
|
||||||
execExternalProgram(ex & ' ' & service.arguments)
|
execExternalProgram(ex & ' ' & service.arguments)
|
||||||
|
|
||||||
#GC_disableMarkAndSweep()
|
|
||||||
|
|
||||||
when defined(GC_setMaxPause):
|
when defined(GC_setMaxPause):
|
||||||
GC_setMaxPause 2_000
|
GC_setMaxPause 2_000
|
||||||
|
|
||||||
|
when compileOption("gc", "v2"):
|
||||||
|
# the new correct mark&sweet collector is too slow :-/
|
||||||
GC_disableMarkAndSweep()
|
GC_disableMarkAndSweep()
|
||||||
condsyms.InitDefines()
|
condsyms.InitDefines()
|
||||||
HandleCmdLine()
|
HandleCmdLine()
|
||||||
|
|
|
||||||
1022
lib/system/gc.nim
Executable file → Normal file
1022
lib/system/gc.nim
Executable file → Normal file
File diff suppressed because it is too large
Load diff
1050
lib/system/oldgc.nim → lib/system/gc2.nim
Normal file → Executable file
1050
lib/system/oldgc.nim → lib/system/gc2.nim
Normal file → Executable file
File diff suppressed because it is too large
Load diff
|
|
@ -307,10 +307,10 @@ else:
|
||||||
include "system/cellsets"
|
include "system/cellsets"
|
||||||
when not leakDetector:
|
when not leakDetector:
|
||||||
sysAssert(sizeof(TCell) == sizeof(TFreeCell), "sizeof TFreeCell")
|
sysAssert(sizeof(TCell) == sizeof(TFreeCell), "sizeof TFreeCell")
|
||||||
when true:
|
when compileOption("gc", "v2"):
|
||||||
include "system/gc"
|
include "system/gc2"
|
||||||
else:
|
else:
|
||||||
include "system/oldgc"
|
include "system/gc"
|
||||||
|
|
||||||
{.pop.}
|
{.pop.}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,7 @@ proc setLengthSeq(seq: PGenericSeq, elemSize, newLen: int): PGenericSeq {.
|
||||||
elif newLen < result.len:
|
elif newLen < result.len:
|
||||||
# we need to decref here, otherwise the GC leaks!
|
# we need to decref here, otherwise the GC leaks!
|
||||||
when not defined(boehmGC) and not defined(nogc):
|
when not defined(boehmGC) and not defined(nogc):
|
||||||
|
when compileOption("gc", "v2"):
|
||||||
for i in newLen..result.len-1:
|
for i in newLen..result.len-1:
|
||||||
let len0 = gch.tempStack.len
|
let len0 = gch.tempStack.len
|
||||||
forAllChildrenAux(cast[pointer](cast[TAddress](result) +%
|
forAllChildrenAux(cast[pointer](cast[TAddress](result) +%
|
||||||
|
|
@ -212,6 +213,11 @@ proc setLengthSeq(seq: PGenericSeq, elemSize, newLen: int): PGenericSeq {.
|
||||||
for i in len0 .. <len1:
|
for i in len0 .. <len1:
|
||||||
doDecRef(gch.tempStack.d[i], LocalHeap, MaybeCyclic)
|
doDecRef(gch.tempStack.d[i], LocalHeap, MaybeCyclic)
|
||||||
gch.tempStack.len = len0
|
gch.tempStack.len = len0
|
||||||
|
else:
|
||||||
|
for i in newLen..result.len-1:
|
||||||
|
forAllChildrenAux(cast[pointer](cast[TAddress](result) +%
|
||||||
|
GenericSeqSize +% (i*%elemSize)),
|
||||||
|
extGetCellType(result).base, waZctDecRef)
|
||||||
|
|
||||||
# XXX: zeroing out the memory can still result in crashes if a wiped-out
|
# XXX: zeroing out the memory can still result in crashes if a wiped-out
|
||||||
# cell is aliased by another pointer (ie proc paramter or a let variable).
|
# cell is aliased by another pointer (ie proc paramter or a let variable).
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue