Ann: SWI-Prolog 9.3.19

Dear SWI-Prolog user,

SWI-Prolog 9.3.19 is ready for download. It brings a couple of
bug fixes, an extensive rewrite of the clause indexing and some
enhancements. Highlights:

Indexing

The clause indexing code has been split into many more small and
documented functions. It also functions a little different:

  • Static code now computes all meaningful indexes on the first call.
    It a mode/1 declaration is present, arguments annotated with -
    are ignored as indexing candidate. Execution finds the most
    effective applicable index and materializes this the first
    time it was selected as the best index to use. This notably
    implies that performance no longer depends on the order in which
    candidate indexes are build, making the indexing more robust.
  • Dynamic code handling has not been changed yet.
  • jiti_list/1 shows both materialized and non-materialized (possible)
    indexes. jiti_suggest_modes/1 may be used to hint at mode/1
    declarations to avoid considering useless indexes.
  • 9.3.18 already provided improvement for indexing if all clauses
    have unbound arguments for leading arguments.

Together with code improvements, these changes improve performance by
5-10% on the benchmarks. I suspect they have more impact on code we
find “in the wild”, especially when written by people not aware of the
details in Prolog indexing.

Bug fixes

  • Control-C + abort while writing output could cause Prolog
    to terminate.
  • Restrict CHR term expansion to modules into which CHR is
    imported. Avoids conflicts with SSU ==> DCG rules.
  • Allow HTTP error reports to generate HTML containing
    non-ASCII characters.
  • Make sure the janus Python module is accessible from
    Prolog if Prolog is loaded into Python.

Usability

  • Both using the libedit command line editor and the Windows
    swipl-win.exe add a command paste-quoted, bound to
    Control-Y. This pastes the clipboard text into the console
    as Prolog quoted text. The quote character is defined by
    the quote before the caret. If there is no quote before
    the caret, single quoted insert is used. After suggestion
    by @pasik
  • Some enhancements to explain/1.

Building

If you upgrade using git and build in the old build directory it
may be necessary to delete all .qlf files first by running this
in the build directory.

swipl qlf clean -ra

Enjoy --- Jan

SWI-Prolog Changelog since version 9.3.18

  • MODIFIED: Only include <windows.h if
    SWIPL_WINDOWS_NATIVE_ACCESS is defined This provides the types and
    prototypes for the Swin* functions that provide access to underlying
    HANDLE and SOCKET objects.

  • ADDED: swipl-win console ^Y bound to paste_quoted.

  • ENHANCED: Simplify shallow backtracking code

  • ADDED: jiti_suggest_modes/0,1 Inspect the created JIT indexes, looking
    for arguments for which we could create an index, but the predicate
    is never called with the argument instantiated.

  • ENHANCED: Handling of candidate deep indexes.

  • MODIFIED: predicate_property/2 indexed(-Indexes) property Now returns
    the indexes as a list of dicts. This supports new features and is
    easier to extend as indexing is further refined.

  • ADDED: Low level support to compute all useful hash indexes and
    their properties. Accessible from Prolog as ‘$candidate_indexes’/3

  • DOC: Clarified PL_get_arg() and _PL_get_arg().

  • FIXED: indexableCompound() This function is used to see whether
    a deep index is possible. It could generate wrong results, both
    missing indexes and making useless indexes.

  • TEST: Cleanup reload test Layout and use assertion/1 such that we
    can more useful feedback

  • ENHANCED: explain/1 Several enhancements, notably list predicates with
    certain properties and provides some more detail on various objects.

  • FIXED: Cleanly destroy claused indexes on free.

  • FIXED: Detection whether a compound can be used for deep indexes.
    This incorrectly considered H_VOID/H_VOID_N to be indexable.
    Also documents and uses bool.

  • FIXED: addClauseToListIndexes() could skip indexes

  • ENHANCED: Inserting new clause indexes

  • FIXED: Crash in clear_frame_vars() when compiled for debugging

  • ADDED: library(prolog_colour): colour mode/1 directives. Coloured as
    meta_predicate and therefore still accepts the non-mode specifiers.

  • ADDED: check/0: print dummy mode declarations.

  • FIXED: Control-C + abort while printing output may exit REPL.
    If the abort is handled by PL_handle_signals() called from flushing
    the output, the stream is set in error state. If releasing the
    stream re-raises the exception it should clear the error state from
    the stream.

  • CLEANUP: Remove unused supervisor instructions S_ALLCLAUSES and
    S_NEXTCLAUSE

  • DOC: JIT indexing for vs [|] and “primary” index

  • ADDED: mode/1 and predicate_property/2 property mode(-Head)

  • ENHANCED: Generalize S_LIST supervisor for any argument. The S_LIST
    supervisor is now used to select between an [] and [_|_] clause
    regardless of the argument.

  • FIXED: Clause analysis that involves multiple calls to skipArgs()
    In this case we need to keep context for dealing with H_VOID_N,
    skipping N void arguments.

  • FIXED: reexport/2: allow for op(Priority,Associativity,Name) Consistent
    with use_module/2 as (now explicitly) claimed. Reported by Rick
    Workmann.

  • FIXED: alloc_assessment(): check for malloc() failure

  • ENHANCED: bypass most indexing code for non-indexable predicates

  • ENHANCED: Change default index argument

  • ADDED: Prolog flags to query and change the JIT clause indexing.
    Experimental. The meaning and names of the flags are likely to change.

Package bench

  • ENHANCED: Benchmark comparison suite. Be more relaxed on missing
    systems and allow adding new systems without changing the sources.
    See README.md

Package chr

  • MODIFIED: Only perform CHR expansion when loaded in the context.
    Restrict CHR term expansion to modules into which library(chr) has
    been imported.

Package clib

  • PORT: Provide SWIPL_WINDOWS_NATIVE_ACCESS for 9.3.19

  • TEST: Fixed broken test for Prolog streams.

Package http

  • FIXED: Handle HTML error replies that contain non-ASCII. HTML error
    replies are now sent using UTF-8 encoding. This patch also includes
    more careful computation of the length of replies, resulting in
    exceptions rather than claiming the wrong length on invalid input.

Package libedit

  • ADDED: ^Y to paste as quoted.

Package ltx2htm

  • ADDED: \keyitem{Key}{Value} for describing keys of a dict

Package odbc

  • PORT: Incude windows.h, needed for SWI-Prolog 9.3.19 and up This
    is required as SWI-Stream.h no longer includes the windows header.

Package pengines

  • ADDED: add HTTP path alias pengine. This allows for modifying the
    location on a pengine server.

Package pldoc

  • ADDED: Allow copying the predicate name or mode from the manual.

  • ENHANCED: Allow copy of the synopsis text :- use_module(...).
    Also improve (can be autoloaded) message.

Package swipy

  • TEST: Added tests for pytest of the Python module.

  • FIXED: Import janus_swi explicitly as janus This is needed when
    Prolog is embedded into Python.

Package xpce

  • FIXED: Avoid deadlock in display<-selection.
2 Likes