Allow instance allocators control over module compilation.
This commit introduces two new methods on `InstanceAllocator`: * `validate_module` - this method is used to validate a module after translation but before compilation. It will be used for the upcoming pooling allocator to ensure a module being compiled adheres to the limits of the allocator. * `adjust_tunables` - this method is used to adjust the `Tunables` given the JIT compiler. The pooling allocator will use this to force all memories to be static during compilation.
This commit is contained in:
@@ -101,6 +101,7 @@ impl CompilationArtifacts {
|
||||
pub fn build(
|
||||
compiler: &Compiler,
|
||||
data: &[u8],
|
||||
validate: impl Fn(&ModuleTranslation) -> Result<(), String> + Sync,
|
||||
) -> Result<(usize, Vec<CompilationArtifacts>, TypeTables), SetupError> {
|
||||
let (main_module, translations, types) = ModuleEnvironment::new(
|
||||
compiler.frontend_config(),
|
||||
@@ -112,6 +113,8 @@ impl CompilationArtifacts {
|
||||
|
||||
let list = maybe_parallel!(translations.(into_iter | into_par_iter))
|
||||
.map(|mut translation| {
|
||||
validate(&translation).map_err(|e| SetupError::Validate(e))?;
|
||||
|
||||
let Compilation {
|
||||
obj,
|
||||
unwind_info,
|
||||
|
||||
Reference in New Issue
Block a user