Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/FastVM/minivm
A VM That is Dynamic and Fast
https://github.com/FastVM/minivm
Last synced: 2 months ago
JSON representation
A VM That is Dynamic and Fast
- Host: GitHub
- URL: https://github.com/FastVM/minivm
- Owner: FastVM
- License: mit
- Created: 2021-03-20T22:29:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-23T13:40:45.000Z (5 months ago)
- Last Synced: 2024-05-02T04:58:56.299Z (5 months ago)
- Language: C
- Homepage:
- Size: 6.03 MB
- Stars: 1,551
- Watchers: 35
- Forks: 54
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
![The MiniVM Logo, a blueish grey brick (Or maybe can of tuna if you are a cat)](res/MiniVM.svg)
# MiniVM
MiniVM is a Small but Optimizing Virtual Machine and Runtime.
It has a just-in-time compiler based on [Cuik](https://github.com/realnegate/cuik)'s [TB](https://github.com/RealNeGate/Cuik/tree/master/tb).
Currently it supports Linux x86-64, FreeBSD amd64, Windows x64 and WebAssembly.
MiniVM is written in C11 with (minor GNU extensions), and builds with GCC and Clang, with TCC support not hard to patch in.
## Building
MiniVM uses GNU Make as it's build system.
### Requirements
You'll need
* The MiniVM repo
* Make sure to get the cuik submodule
* You can use `git clone github.com/FastVM/minivm --recursive`
* If you've already cloned you can use `git submodule update --init`
* A C Compiler
* GCC works
* Clang works if you replace CC=gcc with CC=clang### Build Configs
Here's some Shell Commands to build MiniVM different ways
* Debug - `make -Bj OPT='-g'`
* For Size - `make -Bj CC=gcc OPT='-s -Oz -flto -fno-asynchronous-unwind-tables -fomit-frame-pointer'`
* GCC does a better job than Clang to make tiny binaries of MiniVM.
* For Speed - `make -Bj OPT='-O3 -flto'`## Speed
Here's some benchmark runs, they aren't too representative yet.
### Math + Recursion
```sh
shell> ./build/bin/minivm --dump-time test/fib/fib40.lua
102334155
took: 1725.805ms
```### Startup Perf
```sh
shell> ./build/bin/minivm --dump-time -e 'print("hello world")'
Hello, World
took: 0.307ms
```