/* * nanowasm, a tiny WebAssembly/Wasm interpreter * Copyright (C) 2023-2024 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 #include static void (*const ops[])(struct nw_interp *) = { [OP_UNREACHABLE] = nwp_op_unreachable, [OP_NOP] = nwp_op_nop, [OP_I32_LOAD] = nwp_op_i32_load, [OP_I32_CONST] = nwp_op_i32_const, [OP_END] = nwp_op_end, #if 0 [OP_BLOCK] = nwp_op_block, [OP_LOOP] = nwp_op_loop, [OP_IF] = nwp_op_if, [OP_ELSE] = nwp_op_else, [OP_BR] = nwp_op_br, [OP_BR_IF] = nwp_op_br_if, [OP_BR_TABLE] = nwp_op_br_table, [OP_RETURN] = nwp_op_return, [OP_CALL] = nwp_op_call, [OP_CALL_INDIRECT] = nwp_op_call_indirect, [OP_GET_LOCAL] = nwp_op_get_local, [OP_SET_LOCAL] = nwp_op_set_local, [OP_TEE_LOCAL] = nwp_op_tee_local, [OP_GET_GLOBAL] = nwp_op_get_global, [OP_SET_GLOBAL] = nwp_op_set_global, [OP_I32_STORE] = nwp_op_i32_store, [OP_I64_CONST] = nwp_op_i64_const, [OP_F32_CONST] = nwp_op_f32_const, [OP_F64_CONST] = nwp_op_f64_const, [OP_I32_SUB] = nwp_op_i32_sub #endif }; const struct nwp_ops nwp_ops = { .ops = ops, .n = sizeof ops / sizeof *ops };