Code review feedback.
* Remove `Config::for_target` in favor of setter `Config::target`. * Remove explicit setting of Cranelift flags in `Config::new` in favor of calling the `Config` methods that do the same thing. * Serialize the package version independently of the data when serializing a module. * Use struct deconstructing in module serialization to ensure tunables and features aren't missed. * Move common log initialization in the CLI into `CommonOptions`.
This commit is contained in:
22
src/lib.rs
22
src/lib.rs
@@ -196,12 +196,24 @@ struct CommonOptions {
|
||||
}
|
||||
|
||||
impl CommonOptions {
|
||||
fn config(&self, target: Option<&str>) -> Result<Config> {
|
||||
let mut config = if let Some(target) = target {
|
||||
Config::for_target(target)?
|
||||
fn init_logging(&self) {
|
||||
if self.disable_logging {
|
||||
return;
|
||||
}
|
||||
if self.log_to_files {
|
||||
let prefix = "wasmtime.dbg.";
|
||||
init_file_per_thread_logger(prefix);
|
||||
} else {
|
||||
Config::new()
|
||||
};
|
||||
pretty_env_logger::init();
|
||||
}
|
||||
}
|
||||
fn config(&self, target: Option<&str>) -> Result<Config> {
|
||||
let mut config = Config::new();
|
||||
|
||||
// Set the target before setting any cranelift options
|
||||
if let Some(target) = target {
|
||||
config.target(target)?;
|
||||
}
|
||||
|
||||
config
|
||||
.cranelift_debug_verifier(self.enable_cranelift_debug_verifier)
|
||||
|
||||
Reference in New Issue
Block a user