summary refs log tree commit diff stats
path: root/compiler/vm.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r--compiler/vm.nim15
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim
index aedbb92b4..e40acca6c 100644
--- a/compiler/vm.nim
+++ b/compiler/vm.nim
@@ -87,9 +87,7 @@ proc bailOut(c: PCtx; tos: PStackFrame) =
 when not defined(nimComputedGoto):
   {.pragma: computedGoto.}
 
-proc myreset(n: var TFullReg) =
-  when defined(system.reset): 
-    reset(n)
+proc myreset(n: var TFullReg) = reset(n)
 
 template ensureKind(k: expr) {.immediate, dirty.} =
   if regs[ra].kind != k:
@@ -1080,6 +1078,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
     of opcNKind:
       decodeB(rkInt)
       regs[ra].intVal = ord(regs[rb].node.kind)
+      c.comesFromHeuristic = regs[rb].node.info
     of opcNIntVal:
       decodeB(rkInt)
       let a = regs[rb].node
@@ -1255,8 +1254,16 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
         internalError(c.debug[pc],
           "request to create a NimNode of invalid kind")
       let cc = regs[rc].node
+
       regs[ra].node = newNodeI(TNodeKind(int(k)),
-        if cc.kind == nkNilLit: c.debug[pc] else: cc.info)
+        if cc.kind != nkNilLit:
+          cc.info
+        elif c.comesFromHeuristic.line > -1:
+          c.comesFromHeuristic
+        elif c.callsite != nil and c.callsite.safeLen > 1:
+          c.callsite[1].info
+        else:
+          c.debug[pc])
       regs[ra].node.flags.incl nfIsRef
     of opcNCopyNimNode:
       decodeB(rkNode)