--gc:destructors now means Nim uses pure refcounting (#12557)

This commit is contained in:
Andreas Rumpf
2019-10-30 16:15:17 +01:00
committed by GitHub
parent b5bb581642
commit 1746da2d9e
12 changed files with 123 additions and 35 deletions

View File

@@ -87,7 +87,7 @@ type
ntfEnumHole = 2 # enum has holes and thus `$` for them needs the slow
# version
TNimType {.compilerproc.} = object
when defined(gcDestructors):
when defined(gcHooks):
head*: pointer
size*: int
kind: TNimKind
@@ -103,7 +103,7 @@ type
instances: int # count the number of instances
sizes: int # sizes of all instances in bytes
when defined(gcDestructors):
when defined(gcHooks):
type
PNimType* = ptr TNimType
else:

View File

@@ -507,10 +507,10 @@ else:
elif defined(gcRegions):
# XXX due to bootstrapping reasons, we cannot use compileOption("gc", "stack") here
include "system/gc_regions"
elif defined(nimV2) or defined(gcDestructors):
elif defined(nimV2) or usesDestructors:
var allocator {.rtlThreadVar.}: MemRegion
instantiateForRegion(allocator)
when defined(gcDestructors):
when defined(gcHooks):
include "system/gc_hooks"
elif defined(gcMarkAndSweep):
# XXX use 'compileOption' here

View File

@@ -226,7 +226,7 @@ when not defined(useNimRtl):
cl: var ReprClosure) =
# we know that p is not nil here:
when declared(CellSet):
when defined(boehmGC) or defined(gogc) or defined(nogc) or defined(gcDestructors):
when defined(boehmGC) or defined(gogc) or defined(nogc) or usesDestructors:
var cell = cast[PCell](p)
else:
var cell = usrToCell(p)

View File

@@ -148,7 +148,7 @@ else:
proc threadProcWrapStackFrame[TArg](thrd: ptr Thread[TArg]) =
when defined(boehmgc):
boehmGC_call_with_stack_base(threadProcWrapDispatch[TArg], thrd)
elif not defined(nogc) and not defined(gogc) and not defined(gcRegions) and not defined(gcDestructors):
elif not defined(nogc) and not defined(gogc) and not defined(gcRegions) and not usesDestructors:
var p {.volatile.}: proc(a: ptr Thread[TArg]) {.nimcall, gcsafe.} =
threadProcWrapDispatch[TArg]
# init the GC for refc/markandsweep