dmd/druntime
richard (rikki) andrew cattermole 2625a1607c Initial attempt at stdatomic.h
2023-12-08 12:45:28 +01:00
..
benchmark compiler/test: add tests to test LoongArch-related reserved versions 2023-10-04 21:47:14 +08:00
def Create README.md at ./dmd/druntime/def 2023-12-05 03:06:31 +01:00
mak Initial attempt at stdatomic.h 2023-12-08 12:45:28 +01:00
src Initial attempt at stdatomic.h 2023-12-08 12:45:28 +01:00
test druntime/test/*.mak: replaces -Isrc by -Iimport (#15881) 2023-12-04 12:24:07 +02:00
.editorconfig Merge dlang/druntime repository into dlang/dmd 2022-07-09 18:53:15 +02:00
.gitignore Merge dlang/druntime repository into dlang/dmd 2022-07-09 18:53:15 +02:00
CODEOWNERS Merge dlang/druntime repository into dlang/dmd 2022-07-09 18:53:15 +02:00
CONTRIBUTING.md Merge dlang/druntime repository into dlang/dmd 2022-07-09 18:53:15 +02:00
dub.sdl Merge dlang/druntime repository into dlang/dmd 2022-07-09 18:53:15 +02:00
posix.mak Add Valgrind GC integration (#15304) 2023-06-15 01:01:42 -07:00
project.ddoc Merge dlang/druntime repository into dlang/dmd 2022-07-09 18:53:15 +02:00
README.md fix(druntime): outdated DMD's source code links direct to the old tree path 2022-08-03 10:41:49 +01:00
setmscver.bat Merge dlang/druntime repository into dlang/dmd 2022-07-09 18:53:15 +02:00
win32.mak druntime: copydir target removed (#15879) 2023-12-04 12:53:32 +02:00
win64.mak druntime win64.mak: Unused DDOCFLAGS variable removed 2023-12-05 02:06:29 +01:00

DRuntime: Runtime Library for the D Programming Language

This is DRuntime. It is the low-level runtime library backing the D programming language.

DRuntime is typically linked together with Phobos in a release such that the compiler only has to link to a single library to provide the user with the runtime and the standard library.

Purpose

DRuntime is meant to be an abstraction layer above the compiler. Different compilers will likely have their own versions of DRuntime. While the implementations may differ, the interfaces should be the same.

Features

The runtime library provides the following:

  • The Object class, the root of the class hierarchy.
  • Implementations of array operations.
  • The associative array implementation.
  • Type information and RTTI.
  • Common threading and fiber infrastructure.
  • Synchronization and coordination primitives.
  • Exception handling and stack tracing.
  • Garbage collection interface and implementation.
  • Program startup and shutdown routines.
  • Low-level math intrinsics and support code.
  • Interfaces to standard C99 functions and types.
  • Interfaces to operating system APIs.
  • Atomic load/store and binary operations.
  • CPU detection/identification for x86.
  • System-independent time/duration functionality.
  • D ABI demangling helpers.
  • Low-level bit operations/intrinsics.
  • Unit test, coverage, and trace support code.
  • Low-level helpers for compiler-inserted calls.

Source structure

In the src directory, there are core and rt packages.

The rt package contains implementations for compiler-inserted calls. You may not import rt.xxx outside of the rt package itself, since its source is not accessible once druntime is compiled; it isn't included in the druntime/import that ships with compiler releases. The compiler assumes these functions have a specific extern(C) signature, and expects them to be linked into the final binary. See for example: https://github.com/dlang/dmd/blob/master/compiler/src/dmd/backend/drtlsym.d

The core package is shipped with the compiler and has a stable API. It contains implementations for D features, but also some D conversions of header files from external libraries:

  • core/stdc - C standard library
  • core/stdcpp - C++ standard library
  • core/sys - operating system API

An exception to the public API is core.internal, which contains compiler hooks that are templates. Many hooks from rt use TypeInfo class parameters, providing run-time type information, but they are being replaced by template functions, using static type information: Replace Runtime Hooks with Templates

Since uninstantiated templates aren't compiled into the druntime binary, they can't be in rt. Symbols from core.internal can be publically imported from other core modules, but are not supposed to be imported or otherwise referenced by end user modules.

Issues

To report a bug or look up known issues with the runtime library, please visit the bug tracker.

Building

See the wiki page for build instructions.