feat: 增加 CreateRegExp 字节码,正则字面量每次执行创建新对象

This commit is contained in:
爱特每羊队
2026-06-25 10:28:35 +08:00
parent 5007e7af7c
commit 1ef8349208
4 changed files with 48 additions and 5 deletions
@@ -18,7 +18,11 @@ impl Compiler {
}
pub(in crate::counter) fn count_regexp_literal(&self, ctx: &mut CompileCtx) {
ctx.alloc_reg();
ctx.alloc_reg(); // pattern reg (LOAD_CONST)
ctx.projected_pc += 1;
ctx.alloc_reg(); // flags reg (LOAD_CONST)
ctx.projected_pc += 1;
ctx.alloc_reg(); // result reg (CREATE_REGEXP)
ctx.projected_pc += 1;
}