proj-plbook-plChImplementationTools

Table of Contents for Programming Languages: a survey

LLVM

See LLVM

PyPy

See PyPy

JVM

See JVM

CLR

See CLR

Rust HolyJIT

https://github.com/nbp/holyjit

" HolyJit? is a high-level Just-In-Time compiler. It extends the Rust compiler to convert the code of an interpreter written in Rust to tune a JIT compiler to handle the same interpreted language. ... Thus, you basically have to write an interpreter, and annotate it properly to teach the JIT compiler what can be optimized by the compiler. "

OMR

https://github.com/eclipse/omr

Libc s

https://en.wikipedia.org/wiki/C_standard_library

Many "libc" implementations combine the C standard library with an implementation of the POSIX standard.

Feature-complete libcs

By 'feature-complete' libcs, we mean libcs that implement all functionality required by a C standard.

glibc:

musl:

Microsoft Visual C Run-Time Library (MSVCRT.DLL):

Alternate libcs

Note: i'm not clear on which, if any, of these are 'feature complete'.

Alternative libcs with restrictive licenses

dietlibc:

uClibc:

Note: According to [9] and [10], LGPL-licensed libcs cannot be statically linked in proprietary software.

Note: if the common libcs can't support static linking, then how do runtimes of statically linked languages written in C work when the runtime was itself (at least initially) written in C? One example is Go; "Gc uses a custom C library to keep the footprint under control; it is compiled with a version of the Plan 9 C compiler that supports resizable stacks for goroutines" -- [11].

Alternative libcs with permissive licenses

Bionic, a simplified libc variant for Android:

newlib libc:

Newlib has a variant 'newlib-nano'. "Newlib is a C library that can be used on embedded systems. However, as the feature set has been increased it has become too bloated for use on the very smallest systems where the amount of memory can be very limited. In order to provide a C library with a very small footprint, suited for use with micro- controllers, we have created newlib-nano based on newlib 1.19.0.":

Olibc:

Minimalistic "libc" alternatives

rt0:

Baselibc "for embedded systems. Mainly geared for 32-bit microcontrollers in the 10-100kB memory range. The library compiles to less than 5kB total on Cortex-M3, and much less if some functions aren't used. The code is based on klibc and tinyprintf modules, and licensed under the BSD license."

Making your own minimal libc

Comparisons and lists of libcs

see also plChStdLibraries under 'C standard library'

Other runtimes and runtime libraries

See also targets, IRs, VMs and runtimes

Apache Portable Runtime

"OS threads, blocking IO, and other system things"

libuv

asynchronous I/O and some other stuff.

Used by nodejs, Rust language, Luvit, Julia, pyuv, MoarVM?.

libumem

Used by nodejs

helps with debugging memory leaks (see http://www.joyent.com/blog/walmart-node-js-memory-leak for an example)

Code generators / Assembly

See also plChBackendImpl, section Code generation tools

Lists:

Other useful runtime libraries

libatomic_ops

"Provides implementations for atomic memory update operations on a number of architectures"

"Note that experience with this package contributed to the design of C11 and C++11 atomics, which represent a careful refinement of the API. If your platform supports well-implemented C11 or C++11 atomics, please use those instead. "

documentation: http://en.cppreference.com/w/c/atomic

C11 atomics:

All of the above atomics take an optional parameter, memory_order, which can be one of relaxed memory_order_relaxed, memory_order_consume, memory_order_acquire, memory_order_release, memory_order_acq_rel, memory_order_seq_cst. The default is memory_order_seq_cst (the strongest sequencing condition). Here's what these do: http://en.cppreference.com/w/c/atomic/memory_order

"Members of an atomic struct/union may not be accessed individually. The whole struct must first be copied to a non-atomic variable of compatible type."

"The ++,--, and compound assignment operators (e.g. +=) are atomic read-modify-write operations."

-- http://fileadmin.cs.lth.se/cs/Education/EDAN25/F06.pdf

Libffi

https://sourceware.org/libffi/

"portable, high level programming interface to various calling conventions"

Links

Language workbenches

Libraries

Program transformation

DynASM

Cranelift

Faerie

Magical ELF and Mach-o object file writer backend

https://github.com/m4b/faerie

Parsing

ANTLR: https://www.antlr.org/

Lex and Yacc: http://dinosaur.compilertools.net/

Bison: https://en.wikipedia.org/wiki/GNU_Bison

Attoparsec:

Ohm:

https://docs.racket-lang.org/brag/

https://tree-sitter.github.io/tree-sitter/

https://github.com/JetBrains/Grammar-Kit

K framework

http://kframework.org/

"a rewrite-based executable semantic framework in which programming languages, type systems and formal analysis tools can be defined"

Lunatic

https://github.com/lunatic-lang/lunatic

"Lunatic is a platform for building actor systems that use WebAssembly? instances as actors. It is heavily inspired by Erlang and can be targeted from any language that can compile to WebAssembly?. Currently there are only bindings for Rust available."

" Lunatic is a set of libraries and a WebAssembly? runtime which allows developers to build resilient actor systems.

The people involved in the creation of WebAssembly? made it fast, efficient and secure in the browser. We can benefit from this development on the backend too. That's why Lunatic chose WebAssembly? instances as the abstraction for actors. Each instance has its own stack, heap and syscalls. This allows us to have completely isolated execution environments per actor, without reaching out to much heavier technologies like Docker. Another benefit of using WebAssembly? is that Lunatic applications can be built in any language supporting WebAssembly? as a target (like C/C++, Rust, AssemblyScript?, etc).

The other part of Lunatic are the libraries exposing Lunatic's features to programming languages. This includes actor creation, message sending, networking and other functionalities. For now there is only support for Rust, but other languages are coming too. Hold tight! "

" Design

Lunatic is written in Rust and uses Mozilla's Wasmtime to create processes as WebAssembly? instances. Similar to how it's done in Erlang, Lunatic uses the name Process for actors. Lunatic's processes are lightweight, fast to create and destroy, and the scheduling overhead is low. They are designed for massive concurrency.

All processes are scheduled using an async executor and all code running on top of Lunatic will be automatically transformed to be non-blocking. This is also true for low level languages like C and Rust. From the perspective of the developer, only blocking syscalls are used. However, the runtime will take care of actually scheduling another process' execution when one is waiting on networking traffic or is blocked for another reason. This way we get the best of both worlds, straightforward development (without async keywords) and the highest performance possible. " https://dev.to/bkolobara/writing-rust-the-elixir-way-2lm8

Libfringe

https://github.com/edef1c/libfringe

" libfringe is a library implementing safe, lightweight context switches, without relying on kernel services. It can be used in hosted environments (using std) as well as on bare metal (using core).

It provides the following safe abstractions:

    an implementation of generators, Generator.

It also provides the necessary low-level building blocks:

    a trait that can be implemented by stack allocators, Stack;
    a wrapper for using slice references as stacks, SliceStack;
    a stack allocator based on Box<[u8]>, OwnedStack;
    a stack allocator based on anonymous memory mappings with guard pages, OsStack.

libfringe emphasizes safety and correctness, and goes to great lengths to never violate the platform ABI. "

Bastion

https://bastion.rs/

" Bastion is a highly-available, fault-tolerant runtime system with dynamic dispatch oriented lightweight process model. It supplies actor model like concurrency with lightweight process implementation and utilize all the system resources efficiently with giving promise of at-most-once message delivery guarantee.

    Message-based communication makes this project a lean mesh of actor system.
    Runtime fault-tolerance makes it a good candidate for distributed systems.
    Completely asynchronous runtime with NUMA-aware and cache-affine SMP executor.
    Supervision system makes it easy to manage lifecycles."

GNU Jitter

https://www.gnu.org/software/jitter/ https://ageinghacker.net/talks/jitter-slides--saiu--ghm2017--2017-08-25.pdf https://git.ageinghacker.net/git/cgit.cgi/jitter/tree/doc/jitter.texi https://ageinghacker.net/projects/jitter-tutorial/

"automatically generating a portable, very efficient language virtual machine"

Disassemblers

Hex editors

Linkers

Linker script annotated example:

About linkers:

Misc tools

Links to Implementation Tools