custom changes

This commit is contained in:
T0b1
2023-04-14 18:46:16 +02:00
parent a97e82c6e2
commit 606ae9b4d1
8 changed files with 25 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ use std::cmp::max;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use thiserror::Error;
use log::trace;
const TESTFILE_NAMESPACE: u32 = 0;
@@ -191,6 +192,7 @@ impl TestFileCompiler {
// First, rename the function
let func_original_name = func.name;
func.name = UserFuncName::User(defined_func.new_name.clone());
trace!("Rename func from '{}' to '{}'", func_original_name, func.name);
// Rename any functions that it references
// Do this in stages to appease the borrow checker
@@ -233,6 +235,10 @@ impl TestFileCompiler {
.get(&func.name)
.ok_or(anyhow!("Undeclared function {} found!", &func.name))?;
if log::log_enabled!(log::Level::Trace) {
self.ctx.set_disasm(true);
}
self.ctx.func = self.apply_func_rename(func, defined_func)?;
self.module.define_function_with_control_plane(
defined_func.func_id,
@@ -277,6 +283,11 @@ impl TestFileCompiler {
// available).
self.module.finalize_definitions()?;
for (name, func) in self.defined_functions.iter() {
let ptr = self.module.get_finalized_function(func.func_id);
trace!("Function '{}' at {:#X}", name, ptr as u64);
}
Ok(CompiledTestFile {
module: Some(self.module),
defined_functions: self.defined_functions,