hotfix for --gc:regions
This commit is contained in:
parent
7e8eadb6ba
commit
3221ac0943
2 changed files with 12 additions and 6 deletions
|
|
@ -561,13 +561,16 @@ else:
|
|||
|
||||
when not declared(nimNewSeqOfCap):
|
||||
proc nimNewSeqOfCap(typ: PNimType, cap: int): pointer {.compilerproc.} =
|
||||
let s = addInt(mulInt(cap, typ.base.size), GenericSeqSize)
|
||||
when declared(newObjNoInit):
|
||||
result = if ntfNoRefs in typ.base.flags: newObjNoInit(typ, s) else: newObj(typ, s)
|
||||
when defined(gcRegions):
|
||||
result = newStr(typ, cap, ntfNoRefs notin typ.base.flags)
|
||||
else:
|
||||
result = newObj(typ, s)
|
||||
cast[PGenericSeq](result).len = 0
|
||||
cast[PGenericSeq](result).reserved = cap
|
||||
let s = addInt(mulInt(cap, typ.base.size), GenericSeqSize)
|
||||
when declared(newObjNoInit):
|
||||
result = if ntfNoRefs in typ.base.flags: newObjNoInit(typ, s) else: newObj(typ, s)
|
||||
else:
|
||||
result = newObj(typ, s)
|
||||
cast[PGenericSeq](result).len = 0
|
||||
cast[PGenericSeq](result).reserved = cap
|
||||
|
||||
{.pop.}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue