Skip to content

Commit

Permalink
fix nim-lang#16458; make useNimRtl compile for --gc:orc (nim-lang#19512)
Browse files Browse the repository at this point in the history
* fix nim-lang#16458; make useNimRtl compile for --gc:orc/arc

* fix tests
  • Loading branch information
ringabout authored and PMunch committed Mar 28, 2022
1 parent 336ac6f commit 7d63772
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/system/mmdisp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ else:
# XXX due to bootstrapping reasons, we cannot use compileOption("gc", "stack") here
include "system/gc_regions"
elif defined(nimV2) or usesDestructors:
var allocator {.rtlThreadVar.}: MemRegion
instantiateForRegion(allocator)
when not defined(useNimRtl):
var allocator {.rtlThreadVar.}: MemRegion
instantiateForRegion(allocator)
when defined(gcHooks):
include "system/gc_hooks"
elif defined(gcMarkAndSweep):
Expand Down
4 changes: 2 additions & 2 deletions lib/system/orc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ template orcAssert(cond, msg) =
when logOrc:
proc strstr(s, sub: cstring): cstring {.header: "<string.h>", importc.}

proc nimTraceRef(q: pointer; desc: PNimTypeV2; env: pointer) {.compilerRtl, inline.} =
proc nimTraceRef(q: pointer; desc: PNimTypeV2; env: pointer) {.compilerRtl, inl.} =
let p = cast[ptr pointer](q)
if p[] != nil:

Expand All @@ -128,7 +128,7 @@ proc nimTraceRef(q: pointer; desc: PNimTypeV2; env: pointer) {.compilerRtl, inli
var j = cast[ptr GcEnv](env)
j.traceStack.add(p, desc)

proc nimTraceRefDyn(q: pointer; env: pointer) {.compilerRtl, inline.} =
proc nimTraceRefDyn(q: pointer; env: pointer) {.compilerRtl, inl.} =
let p = cast[ptr pointer](q)
if p[] != nil:
var j = cast[ptr GcEnv](env)
Expand Down
3 changes: 2 additions & 1 deletion lib/system/seqs_v2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ proc prepareSeqAdd(len: int; p: pointer; addlen, elemSize, elemAlign: int): poin

proc shrink*[T](x: var seq[T]; newLen: Natural) {.tags: [], raises: [].} =
when nimvm:
setLen(x, newLen)
{.cast(tags: []).}:
setLen(x, newLen)
else:
#sysAssert newLen <= x.len, "invalid newLen parameter for 'shrink'"
when not supportsCopyMem(T):
Expand Down
6 changes: 6 additions & 0 deletions tests/arc/t16458.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
discard """
matrix: "--gc:orc --d:useNimRtl"
action: "compile"
"""

echo 134

0 comments on commit 7d63772

Please sign in to comment.