summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-07-22 11:10:44 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-07-22 11:10:52 +0200
commitad608838bf8c6300cb0c62338c4e95c8d2afbeec (patch)
tree17dc5c273b2cf93d2e5778bb3ce62772c4c55eb6 /lib
parent1f13e94dd0bbef5e411eabdce93314f39d1b6394 (diff)
downloadNim-ad608838bf8c6300cb0c62338c4e95c8d2afbeec.tar.gz
closures have an object type field so that we can perform correct deepCopy() for the BoehmGC target
Diffstat (limited to 'lib')
-rw-r--r--lib/system.nim4
-rw-r--r--lib/system/deepcopy.nim6
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 8f653c1e0..d62c0424e 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -413,7 +413,7 @@ type
     ## is an int type ranging from one to the maximum value
     ## of an int. This type is often useful for documentation and debugging.
 
-  RootObj* {.exportc: "TNimObject", inheritable.} =
+  RootObj* {.compilerProc, inheritable.} =
     object ## the root of Nim's object hierarchy. Objects should
            ## inherit from RootObj or one of its descendants. However,
            ## objects that have no ancestor are allowed.
@@ -3269,7 +3269,7 @@ when not defined(JS): #and not defined(nimscript):
     proc finished*[T: proc](x: T): bool {.noSideEffect, inline.} =
       ## can be used to determine if a first class iterator has finished.
       {.emit: """
-      `result` = *((NI*) `x`.ClE_0) < 0;
+      `result` = ((NI*) `x`.ClE_0)[1] < 0;
       """.}
 
 elif defined(JS):
diff --git a/lib/system/deepcopy.nim b/lib/system/deepcopy.nim
index e12f08842..65ba2278c 100644
--- a/lib/system/deepcopy.nim
+++ b/lib/system/deepcopy.nim
@@ -148,11 +148,11 @@ proc genericDeepCopyAux(dest, src: pointer, mt: PNimType; tab: var PtrTable) =
             let realType = x.typ
             sysAssert realType == mt, " types do differ"
           # this version should work for any possible GC:
-          let size = if mt.base.kind == tyObject: cast[ptr PNimType](s2)[].size else: mt.base.size
-          let z = newObj(mt, size)
+          let typ = if mt.base.kind == tyObject: cast[ptr PNimType](s2)[] else: mt.base
+          let z = newObj(mt, typ.size)
           unsureAsgnRef(cast[PPointer](dest), z)
           tab.put(s2, z)
-          genericDeepCopyAux(z, s2, mt.base, tab)
+          genericDeepCopyAux(z, s2, typ, tab)
       else:
         unsureAsgnRef(cast[PPointer](dest), z)
   of tyPtr:
2013-06-09 23:29:43 +0200 committer Araq <rumpf_a@web.de> 2013-06-09 23:29:43 +0200 implemented large parts of the 'not nil' checking' href='/ahoang/Nim/commit/tests/reject/tuninit1.nim?h=devel&id=23ef565a3c2c1f83816fefbeadb0fc59e754997d'>23ef565a3 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36