Commit graph

8654 commits

Author SHA1 Message Date
Daniel Kochmański
ba45731c19 Merge branch 'gray-path' into 'develop'
Add generic PATHNAME and TRUENAME

See merge request embeddable-common-lisp/ecl!320
2024-01-26 08:15:53 +00:00
Daniel Kochmański
e851458058 Merge branch 'type-check-init-forms' into 'develop'
cmp: check that the type of init-forms for optional and keyword arguments matches their proclaimed types

See merge request embeddable-common-lisp/ecl!316
2024-01-26 08:14:20 +00:00
Tarn W. Burton
47c2663955
Update changelog for generic pathname/truename 2024-01-25 14:06:37 -05:00
Tarn W. Burton
bc6e31f926
Add generic pathname/truename 2024-01-25 14:05:27 -05:00
Daniel Kochmański
3850dcf5d7 Merge branch 'gray-string-length' into 'develop'
Add Gray extension for file-string-length

See merge request embeddable-common-lisp/ecl!318
2024-01-24 12:47:38 +00:00
Daniel Kochmański
4649258796 Merge branch 'ansi-test' into 'develop'
Add ansi-test to tests

See merge request embeddable-common-lisp/ecl!319
2024-01-24 12:45:10 +00:00
Tarn W. Burton
417cf25bc4
Add ansi-test to tests 2024-01-14 13:30:49 -05:00
Daniel Kochmański
5b4e355697 Merge branch 'update-license-to-lgpl-2.1-or-later' into 'develop'
cleanup: update license to lgpl-2.1+ in both headers and text

See merge request embeddable-common-lisp/ecl!317
2024-01-14 11:57:08 +00:00
Daniel Kochmański
3e37843a33 cleanup: update license to lgpl-2.1+ in both headers and text 2024-01-14 12:22:27 +01:00
Tarn W. Burton
10fa901e98
Update for gray:stream-file-string-length 2024-01-13 10:32:59 -05:00
Tarn W. Burton
e554673006
Add support for gray:stream-file-string-length 2024-01-13 10:26:35 -05:00
Marius Gerbershagen
0be6cd09a6 cmp: don't forget the type check for keyword arguments initialized to nil
For keyword arguments initialized to nil, we were previously not
checking the type of the argument at all.
2023-12-30 18:47:46 +01:00
Marius Gerbershagen
561b09a8ce cmp: check that the type of init-forms for optional and keyword arguments matches their proclaimed types
For now, we only check constant init forms where we can do the check
at compile time.
2023-12-30 18:41:15 +01:00
Daniel Kochmański
db4e3a0013 Merge branch 'dead-code-elimination' into 'develop'
Better dead code elimination and type propagation

See merge request embeddable-common-lisp/ecl!315
2023-12-30 13:06:29 +00:00
Marius Gerbershagen
d500109d07 cmp: fix a few type declarations 2023-12-30 13:31:55 +01:00
Marius Gerbershagen
49ea8975ee Makefile.in: add cmp/cmpbackend-cxx files 2023-12-30 13:31:55 +01:00
Marius Gerbershagen
fdcbe9458d cmp: better dead code elimination
Eliminate dead branches in IF/AND/OR forms if the type of the object
returned by the test form is known to be null or non-null. Get rid of
unnecessary tests in AND/OR forms if we know that a clause cannot
short-circuit the evaluation. Replace NOT forms by T or NIL constants
if we know that the argument is null or non-null.
2023-12-30 13:31:55 +01:00
Marius Gerbershagen
b5dbba1f68 cmp: improvements for (c1nil) and (c1t)
Make the types more precise to improve type propagation. We will fall
back to using object-type as appropriate in later stages of the
compilation.

Also return a new copy for each invocation instead of the same *c1nil*
and *c1t* since we may later set the type of the c1form (e.g. in
enforce-types). This can happen for invalid code which can permanently
set the type of *c1nil* to NIL, leading to miscompilations later on
for unrelated valid code.
2023-12-30 12:39:49 +01:00
Marius Gerbershagen
c474f33fa9 cmp: object-type: nil should have type NULL instead of SYMBOL 2023-12-30 12:39:49 +01:00
Marius Gerbershagen
8cd985961c cmp: improve type propagation for (and), (or), (if) and (not)
Fix errors in handling values types for (and) and (or) (all forms but
the last form return only the primary value). Also be more precise if
branches are not taken or the evaluation is known to short circuit.
2023-12-30 12:39:48 +01:00
Marius Gerbershagen
e0cd45299d Merge branch 'cmpc-refactor-next' into 'develop'
Futher refactor of the compiler

See merge request embeddable-common-lisp/ecl!313
2023-12-28 13:31:03 +00:00
Daniel Kochmański
a230243c97 cmp: loc-refers-to-special-p: more precise check for BIND 2023-12-28 12:50:37 +01:00
Daniel Kochmański
6fb6c7790f cmp: variable holding function has gensym as a name
Previously we've named the function's variable with the function name. That
could lead to a varible named (SETF FOO), and that can break down the road
because variable names are assumed to be symbols.

Moreover this change will prevent a possible fail scenario where we inline a
constant value with a known name instead of the function with the same name.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
5f0cd1acad cmp: inl: specify the value type in make-inline-temp-var 2023-12-28 12:46:24 +01:00
Daniel Kochmański
9e79ae1a09 cmp: rework c2call-global for readibility 2023-12-28 12:46:24 +01:00
Daniel Kochmański
cb0d8274ae cmp: cleanup in the file cmppass2-call 2023-12-28 12:46:24 +01:00
Daniel Kochmański
923d9706f1 cmp: inl: introduce a macro WITH-INLINE-BLOCKS
This macro captures a common invocation scheme.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
9229976731 cmp: inl: remove dead (and invalid!) code
C inliners for arithmetic operations assumed that there may be more than two
arguments and worked similar to reduce:

    ARG_n+3 <- (inline-binop ARG_n+2 ARG_n+1) op ARG_n

that said ECL has compiler macros that simplify the arithmetic so there are
always at most two arguments, so it is enough to inline:

    (inline-binop ARG1 ARG2)

As for the incorrect code -- when there were remaining arguments, the result of
the previous operation was saved with save-inline-loc, but(!) save-inline-loc
expected an inlined argument, while inline-binop calls produce-inline-loc that
returns a "normal" location - that's probably some change from the past, because
produce-inline-loc seems to clearly indicate that it should return inlined value
- and save-inline-loc would always error because of the argument type mismatch.

This commit removes the dead code and now unused save-inline-loc function.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
c6955e41c5 cmp: inl: move code around in the cxx backend inliners
After understanding better the code I've moved argument inlining and function
inlining close to each other, also negate-argument clearly belongs in there too.

INLINED-ARG is now a structure (not a naked list) - that helps with
understanding abstractions better.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
48c39c8083 cmp: inl: remove maybe-save-value and introduce inline-arg0 instead
This function has very clear resemblence of inline-args so it is moved to
cmpc-opt-inl.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
a12d24a8bf cmp: exit manager: implement branching directly in the module
Instead of open-coding branching manually in individual operators we introduce
separate unwinding operators.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
bb42ed7194 cmp: compute-unwind: make all arguments explicit
Instead of relying on *UNWIND-PROTECT* we accept explicit arguments.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
909e5693ab cmp: tagbody: move tag allocation before branching
This is a cosmetic change for readibility.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
bc01ff1a3c cmp: unwind-cjump: avoid recursive call to unwind-exit
Previously our call for conditional jumps worked like:

  unwind-exit -> unwind-cjump -> unwind-exit -> unwind-{label,exit}

The roundtrip to unwind-exit makes tracking invocations harder. The new
invocation chain is:

  unwind-exit -> unwind-cjump -> unwind-{label,exit}
2023-12-28 12:46:24 +01:00
Daniel Kochmański
b9605fd3e4 cmp: exit manager: introduce operators UNWIND-FLEE and UNWIND-COND
The operator UNWIND-FLEE is used to perform a dynamic unwind. Previously we've
opencoded this type of exits in appropriate operators.

The operator UNWIND-COND is used to perform a conditional unwind. It is expected
to be called to produce the IF statement body. With this commit all every
transfer of control goes through the exit manager.

Ultimately we will want to include the if test directly in UNWIND-COND.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
dfa02ba434 cmp: unwind-label: relax conditions for carrying the value
There is no need to carry the location value across the unwind when the
destination is not special, because then we may assign the destination before we
unwind the stack. That allows us to skip examining the unwind requirements.
2023-12-28 12:46:24 +01:00
Daniel Kochmański
d13d400654 cmp: move the variable *DESTINATION* to cmpc 2023-12-28 12:46:24 +01:00
Daniel Kochmański
c2ffcc5deb cmp: introduce a separate environment for functions
There is an environment for the backend, and there is a separate environment for
each function.
2023-12-28 12:46:21 +01:00
Daniel Kochmański
def52d9657 cmp: pull emit-toplevel-form into emit-entry-fun
Instead of mincing blocks form-by-form, we put them all in a single function
environment and make them share locals.
2023-12-28 12:42:39 +01:00
Daniel Kochmański
364deb0551 cmp: remove unused bindings
EMIT-TOPLEVEL-FORM bound *compile-file-truename* and *compile-file-position* to
be immedietely rebound in T2EXPR (to the same value!).

*COMPILE-TO-LINKING-CALL* is not used anywhere.
2023-12-28 12:42:39 +01:00
Daniel Kochmański
141231f2fe cmp: remove dead code 2023-12-28 12:42:39 +01:00
Daniel Kochmański
397dc995d4 cmp: cosmetic changes, elaborate in a comment 2023-12-28 12:42:39 +01:00
Daniel Kochmański
b4da521398 cmp: set-loc: fix a braino (don't access special variable)
set-loc saves the location to the destination, and while doing so it coerces the
former to the type of the latter. Our code used *destination* as the argument to
LOC-REPRESENTATION-TYPE, but DESTINATION and *DESTINATION* may not be the same.
2023-12-28 12:42:39 +01:00
Daniel Kochmański
b3e85f1014 cmp: move misplaced comment to cmpc-inl-sysfun 2023-12-28 12:42:39 +01:00
Daniel Kochmański
f074f1087b cmp: cleanup: remove unused function 2023-12-28 12:42:39 +01:00
Daniel Kochmański
125605b1d0 Merge branch 'read-line' into 'develop'
Fix stream-read-line return

See merge request embeddable-common-lisp/ecl!312
2023-12-28 10:52:08 +00:00
Daniel Kochmański
1be34217a8 seqmacros: do-sublist: fix an invalid declaration
ECL declared the argument %sublist as CONS while it may be either CONS or NIL.
Reported by Alex Wood from Clasp.
2023-12-16 19:23:36 +01:00
Daniel Kochmański
f4af0cc9e3 INSTALL: add an extra hint for emscripten re stack size
Fixes #726.
2023-12-09 09:24:58 +01:00
Daniel Kochmański
1615d72900 cmp: don't attempt to inline constant values with make-load forms
This recent regression caused issues when we try to inline values of constants
that are structures. Fixes #727.
2023-12-07 14:28:01 +01:00
Marius Gerbershagen
758ebc6230 Merge branch 'cmpc-refactor' into 'develop'
cmp: further refactor

See merge request embeddable-common-lisp/ecl!311
2023-12-05 20:26:02 +00:00