mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
cleaned up whitespace
This commit is contained in:
@@ -239,7 +239,7 @@ proc pushSafePoint(f: PStackFrame; pc: int) =
|
||||
|
||||
proc popSafePoint(f: PStackFrame) = discard f.safePoints.pop()
|
||||
|
||||
proc cleanUpOnException(c: PCtx; tos: PStackFrame):
|
||||
proc cleanUpOnException(c: PCtx; tos: PStackFrame):
|
||||
tuple[pc: int, f: PStackFrame] =
|
||||
let raisedType = c.currentExceptionA.typ.skipTypes(abstractPtrs)
|
||||
var f = tos
|
||||
@@ -257,7 +257,7 @@ proc cleanUpOnException(c: PCtx; tos: PStackFrame):
|
||||
let exceptType = c.types[c.code[pc2].regBx-wordExcess].skipTypes(
|
||||
abstractPtrs)
|
||||
if inheritanceDiff(exceptType, raisedType) <= 0:
|
||||
# mark exception as handled but keep it in B for
|
||||
# mark exception as handled but keep it in B for
|
||||
# the getCurrentException() builtin:
|
||||
c.currentExceptionB = c.currentExceptionA
|
||||
c.currentExceptionA = nil
|
||||
@@ -349,14 +349,14 @@ proc opConv*(dest: var TFullReg, src: TFullReg, desttyp, srctyp: PType): bool =
|
||||
if dest.kind != rkFloat:
|
||||
myreset(dest); dest.kind = rkFloat
|
||||
case skipTypes(srctyp, abstractRange).kind
|
||||
of tyInt..tyInt64, tyUInt..tyUInt64, tyEnum, tyBool, tyChar:
|
||||
of tyInt..tyInt64, tyUInt..tyUInt64, tyEnum, tyBool, tyChar:
|
||||
dest.floatVal = toFloat(src.intVal.int)
|
||||
else:
|
||||
dest.floatVal = src.floatVal
|
||||
else:
|
||||
asgnComplex(dest, src)
|
||||
|
||||
proc compile(c: PCtx, s: PSym): int =
|
||||
proc compile(c: PCtx, s: PSym): int =
|
||||
result = vmgen.genProc(c, s)
|
||||
when debugEchoCode: c.echoCode result
|
||||
#c.echoCode
|
||||
@@ -396,10 +396,10 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
pc = tos.comesFrom
|
||||
tos = tos.next
|
||||
let retVal = regs[0]
|
||||
if tos.isNil:
|
||||
if tos.isNil:
|
||||
#echo "RET ", retVal.rendertree
|
||||
return retVal
|
||||
|
||||
|
||||
move(regs, tos.slots)
|
||||
assert c.code[pc].opcode in {opcIndCall, opcIndCallAsgn}
|
||||
if c.code[pc].opcode == opcIndCallAsgn:
|
||||
@@ -653,7 +653,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
of opcSubu:
|
||||
decodeBC(rkInt)
|
||||
regs[ra].intVal = regs[rb].intVal -% regs[rc].intVal
|
||||
of opcMulu:
|
||||
of opcMulu:
|
||||
decodeBC(rkInt)
|
||||
regs[ra].intVal = regs[rb].intVal *% regs[rc].intVal
|
||||
of opcDivu:
|
||||
@@ -726,7 +726,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
of opcLeSet:
|
||||
decodeBC(rkInt)
|
||||
regs[ra].intVal = ord(containsSets(regs[rb].node, regs[rc].node))
|
||||
of opcEqSet:
|
||||
of opcEqSet:
|
||||
decodeBC(rkInt)
|
||||
regs[ra].intVal = ord(equalSets(regs[rb].node, regs[rc].node))
|
||||
of opcLtSet:
|
||||
@@ -737,9 +737,9 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
of opcMulSet:
|
||||
decodeBC(rkNode)
|
||||
createSet(regs[ra])
|
||||
move(regs[ra].node.sons,
|
||||
move(regs[ra].node.sons,
|
||||
nimsets.intersectSets(regs[rb].node, regs[rc].node).sons)
|
||||
of opcPlusSet:
|
||||
of opcPlusSet:
|
||||
decodeBC(rkNode)
|
||||
createSet(regs[ra])
|
||||
move(regs[ra].node.sons,
|
||||
@@ -753,7 +753,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
decodeBC(rkNode)
|
||||
createSet(regs[ra])
|
||||
move(regs[ra].node.sons,
|
||||
nimsets.symdiffSets(regs[rb].node, regs[rc].node).sons)
|
||||
nimsets.symdiffSets(regs[rb].node, regs[rc].node).sons)
|
||||
of opcConcatStr:
|
||||
decodeBC(rkNode)
|
||||
createStr regs[ra]
|
||||
@@ -793,7 +793,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
assert c.code[pc].opcode == opcSubStr
|
||||
let rd = c.code[pc].regA
|
||||
createStr regs[ra]
|
||||
regs[ra].node.strVal = substr(regs[rb].node.strVal,
|
||||
regs[ra].node.strVal = substr(regs[rb].node.strVal,
|
||||
regs[rc].intVal.int, regs[rd].intVal.int)
|
||||
of opcParseFloat:
|
||||
decodeBC(rkInt)
|
||||
@@ -896,12 +896,12 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
# we know the next instruction is a 'fjmp':
|
||||
let branch = c.constants[instr.regBx-wordExcess]
|
||||
var cond = false
|
||||
for j in countup(0, sonsLen(branch) - 2):
|
||||
if overlap(regs[ra].regToNode, branch.sons[j]):
|
||||
for j in countup(0, sonsLen(branch) - 2):
|
||||
if overlap(regs[ra].regToNode, branch.sons[j]):
|
||||
cond = true
|
||||
break
|
||||
assert c.code[pc+1].opcode == opcFJmp
|
||||
inc pc
|
||||
inc pc
|
||||
# we skip this instruction so that the final 'inc(pc)' skips
|
||||
# the following jump
|
||||
if not cond:
|
||||
@@ -1273,7 +1273,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
of opcNSetIntVal:
|
||||
decodeB(rkNode)
|
||||
var dest = regs[ra].node
|
||||
if dest.kind in {nkCharLit..nkInt64Lit} and
|
||||
if dest.kind in {nkCharLit..nkInt64Lit} and
|
||||
regs[rb].kind in {rkInt}:
|
||||
dest.intVal = regs[rb].intVal
|
||||
else:
|
||||
@@ -1281,24 +1281,24 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
of opcNSetFloatVal:
|
||||
decodeB(rkNode)
|
||||
var dest = regs[ra].node
|
||||
if dest.kind in {nkFloatLit..nkFloat64Lit} and
|
||||
if dest.kind in {nkFloatLit..nkFloat64Lit} and
|
||||
regs[rb].kind in {rkFloat}:
|
||||
dest.floatVal = regs[rb].floatVal
|
||||
else:
|
||||
else:
|
||||
stackTrace(c, tos, pc, errFieldXNotFound, "floatVal")
|
||||
of opcNSetSymbol:
|
||||
decodeB(rkNode)
|
||||
var dest = regs[ra].node
|
||||
if dest.kind == nkSym and regs[rb].node.kind == nkSym:
|
||||
dest.sym = regs[rb].node.sym
|
||||
else:
|
||||
else:
|
||||
stackTrace(c, tos, pc, errFieldXNotFound, "symbol")
|
||||
of opcNSetIdent:
|
||||
decodeB(rkNode)
|
||||
var dest = regs[ra].node
|
||||
if dest.kind == nkIdent and regs[rb].node.kind == nkIdent:
|
||||
dest.ident = regs[rb].node.ident
|
||||
else:
|
||||
else:
|
||||
stackTrace(c, tos, pc, errFieldXNotFound, "ident")
|
||||
of opcNSetType:
|
||||
decodeB(rkNode)
|
||||
@@ -1309,7 +1309,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||
of opcNSetStrVal:
|
||||
decodeB(rkNode)
|
||||
var dest = regs[ra].node
|
||||
if dest.kind in {nkStrLit..nkTripleStrLit} and
|
||||
if dest.kind in {nkStrLit..nkTripleStrLit} and
|
||||
regs[rb].kind in {rkNode}:
|
||||
dest.strVal = regs[rb].node.strVal
|
||||
else:
|
||||
@@ -1436,7 +1436,7 @@ proc evalConstExprAux(module, prc: PSym, n: PNode, mode: TEvalMode): PNode =
|
||||
#for i in 0 .. <c.prc.maxSlots: tos.slots[i] = newNode(nkEmpty)
|
||||
result = rawExecute(c, start, tos).regToNode
|
||||
|
||||
proc evalConstExpr*(module: PSym, e: PNode): PNode =
|
||||
proc evalConstExpr*(module: PSym, e: PNode): PNode =
|
||||
result = evalConstExprAux(module, nil, e, emConst)
|
||||
|
||||
proc evalStaticExpr*(module: PSym, e: PNode, prc: PSym): PNode =
|
||||
|
||||
Reference in New Issue
Block a user