-
Notifications
You must be signed in to change notification settings - Fork 847
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
Single-pass native code generation for x86-64 using dynasm. #276
Merged
Merged
Changes from 1 commit
Commits
Show all changes
112 commits
Select commit
Hold shift + click to select a range
9649219
Initial work on WebAssembly parser for Dynasm backend.
losfair f735471
Merge remote-tracking branch 'private/master' into feature/dynasm-bac…
losfair af19f5c
Update dependencies.
losfair bbb27be
Code generation framework.
losfair ffc1bde
Cleanup & add imports.
losfair 2fbb5e3
Codegen backend for x64.
losfair 4ebb22f
Calling conventions, value stack, and runtime stack layout.
losfair a69c5b4
stack: Helper functions and unified return types
losfair 43df3dd
Use System V calling convention and implement a few opcodes.
losfair 7df7204
codegen: More opcodes
losfair 8d8db4a
Starting integration.
losfair 1526d35
Emit a Return opcode if the last one is not return.
losfair bb52a4e
Now we can run `add`!
losfair 5583e96
Mitigate a bug that causes incorrect code generation.
losfair 93d2713
Operators.
losfair 61c8350
Control frames, jumps & stack unwinding.
losfair aaabbf1
Operator::Br and control stack fixes
losfair 6f97ebd
Remove a hack in parser.
losfair 63b3f41
Handle unreachable and fix return.
losfair 7c43993
Block and conditional branch.
losfair 08a2ec8
Unary operators, comparison opcodes, loops, etc.
losfair 693c9fd
Single-pass backend tests.
losfair e9c0325
Update dependencies
losfair 09cbd4a
Changed to using custom calling conventions; Implemented direct calls.
losfair b2f5f77
Add direct call test
losfair dbebdf9
Code generation for br_table.
losfair 2432a6c
Fix function calls.
losfair da1a3fa
Add test for br_table.
losfair 80812e3
Implement native call & fix stack alignment.
losfair 78fd995
Fix argument passing at entry.
losfair b18595f
Pass command-line arguments to wasm as i32.
losfair 5302949
Allow more registers to be used.
losfair 9d8c5a5
Add a note on incorrect code generation.
losfair 3c3c5db
Native trampolines.
losfair d50f1cc
If/Else.
losfair ec9a8f0
Add test for if/else.
losfair b7ca5e4
Add Select opcode.
losfair adb309f
Add select test.
losfair 64142c4
Reserve R15.
losfair e026adf
Initial work on linear memory.
losfair aa75994
Add memory opcodes and test.
losfair 2962fe2
Add unwinding test.
losfair fa61b66
Strongly type scratch registers and fixed an unwinding issue.
losfair bd7698e
64-bit operators.
losfair 5a97a25
Add basic test for i64.
losfair 27b2061
Implemented missing integer operators and fixed division.
losfair 8d2e877
tee_local and div tests
losfair 12c2137
Hack around calling imports. Not yet working.
losfair 258dea6
Fix calling imports.
losfair 4c4743e
Globals.
losfair 3efccbe
Support imported globals.
losfair 25034ec
Almost finished indirect calls.
losfair c6dfbcd
Add tests.
losfair c5ef0a9
Update vm::Ctx.
losfair 683cb20
Fix call_indirect.
losfair c3b0bd7
Validate return values in indirect call test.
losfair 1fc7b31
Add missing trait items to DynasmCompiler so that cargo build --all w…
bjfish 557be77
Merge branch 'master' into feature/dynasm-backend
bjfish a5bab8c
Updates to compile dynasm after merge from master
bjfish 68181ac
Add dynasm to spectests
bjfish d4ded2c
Fix bugs found when running spectests.
losfair 179bbf9
Fix integer division.
losfair e5d67c9
Add dynasm feature to emscripten tests
bjfish d80ea47
FIx bugs found with spectests.
losfair c76887d
Merge remote-tracking branch 'private/feature/dynasm-backend' into fe…
losfair 592c3fb
Fixes and some floating point operations.
losfair 4d2b6a0
Add Copy + Clone for IfElseState
losfair 1104073
Implemented more floating point operations.
losfair 1b5ea9b
Passes all `assert_return(_*)` tests.
losfair 53a8fca
Make wasmer executable work with dynasm
syrusakbary 81af8cf
Fixed several bugs in the single-pass backend and implemented a runti…
losfair 1f8c644
Merge remote-tracking branch 'private/feature/dynasm-backend' into fe…
losfair f8fe999
Implemented protected call and floating point traps; passing all spec…
losfair d8d39c3
Fix warnings.
losfair 7394df2
FIx floating point trunc's.
losfair 08f4526
Merge remote-tracking branch 'origin/master' into feature/dynasm-backend
losfair fcfde73
Use R15 as temporary register.
losfair 337b2eb
Add dynasm tests to the Makefile
bjfish 99faa79
Run cargo fmt.
losfair 6c40ea1
Cargo fmt more files.
losfair e2a3887
Merge remote-tracking branch 'private/feature/dynasm-backend' into fe…
losfair 4ca27b6
Manually fix lint errors.
losfair e48ff02
Remove commented out code.
losfair c5694ec
Fix lint errors.
losfair 662a649
Only run dynasm tests on nightly.
losfair e1cb4fc
Removed submodule cranlift
bjfish caa239a
Make wasmer-dynasm-backend optional.
losfair 75678b5
Merge remote-tracking branch 'origin/feature/dynasm-backend' into fea…
losfair b94c046
Remove println.
losfair af8f307
Fix dependencies.
losfair cd5c145
Fix default compiler.
losfair b06a49e
Move wasmer-dynasm-backend out of default-compiler.
losfair eb606a6
Disable clippy temporarily.
losfair af24cfc
Exclude dynasm backend in cargo test.
losfair 2ab2205
Allow cross-module indirect calls.
losfair ebaf2dc
Make DynFunc::func_index private.
losfair 61abe70
cargo fmt
losfair a006a36
Cleanup.
losfair 14da8ab
Run-time memory bound checking.
losfair 4256ccb
Cleanup & fix need_check condition.
losfair 7ee364a
Cargo fmt.
losfair fd60631
Remove '+nightly' in Makefile.
losfair f0e8f22
Merge remote-tracking branch 'origin/master' into feature/dynasm-backend
losfair 82b2034
Run clippy on nightly rust.
losfair 8b85099
Unset global git redirection.
losfair 295efbf
Fix clippy errors.
losfair 01f18b2
Merge remote-tracking branch 'origin/master' into feature/dynasm-backend
losfair 395161a
Merge remote-tracking branch 'origin/master' into feature/dynasm-backend
losfair cb3846f
Add `InternalCtx`.
losfair a4ee873
Merge remote-tracking branch 'origin/master' into feature/dynasm-backend
losfair 26e4278
Make the `internal` field private from outside.
losfair 08ba696
Fix vmctx offset tests.
losfair File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update vm::Ctx.
- Loading branch information
commit c5ef0a96e90d64150247096e6b16ba497dd93551
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is it necessary for these to be public outside of the crate?
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.
These fields need to be public to be accessed from the codegen backend. Otherwise we have to access these fields by offsets which is not clean.
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.
The ctx has been designed to be usable without falling back on rust. Can you use either offsets or implement it in assembly so that it doesn't need to call rust to do call_indirect?
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.
Dynasm provides a quite good feature that computes offset of a struct field automatically by name. Even only for this reason, it's good to keep these fields public.
Also, I prefer to implement cold or large code paths in Rust to improve cleanness and make it less error-prone. Currently the only two functions implemented in assembly are
CONSTRUCT_STACK_AND_CALL_NATIVE
andCALL_WASM
which both does some low-level stuff that converts calling conventions.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.
The Context is exposed to the user of the runtime, so it's not ideal for these internal fields to be public. I'd be okay with making an
InternalVmCtx
struct that has these fields public, and then is part of theVmctx
struct.