-
Notifications
You must be signed in to change notification settings - Fork 824
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
Experimental Native Compilation Refactor #2272
Conversation
# Conflicts: # lib/compiler-llvm/src/compiler.rs # lib/engine-native/src/artifact.rs
Co-authored-by: nlewycky <[email protected]>
Co-authored-by: nlewycky <[email protected]>
# Conflicts: # Cargo.lock # fuzz/Cargo.lock
# Conflicts: # Cargo.lock # fuzz/Cargo.lock # lib/engine-native/src/artifact.rs # lib/vm/src/trap/trapcode.rs
.args(link_aganist_extra_libs) | ||
.arg("-o") | ||
.arg(&self.output_path); | ||
println!("COMMAND: {:?}", command); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Remove
#[derive(Clone, Debug, PartialEq, Eq)] | ||
pub struct ExperimentalNativeCompilation { | ||
/// The contents of emitted object files | ||
pub object_files: Vec<Vec<u8>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the comment document the order of these? Is the order deterministic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the order is deterministic as the current implementation (per llvm-compilation), but IMHO should not be required since it's just an implementation detail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please comment that the order is irrelevant but deterministic. It helps the next person understand this data.
lib/engine-native/src/serialize.rs
Outdated
pub fn serialize(&mut self) -> Result<Vec<u8>, CompileError> { | ||
/// Serialize the Metadata into bytes | ||
/// The bytes will have the following format: | ||
/// RKYV serialization (any length) + POS (8 bytes) + Endian (1 byte) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POS?
Co-authored-by: nlewycky <[email protected]>
Co-authored-by: nlewycky <[email protected]>
Co-authored-by: nlewycky <[email protected]>
# Conflicts: # Cargo.lock # fuzz/Cargo.lock # lib/compiler-llvm/Cargo.toml # lib/compiler-llvm/src/object_file.rs
lib/cli/src/commands/create_exe.rs
Outdated
#[cfg(not(windows))] | ||
let wasm_object_path = PathBuf::from("wasm.o"); | ||
let wasm_object_path = PathBuf::from("wasm.a"); | ||
#[cfg(windows)] | ||
let wasm_object_path = PathBuf::from("wasm.obj"); | ||
let wasm_object_path = PathBuf::from("wasm.a"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer need windows/non-windows here since they're the same.
Co-authored-by: nlewycky <[email protected]>
Co-authored-by: nlewycky <[email protected]>
Co-authored-by: nlewycky <[email protected]>
bors try |
tryBuild failed: |
2342: Engine native (slim) r=syrusakbary a=syrusakbary <!-- Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test: https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests --> # Description This PR is the slim version of #2272. It advances on: * [x] Stops encoding the endian into the serialized data (rkyv already does that for us since `0.6.1`) * [x] Sets the proper function lengths in the native engine * [x] Catch signal traps only when the pc is originated from a Wasm function, and not in the host (fixing #2328) <!-- Provide details regarding the change including motivation, links to related issues, and the context of the PR. --> # Review - [ ] Add a short description of the change to the CHANGELOG.md file Co-authored-by: Syrus <[email protected]> Co-authored-by: Syrus Akbary <[email protected]> Co-authored-by: Mark McCaskey <[email protected]>
Description
This PR refactors the experimental native compilation, making it much more resilient.
lld
linker (we can embed it in the future)This PR is also designed in mind to make much easier the creation and parsing of SourceMaps that we can use later to detect traps in an exact location.
For the trap info to be completely binded we will need to merge this PR first:
#2250
And for traps to be working all the way on LLVM, we will need to merge this after:
#2216
Edit by @Hywan: Fixes #1727
Review