Move SourceLoc into compiler

This commit is contained in:
Syrus
2020-04-21 23:05:58 -07:00
parent 68b500ad84
commit b360bd40bb
9 changed files with 13 additions and 12 deletions

View File

@@ -1,6 +1,5 @@
use cranelift_codegen::{isa, Context}; use cranelift_codegen::{isa, Context};
use wasm_common::SourceLoc; use wasmer_compiler::{FunctionAddressMap, FunctionBodyData, InstructionAddressMap, SourceLoc};
use wasmer_compiler::{FunctionAddressMap, FunctionBodyData, InstructionAddressMap};
pub fn get_function_address_map<'data>( pub fn get_function_address_map<'data>(
context: &Context, context: &Context,

View File

@@ -15,12 +15,13 @@ use rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use std::collections::HashMap; use std::collections::HashMap;
use wasm_common::entity::{EntityRef, PrimaryMap, SecondaryMap}; use wasm_common::entity::{EntityRef, PrimaryMap, SecondaryMap};
use wasm_common::{ use wasm_common::{
DefinedFuncIndex, Features, FuncIndex, FuncType, MemoryIndex, SignatureIndex, SourceLoc, DefinedFuncIndex, Features, FuncIndex, FuncType, MemoryIndex, SignatureIndex, TableIndex,
TableIndex,
}; };
use wasmer_compiler::CompileError; use wasmer_compiler::CompileError;
use wasmer_compiler::FunctionBodyData; use wasmer_compiler::FunctionBodyData;
use wasmer_compiler::{Compilation, CompiledFunction, Compiler, JumpTable, TrapInformation}; use wasmer_compiler::{
Compilation, CompiledFunction, Compiler, JumpTable, SourceLoc, TrapInformation,
};
use wasmer_compiler::{CompilerConfig, ModuleTranslationState, Target}; use wasmer_compiler::{CompilerConfig, ModuleTranslationState, Target};
use wasmer_compiler::{Relocation, RelocationTarget}; use wasmer_compiler::{Relocation, RelocationTarget};
use wasmer_runtime::TrapCode; use wasmer_runtime::TrapCode;

View File

@@ -4,7 +4,8 @@
use cranelift_codegen::ir; use cranelift_codegen::ir;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use wasm_common::entity::PrimaryMap; use wasm_common::entity::PrimaryMap;
use wasm_common::{DefinedFuncIndex, SourceLoc}; use wasm_common::DefinedFuncIndex;
use wasmer_compiler::SourceLoc;
/// Single source location to generated address mapping. /// Single source location to generated address mapping.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]

View File

@@ -1,9 +1,9 @@
//! Data structures to provide transformation of the source //! Data structures to provide transformation of the source
// addresses of a WebAssembly module into the native code. // addresses of a WebAssembly module into the native code.
use crate::sourceloc::SourceLoc;
use crate::std::vec::Vec; use crate::std::vec::Vec;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use wasm_common::SourceLoc;
/// Single source location to generated address mapping. /// Single source location to generated address mapping.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]

View File

@@ -48,6 +48,7 @@ mod trap;
mod unwind; mod unwind;
#[macro_use] #[macro_use]
mod translator; mod translator;
mod sourceloc;
pub use crate::address_map::{FunctionAddressMap, InstructionAddressMap}; pub use crate::address_map::{FunctionAddressMap, InstructionAddressMap};
pub use crate::compiler::Compiler; pub use crate::compiler::Compiler;
@@ -56,6 +57,7 @@ pub use crate::errors::CompileError;
pub use crate::function::{Compilation, CompiledFunction, Functions}; pub use crate::function::{Compilation, CompiledFunction, Functions};
pub use crate::jump_table::{JumpTable, JumpTableOffsets}; pub use crate::jump_table::{JumpTable, JumpTableOffsets};
pub use crate::relocation::{Relocation, RelocationKind, RelocationTarget, Relocations}; pub use crate::relocation::{Relocation, RelocationKind, RelocationTarget, Relocations};
pub use crate::sourceloc::SourceLoc;
pub use crate::translator::{ pub use crate::translator::{
to_wasm_error, translate_module, FunctionBodyData, ModuleEnvironment, ModuleTranslation, to_wasm_error, translate_module, FunctionBodyData, ModuleEnvironment, ModuleTranslation,
ModuleTranslationState, WasmError, WasmResult, ModuleTranslationState, WasmError, WasmResult,

View File

@@ -1,6 +1,6 @@
use crate::sourceloc::SourceLoc;
use crate::CodeOffset; use crate::CodeOffset;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use wasm_common::SourceLoc;
use wasmer_runtime::TrapCode; use wasmer_runtime::TrapCode;
/// Information about trap. /// Information about trap.

View File

@@ -15,8 +15,8 @@ use std::cmp;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use wasm_common::entity::EntityRef; use wasm_common::entity::EntityRef;
use wasm_common::{FuncIndex, SourceLoc}; use wasm_common::FuncIndex;
use wasmer_compiler::{FunctionAddressMap, TrapInformation}; use wasmer_compiler::{FunctionAddressMap, SourceLoc, TrapInformation};
use wasmer_runtime::Module; use wasmer_runtime::Module;
lazy_static::lazy_static! { lazy_static::lazy_static! {

View File

@@ -29,7 +29,6 @@ mod features;
mod indexes; mod indexes;
mod native; mod native;
mod r#ref; mod r#ref;
mod sourceloc;
mod types; mod types;
mod values; mod values;
@@ -48,7 +47,6 @@ pub use crate::indexes::{
}; };
pub use crate::native::{Func, HostFunction, NativeWasmType, WasmTypeList, WithEnv, WithoutEnv}; pub use crate::native::{Func, HostFunction, NativeWasmType, WasmTypeList, WithEnv, WithoutEnv};
pub use crate::r#ref::{AnyRef, HostInfo, HostRef}; pub use crate::r#ref::{AnyRef, HostInfo, HostRef};
pub use crate::sourceloc::SourceLoc;
pub use crate::values::Value; pub use crate::values::Value;
pub use types::{ pub use types::{
ExportType, ExternType, FuncType, GlobalInit, GlobalType, ImportType, MemoryType, Mutability, ExportType, ExternType, FuncType, GlobalInit, GlobalType, ImportType, MemoryType, Mutability,