Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
cca94f6
JIT: Optimize calls to TERM_COMPARE
pguyot Sep 20, 2025
1075c1a
JIT: optimize calls to term_to_int using types
pguyot Sep 17, 2025
5bf8793
JIT: optimize verify_is_match_state_and_get_ptr using types
pguyot Sep 23, 2025
ac6b947
JIT: optimize verify_is_function using types
pguyot Sep 23, 2025
ab25ecd
JIT: reduce register usage on binary matching
pguyot Sep 3, 2025
96c5842
AArch64: initial commit
pguyot Jul 20, 2025
e28af9d
AArch64: get rid of patch_* helpers, fix warnings
pguyot Jul 21, 2025
92cfe66
AArch64: call_only_or_schedule_next_and_label_relocation_test
pguyot Jul 21, 2025
5597cf7
AArch64: rename and_/3 and fix bitmask with a new test
pguyot Jul 21, 2025
20073b9
AArch64: implement get_list_test/0
pguyot Jul 21, 2025
880ca81
AArch64: implement is_integer_test/0
pguyot Jul 21, 2025
8302ea5
AArch64: implement is_boolean_test/0
pguyot Jul 21, 2025
2e126fe
AArch64: change order to match assembly and use unimplemented for uni…
pguyot Jul 21, 2025
f0a8c7e
AArch64: call_fun_test/0 and optimization of a condition
pguyot Jul 21, 2025
9789e5c
AArch64: move_to_vm_register
pguyot Jul 21, 2025
55c84c6
AArch64: move_array_element
pguyot Jul 22, 2025
8750b48
AArch64: further tests
pguyot Jul 22, 2025
aeb33d1
AArch64: Fix encoding of tst instruction
pguyot Jul 24, 2025
87a4098
AArch64: handle mmap specificities of Apple Silicon
pguyot Jul 24, 2025
27b0925
AArch64: enable Jit on arm64
pguyot Jul 24, 2025
1612d94
AArch64: precompile to AArch64
pguyot Jul 24, 2025
e712e10
AArch64: add ldr with fp reg
pguyot Jul 24, 2025
c0b81a4
AArch64: multiply
pguyot Jul 24, 2025
731a415
AArch64: set_bs, rewrite_cp_offset
pguyot Jul 24, 2025
a9f8698
AArch64: run CI tests on macOS
pguyot Aug 18, 2025
580f047
AArch64: implement missing functions and workaround for 64 bits integers
pguyot Aug 18, 2025
7a8c60a
AArch64: fix mmap usage on macOS
pguyot Aug 19, 2025
ef45053
AArch64: Fix bug in remaining reductions handling
pguyot Aug 22, 2025
07d900b
AArch64: factorize and increase coverage
pguyot Aug 22, 2025
67a5898
AArch64: increase coverage and use cbz/tbz/tbnz
pguyot Aug 23, 2025
dc371bc
AArch64: support aarch64 on Linux
pguyot Aug 24, 2025
229d30c
AArch64: static assert offsets
pguyot Aug 24, 2025
b202a3b
AArch64: use SCRATCH_REG macro and fix the list
pguyot Aug 24, 2025
5f4829c
AArch64: fix register usage with if_block_cond
pguyot Sep 7, 2025
be7343f
AArch64: add get_array_element with {free, Reg}
pguyot Sep 7, 2025
8bd7249
AArch64: add move_to_native_register/2,3 with {x_reg, extra}
pguyot Sep 7, 2025
1b75c87
AArch64: move labels to backend states
pguyot Sep 20, 2025
6d3d0aa
AArch64: optimize jump_to_label with known labels
pguyot Sep 20, 2025
cbae821
AArch64: add move_to_vm_register test with fp_reg
pguyot Sep 20, 2025
a5327c0
AArch64: add continuation entry point to save registers
pguyot Sep 20, 2025
d0b3d5b
AArch64: remove unused move_to_native_register/3 with fpu
pguyot Aug 30, 2025
ba408fd
AArch64: remove entirely usage of FPU
pguyot Aug 30, 2025
bc86c88
AArch64: fix tests after primitive renumbering
pguyot Sep 20, 2025
593be36
AArch64: use binutils helper for asm tests
pguyot Sep 17, 2025
de5b4d0
AArch64: improvement and complete coverage of asm functions
pguyot Sep 19, 2025
feac56c
AArch64: fix assembler for some instructions and tests
pguyot Sep 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/build-and-test-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ jobs:
otp: "28"
cmake_opts_other: "-DAVM_DISABLE_JIT=OFF"

- os: "macos-14"
otp: "28"
cmake_opts_other: "-DAVM_DISABLE_JIT=OFF"

- os: "macos-15"
otp: "28"
cmake_opts_other: "-DAVM_DISABLE_JIT=OFF"

steps:
# Setup
- name: "Checkout repo"
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
if (NOT AVM_DISABLE_JIT)
set(AVM_JIT_TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm64|aarch64$")
if (NOT AVM_DISABLE_JIT)
set(AVM_JIT_TARGET_ARCH "aarch64")
endif()
else()
if (NOT AVM_DISABLE_JIT)
message("JIT is not supported on ${CMAKE_SYSTEM_PROCESSOR}")
Expand Down
17 changes: 16 additions & 1 deletion libs/estdlib/src/code_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
code_chunk/1,
atom_resolver/2,
literal_resolver/2,
type_resolver/2,
set_native_code/3
]).

Expand Down Expand Up @@ -126,6 +127,14 @@ atom_resolver(_Module, _Index) ->
literal_resolver(_Module, _Index) ->
erlang:nif_error(undefined).

%% @doc Get a type from its index
%% @return The type information
%% @param Module module get a type from
%% @param Index type index in the module
-spec type_resolver(Module :: module(), Index :: non_neg_integer()) -> any().
type_resolver(_Module, _Index) ->
erlang:nif_error(undefined).

%% @doc Associate a native code stream with a module
%% @return ok
%% @param Module module to set the native code of
Expand Down Expand Up @@ -154,10 +163,16 @@ load(Module) ->
LiteralResolver = fun(Index) ->
code_server:literal_resolver(Module, Index)
end,
TypeResolver = fun(Index) -> code_server:type_resolver(Module, Index) end,
Stream0 = jit:stream(jit_mmap_size(byte_size(Code))),
{BackendModule, BackendState0} = jit:backend(Stream0),
{LabelsCount, BackendState1} = jit:compile(
Code, AtomResolver, LiteralResolver, BackendModule, BackendState0
Code,
AtomResolver,
LiteralResolver,
TypeResolver,
BackendModule,
BackendState0
),
Stream1 = BackendModule:stream(BackendState1),
code_server:set_native_code(Module, LabelsCount, Stream1),
Expand Down
1 change: 1 addition & 0 deletions libs/jit/include/jit.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
-define(JIT_FORMAT_VERSION, 1).

-define(JIT_ARCH_X86_64, 1).
-define(JIT_ARCH_AARCH64, 2).

-define(JIT_VARIANT_PIC, 1).

Expand Down
2 changes: 2 additions & 0 deletions libs/jit/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ set(ERLANG_MODULES
jit_precompile
jit_stream_binary
jit_stream_mmap
jit_aarch64
jit_aarch64_asm
jit_x86_64
jit_x86_64_asm
)
Expand Down
Loading
Loading