Fil-C on Nix

Filnix wiki

trealla.md

Trealla with Fil-C

The Fil-C package tracks upstream commit 98a821db66715618e358c36c7d7164213c0f6820, HEAD when checked on November 10, 2026. The previous pins were 12f4cbd7 (September 5, 2026, one commit after v3.9.40; 630 commits earlier) and v2.84.14 (November 5, 2025). All were built with the existing Fil-C toolchain; LLVM and the runtime were unchanged.

nix build .#pkgsFilc.trealla
./result/bin/tpl
nix build .#checks.x86_64-linux.trealla

Packaging changes

The new tabling patch fixes two pointer-to-integer-to-pointer round trips in bif_tbl_get_answer_2 and bif_tbl_wkl_work_3. Each now stores its cursor and generation in a pointer-typed member of the existing saved-state union. Choice-point copies consequently preserve the cursor's capability. The generation checks that reject invalidated enumerations remain intact. This is ordinary C and does not require a Fil-C-specific escape hatch.

November 2026 update

Validation

Before the cursor patch, the latest revision built successfully but failed five of 402 upstream tests: dcg_tabling, tabling, tabling_incremental, tabling_reconstruct, and tabling_subsumption. Fil-C reported a pointer with a null capability in the tabling implementation. The other 397 passed. After the cursor patch, all 402 upstream tests passed in 2 minutes 10 seconds on the development host.

The Nix runtime check exercises all six tabling regression files and five DCG files, plus CLP(Z), installed-library association maps, exact integer arithmetic, a tail call whose argument starts a new heap page, and a call from Prolog into a Fil-C-built shared library through use_foreign_module. It checks both exit status and expected output; Trealla can report an initialization error while exiting successfully. Package build-time checks remain disabled in favor of this explicit check.

This is not comprehensive FFI validation. An exploratory call through the private $register_function evaluable-function interface reached a Fil-C trap in ffi_prep_cif; the public use_foreign_module predicate interface passed. That private-interface problem remains outside this refresh.

The full upstream suite can also be run from an extracted source checkout:

ln -s /absolute/path/to/result/bin/tpl tpl
./tests/run.sh

What is developing upstream

The recent history is predominantly Andrew Davison's work and combines language/runtime fixes with substantial new facilities. The following are source-history observations, not a claim that every feature is production ready:

For a compiler experiment, DCGs, structured terms, and explicit worklists are a reasonable starting point. Tabling deserves dedicated completeness and error-propagation tests: the pinned driver still catches worker exceptions as branch failure and resets incomplete tables. A caller must not infer that a returned answer set is complete merely because no exception escaped.