All Projects → ss220-space → dmjit

ss220-space / dmjit

Licence: AGPL-3.0 license
.dmJIT is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle! (formerly known as dm-jitaux)

Programming Languages

rust
11053 projects
DM
37 projects
LLVM
166 projects

Projects that are alternatives of or similar to dmjit

jingle
🔔 Jingle is a dynamically-typed, multi-paradigm programming language designed for humans and machines.
Stars: ✭ 34 (+88.89%)
Mutual labels:  llvm, jit-compiler
JitCat
A C++17 library for parsing and executing expressions. Allows easy exposure of variables and functions from C++ through built-in reflection functionality.
Stars: ✭ 16 (-11.11%)
Mutual labels:  llvm, jit-compiler
Pure Lang
Pure programming language
Stars: ✭ 209 (+1061.11%)
Mutual labels:  llvm, jit-compiler
Compiler-written-in-Haskell
A Turing complete language 😉
Stars: ✭ 31 (+72.22%)
Mutual labels:  llvm, jit-compiler
Batch-First
A JIT compiled chess engine which traverses the search tree in batches in a best-first manner, allowing for neural network batching, asynchronous GPU use, and vectorized CPU computations.
Stars: ✭ 27 (+50%)
Mutual labels:  llvm, jit-compiler
aWsm
WebAssembly ahead-of-time compiler and runtime. Focuses on generating fast code, simplicity, and portability.
Stars: ✭ 177 (+883.33%)
Mutual labels:  llvm
TinyCompiler
c compiler based on flex(lex), bison(yacc) and LLVM, supports LLVM IR and obj code generation. 基于flex,bison以及LLVM,使用c++11实现的类C语法编译器, 支持生成中间代码及可执行文件.
Stars: ✭ 162 (+800%)
Mutual labels:  llvm
dr checker 4 linux
Port of "DR.CHECKER : A Soundy Vulnerability Detection Tool for Linux Kernel Drivers" to Clang/LLVM 10 and Linux Kernel
Stars: ✭ 34 (+88.89%)
Mutual labels:  llvm
clam
Static Analyzer for LLVM bitcode based on Abstract Interpretation
Stars: ✭ 180 (+900%)
Mutual labels:  llvm
kcs
Scripting in C with JIT(x64)/VM.
Stars: ✭ 25 (+38.89%)
Mutual labels:  jit-compiler
proton-clang-build
A set of scripts to build optimized LLVM and binutils toolchains. See https://github.com/kdrag0n/proton-clang for prebuilts.
Stars: ✭ 30 (+66.67%)
Mutual labels:  llvm
LLVM-Metadata-Visualizer
LLVM Metadata Visualizer
Stars: ✭ 20 (+11.11%)
Mutual labels:  llvm
m2lang
The LLVM-based Modula-2 compiler
Stars: ✭ 29 (+61.11%)
Mutual labels:  llvm
jitmap
LLVM-jitted bitmaps
Stars: ✭ 25 (+38.89%)
Mutual labels:  llvm
chimera
🐍 A CLI tool for generating Boost.Python/pybind11 bindings from C/C++
Stars: ✭ 12 (-33.33%)
Mutual labels:  llvm
lldbg
A lightweight native GUI for LLDB.
Stars: ✭ 83 (+361.11%)
Mutual labels:  llvm
ebpfpub
ebpfpub is a generic function tracing library for Linux that supports tracepoints, kprobes and uprobes.
Stars: ✭ 86 (+377.78%)
Mutual labels:  llvm
opencilk-project
Monorepo for the OpenCilk compiler, forked from llvm/llvm-project. See the OpenCilk/infrastructure repository for build and installation instructions.
Stars: ✭ 42 (+133.33%)
Mutual labels:  llvm
stack-guard
A toy implementation of 'Stack Guard' on top of the LLVM compiler toolchain
Stars: ✭ 21 (+16.67%)
Mutual labels:  llvm
lsif-clang
Language Server Indexing Format (LSIF) generator for C, C++ and Objective C
Stars: ✭ 28 (+55.56%)
Mutual labels:  llvm

WIP PRs Welcome

.dmJIT

.dmJIT is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle (such as rewriting/refactoring your DM code).

Implementation status

Roadmap

  • PoC ✔️
  • Deoptimization ✔️
  • Sleeping proc deoptimization
  • Calls ✔️
  • Virtual calls ✔️
  • Type probing deoptimization
  • Heterogenous instruction optimization
  • JITed-to-JITed direct calls
  • Tiering
  • Branch / Call counting
  • Sleeping proc support

Opcodes

OpCode Status
GetVar SetCache, Field, Src, Local, Arg
SetVar SetCache, Field, Local, Arg
Add Float
Sub Float
Tg Float
Tl Float
Tge Float
Tle Float
AugAdd Float
AugSub Float
Teq ✔️
Ret ✔️
End ✔️
Test ✔️
Jz ✔️
JmpOr ✔️
JmpAnd ✔️
Jmp ✔️
PushInt ✔️
PushVal ✔️
GetFlag ✔️
Pop ✔️
IsNull ✔️
Not ✔️
Mul Float
CallGlobal No sleep deopt
Call StaticProc, DynamicProc, No sleep deopt
CallStatement StaticProc, DynamicProc, No sleep deopt
Abs ✔️
RoundN ✔️

Dependencies

These instructions were taken directly from tgstation's rust-g documentation.

The Rust compiler:

  1. Install the Rust compiler's dependencies (primarily the system linker):

  2. Use the Rust installer, or another Rust installation method, or run the following:

    curl https://sh.rustup.rs -sSfo rustup-init.sh
    chmod +x rustup-init.sh
    # Nightly toolchain is required
    ./rustup-init.sh

    Alternatively without saving

    # Nightly toolchain is required
    curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly
  3. Set the default compiler to 32-bit:

    # Clone the `dm-jitaux` repository to a directory of your choice
    git clone https://github.com/ss220-space/dm-jitaux.git
    # in the `dm-jitaux` directory...
    cd dm-jitaux
    # Linux
    rustup target add i686-unknown-linux-gnu
    # Windows
    rustup target add i686-pc-windows-msvc
    
    # Clone the `auxtools` repository to a parent directory of dm-jitaux
    cd ..
    git clone https://github.com/ss220-space/auxtools.git --branch dm-jitaux
    # in the `auxtools` directory...
    cd auxtools
    # Linux
    rustup target add i686-unknown-linux-gnu
    # Windows
    rustup target add i686-pc-windows-msvc

System libraries:

  • Ubuntu and Debian users run:

    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install zlib1g-dev:i386 libssl-dev:i386 pkg-config:i386
    sudo apt-get install gcc-multilib g++-multilib
  • Other Linux distributions install the appropriate 32-bit development and 32-bit runtime packages.

Building

LLVM

Windows

CMake required, can be downloaded from cmake.org

You need to build LLVM 12.0.0 on Windows with x32 target and MD CRT linking

Note: It takes 30-60 minutes to compile, 23 GB of free disk space

Download from LLVM github releases

# Unpack to path without spaces 
tar -xJf llvm-12.0.0.src.tar.xz
# Create build directory
mkdir build
cd build
# Configure 
cmake -DCMAKE_INSTALL_PREFIX=C:/LLVM -DLLVM_USE_CRT_DEBUG=MD -DLLVM_TARGETS_TO_BUILD="X86" -Thost=x86 -A Win32 ../llvm-12.0.0.src/
# Build
cmake --build .
# Install to CMAKE_INSTALL_PREFIX
cmake --build . --target install

Full guide: Building LLVM with CMake

Debian

sudo apt install llvm-12-dev:i386

Other

Checkout this for more info.

Compiling

Windows

# PowerShell
$env:LLVM_SYS_120_PREFIX = "C:\LLVM" # LLVM prefix specified before
cargo build --target i686-pc-windows-msvc
cargo test --target i686-pc-windows-msvc -- --test-threads=1

Linux

cargo build --target i686-unknown-linux-gnu
BYOND_PATH="~/byond" cargo test --target i686-unknown-linux-gnu -- --test-threads=1

See also

DM Opcode relative frequency table

opcode_counts.txt

License

dm-jitaux is licensed under the AGPL-3.0 License. See LICENSE for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].