Commit graph

7871 commits

Author SHA1 Message Date
Marius Gerbershagen
350c493cb4 configure: only disable fpe but not ieee-fp for mingw
Due to recent changes, it is possible to have infinity and NaN, but
without floating point exceptions.
2020-03-01 18:49:49 +01:00
Marius Gerbershagen
c704f34ce2 Merge branch 'develop' into 'develop'
restore 21bit unicode on windows msvc build

See merge request embeddable-common-lisp/ecl!188
2020-03-01 17:44:57 +00:00
Yuguo Zhang
b59bbd6164 restore 21bit unicode on windows msvc build
ecl_character is a signed type actually,
16bit signed short is not big enough to hold big charsets, such as
CP936.

this commit rolls back 74b67347.
2020-02-26 11:36:34 +08:00
Marius Gerbershagen
4faac4dcb8 doc: replace legacy names by their new counterparts 2020-02-22 19:12:43 +01:00
Marius Gerbershagen
f18cbde8e7 queue.d: don't call _ecl_big_register_free for a normalized bignum
Fixes segmentation faults on windows when using semaphores.
2020-02-21 22:39:36 +01:00
Daniel Kochmański
db3079f8a0 Merge branch 'fpe-without-sigfpe2' into 'develop'
ieee_fp: move fetestexcept checks directly after floating point calculations

See merge request embeddable-common-lisp/ecl!186
2020-02-17 21:44:35 +00:00
Daniel Kochmański
f0d8f8dcf7 Merge branch 'fix-560' into 'develop'
Fix #560

Closes #560

See merge request embeddable-common-lisp/ecl!185
2020-02-17 21:32:06 +00:00
Marius Gerbershagen
3afa3e1a42 ieee_fp: move fetestexcept checks directly after floating point calculations
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.
2020-02-16 22:32:37 +01:00
Marius Gerbershagen
711d17e373 si_clear_gfun_hash: only enqueue operations for threads with valid environments
Fixes #560.
2020-02-14 22:40:56 +01:00
Marius Gerbershagen
cc7c0d4386 multithreading: fix race condition on thread creation
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.
2020-02-14 22:31:46 +01:00
Marius Gerbershagen
6d33095ddd Merge branch 'fix-561' into 'develop'
function-lambda-list: bytecmp: always use the annotation

Closes #561

See merge request embeddable-common-lisp/ecl!184
2020-02-12 19:01:35 +00:00
Daniel Kochmański
471f3f8312 function-lambda-list: bytecmp: always use the annotation
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.
2020-02-11 17:06:51 +01:00
Daniel Kochmański
5d5fcc40d2 Merge branch 'develop' into 'develop'
cmpmain: fix link(msvc) arguments in linker-ar

See merge request embeddable-common-lisp/ecl!183
2020-02-10 09:25:55 +00:00
Daniel Kochmański
f9df17af63 Merge branch 'doc-cosmetic-improvements' into 'develop'
doc: cosmetic improvements

See merge request embeddable-common-lisp/ecl!182
2020-02-10 09:25:07 +00:00
Yuguo Zhang
2532262c0a cmpmain: fix link(msvc) arguments bug in linker-ar 2020-02-10 13:17:18 +08:00
Marius Gerbershagen
c530793d2b doc: cosmetic improvements
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.
2020-02-07 21:43:11 +01:00
Marius Gerbershagen
b85d628955 run-program: fix handling of nil argument to :if-output-exists, :if-input-does-not-exist
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>
2020-02-07 21:38:30 +01:00
Daniel Kochmański
f67d9a5b91 Merge branch 'sockets-address-info-fix' into 'develop'
sockets: fix GET-HOST-BY-NAME and GET-HOST-BY-ADDRESS

See merge request embeddable-common-lisp/ecl!180
2020-02-04 18:37:01 +00:00
Daniel Kochmański
8cad05627f Merge branch 'fix-553' into 'develop'
Fix #553

Closes #553

See merge request embeddable-common-lisp/ecl!181
2020-02-04 18:35:49 +00:00
Marius Gerbershagen
f1a92c422a cmp: Ignore compiler macros in (eval-when (:compile-toplevel))
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.
2020-02-02 17:38:27 +01:00
Marius Gerbershagen
41fef66e1e Revert "cmp: remove unused variables: *compile-time-too*, *not-compile-time*"
This reverts commit 241f3ed172.
2020-02-02 16:01:38 +01:00
Marius Gerbershagen
2e4a23f7c9 Revert "cmp: Allow for compile time evaluation of inlined forms"
This reverts commit b00e62f9d3.
2020-02-02 16:01:24 +01:00
Marius Gerbershagen
56a75fec47 doc: document ext:with-backend
There's no perfect place to put this, I think it belongs next to
the documentation for the closely related ffi:defla.
2020-01-27 21:20:51 +01:00
Marius Gerbershagen
10c4f6e6d6 ffi: fix bogus error when using load-foreign-library with bytecmp
As it modifies the linker flags, the do-load-foreign-library function
only works with the C compiler.
2020-01-27 20:58:21 +01:00
Marius Gerbershagen
c8003c2fc4 cmp: quote arguments when invoking C compiler
Now we can compile files with spaces in their paths on windows.
2020-01-26 21:33:45 +01:00
Marius Gerbershagen
12cac13786 sockets: fix GET-HOST-BY-NAME and GET-HOST-BY-ADDRESS
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
2020-01-25 17:43:30 +01:00
Daniel Kochmański
eadefe86ed Merge branch 'module-init-functions' into 'develop'
Reintroduce init_lib_CMP, init_lib_SOCKETS, ...

See merge request embeddable-common-lisp/ecl!179
2020-01-22 22:09:11 +00:00
Marius Gerbershagen
14951e4c0b reintroduce init functions for modules
Reintroduce the entry points like init_lib_CMP, init_lib_SOCKETS, ...
we had in ECL 16.1.3 for our builtin modules linked as static
libraries.
2020-01-22 19:06:38 +01:00
Marius Gerbershagen
3267bf7f62 tests: fix output-streams test from the run-program testsuite
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.
2020-01-19 20:06:55 +01:00
Marius Gerbershagen
a97a881b90 bignums: fix wrong usage of bignum registers
Add comment explaining how bignum registers should be used.
2020-01-17 18:03:26 +01:00
Marius Gerbershagen
fdbfb8b81b Merge branch 'fix-550' into 'develop'
Fix 550

Closes #550

See merge request embeddable-common-lisp/ecl!178
2020-01-13 18:55:52 +00:00
Marius Gerbershagen
07c5c6b3c1 ecl_process_env_unsafe: don't mark as __attribute__((const))
This can cause the C compiler to optimize away multiple calls to this
function, which makes the ECL_WITH_LISP_FPE macro fail.
2020-01-12 18:53:50 +01:00
Marius Gerbershagen
793e2e9375 tests: add test for ECL_WITH_LISP_FPE macro 2020-01-12 18:53:48 +01:00
Marius Gerbershagen
865b9e7636 fpe: fix ECL_WITH_LISP_FPE macro after changes to floating point exception handling
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.
2020-01-12 18:53:45 +01:00
Daniel Kochmański
9cf6e774a4 Merge branch 'fpe-without-sigfpe' into 'develop'
Fix floating point exceptions for systems without working feenableexcept

See merge request embeddable-common-lisp/ecl!177
2020-01-12 10:30:09 +00:00
Daniel Kochmański
3743c85d4d cmp: unoptimized long call: evaluate the function first
Fixes #550.
2020-01-12 11:18:46 +01:00
Daniel Kochmański
e399d33fc6 tests: add regression test for 550 2020-01-12 11:18:23 +01:00
Marius Gerbershagen
22ad495e26 ieee-fp: allow for infinity and NaN without floating point exceptions 2020-01-11 17:21:10 +01:00
Marius Gerbershagen
e65e23ee8a configure: check if feenableexcept is actually working
Not all processors will signal floating point exceptions even when
told so, for example the Raspberry Pi as Dave Richards pointed out on
the ecl-devel mailing list.
2020-01-11 15:37:15 +01:00
Marius Gerbershagen
cb03494a6d ieee_fp: use explicit checks for fpe bits if feenableexcept is not declared
Using isnan and isfinite to check for floating point exceptions
doesn't work when we want floats to be able to have infinity or NaN as
values, thus this option was removed with commit
5f71f728a3. However, we can still use
fetestexcept to explicitly check if floating point exceptions occurred
even when we can't use the feenableexcept/SIGFPE signal delivery
mechanism.

Previously, we had something like this in the
ECL_MATHERR_TEST/ECL_MATHERR_CLEAR macros, but this was not used
consistently in our codebase (the ECL_MATHERR_TEST macro was missing
in many places). Instead of error-prone testing at every point of
computation, we call fetestexcept in DO_DETECT_FPE when creating a new
float/complex float. In order to avoid having to do this twice, the
DO_DETECT_FPE2 macro is introduced.

A minor disadvantage of this strategy is that floating point
exceptions may be signaled later than they occurred.
2020-01-11 15:32:52 +01:00
Daniel Kochmański
2cf975416a Merge branch 'gmp-alloc-fix' into 'develop'
Fix gmp allocation functions and #485

Closes #485

See merge request embeddable-common-lisp/ecl!176
2020-01-06 20:02:20 +00:00
Marius Gerbershagen
c2a577d609 bignums: prevent bignum registers from growing too big
We had this code before, but it made non-functional in commit
20f4c8931e and got removed with commit
749b97d06c.
2020-01-04 18:07:41 +01:00
Marius Gerbershagen
c301b108a7 bignums: don't use ecl_alloc_atomic for gmp
The gmp manual (https://gmplib.org/manual/Custom-Allocation.html) states

> GMP may use allocated blocks to hold pointers to other allocated
  blocks. This will limit the assumptions a conservative garbage
  collection scheme can make.

Thus we can't use ecl_alloc_atomic. We could just use ecl_alloc
instead, however our implementation is already structured in such a
way that it is sufficient to use ecl_alloc_uncollectable. The reason
for that is that currently all bignums except those in the bignum
registers in the thread local environment are allocated as compact
objects so that we only need to call mpz_clear for the few non-compact
objects in the bignum registers.

See also commits 7b536161 and bd48b859.
Fixes #485.
2020-01-04 17:49:08 +01:00
Marius Gerbershagen
f5dfc145d0 Merge branch 'fix-547' into 'develop'
Fix 547

Closes #547

See merge request embeddable-common-lisp/ecl!174
2020-01-02 15:25:36 +00:00
Marius Gerbershagen
8ff5d8b60c Merge branch 'fix-546' into 'develop'
dffi: define ffi_type_complex_* types only when available

Closes #546

See merge request embeddable-common-lisp/ecl!175
2020-01-02 14:45:58 +00:00
Daniel Kochmański
1ccf7db8f8 dffi: define ffi_type_complex_* types only when available
In ecl_type_to_libffi_types we have definitions for complex float
types when appropriate define is present. Fixes #546.
2019-12-31 10:16:38 +01:00
Daniel Kochmański
bbd3c2d6d0 expt: add a case for complex-float ^ integer.
Lack of this switch branch lead to unrecoverable error. Fixes #547.
2019-12-30 22:04:11 +01:00
Daniel Kochmański
78138b65dc tests: add regression test for 547
Also add complex tests to the make-check test suite. that was a clear omission.
2019-12-30 22:04:07 +01:00
Daniel Kochmański
ef450d9070 contrib: sockets: fix get-host-by-name
Remove flag AI_V4MAPPED which takes effect only for AF_INET6
family. Currently we do not work at all with ipv6, hence this flag is
a no-op. Moreover Android has no definition for this flag. See !172.

Fix contributed by Polos Ruetz. Closes !172.
2019-12-30 10:39:13 +01:00
Daniel Kochmański
d6b577233b Merge branch 'c-stack-size' into 'develop'
Change handling of C stack resizing

See merge request embeddable-common-lisp/ecl!173
2019-12-30 09:37:40 +00:00