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

State preserving for LLVM, and Singlepass -> LLVM OSR-based tier switching. #567

Merged
merged 64 commits into from
Sep 1, 2019

Conversation

losfair
Copy link
Contributor

@losfair losfair commented Jul 17, 2019

No description provided.

lib/llvm-backend/cpp/object_loader.cpp Outdated Show resolved Hide resolved
lib/llvm-backend/cpp/object_loader.cpp Outdated Show resolved Hide resolved
lib/llvm-backend/src/backend.rs Outdated Show resolved Hide resolved
lib/runtime-core/src/fault.rs Show resolved Hide resolved
lib/runtime-core/src/state.rs Outdated Show resolved Hide resolved
lib/runtime-core/src/state.rs Show resolved Hide resolved
22 => X64Register::XMM(XMM::XMM5),
23 => X64Register::XMM(XMM::XMM6),
24 => X64Register::XMM(XMM::XMM7),
_ => return None,
Copy link
Contributor

Choose a reason for hiding this comment

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

This applies to LLVM generated code too, right? Any reason to believe LLVM will never use XMM8--XMM31? YMM? ZMM/K (AVX-512)? I'm willing to say that we will never use x87 floating point stack or MMX registers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Will add XMM8-XMM31 in. Since all values tracked by the stack map are not larger than 64 bits (SIMD is an exception, but can fix it later), saving just XMM8-31 should be enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it works then it's fine for now, but I can't promise that LLVM won't pack four 64-bit values together in a YMM register for example. It could if it wanted to, it just doesn't seem to want to.

What goes wrong if LLVM uses registers that aren't listed here? a) Will it cause problems at runtime or do we just realize we can't tier-switch at this point and ignore it? b) Is there a way I can test whether other registers are used, starting with a given Wasm file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the LLVM values "semantically" are at most 64 bits, then the equivalent runtime locations are unlikely to be larger than 64 bits - I don't think there's a way to represent in stackmap a value with different sizes between LLVM value and runtime location. Also, with the presence of stackmap some LLVM optimizations won't apply.

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 compiler will panic if this function returns None, indicating a bug.

lib/singlepass-backend/src/codegen_x64.rs Show resolved Hide resolved
lib/runtime-core/src/state.rs Outdated Show resolved Hide resolved
lib/llvm-backend/src/code.rs Outdated Show resolved Hide resolved
@syrusakbary
Copy link
Member

@losfair losfair marked this pull request as ready for review August 9, 2019 18:45
@bors
Copy link
Contributor

bors bot commented Aug 22, 2019

try

Build failed

@losfair
Copy link
Contributor Author

losfair commented Aug 23, 2019

bors try

bors bot added a commit that referenced this pull request Aug 23, 2019
@bors
Copy link
Contributor

bors bot commented Aug 23, 2019

try

Build failed

@losfair
Copy link
Contributor Author

losfair commented Aug 23, 2019

bors try

bors bot added a commit that referenced this pull request Aug 23, 2019
@bors
Copy link
Contributor

bors bot commented Aug 23, 2019

try

Build failed

@losfair
Copy link
Contributor Author

losfair commented Aug 23, 2019

bors try

bors bot added a commit that referenced this pull request Aug 23, 2019
@bors
Copy link
Contributor

bors bot commented Aug 23, 2019

try

Build failed

@losfair
Copy link
Contributor Author

losfair commented Sep 1, 2019

bors try

bors bot added a commit that referenced this pull request Sep 1, 2019
@bors
Copy link
Contributor

bors bot commented Sep 1, 2019

try

Build failed

  • wasmerio.wasmer

@losfair
Copy link
Contributor Author

losfair commented Sep 1, 2019

bors try

bors bot added a commit that referenced this pull request Sep 1, 2019
@wasmerio wasmerio deleted a comment from bors bot Sep 1, 2019
@wasmerio wasmerio deleted a comment from bors bot Sep 1, 2019
@losfair
Copy link
Contributor Author

losfair commented Sep 1, 2019

The failing Test linux test passes for me locally. Manually merging.

@losfair losfair merged commit c28b5d4 into master Sep 1, 2019
@bors bors bot deleted the feature/llvm-osr branch September 1, 2019 11:06
@bors
Copy link
Contributor

bors bot commented Sep 1, 2019

try

Build failed

  • wasmerio.wasmer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants