Skip to content

acctress/selene

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues project_license


Selene

Selene, a lightweight WebAssembly JIT runtime written in Zig.
Explore the docs »

Report Bug · Request Feature

⚠️ Selene is early and incomplete. Currently supports a subset of Wasm - enough to run arithmetic, control flow, and function calls.

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Selene is a lightweight WebAssembly JIT runtime written in Zig. It parses .wasm binaries, translates them into zjit's SSA IR, and compiles them to native machine code at runtime. Built entirely from scratch, no LLVM, no Cranelift, no depedencies.

(back to top)

Built With

  • Zig

(back to top)

Example

$ selene inspect add.wasm
functions (1):
  add : (i32, i32) -> i32
$ selene run add.wasm --fn add -- 10 20
30

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Commands

selene run <file.wasm>                              # run default export
selene run <file.wasm> --fn <fn_name>               # call a specific exported function
selene run <file.wasm> --fn <fn_name> -- 1 2 3      # pass arguments
selene inspect <file.wasm>                          # dump sections, exports, imports
selene inspect <file.wasm>  --functions             # list all functions and signatures
selene inspect <file.wasm>  --exports               # list exports

Screenshot-2026-06-26-185317.png

Future flags

--verbose       # Log IR and show compilation steps
--interpret     # A fallback interpreter mode, no JIT
--dump-ir       # Log zjit IR before code generation
--dump-asm      # Log native ASM output 

Prerequisites

  • Zig 0.14.0 or later
  • A .wasm binary

Installation

Build from source

git clone https://github.com/acctress/selene.git
cd selene
zig build
./zig-out/bin/selene run file.wasm

(back to top)

Roadmap

  • Wasm binary parser
    • Magic number + version validation
    • Section loop (type, func, code)
    • LEB128 decoding
  • Wasm validator
  • Wasm to zjit IR translator
    • Arithmetic opcodes (i32.add, i32.sub)
    • Control flow (block, loop, if, br, br_if)
    • Function calls
  • zjit JIT backend integration
  • Native code execution
  • Host + sandbox
    • Linear memory
    • Imports and exports
    • WASI support
  • CLI
    • run subcommand
    • inspect subcommand
    • --dump-ir flag
    • --dump-asm flag
    • --interpret fallback
  • Optimisation passes
    • Pass manager
    • Constant folding
    • DCE
    • Copy propagation

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT license. See LICENSE.txt for more information.

(back to top)

Contact

Discord - acctress Email - 0x2014@proton.me

Project Link: https://github.com/acctress/selene

(back to top)

About

Selene, a lightweight WebAssembly JIT runtime written in Zig.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Contributors