debug build works again; sorry
This commit is contained in:
parent
5c9552437c
commit
f94941964d
4 changed files with 55 additions and 54 deletions
|
|
@ -44,6 +44,10 @@ type
|
||||||
typeDesc* {.magic: TypeDesc.} ## meta type to denote
|
typeDesc* {.magic: TypeDesc.} ## meta type to denote
|
||||||
## a type description (for templates)
|
## a type description (for templates)
|
||||||
|
|
||||||
|
const
|
||||||
|
hasThreadSupport = false # deactivate for now: thread stack walking
|
||||||
|
# is missing!
|
||||||
|
|
||||||
proc defined*[T](x: T): bool {.magic: "Defined", noSideEffect.}
|
proc defined*[T](x: T): bool {.magic: "Defined", noSideEffect.}
|
||||||
## Special compile-time procedure that checks whether `x` is
|
## Special compile-time procedure that checks whether `x` is
|
||||||
## defined. `x` has to be an identifier or a qualified identifier.
|
## defined. `x` has to be an identifier or a qualified identifier.
|
||||||
|
|
@ -779,14 +783,6 @@ proc compileOption*(option, arg: string): bool {.
|
||||||
include "system/inclrtl"
|
include "system/inclrtl"
|
||||||
|
|
||||||
when not defined(ecmascript) and not defined(nimrodVm):
|
when not defined(ecmascript) and not defined(nimrodVm):
|
||||||
|
|
||||||
proc atomicInc*(memLoc: var int, x: int): int {.inline.}
|
|
||||||
## atomic increment of `memLoc`. Returns the value after the operation.
|
|
||||||
|
|
||||||
proc atomicDec*(memLoc: var int, x: int): int {.inline.}
|
|
||||||
## atomic decrement of `memLoc`. Returns the value after the operation.
|
|
||||||
|
|
||||||
include "system/systhread"
|
|
||||||
include "system/cgprocs"
|
include "system/cgprocs"
|
||||||
|
|
||||||
proc add *[T](x: var seq[T], y: T) {.magic: "AppendSeqElem", noSideEffect.}
|
proc add *[T](x: var seq[T], y: T) {.magic: "AppendSeqElem", noSideEffect.}
|
||||||
|
|
@ -1444,6 +1440,12 @@ proc quit*(errorcode: int = QuitSuccess) {.
|
||||||
|
|
||||||
when not defined(EcmaScript) and not defined(NimrodVM):
|
when not defined(EcmaScript) and not defined(NimrodVM):
|
||||||
|
|
||||||
|
proc atomicInc*(memLoc: var int, x: int): int {.inline.}
|
||||||
|
## atomic increment of `memLoc`. Returns the value after the operation.
|
||||||
|
|
||||||
|
proc atomicDec*(memLoc: var int, x: int): int {.inline.}
|
||||||
|
## atomic decrement of `memLoc`. Returns the value after the operation.
|
||||||
|
|
||||||
proc initGC()
|
proc initGC()
|
||||||
|
|
||||||
proc initStackBottom() {.inline.} =
|
proc initStackBottom() {.inline.} =
|
||||||
|
|
@ -1709,7 +1711,7 @@ when not defined(EcmaScript) and not defined(NimrodVM):
|
||||||
else:
|
else:
|
||||||
result = n.sons[n.len]
|
result = n.sons[n.len]
|
||||||
|
|
||||||
#include "system/systhread"
|
include "system/systhread"
|
||||||
include "system/mmdisp"
|
include "system/mmdisp"
|
||||||
include "system/sysstr"
|
include "system/sysstr"
|
||||||
include "system/assign"
|
include "system/assign"
|
||||||
|
|
|
||||||
|
|
@ -23,49 +23,50 @@ proc nimLoadLibraryError(path: string) {.compilerproc, noinline.}
|
||||||
|
|
||||||
proc setStackBottom(theStackBottom: pointer) {.compilerRtl, noinline.}
|
proc setStackBottom(theStackBottom: pointer) {.compilerRtl, noinline.}
|
||||||
|
|
||||||
# Support for thread local storage:
|
when false:
|
||||||
when defined(windows):
|
# Support for thread local storage:
|
||||||
type
|
when defined(windows):
|
||||||
TThreadVarSlot {.compilerproc.} = distinct int32
|
type
|
||||||
|
TThreadVarSlot {.compilerproc.} = distinct int32
|
||||||
|
|
||||||
proc TlsAlloc(): TThreadVarSlot {.
|
proc TlsAlloc(): TThreadVarSlot {.
|
||||||
importc: "TlsAlloc", stdcall, dynlib: "kernel32".}
|
importc: "TlsAlloc", stdcall, dynlib: "kernel32".}
|
||||||
proc TlsSetValue(dwTlsIndex: TThreadVarSlot, lpTlsValue: pointer) {.
|
proc TlsSetValue(dwTlsIndex: TThreadVarSlot, lpTlsValue: pointer) {.
|
||||||
importc: "TlsSetValue", stdcall, dynlib: "kernel32".}
|
importc: "TlsSetValue", stdcall, dynlib: "kernel32".}
|
||||||
proc TlsGetValue(dwTlsIndex: TThreadVarSlot): pointer {.
|
proc TlsGetValue(dwTlsIndex: TThreadVarSlot): pointer {.
|
||||||
importc: "TlsGetValue", stdcall, dynlib: "kernel32".}
|
importc: "TlsGetValue", stdcall, dynlib: "kernel32".}
|
||||||
|
|
||||||
proc ThreadVarAlloc(): TThreadVarSlot {.compilerproc, inline.} =
|
proc ThreadVarAlloc(): TThreadVarSlot {.compilerproc, inline.} =
|
||||||
result = TlsAlloc()
|
result = TlsAlloc()
|
||||||
proc ThreadVarSetValue(s: TThreadVarSlot, value: pointer) {.
|
proc ThreadVarSetValue(s: TThreadVarSlot, value: pointer) {.
|
||||||
compilerproc, inline.} =
|
compilerproc, inline.} =
|
||||||
TlsSetValue(s, value)
|
TlsSetValue(s, value)
|
||||||
proc ThreadVarGetValue(s: TThreadVarSlot): pointer {.
|
proc ThreadVarGetValue(s: TThreadVarSlot): pointer {.
|
||||||
compilerproc, inline.} =
|
compilerproc, inline.} =
|
||||||
result = TlsGetValue(s)
|
result = TlsGetValue(s)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
type
|
type
|
||||||
Tpthread_key {.importc: "pthread_key_t",
|
Tpthread_key {.importc: "pthread_key_t",
|
||||||
header: "<sys/types.h>".} = distinct int
|
header: "<sys/types.h>".} = distinct int
|
||||||
TThreadVarSlot {.compilerproc.} = Tpthread_key
|
TThreadVarSlot {.compilerproc.} = Tpthread_key
|
||||||
|
|
||||||
proc pthread_getspecific(a1: Tpthread_key): pointer {.
|
proc pthread_getspecific(a1: Tpthread_key): pointer {.
|
||||||
importc: "pthread_getspecific", header: "<pthread.h>".}
|
importc: "pthread_getspecific", header: "<pthread.h>".}
|
||||||
proc pthread_key_create(a1: ptr Tpthread_key,
|
proc pthread_key_create(a1: ptr Tpthread_key,
|
||||||
destruct: proc (x: pointer) {.noconv.}): int32 {.
|
destruct: proc (x: pointer) {.noconv.}): int32 {.
|
||||||
importc: "pthread_key_create", header: "<pthread.h>".}
|
importc: "pthread_key_create", header: "<pthread.h>".}
|
||||||
proc pthread_key_delete(a1: Tpthread_key): int32 {.
|
proc pthread_key_delete(a1: Tpthread_key): int32 {.
|
||||||
importc: "pthread_key_delete", header: "<pthread.h>".}
|
importc: "pthread_key_delete", header: "<pthread.h>".}
|
||||||
|
|
||||||
proc pthread_setspecific(a1: Tpthread_key, a2: pointer): int32 {.
|
proc pthread_setspecific(a1: Tpthread_key, a2: pointer): int32 {.
|
||||||
importc: "pthread_setspecific", header: "<pthread.h>".}
|
importc: "pthread_setspecific", header: "<pthread.h>".}
|
||||||
|
|
||||||
proc ThreadVarAlloc(): TThreadVarSlot {.compilerproc, inline.} =
|
proc ThreadVarAlloc(): TThreadVarSlot {.compilerproc, inline.} =
|
||||||
discard pthread_key_create(addr(result), nil)
|
discard pthread_key_create(addr(result), nil)
|
||||||
proc ThreadVarSetValue(s: TThreadVarSlot, value: pointer) {.
|
proc ThreadVarSetValue(s: TThreadVarSlot, value: pointer) {.
|
||||||
compilerproc, inline.} =
|
compilerproc, inline.} =
|
||||||
discard pthread_setspecific(s, value)
|
discard pthread_setspecific(s, value)
|
||||||
proc ThreadVarGetValue(s: TThreadVarSlot): pointer {.compilerproc, inline.} =
|
proc ThreadVarGetValue(s: TThreadVarSlot): pointer {.compilerproc, inline.} =
|
||||||
result = pthread_getspecific(s)
|
result = pthread_getspecific(s)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ type
|
||||||
exc: ref E_Base # XXX only needed for bootstrapping; unused
|
exc: ref E_Base # XXX only needed for bootstrapping; unused
|
||||||
context: C_JmpBuf
|
context: C_JmpBuf
|
||||||
|
|
||||||
when hasThreadSupport: nil
|
#when hasThreadSupport: nil
|
||||||
|
|
||||||
var
|
var
|
||||||
excHandler {.threadvar, compilerproc.}: PSafePoint = nil
|
excHandler {.threadvar, compilerproc.}: PSafePoint = nil
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
const
|
const
|
||||||
hasThreadSupport = false # deactivate for now: thread stack walking
|
|
||||||
# is missing!
|
|
||||||
maxThreads = 256
|
maxThreads = 256
|
||||||
|
|
||||||
when (defined(gcc) or defined(llvm_gcc)) and hasThreadSupport:
|
when (defined(gcc) or defined(llvm_gcc)) and hasThreadSupport:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue