Skip to content

Commit

Permalink
Update remaining locations to use a &'static str for backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark McCaskey committed Jan 15, 2020
1 parent 273a630 commit 75d7f10
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
32 changes: 29 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions lib/runtime-core/src/tiering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct OptimizationState {
}

struct OptimizationOutcome {
backend_id: String,
backend_id: &'static str,
module: Module,
}

Expand All @@ -54,7 +54,7 @@ unsafe impl Sync for CtxWrapper {}

unsafe fn do_optimize(
binary: &[u8],
backend_id: String,
backend_id: &'static str,
compiler: Box<dyn Compiler>,
ctx: &Mutex<CtxWrapper>,
state: &OptimizationState,
Expand Down Expand Up @@ -87,8 +87,8 @@ pub unsafe fn run_tiering<F: Fn(InteractiveShellContext) -> ShellExitOperation>(
import_object: &ImportObject,
start_raw: extern "C" fn(&mut Ctx),
baseline: &mut Instance,
baseline_backend: String,
optimized_backends: Vec<(String, Box<dyn Fn() -> Box<dyn Compiler> + Send>)>,
baseline_backend: &'static str,
optimized_backends: Vec<(&'static str, Box<dyn Fn() -> Box<dyn Compiler> + Send>)>,
interactive_shell: F,
) -> Result<(), String> {
ensure_sighandler();
Expand Down Expand Up @@ -140,7 +140,7 @@ pub unsafe fn run_tiering<F: Fn(InteractiveShellContext) -> ShellExitOperation>(
}));

loop {
let new_optimized: Option<(String, &mut Instance)> = {
let new_optimized: Option<(&'static str, &mut Instance)> = {
let mut outcome = opt_state.outcome.lock().unwrap();
if let Some(x) = outcome.take() {
let instance = x
Expand Down
4 changes: 2 additions & 2 deletions src/bin/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,15 @@ fn execute_wasi(
&import_object,
start_raw,
&mut instance,
options.backend,
options.backend.to_string(),
options
.optimized_backends
.iter()
.map(
|&backend| -> (Backend, Box<dyn Fn() -> Box<dyn Compiler> + Send>) {
let options = options.clone();
(
backend,
backend.to_string(),
Box::new(move || {
get_compiler_by_backend(backend, &options).unwrap()
}),
Expand Down

0 comments on commit 75d7f10

Please sign in to comment.