Dear SWI-Prolog user,
SWI-Prolog 9.3.4 is ready for download. This version comes with a lot
of internal changes, which means that the stable releases (9.2.x) from
now on only backports critical bugs.
This version got the first two rounds of the planned internal reorganization. More concrete:
- Prolog data is now 64 bits, regardless of the platform. In practice,
this affects the Win32, WASM and small systems such as older
Raspberry Pis. As a consequence, stack usage on these platforms
nearly doubles, but stacks are now limited by memory rather than
having an 128Mb limit. Efficient (tagged) integers now have
57 bits on all platforms (was 25 on 32 bit platforms). - Prolog data now uses absolute addressing, rather than stack offsets.
I expected this to have significant performance impact, as introducing
relative addresses reduced performance (but was the chosen way to
allow many threads to use all memory on 32 bit systems). Unfortunately
this the impact is not measurable. Apparently modern CPUs do enough
look ahead to get the data ready when needed in parallel. Nevertheless,
this is a step ahead as it allows for further simplification, optimizing
type tagging for 64 bits and new features such as direct access to terms
in engines. Hopefully those changes will have some performance impact.
Although all tests pass on all platforms, some regression is likely. Please
report bugs. These changes made some latent bugs surface. Other highlights:
- Fixed crash in PL_get_mpq()
- Better memory management for bignum operations. Avoid possibly
memory leak in format/3 on bignums. Introducemax_integer_size
flag
to limit the memory of bignums (avoiding resource errors). By default,
bignums are limited to the stack limit. - Unicode fixes: QLF I/O and upcase/downcase that changes characters <= 255
to larger code points. - Various portability issues
- Sweep (GNU Emacs) issue with certain locales (@oskardrums)
- Janus: Two Python object reference count issues. Added py_import/2,
effectively realizingimport module as alias
Also push Ubuntu PPA for Noble Numbat (24.04)
Enjoy --- Jan
SWI-Prolog Changelog since version 9.3.3
-
PORT: Include Ubuntu 24.04 (Noble Nombat) in PPA builds
-
PORT: Use -funwind-tables on ARM systems with glibc, also for clang
-
CLEANUP: Remove various unused macros and join macros that are now the
same Also document the current state of the Prolog data representation. -
ENHANCED: Removed accessing Prolog data using relative addresses This
patch removes accessing Prolog data using relative addresses to the
stack bases. This was long ago introduced to facilitating access to
all memory on 32-bit systems using multiple threads.Now all prolog data is 64 bits, also on 32-bit systems and hence we can
access all memory using a tagged pointer. -
PORT: Deal with Android
android-execinfo
library. -
FIXED: generation of swipl.pc pkg-config file Now uses LIBSWIPL_DIR to
get the correct -L flag when the system is installed as global library. -
FIXED: Reconsult when the loaded code sets the
trace
flag on
a predicate. This was due to a conflict over the predicate flags.
As theflags
field was widened, we can avoid these problems. -
PORT: #1265 Deal with static_assert() after label
-
FIXED: WASM: fix fid arg position in this.query call in
__call_yieldable -
FIXED: #1262 upcase_atom/2 and friends on ISO → wide If input is
ISO-Latin-1 and the converted character requires wide characters
the system trapped an assertion error. Now correctly converts to
wide characters. -
FIXED: Clang handling of
max_integer_size
Clang cannot handle
setjmp()/longjmp in PL_next_solution(), but it can in the simple
evalExpression() function. This does not have measurable impact on
performance, so we enabled this as default. This fixes limiting the
integer size for WASM and Clang builds on Linux. This problem did
not surface on the MacOS version. -
FIXED: Compute new stack size when we reach the limit. Suffered from
integer overflow on 32-bit machines and got several edge cases wrong. -
CLEANUP: Allow for gcc
-Wconversion
With 64 bit word it is easy
to get conversion errors. Compiling with-Wconversion
helps
tracking these. -
FIXED: comparison of MPZ and MPQ with 64 bit integers if long is
4 bytes -
FIXED: Push string when stack > 128Mb on 32-bit hardware
-
DEBUG: Added
scripts/gdbinit
Share gdb script with useful debugging
commands. [no ci] -
FIXED: Normalize LibBF numbers created from 64 bit integers on VS2022
VS2022 does not support 128-bit integers and therefore we must use
32-bit “limbs” -
PORT: VS2022: void* arithmetic, wrong order for SIZEOF_WORD
-
FIXED: forAtomsInClause() handling of B_*_?C instructions These called
PL_unregister_atom() on the atom, rather than the argument function. -
FIXED: DEBUG(CHK_SECURE) clean of memory (wrong size)
-
FIXED: Type handling in copy_term/2 and friends.
-
ADDED: PL_atom_index() and PL_atom_from_index() Turn atoms into small
objects that can be combined with other pointer sized objects with
space for a tag. -
BUILD: Respect
$CFLAGS
and$CXXFLAGS
in a CMake build types -
CLEANUP: Get rid two definitions for trail entries
-
CLEANUP: Prepare hash tables for the M64 data model This huge commit
changes pl-table.c to be word → word rather than void* → void* as
we plan to make words 64 bit, also on 32 bit systems. This patch also
introduces 4 table types, TableWW, TableWP, TablePW and TablePP. These
tables map between words and pointers in all 4 possible ways.This patch also involves small cleanups and fixes encountered while
reading the code and use FOR_TABLE() everywhere, removing the old
for_table() macro. -
FIXED: prototype for get_string_text()
-
FIXED: make markAtomsOnGlobalStack() safe This could crash on all
platforms. It is notably dangerous using the experimentalO_M64
model. -
TEST: Disable
max_integer_size
test for emscripten Doesn’t handle
longjmp() correctly in release mode. Works in debug mode, but that
is not useful. -
FIXED: write clauses holding > 0xffff Unicode chars in strings to
QLF on Windows. -
FIXED: forAtomsInClause() handling of B_*_?C instructions These called
PL_unregister_atom() on the atom, rather than the argument function. -
FIXED: Temp buffer handling when stack is close to top of address range
-
DEBUG: Fixed chk_secure report on invalid term due to
PushPtr()/PopPtr() This construct to turn raw pointers into term
references to preserve them during GC can create referenc pointers
to the local stack. Another possible fix is to turn such references
into direct term references. That avoids local stack references,
but as this is only used around GC and GC itself uses local stack
reference pointers, there is little to gain. -
FIXED: unifiable/3 internal consistency Unifiable did not correctly
handle stack resizing. This is detected when running using chk_secure.
Not sure whether it can also cause real issues, but the new code is
simpler and safe. -
FIXED: powm/3 function: wrong type check on 3rd argument.
-
FIXED: Declaration of term stack for evaluating expressions
-
FIXED: Write bignums when inside arithmetic. Should normally not be
needed, but debugging is much easier if we can. -
PORT: Avoid spurious warnings from spoiling pthread_setname_np()
test This used to use-Werror
to ensure a compiler failure if the
number of arguments do not match the prototype, but this is already
enforced in todays compilers. -
FIXED: use_module/2 with except and reexport/2 with except to
print warning These predicates failed if the source did not export
the excluded predicate. Now it prints a warning and ignores the
non-existent predicate. -
DEPRECATED: Sseek(), Stell()
-
FIXED: Another fileno issue.
-
ADDED: library(sandbox): allow for
Dict.get(key,Default)
-
FIXED: Stream initialization for
swipl-win.exe
Was broken since
recent changes keeping track offileno
. Reported by Jan Burse. -
ADDED: PL_system_error() This patch also adds documetation for
PL_fatal_error(). -
ADDED: Prolog flag
max_integer_size
This flag limits the allocations
on behalve of bignum and rational number processing, DoS attacks
by exhausting memory using huge numbers as well as poor interrupt
handling due to lack of signal handling inside the bignum libraries. -
ENHANCED: Use temprary malloc API for bignum arithmetic
-
ENHANCED: Keep small bignums on the stack
-
CLEANUP: Simplify arithmetic context This is no longer nested and can
(thus) be simplified. -
FIXED: format/3: Ensure balanced AR_BEGIN()/AR_END() On errors it was
possible that AR_END() was not called. This may lead to memory leaking
and errornous operation when linked in a process that also uses gmp. -
ENHANCED: Improve memory reuse after writing huge integers.
-
FIXED: #1254 crash in PL_get_mpq()
Package clib
- PORT: Avoid warning on __RCSID() in bsd-crypt.c Suppresses a warning
on CRAN win builder
Package cpp
-
MODIFIED: PL_get_integer() no longer accepts floats
-
TEST: exceptions in blob callback
-
DEPRECATED: PlStream::tell(), PlStream::seek() Also fixes initilization
errors. Uses PL_system_error() to signal misuse rather than assert() -
FIXED: Possibly uninitialized variable This is a temporary patch.
blob compare() and acquire() cannot raise a Prolog exception.
This should print a message and abort the process. -
FIXED: handle nil blobs in callbacks
Package http
-
MODIFIED: library(http/http_load) to verify certificates This library
allows for loading files from http/https URLs. It used to skip
certificate checking. Checking is now enabled and the Option argument
may be used to disable it (using thecert_verify_hook
option). -
FIXED: Undefined predicate schedule_gc/2 in library(http/http_session)
Package pldoc
- ENHANCED: Deal with a large selection of diacritics in the LaTeX
backend. When converting PlDoc markdown to LaTex, we now generate
proper LaTeX sequences for ten common diacritics.
Package semweb
-
FIXED: #112 C11 compatibility (no declaration after label)
-
FIXED: Message propagation when rdf_load_db/1 fails.
-
FIXED: Type error
Package ssl
- PORT: Fix test for X509_get0_signature() on Windows. This is still
problematic as-Werror -c
assumes gcc/clang/… We could use
try_compile
as incmake/CheckFloatingPointFormat.cmake
of the
main source?
Package sweep
- FIXED: workaround Emacs incompatibility with certain locales The Emacs
Elisp reader only works with locales that have “.” as their decimal
separator, but Prolog initialization sets up the locale according to
the environment variables. Therefore we need to reset the locale
after initializing Prolog in case the environment prescribes a
locale with a different decimal separator, such as fr_FR. See also
loading sweep trashes emacs hashtable management · Issue #1 · SWI-Prolog/packages-sweep · GitHub
Package swipy
-
DOC: janus.query() etc optional arguments is called
inputs
-
FIXED: Memory leak when generating a Prolog dict from a Python dict
-
FIXED: Wrong Python refcount update. Reported by Jerry James as !8.
That is is not entirely correct though. -
FIXED: iterator janus.query(): properly handle data conversion
exceptions -
ADDED: py_import/2: Allows to import a module with a different name.