Big news
- Frontend, druntime and Phobos are at version ~2.113.0, incl. new command-line option
-foptimize-nothrowto restore thenothrowoptimizations. (#5113, #5221, #5239)-foptimize-nothrowis the default setting when targeting Windows or WebAssembly, to make hitting #3504 much less likely.
- Support for LLVM 22. The prebuilt packages use v22.1.8. (#5097, #5102, #5172)
- Minimum LLVM version raised to 18. (#5094)
- DRuntime and Phobos now support WASI preview levels 1 and 2, based on
wasi-libc. Two caveats being that WASI is strictly single-threaded (currently), and that fibers are unavailable. (#5186, #5229, #5230, #5242) - New prebuilt addon packages (
ldc2-*-addon-<target OS>.tar.xz) for simple cross-compilation. Simply unpack them directly into your LDC installation directory, and then cross-compile via-mtriple=…(ordub --target=…): (#5240)- Windows:
x86_64-windows-msvc,i686-windows-msvc; no SDK required. - Android:
aarch64-linux-android30,armv7a-linux-androideabi29,x86_64-linux-android29,i686-linux-android29; needs an Android NDK (r27) and itstoolchains/llvm/prebuilt/*/bin/dir in your PATH. - WASI:
wasm32-unknown-wasip1,wasm32-unknown-wasip2; needs a WASI SDK and itsbin/dir in your PATH. (#5207, #5242)
- Windows:
- The
@ldc.attributes.restrictUDA is now supported for dynamic-array parameters too. Builtin array ops (c[] = a[] * b[]etc.) use it, enabling auto-vectorization. Note that for such array ops, the dlang spec prescribes that the slice on the left and any slices on the right must not overlap (https://dlang.org/spec/arrays.html#array-operations), and this knowledge is now used by the optimizer; e.g.,x[] *= x[]is invalid. (#5148, #5168, #5176) - DMD-style inline assembly:
asm { naked; }is now much less of a special case wrt. codegen - such naked functions are now emitted as ifasm { naked; }was replaced with the@nakedfunction UDA. IR-wise, they are not emitted as module-level asm blobs anymore, but regular IR functions. This should lift a few formerasm { naked; }-specific restrictions and fixed at least one LTO issue. (#5041) - dcompute: Added support for Native device code Embedding (PTX and SPIR-V) into the host executable's
.rodatasection. (#5140) - WebAssembly:
- The default
-fvisibilitysetting was changed tohidden, like clang, so that only explicitexported symbols are not hidden. And-L--export-dynamicisn't used by default for linking anymore either; add it manually to export all non-hidden symbols, as for normal Posix targets. The net effect is that the size of linked wasm binaries shrinks significantly by default. (#5216) - Exceptions are now supported. Currently, using D and C++ exceptions are mutually exclusive. If linking in DRuntime, you cannot link in C++ code relying on
libunwind(exceptions), due to the hacks required to convince LLVM to use D's EH personality. A future LLVM release may help remove the constraint. (#5162) - In order to allow the GC to function correctly, a new pass is run after optimizations, to spill potential pointers onto the "stack". This pass is enabled by default for all Wasm targets, but can be disabled with
-betterCor the new-disable-wasm-ptrs-spill. (#5178)
- The default
- A new
-fno-moduleinfo-localclassesswitch has been added. This disables populatingModuleInfo.localClassesfor each module. This can help eliminate/strip more dead-code (thus decreasing binary sizes), but breaksObject.factoryand any other code relying on iterating over saidlocalClasses. Enabled by default for Wasm targets. (#5224, #5231) - Predefined version
LDC_LLVM_*now only contains the LLVM major version, i.e., formerversion (LDC_LLVM_1801)with LLVM v18.1 is nowversion (LDC_LLVM_18). Useldc.intrinsics.LLVM_versionfor backwards compatibility if really needed. (#5109)
Platform support
- Supports LLVM 18 - 22.
- WebAssembly:
extern(C) mainis now mangled as__main_voidor__main_argc_argvas appropriate, matching Clang behavior (#5186).