Merge remote-tracking branch 'origin/master' into feature/unified-exceptions

This commit is contained in:
losfair
2020-01-16 03:01:21 +08:00
8 changed files with 24 additions and 18 deletions

View File

@ -92,7 +92,7 @@ pub trait ModuleCodeGenerator<FCG: FunctionCodeGenerator<E>, RM: RunnableModule,
) -> Self;
/// Returns the backend id associated with this MCG.
fn backend_id() -> String;
fn backend_id() -> &'static str;
/// It sets if the current compiler requires validation before compilation
fn requires_pre_validation() -> bool {
@ -231,7 +231,7 @@ impl<
validate_with_features(wasm, &compiler_config.features)?;
}
let mut mcg = match MCG::backend_id().as_ref() {
let mut mcg = match MCG::backend_id() {
"llvm" => MCG::new_with_target(
compiler_config.triple.clone(),
compiler_config.cpu_name.clone(),

View File

@ -82,7 +82,7 @@ pub fn read_module<
func_assoc: Map::new(),
signatures: Map::new(),
backend: MCG::backend_id(),
backend: MCG::backend_id().to_string(),
namespace_table: StringTable::new(),
name_table: StringTable::new(),

View File

@ -186,7 +186,7 @@ pub struct CodeVersion {
pub base: usize,
/// The backend used to compile this module.
pub backend: String,
pub backend: &'static str,
/// `RunnableModule` for this code version.
pub runnable_module: Arc<Box<dyn RunnableModule>>,

View File

@ -43,7 +43,7 @@ struct OptimizationState {
}
struct OptimizationOutcome {
backend_id: String,
backend_id: &'static str,
module: Module,
}
@ -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,
@ -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();
@ -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