summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-11-30 21:05:45 +0800
committerGitHub <noreply@github.com>2023-11-30 14:05:45 +0100
commitb5f5b74fc8308593f04e3bc11f7c5ead24b73eb5 (patch)
treee373a39deab03649a8fbc4bed9a9c0582f48ba64 /lib
parent9140f8e2212c91347704cec0f98c0345ddf0ea1e (diff)
downloadNim-b5f5b74fc8308593f04e3bc11f7c5ead24b73eb5.tar.gz
enable vtable implementation for C++ and make it an experimental feature (#23004)
follow up https://github.com/nim-lang/Nim/pull/22991

- [x] turning it into an experimental feature

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/system.nim7
-rw-r--r--lib/system/arc.nim2
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/system.nim b/lib/system.nim
index a072c5851..4a52a0014 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1606,8 +1606,11 @@ when not defined(js) and defined(nimV2):
       traceImpl: pointer
       typeInfoV1: pointer # for backwards compat, usually nil
       flags: int
-      when defined(nimPreviewVtables) and not defined(cpp):
-        vTable: UncheckedArray[pointer] # vtable for types
+      when defined(gcDestructors):
+        when defined(cpp):
+          vTable: ptr UncheckedArray[pointer] # vtable for types
+        else:
+          vTable: UncheckedArray[pointer] # vtable for types
     PNimTypeV2 = ptr TNimTypeV2
 
 proc supportsCopyMem(t: typedesc): bool {.magic: "TypeTrait".}
diff --git a/lib/system/arc.nim b/lib/system/arc.nim
index 88d21643a..b788ac664 100644
--- a/lib/system/arc.nim
+++ b/lib/system/arc.nim
@@ -244,7 +244,7 @@ template tearDownForeignThreadGc* =
 proc isObjDisplayCheck(source: PNimTypeV2, targetDepth: int16, token: uint32): bool {.compilerRtl, inl.} =
   result = targetDepth <= source.depth and source.display[targetDepth] == token
 
-when defined(nimPreviewVtables) and not defined(cpp):
+when defined(gcDestructors):
   proc nimGetVTable(p: pointer, index: int): pointer
         {.compilerRtl, inline, raises: [].} =
     result = cast[ptr PNimTypeV2](p).vTable[index]