Commit graph

8964 commits

Author SHA1 Message Date
Daniel Kochmański
4542318b80 stream: add missing lisp interfaces
The api for these is cleaned up compared to Common Lisp counterparts.
2025-07-26 16:59:42 +02:00
Daniel Kochmański
a5c922b849 stream: unread_error and unread_twice are now not continuable
At least in two from four cases continuing from the error lead to an error:

- for concatenated stream we've tried to dispatch on CAR that was NIL (segfault)
- for string stream we've decremented the position below 0

Also change these functions to defined macros ecl_unread_* that expand to
FEerror (in internal.h). This is in anticipation of splitting file.d.
2025-07-26 16:59:42 +02:00
Daniel Kochmański
b8e8899280 stream: change order of arguments in internal write_byte methods
That said this is inconsistent with how we implement ECL-WRITE-CHAR, and with
STREAM-WRITE-BYTE, so for convenience we swap the argument order.
2025-07-26 16:59:42 +02:00
Daniel Kochmański
c828e7b64d core: move atomics from threads directory to core
Atomics are needed by stacks.

Replace ecl_atomic_push -> ecl_atomic_psh that takes as an argument a
preallocated cons. ecl_atomic_push is replaced with a macro.
2025-07-26 16:59:42 +02:00
Daniel Kochmański
0dad009527 c/makefile: group files in rough categories 2025-07-26 16:59:42 +02:00
Daniel Kochmański
ca8eea81a1 Update gitlab-ci to run pipeline less frequently (2) 2025-07-26 16:59:24 +02:00
Daniel Kochmański
31a82c296c Update gitlab-ci to run pipeline less frequently
We've hit qutie fast 3/4 of the limit, so this pull request limits pipelines to
be run only when we commit to the branch develop and on merge requests.
2025-07-26 08:31:28 +02:00
Daniel Kochmański
84e9b0b450 Merge branch 'cross-compilation-core' into 'develop'
Cross compilation improvements

Closes #741 and #747

See merge request embeddable-common-lisp/ecl!352
2025-07-21 08:04:44 +00:00
Daniel Kochmański
3e3da7dc27 gitlab-ci.yml: specify artifacts and make test jobs work
We don't fail when some tests don't pass -- we run them instead and the
submitter/reviewer now can check results before merging.
2025-07-21 10:02:08 +02:00
Marius Gerbershagen
b77a0bbf06 update compilation instructions for iOS and emscripten
We don't need a separate host compiler anymore.
2025-07-19 16:33:22 +02:00
Marius Gerbershagen
f0ef267ce7 update compilation instructions for android
With recent versions of the android NDK, there is no need to create a
separate toolchain anymore. Moreover, the LDFLAGS and CPPFLAGS are
obsolete. Also, we can't call the C compiler with a `-Dandroid`
argument as we used to since that conflicts with uses of the `android`
identifier within the header files of the android C standard library.
Therefore, we change from `thehost=android` to `thehost=ANDROID` in
uppercase. Finally, make the test script run more reliably by starting
an adb server before we change TMPDIR.
2025-07-19 16:33:22 +02:00
Marius Gerbershagen
6a3605b768 clos: builtin classes have the same index independent of configure options
This is needed to allow for cross compiling from a compiler with a
different set of configure options (e.g. compiling for a target which
doesn't support complex floats from a host which does).
2025-07-19 16:33:22 +02:00
Marius Gerbershagen
b194811ee3 src/util: add script to help in testing cross compilation 2025-07-19 16:33:22 +02:00
Marius Gerbershagen
d51ce511f6 handle *features* entirely in the configure script
Previously, there were a lot of places that turned on or off C macros
which finally determined whether some particular entry was found
in *features* or not. Now, we do this all in the configure script.
This is necessary for cross compilation from a non-compatible host
which may have different features.
2025-07-19 16:33:22 +02:00
Marius Gerbershagen
cd90ecfd55 cmp: signal internal error in wt-vv-value if we detect a programming error 2025-07-19 16:33:22 +02:00
Marius Gerbershagen
887115fe95 cmp: implement cross compilation from host compiler with different word size 2025-07-19 16:31:55 +02:00
Marius Gerbershagen
a1b1eee8b5 cmp: allow for storing type definitions in the compiler environment
Currently unused; will be used in the implementation of
cross-compilation.
2025-07-19 16:31:55 +02:00
Daniel Kochmański
c7b5b9f70e ecl_init_module: rebind *readtable* and *package* to protect the env
Fixes #785.
2025-07-17 16:02:18 +02:00
Marius Gerbershagen
af89c4a972 don't forget to initialize C stack limits if threads are disabled
This was broken after the recent refactor of the initialization code.
2025-07-06 14:40:21 +02:00
Marius Gerbershagen
9457813343 fix initialization of the main thread environment
The default sigmask was NULL previously (bug introduced in the
refactor in commit 0f4e9b1e1).
2025-07-05 22:07:28 +02:00
Marius Gerbershagen
a213b4eaa1 fix typo preventing non-threaded builds from working
Introduced in the refactor in commit
ecaa73155b
2025-06-28 20:08:16 +02:00
Marius Gerbershagen
b0f7711bd1 tests: fix process-environ
We were trying to check if the output of the program is empty but we
were passing `:output nil` to ext:run-program. Thus, the stream from
which we trying to read was nil which is the stream designator for the
standard input. The empty read succeeded only by chance if the
standard input had no available characters to read.
2025-06-28 19:45:50 +02:00
Daniel Kochmański
7f18d20ad3 Merge branch 'fix-78x' into develop 2025-06-26 14:31:37 +02:00
Daniel Kochmański
0857a438f6 logical pathnames: add a regression test and update the changelog
I've tested it against ansi-test and our own test suite and there are no
regressions.

Related to #784.
2025-06-26 14:31:07 +02:00
Daniel Kochmański
5818808f7c logical pathnames: fix logical pathname translation for multiple *
After this commit

    (setf (logical-pathname-translations "x")
          (list ("X:a;*;b;*;*.*" "/hello/*/hi/*/what/*.*")))
    (translate-logical-pathname #p"x:a;bonjour;b;barev;greetings.me")

will return a correct result

    #P"/hello/bonjour/hi/barev/what/greetings.me"

Related to #784.
2025-06-26 14:06:17 +02:00
Daniel Kochmański
03e61206ba logical pathnames: fix find_list_wilds to not produce self-refs
The function find_list_wilds incorrectly collected results from calling
find_wilds, and the latter returned incorrect results when the component fully
matched. It seems that this was a single function that was later split with
errors.

This change saves us from a segfault when we try to match multiple wild
components. Previously find_list_wilds for

(setf (logical-pathname-translations "x")
      `(("X:a;*;b;*;*.*" "/hello/*/hi/*/what/*.*")))
;; ((#P"X:A;*;B;*;*.*" #P"/hello/*/hi/*/what/*.*"))
(translate-logical-pathname #p"x:a;bonjour;b;barev;greetings.me")

returned #1=((BONJUR) #1# BAREV).

Moreover fix an issue where we've compared incorrect character in find_wilds to
determine the end of the glob (we've compared the source character with #\*
instead of the character after).

Fixes #784.
2025-06-26 13:28:42 +02:00
Marius Gerbershagen
ea5a10cbc1 copy-symbol: work around a bug in gcc
On x86_64, gcc 12.2.0 from debian 12 miscompiles the code we had
previously. It generates code that copies symbol.macfun and
symbol.sfdef using an aligned move SSE instruction which requires 16
byte alignment of its operand. This alignment is not present in
general, leading to a segfault for instance when calling (copy-symbol
t t). By reordering the assignments, we avoid triggering the bug.
2025-06-22 10:45:53 +02:00
Daniel Kochmański
d880e6f276 stacks: fix issues with ecl_make_stack
these functions are not used by us yet, so these issues were not noticed. Most
notably we did not assign the vector type and did not release the object.
2025-06-06 15:19:06 +02:00
Daniel Kochmański
9a894b7dab stacks: fix a type in an error message 2025-06-03 21:16:33 +02:00
Daniel Kochmański
0f24472237 bytevm: allow for bytecodes data segment to be NIL
We don't eagerly dereference bytecodes.data->vector.self in case when data is
assigned ECL_NIL. IN that case the *data vector is NULL. That saves us from the
necessity to allocate a vector when we don't use the data segment at all.
2025-06-02 12:05:50 +02:00
Marius Gerbershagen
a158731cc9 Merge branch 'bytecmp-fix-eval-with-env' into 'develop'
Fix a recent regression in bytecodes compiler

See merge request embeddable-common-lisp/ecl!350
2025-05-31 14:54:49 +00:00
Marius Gerbershagen
cb9b63a9a7 Merge branch 'refactor-stacks' into 'develop'
refactor stacks to reduce dependencies

See merge request embeddable-common-lisp/ecl!348
2025-05-31 14:39:34 +00:00
Daniel Kochmański
c00b13f47d stacks: when the stack frame is aligned with the stack, update both
This is to ensure that the topmost frame manipulations update also a data stack.
2025-05-29 14:55:46 +02:00
Daniel Kochmański
e9e97815bc stacks: make stack frame state consistent based on its operators
Previously we did not perform necessary checks for whether we should update the
frame size and stack pointer or whether we should resize the stack. This commit
fixes these functions and adds a missing function to API ecl_stack_frame_pop.
2025-05-29 14:05:17 +02:00
Daniel Kochmański
8fcac4bd9f ecl-inl: add looping over stack frames 2025-05-29 11:29:21 +02:00
Daniel Kochmański
c40a3011b6 bytecmp: import_cmpenv registers a function boundary in the end
This is to avoid a situation where the form evaluated by CMP-EVAL treats the
compiler environment as its own local environment. That caused recently a
regression, because we count indexes in FIFO order for sake of dlat closures

Before local closures:

                     v first from top (correct)
[compiler-env-record form-record]

After local closures

 v first from bottom (incorrect)
[compiler-env-record form-record]

After this commit:

                       v first from bottom after the boundary
[compiler-env-record | form-record]
2025-05-27 14:02:32 +02:00
Daniel Kochmański
ba891a5094 bytecmp: lazily allocate a vector for captured env objects
This way we don't need to separately keep track for whether the function
boundary was crossed for the env, and we don't need to /think hard/ when
captured vector should be allocated.

Moreover the test for whether the parent crosses the function boundary is
precise now, and we save memory when we don't need to allocat a vector.
2025-05-27 14:02:32 +02:00
Daniel Kochmański
3ba6b6dbb6 bytecmp: import_cmpenv: fix reversed test for lexical_level
Commit f36f53a933 accidently(?) reversed the test
by adding the else clause without switghing != to ==.

SYMBOL-MACROLET does not change top-levelness of its children (unlike other
bindings), so we should set lexical_level=1 when we encounter /other/ binding
than SYMBOL-MACRO.

Moreover we add :DECLARE to the mix. The macro LOCALLY does not change
top-levelness either.
2025-05-27 14:02:32 +02:00
Daniel Kochmański
9995ba6188 bytecmp: import compiler environment in a function import_cmpenv
This step simplifies logic where we import either from lexenv or from cmpenv.
The next step is to add a correction to locations in cmpenv to address the most
recent regression in passing env from the c compiler to the bytecodes compiler.
2025-05-27 14:02:32 +02:00
Daniel Kochmański
92978b6cae tests: add a test for the recent regression in bytecmp
The regression happens when we pass compiler env from ccmp to bcmp.
2025-05-27 14:02:28 +02:00
Daniel Kochmański
71763174ef doc: clarify wording for :INITIAL-BINDINGS in MAKE-PROCESS 2025-05-26 09:28:10 +02:00
Daniel Kochmański
b1605eaeae update the changelog 2025-05-26 09:28:10 +02:00
Daniel Kochmański
5233c2104a stacks: move ECL_STACK_RESIZE_DISABLE_INTERRUPTS before realloc 2025-05-26 09:28:10 +02:00
Daniel Kochmański
ecaa73155b cleanup: reorganize cl_env_struct 2025-05-26 09:28:10 +02:00
Daniel Kochmański
7dfc7ac5e9 stacks: add a general purpose stack implementation based on vector 2025-05-26 09:28:10 +02:00
Daniel Kochmański
03e9f9296c stacks: refactor file to separate low level and high level operators
With this it will possible to move low level primitives earlier in the bootstrap
process.
2025-05-26 09:28:08 +02:00
Daniel Kochmański
fd2fae1a39 stacks: merge stack overflow errors into a single handler
Replace calls to cl_error and cl_cerror with CEstack_overflow.
2025-05-26 09:21:50 +02:00
Daniel Kochmański
21c23973ae stacks: refactor the code in stacks.d
- {run,bds,frs}_set_size functions were very similar; I've updated them to
  follow the same naming convention and execution order to indicate that.
- these functions are now renamed to xxx_set_limit -that simplifies some code
- there were inconsistencies in how we've treated boot sizes (limit vs size)
2025-05-26 09:21:32 +02:00
Daniel Kochmański
72fb1c583a stacks: remove serror, stack-error-handler and reset-margin
All these operations were propagated up to the condition system in order to
reset the stack margin in the case of a non-local exit. We can do that easily
with open-coded unwind protect within stacks.
2025-05-26 08:44:18 +02:00
Daniel Kochmański
6463cae89c stacks: rename bindings and runtime stack pointers stored in frs
They are named to follow the same convention hinting that it is an index, not a
pointer.
2025-05-26 08:43:59 +02:00