Update to Rust 2018 Edition.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use cranelift_codegen::ir;
|
||||
use cranelift_wasm::Global;
|
||||
use vmcontext::{
|
||||
use crate::vmcontext::{
|
||||
VMContext, VMFunctionBody, VMGlobalDefinition, VMMemoryDefinition, VMTableDefinition,
|
||||
};
|
||||
use cranelift_codegen::ir;
|
||||
use cranelift_wasm::Global;
|
||||
use wasmtime_environ::{MemoryPlan, TablePlan};
|
||||
|
||||
/// The value of an export passed from one instance to another.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::vmcontext::{VMFunctionImport, VMGlobalImport, VMMemoryImport, VMTableImport};
|
||||
use cranelift_entity::{BoxedSlice, PrimaryMap};
|
||||
use cranelift_wasm::{FuncIndex, GlobalIndex, MemoryIndex, TableIndex};
|
||||
use vmcontext::{VMFunctionImport, VMGlobalImport, VMMemoryImport, VMTableImport};
|
||||
|
||||
/// Resolved import pointers.
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
//! An `Instance` contains all the runtime state used by execution of a wasm
|
||||
//! module.
|
||||
|
||||
use crate::export::Export;
|
||||
use crate::imports::Imports;
|
||||
use crate::memory::LinearMemory;
|
||||
use crate::mmap::Mmap;
|
||||
use crate::signalhandlers::{wasmtime_init_eager, wasmtime_init_finish};
|
||||
use crate::table::Table;
|
||||
use crate::traphandlers::wasmtime_call;
|
||||
use crate::vmcontext::{
|
||||
VMCallerCheckedAnyfunc, VMContext, VMFunctionBody, VMFunctionImport, VMGlobalDefinition,
|
||||
VMGlobalImport, VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition,
|
||||
VMTableImport,
|
||||
};
|
||||
use cranelift_entity::EntityRef;
|
||||
use cranelift_entity::{BoxedSlice, PrimaryMap};
|
||||
use cranelift_wasm::{
|
||||
DefinedFuncIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, FuncIndex,
|
||||
GlobalIndex, GlobalInit, MemoryIndex, SignatureIndex, TableIndex,
|
||||
};
|
||||
use export::Export;
|
||||
use imports::Imports;
|
||||
use memory::LinearMemory;
|
||||
use mmap::Mmap;
|
||||
use signalhandlers::{wasmtime_init_eager, wasmtime_init_finish};
|
||||
use std::rc::Rc;
|
||||
use std::slice;
|
||||
use std::string::String;
|
||||
use std::{mem, ptr};
|
||||
use table::Table;
|
||||
use traphandlers::wasmtime_call;
|
||||
use vmcontext::{
|
||||
VMCallerCheckedAnyfunc, VMContext, VMFunctionBody, VMFunctionImport, VMGlobalDefinition,
|
||||
VMGlobalImport, VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition,
|
||||
VMTableImport,
|
||||
};
|
||||
use wasmtime_environ::{DataInitializer, Module, TableElements, VMOffsets};
|
||||
|
||||
fn signature_id(
|
||||
@@ -450,7 +450,7 @@ impl Instance {
|
||||
module: Rc<Module>,
|
||||
finished_functions: BoxedSlice<DefinedFuncIndex, *const VMFunctionBody>,
|
||||
imports: Imports,
|
||||
data_initializers: &[DataInitializer],
|
||||
data_initializers: &[DataInitializer<'_>],
|
||||
vmshared_signatures: BoxedSlice<SignatureIndex, VMSharedSignatureIndex>,
|
||||
) -> Result<Self, InstantiationError> {
|
||||
let mut tables = create_tables(&module);
|
||||
@@ -705,7 +705,7 @@ fn check_table_init_bounds(
|
||||
|
||||
/// Compute the offset for a memory data initializer.
|
||||
fn get_memory_init_start(
|
||||
init: &DataInitializer,
|
||||
init: &DataInitializer<'_>,
|
||||
module: &Module,
|
||||
contents: &mut InstanceContents,
|
||||
) -> usize {
|
||||
@@ -725,7 +725,7 @@ fn get_memory_init_start(
|
||||
|
||||
/// Return a byte-slice view of a memory's data.
|
||||
fn get_memory_slice<'contents>(
|
||||
init: &DataInitializer,
|
||||
init: &DataInitializer<'_>,
|
||||
module: &Module,
|
||||
contents: &'contents mut InstanceContents,
|
||||
) -> &'contents mut [u8] {
|
||||
@@ -746,7 +746,7 @@ fn get_memory_slice<'contents>(
|
||||
fn check_memory_init_bounds(
|
||||
module: &Module,
|
||||
contents: &mut InstanceContents,
|
||||
data_initializers: &[DataInitializer],
|
||||
data_initializers: &[DataInitializer<'_>],
|
||||
) -> Result<(), InstantiationError> {
|
||||
for init in data_initializers {
|
||||
let start = get_memory_init_start(init, module, contents);
|
||||
@@ -868,7 +868,7 @@ fn create_memories(
|
||||
fn initialize_memories(
|
||||
module: &Module,
|
||||
contents: &mut InstanceContents,
|
||||
data_initializers: &[DataInitializer],
|
||||
data_initializers: &[DataInitializer<'_>],
|
||||
) -> Result<(), InstantiationError> {
|
||||
for init in data_initializers {
|
||||
let start = get_memory_init_start(init, module, contents);
|
||||
|
||||
@@ -24,22 +24,19 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||
|
||||
extern crate cranelift_codegen;
|
||||
extern crate cranelift_entity;
|
||||
extern crate cranelift_wasm;
|
||||
extern crate errno;
|
||||
extern crate region;
|
||||
extern crate wasmtime_environ;
|
||||
use errno;
|
||||
use region;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate libc;
|
||||
use libc;
|
||||
#[macro_use]
|
||||
extern crate memoffset;
|
||||
extern crate cast;
|
||||
extern crate failure;
|
||||
use cast;
|
||||
use failure;
|
||||
#[macro_use]
|
||||
extern crate failure_derive;
|
||||
#[cfg(target_os = "windows")]
|
||||
@@ -58,14 +55,14 @@ mod vmcontext;
|
||||
|
||||
pub mod libcalls;
|
||||
|
||||
pub use export::Export;
|
||||
pub use imports::Imports;
|
||||
pub use instance::{Instance, InstantiationError, LinkError};
|
||||
pub use mmap::Mmap;
|
||||
pub use sig_registry::SignatureRegistry;
|
||||
pub use signalhandlers::{wasmtime_init_eager, wasmtime_init_finish};
|
||||
pub use traphandlers::{wasmtime_call, wasmtime_call_trampoline};
|
||||
pub use vmcontext::{
|
||||
pub use crate::export::Export;
|
||||
pub use crate::imports::Imports;
|
||||
pub use crate::instance::{Instance, InstantiationError, LinkError};
|
||||
pub use crate::mmap::Mmap;
|
||||
pub use crate::sig_registry::SignatureRegistry;
|
||||
pub use crate::signalhandlers::{wasmtime_init_eager, wasmtime_init_finish};
|
||||
pub use crate::traphandlers::{wasmtime_call, wasmtime_call_trampoline};
|
||||
pub use crate::vmcontext::{
|
||||
VMContext, VMFunctionBody, VMFunctionImport, VMGlobalDefinition, VMGlobalImport,
|
||||
VMMemoryDefinition, VMMemoryImport, VMSharedSignatureIndex, VMTableDefinition, VMTableImport,
|
||||
};
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
//! inline rather than calling them, particularly when CPUs have special
|
||||
//! instructions which compute them directly.
|
||||
|
||||
use crate::vmcontext::VMContext;
|
||||
use cranelift_wasm::{DefinedMemoryIndex, MemoryIndex};
|
||||
use vmcontext::VMContext;
|
||||
|
||||
/// Implementation of f32.ceil
|
||||
pub extern "C" fn wasmtime_f32_ceil(x: f32) -> f32 {
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
//!
|
||||
//! `LinearMemory` is to WebAssembly linear memories what `Table` is to WebAssembly tables.
|
||||
|
||||
use mmap::Mmap;
|
||||
use crate::mmap::Mmap;
|
||||
use crate::vmcontext::VMMemoryDefinition;
|
||||
use region;
|
||||
use std::string::String;
|
||||
use vmcontext::VMMemoryDefinition;
|
||||
use wasmtime_environ::{MemoryPlan, MemoryStyle, WASM_MAX_PAGES, WASM_PAGE_SIZE};
|
||||
|
||||
/// A linear memory instance.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! Implement a registry of function signatures, for fast indirect call
|
||||
//! signature checking.
|
||||
|
||||
use crate::vmcontext::VMSharedSignatureIndex;
|
||||
use cast;
|
||||
use cranelift_codegen::ir;
|
||||
use std::collections::{hash_map, HashMap};
|
||||
use vmcontext::VMSharedSignatureIndex;
|
||||
|
||||
/// WebAssembly requires that the caller and callee signatures in an indirect
|
||||
/// call must match. To implement this efficiently, keep a registry of all
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use crate::vmcontext::VMContext;
|
||||
use std::borrow::{Borrow, BorrowMut};
|
||||
use std::cell::RefCell;
|
||||
use std::sync::RwLock;
|
||||
use vmcontext::VMContext;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/signalhandlers.rs"));
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
//!
|
||||
//! `Table` is to WebAssembly tables what `LinearMemory` is to WebAssembly linear memories.
|
||||
|
||||
use crate::vmcontext::{VMCallerCheckedAnyfunc, VMTableDefinition};
|
||||
use cranelift_wasm::TableElementType;
|
||||
use vmcontext::{VMCallerCheckedAnyfunc, VMTableDefinition};
|
||||
use wasmtime_environ::{TablePlan, TableStyle};
|
||||
|
||||
/// A table instance.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//! WebAssembly trap handling, which is built on top of the lower-level
|
||||
//! signalhandling mechanisms.
|
||||
|
||||
use crate::signalhandlers::jmp_buf;
|
||||
use crate::vmcontext::{VMContext, VMFunctionBody};
|
||||
use libc::c_int;
|
||||
use signalhandlers::jmp_buf;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::string::String;
|
||||
use vmcontext::{VMContext, VMFunctionBody};
|
||||
|
||||
// Currently we uset setjmp/longjmp to unwind out of a signal handler
|
||||
// and back to the point where WebAssembly was called (via `call_wasm`).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! This file declares `VMContext` and several related structs which contain
|
||||
//! fields that compiled wasm code accesses directly.
|
||||
|
||||
use instance::InstanceContents;
|
||||
use crate::instance::InstanceContents;
|
||||
use std::{ptr, u32};
|
||||
|
||||
/// An imported function.
|
||||
|
||||
Reference in New Issue
Block a user