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

Feature/llvm pic mcsmall #1607

Closed
wants to merge 18 commits into from
Closed

Feature/llvm pic mcsmall #1607

wants to merge 18 commits into from

Conversation

nlewycky
Copy link
Contributor

Description

Review

  • Add a short description of the the change to the CHANGELOG.md file

There's no connection the target pointer size and which relocations exist. Relocations may affect as many bytes, or even just bits, as they like.
Return custom sections from JITEngineInner::allocate.

In CodeMemory, move the `mmap` member after the `unwind_registries` member. The UnwindRegistry registers by pointer into the memory owned by the Mmap, once the Mmap is deleted, this is gone. (Yes, this means that the Arc<> here is somewhat fictitious, if unwind_registries haven't been dropped before this point then attempting to drop them after mmap will dereference a dangling pointer.)

Make SectionBodyPtr a full wrapper type instead of a type alias so that we can use SectionBodyPtr(expr) syntax.
@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2020

Codecov Report

Merging #1607 into master will decrease coverage by 0.04%.
The diff coverage is 37.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1607      +/-   ##
==========================================
- Coverage   31.76%   31.72%   -0.05%     
==========================================
  Files         185      185              
  Lines       27017    26995      -22     
==========================================
- Hits         8583     8564      -19     
+ Misses      18434    18431       -3     
Impacted Files Coverage Δ
lib/compiler-llvm/src/trampoline/wasm.rs 73.30% <0.00%> (ø)
lib/compiler-llvm/src/translator/abi.rs 87.74% <ø> (ø)
lib/compiler/src/relocation.rs 7.31% <0.00%> (-0.38%) ⬇️
lib/object/src/module.rs 0.00% <0.00%> (ø)
lib/vm/src/lib.rs 25.00% <0.00%> (-25.00%) ⬇️
lib/engine-jit/src/engine.rs 40.18% <28.88%> (+0.71%) ⬆️
lib/engine-jit/src/code_memory.rs 34.73% <39.18%> (-10.10%) ⬇️
lib/compiler-llvm/src/compiler.rs 26.08% <50.00%> (-0.29%) ⬇️
lib/compiler-llvm/src/object_file.rs 71.76% <62.50%> (-2.36%) ⬇️
lib/compiler-singlepass/src/codegen_x64.rs 34.51% <100.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c6e4563...eb99744. Read the comment docs.

@@ -37,22 +37,18 @@ fn apply_relocation(
};

match r.kind {
#[cfg(target_pointer_width = "64")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intentional. JIT can only support the target pointer widths for the target architecture.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relocation specifies how many bits it modifies, regardless of the pointer width on the machine. For example AArch64 has LD_PREL_LO19 which edits exactly 19 bits of the value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I understand that.

What I mean is, before if you were trying to run code compiled for a 64 bit machine, in a 32 bit machine, it would have fall back to a panic! ->

kind => panic!(
"Relocation kind unsupported in the current architecture {}",
kind
),

By removing the cfg macro, it will silently fail until you actually try to run it. Which I think is a worse developer experience.

@@ -157,7 +157,7 @@ pub struct JITEngineInner {
features: Features,
/// The code memory is responsible of publishing the compiled
/// functions to memory.
code_memory: CodeMemory,
code_memory: Vec<CodeMemory>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to understand the needs/implications of this. I guess now each artifact will have its own CodeMemory?
Is that assumption accurate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and each CodeMemory has one Mmap. To get small code model to work, everything a compiled module needs is within a single 32-bit region.

@Hywan Hywan added 🎉 enhancement New feature! 📦 lib-compiler-llvm About wasmer-compiler-llvm labels Jul 19, 2021
@syrusakbary
Copy link
Member

Marking this as obsolete as this have changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature! 📦 lib-compiler-llvm About wasmer-compiler-llvm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants