You are not logged in.
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
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
Hi Arnaud,
Sorry we never replied to your earlier post. Thank you for your interest in the compiler, and especially for fpcx64mm — it remains part of MoonCompiler's default profile.
On platforms: we support Win64 and Linux x86-64 as complete toolchains, qualified together with their RTL and runtime. We have no current plans for macOS or other architectures; each would need its own port and validation of the compiler and runtime.
We have already submitted several self-contained compiler fixes with regression tests to FPC and Unleashed. They remain open. We cannot submit the entire fork as one patch set: some changes belong specifically to our Delphi/Unicode profile.
Since our first post, MoonCompiler 2.1 has been released. We have substantially improved code generation for loops and resource cleanup, sped up string processing and dictionaries, and made application builds work directly with the installed fpc. We also added exception reports preserving the original call stack, register values and a bounded snapshot of stack memory; for hangs, a manual report can capture the stacks of all threads.
We expanded the Delphi-compatible libraries and runtime: asynchronous HTTP requests with cancellation, cookies and authentication; streamed uploads; threaded queues and countdown events; historical time-zone rules; and Win64 delayed DLL imports.
MoonCompiler 2.1 release · Detailed release notes
We'd be interested to hear whether this work is useful to the community and which further fixes, features or optimizations would be worth pursuing. Our main real-world workloads come from cryptocurrency trading server cores, so experience from other kinds of projects would be especially valuable.
Offline