Skip to content
Snippets Groups Projects

Forkify fixes

Merged Xavier Routh requested to merge forkify-fixes into main
1 file
+ 36
0
Compare changes
  • Side-by-side
  • Inline
+ 36
0
@@ -146,6 +146,42 @@ pub fn run_schedule_on_hercules(
.map_err(|e| format!("Scheduling Error: {}", e))
}
pub fn run_schedule_from_file_on_hercules(
module: Module,
sched_filename: Option<String>,
) -> Result<Module, String> {
let sched = process_schedule(sched_filename)?;
// Prepare the scheduler's string table and environment
// For this, we put all of the Hercules function names into the environment
// and string table
let mut strings = StringTable::new();
let mut env = Env::new();
env.open_scope();
for (idx, func) in module.functions.iter().enumerate() {
let func_name = strings.lookup_string(func.name.clone());
env.insert(
func_name,
Value::HerculesFunction {
func: FunctionID::new(idx),
},
);
}
env.open_scope();
schedule_module(
module,
sched,
strings,
env,
JunoFunctions { func_ids: vec![] },
)
.map_err(|e| format!("Scheduling Error: {}", e))
}
pub fn schedule_hercules(
module: Module,
sched_filename: Option<String>,
Loading