system.nim: don't use deprecated symbols/constructs
This commit is contained in:
parent
794d36cf31
commit
346ea6d171
8 changed files with 33 additions and 32 deletions
|
|
@ -748,7 +748,7 @@ proc getOccupiedMem(a: MemRegion): int {.inline.} =
|
|||
|
||||
# ---------------------- thread memory region -------------------------------
|
||||
|
||||
template instantiateForRegion(allocator: expr) =
|
||||
template instantiateForRegion(allocator: untyped) =
|
||||
when defined(fulldebug):
|
||||
proc interiorAllocatedPtr*(p: pointer): pointer =
|
||||
result = interiorAllocatedPtr(allocator, p)
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ when defined(endb):
|
|||
|
||||
when not defined(noSignalHandler):
|
||||
proc signalHandler(sign: cint) {.exportc: "signalHandler", noconv.} =
|
||||
template processSignal(s, action: expr) {.immediate, dirty.} =
|
||||
template processSignal(s, action: untyped) {.dirty.} =
|
||||
if s == SIGINT: action("SIGINT: Interrupted by Ctrl-C.\n")
|
||||
elif s == SIGSEGV:
|
||||
action("SIGSEGV: Illegal storage access. (Attempt to read from nil?)\n")
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ proc internRefcount(p: pointer): int {.exportc: "getRefcount".} =
|
|||
when BitsPerPage mod (sizeof(int)*8) != 0:
|
||||
{.error: "(BitsPerPage mod BitsPerUnit) should be zero!".}
|
||||
|
||||
template color(c): expr = c.refCount and colorMask
|
||||
template color(c): untyped = c.refCount and colorMask
|
||||
template setColor(c, col) =
|
||||
when col == rcBlack:
|
||||
c.refcount = c.refcount and not colorMask
|
||||
|
|
@ -167,7 +167,7 @@ proc writeCell(msg: cstring, c: PCell) =
|
|||
c_fprintf(stdout, "[GC] %s: %p %d %s rc=%ld; color=%ld\n",
|
||||
msg, c, kind, typName, c.refcount shr rcShift, c.color)
|
||||
|
||||
template gcTrace(cell, state: expr): stmt {.immediate.} =
|
||||
template gcTrace(cell, state: untyped) =
|
||||
when traceGC: traceCell(cell, state)
|
||||
|
||||
# forward declarations:
|
||||
|
|
@ -179,13 +179,13 @@ proc forAllChildrenAux(dest: pointer, mt: PNimType, op: WalkOp) {.benign.}
|
|||
# we need the prototype here for debugging purposes
|
||||
|
||||
when hasThreadSupport and hasSharedHeap:
|
||||
template `--`(x: expr): expr = atomicDec(x, rcIncrement) <% rcIncrement
|
||||
template `++`(x: expr): stmt = discard atomicInc(x, rcIncrement)
|
||||
template `--`(x: untyped): untyped = atomicDec(x, rcIncrement) <% rcIncrement
|
||||
template `++`(x: untyped) = discard atomicInc(x, rcIncrement)
|
||||
else:
|
||||
template `--`(x: expr): expr =
|
||||
template `--`(x: untyped): untyped =
|
||||
dec(x, rcIncrement)
|
||||
x <% rcIncrement
|
||||
template `++`(x: expr): stmt = inc(x, rcIncrement)
|
||||
template `++`(x: untyped) = inc(x, rcIncrement)
|
||||
|
||||
proc incRef(c: PCell) {.inline.} =
|
||||
gcAssert(isAllocatedPtr(gch.region, c), "incRef: interiorPtr")
|
||||
|
|
@ -419,7 +419,7 @@ proc addNewObjToZCT(res: PCell, gch: var GcHeap) {.inline.} =
|
|||
var d = gch.zct.d
|
||||
when true:
|
||||
# loop unrolled for performance:
|
||||
template replaceZctEntry(i: expr) =
|
||||
template replaceZctEntry(i: untyped) =
|
||||
c = d[i]
|
||||
if c.refcount >=% rcIncrement:
|
||||
c.refcount = c.refcount and not ZctFlag
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ when allowForeignThreadGc:
|
|||
setStackBottom(addr(stackTop))
|
||||
initGC()
|
||||
else:
|
||||
template setupForeignThreadGc*(): stmt =
|
||||
template setupForeignThreadGc*() =
|
||||
{.error: "setupForeignThreadGc is available only when ``--threads:on`` and ``--tlsEmulation:off`` are used".}
|
||||
|
||||
# ----------------- stack management --------------------------------------
|
||||
|
|
@ -197,7 +197,7 @@ when defined(sparc): # For SPARC architecture.
|
|||
var x = cast[ByteAddress](p)
|
||||
result = a <=% x and x <=% b
|
||||
|
||||
template forEachStackSlot(gch, gcMark: expr) {.immediate, dirty.} =
|
||||
template forEachStackSlot(gch, gcMark: untyped) {.dirty.} =
|
||||
when defined(sparcv9):
|
||||
asm """"flushw \n" """
|
||||
else:
|
||||
|
|
@ -235,7 +235,7 @@ elif stackIncreases:
|
|||
# a little hack to get the size of a JmpBuf in the generated C code
|
||||
# in a platform independent way
|
||||
|
||||
template forEachStackSlot(gch, gcMark: expr) {.immediate, dirty.} =
|
||||
template forEachStackSlot(gch, gcMark: untyped) {.dirty.} =
|
||||
var registers {.noinit.}: C_JmpBuf
|
||||
if c_setjmp(registers) == 0'i32: # To fill the C stack with registers.
|
||||
var max = cast[ByteAddress](gch.stackBottom)
|
||||
|
|
@ -261,7 +261,7 @@ else:
|
|||
if a <=% x and x <=% b:
|
||||
return true
|
||||
|
||||
template forEachStackSlot(gch, gcMark: expr) {.immediate, dirty.} =
|
||||
template forEachStackSlot(gch, gcMark: untyped) {.dirty.} =
|
||||
# We use a jmp_buf buffer that is in the C stack.
|
||||
# Used to traverse the stack and registers assuming
|
||||
# that 'setjmp' will save registers in the C stack.
|
||||
|
|
@ -299,7 +299,7 @@ else:
|
|||
var x = cast[ByteAddress](p)
|
||||
result = a <=% x and x <=% b
|
||||
|
||||
template forEachStackSlot(gch, gcMark: expr) {.immediate, dirty.} =
|
||||
template forEachStackSlot(gch, gcMark: untyped) {.dirty.} =
|
||||
# We use a jmp_buf buffer that is in the C stack.
|
||||
# Used to traverse the stack and registers assuming
|
||||
# that 'setjmp' will save registers in the C stack.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const
|
|||
rcGrey = 1 # unused
|
||||
rcBlack = 2
|
||||
|
||||
template mulThreshold(x): expr {.immediate.} = x * 2
|
||||
template mulThreshold(x): untyped = x * 2
|
||||
|
||||
when defined(memProfiler):
|
||||
proc nimProfile(requestedSize: int)
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@ proc eqStrings(a, b: NimString): bool {.inline, compilerProc.} =
|
|||
equalMem(addr(a.data), addr(b.data), a.len)
|
||||
|
||||
when declared(allocAtomic):
|
||||
template allocStr(size: expr): expr =
|
||||
template allocStr(size: untyped): untyped =
|
||||
cast[NimString](allocAtomic(size))
|
||||
|
||||
template allocStrNoInit(size: expr): expr =
|
||||
template allocStrNoInit(size: untyped): untyped =
|
||||
cast[NimString](boehmAllocAtomic(size))
|
||||
else:
|
||||
template allocStr(size: expr): expr =
|
||||
template allocStr(size: untyped): untyped =
|
||||
cast[NimString](newObj(addr(strDesc), size))
|
||||
|
||||
template allocStrNoInit(size: expr): expr =
|
||||
template allocStrNoInit(size: untyped): untyped =
|
||||
cast[NimString](newObjNoInit(addr(strDesc), size))
|
||||
|
||||
proc rawNewStringNoInit(space: int): NimString {.compilerProc.} =
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ const
|
|||
UNI_SUR_LOW_START = 0xDC00
|
||||
UNI_SUR_LOW_END = 0xDFFF
|
||||
|
||||
template ones(n: expr): expr = ((1 shl n)-1)
|
||||
template ones(n: untyped): untyped = ((1 shl n)-1)
|
||||
|
||||
template fastRuneAt(s: cstring, i: int, result: expr, doInc = true) =
|
||||
template fastRuneAt(s: cstring, i: int, result: untyped, doInc = true) =
|
||||
## Returns the unicode character ``s[i]`` in `result`. If ``doInc == true``
|
||||
## `i` is incremented by the number of bytes that have been processed.
|
||||
bind ones
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue