mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 14:25:23 +00:00
gc_common: fixes a typo
This commit is contained in:
@@ -157,25 +157,6 @@ else:
|
||||
iterator items(first: var GcStack): ptr GcStack = yield addr(first)
|
||||
proc len(stack: var GcStack): int = 1
|
||||
|
||||
proc stackSize(stack: ptr GcStack): int {.noinline.} =
|
||||
when nimCoroutines:
|
||||
var pos = stack.pos
|
||||
else:
|
||||
var pos {.volatile.}: pointer
|
||||
pos = addr(pos)
|
||||
|
||||
if pos != nil:
|
||||
when defined(stackIncreases):
|
||||
result = cast[ByteAddress](pos) -% cast[ByteAddress](stack.bottom)
|
||||
else:
|
||||
result = cast[ByteAddress](stack.bottom) -% cast[ByteAddress](pos)
|
||||
else:
|
||||
result = 0
|
||||
|
||||
proc stackSize(): int {.noinline.} =
|
||||
for stack in gch.stack.items():
|
||||
result = result + stack.stackSize()
|
||||
|
||||
when nimCoroutines:
|
||||
proc setPosition(stack: ptr GcStack, position: pointer) =
|
||||
stack.pos = position
|
||||
@@ -246,6 +227,25 @@ elif defined(hppa) or defined(hp9000) or defined(hp9000s300) or
|
||||
else:
|
||||
const stackIncreases = false
|
||||
|
||||
proc stackSize(stack: ptr GcStack): int {.noinline.} =
|
||||
when nimCoroutines:
|
||||
var pos = stack.pos
|
||||
else:
|
||||
var pos {.volatile.}: pointer
|
||||
pos = addr(pos)
|
||||
|
||||
if pos != nil:
|
||||
when stackIncreases:
|
||||
result = cast[ByteAddress](pos) -% cast[ByteAddress](stack.bottom)
|
||||
else:
|
||||
result = cast[ByteAddress](stack.bottom) -% cast[ByteAddress](pos)
|
||||
else:
|
||||
result = 0
|
||||
|
||||
proc stackSize(): int {.noinline.} =
|
||||
for stack in gch.stack.items():
|
||||
result = result + stack.stackSize()
|
||||
|
||||
{.push stack_trace: off.}
|
||||
when nimCoroutines:
|
||||
proc GC_addStack(bottom: pointer) {.cdecl, exportc.} =
|
||||
|
||||
Reference in New Issue
Block a user