conditional TGenericSeq extension
This commit is contained in:
parent
8624654c57
commit
b487d4e425
3 changed files with 18 additions and 8 deletions
|
|
@ -67,12 +67,16 @@ type
|
||||||
pbyteArray = ptr array[0.. 0xffff, int8]
|
pbyteArray = ptr array[0.. 0xffff, int8]
|
||||||
|
|
||||||
TGenericSeq {.importc.} = object
|
TGenericSeq {.importc.} = object
|
||||||
len, space, elemSize: int
|
len, space: int
|
||||||
|
when defined(gogc):
|
||||||
|
elemSize: int
|
||||||
PGenSeq = ptr TGenericSeq
|
PGenSeq = ptr TGenericSeq
|
||||||
{.deprecated: [TAny: Any, TAnyKind: AnyKind].}
|
{.deprecated: [TAny: Any, TAnyKind: AnyKind].}
|
||||||
|
|
||||||
const
|
when defined(gogc):
|
||||||
GenericSeqSize = (3 * sizeof(int))
|
const GenericSeqSize = (3 * sizeof(int))
|
||||||
|
else:
|
||||||
|
const GenericSeqSize = (2 * sizeof(int))
|
||||||
|
|
||||||
proc genericAssign(dest, src: pointer, mt: PNimType) {.importCompilerProc.}
|
proc genericAssign(dest, src: pointer, mt: PNimType) {.importCompilerProc.}
|
||||||
proc genericShallowAssign(dest, src: pointer, mt: PNimType) {.
|
proc genericShallowAssign(dest, src: pointer, mt: PNimType) {.
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,9 @@ const ArrayDummySize = when defined(cpu16): 10_000 else: 100_000_000
|
||||||
when not defined(JS):
|
when not defined(JS):
|
||||||
type
|
type
|
||||||
TGenericSeq {.compilerproc, pure, inheritable.} = object
|
TGenericSeq {.compilerproc, pure, inheritable.} = object
|
||||||
len, reserved, elemSize: int
|
len, reserved: int
|
||||||
|
when defined(gogc):
|
||||||
|
elemSize: int
|
||||||
PGenericSeq {.exportc.} = ptr TGenericSeq
|
PGenericSeq {.exportc.} = ptr TGenericSeq
|
||||||
UncheckedCharArray {.unchecked.} = array[0..ArrayDummySize, char]
|
UncheckedCharArray {.unchecked.} = array[0..ArrayDummySize, char]
|
||||||
# len and space without counting the terminating zero:
|
# len and space without counting the terminating zero:
|
||||||
|
|
@ -2682,8 +2684,10 @@ when not defined(JS): #and not defined(NimrodVM):
|
||||||
when not defined(NimrodVM):
|
when not defined(NimrodVM):
|
||||||
include "system/sets"
|
include "system/sets"
|
||||||
|
|
||||||
const
|
when defined(gogc):
|
||||||
GenericSeqSize = (3 * sizeof(int))
|
const GenericSeqSize = (3 * sizeof(int))
|
||||||
|
else:
|
||||||
|
const GenericSeqSize = (2 * sizeof(int))
|
||||||
|
|
||||||
proc getDiscriminant(aa: pointer, n: ptr TNimNode): int =
|
proc getDiscriminant(aa: pointer, n: ptr TNimNode): int =
|
||||||
sysAssert(n.kind == nkCase, "getDiscriminant: node != nkCase")
|
sysAssert(n.kind == nkCase, "getDiscriminant: node != nkCase")
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ proc rawNewStringNoInit(space: int): NimString {.compilerProc.} =
|
||||||
if s < 7: s = 7
|
if s < 7: s = 7
|
||||||
result = allocStrNoInit(sizeof(TGenericSeq) + s + 1)
|
result = allocStrNoInit(sizeof(TGenericSeq) + s + 1)
|
||||||
result.reserved = s
|
result.reserved = s
|
||||||
|
when defined(gogc):
|
||||||
result.elemSize = 1
|
result.elemSize = 1
|
||||||
|
|
||||||
proc rawNewString(space: int): NimString {.compilerProc.} =
|
proc rawNewString(space: int): NimString {.compilerProc.} =
|
||||||
|
|
@ -57,6 +58,7 @@ proc rawNewString(space: int): NimString {.compilerProc.} =
|
||||||
if s < 7: s = 7
|
if s < 7: s = 7
|
||||||
result = allocStr(sizeof(TGenericSeq) + s + 1)
|
result = allocStr(sizeof(TGenericSeq) + s + 1)
|
||||||
result.reserved = s
|
result.reserved = s
|
||||||
|
when defined(gogc):
|
||||||
result.elemSize = 1
|
result.elemSize = 1
|
||||||
|
|
||||||
proc mnewString(len: int): NimString {.compilerProc.} =
|
proc mnewString(len: int): NimString {.compilerProc.} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue