mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
* fix #16458; make useNimRtl compile for --gc:orc/arc * fix tests
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
6
tests/arc/t16458.nim
Normal file
6
tests/arc/t16458.nim
Normal file
@@ -0,0 +1,6 @@
|
||||
discard """
|
||||
matrix: "--gc:orc --d:useNimRtl"
|
||||
action: "compile"
|
||||
"""
|
||||
|
||||
echo 134
|
||||
Reference in New Issue
Block a user