Update Wasmer, log load times, some minor performance tweaks
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-12-25 11:26:14 +01:00
parent f4d09a8915
commit 055fbfba78
6 changed files with 82 additions and 13 deletions

View File

@@ -7,8 +7,8 @@ use hashbrown::{HashMap, HashSet};
use parking_lot::lock_api::RwLockReadGuard;
use parking_lot::{RawRwLock, RwLock};
use wasmer::{
AsStoreMut, AsStoreRef, Cranelift, EngineBuilder, Extern, Features, Function, FunctionEnv, Imports, Instance,
Memory, Module, Store, StoreMut, StoreRef, TypedFunction, Value,
AsStoreMut, AsStoreRef, EngineBuilder, Extern, Features, Function, FunctionEnv, Imports, Instance, Memory, Module,
Store, StoreMut, StoreRef, TypedFunction, Value,
};
use crate::dynamic_data::{ItemScript, Script, ScriptOwnerData, ScriptResolver};
@@ -52,7 +52,7 @@ struct ScriptCapabilitiesKey {
impl WebAssemblyScriptResolver {
/// Instantiates a new WebAssemblyScriptResolver.
pub fn new() -> Box<WebAssemblyScriptResolver> {
let compiler = Cranelift::default();
let compiler = wasmer::LLVM::default();
let mut features = Features::new();
features.multi_value = true;
features.reference_types = true;

View File

@@ -129,10 +129,13 @@ impl ValueIdentifiable for StringKey {
}
}
/// The difference in ascii characters to translate from uppercase to lowercase.
const CAPITAL_DIFF: u8 = b'a' - b'A';
/// Converts a character to lowercased in a const safe way.
const fn to_lower(c: u8) -> u8 {
if c >= b'A' && c <= b'Z' {
return c + (b'a' - b'A');
return c + CAPITAL_DIFF;
}
c
}