summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-07-21 16:41:46 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-07-27 14:01:28 +0200
commit25e6c53bb5575587f0ef8bb17ef4b6f25e046f3e (patch)
tree2d802179cf9c904cd5582dc458fc5bd04454fed2 /compiler
parent1a770402784ed99099f1905e1e4c201020e03bca (diff)
downloadNim-25e6c53bb5575587f0ef8bb17ef4b6f25e046f3e.tar.gz
makes the -d:nimIncremental compiler mode compile again
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rodimpl.nim40
-rw-r--r--compiler/semdata.nim2
-rw-r--r--compiler/vmdef.nim2
3 files changed, 18 insertions, 26 deletions
diff --git a/compiler/rodimpl.nim b/compiler/rodimpl.nim
index be7a601a7..70893a600 100644
--- a/compiler/rodimpl.nim
+++ b/compiler/rodimpl.nim
@@ -225,18 +225,13 @@ proc encodeType(g: ModuleGraph, t: PType, result: var string) =
     add(result, '\15')
     encodeVInt(t.destructor.id, result)
     pushSym(w, t.destructor)
-  if t.deepCopy != nil:
+  for a in t.attachedOps:
     add(result, '\16')
-    encodeVInt(t.deepcopy.id, result)
-    pushSym(w, t.deepcopy)
-  if t.assignment != nil:
-    add(result, '\17')
-    encodeVInt(t.assignment.id, result)
-    pushSym(w, t.assignment)
-  if t.sink != nil:
-    add(result, '\18')
-    encodeVInt(t.sink.id, result)
-    pushSym(w, t.sink)
+    if a == nil:
+      encodeVInt(-1, result)
+    else:
+      encodeVInt(a.id, result)
+      pushSym(w, a)
   for i, s in items(t.methods):
     add(result, '\19')
     encodeVInt(i, result)
@@ -427,8 +422,10 @@ proc storeRemaining*(g: ModuleGraph; module: PSym) =
       stillForwarded.add s
   swap w.forwardedSyms, stillForwarded
   transitiveClosure(g)
+  var nimid = 0
   for x in items(g.config.m.fileInfos):
     storeFilename(g, x.fullPath, FileIndex(nimid))
+    inc nimid
 
 # ---------------- decoder -----------------------------------
 
@@ -636,18 +633,13 @@ proc loadType(g; id: int; info: TLineInfo): PType =
   else:
     result.lockLevel = UnspecifiedLockLevel
 
-  if b.s[b.pos] == '\15':
-    inc(b.pos)
-    result.destructor = loadSym(g, decodeVInt(b.s, b.pos), info)
-  if b.s[b.pos] == '\16':
-    inc(b.pos)
-    result.deepCopy = loadSym(g, decodeVInt(b.s, b.pos), info)
-  if b.s[b.pos] == '\17':
-    inc(b.pos)
-    result.assignment = loadSym(g, decodeVInt(b.s, b.pos), info)
-  if b.s[b.pos] == '\18':
-    inc(b.pos)
-    result.sink = loadSym(g, decodeVInt(b.s, b.pos), info)
+  for a in low(result.attachedOps)..high(result.attachedOps):
+    if b.s[b.pos] == '\16':
+      inc(b.pos)
+      let id = decodeVInt(b.s, b.pos)
+      if id >= 0:
+        result.attachedOps[a] = loadSym(g, id, info)
+
   while b.s[b.pos] == '\19':
     inc(b.pos)
     let x = decodeVInt(b.s, b.pos)
@@ -842,7 +834,7 @@ proc replay(g: ModuleGraph; module: PSym; n: PNode) =
       of "error": localError(g.config, n.info, errUser, n[1].strVal)
       of "compile":
         internalAssert g.config, n.len == 3 and n[2].kind == nkStrLit
-        let cname = AbsoluteFile n[1].strVal,
+        let cname = AbsoluteFile n[1].strVal
         var cf = Cfile(nimname: splitFile(cname).name, cname: cname,
                        obj: AbsoluteFile n[2].strVal,
                        flags: {CfileFlag.External})
diff --git a/compiler/semdata.nim b/compiler/semdata.nim
index 76eb468ed..257415383 100644
--- a/compiler/semdata.nim
+++ b/compiler/semdata.nim
@@ -11,7 +11,7 @@
 
 import
   intsets, options, ast, astalgo, msgs, idents, renderer,
-  magicsys, passes, vmdef, modulegraphs, lineinfos
+  magicsys, vmdef, modulegraphs, lineinfos
 
 type
   TOptionEntry* = object      # entries to put on a stack for pragma parsing
diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim
index 425f728e7..c2645c803 100644
--- a/compiler/vmdef.nim
+++ b/compiler/vmdef.nim
@@ -10,7 +10,7 @@
 ## This module contains the type definitions for the new evaluation engine.
 ## An instruction is 1-3 int32s in memory, it is a register based VM.
 
-import ast, passes, idents, intsets, options, modulegraphs, lineinfos
+import ast, idents, intsets, options, modulegraphs, lineinfos
 
 const
   byteExcess* = 128 # we use excess-K for immediates