Commit graph

8083 commits

Author SHA1 Message Date
Daniel Kochmański
6f0bc19628 Merge branch 'fix-559' into 'develop'
Fix #559

Closes #559

See merge request embeddable-common-lisp/ecl!187
2020-03-02 13:39:38 +00:00
Daniel Kochmański
6c40cb1439 Merge branch 'windows-fixes' into 'develop'
various fixes for Windows

Closes #564

See merge request embeddable-common-lisp/ecl!189
2020-03-01 20:06:52 +00:00
Marius Gerbershagen
a7e694de0e ecl_import_current_thread: fix segmentation fault
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.
2020-03-01 18:49:50 +01:00
Marius Gerbershagen
0577802718 ecl_release_current_thread: don't close handle twice
thread_cleanup already calls CloseHandle
2020-03-01 18:49:50 +01:00
Marius Gerbershagen
313d553918 tests: fix embedding tests on cygwin 2020-03-01 18:49:50 +01:00
Marius Gerbershagen
fd7b4c6f85 tests: add test for ecl_import_current_thread 2020-03-01 18:49:50 +01:00
Marius Gerbershagen
14fa51f172 fix config.h for MSVC win64 2020-03-01 18:49:50 +01:00
Marius Gerbershagen
2155e354e4 doc: more detailed build instructions for MSVC 2020-03-01 18:49:49 +01:00
Marius Gerbershagen
6dce405b2a tests: stop compilers from complaining about division by zero in emb.0003.with-lisp-fpe 2020-03-01 18:49:49 +01:00
Marius Gerbershagen
a3eebf1ba3 Revert "ieee-fp: remove _fpreset from si_trap_fpe"
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!
2020-03-01 18:49:49 +01:00
Marius Gerbershagen
6729693650 fix fixint and fixnnint for apis with long smaller than cl_fixnum
Concerns especially win64. These functions have been broken since
commit 0102aed9f5.
2020-03-01 18:49:49 +01:00
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
f020031047 defclass: don't create class at compile time
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.
2020-02-17 21:33:21 +01: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