diff options
author | Araq <rumpf_a@web.de> | 2013-12-13 01:21:23 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-12-13 01:21:23 +0100 |
commit | 328f1932925889d5bb7f91c68fb1504b9b26ba8c (patch) | |
tree | f26fa7993b085104fef4d54701d27eae5f40cc18 /compiler/vm.nim | |
parent | 6db20a4be8556621b3a33f87854b4b857c4dcf9e (diff) | |
download | Nim-328f1932925889d5bb7f91c68fb1504b9b26ba8c.tar.gz |
new VM: globals kinda work
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r-- | compiler/vm.nim | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index 984cc4bb8..ef83860f7 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -1027,6 +1027,9 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): PNode = if c.code[pc].opcode in {opcWrGlobal, opcWrGlobalRef} and c.code[pc].regBx == rb: break + of opcGlobalAlias: + let rb = instr.regBx - wordExcess - 1 + regs[ra] = c.globals.sons[rb] inc pc proc fixType(result, n: PNode) {.inline.} = @@ -1135,11 +1138,14 @@ proc evalMacroCall*(module: PSym, n, nOrig: PNode, sym: PSym): PNode = # setup arguments: var L = n.safeLen if L == 0: L = 1 - InternalAssert tos.slots.len >= L + # This is wrong for tests/reject/tind1.nim where the passed 'else' part + # doesn't end up in the parameter: + #InternalAssert tos.slots.len >= L # return value: tos.slots[0] = newNodeIT(nkNilLit, n.info, sym.typ.sons[0]) # setup parameters: - for i in 1 .. < L: tos.slots[i] = setupMacroParam(n.sons[i]) + for i in 1 .. < min(tos.slots.len, L): + tos.slots[i] = setupMacroParam(n.sons[i]) # temporary storage: for i in L .. <maxSlots: tos.slots[i] = newNode(nkEmpty) result = rawExecute(c, start, tos) |