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

Method compile_stdlib_objects

src/compilation_pipeline.rs:1239–1260  ·  view source on GitHub ↗

Compile the stdlib for `mode` as independent per-module objects (no source concatenation), to link alongside the user program. Kernel gets its prefix.

(
        mode: TargetMode,
    )

Source from the content-addressed store, hash-verified

1237 -> Result<Vec<(String, AssembledOutput)>, CompilationError> {
1238 let mut pipeline = CompilationPipeline::new();
1239 pipeline.set_target_mode(TargetMode::Kernel);
1240 pipeline.set_write_artifacts(false);
1241 pipeline.set_type_prelude(hll_to_ir::stdlib::get_stdlib_type_prelude());
1242 pipeline.set_string_prefix(Some("__kern_str_".to_owned()));
1243 pipeline.set_module_mangling(false);
1244 pipeline.set_current_source_path(bundled_module_path("my_kernel"));
1245 pipeline.compile_program_closure("my_kernel", os_runtime::kernel::MY_KERNEL)
1246 }
1247}
1248
1249/// Bundled HLL modules addressable by `import("name")` in host builds.
1250pub fn bundled_module_source(name: &str) -> Option<&'static str> {
1251 os_runtime::module_source(name).or_else(|| crate::userspace::module_source(name))
1252}
1253
1254// Repo-relative source path of a bundled module, mirroring `bundled_module_source`.
1255fn bundled_module_path(name: &str) -> Option<&'static str> {
1256 os_runtime::module_path(name).or_else(|| crate::userspace::module_path(name))
1257}
1258
1259fn module_member_aliases(
1260 alias: &str,
1261 key: &str,
1262 exports: &std::collections::HashSet<String>,
1263) -> std::collections::HashMap<String, String> {

Callers

nothing calls this directly

Calls 9

get_stdlib_type_preludeFunction · 0.85
set_write_artifactsMethod · 0.80
set_string_prefixMethod · 0.80
collectMethod · 0.80
compile_modulesMethod · 0.80
set_target_modeMethod · 0.45
set_type_preludeMethod · 0.45

Tested by

no test coverage detected