fixes a critical --gc:boehm regression
This commit is contained in:
parent
0e01a5f76c
commit
e0f3e8432a
2 changed files with 7 additions and 5 deletions
|
|
@ -1193,6 +1193,8 @@ proc genDefault(p: BProc; n: PNode; d: var TLoc) =
|
||||||
if d.k == locNone: getTemp(p, n.typ, d, needsInit=true)
|
if d.k == locNone: getTemp(p, n.typ, d, needsInit=true)
|
||||||
else: resetLoc(p, d)
|
else: resetLoc(p, d)
|
||||||
|
|
||||||
|
proc trivialDestructor(s: PSym): bool {.inline.} = s.ast[bodyPos].len == 0
|
||||||
|
|
||||||
proc rawGenNew(p: BProc, a: TLoc, sizeExpr: Rope) =
|
proc rawGenNew(p: BProc, a: TLoc, sizeExpr: Rope) =
|
||||||
var sizeExpr = sizeExpr
|
var sizeExpr = sizeExpr
|
||||||
let typ = a.t
|
let typ = a.t
|
||||||
|
|
@ -1210,7 +1212,7 @@ proc rawGenNew(p: BProc, a: TLoc, sizeExpr: Rope) =
|
||||||
genAssignment(p, a, b, {})
|
genAssignment(p, a, b, {})
|
||||||
else:
|
else:
|
||||||
let ti = genTypeInfo(p.module, typ, a.lode.info)
|
let ti = genTypeInfo(p.module, typ, a.lode.info)
|
||||||
if bt.destructor != nil:
|
if bt.destructor != nil and not trivialDestructor(bt.destructor):
|
||||||
# the prototype of a destructor is ``=destroy(x: var T)`` and that of a
|
# the prototype of a destructor is ``=destroy(x: var T)`` and that of a
|
||||||
# finalizer is: ``proc (x: ref T) {.nimcall.}``. We need to check the calling
|
# finalizer is: ``proc (x: ref T) {.nimcall.}``. We need to check the calling
|
||||||
# convention at least:
|
# convention at least:
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,8 @@ when defined(boehmgc):
|
||||||
if result == nil: raiseOutOfMem()
|
if result == nil: raiseOutOfMem()
|
||||||
proc alloc0(size: Natural): pointer =
|
proc alloc0(size: Natural): pointer =
|
||||||
result = alloc(size)
|
result = alloc(size)
|
||||||
proc realloc(p: pointer, newsize: Natural): pointer =
|
proc realloc(p: pointer, newSize: Natural): pointer =
|
||||||
result = boehmRealloc(p, newsize)
|
result = boehmRealloc(p, newSize)
|
||||||
if result == nil: raiseOutOfMem()
|
if result == nil: raiseOutOfMem()
|
||||||
proc dealloc(p: pointer) = boehmDealloc(p)
|
proc dealloc(p: pointer) = boehmDealloc(p)
|
||||||
|
|
||||||
|
|
@ -122,8 +122,8 @@ when defined(boehmgc):
|
||||||
if result == nil: raiseOutOfMem()
|
if result == nil: raiseOutOfMem()
|
||||||
proc allocShared0(size: Natural): pointer =
|
proc allocShared0(size: Natural): pointer =
|
||||||
result = allocShared(size)
|
result = allocShared(size)
|
||||||
proc reallocShared(p: pointer, newsize: Natural): pointer =
|
proc reallocShared(p: pointer, newSize: Natural): pointer =
|
||||||
result = boehmRealloc(p, newsize)
|
result = boehmRealloc(p, newSize)
|
||||||
if result == nil: raiseOutOfMem()
|
if result == nil: raiseOutOfMem()
|
||||||
proc deallocShared(p: pointer) = boehmDealloc(p)
|
proc deallocShared(p: pointer) = boehmDealloc(p)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue