Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.3k
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
py/asmthumb: Implement long jumps on Thumb/armv6m architecture.#17293
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@agatti FYI |
github-actionsbot commentedMay 13, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Code size report:
|
codecovbot commentedMay 13, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 21938 21938 ======================================= Hits 21618 21618 Misses 320 320 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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>
3e320ac
to5f4abeb
Compare5f4abeb
intomicropython:masterUh oh!
There was an error while loading.Please reload this page.
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).