Commit graph

19 commits

Author SHA1 Message Date
Daniel Kochmański
7a4589ff7f lwp: add new types CONTINUATION and THREAD 2026-03-15 09:47:50 +01:00
Daniel Kochmański
67418ed1c7 exceptions: introduce the concept of an exception
Exceptions, unlike conditions, are stack allocated and can't be captured.
2026-03-15 09:47:50 +01:00
Daniel Kochmański
12f1458a32 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.
2026-03-15 09:47:50 +01:00
Daniel Kochmański
df66f26cb6 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-15 09:46:31 +01:00
Daniel Kochmański
9f54582bda reader: add a new object to the system ecl_token
It represents unparsed token constructed by the reader.
2026-03-13 19:23:05 +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
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
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
Daniel Kochmański
82e01c0b7d cosmetic: replace @'t' with ECL_T in core 2024-12-11 12:38:30 +01:00
Daniel Kochmański
cc27aadf5f clos: ensure correct class stamps
- we did not distinguish between classes that had no slots and classes that
  had no been iniutialized - that led to incorrect class stamps

- structures had no initial class stamp matching their structure

- structures when slot names chagned had their stamp increased despite not
  really changing
2022-02-04 21:31:53 +01:00
Daniel Kochmański
b9d54d6be7 internals: rename instance.sig to instance.slotds
Slot definitions are no longer a signature, but they are still needed
to update obsolete instances. Reader function name is also changed to
SI:INSTANCE-SLOTDS. SI:INSTANCE-SIG-SET name does not change, because
it sets both SLOTDS and the STAMP.
2020-04-19 17:04:42 +02:00
Daniel Kochmański
f1bc883ed6 clos: introduce class stamps for marking instances obsolete
We should call make-instances-obsolete from finalize-inheritance if we
want to be conforming, because user may have added their own auxiliary
methods.

This change while being last in a serie of commits was locally the
first change which solved problems. It will enable us to implement the
fast generic dispatch after the release.
2020-04-19 17:04:41 +02:00
Daniel Kochmański
81a85f37bd clos: introduce a new system function si:instance-obsolete-p
It helps to determine whether the instance needs to be updated for a
class after redefinition. Currently it is done by comparing the
signature with the instance's class slots.
2020-04-19 14:34:23 +02:00
Daniel Kochmański
ea87100a06 long-float: remove conditionalization
Many parts of the source code were bent backward to support builds
without long floats which are always present given we depend expect
c99 compiler.

The corresponding C macros (ECL_LONG_FLOAT) and the *feature*
entry (:long-float) are marked as deprecated in the documentation.
2019-05-24 21:04:59 +00:00
Daniel Kochmański
e1adfd2794 numeric tower: merge <complex float> with <complex>
cl_type_of: give better results for (type-of <complex>)

Instead of simply returning complex we return:

  (complex real)

when code is built without complex float support, and otherwise

  (complex rational)
  (complex single-float)
  (complex double-float)
  (complex long-float)

New functions:
- ecl_to_csfloat
- ecl_to_cdfloat
- ecl_to_clfloat
2019-05-15 16:35:16 +02:00
Daniel Kochmański
a0a92dc2af complex float: add a new types and builtin classes
What has changed:

- new types si:complex-float, si:complex-single-float,
  si:complex-double-float and si:complex-long-float
- new builtin classes long-float (for completness) and
  si:complex-float
- new internal function si:complex-float and si:complex-float-p for
  constructing complex floats (both arguments must be of the same
  float type) and a type predicate
- printer for new types (right now it conses, see below)
- a new feature :complex-float
- a new type is recognized as a type disjoint of complex and real

- cleanup: +built-in-type-list+: remove some redundancy
  For instance instread of saying
    (real (or integer single-float double-float ratio))
  We say
    (real (or integer float ratio))
  etc.

Flaws which will be fixed in upcoming commits:

- complex-float hierarchy is independent of the complex hierarchy
- ecl_make_complex_float could be replaced by _ecl_make_complex_*float
- write_complex_float allocates new objects for printing
- write_complex_float does print unreadable object
- math dispatchers doesn't recognize the object

Testing things out:

> (si:complex-float 0.0d0 0.0d0)
; #<CF(0.0d0 0.0d0)>
> (si:complex-float 0.0d0 0.0s0)       ; signals type error
> (+ (si:complex-float 0.0d0 0.0d0) 1) ; signals type error

lisp runtime: make si_complex-float a subtype of a number.
2019-05-13 19:48:54 +02:00
Marius Gerbershagen
46d74c5a66 cosmetic changes in assignment.d and clos/instance.d 2018-10-15 19:55:39 +02:00
Marius Gerbershagen
239a2aa4f1 threading: add support for atomic operations
We support both compare-and-swap and fetch-and-add (via
    atomic-incf/decf) on the most common places and define an
    extension interface for compare-and-swap similiar to the one in
    SBCL.

    These changes introduce new dependencies on the libatomic_ops
    macros AO_fetch_compare_and_swap and AO_fetch_and_add.
2018-10-15 19:55:39 +02:00
Daniel Kochmański
915b40ce03 cleanup: move C/CXX part of CLOS to src/c/clos/ directory
instance.d and gfun.d were in the top C source directory.
2017-05-06 18:27:34 +02:00
Renamed from src/c/instance.d (Browse further)