mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-22 16:35:33 +00:00
Deny many warnings in CI; fix warnings
This commit is contained in:
5
.github/workflows/main.yaml
vendored
5
.github/workflows/main.yaml
vendored
@ -43,13 +43,18 @@ jobs:
|
||||
- run: cargo test --release
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
RUSTFLAGS: "-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects -D mutable-borrow-reservation-conflict" # TODO: add `-D missing-docs`
|
||||
- name: Build and Test C API
|
||||
run: |
|
||||
make capi
|
||||
make test-capi-cranelift
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
RUSTFLAGS: "-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects -D mutable-borrow-reservation-conflict" # TODO: add `-D missing-docs`
|
||||
if: matrix.os != 'windows-latest'
|
||||
- name: Build C API on Windows
|
||||
run: make capi
|
||||
if: matrix.os == 'windows-latest'
|
||||
env:
|
||||
RUST_BACKTRACE: 1
|
||||
RUSTFLAGS: "-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects -D mutable-borrow-reservation-conflict" # TODO: add `-D missing-docs`
|
||||
|
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -569,7 +569,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "inkwell"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/theDan64/inkwell?rev=af1846fd8aea530cef9a59170715e5c6c64346f6#af1846fd8aea530cef9a59170715e5c6c64346f6"
|
||||
source = "git+https://github.com/theDan64/inkwell?rev=1bfecc0a095d7ffdfa20a64630864f0297349508#1bfecc0a095d7ffdfa20a64630864f0297349508"
|
||||
dependencies = [
|
||||
"either",
|
||||
"inkwell_internals",
|
||||
@ -583,7 +583,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "inkwell_internals"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/theDan64/inkwell?rev=af1846fd8aea530cef9a59170715e5c6c64346f6#af1846fd8aea530cef9a59170715e5c6c64346f6"
|
||||
source = "git+https://github.com/theDan64/inkwell?rev=1bfecc0a095d7ffdfa20a64630864f0297349508#1bfecc0a095d7ffdfa20a64630864f0297349508"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
4
build.rs
4
build.rs
@ -13,10 +13,6 @@ use test_generator::{
|
||||
with_features, with_test_module, Testsuite,
|
||||
};
|
||||
|
||||
fn is_truthy_env(name: &str) -> bool {
|
||||
env::var(name).map(|n| n == "1").unwrap_or_default()
|
||||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed=tests/ignores.txt");
|
||||
|
@ -7,8 +7,7 @@ use crate::RuntimeError;
|
||||
use crate::{ExternType, FunctionType, GlobalType, MemoryType, TableType, ValType};
|
||||
use std::cmp::max;
|
||||
use std::slice;
|
||||
use wasm_common::{Bytes, HostFunction, Pages, ValueType, WasmTypeList, WithEnv, WithoutEnv};
|
||||
use wasmer_engine::Engine as _;
|
||||
use wasm_common::{HostFunction, Pages, ValueType, WasmTypeList, WithEnv, WithoutEnv};
|
||||
use wasmer_runtime::{
|
||||
wasmer_call_trampoline, Export, ExportFunction, ExportGlobal, ExportMemory, ExportTable,
|
||||
LinearMemory, MemoryError, Table as RuntimeTable, VMCallerCheckedAnyfunc, VMContext,
|
||||
|
@ -7,7 +7,7 @@ use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use thiserror::Error;
|
||||
use wasmer_compiler::{CompileError, WasmError};
|
||||
use wasmer_engine::{CompiledModule, DeserializeError, Engine, Resolver, SerializeError};
|
||||
use wasmer_engine::{CompiledModule, DeserializeError, Resolver, SerializeError};
|
||||
use wasmer_runtime::{ExportsIterator, ImportsIterator, InstanceHandle, Module as ModuleInfo};
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
@ -74,6 +74,7 @@ impl Module {
|
||||
/// let bytes: Vec<u8> = vec![];
|
||||
/// let module = Module::new(&store, bytes)?;
|
||||
/// ```
|
||||
#[allow(unreachable_code)]
|
||||
pub fn new(store: &Store, bytes: impl AsRef<[u8]>) -> Result<Module, CompileError> {
|
||||
#[cfg(feature = "wat")]
|
||||
{
|
||||
@ -206,7 +207,7 @@ impl Module {
|
||||
Ok(Self::from_compiled_module(store, compiled))
|
||||
}
|
||||
|
||||
fn from_compiled_module(store: &Store, compiled: Arc<CompiledModule>) -> Self {
|
||||
fn from_compiled_module(store: &Store, compiled: Arc<dyn CompiledModule>) -> Self {
|
||||
Module {
|
||||
store: store.clone(),
|
||||
compiled,
|
||||
|
@ -1,7 +1,9 @@
|
||||
#[cfg(all(feature = "compiler", feature = "engine"))]
|
||||
use crate::tunables::Tunables;
|
||||
use std::sync::Arc;
|
||||
#[cfg(feature = "compiler")]
|
||||
#[cfg(all(feature = "compiler", feature = "engine"))]
|
||||
use wasmer_compiler::CompilerConfig;
|
||||
|
||||
use std::sync::Arc;
|
||||
use wasmer_engine::Engine;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,3 +1,8 @@
|
||||
//! Wasmer Cranelift compiler build script.
|
||||
//!
|
||||
//! Sets the git revsion? for $PURPOSE
|
||||
//! TODO(syrus): explain what's happening here
|
||||
|
||||
use std::process::Command;
|
||||
use std::str;
|
||||
|
||||
|
@ -6,26 +6,22 @@ use crate::func_environ::{get_func_name, FuncEnvironment};
|
||||
use crate::sink::{RelocSink, TrapSink};
|
||||
use crate::trampoline::{make_wasm_trampoline, FunctionBuilderContext};
|
||||
use crate::translator::{
|
||||
compiled_function_unwind_info, irlibcall_to_libcall, irreloc_to_relocationkind,
|
||||
signature_to_cranelift_ir, transform_jump_table, FuncTranslator,
|
||||
compiled_function_unwind_info, signature_to_cranelift_ir, transform_jump_table, FuncTranslator,
|
||||
};
|
||||
use cranelift_codegen::ir::{self, ExternalName};
|
||||
use cranelift_codegen::ir;
|
||||
use cranelift_codegen::print_errors::pretty_error;
|
||||
use cranelift_codegen::{binemit, isa, Context};
|
||||
use rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
|
||||
use wasm_common::entity::{EntityRef, PrimaryMap};
|
||||
use wasm_common::entity::PrimaryMap;
|
||||
use wasm_common::{
|
||||
Features, FunctionIndex, FunctionType, LocalFunctionIndex, MemoryIndex, SignatureIndex,
|
||||
TableIndex,
|
||||
Features, FunctionType, LocalFunctionIndex, MemoryIndex, SignatureIndex, TableIndex,
|
||||
};
|
||||
use wasmer_compiler::CompileError;
|
||||
use wasmer_compiler::{
|
||||
Compilation, CompiledFunction, CompiledFunctionFrameInfo, Compiler, FunctionBody,
|
||||
FunctionBodyData, SourceLoc, TrapInformation,
|
||||
FunctionBodyData,
|
||||
};
|
||||
use wasmer_compiler::{CompilerConfig, ModuleTranslationState, Target};
|
||||
use wasmer_compiler::{Relocation, RelocationTarget};
|
||||
use wasmer_runtime::TrapCode;
|
||||
use wasmer_runtime::{MemoryPlan, Module, TablePlan};
|
||||
|
||||
/// A compiler that compiles a WebAssembly module with Cranelift, translating the Wasm to Cranelift IR,
|
||||
|
@ -1,9 +1,6 @@
|
||||
//! Support for compiling with Cranelift.
|
||||
|
||||
use crate::translator::{
|
||||
irlibcall_to_libcall, irreloc_to_relocationkind, signature_to_cranelift_ir,
|
||||
transform_jump_table, FuncTranslator,
|
||||
};
|
||||
use crate::translator::{irlibcall_to_libcall, irreloc_to_relocationkind};
|
||||
use cranelift_codegen::binemit;
|
||||
use cranelift_codegen::ir::{self, ExternalName};
|
||||
use wasm_common::entity::EntityRef;
|
||||
@ -136,7 +133,7 @@ fn translate_ir_trapcode(trap: ir::TrapCode) -> TrapCode {
|
||||
ir::TrapCode::BadConversionToInteger => TrapCode::BadConversionToInteger,
|
||||
ir::TrapCode::UnreachableCodeReached => TrapCode::UnreachableCodeReached,
|
||||
ir::TrapCode::Interrupt => TrapCode::Interrupt,
|
||||
ir::TrapCode::User(user_code) => unimplemented!("User trap code not supported"),
|
||||
ir::TrapCode::User(_user_code) => unimplemented!("User trap code not supported"),
|
||||
// ir::TrapCode::User(user_code) => TrapCode::User(user_code),
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
//! ```
|
||||
use super::binemit::TrampolineRelocSink;
|
||||
use crate::translator::{
|
||||
compiled_function_unwind_info, signature_to_cranelift_ir, transform_jump_table,
|
||||
compiled_function_unwind_info, signature_to_cranelift_ir, /*transform_jump_table, */
|
||||
};
|
||||
use cranelift_codegen::ir::InstBuilder;
|
||||
use cranelift_codegen::isa::TargetIsa;
|
||||
@ -16,7 +16,7 @@ use cranelift_codegen::Context;
|
||||
use cranelift_codegen::{binemit, ir};
|
||||
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
|
||||
use wasm_common::FunctionType;
|
||||
use wasmer_compiler::{CompileError, CompiledFunction, CompiledFunctionFrameInfo, FunctionBody};
|
||||
use wasmer_compiler::{CompileError, FunctionBody};
|
||||
|
||||
/// Create a trampoline for invoking a WebAssembly function.
|
||||
pub fn make_wasm_trampoline(
|
||||
|
@ -16,6 +16,7 @@ use wasmer_compiler::WasmResult;
|
||||
/// The value of a WebAssembly global variable.
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum GlobalVariable {
|
||||
#[allow(dead_code)]
|
||||
/// This is a constant global with a value known at compile time.
|
||||
Const(ir::Value),
|
||||
|
||||
@ -29,10 +30,12 @@ pub enum GlobalVariable {
|
||||
ty: ir::Type,
|
||||
},
|
||||
|
||||
#[allow(dead_code)]
|
||||
/// This is a global variable that needs to be handled by the environment.
|
||||
Custom,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/// How to return from functions.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum ReturnMode {
|
||||
|
@ -216,8 +216,11 @@ pub struct FuncTranslationState {
|
||||
functions: HashMap<FunctionIndex, (ir::FuncRef, usize)>,
|
||||
}
|
||||
|
||||
// TODO: review this comment it seems to be not true, `FuncTranslationState` is _not_ exposed
|
||||
// publicly from this crate.
|
||||
// Public methods that are exposed to non-`wasmer_compiler` API consumers.
|
||||
impl FuncTranslationState {
|
||||
#[allow(dead_code)]
|
||||
/// True if the current translation state expresses reachable code, false if it is unreachable.
|
||||
#[inline]
|
||||
pub fn reachable(&self) -> bool {
|
||||
|
@ -15,7 +15,7 @@ use crate::{Addend, CodeOffset, JumpTable};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
use wasm_common::entity::PrimaryMap;
|
||||
use wasm_common::{FunctionIndex, LocalFunctionIndex};
|
||||
use wasm_common::LocalFunctionIndex;
|
||||
use wasmer_runtime::libcalls::LibCall;
|
||||
|
||||
/// Relocation kinds for every ISA.
|
||||
@ -106,15 +106,15 @@ impl Relocation {
|
||||
/// The function returns the relocation address and the delta.
|
||||
pub fn for_address(&self, start: usize, target_func_address: u64) -> (usize, u64) {
|
||||
match self.kind {
|
||||
RelocationKind::Abs8 => unsafe {
|
||||
RelocationKind::Abs8 => {
|
||||
let reloc_address = start + self.offset as usize;
|
||||
let reloc_addend = self.addend as isize;
|
||||
let reloc_abs = (target_func_address)
|
||||
.checked_add(reloc_addend as u64)
|
||||
.unwrap();
|
||||
(reloc_address, reloc_abs)
|
||||
},
|
||||
RelocationKind::X86PCRel4 => unsafe {
|
||||
}
|
||||
RelocationKind::X86PCRel4 => {
|
||||
let reloc_address = start + self.offset as usize;
|
||||
let reloc_addend = self.addend as isize;
|
||||
let reloc_delta_u32 = (target_func_address as u32)
|
||||
@ -122,7 +122,7 @@ impl Relocation {
|
||||
.checked_add(reloc_addend as u32)
|
||||
.unwrap();
|
||||
(reloc_address, reloc_delta_u32 as u64)
|
||||
},
|
||||
}
|
||||
RelocationKind::X86CallPCRel4 => {
|
||||
let reloc_address = start + self.offset as usize;
|
||||
let reloc_addend = self.addend as isize;
|
||||
|
@ -2,7 +2,6 @@
|
||||
use enumset::{EnumSet, EnumSetType};
|
||||
pub use target_lexicon::{Architecture, CallingConvention, OperatingSystem, Triple};
|
||||
|
||||
use crate::std::boxed::Box;
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
use raw_cpuid::CpuId;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
use crate::WasmError;
|
||||
use thiserror::Error;
|
||||
use wasmparser::BinaryReaderError;
|
||||
|
||||
/// Return an `Err(WasmError::Unsupported(msg))` where `msg` the string built by calling `format!`
|
||||
|
@ -4,8 +4,8 @@ use crate::{CodeMemory, CompiledModule};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use wasm_common::entity::PrimaryMap;
|
||||
use wasm_common::{FunctionType, LocalFunctionIndex, MemoryIndex, SignatureIndex, TableIndex};
|
||||
use wasmer_compiler::{Compilation, CompileError, FunctionBody, Target};
|
||||
use wasm_common::{FunctionType, LocalFunctionIndex, SignatureIndex};
|
||||
use wasmer_compiler::{CompileError, FunctionBody};
|
||||
#[cfg(feature = "compiler")]
|
||||
use wasmer_compiler::{Compiler, CompilerConfig};
|
||||
use wasmer_engine::{
|
||||
@ -13,8 +13,7 @@ use wasmer_engine::{
|
||||
SerializeError, Tunables,
|
||||
};
|
||||
use wasmer_runtime::{
|
||||
InstanceHandle, MemoryPlan, Module, SignatureRegistry, TablePlan, VMFunctionBody,
|
||||
VMSharedSignatureIndex, VMTrampoline,
|
||||
InstanceHandle, Module, SignatureRegistry, VMFunctionBody, VMSharedSignatureIndex, VMTrampoline,
|
||||
};
|
||||
|
||||
/// A WebAssembly `JIT` Engine.
|
||||
@ -129,7 +128,7 @@ impl Engine for JITEngine {
|
||||
resolver: &dyn Resolver,
|
||||
) -> Result<InstanceHandle, InstantiationError> {
|
||||
let compiled_module = compiled_module.downcast_ref::<CompiledModule>().unwrap();
|
||||
unsafe { compiled_module.instantiate(&self, resolver, Box::new(())) }
|
||||
compiled_module.instantiate(&self, resolver, Box::new(()))
|
||||
}
|
||||
|
||||
/// Finish the instantiation of a WebAssembly module
|
||||
@ -139,7 +138,7 @@ impl Engine for JITEngine {
|
||||
handle: &InstanceHandle,
|
||||
) -> Result<(), InstantiationError> {
|
||||
let compiled_module = compiled_module.downcast_ref::<CompiledModule>().unwrap();
|
||||
unsafe { compiled_module.finish_instantiation(&handle) }
|
||||
compiled_module.finish_instantiation(&handle)
|
||||
}
|
||||
|
||||
/// Serializes a WebAssembly module
|
||||
|
@ -13,7 +13,7 @@ use wasmer_runtime::VMFunctionBody;
|
||||
/// Links a module, patching the allocated functions with the
|
||||
/// required relocations and jump tables.
|
||||
pub fn link_module(
|
||||
module: &Module,
|
||||
_module: &Module,
|
||||
allocated_functions: &PrimaryMap<LocalFunctionIndex, *mut [VMFunctionBody]>,
|
||||
jt_offsets: &PrimaryMap<LocalFunctionIndex, JumpTableOffsets>,
|
||||
relocations: Relocations,
|
||||
|
@ -4,25 +4,23 @@
|
||||
use crate::engine::{JITEngine, JITEngineInner};
|
||||
use crate::link::link_module;
|
||||
use crate::serialize::{SerializableCompilation, SerializableModule};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::any::Any;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use wasm_common::entity::{BoxedSlice, EntityRef, PrimaryMap};
|
||||
use wasm_common::entity::{BoxedSlice, PrimaryMap};
|
||||
use wasm_common::{
|
||||
DataInitializer, LocalFunctionIndex, LocalGlobalIndex, LocalMemoryIndex, LocalTableIndex,
|
||||
MemoryIndex, OwnedDataInitializer, SignatureIndex, TableIndex,
|
||||
DataInitializer, LocalFunctionIndex, MemoryIndex, OwnedDataInitializer, SignatureIndex,
|
||||
TableIndex,
|
||||
};
|
||||
use wasmer_compiler::CompileError;
|
||||
#[cfg(feature = "compiler")]
|
||||
use wasmer_compiler::ModuleEnvironment;
|
||||
use wasmer_engine::{
|
||||
register_frame_info, resolve_imports, CompiledModule as BaseCompiledModule, DeserializeError,
|
||||
Engine, GlobalFrameInfoRegistration, InstantiationError, LinkError, Resolver, RuntimeError,
|
||||
SerializableFunctionFrameInfo, SerializeError, Tunables,
|
||||
Engine, GlobalFrameInfoRegistration, InstantiationError, Resolver, RuntimeError,
|
||||
SerializableFunctionFrameInfo, SerializeError,
|
||||
};
|
||||
use wasmer_runtime::{
|
||||
InstanceHandle, LinearMemory, Module, SignatureRegistry, Table, VMFunctionBody,
|
||||
VMGlobalDefinition, VMSharedSignatureIndex,
|
||||
InstanceHandle, Module, SignatureRegistry, VMFunctionBody, VMSharedSignatureIndex,
|
||||
};
|
||||
|
||||
use wasmer_runtime::{MemoryPlan, TablePlan};
|
||||
|
@ -15,7 +15,7 @@ use wasmer_runtime::{InstanceHandle, VMSharedSignatureIndex, VMTrampoline};
|
||||
/// such as: JIT or Native.
|
||||
pub trait Engine {
|
||||
/// Get the tunables
|
||||
fn tunables(&self) -> &Tunables;
|
||||
fn tunables(&self) -> &dyn Tunables;
|
||||
|
||||
/// Register a signature
|
||||
fn register_signature(&self, func_type: &FunctionType) -> VMSharedSignatureIndex;
|
||||
@ -30,7 +30,7 @@ pub trait Engine {
|
||||
fn validate(&self, binary: &[u8]) -> Result<(), CompileError>;
|
||||
|
||||
/// Compile a WebAssembly binary
|
||||
fn compile(&self, binary: &[u8]) -> Result<Arc<CompiledModule>, CompileError>;
|
||||
fn compile(&self, binary: &[u8]) -> Result<Arc<dyn CompiledModule>, CompileError>;
|
||||
|
||||
/// Instantiates a WebAssembly module
|
||||
unsafe fn instantiate(
|
||||
@ -50,13 +50,13 @@ pub trait Engine {
|
||||
fn serialize(&self, compiled_module: &dyn CompiledModule) -> Result<Vec<u8>, SerializeError>;
|
||||
|
||||
/// Deserializes a WebAssembly module
|
||||
fn deserialize(&self, bytes: &[u8]) -> Result<Arc<CompiledModule>, DeserializeError>;
|
||||
fn deserialize(&self, bytes: &[u8]) -> Result<Arc<dyn CompiledModule>, DeserializeError>;
|
||||
|
||||
/// Deserializes a WebAssembly module from a path
|
||||
fn deserialize_from_file(
|
||||
&self,
|
||||
file_ref: &Path,
|
||||
) -> Result<Arc<CompiledModule>, DeserializeError> {
|
||||
) -> Result<Arc<dyn CompiledModule>, DeserializeError> {
|
||||
// TODO: Return an IoDeserializeError, so we don't need to map the error
|
||||
let bytes =
|
||||
std::fs::read(file_ref).map_err(|e| DeserializeError::Generic(format!("{}", e)))?;
|
||||
|
@ -1,6 +1,3 @@
|
||||
use crate::error::InstantiationError;
|
||||
use std::sync::Arc;
|
||||
use wasmer_runtime::InstanceHandle;
|
||||
use wasmer_runtime::Module;
|
||||
|
||||
use downcast_rs::{impl_downcast, Downcast};
|
||||
|
@ -66,7 +66,7 @@ impl ModuleFrameInfo {
|
||||
}
|
||||
|
||||
fn process_function_debug_info(&mut self, local_index: LocalFunctionIndex) {
|
||||
let mut func = self.frame_infos.get_mut(local_index).unwrap();
|
||||
let func = self.frame_infos.get_mut(local_index).unwrap();
|
||||
let processed: CompiledFunctionFrameInfo = match func {
|
||||
SerializableFunctionFrameInfo::Processed(_) => {
|
||||
// This should be a no-op on processed info
|
||||
@ -187,7 +187,8 @@ impl GlobalFrameInfo {
|
||||
pub fn maybe_process_frame(&mut self, pc: usize) -> Option<()> {
|
||||
let module = self.module_info_mut(pc)?;
|
||||
let func = module.function_info(pc)?;
|
||||
module.process_function_debug_info(func.local_index);
|
||||
let func_local_index = func.local_index;
|
||||
module.process_function_debug_info(func_local_index);
|
||||
Some(())
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::error::LinkError;
|
||||
use wasm_common::entity::{EntityRef, PrimaryMap};
|
||||
use wasm_common::{
|
||||
GlobalIndex, LocalGlobalIndex, LocalMemoryIndex, LocalTableIndex, MemoryIndex, MemoryType,
|
||||
TableIndex, TableType,
|
||||
LocalGlobalIndex, LocalMemoryIndex, LocalTableIndex, MemoryIndex, MemoryType, TableIndex,
|
||||
TableType,
|
||||
};
|
||||
use wasmer_runtime::MemoryError;
|
||||
use wasmer_runtime::{LinearMemory, Module, Table, VMGlobalDefinition};
|
||||
|
@ -1,3 +1,5 @@
|
||||
//! Runtime build script compiles C code using setjmp for trap handling.
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=src/trap/helpers.c");
|
||||
cc::Build::new()
|
||||
|
@ -1,5 +1,4 @@
|
||||
use crate::vmcontext::{VMFunctionImport, VMGlobalImport, VMMemoryImport, VMTableImport};
|
||||
use std::collections::HashSet;
|
||||
use wasm_common::entity::{BoxedSlice, PrimaryMap};
|
||||
use wasm_common::{FunctionIndex, GlobalIndex, MemoryIndex, TableIndex};
|
||||
|
||||
|
@ -18,7 +18,7 @@ use more_asserts::assert_lt;
|
||||
use std::alloc::{self, Layout};
|
||||
use std::any::Any;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::HashMap;
|
||||
use std::convert::TryFrom;
|
||||
use std::sync::Arc;
|
||||
use std::{mem, ptr, slice};
|
||||
|
@ -19,7 +19,6 @@ mod types;
|
||||
pub use self::builder::*;
|
||||
pub use self::types::*;
|
||||
use crate::syscalls::types::*;
|
||||
use crate::WasiEnv;
|
||||
use generational_arena::Arena;
|
||||
pub use generational_arena::Index as Inode;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -52,15 +51,6 @@ const STDOUT_DEFAULT_RIGHTS: __wasi_rights_t = __WASI_RIGHT_FD_DATASYNC
|
||||
| __WASI_RIGHT_POLL_FD_READWRITE;
|
||||
const STDERR_DEFAULT_RIGHTS: __wasi_rights_t = STDOUT_DEFAULT_RIGHTS;
|
||||
|
||||
/// Get WasiState from a Ctx
|
||||
///
|
||||
/// # Safety
|
||||
/// - This function must be called on a `WasiEnv` that was created with `WasiState`
|
||||
/// in the data field
|
||||
pub unsafe fn get_wasi_state<'a>(env: &'a mut WasiEnv) -> &'a mut WasiState {
|
||||
env.state_mut()
|
||||
}
|
||||
|
||||
/// A completely aribtrary "big enough" number used as the upper limit for
|
||||
/// the number of symlinks that can be traversed when resolving a path
|
||||
pub const MAX_SYMLINKS: u32 = 128;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use wasmer::{ExternType, ImportType, Module};
|
||||
use wasmer::{ExternType, Module};
|
||||
|
||||
#[allow(dead_code)]
|
||||
/// Check if a provided module is compiled for some version of WASI.
|
||||
|
@ -1,5 +1,5 @@
|
||||
//! When wasmer self-update is executed, this is what gets executed
|
||||
use anyhow::{bail, Context, Result};
|
||||
use anyhow::{Context, Result};
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use std::process::{Command, Stdio};
|
||||
use structopt::StructOpt;
|
||||
@ -35,6 +35,6 @@ impl SelfUpdate {
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn inner_execute(&self) -> Result<()> {
|
||||
bail!("Self update is not supported on Windows. Use install instructions on the Wasmer homepage: https://wasmer.io");
|
||||
anyhow::bail!("Self update is not supported on Windows. Use install instructions on the Wasmer homepage: https://wasmer.io");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user