made large parts of the stdlib gcsafe

This commit is contained in:
Araq 2014-04-20 20:01:24 +02:00
commit e6d17e6273
21 changed files with 138 additions and 113 deletions

View file

@ -29,7 +29,7 @@ type
region: TMemRegion
PRawChannel = ptr TRawChannel
TLoadStoreMode = enum mStore, mLoad
TChannel*[TMsg] = TRawChannel ## a channel for thread communication
TChannel* {.gcsafe.}[TMsg] = TRawChannel ## a channel for thread communication
const ChannelDeadMask = -2

View file

@ -16,6 +16,8 @@
# -> defined(useNimRtl) or appType == "lib" and not defined(createNimRtl)
# 3) Exported into nimrtl.
# -> appType == "lib" and defined(createNimRtl)
when not defined(nimNewShared):
{.pragma: gcsafe.}
when defined(createNimRtl):
when defined(useNimRtl):
@ -24,7 +26,7 @@ when defined(createNimRtl):
{.error: "nimrtl must be built as a library!".}
when defined(createNimRtl):
{.pragma: rtl, exportc: "nimrtl_$1", dynlib.}
{.pragma: rtl, exportc: "nimrtl_$1", dynlib, gcsafe.}
{.pragma: inl.}
{.pragma: compilerRtl, compilerproc, exportc: "nimrtl_$1", dynlib.}
elif defined(useNimRtl):
@ -34,11 +36,11 @@ elif defined(useNimRtl):
const nimrtl* = "nimrtl.dylib"
else:
const nimrtl* = "libnimrtl.so"
{.pragma: rtl, importc: "nimrtl_$1", dynlib: nimrtl.}
{.pragma: rtl, importc: "nimrtl_$1", dynlib: nimrtl, gcsafe.}
{.pragma: inl.}
{.pragma: compilerRtl, compilerproc, importc: "nimrtl_$1", dynlib: nimrtl.}
else:
{.pragma: rtl.}
{.pragma: rtl, gcsafe.}
{.pragma: inl, inline.}
{.pragma: compilerRtl, compilerproc.}

View file

@ -256,9 +256,9 @@ type
## that **must not** be part of a message! Use
## a ``TThreadId`` for that.
when TArg is void:
dataFn: proc () {.nimcall.}
dataFn: proc () {.nimcall, gcsafe.}
else:
dataFn: proc (m: TArg) {.nimcall.}
dataFn: proc (m: TArg) {.nimcall, gcsafe.}
data: TArg
TThreadId*[TArg] = ptr TThread[TArg] ## the current implementation uses
## a pointer as a thread ID.