summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-08-06 14:19:33 +0200
committerJo-Philipp Wich <jo@mein.io>2022-08-06 23:25:11 +0200
commitc9442f12ee056fd50f314408052917cc5f359bb4 (patch)
treeb3b813b7e1a1d1146a6977da4ee7b51f7067ebbd /include
parentb6fd8a2f825ba3d38137bcfbf44ef7dd09161cd2 (diff)
vm: introduce new I_DYNLOAD opcode
The I_DYNLOAD opcode is basically a bytecode level instruction for uc_require() with semantics similar to I_IMPORT. It allows loading a dynamic extension library at runtime and treating values from the resulting module context object like exports from a compile time source module. For example the statement `import { readfile, writefile } from "fs"` would import the readfile() and writefile() functions of fs.so as readonly live bindings into the current file scope. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'include')
-rw-r--r--include/ucode/vm.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/ucode/vm.h b/include/ucode/vm.h
index cc57fdb..8562524 100644
--- a/include/ucode/vm.h
+++ b/include/ucode/vm.h
@@ -97,7 +97,8 @@ __insn(NEXTK) \
__insn(NEXTKV) \
__insn(DELETE) \
__insn(IMPORT) \
-__insn(EXPORT)
+__insn(EXPORT) \
+__insn(DYNLOAD)
#undef __insn