Hans Elias B. Josephsen, @hansihe
Greenfield compiler and runtime for BEAM languages
WebAssembly
Native
True Embedded
Browser Apps
CDN Edge Compute
Server Deployments
Embedded Applications
Native GUI Applications
Current
Current
x86_64
x86_64
arm64
Future?
Your toaster?
Startup
+++
+++
-
++
+
++
WASM
Browser
CDN Edge
Native
Server
GUI
Embedded
True Embedded
Toaster
Code Size
+++
-
-
+
+
+++
Performance
+
++
+++
++
+
-
Placeholder slide
Source Code
AST
IR
IR
Target
Parsing
Lowering
Optimization
Lowering
Source Code
AST
IR
IR
Target
Parsing
Lowering
Optimization
Lowering
function(a) {
a * 2 * 2
}
function
a
*
*
a
2
2
function(a) {
a * 2 * 2
}
Source Code
AST
IR
IR
Target
Parsing
Lowering
Optimization
Lowering
blah
function
a
*
*
a
2
2
Source Code
AST
IR
IR
Target
Parsing
Lowering
Optimization
Lowering
function($a) {
$1 = $a * 2;
$2 = $1 * 2;
ret $2;
}
function(a) {
a * 2 * 2
}
function
a
*
*
a
2
2
function($a) {
$1 = $a * 4;
ret $1;
}
Source Code
AST
IR
IR
Target
Parsing
Lowering
Optimization
Lowering
function($a) {
$1 = $a * 2;
$2 = $1 * 2;
ret $2;
}
function(a) {
a * 2 * 2
}
function
a
*
*
a
2
2
function($a) {
$1 = $a * 4;
ret $1;
}
Source Code
AST
IR
IR
Target
Parsing
Lowering
Optimization
Lowering
function(a) {
a * 2 * 2
}
function
a
*
*
a
2
2
function($a) {
$1 = $a * 4;
ret $1;
}
function($a) {
$1 = $a * 2;
$2 = $1 * 2;
ret $2;
}
mul $0 4
ret
Erlang
Erlang AST
EIR
MLIR
LLVM IR
Abstract Erlang
Elixir
WASM
x86_64
Others
Optimization passes
Erlang
Erlang AST
EIR
MLIR
LLVM IR
Abstract Erlang
Elixir
WASM
x86_64
Others
Optimization passes
Erlang
Erlang AST
EIR
MLIR
LLVM IR
Abstract Erlang
Elixir
WASM
x86_64
Others
Optimization passes
Erlang
Erlang AST
EIR
MLIR
LLVM IR
Abstract Erlang
Elixir
WASM
x86_64
Others
Optimization passes
Erlang
Erlang AST
EIR
MLIR
LLVM IR
Abstract Erlang
Elixir
WASM
x86_64
Others
Optimization passes
Erlang
Erlang AST
EIR
MLIR
LLVM IR
Abstract Erlang
Elixir
WASM
x86_64
Others
Optimization passes
Lumen Compiler
Erlang
Erlang AST
EIR
MLIR
LLVM IR
Abstract Erlang
Elixir
WASM
x86_64
Others
Optimization passes
Eir Project
Lumen Compiler
Erlang
Erlang AST
EIR
MLIR
LLVM IR
Abstract Erlang
Elixir
WASM
x86_64
Others
Optimization passes
Eir Project
Lumen Compiler
Erlang
Erlang AST
EIR
MLIR
LLVM IR
Abstract Erlang
Elixir
WASM
x86_64
Others
Optimization passes
Eir Project
Lumen Compiler
a'my_function'/1 {
entry(%ret, %thr, %arg):
%tup = {a'ok', %arg};
%ret(%tup);
}
def my_function(arg) do
{:ok, arg}
end
a'foo'/1 {
entry(%ret, %thr, %arg):
match %arg {
value 0 => branch1;
_ => branch2;
};
branch1():
%ret(a'bar');
branch2():
%ret(a'baz');
}
def foo(0), do: :bar
def foo(_), do: :baz
a'bar'/1 {
entry(%ret, %thr, %a):
%ret(clos);
clos(%cret, %cthr, %b):
%cret({%a, %b});
}
def bar(a) do
fn (b) -> {a, b} end
end
def bar(a) do
:mod.foo(a)
end
def bar(a) do
:mod.foo(a)
end
a'bar'/1 {
entry(%ret, %thr, %a):
b1();
b1():
%fun = a'mod':a'foo'/1;
%fun(%a) => b3 except b2;
b2(%t1, %t2, %t3):
%thr(%t1, %t2, %t3);
b3(%r1):
%ret(%r1);
}
a'bar'/1 {
entry(%ret, %thr, %a):
b1();
b1():
%fun = a'mod':a'foo'/1;
%fun(%a) => b3 except b2;
b2(%t1, %t2, %t3):
%thr(%t1, %t2, %t3);
b3(%r1):
%ret(%r1);
}
a'bar'/1 {
entry(%ret, %thr, %a):
%fun = a'mod':a'foo'/1;
%fun(%a) => %ret except %thr;
}