/* * 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 #include #include 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 };