parent
5dff66b35a
commit
23393b8478
1 changed files with 14 additions and 8 deletions
|
|
@ -523,8 +523,14 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
# Used to keep track of where the execution is resumed.
|
# Used to keep track of where the execution is resumed.
|
||||||
var savedPC = -1
|
var savedPC = -1
|
||||||
var savedFrame: PStackFrame
|
var savedFrame: PStackFrame
|
||||||
var regs: seq[TFullReg] # alias to tos.slots for performance
|
when defined(gcArc):
|
||||||
move(regs, tos.slots)
|
template updateRegsAlias = discard
|
||||||
|
template regs: untyped = tos.slots
|
||||||
|
else:
|
||||||
|
template updateRegsAlias =
|
||||||
|
move(regs, tos.slots)
|
||||||
|
var regs: seq[TFullReg] # alias to tos.slots for performance
|
||||||
|
updateRegsAlias
|
||||||
#echo "NEW RUN ------------------------"
|
#echo "NEW RUN ------------------------"
|
||||||
while true:
|
while true:
|
||||||
#{.computedGoto.}
|
#{.computedGoto.}
|
||||||
|
|
@ -550,12 +556,12 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
# Perform any cleanup action before returning
|
# Perform any cleanup action before returning
|
||||||
if newPc < 0:
|
if newPc < 0:
|
||||||
pc = tos.comesFrom
|
pc = tos.comesFrom
|
||||||
tos = tos.next
|
|
||||||
let retVal = regs[0]
|
let retVal = regs[0]
|
||||||
|
tos = tos.next
|
||||||
if tos.isNil:
|
if tos.isNil:
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
move(regs, tos.slots)
|
updateRegsAlias
|
||||||
assert c.code[pc].opcode in {opcIndCall, opcIndCallAsgn}
|
assert c.code[pc].opcode in {opcIndCall, opcIndCallAsgn}
|
||||||
if c.code[pc].opcode == opcIndCallAsgn:
|
if c.code[pc].opcode == opcIndCallAsgn:
|
||||||
regs[c.code[pc].regA] = retVal
|
regs[c.code[pc].regA] = retVal
|
||||||
|
|
@ -1245,7 +1251,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
if isClosure:
|
if isClosure:
|
||||||
newFrame.slots[rc] = TFullReg(kind: rkNode, node: regs[rb].node[1])
|
newFrame.slots[rc] = TFullReg(kind: rkNode, node: regs[rb].node[1])
|
||||||
tos = newFrame
|
tos = newFrame
|
||||||
move(regs, newFrame.slots)
|
updateRegsAlias
|
||||||
# -1 for the following 'inc pc'
|
# -1 for the following 'inc pc'
|
||||||
pc = newPc-1
|
pc = newPc-1
|
||||||
else:
|
else:
|
||||||
|
|
@ -1321,7 +1327,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
savedPC = -1
|
savedPC = -1
|
||||||
if tos != savedFrame:
|
if tos != savedFrame:
|
||||||
tos = savedFrame
|
tos = savedFrame
|
||||||
move(regs, tos.slots)
|
updateRegsAlias
|
||||||
of opcRaise:
|
of opcRaise:
|
||||||
let raised =
|
let raised =
|
||||||
# Empty `raise` statement - reraise current exception
|
# Empty `raise` statement - reraise current exception
|
||||||
|
|
@ -1347,7 +1353,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
pc = jumpTo.where - 1
|
pc = jumpTo.where - 1
|
||||||
if tos != frame:
|
if tos != frame:
|
||||||
tos = frame
|
tos = frame
|
||||||
move(regs, tos.slots)
|
updateRegsAlias
|
||||||
of ExceptionGotoFinally:
|
of ExceptionGotoFinally:
|
||||||
# Jump to the `finally` block first then re-jump here to continue the
|
# Jump to the `finally` block first then re-jump here to continue the
|
||||||
# traversal of the exception chain
|
# traversal of the exception chain
|
||||||
|
|
@ -1356,7 +1362,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
pc = jumpTo.where - 1
|
pc = jumpTo.where - 1
|
||||||
if tos != frame:
|
if tos != frame:
|
||||||
tos = frame
|
tos = frame
|
||||||
move(regs, tos.slots)
|
updateRegsAlias
|
||||||
of ExceptionGotoUnhandled:
|
of ExceptionGotoUnhandled:
|
||||||
# Nobody handled this exception, error out.
|
# Nobody handled this exception, error out.
|
||||||
bailOut(c, tos)
|
bailOut(c, tos)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue