- Notifications
You must be signed in to change notification settings - Fork8.2k
py/asmthumb: Implement long jumps on Thumb/armv6m architecture.#17293
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
dpgeorge wants to merge1 commit intomicropython:masterChoose a base branch fromdpgeorge:py-asmthumb-implement-armv6m-long-jump
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Open
py/asmthumb: Implement long jumps on Thumb/armv6m architecture.#17293
dpgeorge wants to merge1 commit intomicropython:masterfromdpgeorge:py-asmthumb-implement-armv6m-long-jump
Conversation
This file contains hidden or 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
With this change, all tests (except thread tests) now pass on RPI_PICO whenusing the native emitter: (plug in RPI_PICO) $ cd tests $ ./run-tests.py -t a0 --via-mpy --emit nativeSigned-off-by: Damien George <damien@micropython.org>
@agatti FYI |
Code size report:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #17293 +/- ##======================================= Coverage 98.54% 98.54% ======================================= Files 169 169 Lines 21897 21897 ======================================= Hits 21579 21579 Misses 318 318 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
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.
Summary
Implement long jumps (greater than +/- 2k code distance) for armv6m targets, eg RPI_PICO.
With this change, all tests (except thread tests) now pass on RPI_PICO when using the native emitter:
Testing
Tested on an RPI_PICO as above. Prior to this PR 8 tests would fail due to large jumps not being implemented. Now they pass.
Trade-offs and Alternatives
All forwards jumps now take 8 or 10 bytes, whereas previously they took only 2 bytes. That's just because it's not possible to know in advance how long the jump is, and the emitter must commit to the size of the instruction in early passes (one day that could be improved by adding more assembler passes).
The jump can now clobber register
r1
, which it uses as a temporary to calculate the long jump. Clobbering this register is OK, it's anyway used as a temporary in the native emitter and is never needed across jumps (butr0
is because it's used to return a value from the function, so that can't be used here as a temporary).