12.9 步骤 2:VM 译码 switch(标量/跳转/LOAD-STORE)。

- Machine.cpp:create(拷贝数据段+建 MAIN 帧)、run_cycle、step、exec_one
- 标量:MOVE/LOADK(常量表 tag 定值表示)/NOT/AND/OR/四则饱和/CMP 全宽比较
- 跳转:JMP/JT/JF(相对下一条);LOAD/STORE:slot×8 定宽槽,BadSlot 校验
- 寄存器越界检查按指令形态(a|b 作偏移/槽号/常量 id 时不查)
- 修:ImageView 默认构造公开(无效态)、Codegen 两个编译警告
- 冒烟:用例 02/04/07/05 跑通、06 触发 CycleLimit、step 单步
This commit is contained in:
2026-08-21 20:16:28 +08:00
parent 815eb87a46
commit efe4dd1a2c
3 changed files with 260 additions and 7 deletions
+3 -1
View File
@@ -77,6 +77,8 @@ namespace isa {
// 只读视图:校验过的映像
class ImageView {
public:
// 默认构造为无效态(ok() == falseerror() == "uninitialized"
ImageView();
static ImageView from(const uint8_t* buf, size_t len);
static ImageView from(const std::vector<uint8_t>& buf);
@@ -96,7 +98,7 @@ namespace isa {
size_t data_len() const; // 字节数
private:
ImageView();
// 私有成员与内部构造辅助(from 使用)
const uint8_t* buf_;
size_t len_;