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

Function cached_kernel_multi_module

tests/integration/kernel_integration.rs:46–58  ·  view source on GitHub ↗

Kernel built the way the GUI does it: each stdlib module compiled separately and linked together. This covers the separate-object link path (e.g. the "9 enable" page-fault regression) which the single-concat path does not.

()

Source from the content-addressed store, hash-verified

44 .linked
45}
46
47// Compile a catalog program the way the app boot path does. Memoized by name so
48// the many tests that rebuild `shell`/`as`/`cc`/`ld` share one compile + a clone.
49fn compile_hosted_program(name: &str) -> AssembledOutput {
50 static CACHE: OnceLock<Mutex<HashMap<String, AssembledOutput>>> = OnceLock::new();
51 let cache = CACHE.get_or_init(|| Mutex::new(HashMap::new()));
52 if let Some(out) = cache.lock().unwrap().get(name) {
53 return out.clone();
54 }
55 // Compile outside the lock so unrelated names build in parallel; a rare race
56 // just rebuilds one program twice, which is harmless.
57 let prog = user::program(name).expect("program in catalog");
58 let out = BuildExecutor::build(&BuildManifest::from_user_program(prog))
59 .expect("catalog hosted manifest build")
60 .linked;
61 cache.lock().unwrap().insert(name.to_owned(), out.clone());

Calls

no outgoing calls