Ann: SWI-Prolog 9.3.20

Dear SWI-Prolog user,

SWI-Prolog 9.3.20 is ready for download. Most of the work is on the
C API, WASM and single threaded version:

  • Support Emscripten 4 for building the WASM version
  • Enable engines in the single threaded version, including the
    WASM version by default.
  • Fix a bug in the single threaded system that can cause serious
    slowdown due to excessive calling of the atom garbage collector.
    This actually also happens in the normal threaded version, but
    as AGC is running in a separate thread the impact was much smaller.
  • Extend the C API for engine and query interaction to make managing
    engines from C easier.
  • Use the above to add class Engine to the WASM version.
  • WASM: support running both synchronous and asynchronous queries
    in a new anonymous or explicitly manage Engine.

Small stuff

  • Small enhancements to the debugger: make debugging/0 report
    spy points (was broken) and avoid some spurious activation
    of the tracer in multi-threaded (e.g., http server) applications.

  • swipl-ld makes a C macro SWIPL_HOME (as a C string)
    available that can be used to set the Prolog home properly.

    Enjoy — Jan

SWI-Prolog Changelog since version 9.3.19

  • ADDED: WASM: options parameter to Prolog.query() and Prolog.forEach()
    to control running in a dedicated engine.

  • DOC: Class Engine

  • WASM: Improve Query and Engine interaction and benchmark suite

  • DOC: Docuemnt scripts/configure in CMAKE.md

  • MODIFIED: By default enable engines in single threaded version.
    The impact on performance and size is minimal.

  • ADDED: Support Prolog engines in the WASM JavaScript interface

  • ADDED: PL_current_engine() Although we can also fetch the current
    engine using PL_set_engine(), this API is simpler and faster and
    notably easier to handle for e.g., the WASM version.

  • WASM: Use (hard) links to populate the wasm-preload directory. This
    makes incremental builds work correctly if Prolog files are changed.

  • ENHANCED: No longer trigger AGC from CGC We used to trigger this if
    there are a fair amount of clauses that have been erased for which
    we have a clause reference. As we remove these clauses anyway from
    the indexes, they only cost memory and thus leaving the decision to
    normal AGC seems fine.

    In due time we should probably consider atom sizes when considering
    AGC.

  • ADDED: PL_set_query_data() and PL_query_data() These allows attaching
    user data to a Prolog query. This allows for efficiently tracking
    the role and status of a query in an application.

  • ADDED: Better engine corouting support from C using PL_WITH_ENGINE()

  • WASM: Missing build dependency

  • CLEANUP: conditional dead code when using engines without threads.

  • WASM: Associate await/2 state with the engine This is part of
    supporting multiple engines in the WASM version.

  • ADDED: PL_query_arguments() This finds the arguments of the primary
    goal of a query.

  • ADDED: Support engines in single-threaded version This patch revives
    an old proof-of-concept option to include engines in the single
    threaded version. The code compiles and tests again. Added Prolog
    flag engines to indicate the system has engine support.

  • DOC: Extended state values for PL_next_solution()

  • ADDED: Provide SWIPL_HOME macro from swipl-ld

  • TEST: Move tests from src/Tests to tests This simplifies navifating
    the source tree. It notably allows us running git grep in the
    src directory for C code without false hits from the Prolog tests.

  • BUILD: Support multiple Emscripten environments in scripts/configure

  • PORT: WASM: Silence unused main warning. Main is a tiny function
    that pulls in no extra dependencies, so keeping it in is easier than
    leaving it out.

  • PORT: Support Emscripten 4 - All source must be in --pre-js as the
    --post-js is loaded
    after the module is initialized and thus we cannot initialize
    Prolog
    there. - Bug in Query constructor, passing an integer rather
    than a string.

  • FIXED: Compilation on single-threaded systems.

  • FIXED: debugging/0 fails to report spy points. Because debugging/0
    runs the implementation in nodebug mode it never reports that debug
    mode is on and the set spy points.

  • PORT: Avoid C23 static_assert() without message

Package http

  • ENHANCED: Ensure the HTTP worker disables tracing before starting
    the next request. This avoids what seems spurious activation of the
    debugger because the user finished debugging some request and the
    debugger is started immediately on a possibly unrelated request.

Package swipl-win

  • ADDED: minimal implementation of ^Y

Package swipy

  • DOC: #16 Document usage on MacOS using SWI-Prolog.app.
2 Likes