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

Function cached_stdlib_objs

tests/integration/vm_execution.rs:22–28  ·  view source on GitHub ↗

The hosted stdlib is identical for every VM-execution test, so compile and assemble it exactly once for the whole suite and link each user program against the cached object. This avoids ~40 redundant stdlib compiles.

()

Source from the content-addressed store, hash-verified

20// for the suite. This avoids about 40 redundant stdlib compiles.
21fn cached_stdlib_objs() -> &'static [(String, AssembledOutput)] {
22 static STDLIB: OnceLock<Vec<(String, AssembledOutput)>> = OnceLock::new();
23 STDLIB.get_or_init(|| {
24 CompilationPipeline::compile_stdlib_objects(TargetMode::Hosted)
25 .expect("stdlib compile failed")
26 })
27}
28
29// The cached stdlib objects plus the user object, as a link module list.
30fn link_with_stdlib<'a>(user: &'a AssembledOutput) -> Vec<(&'a str, &'a AssembledOutput)> {
31 let mut modules: Vec<(&str, &AssembledOutput)> = cached_stdlib_objs()

Calls 1

compile_stdlib_objectsFunction · 0.85