diff --git a/lib/api/src/backend/js/entities/engine.rs b/lib/api/src/backend/js/entities/engine.rs index d8f02c222..96df07412 100644 --- a/lib/api/src/backend/js/entities/engine.rs +++ b/lib/api/src/backend/js/entities/engine.rs @@ -1,5 +1,4 @@ -use wasmer_compiler::types::target::Target; -use wasmer_types::Features; +use wasmer_types::{target::Target, Features}; /// The engine for the JavaScript runtime. #[derive(Clone, Debug)] diff --git a/lib/api/src/backend/jsc/entities/engine.rs b/lib/api/src/backend/jsc/entities/engine.rs index ef6b56c64..05b4fc924 100644 --- a/lib/api/src/backend/jsc/entities/engine.rs +++ b/lib/api/src/backend/jsc/entities/engine.rs @@ -1,8 +1,7 @@ use std::sync::Arc; use rusty_jsc::{JSContext, JSObject}; -use wasmer_compiler::types::target::Target; -use wasmer_types::Features; +use wasmer_types::{target::Target, Features}; use crate::{AsEngineRef, AsStoreRef}; diff --git a/lib/api/src/backend/sys/entities/engine.rs b/lib/api/src/backend/sys/entities/engine.rs index 25825e1b5..6cfe97143 100644 --- a/lib/api/src/backend/sys/entities/engine.rs +++ b/lib/api/src/backend/sys/entities/engine.rs @@ -4,9 +4,9 @@ use std::{path::Path, sync::Arc}; use shared_buffer::OwnedBuffer; pub use wasmer_compiler::{ - types::target::Target, Artifact, BaseTunables, CompilerConfig, Engine, EngineBuilder, Tunables, + Artifact, BaseTunables, CompilerConfig, Engine, EngineBuilder, Tunables, }; -use wasmer_types::{DeserializeError, Features, HashAlgorithm}; +use wasmer_types::{target::Target, DeserializeError, Features, HashAlgorithm}; use crate::{BackendEngine, BackendModule}; diff --git a/lib/api/src/backend/sys/mod.rs b/lib/api/src/backend/sys/mod.rs index e192c2d74..ab009c0dc 100644 --- a/lib/api/src/backend/sys/mod.rs +++ b/lib/api/src/backend/sys/mod.rs @@ -14,11 +14,9 @@ pub use wasmer_compiler::{ wasmparser, CompilerConfig, FunctionMiddleware, MiddlewareReaderState, ModuleMiddleware, }; -pub use wasmer_compiler::{ - types::target::{Architecture, CpuFeature, OperatingSystem, Target, Triple}, - Artifact, EngineBuilder, Features, Tunables, -}; +pub use wasmer_compiler::{Artifact, EngineBuilder, Features, Tunables}; +pub use wasmer_types::target::{Architecture, CpuFeature, OperatingSystem, Target, Triple}; pub use wasmer_types::MiddlewareError; #[cfg(feature = "cranelift")] diff --git a/lib/api/src/backend/v8/entities/engine.rs b/lib/api/src/backend/v8/entities/engine.rs index c70be238d..75cc5f682 100644 --- a/lib/api/src/backend/v8/entities/engine.rs +++ b/lib/api/src/backend/v8/entities/engine.rs @@ -4,8 +4,7 @@ use crate::{ BackendEngine, }; use std::sync::Arc; -use wasmer_compiler::types::target::Target; -use wasmer_types::Features; +use wasmer_types::{target::Target, Features}; // A handle to an engine, which we want to unsafely mark as Sync. struct EngineCapsule(*mut wasm_engine_t); diff --git a/lib/api/src/backend/wamr/entities/engine.rs b/lib/api/src/backend/wamr/entities/engine.rs index d6980358f..6f8e5eee5 100644 --- a/lib/api/src/backend/wamr/entities/engine.rs +++ b/lib/api/src/backend/wamr/entities/engine.rs @@ -4,8 +4,7 @@ use crate::{ BackendEngine, }; use std::sync::Arc; -use wasmer_compiler::types::target::Target; -use wasmer_types::Features; +use wasmer_types::{target::Target, Features}; #[derive(Debug)] pub(crate) struct CApiEngine { diff --git a/lib/api/src/backend/wasmi/entities/engine.rs b/lib/api/src/backend/wasmi/entities/engine.rs index 9d486f42c..89d8244ef 100644 --- a/lib/api/src/backend/wasmi/entities/engine.rs +++ b/lib/api/src/backend/wasmi/entities/engine.rs @@ -4,8 +4,7 @@ use crate::{ BackendEngine, }; use std::sync::Arc; -use wasmer_compiler::types::target::Target; -use wasmer_types::Features; +use wasmer_types::{target::Target, Features}; #[derive(Debug)] pub(crate) struct CApiEngine { diff --git a/lib/api/src/entities/engine/inner.rs b/lib/api/src/entities/engine/inner.rs index fc7617550..78463f677 100644 --- a/lib/api/src/entities/engine/inner.rs +++ b/lib/api/src/entities/engine/inner.rs @@ -1,7 +1,6 @@ use bytes::Bytes; use std::{path::Path, sync::Arc}; -use wasmer_compiler::types::target::Target; -use wasmer_types::{DeserializeError, Features}; +use wasmer_types::{target::Target, DeserializeError, Features}; #[cfg(feature = "sys")] use wasmer_compiler::{Artifact, CompilerConfig}; diff --git a/lib/api/src/entities/engine/mod.rs b/lib/api/src/entities/engine/mod.rs index 29912f66b..881813a87 100644 --- a/lib/api/src/entities/engine/mod.rs +++ b/lib/api/src/entities/engine/mod.rs @@ -2,12 +2,12 @@ use bytes::Bytes; use std::{path::Path, sync::Arc}; -use wasmer_types::{DeserializeError, Features}; +use wasmer_types::{target::Target, DeserializeError, Features}; #[cfg(feature = "sys")] use wasmer_compiler::Artifact; -use wasmer_compiler::types::target::Target; +#[cfg(feature = "compiler")] use wasmer_compiler::CompilerConfig; use crate::{BackendKind, IntoBytes, Store}; diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index 99052ccec..afff4e516 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -1595,7 +1595,7 @@ pub(super) mod utils { use anyhow::{anyhow, Context}; use target_lexicon::{Architecture, Environment, OperatingSystem, Triple}; - use wasmer_compiler::types::target::{self as wasmer_types, CpuFeature, Target}; + use wasmer_types::target::{CpuFeature, Target}; use crate::config::WasmerEnv; @@ -1848,7 +1848,9 @@ pub(super) mod utils { pub(super) fn triple_to_zig_triple(target_triple: &Triple) -> String { let arch = match target_triple.architecture { Architecture::X86_64 => "x86_64".into(), - Architecture::Aarch64(wasmer_types::Aarch64Architecture::Aarch64) => "aarch64".into(), + Architecture::Aarch64(wasmer_types::target::Aarch64Architecture::Aarch64) => { + "aarch64".into() + } v => v.to_string(), }; let os = match target_triple.operating_system { diff --git a/lib/cli/src/commands/gen_c_header.rs b/lib/cli/src/commands/gen_c_header.rs index c5256d1bd..fbae31945 100644 --- a/lib/cli/src/commands/gen_c_header.rs +++ b/lib/cli/src/commands/gen_c_header.rs @@ -3,15 +3,12 @@ use std::path::PathBuf; use anyhow::{Context, Error}; use bytes::Bytes; use clap::Parser; -use wasmer_compiler::{ - types::{ - symbols::ModuleMetadataSymbolRegistry, - target::{CpuFeature, Triple}, - }, - Artifact, -}; +use wasmer_compiler::{types::symbols::ModuleMetadataSymbolRegistry, Artifact}; use wasmer_package::{package::WasmerPackageError, utils::from_bytes}; -use wasmer_types::MetadataHeader; +use wasmer_types::{ + target::{CpuFeature, Triple}, + MetadataHeader, +}; use webc::{compat::SharedBytes, Container, ContainerError, DetectError}; use crate::backend::RuntimeOptions; diff --git a/lib/compiler-cranelift/src/compiler.rs b/lib/compiler-cranelift/src/compiler.rs index 437af3fe0..ae682f67a 100644 --- a/lib/compiler-cranelift/src/compiler.rs +++ b/lib/compiler-cranelift/src/compiler.rs @@ -35,13 +35,13 @@ use wasmer_compiler::{ module::CompileModuleInfo, relocation::{Relocation, RelocationTarget}, section::SectionIndex, - target::{CallingConvention, Target}, unwind::CompiledFunctionUnwindInfo, }, Compiler, FunctionBinaryReader, FunctionBodyData, MiddlewareBinaryReader, ModuleMiddleware, ModuleMiddlewareChain, ModuleTranslationState, }; use wasmer_types::entity::{EntityRef, PrimaryMap}; +use wasmer_types::target::{CallingConvention, Target}; use wasmer_types::{ CompileError, FunctionIndex, LocalFunctionIndex, ModuleInfo, SignatureIndex, TrapCode, TrapInformation, diff --git a/lib/compiler-cranelift/src/config.rs b/lib/compiler-cranelift/src/config.rs index b3f5144c2..b854efbb2 100644 --- a/lib/compiler-cranelift/src/config.rs +++ b/lib/compiler-cranelift/src/config.rs @@ -5,10 +5,8 @@ use cranelift_codegen::{ CodegenResult, }; use std::sync::Arc; -use wasmer_compiler::{ - types::target::{Architecture, CpuFeature, Target}, - Compiler, CompilerConfig, Engine, EngineBuilder, ModuleMiddleware, -}; +use wasmer_compiler::{Compiler, CompilerConfig, Engine, EngineBuilder, ModuleMiddleware}; +use wasmer_types::target::{Architecture, CpuFeature, Target}; // Runtime Environment diff --git a/lib/compiler-cranelift/src/dwarf.rs b/lib/compiler-cranelift/src/dwarf.rs index 50fd10ef8..8568a831f 100644 --- a/lib/compiler-cranelift/src/dwarf.rs +++ b/lib/compiler-cranelift/src/dwarf.rs @@ -3,9 +3,8 @@ use gimli::{RunTimeEndian, SectionId}; use wasmer_compiler::types::{ relocation::{Relocation, RelocationKind, RelocationTarget}, section::{CustomSection, CustomSectionProtection, SectionBody}, - target::Endianness, }; -use wasmer_types::{entity::EntityRef, LocalFunctionIndex}; +use wasmer_types::{entity::EntityRef, target::Endianness, LocalFunctionIndex}; #[derive(Clone, Debug)] pub struct WriterRelocate { diff --git a/lib/compiler-llvm/src/compiler.rs b/lib/compiler-llvm/src/compiler.rs index 4d1aae46f..66e1009a4 100644 --- a/lib/compiler-llvm/src/compiler.rs +++ b/lib/compiler-llvm/src/compiler.rs @@ -19,11 +19,11 @@ use wasmer_compiler::{ relocation::RelocationTarget, section::{CustomSection, CustomSectionProtection, SectionBody, SectionIndex}, symbols::{Symbol, SymbolRegistry}, - target::Target, }, Compiler, FunctionBodyData, ModuleMiddleware, ModuleTranslationState, }; use wasmer_types::entity::{EntityRef, PrimaryMap}; +use wasmer_types::target::Target; use wasmer_types::{CompileError, FunctionIndex, LocalFunctionIndex, SignatureIndex}; use wasmer_vm::LibCall; diff --git a/lib/compiler-llvm/src/config.rs b/lib/compiler-llvm/src/config.rs index 5747d2c2d..f9223c323 100644 --- a/lib/compiler-llvm/src/config.rs +++ b/lib/compiler-llvm/src/config.rs @@ -8,11 +8,11 @@ use itertools::Itertools; use std::fmt::Debug; use std::sync::Arc; use target_lexicon::BinaryFormat; -use wasmer_compiler::{ - types::target::{Architecture, OperatingSystem, Target, Triple}, - Compiler, CompilerConfig, Engine, EngineBuilder, ModuleMiddleware, +use wasmer_compiler::{Compiler, CompilerConfig, Engine, EngineBuilder, ModuleMiddleware}; +use wasmer_types::{ + target::{Architecture, OperatingSystem, Target, Triple}, + Features, FunctionType, LocalFunctionIndex, }; -use wasmer_types::{Features, FunctionType, LocalFunctionIndex}; /// The InkWell ModuleInfo type pub type InkwellModule<'ctx> = inkwell::module::Module<'ctx>; diff --git a/lib/compiler-singlepass/src/arm64_decl.rs b/lib/compiler-singlepass/src/arm64_decl.rs index 7657306c8..948948805 100644 --- a/lib/compiler-singlepass/src/arm64_decl.rs +++ b/lib/compiler-singlepass/src/arm64_decl.rs @@ -6,7 +6,7 @@ use crate::{ }; use std::collections::BTreeMap; use std::slice::Iter; -use wasmer_compiler::types::target::CallingConvention; +use wasmer_types::target::CallingConvention; use wasmer_types::{CompileError, Type}; /// General-purpose registers. diff --git a/lib/compiler-singlepass/src/codegen.rs b/lib/compiler-singlepass/src/codegen.rs index ab012b096..795d9665d 100644 --- a/lib/compiler-singlepass/src/codegen.rs +++ b/lib/compiler-singlepass/src/codegen.rs @@ -20,7 +20,6 @@ use wasmer_compiler::{ function::{CompiledFunction, CompiledFunctionFrameInfo, FunctionBody}, relocation::{Relocation, RelocationTarget}, section::SectionIndex, - target::CallingConvention, }, wasmparser::{ BlockType as WpTypeOrFuncType, HeapType as WpHeapType, Operator, RefType as WpRefType, @@ -32,13 +31,13 @@ use wasmer_compiler::{ #[cfg(feature = "unwind")] use wasmer_compiler::types::unwind::CompiledFunctionUnwindInfo; +use wasmer_types::target::CallingConvention; use wasmer_types::{ entity::{EntityRef, PrimaryMap}, CompileError, FunctionIndex, FunctionType, GlobalIndex, LocalFunctionIndex, LocalMemoryIndex, MemoryIndex, MemoryStyle, ModuleInfo, SignatureIndex, TableIndex, TableStyle, TrapCode, Type, VMBuiltinFunctionIndex, VMOffsets, }; - /// The singlepass per-function code generator. pub struct FuncGen<'a, M: Machine> { // Immutable properties assigned at creation time. diff --git a/lib/compiler-singlepass/src/compiler.rs b/lib/compiler-singlepass/src/compiler.rs index 8f473648f..c8ea91bd9 100644 --- a/lib/compiler-singlepass/src/compiler.rs +++ b/lib/compiler-singlepass/src/compiler.rs @@ -25,12 +25,12 @@ use wasmer_compiler::{ function::{Compilation, CompiledFunction, FunctionBody, UnwindInfo}, module::CompileModuleInfo, section::SectionIndex, - target::{Architecture, CallingConvention, CpuFeature, OperatingSystem, Target}, }, Compiler, CompilerConfig, FunctionBinaryReader, FunctionBodyData, MiddlewareBinaryReader, ModuleMiddleware, ModuleMiddlewareChain, ModuleTranslationState, }; use wasmer_types::entity::{EntityRef, PrimaryMap}; +use wasmer_types::target::{Architecture, CallingConvention, CpuFeature, Target}; use wasmer_types::{ CompileError, FunctionIndex, FunctionType, LocalFunctionIndex, MemoryIndex, ModuleInfo, TableIndex, TrapCode, TrapInformation, VMOffsets, diff --git a/lib/compiler-singlepass/src/config.rs b/lib/compiler-singlepass/src/config.rs index 1787c45c0..71cd41d61 100644 --- a/lib/compiler-singlepass/src/config.rs +++ b/lib/compiler-singlepass/src/config.rs @@ -3,11 +3,11 @@ use crate::compiler::SinglepassCompiler; use std::sync::Arc; -use wasmer_compiler::{ - types::target::{CpuFeature, Target}, - Compiler, CompilerConfig, Engine, EngineBuilder, ModuleMiddleware, +use wasmer_compiler::{Compiler, CompilerConfig, Engine, EngineBuilder, ModuleMiddleware}; +use wasmer_types::{ + target::{CpuFeature, Target}, + Features, }; -use wasmer_types::Features; #[derive(Debug, Clone)] pub struct Singlepass { diff --git a/lib/compiler-singlepass/src/dwarf.rs b/lib/compiler-singlepass/src/dwarf.rs index 8254b1cea..118679966 100644 --- a/lib/compiler-singlepass/src/dwarf.rs +++ b/lib/compiler-singlepass/src/dwarf.rs @@ -5,9 +5,8 @@ use gimli::{ use wasmer_compiler::types::{ relocation::{Relocation, RelocationKind, RelocationTarget}, section::{CustomSection, CustomSectionProtection, SectionBody}, - target::Endianness, }; -use wasmer_types::{entity::EntityRef, LocalFunctionIndex}; +use wasmer_types::{entity::EntityRef, target::Endianness, LocalFunctionIndex}; #[derive(Clone, Debug)] pub struct WriterRelocate { diff --git a/lib/compiler-singlepass/src/emitter_arm64.rs b/lib/compiler-singlepass/src/emitter_arm64.rs index 0db30782e..46de91d1c 100644 --- a/lib/compiler-singlepass/src/emitter_arm64.rs +++ b/lib/compiler-singlepass/src/emitter_arm64.rs @@ -13,9 +13,10 @@ use dynasmrt::{ use wasmer_compiler::types::{ function::FunctionBody, section::{CustomSection, CustomSectionProtection, SectionBody}, - target::CallingConvention, }; -use wasmer_types::{CompileError, FunctionIndex, FunctionType, Type, VMOffsets}; +use wasmer_types::{ + target::CallingConvention, CompileError, FunctionIndex, FunctionType, Type, VMOffsets, +}; type Assembler = VecAssembler; diff --git a/lib/compiler-singlepass/src/emitter_x64.rs b/lib/compiler-singlepass/src/emitter_x64.rs index 2393725a4..a3da7a7b7 100644 --- a/lib/compiler-singlepass/src/emitter_x64.rs +++ b/lib/compiler-singlepass/src/emitter_x64.rs @@ -9,8 +9,7 @@ pub use crate::{ }; use dynasm::dynasm; use dynasmrt::{AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi}; -use wasmer_compiler::types::target::CpuFeature; -use wasmer_types::CompileError; +use wasmer_types::{target::CpuFeature, CompileError}; /// Force `dynasm!` to use the correct arch (x64) when cross-compiling. /// `dynasm!` proc-macro tries to auto-detect it by default by looking at the diff --git a/lib/compiler-singlepass/src/machine.rs b/lib/compiler-singlepass/src/machine.rs index 21ef77692..1207c5568 100644 --- a/lib/compiler-singlepass/src/machine.rs +++ b/lib/compiler-singlepass/src/machine.rs @@ -13,11 +13,11 @@ use wasmer_compiler::{ function::FunctionBody, relocation::{Relocation, RelocationTarget}, section::CustomSection, - target::{Architecture, CallingConvention, Target}, }, wasmparser::{MemArg, ValType as WpType}, }; use wasmer_types::{ + target::{Architecture, CallingConvention, Target}, CompileError, FunctionIndex, FunctionType, TrapCode, TrapInformation, VMOffsets, }; pub type Label = DynamicLabel; diff --git a/lib/compiler-singlepass/src/machine_arm64.rs b/lib/compiler-singlepass/src/machine_arm64.rs index d835d913c..15d8c73ad 100644 --- a/lib/compiler-singlepass/src/machine_arm64.rs +++ b/lib/compiler-singlepass/src/machine_arm64.rs @@ -8,11 +8,11 @@ use wasmer_compiler::{ function::FunctionBody, relocation::{Relocation, RelocationKind, RelocationTarget}, section::CustomSection, - target::{CallingConvention, CpuFeature, Target}, }, wasmparser::{MemArg, ValType as WpType}, }; use wasmer_types::{ + target::{CallingConvention, CpuFeature, Target}, CompileError, FunctionIndex, FunctionType, SourceLoc, TrapCode, TrapInformation, VMOffsets, }; diff --git a/lib/compiler-singlepass/src/machine_x64.rs b/lib/compiler-singlepass/src/machine_x64.rs index 83e025872..8c0066187 100644 --- a/lib/compiler-singlepass/src/machine_x64.rs +++ b/lib/compiler-singlepass/src/machine_x64.rs @@ -19,11 +19,11 @@ use wasmer_compiler::{ function::FunctionBody, relocation::{Relocation, RelocationKind, RelocationTarget}, section::{CustomSection, CustomSectionProtection, SectionBody}, - target::{CallingConvention, CpuFeature, Target}, }, wasmparser::{MemArg, ValType as WpType}, }; use wasmer_types::{ + target::{CallingConvention, CpuFeature, Target}, CompileError, FunctionIndex, FunctionType, SourceLoc, TrapCode, TrapInformation, Type, VMOffsets, }; @@ -8302,7 +8302,7 @@ mod test { use super::*; use enumset::enum_set; use std::str::FromStr; - use wasmer_compiler::types::target::{CpuFeature, Target, Triple}; + use wasmer_types::target::{CpuFeature, Target, Triple}; fn test_move_location(machine: &mut MachineX86_64) -> Result<(), CompileError> { machine.move_location_for_native( diff --git a/lib/compiler-singlepass/src/unwind.rs b/lib/compiler-singlepass/src/unwind.rs index 2045cdf17..babff85af 100644 --- a/lib/compiler-singlepass/src/unwind.rs +++ b/lib/compiler-singlepass/src/unwind.rs @@ -4,7 +4,7 @@ use gimli::write::{Address, CallFrameInstruction, CommonInformationEntry, FrameD use gimli::{AArch64, Encoding, Format, X86_64}; use std::fmt::Debug; #[cfg(feature = "unwind")] -use wasmer_compiler::types::target::Architecture; +use wasmer_types::target::Architecture; #[derive(Clone, Debug)] pub enum UnwindOps { diff --git a/lib/compiler-singlepass/src/x64_decl.rs b/lib/compiler-singlepass/src/x64_decl.rs index 0b5d04c4d..4b8c3f58a 100644 --- a/lib/compiler-singlepass/src/x64_decl.rs +++ b/lib/compiler-singlepass/src/x64_decl.rs @@ -6,8 +6,7 @@ use crate::location::CombinedRegister; use crate::location::Reg as AbstractReg; use std::collections::BTreeMap; use std::slice::Iter; -use wasmer_compiler::types::target::CallingConvention; -use wasmer_types::{CompileError, Type}; +use wasmer_types::{target::CallingConvention, CompileError, Type}; /// General-purpose registers. #[repr(u8)] diff --git a/lib/compiler/src/artifact_builders/artifact_builder.rs b/lib/compiler/src/artifact_builders/artifact_builder.rs index 138d83a6a..9e8586306 100644 --- a/lib/compiler/src/artifact_builders/artifact_builder.rs +++ b/lib/compiler/src/artifact_builders/artifact_builder.rs @@ -6,8 +6,7 @@ use super::trampoline::{libcall_trampoline_len, make_libcall_trampolines}; #[cfg(feature = "compiler")] use crate::{ - serialize::SerializableCompilation, types::target::Target, EngineInner, ModuleEnvironment, - ModuleMiddlewareChain, + serialize::SerializableCompilation, EngineInner, ModuleEnvironment, ModuleMiddlewareChain, }; use crate::{ serialize::{ @@ -19,10 +18,12 @@ use crate::{ module::CompileModuleInfo, relocation::Relocation, section::{CustomSection, SectionIndex}, - target::CpuFeature, }, ArtifactCreate, Features, }; +#[cfg(feature = "compiler")] +use wasmer_types::target::Target; + use core::mem::MaybeUninit; use enumset::EnumSet; use rkyv::rancor::Error as RkyvError; @@ -31,6 +32,7 @@ use shared_buffer::OwnedBuffer; use std::sync::Arc; use wasmer_types::{ entity::{ArchivedPrimaryMap, PrimaryMap}, + target::CpuFeature, DeserializeError, }; diff --git a/lib/compiler/src/artifact_builders/trampoline.rs b/lib/compiler/src/artifact_builders/trampoline.rs index 278be7e25..964493192 100644 --- a/lib/compiler/src/artifact_builders/trampoline.rs +++ b/lib/compiler/src/artifact_builders/trampoline.rs @@ -4,13 +4,12 @@ //! through normal branch instructions. use enum_iterator::IntoEnumIterator; -use target_lexicon::Architecture; +use wasmer_types::target::{Architecture, Target}; use wasmer_types::LibCall; use crate::types::{ relocation::{Relocation, RelocationKind, RelocationTarget}, section::{CustomSection, CustomSectionProtection, SectionBody}, - target::Target, }; // SystemV says that both x16 and x17 are available as intra-procedural scratch diff --git a/lib/compiler/src/compiler.rs b/lib/compiler/src/compiler.rs index cae49edde..c0a0820aa 100644 --- a/lib/compiler/src/compiler.rs +++ b/lib/compiler/src/compiler.rs @@ -1,15 +1,20 @@ //! This module mainly outputs the `Compiler` trait that custom //! compilers will need to implement. -use crate::types::{module::CompileModuleInfo, symbols::SymbolRegistry, target::Target}; +use crate::types::{module::CompileModuleInfo, symbols::SymbolRegistry}; use crate::{ lib::std::{boxed::Box, sync::Arc}, translator::ModuleMiddleware, - types::{function::Compilation, target::CpuFeature}, + types::function::Compilation, FunctionBodyData, ModuleTranslationState, }; use enumset::EnumSet; -use wasmer_types::{entity::PrimaryMap, error::CompileError, Features, LocalFunctionIndex}; +use wasmer_types::{ + entity::PrimaryMap, + error::CompileError, + target::{CpuFeature, Target}, + Features, LocalFunctionIndex, +}; use wasmparser::{Validator, WasmFeatures}; /// The compiler configuration options. diff --git a/lib/compiler/src/engine/artifact.rs b/lib/compiler/src/engine/artifact.rs index 074373f66..ea3092314 100644 --- a/lib/compiler/src/engine/artifact.rs +++ b/lib/compiler/src/engine/artifact.rs @@ -11,10 +11,7 @@ use crate::{ lib::std::vec::IntoIter, register_frame_info, resolve_imports, serialize::{MetadataHeader, SerializableModule}, - types::{ - relocation::{RelocationLike, RelocationTarget}, - target::{CpuFeature, Target}, - }, + types::relocation::{RelocationLike, RelocationTarget}, ArtifactBuild, ArtifactBuildFromArchive, ArtifactCreate, Engine, EngineInner, Features, FrameInfosVariant, FunctionExtent, GlobalFrameInfoRegistration, InstantiationError, ModuleEnvironment, Tunables, @@ -35,6 +32,7 @@ use crate::object::{emit_compilation, emit_data, get_object_for_target, Object}; use wasmer_types::{ entity::{BoxedSlice, PrimaryMap}, + target::{CpuFeature, Target}, ArchivedDataInitializerLocation, ArchivedOwnedDataInitializer, CompileError, DataInitializer, DataInitializerLike, DataInitializerLocation, DataInitializerLocationLike, DeserializeError, FunctionIndex, HashAlgorithm, LocalFunctionIndex, MemoryIndex, ModuleInfo, diff --git a/lib/compiler/src/engine/builder.rs b/lib/compiler/src/engine/builder.rs index 3ff0d5cdb..624fcfaea 100644 --- a/lib/compiler/src/engine/builder.rs +++ b/lib/compiler/src/engine/builder.rs @@ -1,6 +1,6 @@ use super::Engine; -use crate::{types::target::Target, CompilerConfig}; -use wasmer_types::{Features, HashAlgorithm}; +use crate::CompilerConfig; +use wasmer_types::{target::Target, Features, HashAlgorithm}; /// The Builder contents of `Engine` pub struct EngineBuilder { diff --git a/lib/compiler/src/engine/inner.rs b/lib/compiler/src/engine/inner.rs index 16e0e45fe..54d2cef52 100644 --- a/lib/compiler/src/engine/inner.rs +++ b/lib/compiler/src/engine/inner.rs @@ -1,6 +1,6 @@ //! Universal compilation. -use crate::{engine::builder::EngineBuilder, types::target::Target}; +use crate::engine::builder::EngineBuilder; #[cfg(not(target_arch = "wasm32"))] use crate::{ types::{ @@ -22,8 +22,8 @@ use std::sync::{Arc, Mutex}; #[cfg(not(target_arch = "wasm32"))] use wasmer_types::{ - entity::PrimaryMap, DeserializeError, FunctionIndex, FunctionType, LocalFunctionIndex, - SignatureIndex, + entity::PrimaryMap, target::Target, DeserializeError, FunctionIndex, FunctionType, + LocalFunctionIndex, SignatureIndex, }; use wasmer_types::{CompileError, Features, HashAlgorithm}; diff --git a/lib/compiler/src/engine/tunables.rs b/lib/compiler/src/engine/tunables.rs index 163001582..c3c8255c9 100644 --- a/lib/compiler/src/engine/tunables.rs +++ b/lib/compiler/src/engine/tunables.rs @@ -1,8 +1,8 @@ use crate::engine::error::LinkError; -use crate::types::target::{PointerWidth, Target}; use std::ptr::NonNull; use wasmer_types::entity::{EntityRef, PrimaryMap}; use wasmer_types::{ + target::{PointerWidth, Target}, FunctionType, GlobalType, LocalGlobalIndex, LocalMemoryIndex, LocalTableIndex, LocalTagIndex, MemoryIndex, MemoryType, ModuleInfo, Pages, TableIndex, TableType, TagKind, }; diff --git a/lib/compiler/src/object/module.rs b/lib/compiler/src/object/module.rs index 283c70edf..4681393eb 100644 --- a/lib/compiler/src/object/module.rs +++ b/lib/compiler/src/object/module.rs @@ -4,7 +4,6 @@ use crate::types::{ relocation::{RelocationKind as Reloc, RelocationTarget}, section::{CustomSectionProtection, SectionIndex}, symbols::{Symbol, SymbolRegistry}, - target::{Architecture, BinaryFormat, Endianness, Triple}, }; use object::{ elf, macho, @@ -15,6 +14,7 @@ use object::{ SymbolScope, }; use wasmer_types::entity::PrimaryMap; +use wasmer_types::target::{Architecture, BinaryFormat, Endianness, Triple}; use wasmer_types::LocalFunctionIndex; const DWARF_SECTION_NAME: &[u8] = b".eh_frame"; diff --git a/lib/compiler/src/serialize.rs b/lib/compiler/src/serialize.rs index e5bdb354d..1071d700c 100644 --- a/lib/compiler/src/serialize.rs +++ b/lib/compiler/src/serialize.rs @@ -9,14 +9,13 @@ use crate::types::{ module::CompileModuleInfo, relocation::Relocation, section::{CustomSection, SectionIndex}, - target::CpuFeature, }; use enumset::EnumSet; use rkyv::{Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize}; use wasmer_types::{ - entity::PrimaryMap, DeserializeError, Features, FunctionIndex, LocalFunctionIndex, MemoryIndex, - MemoryStyle, ModuleInfo, OwnedDataInitializer, SerializeError, SignatureIndex, TableIndex, - TableStyle, + entity::PrimaryMap, target::CpuFeature, DeserializeError, Features, FunctionIndex, + LocalFunctionIndex, MemoryIndex, MemoryStyle, ModuleInfo, OwnedDataInitializer, SerializeError, + SignatureIndex, TableIndex, TableStyle, }; pub use wasmer_types::MetadataHeader; diff --git a/lib/compiler/src/traits.rs b/lib/compiler/src/traits.rs index a2b952593..2a23b2fcc 100644 --- a/lib/compiler/src/traits.rs +++ b/lib/compiler/src/traits.rs @@ -1,6 +1,5 @@ //! Generic Artifact abstraction for Wasmer Engines. -use crate::types::target::CpuFeature; use crate::Features; use enumset::EnumSet; use std::any::Any; @@ -8,7 +7,8 @@ use std::sync::Arc; use wasmer_types::entity::PrimaryMap; use wasmer_types::SerializeError; use wasmer_types::{ - DataInitializerLike, MemoryIndex, MemoryStyle, ModuleInfo, TableIndex, TableStyle, + target::CpuFeature, DataInitializerLike, MemoryIndex, MemoryStyle, ModuleInfo, TableIndex, + TableStyle, }; /// An `Artifact` is the product that the `Engine` diff --git a/lib/compiler/src/types/mod.rs b/lib/compiler/src/types/mod.rs index 624cd2de1..cbd531b35 100644 --- a/lib/compiler/src/types/mod.rs +++ b/lib/compiler/src/types/mod.rs @@ -6,5 +6,4 @@ pub mod module; pub mod relocation; pub mod section; pub mod symbols; -pub mod target; pub mod unwind; diff --git a/lib/types/src/lib.rs b/lib/types/src/lib.rs index 4309f7801..e9594a885 100644 --- a/lib/types/src/lib.rs +++ b/lib/types/src/lib.rs @@ -62,6 +62,7 @@ mod serialize; mod stack; mod store_id; mod table; +pub mod target; mod trapcode; mod types; mod units; @@ -90,13 +91,13 @@ pub use crate::initializers::{ pub use crate::memory::{Memory32, Memory64, MemorySize}; pub use crate::module::{ExportsIterator, ImportKey, ImportsIterator, ModuleInfo}; pub use crate::module_hash::{HashAlgorithm, ModuleHash}; -pub use crate::units::{ - Bytes, PageCountOutOfRange, Pages, WASM_MAX_PAGES, WASM_MIN_PAGES, WASM_PAGE_SIZE, -}; -pub use types::{ +pub use crate::types::{ ExportType, ExternType, FunctionType, GlobalInit, GlobalType, ImportType, MemoryType, Mutability, TableType, TagKind, TagType, Type, V128, }; +pub use crate::units::{ + Bytes, PageCountOutOfRange, Pages, WASM_MAX_PAGES, WASM_MIN_PAGES, WASM_PAGE_SIZE, +}; pub use value::{RawValue, ValueType}; pub use crate::libcalls::LibCall; diff --git a/lib/compiler/src/types/target.rs b/lib/types/src/target.rs similarity index 99% rename from lib/compiler/src/types/target.rs rename to lib/types/src/target.rs index bf6bbd289..5aec0d0e6 100644 --- a/lib/compiler/src/types/target.rs +++ b/lib/types/src/target.rs @@ -8,13 +8,13 @@ // Same things is now happening with unused-unit for the EnumSetType derivative #![allow(clippy::unused_unit, clippy::use_self)] +use crate::error::ParseCpuFeatureError; use enumset::{EnumSet, EnumSetType}; use std::str::FromStr; pub use target_lexicon::{ Aarch64Architecture, Architecture, BinaryFormat, CallingConvention, Endianness, Environment, OperatingSystem, PointerWidth, Triple, Vendor, }; -use wasmer_types::error::ParseCpuFeatureError; /// The nomenclature is inspired by the [`cpuid` crate]. /// The list of supported features was initially retrieved from