Commit graph

8428 commits

Author SHA1 Message Date
Marius Gerbershagen
f400d2ae5e document the return values for all thread synchronization functions 2023-07-08 15:38:48 +02:00
Marius Gerbershagen
889f93fc08 mp:get-wait: fix return value
Should be `t` according to the documentation while we were returning
the lock itself.
2023-07-08 15:22:39 +02:00
Marius Gerbershagen
0885862e40 cmp: improve handling of potential miscompilations
Abort with a useful error message instead of trying to continue on.
2023-07-01 16:45:21 +02:00
Daniel Kochmański
29fb6009e4 cmp: disassemble: fix a regression
The function disassemble will end up in the backend too eventually, although for
now it is defined in cmpmain. Recently we've moved backend-specific variables to
the code generation pass, but disassemble still relies on that environment.
2023-06-27 09:18:02 +02:00
Marius Gerbershagen
99317ee401 cmp: fix inline expansion of (copy-readtable nil) 2023-06-25 16:08:41 +02:00
Marius Gerbershagen
48f42d8cb0 cmp: minor changes to optimizations for car/cdr
si:cons-car/cdr implement car and cdr on conses without type checks.

Replace those macros by functions and fix the previously ignored
inline definitions. This allows using si:cons-car/cdr in the
interpreter while keeping the code generated the native compiler the
same.

In the future we should probably improve the type inferencer to handle
these optimizations automatically and get rid of si:cons-car/cdr
alltogether.
2023-06-25 15:53:40 +02:00
Marius Gerbershagen
33aca4a57b cmp: don't output invalid C code if dead code elimination fails 2023-06-24 19:07:10 +02:00
Marius Gerbershagen
639d5f3ad3 cmp: fix errors in handling compound function types
These are valid in type declarations but must not be passed on as
arguments to typep.

Moreover, we were sometimes incorrectly simplifying code like

(typep x (function ...))

to (functionp x) in the native compiler.
2023-06-18 13:08:12 +02:00
Marius Gerbershagen
9084ab97bd cmp: remove duplicate type assertion handling 2023-06-18 11:12:45 +02:00
Marius Gerbershagen
a4b69e5c04 Merge branch 'emscripten' into 'develop'
Preliminary support for the emscripten target

See merge request embeddable-common-lisp/ecl!277
2023-06-17 12:01:09 +00:00
Daniel Kochmański
63ff85ef7f install: add build instructions for emscripten 2023-06-13 22:07:12 +02:00
Daniel Kochmański
4b02cea2d2 build: add a preliminary support for the emscripten target
- add a host target wasm32-unknown-emscripten
- update config.sub and config.guess
- invoke autoreconf with gnu autoconf 2.71
- update build scripts to account for .html extensions
2023-06-13 22:07:08 +02:00
Daniel Kochmański
f0b9172800 Merge branch 'update-dependencies' into 'develop'
dependencies: gmp: add a missing include in GMP_CHECK_LIBM_FOR_BUILD

See merge request embeddable-common-lisp/ecl!291
2023-06-12 09:29:49 +00:00
Daniel Kochmański
50c38970c7 dependencies: update bdwgc to 8.2.4 and libatomic_ops to 7.8.0 2023-06-12 10:33:47 +02:00
Daniel Kochmański
39fada4260 dependencies: gmp: add a missing include in GMP_CHECK_LIBM_FOR_BUILD
The missing include was <math.h> required by log, without that emcc failed and
"-lm" was not added to the build flags.

Also regenerate configs with 'autoreconf -ivf'.
2023-06-12 10:33:47 +02:00
Marius Gerbershagen
77bf1a7c90 Merge branch 'cmp-cleanups' into 'develop'
cmp: various cleanups

See merge request embeddable-common-lisp/ecl!289
2023-06-11 13:23:49 +00:00
Daniel Kochmański
4ca79933d3 Merge branch 'thread-timeouts' into 'develop'
Various changes related to time issues

See merge request embeddable-common-lisp/ecl!290
2023-06-11 12:58:59 +00:00
Daniel Kochmański
e10c2010d4 cosmetic: update headers 2023-06-11 10:40:21 +02:00
Daniel Kochmański
95e7bdd7d7 cmpc: change compiler-macro cl:float to c-inliner macro
The compiler macro expanded float to c-inline.
2023-06-11 10:40:21 +02:00
Daniel Kochmański
4a1902658c cmpc: move sysfun to the cxx backend
sysfun declarations revolve strictly around c function inlining that is specific
to the C backend.

Moreover be more explicit about symbol packages and check feature-conditioned
inlines at runtime (not at readtime) in case that we construct the inline
information for a cross-compiled target. This should be further improved.
2023-06-11 10:40:18 +02:00
Daniel Kochmański
8bb0b99499 cmpc: move c-inline expansions of PRINC to the backend
Instead of using DEFINE-COMPILER-MACRO we implement them with DEFINE-C-INLINER
because these optimizations are backend-specific.
2023-06-06 22:34:08 +02:00
Daniel Kochmański
c4b32c5905 cmpc: move produce-inline-loc and co to cmpc-inliner
These operators are used across different optimizations and clearly do not
belong to a specific pass.
2023-06-06 15:02:51 +02:00
Daniel Kochmański
ff67ebfa1a cmpc: move wt "call" routines to cmpc-wt 2023-06-06 14:48:58 +02:00
Daniel Kochmański
ae6614ebba cmpc: move variables related to code generation to the backend 2023-06-06 14:48:58 +02:00
Daniel Kochmański
220b7c7363 cmpc: move constant and inlining c/c++ optimizations
Move appropriate files to the C/C++ backend.
2023-06-06 14:48:58 +02:00
Daniel Kochmański
03be475fb9 cmpc: clean up numeric optimizers and propagators
- merge bits and numeric optimizers in a single file
- move c/c++ optimizers to the backend
- move bits and numeric propagators to a separate file
2023-06-06 14:48:58 +02:00
Daniel Kochmański
1472bb18e6 cmpc: move c/c++ backend to a separate directory 2023-06-06 14:48:58 +02:00
Daniel Kochmański
e9f05ac85e cmp: c1constant-value: remove defunct parameter ONLY-SMALL-VALUES
After inclusion of the externalizable NAN values the parameter
':ONLY-SMALL-VALUES T' is the same as ':ALWAYS NIL' (the default).

That makes the the operator slightly easier to understand.
2023-06-06 14:48:58 +02:00
Daniel Kochmański
d62cf434c6 cmp: enable externalizing NAN 2023-06-06 14:48:58 +02:00
Daniel Kochmański
3565c89ca9 cmp: cosmetic: write (function ,foo) instead of #',foo 2023-06-06 14:48:58 +02:00
Marius Gerbershagen
b049695ec0 ecl_musleep: get rid of unused alertable argument
Was always set to true.
2023-06-04 19:19:16 +02:00
Marius Gerbershagen
3f7581e884 time.d: change the internal time units to microseconds
There is really no reason not to use microseconds. The operating
system APIs we are calling usually report time in microseconds anyway,
so as a bonus there is even less time spent rounding.
2023-06-03 19:25:12 +02:00
Marius Gerbershagen
51627c7e9b get-internal-real-time: use monotonic clock if available
Prevents jumps in the returned value if the system time is reset.
2023-06-03 19:04:53 +02:00
Marius Gerbershagen
c300f2ee3a threads.h: use clock_monotonic for timeouts on posix if available
Prevents threads from timing out too early or too late if the system
clock is adjusted while waiting.
2023-05-27 18:36:16 +02:00
Marius Gerbershagen
c1078cda7d threads.h: add fallback if gettimeofday is not defined
Probably unnecessary but since we have the same fallback in
get-internal-real-time we should add it here too for consistency.
2023-05-27 16:41:57 +02:00
Daniel Kochmański
0321023572 cmp: propagate types in functions too
The propagator for FSET did not descend to the function object while the
propagator for LOCALS did (that was inconsistent). Also cmpmain called
P1PROPAGATE on *LOCAL-FUNS* before the second pass so that was no-op.
2023-05-24 15:49:06 +02:00
Daniel Kochmański
1e9786fd0a cmp: simplify the type propagation pass
Previously we've carries the "assumption" list through all calls, but said
assumption list was never used to make any decisions (and we had numerous
assertions that it must be null at various places).

The assumption list made the code less readable because it intorduced numerous
loops and multiple-value-bind calls just to maintain it. Removal introduces no
known regressions.
2023-05-24 15:49:06 +02:00
Daniel Kochmański
18030bf1b4 cmp: rearrange the order in +all-c1-forms+ to hint top-levelness 2023-05-24 15:49:06 +02:00
Daniel Kochmański
0ccb877b8a cmp: remove a kludge from the function object-type
The function OBJECT-TYPE special-cased NIL and returned SYMBOL as its
type. git-blame shown that this kludge was part of the initial release so I
could not find any reason why it does not return NULL instead. Removing the
kludge did not yield any noticeable regressions.

My guess is that the type system was deficient at that time and type-of did not
work on the type NIL. Returning SYMBOL instead of NULL lead to a sloppy type
propagation of locations containing NIL.
2023-05-24 15:49:06 +02:00
Daniel Kochmański
e23c82b90d cmp: cosmetic: don't use nconc in ctop-write
We simply iterate over both lists without nconcing them.
2023-05-24 15:49:06 +02:00
Daniel Kochmański
aae21dc9ae cmp: return-from: fix a problem where block-name was never used
The intention of c2return-from was to print the block name in the error
message when the block was referenced outside of its dynamic extent, but CCB
was never passed as the return type. The code is simplified to always use the
same code path for non-local returns.
2023-05-24 15:49:06 +02:00
Daniel Kochmański
b8aa49a053 cmp: add a helper function GET-OBJECT for the data segment
This function may be used to get the object from one of the segments or fail
-- most notably it does not add the object to the data segment.
2023-05-24 15:49:06 +02:00
Daniel Kochmański
244f4e0485 cmp: separate cmpbackend from cmpmain (2)
Introduce compiler-pass/assemble-cxx.
2023-05-24 15:49:06 +02:00
Daniel Kochmański
3f3c89ddb2 cmp: separate cmpbackend from cmpmain (1)
Introduce compiler-pass/generate-cxx.
2023-05-24 15:49:03 +02:00
Daniel Kochmański
1a5d1c6ca4 .gitignore: add the directory /local as ignored 2023-05-22 10:16:39 +02:00
Marius Gerbershagen
fceb54c237 replace some deprecated macro names 2023-05-21 19:04:43 +02:00
Jeronimo Pellegrini
1c1db8637c Make (log x 0) return 0 (as per the spec)
The CL spec says that "If base is zero, log returns zero."  But ECL
was not checking for zero, so a divide by zero error was generated.
This patch makes it return zero when the base is zero:

> (log  1 0)

0
> (log 1/2 0)

0
> (log #C(2 1) 0)

0
> (log 2 0.0)

0.0
2023-04-15 15:30:04 +02:00
Marius Gerbershagen
8cffaf858c numbers/log.d: fix typo 2023-03-25 13:46:43 +01:00
Marius Gerbershagen
8586876051 tests: multiprocessing: increase timeout value in semaphore smoke tests
This makes the test run more reliably on slow computers.
2023-03-18 16:41:41 +01:00
Marius Gerbershagen
4705967061 cmp: remove superfluous encode-string function 2023-03-18 15:18:20 +01:00