diff --git a/crates/oxide_vm/tests/builtins_boolean_tests.rs b/crates/oxide_vm/tests/builtins_boolean_tests.rs index bcb6bf50..51b02b43 100644 --- a/crates/oxide_vm/tests/builtins_boolean_tests.rs +++ b/crates/oxide_vm/tests/builtins_boolean_tests.rs @@ -2,6 +2,7 @@ use std::sync::Arc; use oxide_builtins::boolean::{boolean_constructor, boolean_prototype_to_string, boolean_prototype_value_of}; use oxide_compiler::compiler::Compiler; +use oxide_runtime_api::VmHost; use oxide_types::object::JsObject; use oxide_types::value::JsValue; use oxide_vm::vm::Vm; @@ -29,7 +30,8 @@ fn bool_ctor_call(vm: &mut Vm, arg: JsValue) -> JsValue { fn bool_ctor_new(vm: &mut Vm, arg: JsValue) -> JsValue { let proto_ptr = vm.session().builtin_world().boolean_proto.as_ptr() as *mut JsObject; let wrapper = JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::from_js_object(proto_ptr)); - let ptr = vm.epoch().alloc(wrapper); + // 统一入口分配:epoch 置位与对象表登记一步闭合,执行期晋升收集按表取活。 + let ptr = vm.alloc_object(wrapper); let val = JsValue::from_js_object(ptr); vm.set_reg(0, val); vm.set_reg(1, arg); diff --git a/crates/oxide_vm/tests/builtins_map_tests.rs b/crates/oxide_vm/tests/builtins_map_tests.rs index c7d0d701..379c0592 100644 --- a/crates/oxide_vm/tests/builtins_map_tests.rs +++ b/crates/oxide_vm/tests/builtins_map_tests.rs @@ -3,6 +3,7 @@ use std::sync::Arc; use oxide_builtins::map::{map_clear, map_constructor as new_map, map_delete, map_get, map_has, map_set, map_size}; use oxide_compiler::compiler::Compiler; use oxide_kernel::shape_forge::EMPTY_SHAPE_ID; +use oxide_runtime_api::VmHost; use oxide_types::object::JsObject; use oxide_types::value::JsValue; use oxide_vm::vm::Vm; @@ -21,9 +22,8 @@ fn str_val(vm: &Vm, val: JsValue) -> String { /// 分配一个原型指向 Map.prototype 的占位对象并写入 reg 0,作为构造器调用的 `this`。 fn map_this(vm: &mut Vm) -> JsValue { let proto = vm.session().builtin_world().map_proto.as_ptr() as *mut JsObject; - let obj = vm - .epoch() - .alloc(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::from_js_object(proto))); + // 统一入口分配:epoch 置位与对象表登记一步闭合,执行期晋升收集按表取活。 + let obj = vm.alloc_object(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::from_js_object(proto))); let val = JsValue::from_js_object(obj); vm.set_reg(0, val); val diff --git a/crates/oxide_vm/tests/builtins_set_tests.rs b/crates/oxide_vm/tests/builtins_set_tests.rs index d4708bc1..6306cbf7 100644 --- a/crates/oxide_vm/tests/builtins_set_tests.rs +++ b/crates/oxide_vm/tests/builtins_set_tests.rs @@ -3,6 +3,7 @@ use std::sync::Arc; use oxide_builtins::set::{set_add, set_clear, set_constructor as new_set, set_delete, set_has, set_size}; use oxide_compiler::compiler::Compiler; use oxide_kernel::shape_forge::EMPTY_SHAPE_ID; +use oxide_runtime_api::VmHost; use oxide_types::object::JsObject; use oxide_types::value::JsValue; use oxide_vm::vm::Vm; @@ -17,9 +18,8 @@ fn eval(vm: &mut Vm, source: &str) -> Result { /// 分配一个原型指向 Set.prototype 的占位对象并写入 reg 0,作为构造器调用的 `this`。 fn set_this(vm: &mut Vm) -> JsValue { let proto = vm.session().builtin_world().set_proto.as_ptr() as *mut JsObject; - let obj = vm - .epoch() - .alloc(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::from_js_object(proto))); + // 统一入口分配:epoch 置位与对象表登记一步闭合,执行期晋升收集按表取活。 + let obj = vm.alloc_object(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::from_js_object(proto))); let val = JsValue::from_js_object(obj); vm.set_reg(0, val); val