* bindSym power up, working prototype * update bindSym doc * add bindSym test * fix some typo * fix bindSym doc * get rid of specialops field from vm * add experimental: dynamicBindSym
This commit is contained in:
parent
674bd7bfad
commit
78c0ac5407
9 changed files with 183 additions and 13 deletions
|
|
@ -1222,9 +1222,25 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
|||
node.typ.callConv == ccClosure and node.sons[0].kind == nkNilLit and
|
||||
node.sons[1].kind == nkNilLit))
|
||||
of opcNBindSym:
|
||||
# cannot use this simple check
|
||||
# if dynamicBindSym notin c.config.features:
|
||||
|
||||
# bindSym with static input
|
||||
decodeBx(rkNode)
|
||||
regs[ra].node = copyTree(c.constants.sons[rbx])
|
||||
regs[ra].node.flags.incl nfIsRef
|
||||
of opcNDynBindSym:
|
||||
# experimental bindSym
|
||||
let
|
||||
rb = instr.regB
|
||||
rc = instr.regC
|
||||
idx = int(regs[rb+rc-1].intVal)
|
||||
callback = c.callbacks[idx].value
|
||||
args = VmArgs(ra: ra, rb: rb, rc: rc, slots: cast[pointer](regs),
|
||||
currentException: c.currentExceptionB,
|
||||
currentLineInfo: c.debug[pc])
|
||||
callback(args)
|
||||
regs[ra].node.flags.incl nfIsRef
|
||||
of opcNChild:
|
||||
decodeBC(rkNode)
|
||||
let idx = regs[rc].intVal.int
|
||||
|
|
@ -1773,7 +1789,7 @@ proc getGlobalValue*(c: PCtx; s: PSym): PNode =
|
|||
|
||||
include vmops
|
||||
|
||||
proc setupGlobalCtx(module: PSym; graph: ModuleGraph) =
|
||||
proc setupGlobalCtx*(module: PSym; graph: ModuleGraph) =
|
||||
if graph.vm.isNil:
|
||||
graph.vm = newCtx(module, graph.cache, graph)
|
||||
registerAdditionalOps(PCtx graph.vm)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue