#1 2026-09-02 12:56:50

Moonbot-Tech
Member
Registered: 2026-09-02
Posts: 1

MoonCompiler 1.0.0: Delphi 12.2 code on Linux with fpcx64mm

We have published MoonCompiler 1.0.0, a self-contained Pascal toolchain for Win64 and Linux x86-64.

The project grew out of a practical goal: moving the core of a high-load trading terminal, written and still developed with Delphi 12.2, to Linux. We needed to preserve one source base, its types, and its application architecture rather than maintain a separate FPC-specific version.

Unleashed was our starting point. It already provided modern Delphi syntax, but building and running a large application exposed more than 120 correctness, compatibility, and performance issues across the compiler and RTL: managed-value lifetime, exceptions and unwinding, generics, RTTI, Unicode, streams, collections, namespaces, overload resolution, the Win64/Linux ABI, and defects visible only under -O2/-O3.

MoonCompiler ships as one validated configuration:

- Delphi mode and UnicodeString as the normal String;
- Win64 and Linux x86-64;
- automatically inserted threading, monitor, and memory-manager units;
- a dedicated optimizer block: LICM, address GVN, EH-aware register allocation, and code alignment;
- ready-to-use toolchain archives that do not require rebuilding the compiler first.

The bundled memory manager is based on Arnaud's mormot.core.fpcx64mm. In MoonCompiler it is part of the integrated compiler/RTL/MM profile and is installed before user units. We use FPCMM_BOOSTER + FPCMM_MOONSHARD, and added a diagnostic mode together with several changes found through allocator and load testing.

Final measurements:

- current MoonCompiler is 1.31x faster than the original Moon/Unleashed baseline across 243 shared cases;
- across the extended 744-case matrix, it is 1.20x faster than Delphi 12.2 on average;
- across 20 compact models of server and trading hot paths, it is 1.22x faster than Delphi;
- on allocator workloads, fpcx64mm in our profile is 1.65x faster than the standard FPC MM with the same compiler and source.

Qualification covers differential checks against Delphi 12.2, Win64/Linux runtime and ABI, multiple optimization levels, upstream regressions, both mORMot lines used during development, Lazarus, and composition tests transferred from application Pascal code.

Repository
Methodology and complete results

Thank you, Arnaud, for fpcx64mm: it ultimately became one of the central components of the whole system.

We would especially value feedback from experienced FPC and mORMot developers, both on the fpcx64mm integration and on MoonCompiler as a whole.

Offline

#2 Yesterday 10:39:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,592
Website

Re: MoonCompiler 1.0.0: Delphi 12.2 code on Linux with fpcx64mm

It is indeed impressive.

I really like the work on the compiler.
Would it be feasible to keep it cross-platform (not just Linux but Windows + Mac - perhaps not for the ZXSpectrum)?
Or at least do you plan to submit all your patches to the FPC trunk or the Unleashed fork?

I see the FPC team struggling during the last week to make any update. Michael is working on his own side, but the compiler is mostly stalling, even the latest fixes for WinArm are not included.
But perhaps having the Unleashed pascal compiler include all your optimizations could be nice.

Offline

Board footer

Powered by FluxBB