A blog series recounting our adventures in the quest to port the BEAM JIT to the ARM32-bit architecture.This work is made possible thanks to funding from the Erlang Ecosystem Foundation and the ongoing support of its Embedded Working Group.The Erlang ARM32 JIT is born! This week we finally achieved our first milestone in developing the ARM32 JIT. We executed our first Erlang function through JITted ARM32 machine code!shell ~/arm32-jit$ qemu-arm -L /usr/arm-linux-gnueabihf ./otp/RELEASE/erts-15.0/bin/beam.smp -S 1:1 -SDcpu 1:1 -SDio 1 -JDdump true -JMsingle true -- -root /home/arm32-jit/otp/RELEASE -progname erl -home /home ~/arm32-jit$ echo $? 42The BEAM successfully runs and terminates with error code 42! That 42 comes from an Erlang function, just-in-time compiled by our ARM32 JIT!Announcement is done! All code is available at https://github.com/stritzinger/otp/tree/arm32-jitKeep reading for a lot of interesting details!The first piece of Erlang code erlang-module(hello). -export([start/2]). start(_BootMod, _BootArgs) -> halt(42, [{flush, false}]).This is hello.erl that contains a start/2 function. The function head mimics the erl_init:start/2 function, which is the entry point of the first Erlang process. We replaced erl_init:start/2 with hello:start/2 in the erl_init.c module of the BEAM VM. This way, we forced the runtime to execute this Erlang function.hello:start/2 is very simple as it just calls the erlang:halt/2. This function is a BIF (Built-in Function) that executes C code, part of the BEAM VM. This code executes an ordered shutdown of the BEAM and allows us to customize the error code, in this case: 42.(Why {flush, false}? At the time I am writing this, letting it be true causes a segmentation fault EHEH)Obviously, we need to compile this Erlang module, but I will also generate the BEAM assembly so we can have a look at what we will have to deal with.erlang{module, hello}. %% version = 0 {exports, [{module_info,0},{module_info,1},{start,2}]}. {attribute...
First seen: 2025-10-07 14:10
Last seen: 2025-10-07 23:11