summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-09-30 10:23:16 +0200
committerJo-Philipp Wich <jo@mein.io>2022-09-30 10:48:09 +0200
commitd64d5d685d86b38dda8a314b7d1404633e26b346 (patch)
tree963cd227a5bc82ed530fdbb985386e078dba4d4a /include
parentf4b4ded660cb6901af9c6a6548d8750b9e89982b (diff)
vm: maintain export symbol tables per program
Instead of having one global export table per VM instance maintain one table per program instance. This is required to avoid clobbering the export list in case `import` using code is loaded at runtime through `require()`, `loadfile()` etc. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'include')
-rw-r--r--include/ucode/types.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/ucode/types.h b/include/ucode/types.h
index 6041b22..bae2dd5 100644
--- a/include/ucode/types.h
+++ b/include/ucode/types.h
@@ -208,12 +208,14 @@ uc_declare_vector(uc_resource_types_t, uc_resource_type_t *);
/* Program structure definitions */
uc_declare_vector(uc_sources_t, uc_source_t *);
+uc_declare_vector(uc_modexports_t, uc_upvalref_t *);
typedef struct uc_program {
uc_value_t header;
uc_value_list_t constants;
uc_weakref_t functions;
uc_sources_t sources;
+ uc_modexports_t exports;
} uc_program_t;
@@ -277,7 +279,6 @@ typedef struct {
uc_declare_vector(uc_callframes_t, uc_callframe_t);
uc_declare_vector(uc_stack_t, uc_value_t *);
-uc_declare_vector(uc_modexports_t, uc_upvalref_t *);
typedef struct printbuf uc_stringbuf_t;
@@ -294,7 +295,7 @@ struct uc_vm {
uc_source_t *sources;
uc_weakref_t values;
uc_resource_types_t restypes;
- uc_modexports_t exports;
+ char _reserved[sizeof(uc_modexports_t)];
union {
uint32_t u32;
int32_t s32;