MCPcopy Create free account
hub / github.com/WasmVM/WasmVM / run

Method run

src/lib/invoke/dispatch.cpp:22–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 case Opcode::OP: { auto& _m = std::get<WasmInstr::MemArg>(instr.imm); Instr::TYPE t{_m.memidx, _m.offset, _m.align}; operator()(t); break; }
21
22void RunVisitor::run(WasmInstr& instr) {
23 switch(instr.opcode) {
24 // --- Control: no-imm ---
25 ATOM(Unreachable, Unreachable)
26 ATOM(Nop, Nop)
27 ATOM(Else, Else)
28 ATOM(End, End)
29 ATOM(Return, Return)
30 ATOM(Throw_ref, Throw_ref)
31 // --- Control: block type ---
32 BLK(Block, Block)
33 BLK(Loop, Loop)
34 BLK(If, If)
35 // --- Control: one-index ---
36 ONE(Br, Br)
37 ONE(Br_if, Br_if)
38 ONE(Throw, Throw)
39 ONE(Call, Call)
40 ONE(Return_call, Return_call)
41 ONE(Return_call_ref, Return_call_ref)
42 ONE(Call_ref, Call_ref)
43 // --- Control: two-index ---
44 TWO(Call_indirect, Call_indirect, a, b)
45 TWO(Return_call_indirect, Return_call_indirect, a, b)
46 // --- Control: Br_table ---
47 case Opcode::Br_table: {
48 auto& bt = std::get<WasmInstr::BrTab>(instr.imm);
49 Instr::Br_table t;
50 t.indices = bt.indices;
51 operator()(t);
52 break;
53 }
54 // --- Control: Try_table ---
55 case Opcode::Try_table: {
56 auto& tt = std::get<WasmInstr::TryTab>(instr.imm);
57 Instr::Try_table t;
58 t.type = tt.type;
59 t.catches = tt.catches;
60 operator()(t);
61 break;
62 }
63
64 // --- Reference: no-imm ---
65 ATOM(Ref_is_null, Ref_is_null)
66 ATOM(Ref_eq, Ref_eq)
67 ATOM(Ref_as_non_null, Ref_as_non_null)
68 ATOM(Ref_i31, Ref_i31)
69 ATOM(I31_get_s, I31_get_s)
70 ATOM(I31_get_u, I31_get_u)
71 ATOM(Any_convert_extern, Any_convert_extern)
72 ATOM(Extern_convert_any, Extern_convert_any)
73 // --- Reference: one-index ---
74 ONE(Ref_func, Ref_func)
75 ONE(Br_on_null, Br_on_null)
76 ONE(Br_on_non_null, Br_on_non_null)
77 // --- Reference: heap-ref ---
78 case Opcode::Ref_null: {
79 auto& h = std::get<WasmInstr::HeapRef>(instr.imm);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected