Skip to content

Conversation

@pguyot
Copy link
Collaborator

@pguyot pguyot commented Oct 6, 2025

Continuation of:

This cross compilation revealed 32 bits bugs.

  • Fix a warning that appeared with armhf builds
  • Fix a bug with erlang:setnode/2 that failed on armhf when tested against recent versions of epmd
  • Fixed TRACE format strings that generated warnings on armhf when TRACE was enabled in opcodesswitch.h
  • Cross compile for armhf and s390x instead of emulating compiler

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

@pguyot pguyot marked this pull request as draft October 7, 2025 05:44
@pguyot pguyot force-pushed the w40/cross-compile-build branch from 6fbc269 to f7fe2fa Compare October 7, 2025 16:57
@pguyot pguyot marked this pull request as ready for review October 7, 2025 19:53
Copy link
Collaborator

@bettio bettio left a comment

Choose a reason for hiding this comment

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

I still have to review "Cross compile for armhf and s390x architectures". Everything else makes sense.

@pguyot pguyot force-pushed the w40/cross-compile-build branch 2 times, most recently from 0817321 to 25de66f Compare October 8, 2025 05:46
@pguyot pguyot marked this pull request as draft October 8, 2025 06:21
Copy link
Collaborator

@bettio bettio left a comment

Choose a reason for hiding this comment

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

I think I will merge main into feature/bigint without this PR, however I need to understand if one of those commits fix a bug that I may notice while integrating bigints.

@pguyot pguyot force-pushed the w40/cross-compile-build branch from 25de66f to 42ee019 Compare October 10, 2025 18:12
@pguyot
Copy link
Collaborator Author

pguyot commented Oct 10, 2025

I think I will merge main into feature/bigint without this PR, however I need to understand if one of those commits fix a bug that I may notice while integrating bigints.

You may want the unaligned sigbus that could hurt some tests with AArch64.

@pguyot pguyot force-pushed the w40/cross-compile-build branch 2 times, most recently from ced2231 to 4525c46 Compare October 11, 2025 08:32
@pguyot pguyot force-pushed the w40/cross-compile-build branch 8 times, most recently from 10784d2 to 3c52a65 Compare October 13, 2025 05:29
Also enable parallel compilation (make -j3) and fix circular dependency
when building precompiled archives

Signed-off-by: Paul Guyot <[email protected]>
@pguyot pguyot force-pushed the w40/cross-compile-build branch from 3c52a65 to 38234de Compare October 19, 2025 10:46
@pguyot pguyot marked this pull request as ready for review October 19, 2025 10:46
@bettio bettio merged commit f8bdc7d into atomvm:main Oct 19, 2025
165 of 170 checks passed
@pguyot pguyot deleted the w40/cross-compile-build branch October 19, 2025 18:35
bettio added a commit that referenced this pull request Oct 22, 2025
Just in time compilation with armv6m target

Continuation of:
- #1770
- #1773
- #1833
- #1834
- #1835
- #1890
- #1878
- #1881
- #1887

The target is suitable for Pico, Pico2 and STM32.
Benchmark test on a Pico with SMP disabled shows a speed increase from 14% to
62%.

  | native (w34/jit-arm) | emulated (main) -- d8ecc02 | %
-- | -- | -- | --
pingpong_speed_test | 17437587 | 27590085 | 37 %
prime_speed_test | 13257293 | 35212412 | 62 %
prng_test | 1128949 | 1500967 | 25 %
pi_test | 26759537 | 58693061 | 54 %
sudoku_solution_test | 6420801 | 7471461 | 14 %
sudoku_puzzle_test | 254335968 | 333834045 | 24 %

Remark: the current backend requires 64 bits floats. 32 bits floats would need
a specific variant.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
bettio added a commit that referenced this pull request Nov 6, 2025
Embedded JIT mode for Pico

Continuation of:
- #1829
- #1838
- #1881
- #1891
- #1893
- #1900
- #1901
- #1903
- #1907

Add the ability to perform just in time compilation directly on Raspberry Pi
Pico. Erlang bytecode is compiled to armv6m on the first run and directly
executed on subsequent runs. In this PR, the native code compilation does not
take advantage of being done on the device, it still generates position
independent code.

If Erlang modules include `Type` chunk, the same optimizations that happen on
the desktop with precompilation could be done on the Pico, however current
release (0.7.5) of [`packbeam`](https://github.com/atomvm/atomvm_packbeam)
prunes the `Type` chunk.

Just in time compilation on the Pico is achieved by:
- Adding a flush call after JIT is performed, which is noop on all platforms
except on armv6m where we flush the literal pool (normally a noop, though, as
the pool should have been flushed earlier).
- Updating avm API to fetch the last section named end.
- Adding a `jit_stream_flash` for RP2 platform and adding a cache native code
mechanism that rely on the avm end section on RP2 to find out where to flash
jit code (after the last end) and detect if avm were updated.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
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.

2 participants