diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2024-09-07 00:04:38 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-11-06 14:38:40 +0100 |
| commit | 6d9d80362f9932bbc87e162b8ef7df06c73e27e1 (patch) | |
| tree | e3e228c63fe26f07503f226de7fb5086b3dc2286 /src/routines/section/ops.c | |
| download | nanowasm-6d9d80362f9932bbc87e162b8ef7df06c73e27e1.tar.gz | |
First commit
Diffstat (limited to 'src/routines/section/ops.c')
| -rw-r--r-- | src/routines/section/ops.c | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/src/routines/section/ops.c b/src/routines/section/ops.c new file mode 100644 index 0000000..a81c8e7 --- /dev/null +++ b/src/routines/section/ops.c @@ -0,0 +1,141 @@ +/* + * nanowasm, a tiny WebAssembly/Wasm interpreter + * Copyright (C) 2023-2025 Xavier Del Campo Romero + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#include <nanowasm/nw.h> +#include <nw/ops.h> +#include <nw/opcodes.h> + +static const struct nwp_check_op ops[] = +{ + { + OP_UNREACHABLE, + OP_NOP, + nwp_op_check_no_immediate + }, + + { + OP_BLOCK, + OP_IF, + nwp_op_check_block + }, + + { + OP_ELSE, + OP_ELSE, + nwp_op_check_no_immediate + }, + + { + OP_END, + OP_END, + nwp_op_check_end + }, + + { + OP_BR, + OP_BR_IF, + nwp_op_check_relative_depth + }, + + { + OP_BR_TABLE, + OP_BR_TABLE, + nwp_op_check_br_table + }, + + { + OP_RETURN, + OP_RETURN, + nwp_op_check_no_immediate + }, + + { + OP_CALL, + OP_CALL, + nwp_op_check_call + }, + + { + OP_CALL_INDIRECT, + OP_CALL_INDIRECT, + nwp_op_check_call_indirect + }, + + { + OP_DROP, + OP_SELECT, + nwp_op_check_no_immediate + }, + + { + OP_GET_LOCAL, + OP_TEE_LOCAL, + nwp_op_check_local_index, + }, + + { + OP_GET_GLOBAL, + OP_SET_GLOBAL, + nwp_op_check_global_index + }, + + { + OP_I32_LOAD, + OP_I64_STORE32, + nwp_op_check_memory_immediate + }, + + { + OP_CURRENT_MEMORY, + OP_GROW_MEMORY, + nwp_op_check_varuint1 + }, + + { + OP_I32_CONST, + OP_I32_CONST, + nwp_op_check_varint32 + }, + + { + OP_I64_CONST, + OP_I64_CONST, + nwp_op_check_varint64 + }, + + { + OP_F32_CONST, + OP_F32_CONST, + nwp_op_check_uint32 + }, + + { + OP_F64_CONST, + OP_F64_CONST, + nwp_op_check_uint64 + }, + + { + OP_I32_EQZ, + OP_F64_PROMOTE_F32, + nwp_op_check_no_immediate + }, + + { + OP_MISC, + OP_MISC, + nwp_op_check_misc + } +}; + +const struct nwp_check_ops nwp_check_ops = +{ + ops, + sizeof ops / sizeof *ops +}; |
