diff options
author | Araq <rumpf_a@web.de> | 2014-08-12 08:47:39 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-08-12 08:47:39 +0200 |
commit | d1300de5e6ebcca1ef0a6fb0655160c2694f9571 (patch) | |
tree | fca0da739a14e2e1b9b0e0be531cb24c17a74d44 /compiler | |
parent | b8ce3a41753fa3aeeeee1e91401e9909d63cfbe7 (diff) | |
parent | 25610a2f704db32784d52b96118f164cb5113632 (diff) | |
download | Nim-d1300de5e6ebcca1ef0a6fb0655160c2694f9571.tar.gz |
Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/vm.nim | 11 | ||||
-rw-r--r-- | compiler/vmdef.nim | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index a06d10f81..e40acca6c 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -1078,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 @@ -1253,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) diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim index 873d8eebd..cad48abea 100644 --- a/compiler/vmdef.nim +++ b/compiler/vmdef.nim @@ -188,6 +188,7 @@ type features*: TSandboxFlags traceActive*: bool loopIterations*: int + comesFromHeuristic*: TLineInfo # Heuristic for better macro stack traces TPosition* = distinct int @@ -196,7 +197,8 @@ type proc newCtx*(module: PSym): PCtx = PCtx(code: @[], debug: @[], globals: newNode(nkStmtListExpr), constants: newNode(nkStmtList), types: @[], - prc: PProc(blocks: @[]), module: module, loopIterations: MaxLoopIterations) + prc: PProc(blocks: @[]), module: module, loopIterations: MaxLoopIterations, + comesFromHeuristic: unknownLineInfo()) proc refresh*(c: PCtx, module: PSym) = c.module = module |