newruntime: make 'discard new RootObj' work
This commit is contained in:
parent
b350a9fc52
commit
8e27bddb97
2 changed files with 4 additions and 3 deletions
|
|
@ -227,8 +227,9 @@ proc blockLeaveActions(p: BProc, howManyTrys, howManyExcepts: int) =
|
||||||
if not p.module.compileToCpp or optNoCppExceptions in p.config.globalOptions:
|
if not p.module.compileToCpp or optNoCppExceptions in p.config.globalOptions:
|
||||||
# Pop exceptions that was handled by the
|
# Pop exceptions that was handled by the
|
||||||
# except-blocks we are in
|
# except-blocks we are in
|
||||||
for i in countdown(howManyExcepts-1, 0):
|
if not p.noSafePoints:
|
||||||
linefmt(p, cpsStmts, "#popCurrentException();$n", [])
|
for i in countdown(howManyExcepts-1, 0):
|
||||||
|
linefmt(p, cpsStmts, "#popCurrentException();$n", [])
|
||||||
|
|
||||||
proc genGotoState(p: BProc, n: PNode) =
|
proc genGotoState(p: BProc, n: PNode) =
|
||||||
# we resist the temptation to translate it into duff's device as it later
|
# we resist the temptation to translate it into duff's device as it later
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ proc nimNewObj(size: int): pointer {.compilerRtl.} =
|
||||||
discard
|
discard
|
||||||
elif defined(useMalloc):
|
elif defined(useMalloc):
|
||||||
var orig = c_malloc(s)
|
var orig = c_malloc(s)
|
||||||
nimZeroMem(result, s)
|
nimZeroMem(orig, s)
|
||||||
result = orig +! sizeof(RefHeader)
|
result = orig +! sizeof(RefHeader)
|
||||||
else:
|
else:
|
||||||
result = alloc0(s) +! sizeof(RefHeader)
|
result = alloc0(s) +! sizeof(RefHeader)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue