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/vmdef.nim | |
parent | 6db20a4be8556621b3a33f87854b4b857c4dcf9e (diff) | |
download | Nim-328f1932925889d5bb7f91c68fb1504b9b26ba8c.tar.gz |
new VM: globals kinda work
Diffstat (limited to 'compiler/vmdef.nim')
-rw-r--r-- | compiler/vmdef.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim index e31dc9de6..b2b900f66 100644 --- a/compiler/vmdef.nim +++ b/compiler/vmdef.nim @@ -122,6 +122,7 @@ type opcLdImmInt, # dest = immediate value opcWrGlobal, opcWrGlobalRef, + opcGlobalAlias, # load an alias to a global into a register opcGlobalOnce, # used to introduce an assignment to a global once opcSetType, # dest.typ = types[Bx] opcTypeTrait @@ -162,6 +163,8 @@ type blocks*: seq[TBlock] # blocks; temp data structure slots*: array[TRegister, tuple[inUse: bool, kind: TSlotKind]] maxSlots*: int + globals*: array[TRegister, int] # hack: to support passing globals byref + # we map a slot persistently to a global PCtx* = ref TCtx TCtx* = object of passes.TPassContext # code gen context @@ -185,7 +188,7 @@ type proc newCtx*(module: PSym): PCtx = PCtx(code: @[], debug: @[], - globals: newNode(nkStmtList), constants: newNode(nkStmtList), types: @[], + globals: newNode(nkStmtListExpr), constants: newNode(nkStmtList), types: @[], prc: PProc(blocks: @[]), module: module) proc refresh*(c: PCtx, module: PSym) = |