This commit is contained in:
Nilton Constantino
2026-02-02 21:08:46 +00:00
parent 7819dd2d0a
commit 3af2aa1328
8 changed files with 109 additions and 471 deletions
+4 -11
View File
@@ -39,20 +39,13 @@ fn test_canonical_cartridge_heartbeat() {
let pbc_bytes = fs::read(pbc_path).expect("Failed to read canonical PBC. Did you run the generation test?");
// Determine numeric entrypoint PC from the compiled module exports
// Determine entrypoint from the compiled module exports
let module = BytecodeLoader::load(&pbc_bytes).expect("Failed to parse PBC");
let func_idx = module
.exports
.iter()
.find(|e| e.symbol == "src/main/modules:frame")
.map(|e| e.func_idx as usize)
.expect("Entrypoint symbol not found in exports");
let entry_pc = module.functions[func_idx].code_offset as usize;
let entry_pc_str = entry_pc.to_string();
let entry_symbol = "src/main/modules:frame";
let mut vm = VirtualMachine::new(vec![], vec![]);
vm.initialize(pbc_bytes, &entry_pc_str).expect("Failed to initialize VM with canonical cartridge");
vm.prepare_call(&entry_pc_str);
vm.initialize(pbc_bytes, entry_symbol).expect("Failed to initialize VM with canonical cartridge");
vm.prepare_call(entry_symbol);
let mut native = MockNative;
let mut hw = Hardware::new();