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
+1 -4
View File
@@ -242,9 +242,6 @@ namespace {
if (d.type.kind == TypeKind::FbUser || d.type.kind == TypeKind::FbBuiltin) {
continue;
}
if (r > 255) {
return fail("register overflow in function '" + pou.name + "'");
}
f->regs[d.name] = r++;
}
}
@@ -660,8 +657,8 @@ namespace {
case BinOp::Le: return isa::Op::CMP_LE;
case BinOp::Gt: return isa::Op::CMP_GT;
case BinOp::Ge: return isa::Op::CMP_GE;
default: return isa::Op::CMP_EQ; // Add/Sub/Mul/Div 不经此函数
}
return isa::Op::CMP_EQ;
}
/**