Skip to content

Commit d7ac9fd

Browse files
committed
add insn_list_noprefix.h
1 parent a3ce43b commit d7ac9fd

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

lib/insn.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
#include "validation.h"
2828
#include "xlog.h"
2929

30+
/*
31+
* some of wasm instructions have one-byte prefix.
32+
* note: the prefix is just u8, NOT leb128.
33+
*
34+
* prefix our list of instructions
35+
* ------- ------------------------
36+
* 0xfc insn_list_fc.h
37+
* 0xfd insn_list_simd.h
38+
* 0xfe insn_list_threads.h
39+
* <none> insn_list_noprefix.h
40+
*/
41+
3042
struct exec_instruction_desc {
3143
/*
3244
* fetch_exec is called after fetching the first byte of
@@ -866,13 +878,7 @@ const static struct exec_instruction_desc
866878
#endif
867879

868880
const struct exec_instruction_desc exec_instructions[] __exec_table_align = {
869-
#include "insn_list_base.h"
870-
#if defined(TOYWASM_ENABLE_WASM_TAILCALL)
871-
#include "insn_list_tailcall.h"
872-
#endif /* defined(TOYWASM_ENABLE_WASM_TAILCALL) */
873-
#if defined(TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING)
874-
#include "insn_list_eh.h"
875-
#endif /* defined(TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING) */
881+
#include "insn_list_noprefix.h"
876882
};
877883

878884
#undef INSTRUCTION
@@ -989,13 +995,7 @@ const static struct instruction_desc instructions_fe[] = {
989995
* a few optimizations in the parser by allowing full uint8_t index.
990996
*/
991997
static const struct instruction_desc instructions[256] = {
992-
#include "insn_list_base.h"
993-
#if defined(TOYWASM_ENABLE_WASM_TAILCALL)
994-
#include "insn_list_tailcall.h"
995-
#endif /* defined(TOYWASM_ENABLE_WASM_TAILCALL) */
996-
#if defined(TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING)
997-
#include "insn_list_eh.h"
998-
#endif /* defined(TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING) */
998+
#include "insn_list_noprefix.h"
999999
};
10001000

10011001
static const size_t instructions_size = ARRAYCOUNT(instructions);

lib/insn_list_noprefix.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "insn_list_base.h"
2+
#if defined(TOYWASM_ENABLE_WASM_TAILCALL)
3+
#include "insn_list_tailcall.h"
4+
#endif /* defined(TOYWASM_ENABLE_WASM_TAILCALL) */
5+
#if defined(TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING)
6+
#include "insn_list_eh.h"
7+
#endif /* defined(TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING) */

0 commit comments

Comments
 (0)