Commit graph

8274 commits

Author SHA1 Message Date
Daniel Kochmański
2bbf490071 alloc_2.d: remove unused code paths
- GBC_BOEHM_OWN_ALLOCATOR is dead for a long time
- undef alloc_object was used the function rename to ecl_alloc_object
- remove mark phase ignored by the preprocessor
2022-11-24 18:54:39 +01:00
Daniel Kochmański
67f9d6af27 file.d: file_listen: refactor the function
- instead of a magic number -3 define a constant ECL_LISTEN_FALLBACK
- provide a separate definition for windows and not-windows
2022-11-24 18:46:16 +01:00
Daniel Kochmański
2b52fe3ecb pathname_translations: use ecl_assqlp instead of @assoc
ecl_assqlp is sufficient and does not require argument parsing at runtime. host
is always checked to be a string, so the ecl_assoc test EQUAL will have the same
effect as the previously checked STRING-EQUAL.
2022-11-24 18:32:58 +01:00
Daniel Kochmański
f948001dee reader: ensure the correct function arity
We've used void_reader as an implementation for sharp_{plus,minus}_reader -
sharp readers accept three arguments while void_reader accepted two.

- introduce void_reader3
- change sharp_{plus,minus}_reader to use void_reader3
- remove unused defines (leftovers from the past)
- remove unused void_reader (with two arguments)
2022-11-24 18:32:53 +01:00
Daniel Kochmański
4366fac6ad portability: repair builds for --enable-threads=no
A few blocks were not guarded with

 #ifdef ECL_THREADS
 ...
 #endif
2022-11-24 18:32:45 +01:00
Marius Gerbershagen
b9ea8ac6ac rename-file: fix error message
Don't use the filename encoded in utf8/utf16/whatever in the error
message.
2022-11-19 20:38:12 +01:00
Marius Gerbershagen
220faae167 fix encoding for standard input/output/error streams that are not Windows console streams
In commit 892a34e66d, I forgot to set
the encoding to the default value after we start when we are not on a
Windows console.
2022-11-19 20:34:32 +01:00
Marius Gerbershagen
fea8a9dde4 Merge branch 'fix-log-small-ratio' into 'develop'
log: add a separate path for ratios

See merge request embeddable-common-lisp/ecl!276
2022-11-18 15:59:57 +00:00
Daniel Kochmański
06e553157c tests: add a regression test for (log small-ratio) 2022-11-16 00:31:26 +01:00
Daniel Kochmański
b45dec9c32 log: add a separate path for ratios
While not necessarily a bug, it is convenient to not overflow on very small
ratios. When feasible instead of converting to float, we compute log of the
number and the denominator and then return their difference.

c.f https://mailman.common-lisp.net/pipermail/ecl-devel/2022-July/011628.html
2022-11-16 00:31:19 +01:00
Marius Gerbershagen
4d7ee7a301 fix typo introduced in commit de15a8542 2022-10-22 20:02:07 +02:00
Marius Gerbershagen
de15a85420 cosmetic: fix some compiler warnings 2022-10-22 19:58:24 +02:00
Marius Gerbershagen
509a77335a Merge branch 'fix-decode-float' into 'develop'
decode-float: fix the implementation

See merge request embeddable-common-lisp/ecl!275
2022-10-22 17:57:15 +00:00
Daniel Kochmański
3b4c4f3c98 tests: add a regression test for decode-float
Cases are hand picked.
2022-10-22 19:31:55 +02:00
Daniel Kochmański
4861e02c1f decode-float: fix the implementation
The previous code returned 0 for negative floats. Moreover it did not honor
the signed negative zero wrt third returned value.
2022-10-22 19:22:51 +02:00
Daniel Kochmański
e760e9182b Merge branch 'format-e-issues' into 'develop'
Fix several issues with the format ~e directive

Closes #499 and #632

See merge request embeddable-common-lisp/ecl!274
2022-10-02 19:28:00 +00:00
Marius Gerbershagen
482d09ed10 format.lsp: fix incorrect roundings for ~e directive
Due to rounding issues the exponent can be different than what we
guessed. For example in the following only one digit should appear
before the decimal point such that

(format nil "~,1e" 9.9) => 9.9e+0

is correct but

(format nil "~,1e" 9.9) => 10.0e+0

is incorrect, has to be 1.0e+1.
2022-09-24 21:04:43 +02:00
Marius Gerbershagen
0506ce34a3 format.lsp: fix format ~e with width argument
Fixes #632.
2022-09-18 16:33:00 +02:00
Marius Gerbershagen
763369ee84 float_to_digits.d: add some comments 2022-09-18 16:02:47 +02:00
Daniel Kochmański
4252012a2e Merge branch 'cmp-libs-ld-flags-non-backwards-compatible' into develop 2022-09-08 09:03:46 +02:00
Daniel Kochmański
6d191760b3 cosmetic: cmp: rename a function guess-ld-flags to guess-ld-libs
... to better reflect what it returns.
2022-09-08 09:02:42 +02:00
Marius Gerbershagen
d55d31df3b format: print 0 after decimal point with ~e for integer input
Example: (format t "~e" 1.0) used to print 1.e+0, now prints 1.0e+0

Code adapted from SBCL.
2022-09-03 19:38:51 +02:00
Marius Gerbershagen
826cc92983 cmp: introduce new variables for linker flags
Split up the options into additional flags for the linker and
additional libraries.

Quoting from issue #636:

> Here's an example, attempting to link one object file named
  example.o into an executable named example. Libcrypto here is
  superfluous and should be removed by --as-needed:

```
LDFLAGS="-Wl,--as-needed"
LIBS="-lcrypto"
gcc ${LDFLAGS} ${LIBS} example.o -o example # doesn't link libcrypto!
gcc example.o ${LDFLAGS} ${LIBS} -o example # doesn't honor --as-needed!
gcc ${LDFLAGS} example.o ${LIBS} -o example # works great!
```

> In short, the placement of your -l<foo> flags differs from that of
  all the other linker flags. Since ECL is only providing one big
  variable ld-flags for all of the linker flags, there's no correct
  way to pass in options like --as-needed and -l<foo> at the same
  time.

Fixes #636.
2022-08-24 16:38:20 +02:00
Daniel Kochmański
d0a24fe283 Merge branch 'cmp-infinite-loop-circular-structure' into 'develop'
Fix #630

Closes #630

See merge request embeddable-common-lisp/ecl!273
2022-08-16 09:10:24 +00:00
Marius Gerbershagen
3db6ad91ff cmp: fix infinite loop for files containing lists with the same circular structure
Closes #630.
2022-08-14 17:17:57 +02:00
Marius Gerbershagen
3bf98a96e0 tests: fix typo in trap-fpe smoke test
Due to the typo, all floating point exceptions were enabled after the
test had run. This leads to failures in other tests for instance due
to floating-point-inexact errors. Now, the exception flags are
correctly restored again after the test is finished.
2022-08-13 20:58:23 +02:00
Daniel Kochmański
b3d1a3e343 trap-fpe: signal an error when invalid condition is supplied
We've allowed any symbol to be supplied as a condition, when it was not
recognized then we've not changed bits (they remained 0). From now on we signal
an error if the condition can't be signaled.

Since user reported the error with keywords used instead of cl symbols, we also
make the manual more clear regarding the package of condition symbols.
Appropriate smoke tests are added too.

Fixes #681.
2022-07-28 21:08:31 +02:00
Daniel Kochmański
1ce4713804 floats: add operators to convert between floats and bits (integers)
The interface is in the system package (that is - not part of the official api).
2022-07-07 13:24:38 +02:00
Daniel Kochmański
4b83ceb1b6 Merge branch 'ext-program-path-with-environ' into 'develop'
RUN-PROGRAM: Try to use execvp even if :ENVIRON is specified

See merge request embeddable-common-lisp/ecl!272
2022-05-23 07:28:34 +00:00
Eric Timmons
e6b17033b7
RUN-PROGRAM: Try to use execvp even if :ENVIRON is specified
Unfortunately, execvpe is not standard. However, we can replicate its behavior
by pointing **environ to a new array of environment variable assignments before
execvp.

On Darwin, shared libraries do not have direct access to **environ. Instead, we
use the return value of _NSGetEnviron().

Rename all existing uses of environ (as a variable name) to my_environ as
environ now names a macro on both Darwin and Mingw.

If the target does not HAVE_ENVIRON, fall back to execve as before.
2022-05-20 14:38:41 -04:00
Eric Timmons
bad77f4915
Improve PROCESS-ENVIRON tests
(ext:run-program "env" nil :environ '("foo=bar")) actually exits with non-zero
status because 1) PATH is not specified in the child process and even if it
were 2) the use of :ENVIRON prevents ECL from searching the PATH for child
programs.

Rewrite the tests to actually highlight the failure.
2022-05-20 14:11:10 -04:00
Daniel Kochmański
4e9fab94eb ecl_bignum: access the internal object with a macro ecl_bignum
This provides a better data encapsulation and is more portable. Moreover it is
consistent with how we handle other boxed values like ecl_doublefloat.
2022-05-06 10:13:08 +02:00
Daniel Kochmański
e9967ef362 Merge branch 'fix-678' into 'develop'
core: add a new utility 'si_adjust_vector' to arrays.d

Closes #678

See merge request embeddable-common-lisp/ecl!271
2022-04-27 18:16:42 +00:00
Daniel Kochmański
52d0d64f9c ecl_min: don't use ADJUST-ARRAY in the core
The function ADJUST-ARRAY is defined later in Lisp code. Instead of that we use
a newly introduced SI:ADJUST-VECTOR. Fixes #678.
2022-04-27 13:50:19 +02:00
Daniel Kochmański
fe27ab8600 core: add a new utility 'si_adjust_vector' to arrays.d
This function is added to avoid using in the core the f unction CL:ADJUST-ARRAY,
that is not defined during bootstrapping.
2022-04-27 13:50:17 +02:00
Daniel Kochmański
8d90e31ecc Merge branch 'darwin-flat_namespace' into 'develop'
configure: don't use -flat_namespace on Darwin

See merge request embeddable-common-lisp/ecl!268
2022-03-29 09:51:50 +00:00
Daniel Kochmański
a4b593c110 Merge branch 'hashtable-improvements' into 'develop'
hash-tables: performance improvements

See merge request embeddable-common-lisp/ecl!269
2022-03-29 09:50:51 +00:00
Daniel Kochmański
2c1f94cc0d Merge branch 'add-missing-break-statement' into 'develop'
Add missing break statement to cl_hash_table_test

See merge request embeddable-common-lisp/ecl!270
2022-02-28 07:50:31 +00:00
Catherine Tower
88b09a6b60
Add unit test for HASH-TABLE-TEST
The test ensures that there's no error when HASH-TABLE-TEST is called on a hash
table with a custom equality function. The tests pass, with some caveats:

- I'm only about 70% sure that FINISHES is the right test-predicate to use for
  something like this
- The test suite would consistently fail with non-deterministic segfaults while
  testing the MULTIPROCESSING subtest. This could easily be due to the fact that
  I'm using a FreeBSD machine, and don't have access to a Linux machine at the
  moment -- though I'd be happy to re-run the tests when I do. The test suite
  completed when I commented out the MULTIPROCESSING subtest from the ASD
  file. I don't believe this would have any bearing on whether or not the hash
  table tests should pass
2022-02-27 15:19:01 -08:00
Catherine Tower
f0d46570a4
Add missing break statement to cl_hash_table_test
Without the break statement an error is signalled for any hash table with a
custom test function
2022-02-27 14:15:34 -08:00
Caleb Xu
2afa70807e
configure: don't use -flat_namespace on Darwin 2022-02-20 16:36:31 -05:00
Marius Gerbershagen
e3fc760139 Merge branch 'fast-gf' into 'develop'
generic function dispatch changes

See merge request embeddable-common-lisp/ecl!267
2022-02-20 17:11:54 +00:00
Marius Gerbershagen
16faca09b6 hash-tables: performance improvements
Previously, we used the "tombstones" approach for removing entries
from a hash-table, that is buckets were marked as previously occupied
but currently empty. If the hash-table did not grow in size these
tombstones were never cleaned up, only reused for new entries.

For a general purpose hash-table this is a problematic strategy
because there are workloads where this significantly slows down any
attempted lookup or deletion for elements that are not contained in
the hash-table. This happens when new elements are added and deleted
regularly for a long time without the size of the hash-table changing.
Even if the hash-table is never filled above a small fraction of its
size, tombstones will eventually accumulate which an unsuccessfull
search for an element will have to skip over.

In the new implementation, we don't use any tombstones at all but
instead shift elements into more optimal buckets.

In the case where the hash-table in the old approach was free of
tombstones, the new approach is a little slower for the process of
deleting from highly occupied hash-tables itself but inserting into a
hash-table is a little bit faster on the other hand.
2022-02-19 16:02:57 +01:00
Daniel Kochmański
2307259fcd clos: sort-applicable-methods: be specific regarding arguments
The function SORT-APPLICABLE-METHODS accepts as the third argument called
ARGS-SPECIALIZERS however this function assumed that the argument was a list
of argument's classes (i.e not EQL specializers) - see COMPARE-SPECIALIZERS.
This commit doesn't change the function signature but conses a new list that
is ensured to be a list of classes and passes them to COMPARE-METHODS.

(Local) functions COMPARE-METHODS, COMPARE-SPECIALIZERS-LISTS and
COMPARE-SPECIALIZERS have the argument name changed to reflect their true
expectations.

The function COMPARE-SPECIALIZERS takes the CLASS-PRECEDENCE-LIST of the class
of the argument to break ties when there is no direct relationship between
method specializers.
2022-02-05 16:21:23 +01:00
Daniel Kochmański
f37fe9533c clos: compute-applicable-methods: small refactor
Pull a function APPLICABLE-METHOD-LIST into its sole consumer
STD-COMPUTE-APPLICABLE-METHODS.
2022-02-05 16:21:23 +01:00
Daniel Kochmański
86e71d7eb9 clos: add a reference implementation of the legacy discriminator
This implementation is included for the reference and benchmarks.
2022-02-05 16:21:23 +01:00
Daniel Kochmański
74c08fa072 clos: c-a-m-using-classes: don't give up eagerly on EQL specializer
Previously a local function APPLICABLE-METHOD-P returned (values nil nil) when
it found an EQL-specializer where the object was of a matching class. This is
premature because some later specializer may make the method not applicable
based on one of the argument classes, so there is no need to resort to
COMPUTE-APPLICABLE-METHODS in such case.
2022-02-05 16:20:13 +01:00
Daniel Kochmański
9ff049c969 clos: rewrite compute-g-f-spec-list
Previously this function stored a list of elements

  (cons list-or-random-atom argument-position)

ARGUMENT-POSITION was preasumbly stored because authors anticipated denoting
unspecialized arguments, however all positions were always filled because
unspecializer argument had non-nil specializer #<BUILTIN-CLASS T>.

LIST-OR-RANDOM-ATOM contained either a list of EQL specializers or a random
specializer from all method specializers. The second value was not clear.

This change simplifies the code and the interface, we additionally maintain
additional information. From now on the list stores elements:

  (cons class-specializer-p eql-specializers)

CLASS-SPECIALIZER-P is either NIL or T denoting whether the generic function
has a method specialized on this argument on a class other than T.

EQL-SPECIALIZERS without change, is a list of all EQL specializers.
2022-02-05 16:10:33 +01:00
Daniel Kochmański
84200fd315 clos: rework slightly the dispatch mechanism
- improve set-generic-function-dispatch comments
- add a new file that contains "lisp-defined" dispatchers
- remove unused code
2022-02-05 15:03:52 +01:00
Daniel Kochmański
5cb67471fd clos: finalize-inheritance conformance fix
According to "Reinitialization of Class Metaobjects" reinitialize-instance
must call finalize-inheritance if the class was already finalized.
2022-02-05 15:03:52 +01:00