DLL generation may work again
This commit is contained in:
parent
95df3ee1ce
commit
84c473a890
5 changed files with 30 additions and 9 deletions
|
|
@ -63,10 +63,10 @@ type
|
||||||
region: TMemRegion # garbage collected region
|
region: TMemRegion # garbage collected region
|
||||||
stat: TGcStat
|
stat: TGcStat
|
||||||
|
|
||||||
when not defined(useNimRtl):
|
var
|
||||||
var
|
gch {.rtlThreadVar.}: TGcHeap
|
||||||
gch {.rtlThreadVar.}: TGcHeap
|
|
||||||
|
|
||||||
|
when not defined(useNimRtl):
|
||||||
InstantiateForRegion(gch.region)
|
InstantiateForRegion(gch.region)
|
||||||
|
|
||||||
proc acquire(gch: var TGcHeap) {.inline.} =
|
proc acquire(gch: var TGcHeap) {.inline.} =
|
||||||
|
|
|
||||||
|
|
@ -179,14 +179,15 @@ type
|
||||||
nil
|
nil
|
||||||
|
|
||||||
# XXX it'd be more efficient to not use a global variable for the
|
# XXX it'd be more efficient to not use a global variable for the
|
||||||
# thread storage slot, but to rely on the implementation to assign slot 0
|
# thread storage slot, but to rely on the implementation to assign slot X
|
||||||
# for us... ;-)
|
# for us... ;-)
|
||||||
var globalsSlot = ThreadVarAlloc()
|
var globalsSlot = ThreadVarAlloc()
|
||||||
#const globalsSlot = TThreadVarSlot(0)
|
#const globalsSlot = TThreadVarSlot(0)
|
||||||
#sysAssert checkSlot.int == globalsSlot.int
|
#sysAssert checkSlot.int == globalsSlot.int
|
||||||
|
|
||||||
proc GetThreadLocalVars(): pointer {.compilerRtl, inl.} =
|
when emulatedThreadVars:
|
||||||
result = addr(cast[PGcThread](ThreadVarGetValue(globalsSlot)).tls)
|
proc GetThreadLocalVars(): pointer {.compilerRtl, inl.} =
|
||||||
|
result = addr(cast[PGcThread](ThreadVarGetValue(globalsSlot)).tls)
|
||||||
|
|
||||||
when useStackMaskHack:
|
when useStackMaskHack:
|
||||||
proc MaskStackPointer(offset: int): pointer {.compilerRtl, inl.} =
|
proc MaskStackPointer(offset: int): pointer {.compilerRtl, inl.} =
|
||||||
|
|
@ -198,6 +199,7 @@ when useStackMaskHack:
|
||||||
# create for the main thread. Note: do not insert this data into the list
|
# create for the main thread. Note: do not insert this data into the list
|
||||||
# of all threads; it's not to be stopped etc.
|
# of all threads; it's not to be stopped etc.
|
||||||
when not defined(useNimRtl):
|
when not defined(useNimRtl):
|
||||||
|
|
||||||
when not useStackMaskHack:
|
when not useStackMaskHack:
|
||||||
var mainThread: TGcThread
|
var mainThread: TGcThread
|
||||||
ThreadVarSetValue(globalsSlot, addr(mainThread))
|
ThreadVarSetValue(globalsSlot, addr(mainThread))
|
||||||
|
|
@ -264,7 +266,7 @@ when not defined(boehmgc) and not hasSharedHeap:
|
||||||
proc deallocOsPages()
|
proc deallocOsPages()
|
||||||
|
|
||||||
template ThreadProcWrapperBody(closure: expr) =
|
template ThreadProcWrapperBody(closure: expr) =
|
||||||
ThreadVarSetValue(globalsSlot, closure)
|
when defined(globalsSlot): ThreadVarSetValue(globalsSlot, closure)
|
||||||
var t = cast[ptr TThread[TArg]](closure)
|
var t = cast[ptr TThread[TArg]](closure)
|
||||||
when useStackMaskHack:
|
when useStackMaskHack:
|
||||||
var tls: TThreadLocalStorage
|
var tls: TThreadLocalStorage
|
||||||
|
|
|
||||||
12
tests/accept/run/tcnstseq2.nim
Normal file
12
tests/accept/run/tcnstseq2.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
discard """
|
||||||
|
output: "AngelikaAnneAnnaAnkaAnja"
|
||||||
|
"""
|
||||||
|
|
||||||
|
const
|
||||||
|
myWords = @["Angelika", "Anne", "Anna", "Anka", "Anja"]
|
||||||
|
|
||||||
|
for i in 0 .. high(myWords):
|
||||||
|
write(stdout, myWords[i]) #OUT AngelikaAnneAnnaAnkaAnja
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
7
tests/accept/run/tcnstseq3.nim
Normal file
7
tests/accept/run/tcnstseq3.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
discard """
|
||||||
|
output: "AngelikaAnneAnnaAnkaAnja"
|
||||||
|
"""
|
||||||
|
|
||||||
|
for w in items(["Angelika", "Anne", "Anna", "Anka", "Anja"]):
|
||||||
|
write(stdout, w) #OUT AngelikaAnneAnnaAnkaAnja
|
||||||
|
|
||||||
2
todo.txt
2
todo.txt
|
|
@ -2,7 +2,7 @@ Version 0.8.14
|
||||||
==============
|
==============
|
||||||
|
|
||||||
- bug: s[1..n] = @[] produces wrong C code
|
- bug: s[1..n] = @[] produces wrong C code
|
||||||
- bug: DLL generation is broken; write at least a basic test
|
- test suite should contain DLL tests
|
||||||
- optimize unused constants away (affected by HLO)
|
- optimize unused constants away (affected by HLO)
|
||||||
- fix actors.nim; test with different thread var implementations
|
- fix actors.nim; test with different thread var implementations
|
||||||
- dead code elim for JS backend
|
- dead code elim for JS backend
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue