Commit graph

8870 commits

Author SHA1 Message Date
Daniel Kochmański
94a2725ddb Merge branch 'fix-774' into 'develop'
Fix issue #774

Closes #774

See merge request embeddable-common-lisp/ecl!343
2025-04-22 06:57:28 +00:00
Marius Gerbershagen
fba016b093 fix mingw build 2025-04-13 16:54:19 +02:00
Marius Gerbershagen
72c83ac9b5 cmp: fix bug for calls to local functions with more arguments than c-arguments-limits
Closes #774.
2025-04-05 22:14:17 +02:00
Marius Gerbershagen
7b546e7fd2 Merge branch 'first-env' into 'develop'
refactor boot order

See merge request embeddable-common-lisp/ecl!341
2025-04-05 16:50:13 +00:00
Daniel Kochmański
868c3e4d31 core: don't use gc allocator to allocate a runtime environment
When we don't use mprotect (nor guard page), we allocate the memory manually.
This simplifies some code and makes the booting process less intervened with GC.
2025-03-31 20:44:46 +02:00
Daniel Kochmański
72af2d38b0 core: move the first environment initialization before symbols
Also split init_alloc in two passes like init_unixint, so we don't invoke
directly GC_enable. The first pass leaves GC explicitly disabled.
2025-03-31 20:44:46 +02:00
Daniel Kochmański
0f4e9b1e17 core: factor out process managament from thread managament
This is a preliminary step towards coroutines and for switching global env in
single-threaded builds.
2025-03-31 20:44:46 +02:00
Daniel Kochmański
f49cc7f3fd core: the first environment is statically allocated
This is to avoid circularity between the first environment (and interrupts) and
the garbage collector.
2025-03-31 20:44:46 +02:00
Daniel Kochmański
09ebfb47dd core: add wrapper for manual memory managament
We will use this operators to allocate the first environment and stacks so that
there is no circularity between ecl_boot and starting the garbage collector.
2025-03-31 20:44:46 +02:00
Daniel Kochmański
8f8ffc1772 rename the operator ecl_make_stack -> ecl_make_vector 2025-03-31 20:42:17 +02:00
Daniel Kochmański
d3ae7bd532 Merge branch 'bytevm-flat-closures' into 'develop'
Implement flat closures for bytecodes virtual machine

See merge request embeddable-common-lisp/ecl!338
2025-03-31 18:37:31 +00:00
Daniel Kochmański
63a106b4cb bytevm: add a new low-level operator ecl_make_stack
The stack is represented as an actually adjustable vector with a fill
pointer. The main difference from other vector constructors is that it does not
modify the process env -- most notably VALUES vector -- and can be safely used
in the interpreter.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
eb6a64def9 lexenv: remove unused function from the compiler 2025-03-27 22:45:34 +01:00
Daniel Kochmański
75dcfaf705 lexenv: don't bypass referencing the cl_object instance
This is a preliminary step towards consistent access between LCL and LEX envs.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
bd5e72def6 lexenv: don't use adjustable vector -- lexenv size is known 2025-03-27 22:45:34 +01:00
Daniel Kochmański
99b37c8ab5 boot: initialize macfun of ECL_T and ECL_NIL_SYMBOL to ECL_NIL
Prevoiusly this slot was left uninitialized and that lead to a segmentation
fault under certain conditions when we did (copy-symbol t t).
2025-03-27 22:45:34 +01:00
Daniel Kochmański
479400f6fb disassembler: add newly added opcodes to bytecodes disassembler 2025-03-27 22:45:34 +01:00
Daniel Kochmański
90e7a8e560 bytevm: change error names to be more descriptive
VEbad_lambda_arg_excd -> VEbad_lambda_too_many_args
VEbad_lambda_unk_keyw -> VEbad_lambda_unknown_keyword
2025-03-27 22:45:34 +01:00
Daniel Kochmański
77fe30efdd bytecmp: ensure that we close around referenced local macros
This is necessary to recompile bytecodes when they contain macro expansions.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
c9c5323578 tests: add a test for an important corner case
In case that someone wants to store the definition when compiling the file, we
need to make sure that the compiler does not error if it has unreadable objects.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
f56b2b9192 tests: add tests for local macros closing over each other 2025-03-27 22:45:34 +01:00
Daniel Kochmański
0fb64f5c91 bytecmp: [degression] insert CFB local macros in the lexenv
This is necessary if we want to recompile bytecodes either with CCMP or BCMP.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
92772b1afd bytecmp: implement flat closures
This commit replaces capturing whole LEX with an explicit vector of closed
variables. We introduce a set of additional opcodes that deal with closed
entities. Locals are referred as lcl and closed variables as lex.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
7637f84629 bytecmp: [regression] don't stick macros at the lexenv beginning
This commit causes an intentional regression in the bytecodes compiler - we
don't carry over macros and symbol macros, so we can't recompile bytecompiled
function with the native compiler if they reference them.

That will be fixed in a more organized manner after flat closures are in place.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
710ac09e1d bytecmp: refactor handling object references
- split c_tag_ref into three functions c_{tag,blk,fun}_ref, clean c_var_ref

  small differences between functions made the former harder to read
  also update comments about the compiler environment

  functions are refactored to have a similar shape and return the
  same (internal) structure that denotes the object scope and purpose

- don't push special variables as locations in the environment

  that was (an irrelevant) bug, because special variables are not in the en

- rename asm_c to asm_arg_data

  This name better resembles the purpose of the operator
2025-03-27 22:45:34 +01:00
Daniel Kochmański
4e95ee830a tests: add a failing test for minimal closures 2025-03-27 22:45:34 +01:00
Daniel Kochmański
8e44c6322f bytevm: enclose macros over local functions defined with flet/labels
This change requires a kludge that addresses an issue with creating shallow
copies of the environment.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
85c6599d8d cmp: fix a bug in SET-CLOSURE-ENV wrt self-referncing objects
When we were compiling bytecodes with LABELS, the function SET-CLOSURE-ENV
exhibited infinite recursion by adding the record as FLET. C.f test "cmp.0100".
2025-03-27 22:45:34 +01:00
Daniel Kochmański
9161bd427e tests: add a regression test for a newly spotted bug in bytecmp 2025-03-27 22:45:34 +01:00
Daniel Kochmański
1ff274bf08 bytevm: don't use ecl_fdefinition for OP_FUNCTION
The function ecl_fdefinition checks also for lamdbas and whatnot, while all we
need is a lookup in the global namespace for the function name.

This commit also changes how we store SETF function definition -- instead of
maintaining them in a global environment, it is stored along with the symbol.
That saves us from taking a global lock repeatedly.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
9c1bcd0b7b bytevm: use ecl_apply_from_stack_frame to dispatch calls 2025-03-27 22:45:34 +01:00
Daniel Kochmański
32dfca42e5 bytevm: introduce unsafe primops SI:CONS-CAR and SI:CONS-CDR 2025-03-27 22:45:34 +01:00
Daniel Kochmański
497ece5a77 bytevm: move stepping logic out to trace.lsp
We use the environment hook to install the stepper.
2025-03-27 22:45:34 +01:00
Daniel Kochmański
b1aa2e47f3 bytevm: provide function wrappers for all signaled conditions 2025-03-27 22:45:34 +01:00
Daniel Kochmański
d4c20918b9 core: register the finalizer immedietely after allocation
Previously we've registered the finalizer when a symbol was dynamically bound
for the first time; this commit changes that to remove a dependency on GC when
binding special variables.
2025-03-27 22:12:49 +01:00
Daniel Kochmański
fdbff61f51 cons: introduce macro ecl_cons_stack that allocates on the stack 2025-03-27 22:12:49 +01:00
Daniel Kochmański
0f882280c0 cosmetic: removeu nused argument 2025-03-27 09:44:37 +01:00
Daniel Kochmański
7e3dc96fa5 Merge branch 'improve-ensure-directories-exist' into 'develop'
ensure-directories-exist: minor improvements

See merge request embeddable-common-lisp/ecl!340
2025-03-17 20:23:42 +00:00
Marius Gerbershagen
270b3a4157 cmp: fix compiler-macro for make-array
Constant arguments for the dimensions were not handled correctly. The
valid-array-index function was lost in a refactor some time ago.
Moreover, we need to check all of the conditions on the
dimensions (limits on rank, dimension and total size) using an AND
statement instead of checking only the first condition using OR.
2025-03-02 19:36:06 +01:00
Marius Gerbershagen
a3d7036c36 ensure-directories-exist: minor improvements
Simply call mkdir and ignore EEXIST errors to prevent race conditions
when two processes try to create a directory at the same time. Also
avoids a redundant syscall since by not calling si::file-kind, so this
should be slightly faster.
2025-03-01 17:52:26 +01:00
Marius Gerbershagen
31bcb06d83 use separate directory for --with-extra-files to avoid name clashes
Fixes #772
2025-02-22 20:18:42 +01:00
Marius Gerbershagen
315ccd7d8d Merge branch 'improve-describe' into 'develop'
DESCRIBE prints arguments and source information for operators

Closes #711

See merge request embeddable-common-lisp/ecl!339
2025-02-15 14:55:43 +00:00
Daniel Kochmański
8d34f874d0 DESCRIBE prints arguments and source information for operators
After this commit DESCRIBE prints two additional pieces of information below the
docstring. To avoid duplication, corresponding arg piece in doc/help.lsp has
been removed. Fixes #711.
2025-01-28 09:22:08 +01:00
Marius Gerbershagen
3d6bc48e10 Merge branch 'bignum-cleanup' into 'develop'
Small cleanup of bignums

See merge request embeddable-common-lisp/ecl!337
2025-01-22 19:36:14 +00:00
Daniel Kochmański
77dc322364 bignum: factor out serialization functions for bignum 2025-01-20 12:39:59 +01:00
Daniel Kochmański
1102e58e0e bignum: replace numerous references to mpz with _ecl_big trampolines 2025-01-20 12:39:59 +01:00
Daniel Kochmański
ceae17c1bb bignum: replace references to gmp limbs with ecl macros
GMP_LIMB_BITS -> ECL_BIGNUM_LIMB_BITS
mp_limb_t -> ecl_limb_t
2025-01-20 12:39:59 +01:00
Daniel Kochmański
a826e65af0 bignum: internal interface cleanup
Remove unused wrappers and move things used only in big.d to that file.
2025-01-20 12:39:57 +01:00
Daniel Kochmański
c5f7b48a96 ecl_to_float: use the function ratio_to_float 2025-01-20 12:08:50 +01:00
Daniel Kochmański
44033ce73e si_need_to_make_load_form_p: use hash table for load form cache
For very long lists going with list search gives us O(n²).
2024-12-29 20:32:25 +01:00