Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #16458; make useNimRtl compile for --gc:orc #19512

Merged
merged 2 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Comment on lines +85 to +87
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refc uses this condition too =>

when not defined(useNimRtl):

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