diff options
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/alloc.nim | 2 | ||||
-rw-r--r-- | lib/system/excpt.nim | 2 | ||||
-rw-r--r-- | lib/system/gc.nim | 14 | ||||
-rw-r--r-- | lib/system/gc_common.nim | 10 | ||||
-rw-r--r-- | lib/system/gc_ms.nim | 2 | ||||
-rw-r--r-- | lib/system/sysstr.nim | 8 | ||||
-rw-r--r-- | lib/system/widestrs.nim | 4 |
7 files changed, 21 insertions, 21 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim index 065b13460..a124d7537 100644 --- a/lib/system/alloc.nim +++ b/lib/system/alloc.nim @@ -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) diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index b16590c92..be41a63a7 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -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") diff --git a/lib/system/gc.nim b/lib/system/gc.nim index 686729a68..703146484 100644 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -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 diff --git a/lib/system/gc_common.nim b/lib/system/gc_common.nim index 8f9d1edb6..269514ceb 100644 --- a/lib/system/gc_common.nim +++ b/lib/system/gc_common.nim @@ -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. diff --git a/lib/system/gc_ms.nim b/lib/system/gc_ms.nim index 63ca94698..f927575dd 100644 --- a/lib/system/gc_ms.nim +++ b/lib/system/gc_ms.nim @@ -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) diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim index 11034006a..d3d3d5a95 100644 --- a/lib/system/sysstr.nim +++ b/lib/system/sysstr.nim @@ -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.} = diff --git a/lib/system/widestrs.nim b/lib/system/widestrs.nim index 578bebe80..3c957476f 100644 --- a/lib/system/widestrs.nim +++ b/lib/system/widestrs.nim @@ -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 |