Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
feat: implement bytecode emulator backend
Browse files Browse the repository at this point in the history
The native code generation backend is held up on a couple issues that we
don't want to spend time at the moment attempting to address - namely
that lowering to WebAssembly presents some difficult issues around how
to support some of what our native backend wants or needs to do in order
to bring all the pieces of the compiler and runtime together. The lack
of any stack switching intrinsics native to Wasm is a major obstacle
here.

As a result, what this commit does is extend the existing compiler to
support generation of our own bytecode, executed by an emulator which is
linked in to any generated executables. From the perspective of the end
user, there is no noticeable difference between native compilation and
this backend, however there are a few constraints (addressable) that are
not handled here - namely compilation of static/dynamic libraries, and
linking modules previously compiled. This can be handled by performing
our linking process, but that hasn't been implemented and currently
isn't important.

A significant amount of runtime infrastructure was also implemented
during this time, including signal management, system services, and a
rework of the term encoding scheme to support some additional types. The
garbage collector was implemented and is integrated with the emulator.

The next outstanding bit of work is aggressively testing what has been
built here, and expanding upon it in a few ways:

* Build on the current primitives to implement the init procedure
* Implement ETS, persistent term, and atomics services
* Implement the standard library on top of the above
  • Loading branch information
bitwalker committed Feb 24, 2023
1 parent 504381f commit 4fc36a4
Show file tree
Hide file tree
Showing 472 changed files with 51,910 additions and 15,246 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
rustflags = ["--cfg", "tokio_unstable"]
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export LLVM_PREFIX=${XDG_DATA_HOME}/llvm/firefly
export FIREFLY_BUILD_TYPE=static
export LLVM_LINK_LLVM_DYLIB=ON
export LLVM_LINK_LLVM_DYLIB=OFF
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

test/*
!test/lit/
!test/samples/
Loading

0 comments on commit 4fc36a4

Please sign in to comment.