diff options
author | Araq <rumpf_a@web.de> | 2013-12-13 21:29:35 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-12-13 21:29:35 +0100 |
commit | f095e51275a2780ac3e69509c3bb0b75c1c324fb (patch) | |
tree | 3948b967257ff8655cb22a057715be00295c1613 | |
parent | 8c553fa8a2e9476c67c6348bf64c02ea0f19a679 (diff) | |
download | Nim-f095e51275a2780ac3e69509c3bb0b75c1c324fb.tar.gz |
more tests work
-rw-r--r-- | compiler/vm.nim | 5 | ||||
-rw-r--r-- | compiler/vmdef.nim | 2 | ||||
-rw-r--r-- | compiler/vmgen.nim | 8 |
3 files changed, 10 insertions, 5 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index ef83860f7..80b8abb8b 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -802,9 +802,8 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): PNode = decodeB(nkIntLit) regs[ra].intVal = ord(regs[rb].skipMeta.kind == nkNilLit) of opcNBindSym: - # trivial implementation: - decodeB(nkMetaNode) - setMeta(regs[ra], regs[rb].skipMeta.sons[1]) + decodeBx(nkMetaNode) + setMeta(regs[ra], copyTree(c.constants.sons[rbx])) of opcNChild: decodeBC(nkMetaNode) if regs[rb].kind != nkMetaNode: diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim index b2b900f66..b4b787798 100644 --- a/compiler/vmdef.nim +++ b/compiler/vmdef.nim @@ -101,7 +101,6 @@ type opcRaise, opcNChild, opcNSetChild, - opcNBindSym, # opcodes for the AST manipulation following opcCallSite, opcNewStr, @@ -120,6 +119,7 @@ type opcAsgnConst, # dest = copy(constants[Bx]) opcLdGlobal, # dest = globals[Bx] opcLdImmInt, # dest = immediate value + opcNBindSym, opcWrGlobal, opcWrGlobalRef, opcGlobalAlias, # load an alias to a global into a register diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 654738ce4..c53d39985 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -781,7 +781,13 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) = of mNNewNimNode: genBinaryABC(c, n, dest, opcNNewNimNode) of mNCopyNimNode: genUnaryABC(c, n, dest, opcNCopyNimNode) 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 mIdentToStr: genUnaryABC(c, n, dest, opcIdentToStr) of mEqIdent: genBinaryABC(c, n, dest, opcEqIdent) |