Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types) Remove dependency to cranelift-entity #2195

Merged
merged 5 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/compiler-cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ edition = "2018"
wasmer-compiler = { path = "../compiler", version = "1.0.2", features = ["translator"], default-features = false }
wasmer-vm = { path = "../vm", version = "1.0.2" }
wasmer-types = { path = "../wasmer-types", version = "1.0.2", default-features = false, features = ["std"] }
cranelift-entity = { version = "0.70", default-features = false }
cranelift-codegen = { version = "0.70", default-features = false, features = ["x86", "arm64"] }
cranelift-frontend = { version = "0.70", default-features = false }
tracing = "0.1"
Expand All @@ -36,7 +37,7 @@ maintenance = { status = "actively-developed" }
[features]
default = ["std", "enable-serde", "unwind"]
unwind = ["cranelift-codegen/unwind", "gimli"]
enable-serde = ["wasmer-compiler/enable-serde", "wasmer-types/enable-serde"]
enable-serde = ["wasmer-compiler/enable-serde", "wasmer-types/enable-serde", "cranelift-entity/enable-serde"]
std = ["cranelift-codegen/std", "cranelift-frontend/std", "wasmer-compiler/std", "wasmer-types/std"]
core = ["hashbrown", "cranelift-codegen/core", "cranelift-frontend/core"]

Expand Down
1 change: 1 addition & 0 deletions lib/compiler-cranelift/src/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use crate::translator::{irlibcall_to_libcall, irreloc_to_relocationkind};
use cranelift_codegen::binemit;
use cranelift_codegen::ir::{self, ExternalName};
use cranelift_entity::EntityRef as CraneliftEntityRef;
use wasmer_compiler::{JumpTable, Relocation, RelocationTarget, TrapInformation};
use wasmer_types::entity::EntityRef;
use wasmer_types::{FunctionIndex, LocalFunctionIndex};
Expand Down
3 changes: 2 additions & 1 deletion lib/compiler-cranelift/src/translator/translation_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use core::u32;
use cranelift_codegen::binemit::Reloc;
use cranelift_codegen::ir::{self, AbiParam};
use cranelift_codegen::isa::TargetFrontendConfig;
use cranelift_entity::{EntityRef as CraneliftEntityRef, SecondaryMap as CraneliftSecondaryMap};
use cranelift_frontend::FunctionBuilder;
use wasmer_compiler::wasm_unsupported;
use wasmer_compiler::wasmparser;
Expand Down Expand Up @@ -148,7 +149,7 @@ pub fn get_vmctx_value_label() -> ir::ValueLabel {

/// Transforms Cranelift JumpTable's into runtime JumpTables
pub fn transform_jump_table(
jt_offsets: SecondaryMap<ir::JumpTable, u32>,
jt_offsets: CraneliftSecondaryMap<ir::JumpTable, u32>,
) -> SecondaryMap<JumpTable, u32> {
let mut func_jt_offsets = SecondaryMap::with_capacity(jt_offsets.capacity());

Expand Down
5 changes: 1 addition & 4 deletions lib/wasmer-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ readme = "README.md"
edition = "2018"

[dependencies]
# We use `cranelift-entity` here because it's a lightweight dependency and it contains
# some useful data structures
cranelift-entity = "0.70"
serde = { version = "1.0", features = ["derive"], optional = true, default-features = false }
thiserror = "1.0"

[features]
default = ["std", "enable-serde"]
std = ["serde/std"]
core = []
enable-serde = ["serde", "cranelift-entity/enable-serde"]
enable-serde = ["serde"]
7 changes: 7 additions & 0 deletions lib/wasmer-types/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# `wasmer-types` [![Build Status](https://github.com/wasmerio/wasmer/workflows/build/badge.svg?style=flat-square)](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [![Join Wasmer Slack](https://img.shields.io/static/v1?label=Slack&message=join%20chat&color=brighgreen&style=flat-square)](https://slack.wasmer.io) [![MIT License](https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square)](https://github.com/wasmerio/wasmer/blob/master/LICENSE)

This crate provides the basic structures to use WebAssembly easily anywhere.

### Acknowledgments

This project borrowed some of the code for the entity structure from [cranelift-entity](https://crates.io/crates/cranelift-entity).
We decided to move it here to help on serialization/deserialization and also to ease the integration with other tools like `loupe`.

Please check [Wasmer ATTRIBUTIONS](https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md) to further see licenses and other attributions of the project.
Loading