M new/include/viua/arch/ins.h => new/include/viua/arch/ins.h +18 -0
@@ 479,6 479,24 @@ struct LM : Instruction {
LM(viua::arch::ops::M i) : instruction{i}
{}
};
+struct AA : Instruction {
+ viua::arch::ops::M instruction;
+
+ AA(viua::arch::ops::M i) : instruction{i}
+ {}
+};
+struct AD : Instruction {
+ viua::arch::ops::M instruction;
+
+ AD(viua::arch::ops::M i) : instruction{i}
+ {}
+};
+struct PTR : Instruction {
+ viua::arch::ops::M instruction;
+
+ PTR(viua::arch::ops::M i) : instruction{i}
+ {}
+};
} // namespace viua::arch::ins
#endif
M new/include/viua/arch/ops.h => new/include/viua/arch/ops.h +8 -2
@@ 306,8 306,11 @@ enum class OPCODE : opcode_type {
DIVI = (FORMAT_R | 0x0004),
DIVIU = (FORMAT_R | 0x0004 | UNSIGNED),
- SM = (FORMAT_M | 0x0001),
- LM = (FORMAT_M | 0x0002),
+ SM = (FORMAT_M | 0x0001), /* Store Memory */
+ LM = (FORMAT_M | 0x0002), /* Load Memory */
+ AA = (FORMAT_M | 0x0003), /* Allocate Automatic */
+ AD = (FORMAT_M | 0x0004), /* Allocate Dynamic */
+ PTR = (FORMAT_M | 0x0005), /* PoinTeR */
};
auto to_string(opcode_type const) -> std::string;
auto parse_opcode(std::string_view) -> opcode_type;
@@ 395,6 398,9 @@ enum class OPCODE_N : opcode_type {
enum class OPCODE_M : opcode_type {
Make_entry(SM),
Make_entry(LM),
+ Make_entry(AA),
+ Make_entry(AD),
+ Make_entry(PTR),
};
#undef Make_entry
} // namespace viua::arch::ops
M new/include/viua/vm/ins.h => new/include/viua/vm/ins.h +3 -0
@@ 116,6 116,9 @@ Work_instruction(SELF);
Work_instruction(SM);
Work_instruction(LM);
+Work_instruction(AA);
+Work_instruction(AD);
+Work_instruction(PTR);
constexpr auto VIUA_TRACE_CYCLES = true;
auto execute(viua::vm::Stack&, viua::arch::instruction_type const* const)
M new/src/arch/ops.cpp => new/src/arch/ops.cpp +12 -0
@@ 430,6 430,12 @@ auto to_string(opcode_type const raw) -> std::string
return greedy + "sm";
case OPCODE::LM:
return greedy + "lm";
+ case OPCODE::AA:
+ return greedy + "aa";
+ case OPCODE::AD:
+ return greedy + "ad";
+ case OPCODE::PTR:
+ return greedy + "ptr";
}
return "<unknown>";
@@ 576,6 582,12 @@ auto parse_opcode(std::string_view const raw) -> opcode_type
return (op | static_cast<opcode_type>(OPCODE::SM));
} else if (sv == "lm") {
return (op | static_cast<opcode_type>(OPCODE::LM));
+ } else if (sv == "aa") {
+ return (op | static_cast<opcode_type>(OPCODE::AA));
+ } else if (sv == "ad") {
+ return (op | static_cast<opcode_type>(OPCODE::AD));
+ } else if (sv == "ptr") {
+ return (op | static_cast<opcode_type>(OPCODE::PTR));
} else {
throw std::invalid_argument{"viua::arch::ops::parse_opcode: "
+ std::string{raw}};
M new/src/vm/ins.cpp => new/src/vm/ins.cpp +12 -0
@@ 211,6 211,9 @@ auto execute(viua::vm::Stack& stack,
#define Work(OP) case OPCODE_M::OP: execute(OP{instruction}, stack, ip); break
Work(SM);
Work(LM);
+ Work(AA);
+ Work(AD);
+ Work(PTR);
#undef Work
}
break;
@@ 2091,4 2094,13 @@ auto execute(LM const op, Stack& stack, ip_type const ip) -> void
throw abort_execution{ip, "invalid unit in memory instruction: " + std::to_string(unit)};
}
}
+auto execute(AA const, Stack&, ip_type const) -> void
+{
+}
+auto execute(AD const, Stack&, ip_type const) -> void
+{
+}
+auto execute(PTR const, Stack&, ip_type const) -> void
+{
+}
} // namespace viua::vm::ins