Commit graph

7975 commits

Author SHA1 Message Date
Marius Gerbershagen
a8042286ff queue_signal: prevent circular lists in pending_interrupt
Leads to infinite loops in handle_all_queued.
2020-06-01 17:26:14 +02:00
Marius Gerbershagen
ed11e2cc35 fix spinlock handling in queue_signal and pop_signal
We can't use the ECL_WITH_SPINLOCK_BEGIN/END macros since they check
for pending interrupts at the end of their unwind-protect frame. This
leads to various bugs:

- in queue_signal the to be queued interrupt is executed immediately
  after being queued even if interrupts are disabled
- in pop_signal if multiple interrupts are queued they are executed in
  reverse order

To fix these issues, use a) ecl_get/giveup_spinlock directly and b)
ecl_disable/enable_interrupts_env to prevent the spinlock not being
released due to an interrupt happening during the execution of the
main body of pop_signal/queue_signal.
2020-06-01 17:18:35 +02:00
Marius Gerbershagen
e89dce9631 cmp: fix multiple-value-setq for special variables
We need to save env->nvalues before calling cl_set on any variable
because cl_set overwrites env->nvalues. Otherwise, we only get nil for
any variable after the first special one.

Fixes #591.
2020-05-28 21:23:54 +02:00
Daniel Kochmański
2e337edcf9 Merge branch 'develop' into 'develop'
fix issue #593

Closes #593

See merge request embeddable-common-lisp/ecl!210
2020-05-25 19:19:10 +00:00
Dima Pasechnik
4bce0a0e3c fix issue #593
make check for makeinfo conditional on successful
check for install-info
2020-05-25 11:14:42 +01:00
Daniel Kochmański
d7f4637ef5 Merge branch 'precompiled-headers' into 'develop'
cmp: add support for precompiled header files

See merge request embeddable-common-lisp/ecl!203
2020-05-16 19:41:09 +00:00
Marius Gerbershagen
0d65a6ff5f Merge branch 'fix-586' into 'develop'
slot-definitions-compatible-p: check for the slot class too

Closes #586

See merge request embeddable-common-lisp/ecl!207
2020-05-16 18:17:34 +00:00
Daniel Kochmański
4da8ca54b6 slot-definitions-compatible-p: check for the slot class too
The spec says:

    The generic function make-instances-obsolete is invoked
    automatically by the system when defclass has been used to
    redefine an existing standard class and the set of local slots
    accessible in an instance is changed or the order of slots in
    storage is changed. It can also be explicitly invoked by the user.

If the local slot's class is changed then indeed the set has
changed. We also check whether the slot class is S-D-S-D or S-E-S-D
and in both cases we also decide that layouts are not compatible.

Fixes #586.
2020-05-16 19:55:19 +02:00
Marius Gerbershagen
636cb4cf60 cmp: add support for precompiled header files
Improves compilation speed for single functions by about 40-50
percent. Precompiled headers are specific to the compiler version and
options in use. Due to this, we regenerate the header whenever the
compiler configuration changes.
2020-05-16 18:53:57 +02:00
Daniel Kochmański
46e158e912 Merge branch 'gc-fixes' into 'develop'
Garbage collector fixes

See merge request embeddable-common-lisp/ecl!208
2020-05-12 10:14:36 +00:00
Marius Gerbershagen
ecb71b194a predicate.d: fix equalp for hash tables
According to the spec, we should compare values using equalp if two
matching keys are found, but we were only checking if matching keys
exist.
Fixes #587.
2020-05-10 22:18:44 +02:00
Marius Gerbershagen
e0bf0f5ac2 gc: remove unnecessary workarounds for old bdwgc versions 2020-05-10 19:47:05 +02:00
Marius Gerbershagen
d85326d2a5 tests: add stress tests for interrupt safety 2020-05-08 21:10:41 +02:00
Marius Gerbershagen
6825e1afe0 tests: improvements to stress tests
Use the cl-test package (same as for ordinary tests), declare suite
inside the file and remove infinite loops from tests.
2020-05-08 21:10:41 +02:00
Marius Gerbershagen
42fdbba968 process.d: get start_stop_spinlock in thread_cleanup instead of thread_entry_point
Getting this lock in thread_entry_point was problematic: when the
thread was killed from another thread the catch point in
thread_entry_point was reached and the call to ecl_get_spinlock was
skipped. This lead to threads exiting without protection and to
segfaults.
2020-05-08 21:10:41 +02:00
Marius Gerbershagen
8d2b8d0ce1 unixint.d: unblock SIGSEGV before undoing wirte protection on envinronment
Doing it the other way around leads to race conditions, since an
unlucky interrupt arriving just after the mprotect call (but before
the the_env->disable_interrupts = 0 write) will write protect the
environment again, leading to a segfault. This is no problem if
SIGSEGV is unblocked (in which case we will just enter sigsegv_handler
again and arrive at the same point). However if SIGSEGV is blocked (and
another segfault arises) the whole process will die.
2020-05-08 21:10:41 +02:00
Marius Gerbershagen
d8fbbb213e gc: fix type info for precise garbage collector mode 2020-05-08 21:10:41 +02:00
Marius Gerbershagen
73af5cdcdd gc: fix signal handlers for generational garbage collector
The boehm gc needs SIGSEGV or SIGBUS to track dirty pages (see
GC_write_fault_handler). Thus these signals need to be unblocked at
all times.
2020-05-08 20:57:56 +02:00
Daniel Kochmański
f7f0edebd6 tests: add a regression test for the reverse of 58f17f6c6 2020-05-08 13:50:58 +02:00
Daniel Kochmański
a2a12e2531 Revert "cmp: fix inlining of local closures"
This reverts commit 58f17f6c66.
2020-05-08 13:10:13 +02:00
Daniel Kochmański
cbe5326b0f Merge branch 'feature-one-loop-fix' into 'develop'
Fix declaration for complex for variable

Closes #585

See merge request embeddable-common-lisp/ecl!206
2020-05-07 10:07:49 +00:00
Karsten Poeck
5bfe616bd0 Fix declariotion for complex for variable 2020-05-06 21:46:56 +02:00
Marius Gerbershagen
e72ef09e78 printer: fix printing of symbols with non-ascii names
Bug was introduced in commit c6b4296bb8
in converting buffer_write_char from a macro to an inline
function. Problem reported by Vladimir Sedach on the ecl-devel mailing
list.
2020-05-06 21:04:28 +02:00
Marius Gerbershagen
de2269c9e7 tests: add regression test for errors in printing non-ascii symbol names
Changes submitted by Vladimir Sedach to the ecl-devel mailing list.
2020-05-06 21:04:28 +02:00
Marius Gerbershagen
ca01514a47 unicode: fix ecl_string_case for non-ascii characters
Problem reported and fix provided by Vladimir Sedach on the ecl-devel
mailing list.
2020-05-06 21:04:28 +02:00
Marius Gerbershagen
4cac9bc5e0 tests: add tests for unicode case conversion issues
Changes submitted by Vladimir Sedach to the ecl-devel mailing list.
2020-05-06 21:04:28 +02:00
Daniel Kochmański
04aa7c539e Merge branch 'inline-closure' into 'develop'
Fix #577

Closes #577

See merge request embeddable-common-lisp/ecl!204
2020-05-05 18:51:03 +00:00
Marius Gerbershagen
58f17f6c66 cmp: fix inlining of local closures
We have to compile the function expression in the environment in which
it was defined. Fixes #577.
2020-05-01 20:47:47 +02:00
Marius Gerbershagen
fc5a9ad58c tests: add regression test for issue #577 2020-05-01 20:47:47 +02:00
Marius Gerbershagen
c6b4296bb8 cosmetic: fix some compiler warnings 2020-04-29 20:35:37 +02:00
Marius Gerbershagen
bae7d696a9 numbers: remove unnecessary workarounds for single-float numeric functions
Fixes test failures from cmp.0044.inline-cos.
2020-04-25 18:01:00 +02:00
Daniel Kochmański
f152a3000d Merge branch 'fix-576' into develop 2020-04-24 11:50:13 +02:00
Moritz Petersen
d5eafde045 Add a regression test for the bug described in #576
Merge a test for with-output-to-string with the one for
with-input-input-from-string to ensure both close their streams.

Remove check for stream-var being a stream outside of w-i-f-s &
w-o-t-s. According to the specification, the streams' extent ends with the
respective providing form. If the stream was indeed not acccessible anymore, the
test would not pass. In that case open-stream-p should signal a type-error,
causing the test to crash. However in ECL we can assume that the stream is still
intact.
2020-04-24 11:42:46 +02:00
Moritz Petersen
660b1bec69 Always close stream in with-output-to-string & cosmetic changes
Fix #576, Related to !197, 72560efa5a

with-output-to-string is required to close the output stream that it provides
for the extent of the body forms [1]. The current definition does not do that.

This change wraps the body forms in unwind-protect clauses to ensure the stream
is always closed on exit. Because declarations cannot appear at the beginning of
progn forms, any potential declarations are extracted from the body forms and
moved to the beginning of the surrounding let form's body.

element-type is no longer bound to a gensym, but evaluated inside the let body.

The uppercased names are downcased for a more coherent appearance.

[1]: http://www.lispworks.com/documentation/HyperSpec/Body/m_w_out_.htm
2020-04-24 11:42:23 +02:00
Daniel Kochmański
496eb06675 Merge branch 'rc' into 'develop'
20.4.24 release

See merge request embeddable-common-lisp/ecl!200
2020-04-23 10:12:37 +00:00
Daniel Kochmański
eea597de34 20.4.24 release
Announcement proposal. When this is merged to the develop branch, then
we should make a PR against master and merge. Then we shall publish
tarballs and the announcement on the website.
2020-04-21 11:24:02 +02:00
Marius Gerbershagen
29c415b19d Merge branch 'fix-573' into 'develop'
Fix 573

See merge request embeddable-common-lisp/ecl!198
2020-04-19 15:42:51 +00: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
97f174c0a5 clos: specializer class: avoid a metastability issue
1. We've implemented SPECIALIZER-DIRECT-METHODS and
SPECIALIZER-DIRECT-GENERIC-FUNCTIONS as accessors to slots in the
specializer DIRECT-METHODS and DIRECT-GENERIC-FUNCTIONS.

2. As specified in MOP these collections are maintained by
ADD-DIRECT-METHOD and REMOVE-DIRECT-METHOD functions.

3. When we finalize standard-method, we remove old methods and among
them is a method for a function METHOD-GENERIC-FUNCTION, and that
function must be called from REMOVE-DIRECT-METHOD when we want to
update SPECIALIZER-DIRECT-GENERIC-FUNCTIONS, so we end up in a
debugger that there is no specialization for this function.

We adapt approach similar to one taken in SBCL (did they encounter a
similar issue?): specializer class has a SPECIALIZER-METHOD-HOLDER
accessor which stores a CONS cell. We add/remove methods to CAR and
take generic functions from CDR. The trick is that CDR is lazily
computed when SPECIALIZER-DIRECT-GENERIC-FUNCTIONS is called and
invalidated when we add and remove method.
2020-04-19 14:34:23 +02:00
Daniel Kochmański
22f9d51560 clos: finalize-inheritance: don't refinalize structure-class 2020-04-19 14:34:23 +02:00
Daniel Kochmański
5c02111bfc clos: finalize-inheritance: don't always change the class-slots identity
Specification of M-I-O explicitly says that instances are not made
when "local slots" are compatible. This change is necessary to prevent
infinite recursion as reported in #568 without breaking the
finalization protocol, because currently class-slots are used as a
signature for its instances (and that's how being obsolete is
determined).
2020-04-19 14:34:23 +02:00
Daniel Kochmański
bee9e8db55 clos: finalize-inheritance: revert a non-conforming change
finalize-inheritance is expected to run regardless of the fact that
class has been already finalized. I suppose that it is in case when
compute-slot-* methods are specialized to return something else.
2020-04-19 14:34:23 +02:00
Daniel Kochmański
5feb42dfa3 clos: reinitialize-instance: don't remove generic functions
Local function REMOVE-OPTIONAL-SLOT-ACCESSORS removed generic
functions after removing methods while redefining the class if said
generic functions have no other methods. There is nothing in the spec
what would justify it, so we don't fmakunbound these functions
anymore.
2020-04-19 14:34:23 +02:00
Daniel Kochmański
681caade84 clos: allocate-instance: add a comment in allocate-instance
As pointed out by Dr. Robert Strandth initargs argument may be passed
to allocate-instance only after the class has been already finalized,
and indeed we finalize it in make-instance. To be on a safe side,
unlike CLASP, we still check whether the class is already finalized in
case of someone calling allocate-instance outside the make-instance
method.
2020-04-19 14:34:23 +02:00
Daniel Kochmański
3ec02d6daf clos: finalize-unless-forward: check for the class itself first
That was probably a typo, because finalize-unless-forward checked only
the class parents if they were forward-referenced classes, not the
class itself.
2020-04-19 14:34:23 +02:00
Daniel Kochmański
d45f079c3c clos: cleanup: remove unused file, use when-let
File macros.lsp was used for bootstrapping in the past, but it is not
loaded anymore.
2020-04-19 14:34:23 +02:00
Daniel Kochmański
735d49bfd1 tests: improve some tests
- extend tests for make-instances-obsolete
- add a metastability test for the standard-method finalization
- fix tests which assume that metaclasses are finalized eagerly
2020-04-19 14:34:23 +02:00
Daniel Kochmański
34cd3dc221 Merge branch 'getaddrinfo-fixes' into 'develop'
Minor fixes for get-host-by-name from sockets

See merge request embeddable-common-lisp/ecl!199
2020-04-19 12:33:48 +00:00