MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / run_hll_optimize

Function run_hll_optimize

tests/integration/vm_execution.rs:363–381  ·  view source on GitHub ↗

Compile a user program with IR optimization on or off, returning the VM run (exit outcome + UART) and the emitted instruction count.

(src: &str, opts: hll_to_ir::OptOptions)

Source from the content-addressed store, hash-verified

361 let primary = r#"
362boxlib := import("boxlib")
363main: () -> i32 {
364 holder: boxlib.Box<i32> = { .value = 42 }
365 return boxlib.unwrap<i32>(&holder)
366}
367"#;
368 let closure = pipeline
369 .compile_program_closure("user", primary)
370 .expect("closure compile failed");
371
372 let mut modules: Vec<(&str, &AssembledOutput)> = cached_stdlib_objs()
373 .iter()
374 .map(|(n, o)| (n.as_str(), o))
375 .collect();
376 for (name, obj) in &closure {
377 modules.push((name.as_str(), obj));
378 }
379 let assembled = pipeline
380 .link_assembled_objects(&modules)
381 .expect("link failed");
382 let mut vm = VirtualMachine::new(&assembled);
383 let run = vm.run(5_000_000);
384 assert!(

Calls 10

link_with_stdlibFunction · 0.85
set_write_artifactsMethod · 0.80
set_optimizeMethod · 0.80
is_codeMethod · 0.80
compileMethod · 0.45
assembleMethod · 0.45
runMethod · 0.45
cloneMethod · 0.45