more tests work

This commit is contained in:
Araq 2013-12-13 21:29:35 +01:00
commit f095e51275
3 changed files with 10 additions and 5 deletions

View file

@ -802,9 +802,8 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): PNode =
decodeB(nkIntLit) decodeB(nkIntLit)
regs[ra].intVal = ord(regs[rb].skipMeta.kind == nkNilLit) regs[ra].intVal = ord(regs[rb].skipMeta.kind == nkNilLit)
of opcNBindSym: of opcNBindSym:
# trivial implementation: decodeBx(nkMetaNode)
decodeB(nkMetaNode) setMeta(regs[ra], copyTree(c.constants.sons[rbx]))
setMeta(regs[ra], regs[rb].skipMeta.sons[1])
of opcNChild: of opcNChild:
decodeBC(nkMetaNode) decodeBC(nkMetaNode)
if regs[rb].kind != nkMetaNode: if regs[rb].kind != nkMetaNode:

View file

@ -101,7 +101,6 @@ type
opcRaise, opcRaise,
opcNChild, opcNChild,
opcNSetChild, opcNSetChild,
opcNBindSym, # opcodes for the AST manipulation following
opcCallSite, opcCallSite,
opcNewStr, opcNewStr,
@ -120,6 +119,7 @@ type
opcAsgnConst, # dest = copy(constants[Bx]) opcAsgnConst, # dest = copy(constants[Bx])
opcLdGlobal, # dest = globals[Bx] opcLdGlobal, # dest = globals[Bx]
opcLdImmInt, # dest = immediate value opcLdImmInt, # dest = immediate value
opcNBindSym,
opcWrGlobal, opcWrGlobal,
opcWrGlobalRef, opcWrGlobalRef,
opcGlobalAlias, # load an alias to a global into a register opcGlobalAlias, # load an alias to a global into a register

View file

@ -781,7 +781,13 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) =
of mNNewNimNode: genBinaryABC(c, n, dest, opcNNewNimNode) of mNNewNimNode: genBinaryABC(c, n, dest, opcNNewNimNode)
of mNCopyNimNode: genUnaryABC(c, n, dest, opcNCopyNimNode) of mNCopyNimNode: genUnaryABC(c, n, dest, opcNCopyNimNode)
of mNCopyNimTree: genUnaryABC(c, n, dest, opcNCopyNimTree) of mNCopyNimTree: genUnaryABC(c, n, dest, opcNCopyNimTree)
of mNBindSym: genUnaryABC(c, n, dest, opcNBindSym) of mNBindSym:
if n[1].kind in {nkClosedSymChoice, nkOpenSymChoice, nkSym}:
let idx = c.genLiteral(n[1])
if dest < 0: dest = c.getTemp(n.typ)
c.gABx(n, opcNBindSym, dest, idx)
else:
internalError(n.info, "invalid bindSym usage")
of mStrToIdent: genUnaryABC(c, n, dest, opcStrToIdent) of mStrToIdent: genUnaryABC(c, n, dest, opcStrToIdent)
of mIdentToStr: genUnaryABC(c, n, dest, opcIdentToStr) of mIdentToStr: genUnaryABC(c, n, dest, opcIdentToStr)
of mEqIdent: genBinaryABC(c, n, dest, opcEqIdent) of mEqIdent: genBinaryABC(c, n, dest, opcEqIdent)