3#include <sysio/vm/opcodes.hpp>
4#include <sysio/vm/variant.hpp>
10namespace sysio {
namespace vm {
12#define MEMORY_DUMP_OP_VISIT(name, code) \
13 void operator()(const SYS_VM_OPCODE_T(name)& op) { \
14 stream << #name << "\n"; \
17#define MEMORY_DUMP_CONTROL_FLOW_VISIT(name, code) \
18 void operator()(const SYS_VM_OPCODE_T(name)& op) { \
19 stream << #name << " : { " << op.data << ", " << op.pc << ", " << op.index << ", " << op.op_index << " }\n"; \
22#define MEMORY_DUMP_BR_TABLE_VISIT(name, code) \
23 void operator()(const SYS_VM_OPCODE_T(name)& op) { \
24 stream << #name << " : { [ "; \
25 for (uint32_t i=0; i < op.size; i++) { \
26 stream << op.table[i].pc; \
27 if (i < op.size-1) { \
35#define MEMORY_DUMP_CALL_VISIT(name, code) \
36 void operator()(const name##_t& op) { \
37 stream << #name << " : { " << op.index << " }\n"; \
40#define MEMORY_DUMP_VARIABLE_ACCESS_VISIT(name, code) \
41 void operator()(const name##_t& op) { \
42 stream << #name << " : { " << op.index << " }\n"; \
45#define MEMORY_DUMP_MEMORY_VISIT(name, code) \
46 void operator()(const name##_t& op) { \
47 stream << #name << " : { " << op.flags_align << ", " << op.offset << " }\n"; \
50#define MEMORY_DUMP_CONST_VISIT(name, code) \
51 void operator()(const name##_t& op) { \
52 stream << #name << " : { " << op.data.ui << " }\n"; \
55 template <
typename Stream>
81 template <
typename Opcode>
86 template <
typename Stream>
90 for (; index < _size; index++) {
95 Opcode* _opcodes =
nullptr;
Concept for reading and writing characters.
memory_dump(Opcode *opcodes, size_t size)
void write(Stream &&stream)
constexpr auto visit(Visitor &&vis, Variant &&var)
#define T(meth, val, expected)
memory_dump_visitor(Stream &&stream, size_t &i)
#define MEMORY_DUMP_CONST_VISIT(name, code)
#define MEMORY_DUMP_CALL_VISIT(name, code)
#define MEMORY_DUMP_VARIABLE_ACCESS_VISIT(name, code)
#define MEMORY_DUMP_BR_TABLE_VISIT(name, code)
#define MEMORY_DUMP_CONTROL_FLOW_VISIT(name, code)
#define MEMORY_DUMP_OP_VISIT(name, code)
#define SYS_VM_F64_CONSTANT_OPS(opcode_macro)
#define SYS_VM_RETURN_OP(opcode_macro)
#define SYS_VM_EXIT_OP(opcode_macro)
#define SYS_VM_COMPARISON_OPS(opcode_macro)
#define SYS_VM_I64_CONSTANT_OPS(opcode_macro)
#define SYS_VM_I32_CONSTANT_OPS(opcode_macro)
#define SYS_VM_CALL_OPS(opcode_macro)
#define SYS_VM_NUMERIC_OPS(opcode_macro)
#define SYS_VM_CONVERSION_OPS(opcode_macro)
#define SYS_VM_VARIABLE_ACCESS_OPS(opcode_macro)
#define SYS_VM_EMPTY_OPS(opcode_macro)
#define SYS_VM_CALL_IMM_OPS(opcode_macro)
#define SYS_VM_CONTROL_FLOW_OPS(opcode_macro)
#define SYS_VM_ERROR_OPS(opcode_macro)
#define SYS_VM_PARAMETRIC_OPS(opcode_macro)
#define SYS_VM_F32_CONSTANT_OPS(opcode_macro)
#define SYS_VM_BR_TABLE_OP(opcode_macro)