forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Switch the compiler to use relative jumps instead of absolute jumps. 1. The function `relocate_control_flow` is now removed. It used to move basic blocks around in case absolute addresses crossed the easily addressable boundary. The code movement can then avoid having to load the address to a register and using indirect jumps. This is unlikely to happen with relative jumps. But if it does, the existing algorithm wouldn't work anyway. So we can add a new one when required later. 2. In the case of function call jumps, we use `$pc` to save the return address for the callee. This is a bit inefficient as it involves 3 extra computations: `$$reta = ($pc - $is) / 4 + offset_to_return_point`. We could change this to the following: Since we already have a common return point for every function, compute the relative offset from that point to the callee return point statically and use that. We don't have the infrastructure to do that right now, but it shouldn't be too difficult an extension. Fixes FuelLabs#4443
- Loading branch information
1 parent
62f9857
commit 01ee3cb
Showing
32 changed files
with
426 additions
and
501 deletions.
There are no files selected for viewing
626 changes: 290 additions & 336 deletions
626
sway-core/src/asm_generation/fuel/allocated_abstract_instruction_set.rs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
5 changes: 5 additions & 0 deletions
5
test/src/e2e_vm_tests/test_programs/should_pass/language/far_jumps/many_blobs/Forc.lock
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
[[package]] | ||
name = 'core' | ||
source = 'path+from-root-CA7273114FB9B4E5' | ||
|
||
[[package]] | ||
name = 'many_blobs' | ||
source = 'member' | ||
dependencies = ['core'] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ name = "many_blobs" | |
implicit-std = false | ||
|
||
[dependencies] | ||
core = { path = "../../../../../../../../sway-lib-core" } |
Oops, something went wrong.