Commit graph

7894 commits

Author SHA1 Message Date
Daniel Kochmański
4c7658a6fe Merge branch 'minor-compiler-fixes' into 'develop'
Fix some minor compiler bugs

Closes #545

See merge request embeddable-common-lisp/ecl!191
2020-03-26 12:41:06 +00:00
Marius Gerbershagen
91d251a7ba cmp: correctly handle unused special &rest variables
Even when the variable is not used, we still have to do the binding.
2020-03-21 13:05:23 +01:00
Marius Gerbershagen
14d46da134 cmp: fix evaluation order bugs in compiler macros 2020-03-21 11:44:01 +01:00
Marius Gerbershagen
dda466dd0e cmp: allow :allow-other-keys for functions with &key but zero keywords
Functions such as
(defun f (&key) ...)
would give an error when called like (f :allow-other-keys ...).
2020-03-20 21:29:18 +01:00
Marius Gerbershagen
a9065d1d8e cmp: fix closure type for local functions calling closures
When a local function calls a closure it has to be a closure too. Thus
when updating the closure type for a function f, we have to possibly
update also all functions referencing f.

Fixes #545.
2020-03-18 22:00:57 +01:00
Marius Gerbershagen
1d7551c773 doc: document ECLDIR and ecl_import/release_current_thread
Also reorganize the embedding reference into two subsubsections.
2020-03-14 19:56:51 +01:00
Marius Gerbershagen
d7529988f0 numbers: add workaround for log1p
log1pl is not present on NetBSD.
2020-03-12 21:29:12 +01:00
Marius Gerbershagen
1aeb7823e8 cmp: add explicit type suffixes for emitted integer constants in C code
According to the C99 standard, compilers are supposed to automatically
choose the correct type. However, for the C89 standard explicit suffixes
are needed for long longs. Guess what standard msvc follows...
2020-03-07 22:26:44 +01:00
Marius Gerbershagen
f776bd8615 fix daylight savings time detection for win64 2020-03-07 22:26:43 +01:00
Marius Gerbershagen
f76bd95786 fix array dimension limit for msvc win64 2020-03-07 22:26:43 +01:00
Marius Gerbershagen
f936415c0d process.d: add missing include 2020-03-02 22:07:29 +01:00
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