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

Function run_hll_with_limit

tests/integration/vm_execution.rs:41–58  ·  view source on GitHub ↗

Compile user HLL, link it against the cached stdlib object, and run in the VM.

(src: &str, max_steps: u64)

Source from the content-addressed store, hash-verified

39// Compile user HLL, link it against the cached stdlib object, and run in the VM.
40fn run_hll_with_limit(src: &str, max_steps: u64) -> (VirtualMachine, StepOutcome, String) {
41 let mut pipeline = CompilationPipeline::new();
42 pipeline.set_write_artifacts(false);
43
44 let user_result = pipeline.compile(src).expect("user compile failed");
45 let (_, user_tokens) = pipeline.compile_ir_to_assembly_with_tokens(&user_result.ir_program);
46 let user_obj = pipeline
47 .assemble(&user_tokens)
48 .expect("user assemble failed");
49
50 let assembled = pipeline
51 .link_assembled_objects(&link_with_stdlib(&user_obj))
52 .expect("link failed");
53 let mut vm = VirtualMachine::new(&assembled);
54 let run = vm.run(max_steps);
55 let uart = run.uart_output.clone();
56 (vm, run.outcome, uart)
57}
58
59// Runs a directly-constructed IR program, for ops the HLL surface cannot spell.
60fn run_ir(program: &IrProgram) -> (VirtualMachine, StepOutcome, String) {
61 let mut pipeline = CompilationPipeline::new();

Callers 2

run_hll_fileFunction · 0.85
run_hllFunction · 0.85

Calls 8

link_with_stdlibFunction · 0.85
set_write_artifactsMethod · 0.80
compileMethod · 0.45
assembleMethod · 0.45
runMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected