first implementation of the new --seqsv2 switch
This commit is contained in:
parent
ed2fb36bc6
commit
0eae2217b6
7 changed files with 22 additions and 15 deletions
|
|
@ -439,7 +439,7 @@ proc getStackTrace(e: ref Exception): string =
|
|||
proc getStackTraceEntries*(e: ref Exception): seq[StackTraceEntry] =
|
||||
## Returns the attached stack trace to the exception ``e`` as
|
||||
## a ``seq``. This is not yet available for the JS backend.
|
||||
when not defined(gcDestructors):
|
||||
when not defined(nimSeqsV2):
|
||||
shallowCopy(result, e.trace)
|
||||
else:
|
||||
result = move(e.trace)
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ proc forAllChildren(cell: PCell, op: WalkOp) =
|
|||
of tyRef: # common case
|
||||
forAllChildrenAux(cellToUsr(cell), cell.typ.base, op)
|
||||
of tySequence:
|
||||
when not defined(gcDestructors):
|
||||
when not defined(nimSeqsV2):
|
||||
var d = cast[ByteAddress](cellToUsr(cell))
|
||||
var s = cast[PGenericSeq](d)
|
||||
if s != nil:
|
||||
|
|
@ -304,7 +304,7 @@ proc newObjRC1(typ: PNimType, size: int): pointer {.compilerRtl.} =
|
|||
zeroMem(result, size)
|
||||
when defined(memProfiler): nimProfile(size)
|
||||
|
||||
when not defined(gcDestructors):
|
||||
when not defined(nimSeqsV2):
|
||||
proc newSeq(typ: PNimType, len: int): pointer {.compilerRtl.} =
|
||||
# `newObj` already uses locks, so no need for them here.
|
||||
let size = addInt(mulInt(len, typ.base.size), GenericSeqSize)
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ else:
|
|||
else:
|
||||
include "system/gc"
|
||||
|
||||
when not declared(nimNewSeqOfCap) and not defined(gcDestructors):
|
||||
when not declared(nimNewSeqOfCap) and not defined(nimSeqsV2):
|
||||
proc nimNewSeqOfCap(typ: PNimType, cap: int): pointer {.compilerproc.} =
|
||||
when defined(gcRegions):
|
||||
let s = mulInt(cap, typ.base.size) # newStr already adds GenericSeqSize
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ when not defined(useNimRtl):
|
|||
reprAux(result, cast[pointer](cast[ByteAddress](p) + i*bs), typ.base, cl)
|
||||
add result, "]"
|
||||
|
||||
when defined(gcDestructors):
|
||||
when defined(nimSeqsV2):
|
||||
type
|
||||
GenericSeq = object
|
||||
len: int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue