refactor: 寄存器号 u8→u32 全链放宽,vreg 化去 checkpoint/reg_overflow

This commit is contained in:
2026-08-06 16:31:16 +08:00
parent 5988696f5b
commit 224d1347eb
54 changed files with 404 additions and 431 deletions
@@ -9,13 +9,13 @@ use oxide_bytecode::module::Constant;
impl Emitter {
pub(crate) fn emit_template_literal_expression(
&self, tl: &oxide_parser::TemplateLiteral, ctx: &mut CompileCtx,
) -> Result<u8, String> {
) -> Result<u32, String> {
let r = ctx.alloc_reg();
let quasis = &tl.quasis;
let expressions = &tl.expressions;
let segment_count = quasis.len() + expressions.len();
let expr_regs: Vec<u8> = expressions
let expr_regs: Vec<u32> = expressions
.iter()
.map(|e| self.emit_expression(e, ctx))
.collect::<Result<Vec<_>, _>>()?;
@@ -38,12 +38,12 @@ impl Emitter {
for const_idx in quasi_const_idxs.iter() {
parts.push(*const_idx as u32 & 0x7FFF_FFFF);
if let Some(expr_reg) = expr_iter.next() {
parts.push(0x8000_0000u32 | (*expr_reg as u32));
parts.push(0x8000_0000u32 | (*expr_reg));
}
}
ctx.inst(Inst::template_str(
Operand::Reg(r as u32),
Operand::Reg(r),
segment_count as u32,
total_len_hint as u16,
&parts,