diff --git a/vm/src/Machine.cpp b/vm/src/Machine.cpp index e5b1b71..52ccf6e 100644 --- a/vm/src/Machine.cpp +++ b/vm/src/Machine.cpp @@ -351,6 +351,25 @@ bool Machine::exec_one() { } return true; } + if (std::strcmp(name, "LOAD_PTR") == 0) { + // 基址寻址:rs1 寄存器 = 值区地址(实例指针)+ 偏移,跳过槽表直读 + const uint32_t base = static_cast(fr.regs[d.rs1]); + if (!read_value(base + static_cast(d.off_hi), func, &v1)) { + fault_ = Fault::BadSlot; + return false; + } + fr.regs[d.rd] = v1; + return true; + } + if (std::strcmp(name, "STORE_PTR") == 0) { + const uint32_t base = static_cast(fr.regs[d.rs1]); + if (!write_value(base + static_cast(d.off_hi), func, + fr.regs[d.rd])) { + fault_ = Fault::BadSlot; + return false; + } + return true; + } if (std::strcmp(name, "NOT") == 0) { // 逻辑非(恒产 0/1):BOOL 域语义;位串逐位取反需专用指令(v1 无) fr.regs[d.rd] = (fr.regs[d.rs1] == 0) ? 1 : 0;