summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-03-26 01:00:34 +0100
committerAraq <rumpf_a@web.de>2014-03-26 01:00:34 +0100
commitd15788d00a4007a80de4427f84129abe47fa4f11 (patch)
tree3dbe43bbca760f56bdb79c684f8d8af3bd60430f /compiler
parent9e66d988e7fc1f33b11a0b93be484361390bd095 (diff)
downloadNim-d15788d00a4007a80de4427f84129abe47fa4f11.tar.gz
added #903 to the test suite
Diffstat (limited to 'compiler')
-rw-r--r--compiler/vm.nim6
-rw-r--r--compiler/vmdef.nim1
-rw-r--r--compiler/vmgen.nim2
3 files changed, 7 insertions, 2 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 8fea6b293..268289aca 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -448,7 +448,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
         let n = src.sons[rc]
         regs[ra].node = n
       else:
-        stackTrace(c, tos, pc, errIndexOutOfBounds)
+        stackTrace(c, tos, pc, errNilAccess)
     of opcWrObj:
       # a.b = c
       decodeBC(rkNode)
@@ -902,6 +902,10 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
       let rb = instr.regBx - wordExcess - 1
       ensureKind(rkNode)
       regs[ra].node = c.globals.sons[rb]
+    of opcLdGlobalAddr:
+      let rb = instr.regBx - wordExcess - 1
+      ensureKind(rkNodeAddr)
+      regs[ra].nodeAddr = addr(c.globals.sons[rb])
     of opcRepr:
       decodeB(rkNode)
       createStr regs[ra]
diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim
index 90ff8e29f..d0c38a2ad 100644
--- a/compiler/vmdef.nim
+++ b/compiler/vmdef.nim
@@ -126,6 +126,7 @@ type
     opcLdConst,   # dest = constants[Bx]
     opcAsgnConst, # dest = copy(constants[Bx])
     opcLdGlobal,  # dest = globals[Bx]
+    opcLdGlobalAddr, # dest = addr(globals[Bx])
 
     opcLdImmInt,  # dest = immediate value
     opcNBindSym,
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index 59d3d2495..e627fee48 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -1614,7 +1614,7 @@ proc genProc(c: PCtx; s: PSym): int =
     c.gABC(body, opcEof, eofInstr.regA)
     c.optimizeJumps(result)
     s.offset = c.prc.maxSlots
-    #if s.name.s == "tupleUnpack":
+    #if s.name.s == "addStuff":
     #  echo renderTree(body)
     #  c.echoCode(result)
     c.prc = oldPrc