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

Function run_hll

tests/integration/platform_stdlib.rs:17–37  ·  view source on GitHub ↗
(src: &str)

Source from the content-addressed store, hash-verified

15));
16
17fn run_hll(src: &str) -> (String, Option<i64>) {
18 let mut pipeline = CompilationPipeline::new();
19 pipeline.set_write_artifacts(false);
20
21 let stdlib_objs =
22 CompilationPipeline::compile_stdlib_objects(TargetMode::Hosted).expect("stdlib compile");
23 let user = pipeline.compile(src).expect("user compile");
24 let (_, user_tokens) = pipeline.compile_ir_to_assembly_with_tokens(&user.ir_program).expect("valid IR layout");
25 let user_obj = pipeline.assemble(&user_tokens).expect("user assemble");
26 let mut modules: Vec<(&str, &AssembledOutput)> =
27 stdlib_objs.iter().map(|(n, o)| (n.as_str(), o)).collect();
28 modules.push(("user", &user_obj));
29 let assembled = pipeline.link_assembled_objects(&modules).expect("link");
30 let mut vm = VirtualMachine::new(&assembled);
31 let run = vm.run(5_000_000);
32 let exit = match run.outcome {
33 StepOutcome::Halted(code) => Some(code),
34 _ => None,
35 };
36 (run.uart_output, exit)
37}
38
39#[test]
40fn freestanding_stdlib_compiles_as_separate_modules() {

Callers 7

run_withFunction · 0.70
memset_fills_bufferFunction · 0.70
memcpy_copies_bytesFunction · 0.70

Calls 9

compile_stdlib_objectsFunction · 0.85
set_write_artifactsMethod · 0.80
collectMethod · 0.80
pushMethod · 0.80
compileMethod · 0.45
assembleMethod · 0.45
runMethod · 0.45

Tested by 6

memset_fills_bufferFunction · 0.56
memcpy_copies_bytesFunction · 0.56