mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-20 16:01:29 +00:00
@@ -192,7 +192,7 @@ compiled with the `-d:useNimRtl` option and they will depend on both
|
||||
the `nimrtl` library and the `nimhcr` library which implements the
|
||||
hot code reloading run-time. Both libraries can be found in the `lib`
|
||||
folder of Nim and can be compiled into dynamic libraries to satisfy
|
||||
runtime demands of the example code above. An example of compiling
|
||||
runtime demands of the example code above. An example of compiling
|
||||
`nimhcr.nim` and `nimrtl.nim` when the source dir of Nim is installed
|
||||
with choosenim follows.
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ when not defined(js) and (defined(hotcodereloading) or
|
||||
else: "so"
|
||||
type
|
||||
HcrProcGetter* = proc (libHandle: pointer, procName: cstring): pointer {.nimcall.}
|
||||
HcrGcMarkerProc = proc () {.nimcall.}
|
||||
HcrGcMarkerProc = proc () {.nimcall, raises: [].}
|
||||
HcrModuleInitializer* = proc () {.nimcall.}
|
||||
|
||||
when defined(createNimHcr):
|
||||
@@ -606,7 +606,7 @@ when defined(createNimHcr):
|
||||
proc hcrGeneration*(): int {.nimhcr.} =
|
||||
generation
|
||||
|
||||
proc hcrMarkGlobals*() {.nimhcr, nimcall, gcsafe.} =
|
||||
proc hcrMarkGlobals*() {.compilerproc, exportc, dynlib, nimcall, gcsafe.} =
|
||||
# This is gcsafe, because it will be registered
|
||||
# only in the GC of the main thread.
|
||||
{.gcsafe.}:
|
||||
@@ -648,10 +648,10 @@ elif defined(hotcodereloading) or defined(testNimHcr):
|
||||
|
||||
proc hcrAddEventHandler*(isBefore: bool, cb: proc ()) {.nimhcr.}
|
||||
|
||||
proc hcrMarkGlobals*() {.nimhcr, nimcall, gcsafe.}
|
||||
proc hcrMarkGlobals*() {.raises: [], nimhcr, nimcall, gcsafe.}
|
||||
|
||||
when declared(nimRegisterGlobalMarker):
|
||||
nimRegisterGlobalMarker(hcrMarkGlobals)
|
||||
nimRegisterGlobalMarker(cast[GlobalMarkerProc](hcrMarkGlobals))
|
||||
|
||||
else:
|
||||
proc hcrHasModuleChanged*(moduleHash: string): bool =
|
||||
|
||||
@@ -94,7 +94,7 @@ type
|
||||
waZctDecRef, waPush
|
||||
#, waDebug
|
||||
|
||||
Finalizer {.compilerproc.} = proc (self: pointer) {.nimcall, benign.}
|
||||
Finalizer {.compilerproc.} = proc (self: pointer) {.nimcall, benign, raises: [].}
|
||||
# A ref type can have a finalizer that is called before the object's
|
||||
# storage is freed.
|
||||
|
||||
@@ -219,11 +219,11 @@ template gcTrace(cell, state: untyped) =
|
||||
when traceGC: traceCell(cell, state)
|
||||
|
||||
# forward declarations:
|
||||
proc collectCT(gch: var GcHeap) {.benign.}
|
||||
proc isOnStack(p: pointer): bool {.noinline, benign.}
|
||||
proc forAllChildren(cell: PCell, op: WalkOp) {.benign.}
|
||||
proc doOperation(p: pointer, op: WalkOp) {.benign.}
|
||||
proc forAllChildrenAux(dest: pointer, mt: PNimType, op: WalkOp) {.benign.}
|
||||
proc collectCT(gch: var GcHeap) {.benign, raises: [].}
|
||||
proc isOnStack(p: pointer): bool {.noinline, benign, raises: [].}
|
||||
proc forAllChildren(cell: PCell, op: WalkOp) {.benign, raises: [].}
|
||||
proc doOperation(p: pointer, op: WalkOp) {.benign, raises: [].}
|
||||
proc forAllChildrenAux(dest: pointer, mt: PNimType, op: WalkOp) {.benign, raises: [].}
|
||||
# we need the prototype here for debugging purposes
|
||||
|
||||
proc incRef(c: PCell) {.inline.} =
|
||||
@@ -636,7 +636,7 @@ proc markS(gch: var GcHeap, c: PCell) =
|
||||
if not containsOrIncl(gch.marked, d):
|
||||
forAllChildren(d, waMarkPrecise)
|
||||
|
||||
proc markGlobals(gch: var GcHeap) =
|
||||
proc markGlobals(gch: var GcHeap) {.raises: [].} =
|
||||
if gch.gcThreadId == 0:
|
||||
for i in 0 .. globalMarkersLen-1: globalMarkers[i]()
|
||||
for i in 0 .. threadLocalMarkersLen-1: threadLocalMarkers[i]()
|
||||
@@ -691,9 +691,9 @@ proc doOperation(p: pointer, op: WalkOp) =
|
||||
proc nimGCvisit(d: pointer, op: int) {.compilerRtl.} =
|
||||
doOperation(d, WalkOp(op))
|
||||
|
||||
proc collectZCT(gch: var GcHeap): bool {.benign.}
|
||||
proc collectZCT(gch: var GcHeap): bool {.benign, raises: [].}
|
||||
|
||||
proc collectCycles(gch: var GcHeap) =
|
||||
proc collectCycles(gch: var GcHeap) {.raises: [].} =
|
||||
when hasThreadSupport:
|
||||
for c in gch.toDispose:
|
||||
nimGCunref(c)
|
||||
@@ -800,7 +800,7 @@ proc unmarkStackAndRegisters(gch: var GcHeap) =
|
||||
decRef(d[i])
|
||||
gch.decStack.len = 0
|
||||
|
||||
proc collectCTBody(gch: var GcHeap) =
|
||||
proc collectCTBody(gch: var GcHeap) {.raises: [].} =
|
||||
when withRealTime:
|
||||
let t0 = getticks()
|
||||
sysAssert(allocInv(gch.region), "collectCT: begin")
|
||||
|
||||
@@ -415,7 +415,7 @@ else:
|
||||
# end of non-portable code
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
proc prepareDealloc(cell: PCell) =
|
||||
proc prepareDealloc(cell: PCell) {.raises: [].} =
|
||||
when declared(useMarkForDebug):
|
||||
when useMarkForDebug:
|
||||
gcAssert(cell notin gch.marked, "Cell still alive!")
|
||||
@@ -458,7 +458,7 @@ proc deallocHeap*(runFinalizers = true; allowGcAfterwards = true) =
|
||||
initGC()
|
||||
|
||||
type
|
||||
GlobalMarkerProc = proc () {.nimcall, benign.}
|
||||
GlobalMarkerProc = proc () {.nimcall, benign, raises: [].}
|
||||
var
|
||||
globalMarkersLen {.exportc.}: int
|
||||
globalMarkers {.exportc.}: array[0..3499, GlobalMarkerProc]
|
||||
|
||||
@@ -36,7 +36,7 @@ type
|
||||
# local
|
||||
waMarkPrecise # fast precise marking
|
||||
|
||||
Finalizer {.compilerproc.} = proc (self: pointer) {.nimcall, benign.}
|
||||
Finalizer {.compilerproc.} = proc (self: pointer) {.nimcall, benign, raises: [].}
|
||||
# A ref type can have a finalizer that is called before the object's
|
||||
# storage is freed.
|
||||
|
||||
@@ -115,10 +115,10 @@ when BitsPerPage mod (sizeof(int)*8) != 0:
|
||||
{.error: "(BitsPerPage mod BitsPerUnit) should be zero!".}
|
||||
|
||||
# forward declarations:
|
||||
proc collectCT(gch: var GcHeap; size: int) {.benign.}
|
||||
proc forAllChildren(cell: PCell, op: WalkOp) {.benign.}
|
||||
proc doOperation(p: pointer, op: WalkOp) {.benign.}
|
||||
proc forAllChildrenAux(dest: pointer, mt: PNimType, op: WalkOp) {.benign.}
|
||||
proc collectCT(gch: var GcHeap; size: int) {.benign, raises: [].}
|
||||
proc forAllChildren(cell: PCell, op: WalkOp) {.benign, raises: [].}
|
||||
proc doOperation(p: pointer, op: WalkOp) {.benign, raises: [].}
|
||||
proc forAllChildrenAux(dest: pointer, mt: PNimType, op: WalkOp) {.benign, raises: [].}
|
||||
# we need the prototype here for debugging purposes
|
||||
|
||||
when defined(nimGcRefLeak):
|
||||
|
||||
Reference in New Issue
Block a user