@@ -967,6 +967,9 @@ const struct instruction_desc instructions[256] = {
967967#endif  /* defined(TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING) */ 
968968};
969969
970+ #undef  INSTRUCTION
971+ #undef  INSTRUCTION_INDIRECT
972+ 
970973const  size_t  instructions_size  =  ARRAYCOUNT (instructions );
971974
972975#if  defined(TOYWASM_USE_SEPARATE_EXECUTE ) &&                                   \
@@ -995,6 +998,7 @@ instruction_name(const struct exec_instruction_desc *exec_table, uint32_t op)
995998#endif  /* defined(TOYWASM_USE_SEPARATE_EXECUTE) &&                            \ 
996999          defined(TOYWASM_ENABLE_TRACING_INSN) */ 
9971000
1001+ #if  0 
9981002int 
9991003fetch_exec_next_insn (const  uint8_t  * p , struct  cell  * stack ,
10001004                     struct  exec_context  * ctx )
@@ -1031,3 +1035,43 @@ fetch_exec_next_insn(const uint8_t *p, struct cell *stack,
10311035        return  desc -> process (& ctx -> p , NULL , & common_ctx );
10321036#endif 
10331037}
1038+ #else 
1039+ 
1040+ #define  INSTRUCTION (b , n , f , FLAGS )                                           \
1041+         case b:                                                               \
1042+                 __musttail return fetch_exec_##f(p, stack, ctx);
1043+ 
1044+ #define  INSTRUCTION_INDIRECT (b , n )                                            \
1045+         case b:                                                               \
1046+                 __musttail return fetch_exec_next_insn_##n(p, stack, ctx);
1047+ 
1048+ int 
1049+ fetch_exec_next_insn (const  uint8_t  * p , struct  cell  * stack ,
1050+                      struct  exec_context  * ctx )
1051+ {
1052+ #if  !(defined(TOYWASM_USE_SEPARATE_EXECUTE ) &&  defined(TOYWASM_USE_TAILCALL ))
1053+         assert (ctx -> p  ==  p );
1054+ #endif 
1055+         assert (ctx -> event  ==  EXEC_EVENT_NONE );
1056+         assert (ctx -> frames .lsize  >  0 );
1057+ #if  defined(TOYWASM_ENABLE_TRACING_INSN )
1058+         uint32_t  pc  =  ptr2pc (ctx -> instance -> module , p );
1059+ #endif 
1060+         uint32_t  op  =  * p ++ ;
1061+         xlog_trace_insn ("exec %06"  PRIx32  ": %s (%02"  PRIx32  ")" , pc ,
1062+                         instructions [op ].name , op );
1063+         switch  (op ) {
1064+ #include  "insn_list_base.h" 
1065+ #if  defined(TOYWASM_ENABLE_WASM_TAILCALL )
1066+ #include  "insn_list_tailcall.h" 
1067+ #endif  /* defined(TOYWASM_ENABLE_WASM_TAILCALL) */ 
1068+ #if  defined(TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING )
1069+ #include  "insn_list_eh.h" 
1070+ #endif  /* defined(TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING) */ 
1071+         }
1072+         __builtin_assume (false);
1073+ }
1074+ 
1075+ #undef  INSTRUCTION
1076+ #undef  INSTRUCTION_INDIRECT
1077+ #endif 
0 commit comments