Bug was introduced by the recent race condition fixes of commit
cc7c0d4386. ecl_list_process needs to be
able to allocate memory and bind special variables, which wasn't possible
previously, because the environment was not yet initialized. Since we can't
initialize the environment before calling ecl_list_process (that was the
reason for the race condition in the first place), we use the fake environment
allocated on the stack (where the gc can find its contents) until we can
safely call ecl_list_process and switch over to the real environment.
Fixes#564.
This reverts commit bd9c590810.
Apparently, _fpreset is not just equivalent to feclearexcept and really
needed when doing a longjmp out of a signal handler. On top of that, with
MSVC 2019, I now observe segmentation faults without _fpreset, but not with
_fpreset in si_trap_fpe!
This lead to problems in code that defined validate-superclass methods
for custom metaclasses. Such methods are not installed at compile
time, giving errors when we called validate-superclass from
ensure-class during compilation.
The C standard allows compilers to ignore side effects of floating
point operations unless the STDC FENV_ACCESS pragma is in effect. This
could lead to spurious floating point exceptions being signaled
because the C compiler optimized a calculation that would ordinarily
not set fpe bits to one that did (observed with clang for a cast
double to cl_fixnum).
To solve this, we resurrect the ECL_MATHERR macro which was removed in
commit cb03494a6d. We handle fpe bits
only around calculations which are known to be "unsafe" in the sense
that they can produce floating point exceptions. Before the
calculation, all bits are unset and afterwards, we test for
exceptions.
The disadvantage of this method is that optimizations by the C
compiler resulting in unboxed float arithmetic might lead to
missing exceptions, because our native C compiler does not insert
ECL_MATHERR statements around these calculations.
Due to the fact that the thread local environment is allocated with
mmap, the garbage collector is only aware of it after the thread is
listed in cl_core.processes. Therefore, we have to list the thread
before we allocate any memory in its environment. We were doing this
previously, however a bit earlier than needed which had the
unfortunate side effect that not all threads listed in
cl_core.processes had valid environment associated to them. Now, we
delay the listing until immediately before allocating the contents of
environment, ensuring that all listed threads have valid environments.
I think that the old method is a relic from the past when bytecodes
had a different representation. bytecompiled functions also have
proper annotations so there is no need to attempt to disassemble their
lambda lists manually. Closes#561.
Consistent formatting and capitalization, clickable links to functions
defined in other parts of the manual, better looking css for html
output. Some small errors and typos have been corrected as well.
According to the documentation, we were supposed to return nil, but
instead we signaled a bogus error like
:INPUT argument to RUN-PROGRAM does not have a file handle:
#<output stream "/dev/null" 0x5645a22a5280>
Some of the compiler macros expand into FFI:C-INLINE forms, precluding
the compilation of statements like
(eval-when (:compile-toplevel :load-toplevel :execute)
(print "test")).
Commit b00e62f9d3 (now reverted)
attempted to fix this previously, but introduced other bugs (see #553).
Instead of the naive solution of evaluating everything
in (eval-when (:compile-toplevel)) directly with the bytecodes
compiler, the approach used in this commit is to be more specific and
ignore compiler macros during compile time evaluation (i.e. the output
of the compiler macro is used only in the emitted C code, but not as
input for CMP-EVAL).
Fixes#553.
After the recent refactor of GET-HOST-BY-NAME to use getaddrinfo,
these functions had multiple problems that are fixed in this commit:
- in GET-HOST-BY-NAME, freeaddrinfo was called on an unitialized
struct addrinfo if getaddrinfo failed
- error handling in GET-HOST-BY-NAME wasn't working, we were still
trying to use the error handling for gethostbyname
- GET-HOST-BY-ADDRESS still used the deprecated gethostbyaddr function
The test was failing because it was detecting an output of
"
Hello stdoutHello stderr"
instead of the expected
"
Hello stdout
Hello stderr"
The reason for this is that the buffers of the
streams *standard-output* and *error-output* may be distinct, even if
the ouput send to both streams ends up in the same place. Thus, we
need to explicitely force-output in print-test. The error manifested
itself only in builds without thread support, because otherwise ECL
uses write instead of fwrite, avoiding any buffering.
Make sure that apart from turning on/off signaling for exceptions, we
also clear all exception bits. After the recent changes to how ECL
handles floating point exceptions, not doing that could lead to
spurious exceptions being signaled even when using the
ECL_WITH_LISP_FPE macro because an earlier calculation yielded
infinity/NaN.