From c1412d20faba56e2f3c21d639529cab452815691 Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Mon, 8 Jun 2026 23:33:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=BA=E6=9C=AA=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=E8=BF=94=E5=9B=9E=E6=98=BE=E5=BC=8F=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_vm/src/vm.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/crates/oxide_vm/src/vm.rs b/crates/oxide_vm/src/vm.rs index e23ee291..98266d91 100644 --- a/crates/oxide_vm/src/vm.rs +++ b/crates/oxide_vm/src/vm.rs @@ -1854,9 +1854,6 @@ impl Vm { } _ => { - if !op.is_implemented() { - return Ok(JsValue::undefined()); - } return Err(format!("opcode {op} not yet implemented")); } } @@ -2015,4 +2012,21 @@ mod tests { assert_eq!(vm.bytecode[1], ptr as u32); assert_eq!(vm.bytecode[2], (ptr as u64 >> 32) as u32); } + + #[test] + fn unimplemented_profile_opcode_fails_explicitly() { + let module = CompiledModule { + bytecode: vec![ + opcode::encode(opcode::OpCode::PROFILE_TYPE, 0, 0, 0), + opcode::encode(opcode::OpCode::HALT, 0, 0, 0), + ], + n_registers: 1, + ..CompiledModule::new() + }; + let mut vm = Vm::new(); + let err = vm + .run(&module) + .expect_err("unimplemented opcode should fail explicitly"); + assert_eq!(err, "opcode PROFILE_TYPE not yet implemented"); + } }