summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-04-03 22:51:22 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-04-03 22:51:22 +0200
commit6e53300f83dc7646fbad834c494c34470a393885 (patch)
treebe91793e2cbf40d786aaa6c543da0526ac2aff1a /compiler
parent5757ad858cfa86b47a02a0389d3257c3284e1dbb (diff)
downloadNim-6e53300f83dc7646fbad834c494c34470a393885.tar.gz
fixes #3973
Diffstat (limited to 'compiler')
-rw-r--r--compiler/vm.nim7
-rw-r--r--compiler/vmgen.nim2
2 files changed, 6 insertions, 3 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index 7220e1b8e..7be208089 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -10,7 +10,9 @@
 ## This file implements the new evaluation engine for Nim code.
 ## An instruction is 1-3 int32s in memory, it is a register based VM.
 
-const debugEchoCode = false
+const
+  debugEchoCode = false
+  traceCode = debugEchoCode
 
 import ast except getstr
 
@@ -404,7 +406,8 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
     let instr = c.code[pc]
     let ra = instr.regA
     #if c.traceActive:
-    #echo "PC ", pc, " ", c.code[pc].opcode, " ra ", ra, " rb ", instr.regB, " rc ", instr.regC
+    when traceCode:
+      echo "PC ", pc, " ", c.code[pc].opcode, " ra ", ra, " rb ", instr.regB, " rc ", instr.regC
     #  message(c.debug[pc], warnUser, "Trace")
 
     case instr.opcode
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index 47f16a013..43c7ca2db 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -1447,12 +1447,12 @@ proc getNullValue(typ: PType, info: TLineInfo): PNode =
   of tyObject:
     result = newNodeIT(nkObjConstr, info, t)
     result.add(newNodeIT(nkEmpty, info, t))
-    getNullValueAux(t.n, result)
     # initialize inherited fields:
     var base = t.sons[0]
     while base != nil:
       getNullValueAux(skipTypes(base, skipPtrs).n, result)
       base = base.sons[0]
+    getNullValueAux(t.n, result)
   of tyArray, tyArrayConstr:
     result = newNodeIT(nkBracket, info, t)
     for i in countup(0, int(lengthOrd(t)) - 1):