Commit graph

8011 commits

Author SHA1 Message Date
Daniel Kochmański
8a13a9e85f reader: factor out ecl_read_token from ecl_read_object_with_delimiter 2026-03-07 22:42:12 +01:00
Daniel Kochmański
a4504dc1a3 reader: move the general-purpose reader from read.d to reader.d 2026-03-07 22:42:12 +01:00
Daniel Kochmański
8af28af3ef reader: move the readtable implementation from read.d to readtable.d 2026-03-07 22:42:12 +01:00
Daniel Kochmański
cc33abf37a reader: move common-lisp specific readtable entries t rtab_cl.d 2026-03-07 22:42:12 +01:00
Daniel Kochmański
f5870df786 reader: fix set_syntax_from_char copying behavior 2026-03-07 22:42:12 +01:00
Daniel Kochmański
f5372b057d core: split cl_core_struct in two structure cl_core and ecl_core
ecl_core contains early global environment that is meant to be shared by all
runtimes, while cl_core contains an environment relevant to common lisp.
2026-03-07 21:35:37 +01:00
Daniel Kochmański
22f1883ec7 core: define protect and dummy tags as constants
Both tags have a special meaning to the low-level runtime (most notably the
frame stack). Extracting them from "all symbols" is a step towards multiple
runtimes.
2026-03-07 21:35:37 +01:00
Daniel Kochmański
a7c86c32d4 core: move defacto constants from cl_core structure to global space 2026-03-07 21:35:37 +01:00
Daniel Kochmański
ef1f3964ab apply: generic functions are dispatched via the entry point
Previously standard and restricted dispatch was dispatched via
_ecl_standard_dispatch, but that adds a dependency on gfun.d.
2026-03-07 21:35:37 +01:00
Daniel Kochmański
147b7b68b7 apply: move funcall and apply-from-stack eval.d -> apply.d 2026-03-07 21:35:37 +01:00
Daniel Kochmański
0357e288ec core: minor cleanups in files character.d and string.d
These function clearly operates on strings, so move them to string.d
- cl_name_char
- cl_char_name
- ecl_string_case

Add a new local assertion assert_type_radix taht uses the new type.

sq
2026-03-07 21:35:31 +01:00
Daniel Kochmański
9d262a9cb3 core: predlib: add a system type SI:RADIX 2026-03-06 23:04:34 +01:00
Daniel Kochmański
1a1f4a5394 cosmetic: indent vector_push.d 2026-03-06 23:04:34 +01:00
Daniel Kochmański
b752046ed3 Revert "reader: fix a bug in SET-SYNTAX-FROM-CHAR"
This reverts commit 6011067359.
2026-03-06 19:48:53 +01:00
Daniel Kochmański
6011067359 reader: fix a bug in SET-SYNTAX-FROM-CHAR
The regrssion test was added as mix.0036.reader.false-sharing.
2026-03-06 18:58:54 +01:00
Marius Gerbershagen
ae92d13562 find-class: fix bug when searching compiler env
Environment records can be atoms.
2026-03-05 20:22:39 +01:00
Marius Gerbershagen
fcddd9c175 compiler.d: fix order of evaluation bug for nested eval-when forms 2026-03-05 20:22:39 +01:00
Marius Gerbershagen
5053532ee1 avoid name clashes in some tests
The cmp.0077.make-load-form.circular-dep test already tried to avoid
name clashes using ext:with-clean-symbols but this is a bit
problematic to use with file compilation since it uses uninterned
symbols. Just adding a prefix avoids the issue in a simpler, more
robust way.
2026-03-05 20:22:39 +01:00
Daniel Kochmański
13d41b746a tests: add a new regression test for a bug found in the reader 2026-03-05 14:37:08 +01:00
Daniel Kochmański
8d9f3c171d tests: add a new mixed test for bignums 2026-03-04 14:29:30 +01:00
Daniel Kochmański
56f1ce7850 tests: add a regression test for a symbol parser bug 2026-03-04 14:29:30 +01:00
Daniel Kochmański
83fc257cfa tests: add a regression test for a readtable-case bug 2026-03-04 14:29:30 +01:00
Marius Gerbershagen
9b1b5bdcbe fix test
We are already working in a sandbox, no need to use /tmp.
2026-02-28 19:05:15 +01:00
Marius Gerbershagen
2fbdd292af add workaround for compiler bug in clang 19 2026-02-28 16:10:26 +01:00
Daniel Kochmański
ede2f0aaa1 cmp: define constant VM before it is first used in a produced header
When we've built ECL without dynamic VV, the preprocessor define VM was
referenced in the produced header before it was defined. That lead to an error.
2026-02-27 11:22:02 +01:00
Daniel Kochmański
86e2f245f6 cosmetic: remove unnecessary bindings of the_env 2026-02-27 09:51:50 +01:00
Daniel Kochmański
b230bf52ac Merge branch 'find-class-compiler-env' into 'develop'
Store class definitions in the compiler environment

See merge request embeddable-common-lisp/ecl!364
2026-02-27 07:49:21 +00:00
Marius Gerbershagen
03a07d87b4 tests: fix Makefile for platforms that don't ship bash in /bin
Bug fix provided by Dima Pasechnik
2026-02-26 20:06:33 +01:00
Marius Gerbershagen
b1cf56806d clos: store class definitions in the compiler environment
According to the CLHS:

> If a DEFCLASS form appears as a top level form, [...] the compiler
  must make the class definition available to be returned by FIND-CLASS
  when its environment argument is a value received as the environment
  parameter of a macro.

We already store type definitions in the compiler environment, so we
can just reuse that.

While The metaobject protocol doesn't specify what happens when
compiling DEFCLASS, only what happens when executing it (see
https://franz.com/support/documentation/mop/concepts.html#compile-file),
real life software breaks when we try to create a full class object at
compile time. Therefore, we just create a dummy forward-referenced
class object which contains nothing more than a name.
2026-02-25 20:10:06 +01:00
Daniel Kochmański
944d5ef3b1 Merge branch 'cmp-base-string-coercion' into 'develop'
Fix incorrect coercion of base strings to extended strings during compilation

See merge request embeddable-common-lisp/ecl!363
2026-02-23 10:26:10 +00:00
Daniel Kochmański
1b97477d6b cross-compilation: add instructions and configs for mingw 2026-02-16 13:22:31 +01:00
Marius Gerbershagen
08dae53ebc remove unused function declaration 2026-02-14 21:33:29 +01:00
Marius Gerbershagen
d4994b33f0 cmp: fix incorrect coercion of base strings to extended strings
The compiler was coercing base strings to extended strings when
encountering them as literal objects in compiled files. According to
CLHS 3.2.4.2.2, we need to preserve the actual element type (after
upgrading) of arrays during compilation. For ECL, the actual array
element type of a base-string is base-char and therefore we can't
change this to an extended string.

Actually fixing this requires some work since we use the reader to
store a printed representation of the string in the compiled file. The
reader string syntax always returns an extended string (There is a
comment in the code which claims that this is implied by CLHS 2.4.5. I
am not quite sure if that is really true but for backwards
compatibility I don't want to change this). We thus introduce a new
syntax #"..." for base strings which is used when reading objects from
compiled files. To prevent the new syntax from leaking outside of this
context, we also introduce a new readtable.
2026-02-14 20:36:49 +01:00
Marius Gerbershagen
3842c579d4 read.d: replace dead link in comment by explanation in words
The contents of the message can still be found on the internet archive
by browsing http://sourceforge.net/p/ecls/mailman/.
2026-02-14 19:06:36 +01:00
Marius Gerbershagen
44b439135a cmp: fix some compile time type checks
We can't pass compound function types (i.e. function types which
include argument and return types) to TYPEP. At some places, this was
already handled but not everywhere. A new function CMP-TYPEP is
introduced to handle this. At any place where a user-supplied type is
checked at compile time, we need to use CMP-TYPEP instead of TYPEP.
2026-02-13 19:39:20 +01:00
Marius Gerbershagen
93aa909c84 cmp: don't emit style-warnings for dead code elimination
Dead code eliminiation often happens for automatically generated code,
so this leads to many false positives for code that doesn't have any
style issues.

Moreover, the combination of compiler-note and style-warning is
handled badly by asdf. By default, we don't display compiler-notes but
asdf catches style-warnings to display a notice that a style-warning
has been emitted which is confusing since no warning has been printed.
2026-02-13 19:00:48 +01:00
Marius Gerbershagen
33aa5a3941 fix bug in finalizer implementation
We need to save and restore the reference to the current function in
the environment before calling any finalizers. Otherwise, it can
happen that this is overwritten after we have set it but before
actually calling the function. This can lead to all sorts of issues
because closure environments are wrong or variadic dispatch doesn't
work correctly.

The bug appeared intermittently when compiling maxima from a version
of ECL compiled with CFLAGS="-DECL_C_COMPATIBLE_VARIADIC_DISPATCH" and
--disable-threads.
2026-01-31 20:25:49 +01:00
Daniel Kochmański
9cf33d51bb serialize: fix typos introduced in bignum serialization 2026-01-19 10:02:19 +01:00
Marius Gerbershagen
411723aa95 cmp: fix inline expansion for ABS function 2025-12-13 19:51:53 +01:00
Marius Gerbershagen
cae32c08bc cmp: fix inline expansions for EXPT function
Floating point contagion rules and the special case (expt 0 0) were
not handled correctly.
2025-12-13 19:51:53 +01:00
Marius Gerbershagen
c6488fa1c1 cmp: fix type propagator for EXPT
There were a number of bugs here:
- REAL was returned even for complex exponents
- The special case of exponent=0 wasn't handled correctly
- In some cases, EXPT could return integer or rational results but the
  type propagator would always assume that coercion to floating point
  was happening.
2025-12-13 19:51:53 +01:00
Marius Gerbershagen
f1091f4cd6 expt: fix floating point contagion
Examples of the bug

(expt -1.4d0 #C(1 2)) -> #C(-0.0020444484 -0.0016295447)
(expt #C(1.0 3.0) 0.0d0) -> #C(1.0 0.0)

These return a (complex single-float), should be (complex double-float).

The code incorrectly assumed that the numbers associated to the types
tx and ty were ordered such that long floats and complex long floats
have higher numbers than double floats and complex double floats.
2025-12-12 23:02:31 +01:00
Marius Gerbershagen
95566d1380 config-internal.h.in: add missing parameter definition for configure script
Fixes #803.

Bug introduced in commit d51ce511f6
2025-12-12 19:52:49 +01:00
Daniel Kochmański
9f9c9a8037 cmp: assign _ecl_debug_env to lcl_env (not lex_env) 2025-11-29 22:22:41 +01:00
Daniel Kochmański
dfb691ede8 top: add captured records to the local environment
We include captured functions, blocks and variables along with local
variables. This fixes #799.

Moreover DECODE-IHS-ENV is deperacated and more DWIM:
- calls DECODE-IHS-LOCALS for old arguments
- appends DECODE-IHS-LOCALS and DECODE-IHS-LEXENV for ihs index

DECODE-IHS-LOCALS and DECODE-IHS-LEXENV are responsible for decoding appropriate
environments.
2025-11-28 13:13:04 +01:00
Daniel Kochmański
e6ae6146a4 ihs/swank: make si_ihs_env return the local environment (not lexical)
We deprecate the function si_ihs_env in favor of more explicit si_ihs_lex and
si_ihs_lcl, but the former is left for backward compatibility with SLIME/SLYNK
because they call it to query the environment to add locals to the backtrace.
2025-11-28 11:57:09 +01:00
Daniel Kochmański
8a5007fd4a top: separate correctly lexenv from lclenv in break environment
Fixes #799.
2025-11-28 11:57:09 +01:00
Daniel Kochmański
ed5471169e ihs: store locals and lexical environment in separate slots
Since ~recently we store local variables in the bytevm on the stack.  Also, the
native comipler under specified debug options, stores locals in ihs, but it has
nothing to do with the lexical environment. So it feels justified to push both
to a separate field.
2025-11-28 11:57:09 +01:00
Daniel Kochmański
3c4c1639c5 proclamations: fix an invalid proclamation for SI:IHS-ENV
It may seem like this proclamation is invalid sincd !346, but the divergence
happens much earlier. 8c0314022c introduces a
feature where c-compiled code can also add debug information, and in that case
the environment is a vector, so the proclamation back then should be:

  (proclamation si:ihs-env (si::index) (or list vector))

Later when we've changed the representation, it should be changed to

  (proclamation si:ihs-env (si::index) (or null vector))

Where NULL denotes "no lexical environment".
2025-11-28 11:57:09 +01:00
Daniel Kochmański
34afd9a6d3 compile-file: allow :LOAD T :SYSTEM-P T when cross-compiling
We don't need to load the compilation artifact, so there is no reason to error.
2025-11-24 14:47:53 +01:00