gc:stack compiles with --threads:on
This commit is contained in:
parent
ad70fb4ffe
commit
2bc6acd0ed
1 changed files with 17 additions and 7 deletions
|
|
@ -144,6 +144,7 @@ proc runFinalizers(c: Chunk) =
|
||||||
(cast[Finalizer](it.typ.finalizer))(it+!sizeof(ObjHeader))
|
(cast[Finalizer](it.typ.finalizer))(it+!sizeof(ObjHeader))
|
||||||
it = it.nextFinal
|
it = it.nextFinal
|
||||||
|
|
||||||
|
when false:
|
||||||
proc dealloc(r: var MemRegion; p: pointer) =
|
proc dealloc(r: var MemRegion; p: pointer) =
|
||||||
let it = cast[ptr ObjHeader](p-!sizeof(ObjHeader))
|
let it = cast[ptr ObjHeader](p-!sizeof(ObjHeader))
|
||||||
if it.typ != nil and it.typ.finalizer != nil:
|
if it.typ != nil and it.typ.finalizer != nil:
|
||||||
|
|
@ -187,6 +188,8 @@ proc obstackPtr*(): StackPtr = tlRegion.obstackPtr()
|
||||||
proc setObstackPtr*(sp: StackPtr) = tlRegion.setObstackPtr(sp)
|
proc setObstackPtr*(sp: StackPtr) = tlRegion.setObstackPtr(sp)
|
||||||
proc deallocAll*() = tlRegion.deallocAll()
|
proc deallocAll*() = tlRegion.deallocAll()
|
||||||
|
|
||||||
|
proc deallocOsPages(r: var MemRegion) = r.deallocAll()
|
||||||
|
|
||||||
proc joinRegion*(dest: var MemRegion; src: MemRegion) =
|
proc joinRegion*(dest: var MemRegion; src: MemRegion) =
|
||||||
# merging is not hard.
|
# merging is not hard.
|
||||||
if dest.head.isNil:
|
if dest.head.isNil:
|
||||||
|
|
@ -424,6 +427,13 @@ proc realloc(p: pointer, newsize: Natural): pointer =
|
||||||
if result == nil: raiseOutOfMem()
|
if result == nil: raiseOutOfMem()
|
||||||
proc dealloc(p: pointer) = cfree(p)
|
proc dealloc(p: pointer) = cfree(p)
|
||||||
|
|
||||||
|
proc alloc0(r: var MemRegion; size: Natural): pointer =
|
||||||
|
# ignore the region. That is correct for the channels module
|
||||||
|
# but incorrect in general. XXX
|
||||||
|
result = alloc0(size)
|
||||||
|
|
||||||
|
proc dealloc(r: var MemRegion; p: pointer) = dealloc(p)
|
||||||
|
|
||||||
proc allocShared(size: Natural): pointer =
|
proc allocShared(size: Natural): pointer =
|
||||||
result = cmalloc(size)
|
result = cmalloc(size)
|
||||||
if result == nil: raiseOutOfMem()
|
if result == nil: raiseOutOfMem()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue