wasmtime: Pass around more contexts instead of fields (#1486)
* wasmtime: Pass around more contexts instead of fields This commit refactors some wasmtime internals to pass around more context-style structures rather than individual fields of each structure. The intention here is to make the addition of fields to a structure easier to plumb throughout the internals of wasmtime. Currently you need to edit lots of functions to pass lots of parameters, but ideally after this you'll only need to edit one or two struct fields and then relevant locations have access to the information already. Updates in this commit are: * `debug_info` configuration is now folded into `Tunables`. Additionally a `wasmtime::Config` now holds a `Tunables` directly and is passed into an internal `Compiler`. Eventually this should allow for direct configuration of the `Tunables` attributes from the `wasmtime` API, but no new configuration is exposed at this time. * `ModuleTranslation` is now passed around as a whole rather than passing individual components to allow access to all the fields, including `Tunables`. This was motivated by investigating what it would take to optionally allow loops and such to get interrupted, but that sort of codegen setting was currently relatively difficult to plumb all the way through and now it's hoped to be largely just an addition to `Tunables`. * Fix lightbeam compile
This commit is contained in:
@@ -62,14 +62,14 @@ pub struct ModuleEnvironment<'data> {
|
||||
|
||||
impl<'data> ModuleEnvironment<'data> {
|
||||
/// Allocates the environment data structures.
|
||||
pub fn new(target_config: TargetFrontendConfig, tunables: Tunables) -> Self {
|
||||
pub fn new(target_config: TargetFrontendConfig, tunables: &Tunables) -> Self {
|
||||
Self {
|
||||
result: ModuleTranslation {
|
||||
target_config,
|
||||
module: Module::new(),
|
||||
function_body_inputs: PrimaryMap::new(),
|
||||
data_initializers: Vec::new(),
|
||||
tunables,
|
||||
tunables: tunables.clone(),
|
||||
module_translation: None,
|
||||
},
|
||||
imports: 0,
|
||||
|
||||
Reference in New Issue
Block a user