Fixes incorrect macro stack traces.
This commit is contained in:
parent
aaf4b04203
commit
25610a2f70
2 changed files with 13 additions and 2 deletions
|
|
@ -1078,6 +1078,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
of opcNKind:
|
of opcNKind:
|
||||||
decodeB(rkInt)
|
decodeB(rkInt)
|
||||||
regs[ra].intVal = ord(regs[rb].node.kind)
|
regs[ra].intVal = ord(regs[rb].node.kind)
|
||||||
|
c.comesFromHeuristic = regs[rb].node.info
|
||||||
of opcNIntVal:
|
of opcNIntVal:
|
||||||
decodeB(rkInt)
|
decodeB(rkInt)
|
||||||
let a = regs[rb].node
|
let a = regs[rb].node
|
||||||
|
|
@ -1253,8 +1254,16 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
internalError(c.debug[pc],
|
internalError(c.debug[pc],
|
||||||
"request to create a NimNode of invalid kind")
|
"request to create a NimNode of invalid kind")
|
||||||
let cc = regs[rc].node
|
let cc = regs[rc].node
|
||||||
|
|
||||||
regs[ra].node = newNodeI(TNodeKind(int(k)),
|
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
|
regs[ra].node.flags.incl nfIsRef
|
||||||
of opcNCopyNimNode:
|
of opcNCopyNimNode:
|
||||||
decodeB(rkNode)
|
decodeB(rkNode)
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,7 @@ type
|
||||||
features*: TSandboxFlags
|
features*: TSandboxFlags
|
||||||
traceActive*: bool
|
traceActive*: bool
|
||||||
loopIterations*: int
|
loopIterations*: int
|
||||||
|
comesFromHeuristic*: TLineInfo # Heuristic for better macro stack traces
|
||||||
|
|
||||||
TPosition* = distinct int
|
TPosition* = distinct int
|
||||||
|
|
||||||
|
|
@ -196,7 +197,8 @@ type
|
||||||
proc newCtx*(module: PSym): PCtx =
|
proc newCtx*(module: PSym): PCtx =
|
||||||
PCtx(code: @[], debug: @[],
|
PCtx(code: @[], debug: @[],
|
||||||
globals: newNode(nkStmtListExpr), constants: newNode(nkStmtList), types: @[],
|
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) =
|
proc refresh*(c: PCtx, module: PSym) =
|
||||||
c.module = module
|
c.module = module
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue