Daniel Kochmański
fd0f5db4d5
[wip] msvc: update a makefile and specify /std:c11 minimal standard
...
MSVC does not allow for specifying /std:c99 so we need c11. We don't rely on the
default standard because it does not allow for static struct initializers.
2026-03-08 20:03:25 +01:00
Daniel Kochmański
2e1d336581
[bytevm][wip] new opcode CALLW, don't use lcl frame when no locals
...
CALLW calls a word from the data stack. The word differs from normal functions
in that it takes no arguments (so the call does not modify the data stack).
To allow words using the stack across calls (like in "real" forth) don't unwind
the stack on exit if there are no locals.
2026-03-08 20:03:25 +01:00
Daniel Kochmański
aa6600cea3
[bytevm][wip] bytevm: allocate stack manually
...
wip tag because:
- we don't free tha stack (we use alloc_memory)
2026-03-08 20:03:25 +01:00
Daniel Kochmański
9411f7a1ae
[wip] memory: ensure disabled interrupts in top-level operators
...
ecl_alloc_object, ecl_free_object
ecl_alloc, ecl_alloc_manual, ecl_alloc_atomic, ecl_dealloc
Moreover move all top-level ops to memory.d so they are not reliant on mem_gc.
The stubbed allocator uses manual memory managament for all ops.
[wip] because we should adjust ecl_make_stack too
2026-03-08 20:03:25 +01:00
Daniel Kochmański
30e57a8eab
memory: reify the type_info database
...
We store information about the object size, its pointers and name. This
information is later reused by the garbage collector.
2026-03-08 20:03:25 +01:00
Daniel Kochmański
bb278092e0
memory: move ecl_alloc_adjustable_*_string to memory.d
...
These constructors are used to provide buffers that may be returned to cl_core.
2026-03-08 20:02:27 +01:00
Daniel Kochmański
2bcb475df4
memory: move ecl_cons to memory.d
...
ecl_cons requires a separate allocator because it may be a small cons.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
a435f69b1f
memory: make it possible to configure the allocator
2026-03-08 20:01:34 +01:00
Daniel Kochmański
ac423108d7
nucleus: introduce a table with early symbols ecl_symbols
...
This table contains symbols that are essential to the core runtime: ECL_T,
ECL_UNBOUND, ECL_SIGNAL_HANDLERS, ECL_RESTART_CLUSTERs, ECL_INTERRUPTS_ENABLED,
ECL_ALLOW_OTHER_KEYS and ECL_UNBOUND.
The table is initialized with constexpr, so it is possible to use its elements
in static elements. We also add ecl_def_function to ecl-inl to allow
appropriating C functions into Lisp world at top level.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
f203d2db64
nucleus: move early stacks to a separate file
...
This is necessary if we want to link them into nucleus without CL env baggage.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
21fb42edd9
nucleus: move aux throw/go/tagbody implementations to jump.d
2026-03-08 20:01:34 +01:00
Daniel Kochmański
6be00c50c5
garbage: allow for building ecl without bdwgc and with nogc
...
In that case we use a dummy object nogc.o that contains stubs for GC-related
functions. It also defines a substitute module.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
0c8e6b38b9
modules: uninstall signal handlers when unixint is destroyed
2026-03-08 20:01:34 +01:00
Daniel Kochmański
7894622840
modules: deallocate stacks when modules are destroyed
2026-03-08 20:01:34 +01:00
Daniel Kochmański
f1ffa821ce
modules: release all resources on ecl_halt
...
Previously we were lazy and simply marked the runtime as "not booted", but now
we do perform a proper shutdown.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
0aa2707d5f
process: move process initialization to the process module hooks
2026-03-08 20:01:34 +01:00
Daniel Kochmański
3042e5657d
garbage: register and unregister GC threads manually from a module
...
This decouples thread primitives from the garbage collector and allows us to
build nucl once more.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
e2681805f3
process: abstract away create thread, exit thread and sigmask
...
Previously we've opencoded calls to these functions, although they may be nicely
abstracted with static inline functions. This change improves code readibility
and portability.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
54602cc23a
modules: [A/n] move the environment allocators to nucleus
...
Also clean up initialization code across different paths to have the same order.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
2bf1449052
modules: [9/n] introduce ecl_module_thread
2026-03-08 20:01:34 +01:00
Daniel Kochmański
f6e62a050b
modules: [7/n] introduce ecl_module_stacks
2026-03-08 20:01:34 +01:00
Daniel Kochmański
e1c5b915c6
modules: [6/n] introduce ecl_module_aux
2026-03-08 20:01:34 +01:00
Daniel Kochmański
aed13ee7e9
modules: [5/n] introduce ecl_module_ffi
2026-03-08 20:01:34 +01:00
Daniel Kochmański
4efc018094
modules: [4/n] introduce ecl_module_bignum
2026-03-08 20:01:34 +01:00
Daniel Kochmański
726b84a8be
modules: [3/n] introduce ecl_module_process
2026-03-08 20:01:34 +01:00
Daniel Kochmański
001422e3b9
modules: [2/n] introduce ecl_module_unixint
2026-03-08 20:01:34 +01:00
Daniel Kochmański
6116a83fbb
modules: [1/n] introduce ecl_module_gc
...
We also remove conditionalization for garbage collector inclusion in autotools.
When we propose an alternative gc, then we may decide to put them back, or to
add necessary ifdef statements directly in files.
Moreover untangle c-stack from the gc code and assign the stack base with a
rough guess only when it is not initialized yet (GC will always fill it).
Finally remove a kludge from ecl_adopt_cpu and disable colleciton until the cpu
is fully initialized.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
6f21e51667
modules: [0/n] introduce a new structure ecl_module in the system
...
This will allow us to decouple forward system initialization from the early
process code.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
01287175b2
process: move ecl_clear_bignum_registers to _dealloc_env
...
This resolves a fixme.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
0846b149df
process: use GC_thread_is_registered() instead of the_env->cleanup
...
This allows us to remove unnecessary bookkeeping.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
0451796b51
nucleus: [2/n] move processing unit managament to nucleus
2026-03-08 20:01:34 +01:00
Daniel Kochmański
24c6ba6456
nucleus: [1/n] move processing unit managament to nucleus
2026-03-08 20:01:34 +01:00
Daniel Kochmański
6a35457248
exceptions: make reader.d usable in the early env
2026-03-08 20:01:34 +01:00
Daniel Kochmański
ad50724d47
exceptions: make stream.d usable in the early env
...
This is a step towards introducing the I/O system.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
f057e1b5af
exceptions: make character.d usable in early runtime
2026-03-08 20:01:34 +01:00
Daniel Kochmański
eff8a495de
exceptions: make cfun_dispatch use exception trampolines
2026-03-08 20:01:34 +01:00
Daniel Kochmański
96de2e24ad
exceptions: dispatch signals exceptions (not conditions)
2026-03-08 20:01:34 +01:00
Daniel Kochmański
827fbfc268
exceptions: runtime stack error signals exceptions (not conditions)
...
Replace calls to CEstack_overflow with exceptions - this is a necessary step
before moving stacks into nucleus.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
4b389b5341
exceptions: interpreter signals exceptions (not conditions)
2026-03-08 20:01:34 +01:00
Daniel Kochmański
a71eebeb0e
exceptions: introduce the concept of an exception
...
Exceptions, unlike conditions, are stack allocated and can't be captured.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
add69a9b1a
signals: define *SIGNAL-HANDLERS* in cold_boot
...
I've also renamed *HANDLER-CLUSTERS* to a more appropriate *SIGNAL-HANDLERS*.
Currently this symbol is imported to the SYSTEM package, although this may be
revised in the future to cater to multiple global environments. Alternatively
the SYSTEM package may be common to all runtimes.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
dd8f985dd8
signals: handler-bind handles only objects of type CONDITION
2026-03-08 20:01:34 +01:00
Daniel Kochmański
9348ddf462
signals: introduce signals to the early environment
2026-03-08 20:01:34 +01:00
Daniel Kochmański
8a411415b7
signals: rewrite signal handling to use functions and not lists
...
Instead of storing lists in *HANDLER-CLUSTERS*, we define functions that are
called unconditionally on the handler. HANDLER-BIND defines that function to be
a typecase that is dispatched based on the conditiont type, as specified by CL.
This change will aid further refactor.
2026-03-08 20:01:34 +01:00
Daniel Kochmański
e8eefd5963
boot: move ecl_eql to a separate file eql.d
...
This is a low-level comparison operator. We opencode EQL comparison for bignums
to avoid a dependency on GMP (in this file).
2026-03-08 20:01:34 +01:00
Daniel Kochmański
4ab7fb50a7
boot: move ecl_core_struct to boot.d
2026-03-08 20:01:34 +01:00
Daniel Kochmański
1cf9b006d2
boot: move protect and dummy tags to boot.d
2026-03-08 20:01:33 +01:00
Daniel Kochmański
1dbf4664d6
boot: move early constants from main.d to boot.d
2026-03-08 20:01:33 +01:00
Daniel Kochmański
39fd5a954a
boot: add a file boot.d for booting the core
...
Currently it contains only option setters.
2026-03-08 20:01:33 +01:00
Daniel Kochmański
dc0f2bd2c7
boot: add a file escape.d for program control transfer
...
Currently it contains early errors and backtrace.
2026-03-08 20:01:33 +01:00