Implementation of Immix Mark-Region Garbage collector written in Rust Programming Language.

Overview

libimmixcons

Implementation of Immix Mark-Region Garbage collector written in Rust Programming Language.

Status

This is mostly usable library. You can use this library inside your programs or VM implementation safely.

  • Threading support when built with threaded option.
  • Trap based safepoints for almost zero overhead.
  • Conservative stack scanning and precise on heap scanning.
  • Opportunistic evacuation of fragmented blocks.
  • C API in libimmixcons.h.

Building

To build library for use in C/C++ or other language with C FFI use these commands:

RUSTFLAGS="-Clinker-plugin-lto" cargo build --release //  add --no-default-features to build single threaded GC

To link statically with your binary you should use LTO for maximum performance:

# Compile the C code with `-flto=thin`
clang -c -O2 -flto=thin -o main.o ./main.c
# Link everything, making sure that we use an appropriate linker
clang -flto=thin -fuse-ld=lld -L<path to libimmixcons.a> -llibimmixcons -o main -O2 ./cmain.o

Platform support

  • Linux

    Everything works as expected.

  • macOS

    Everything works as expected, this library was firstly developed on macOS machine.

  • FreeBSD,OpenBSD,NetBSD

    I don't know if it works or no, if you tested this library on these platforms please file an issue.

  • Windows

    Should work but it is not properly tested,GC stats printing is unsupported.

TODO

  • More documentation and more examples.

  • More benchmarks.

  • I want more power! Improve performance as it is not at its peak right now.

    To win BDWGC in benchmarks we have to disable unmapping blocks after each GC cycle. To beat it in regular programs we have to implement chunk allocation so we can unmap chunks of blocks rathern than each block individually.

Examples

For examples look in examples/ directory and for usage of C API take a look at example.c.

Benchmarks

gcbench results against BDWGC on iMac mid 2011:

     Running target/release/deps/gcbench_bdwgc-47ada9e692b50c7d
Gnuplot not found, using plotters backend
Benchmarking bdwgc: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 77.5s, or reduce sample count to 10.
bdwgc                   time:   [718.77 ms 724.43 ms 730.26 ms]

     Running target/release/deps/gcbench_bdwgc_incremental-5f4334b96f91de18
Gnuplot not found, using plotters backend
GC Warning: Can't turn on GC incremental mode as fork() handling requested
Benchmarking bdwgc incremental: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 74.6s, or reduce sample count to 10.
bdwgc incremental       time:   [733.45 ms 741.71 ms 750.51 ms]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

     Running target/release/deps/gcbench_immix-a6addca55e071dda
Gnuplot not found, using plotters backend
Benchmarking libimmixcons (30% threshold): Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 70.6s, or reduce sample count to 10.
libimmixcons (30% threshold)
                        time:   [628.04 ms 659.71 ms 694.79 ms]
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe

gcbench results against BDWGC with LTO enabled on iMac mid 2011:

Benchmarking bdwgc: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 79.2s, or reduce sample count to 10.
bdwgc                   time:   [786.30 ms 797.21 ms 809.01 ms]
                        change: [-10.259% -7.9337% -5.5851%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  6 (6.00%) high mild
  1 (1.00%) high severe

     Running target/release/deps/gcbench_bdwgc_incremental-9e5a3fa1d631864c
Gnuplot not found, using plotters backend
GC Warning: Can't turn on GC incremental mode as fork() handling requested
Benchmarking bdwgc incremental: Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 79.6s, or reduce sample count to 10.
bdwgc incremental       time:   [802.26 ms 817.81 ms 835.18 ms]
                        change: [+3.6590% +6.5725% +9.8956%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 10 outliers among 100 measurements (10.00%)
  7 (7.00%) high mild
  3 (3.00%) high severe

     Running target/release/deps/gcbench_immix-811b9e52fc9ac3c4
Gnuplot not found, using plotters backend
Benchmarking libimmixcons (30% threshold): Warming up for 3.0000 s
Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 54.3s, or reduce sample count to 10.
libimmixcons (30% threshold)
                        time:   [441.69 ms 449.68 ms 457.32 ms]
                        change: [-0.7763% +1.6894% +4.2178%] (p = 0.18 > 0.05)
                        No change in performance detected.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
You might also like...
Rhai - An embedded scripting language for Rust.

Rhai - Embedded Scripting for Rust Rhai is an embedded scripting language and evaluation engine for Rust that gives a safe and easy way to add scripti

Interpreted language developed in Rust

Xelis VM Xelis is an interpreted language developed in Rust. It supports constants, functions, while/for loops, arrays and structures. The syntax is s

A rusty dynamically typed scripting language
A rusty dynamically typed scripting language

dyon A rusty dynamically typed scripting language Tutorial Dyon-Interactive Dyon Snippets /r/dyon Dyon script files end with .dyon. To run Dyon script

Source code for the Mun language and runtime.

Mun Mun is a programming language empowering creation through iteration. Features Ahead of time compilation - Mun is compiled ahead of time (AOT), as

Interactive interpreter for a statement-based proof-of-concept language.

nhotyp-lang Nhotyp is a conceptual language designed for ease of implementation during my tutoring in an introductive algorithmic course at Harbin Ins

Scripting language focused on processing tabular data.
Scripting language focused on processing tabular data.

ogma Welcome to the ogma project! ogma is a scripting language focused on ergonomically and efficiently processing tabular data, with batteries includ

A safe-against-invalid-input version of wren.io, written in Rust.

safe_wren A nearly-complete implementation of the Wren language (wren.io) in Rust. The original https://github.com/wren-lang/wren from wren.io is refe

A Python compiler targeting JS, implemented in Rust.

A Python compiler targeting JavaScript, implemented in Rust.

 Diplo is a script runner and dependency manager made in rust mainly for Deno.
Diplo is a script runner and dependency manager made in rust mainly for Deno.

Diplo is a script runner and dependency manager made in rust mainly for Deno. Documentation Tricked.pro/diplo Installing - windows installer Features

Owner
playX
Real name: Adel Prokurov. Rust programmer. Love doing compiler and VM related development. :) Languages: Russian, English.
playX
REPL for the Rust programming language

Rusti A REPL for the Rust programming language. The rusti project is deprecated. It is not recommended for regular use. Dependencies On Unix systems,

Murarth 1.3k Dec 20, 2022
Oxide Programming Language

Oxide Programming Language Interpreted C-like language with a Rust influenced syntax. Latest release Example programs /// recursive function calls to

Arthur Kurbidaev 113 Nov 21, 2022
The hash programming language compiler

The Hash Programming language Run Using the command cargo run hash. This will compile, build and run the program in the current terminal/shell. Submit

Hash 13 Nov 3, 2022
🍖 ham, general purpose programming language

?? ham, a programming language made in rust status: alpha Goals Speed Security Comfort Example fn calc(value){ if value == 5 { return 0

Marc Espín 19 Nov 10, 2022
A small programming language created in an hour

Building a programming language in an hour This is the project I made while doing the Building a programming language in an hour video. You can run it

JT 40 Nov 24, 2022
The Loop programming language

Loop Language Documentation | Website A dynamic type-safe general purpose programming language Note: currently Loop is being re-written into Rust. Mea

LoopLanguage 20 Oct 21, 2022
Stackbased programming language

Rack is a stackbased programming language inspired by Forth, every operation push or pop on the stack. Because the language is stackbased and for a ve

Xavier Hamel 1 Oct 28, 2021
A static, type inferred and embeddable language written in Rust.

gluon Gluon is a small, statically-typed, functional programming language designed for application embedding. Features Statically-typed - Static typin

null 2.7k Dec 29, 2022
sublingual: toy versions of existing programming languages

sublingual: toy versions of existing programming languages This is a collection of toy languages created by taking much "larger" languages (e.g. Rust)

Eduard-Mihai Burtescu 20 Dec 28, 2022
Lisp dialect scripting and extension language for Rust programs

Ketos Ketos is a Lisp dialect functional programming language. The primary goal of Ketos is to serve as a scripting and extension language for program

Murarth 721 Dec 12, 2022