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

Function compiled_stdlib

crates/os-runtime/tests/boot.rs:151–177  ·  view source on GitHub ↗

Compile the kernel stdlib + modules as independent per-module objects (no concatenation).

()

Source from the content-addressed store, hash-verified

149 ("syscall", kernel::SYSCALL),
150 ("fs", kernel::FS),
151 ("trap_entry", kernel::TRAP_ENTRY),
152 ("trap_handler", kernel::TRAP_HANDLER),
153 ]);
154 mods
155}
156
157// Compile the kernel stdlib + modules as independent per-module objects (no concatenation).
158fn compiled_stdlib() -> &'static [(String, AssembledOutput)] {
159 STDLIB_OBJS.get_or_init(|| {
160 kernel_code_modules()
161 .iter()
162 .map(|(name, src)| {
163 let (source_prelude, module_aliases) = direct_imports(src);
164 let compiler = HllCompiler::new(CompileConfig {
165 target: TargetMode::Kernel,
166 strict: true,
167 string_prefix: Some("__kern_str_".to_owned()),
168 type_prelude: get_stdlib_type_prelude(),
169 source_prelude: Some(source_prelude),
170 module_aliases,
171 module_mangle_prefix: None,
172 source_file: Some(format!("{name}.hll")),
173 });
174 let out = compiler.compile(src).unwrap_or_else(|diags| {
175 panic!("kernel stdlib `{name}` compile failed: {diags:?}")
176 });
177 let mut rv = CompilerRv64::new();
178 let (_, tokens) = rv.compile_with_tokens(&out.ir);
179 let obj = Assembler::assemble(&tokens)
180 .unwrap_or_else(|e| panic!("stdlib `{name}` assemble failed: {e}"));

Callers 1

run_kernel_hllFunction · 0.85

Calls 6

kernel_code_modulesFunction · 0.85
direct_importsFunction · 0.85
get_stdlib_type_preludeFunction · 0.85
collectMethod · 0.80
compile_with_tokensMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected