aboutsummaryrefslogtreecommitdiff
path: root/private_include
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-05-22 14:04:36 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-06-12 13:38:05 +0200
commit4f9a2c7a2d8464b04cc08075a7762c6d457090df (patch)
treeae8fe229a3a5ba60d08b74299d0c1850685bda86 /private_include
parentf25b015e5b668028c34974bbb22faa4105c26690 (diff)
downloadnanowasm-sync-4f9a2c7a2d8464b04cc08075a7762c6d457090df.tar.gz
WIP
Diffstat (limited to 'private_include')
-rw-r--r--private_include/nw/interp.h4
-rw-r--r--private_include/nw/ops.h4
-rw-r--r--private_include/nw/sections.h4
-rw-r--r--private_include/nw/types.h13
4 files changed, 19 insertions, 6 deletions
diff --git a/private_include/nw/interp.h b/private_include/nw/interp.h
index 5fa37bf..c8f3249 100644
--- a/private_include/nw/interp.h
+++ b/private_include/nw/interp.h
@@ -28,12 +28,14 @@ int interp_start(const struct nw_interp_cfg *cfg, FILE *f, struct nw_interp *i);
int interp_run(struct nw_interp *i);
int interp_run_limited(struct nw_interp *i, const struct interp_set *ops);
int interp_check_opcode(uint8_t op, FILE *f);
-int interp_push(struct nw_interp *i, const struct nw_frame *f);
int interp_pop(struct nw_interp *i);
void *interp_stackptr(const struct nw_interp *i);
int interp_stack_push(struct nw_interp *i, const void *src, size_t n);
int interp_stack_pop(struct nw_interp *i, void *dst, size_t n);
int interp_heap_store(struct nw_interp *i, size_t addr, const void *src, size_t n);
int interp_heap_load(struct nw_interp *i, size_t addr, void *dst, size_t n);
+int interp_global_push(struct nw_interp *i, const void *src, size_t n);
+int interp_global_pop(struct nw_interp *i, void *dst, size_t n);
+void *interp_globalptr(const struct nw_interp *i);
#endif
diff --git a/private_include/nw/ops.h b/private_include/nw/ops.h
index 02f191e..1b977bf 100644
--- a/private_include/nw/ops.h
+++ b/private_include/nw/ops.h
@@ -11,6 +11,7 @@
#define OPS_H
#include <nanowasm/nw.h>
+#include <nw/types.h>
#include <stdio.h>
int op_unreachable(struct nw_interp *i);
@@ -66,4 +67,7 @@ int check_f32_const(FILE *f);
int check_f64_const(FILE *f);
int check_i32_sub(FILE *f);
+int locals_get(const varuint32 local_index, struct nw_interp *const i,
+ struct nw_locals **const l, varuint32 *const idx);
+
#endif
diff --git a/private_include/nw/sections.h b/private_include/nw/sections.h
index bef9cd8..e835c6d 100644
--- a/private_include/nw/sections.h
+++ b/private_include/nw/sections.h
@@ -49,9 +49,9 @@ int section_function(const struct section *s, const struct nw_mod *m,
int section_code(const struct section *s, const struct nw_mod *m,
varuint32 idx, struct section_code *c);
-int section_code_push(FILE *f, long pc, struct nw_frame *fr);
int section_type_push(FILE *f, const struct nw_mod *m, varuint32 idx,
- struct nw_frame *fr);
+ struct retval *r);
+int section_code_push(FILE *f, struct nw_interp *i);
int section_global_push(FILE *f, const struct nw_mod *m, struct nw_interp *i);
struct resizable_limits
diff --git a/private_include/nw/types.h b/private_include/nw/types.h
index 23a2306..b675611 100644
--- a/private_include/nw/types.h
+++ b/private_include/nw/types.h
@@ -48,11 +48,17 @@ struct nw_block
struct nw_block *prev;
};
+struct nw_locals
+{
+ enum value_type type;
+ unsigned long n;
+ struct nw_locals *next;
+};
+
struct nw_frame
{
- enum value_type local_type;
- unsigned long n_locals;
struct retval retval;
+ struct nw_locals *locals;
struct nw_block *last_block;
struct nw_frame *prev, *next;
};
@@ -74,8 +80,9 @@ int varint64_read(FILE *f, varint64 *out);
int get_value_type(varint7 type, enum value_type *vtype);
size_t get_type_size(enum value_type type);
+const char *value_type_tostr(enum value_type v);
int32_t htoni32(int32_t in);
-const char *value_type_tostr(enum value_type v);
+int32_t ntohi32(int32_t in);
#endif