Skip to content

Clean out dead libs/externals, salvage math_ext, add AOT test - #422

Merged
benswift merged 8 commits into
masterfrom
cleanup/dead-libs-and-scaffolding
Jun 4, 2026
Merged

benswift merged 8 commits into
masterfrom
cleanup/dead-libs-and-scaffolding

Conversation

@benswift

@benswift benswift commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Cleanout of accumulated dead/unmaintainable code in libs/ and examples/, following the same rationale as the v0.9.0-beta contrib/ removal. Each removal was verified empirically (load-tested in a current build) and by a full reverse-reference sweep; nothing kept references anything removed.

Removed

  • Broken external bindings — opencl, opencv, gstreamer, ceph, nanomsg, hid, hidapi, udis86, portaudio. Each fails to load on a current build (native lib not shipped/built), and reviving any means re-adding a native build plus an s7 port. (The static portaudio_static audio backend is untouched — only the dead xtlang binding goes.)
  • Orphaned external bindings — the dead fleet/networking cluster (fleet, fleet-node, ghttp, jansson), plus glib, apr, system, curl, qr-code, libc. Not in any build target, not loaded by anything; "load" only on a dev box that happens to have the system package.
  • Legacy-OpenGL build scaffolding — the EXTERNAL_SHLIBS_GRAPHICS_OPENGL option, aot_external_graphics_opengl target, GL_BIND_METHOD logic and the nanovg/assimp ExternalProjects. Its aotcompile_lib() calls all pointed at libs/contrib/gl/* files deleted at v0.9.0-beta.
  • Dead/unused tests — game-of-life and mpi/random-walk (loaded deleted paths), external/system (tested a removed lib).
  • Verified-unused libs/core orphans — looper, music, xobject, vu_meter, pattern + base/pattern (superseded by pattern-language), toplap_clock (superseded by topclock), vaudio_dsp, and orphan instruments basicsynth/cerberus_midi/channel_strip.

Repaired

  • math_ext.xtm — vector/matrix linear algebra that had silently rotted: all-generic, so it loaded but failed to compile when used, because the math.xtm refactor renamed/changed every primitive it called. Ported and verified working (dot, cross, magnitude, normalise, +, -, elementwise/scalar *, scalar /, transpose, determinant, inverse, matrix multiply).

Added

  • AOT compilation round-trip test — two-phase (extras/cmake/run_aot_test.cmake): AOT-compile a fixture, then load it from its precompiled cache in a fresh process and assert execution + type/global-var docstring preservation. Registered under compiler-unit. Restores (and fixes) coverage the old unrunnable aot-compilation.xtm was meant to provide.

Verification

Full local ctest suite: 100% — 50/50 on Linux x64. Net ~13k lines removed.

Note: impc:ti:get-closure-docstring returns #f even for a freshly-compiled function — looks like a pre-existing regression independent of AOT, so bind-func docstrings aren't asserted. Flagged for separate follow-up.

benswift added 8 commits June 4, 2026 12:53
These bindings target native libraries that aren't shipped in
platform-shlibs, aren't built by CMake, and aren't loaded by anything.
Each fails to load on a current build with "could not find <lib>
dynamic library", and reviving any would mean re-adding a native build
plus porting to s7. Last touched 2016-2020; untouched through the
s7/aarch64 modernisation.

  opencl   - libCL (GPU compute, superseded by WebGPU)
  opencv   - ocv_core_lib/ocv_hgui_lib (computer vision)
  gstreamer- gstreamer (video)
  ceph     - librados (distributed storage)
  nanomsg  - libnanomsg (messaging)
  hid/hidapi - libhid (two competing HID bindings)
  udis86   - libudis86 (x86 disassembler)
  portaudio- libportaudio (legacy binding; the audio backend is the
             statically-linked portaudio_static, unaffected)
Not referenced by any build target, test, example, or live library, and
not in platform-shlibs. They "load" only on a dev box that happens to
have the system package installed; on CI or a clean machine they fail.
Last touched 2019-2020.

  fleet, fleet-node, ghttp, jansson - dead distributed-extempore /
      networking cluster (depended on the now-removed nanomsg)
  glib     - only consumer was the removed gstreamer binding
  apr, system - APR-based OS utilities, referenced only by unregistered
      legacy test aggregators
  curl (2016), qr-code, libc - strays, nothing loads them
The v0.9.0-beta WebGPU migration deleted all libs/contrib/gl/*.xtm,
nanovg.xtm, graphics-pipeline.xtm and assimp.xtm, but left the build
machinery that compiled them behind an OFF-by-default option. The
aot_external_graphics_opengl target's aotcompile_lib() calls all point
at files that no longer exist.

Removed:
  - EXTERNAL_SHLIBS_GRAPHICS_OPENGL option and its EXT_DYLIB override
  - GL_BIND_METHOD logic + AOT_EXTERNAL_GRAPHICS_OPENGL_LIBS list
  - the aot_external_graphics_opengl AOT block (CMakeLists.txt)
  - the "Legacy OpenGL graphics stack" native build block
    (extras/cmake/external_deps.cmake): nanovg + assimp ExternalProjects
    and the external_shlibs_graphics_opengl copy target
  - DEP_NANOVG_COMMIT and DEP_ASSIMP_VERSION pins

WebGPU graphics (stb_image, glfw3, webgpu) and the static portaudio
audio backend are untouched.
  tests/core/game-of-life.xtm   - loads deleted libs/contrib/game-of-life.xtm
  tests/external/mpi/random-walk.xtm - loads deleted examples/external/mpi/random-walk.xtm
  tests/external/system.xtm     - tests the now-removed libs/external/system.xtm

None are registered in extras/cmake/tests.cmake. The legacy
tests/all*.xtm aggregators and tests/core/aot-compilation.xtm are left
in place (a separate question).
math_ext.xtm (vector/matrix linear algebra) had silently rotted: it is
all generic functions, so it loaded fine but failed to compile the
moment any op was instantiated, because the "big refactor of math.xtm"
renamed/changed every primitive it calls. Verified working now for
double vectors and matrices (magnitude, dot, cross, normalise, +, -,
elementwise and scalar *, scalar /, transpose, determinant, inverse,
matrix multiply).

Changes:
  - renamed refactored primitives: vnorm->vnormalise, vdot->vvdot,
    vcross->vvcross, vmul->vvmul, vsum->vvsum, vsub->vvsub,
    mdetrm->mdeterminant, minv->minverse
  - fixed vsmul/vsdiv arg order (scalar-first -> vector-first)
  - dropped mprint's removed 4th (flag) argument
  - fixed the xtm_subtration typo -> xtm_subtraction
  - made the Vec/Mat macros hygienic (gensym, not a hard-coded symbol)
  - reimplemented transposition inline (math.xtm split transpose into a
    float-only mtrans and double-only mtranspose; neither works for a
    type-generic function)
  - removed the element-wise Vector/Vector division overload: math.xtm
    has no vvdiv primitive (Vector/scalar division is retained)
Confirmed by a full reverse-reference sweep (excluding the auto-generated
aot-cache): nothing in libs, examples, runtime, tests, docs, extras or
CMake loads any of these, and most last saw real changes in 2020.

  core/looper, core/music, core/xobject, core/vu_meter, core/math_ext^,
  core/toplap_clock (superseded by topclock), core/vaudio_dsp
  core/pattern + base/pattern (a dead pair; superseded by
    core/pattern-language), core/instruments/{basicsynth,cerberus_midi,
    channel_strip}

^ math_ext kept and repaired in the preceding commit.
Not registered in ctest and unrunnable: it instructs precompiling
libs/contrib/aot-compilation.xtm, deleted at v0.9.0-beta. AOT compilation
is still exercised by the aot_* build targets in CI.
Replaces the unrunnable aot-compilation.xtm removed earlier in this
branch with a real, registered two-phase test:

  - tests/core/aot-compilation-lib.xtm: a small self-contained fixture
    library (ported to the current base.xtm layout; the old one loaded
    the long-gone libs/core/std.xtm)
  - tests/core/aot-compilation.xtm: loads the fixture from its
    precompiled cache and asserts execution (aot_answer, aot_add) and
    docstring preservation (named-type + global-var) survive AOT
  - extras/cmake/run_aot_test.cmake: cmake -P harness that runs phase 1
    (impc:aot:compile-xtm-file) then phase 2 (xtmtest-run-tests),
    mirroring the offline-audio test harness
  - registered in tests.cmake under the compiler-unit label

Note: bind-func (closure) docstrings are deliberately not asserted ---
impc:ti:get-closure-docstring returns #f even for a freshly compiled
function, so that accessor looks broken independent of AOT.
@benswift
benswift merged commit ae6d730 into master Jun 4, 2026
4 checks passed
@benswift
benswift deleted the cleanup/dead-libs-and-scaffolding branch June 4, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant