Commit graph

74 commits

Author SHA1 Message Date
Daniel Kochmański
b3d3a4e31c cleanup: update license to lgpl-2.1+ in both headers and text 2024-03-10 14:48:12 +01:00
Daniel Kochmański
5e1494361e evalmacros: fix the macroexpansion of multiple-value-bind
While it does not affect ecl code (because ECL treats it as a special form),
some code walkers may get confused. Fixes #709.
2023-07-30 14:51:01 +02:00
Daniel Kochmański
66c7626a8f cmp: cleanup: some more cleanup 2023-02-21 14:34:11 +01:00
Marius Gerbershagen
fdcf5e7eff cmp: disable inlining for global functions that are closures
For functions already compiled and loaded, we simply check if the
definition is a closure. For functions defined in the same file, we
don't store their definition in the compiler environment but instead
use *global-funs*. The advantage is that this directly allows us to
determine whether a function is a closure or not and we don't have to
run the first compiler pass again each time we inline the function.

This commit also fixes some minor issues with the inline policy,
described in detail as follows:

1. The inline policy differed subtly between `proclaim` and `declaim`.
If a file like

(eval-when (:compile-toplevel)
  (proclaim '(inline f)))
(defun f ...)

was compiled (but not loaded), subsequent compilations would inline
`f` but for

(declaim (inline f))
(defun f ...)

the function `f` would only get inlined if the file was compiled _and_
loaded. We now use the latter approach for both cases. Thus, calling
`compile-file` without `load` has no side-effects regarding whether
functions are inlined or not.

2. We did not distinguish between functions which were declared inline
at a global versus local level such that e.g. in

(locally
    (declare (inline f))
  (defun f ...))

the function f would get inlined outside the scope of the `locally`
form. This is changed now such that local inline declarations only
apply to the scope in which they are made.

3. Inline declarations were made by expanding into statements like

(eval-when (:compile-toplevel)
  (c::declare-inline ...))

during the macroexpansion of `defun`. However this only works if the
`defun` appears at the toplevel and hence in code like

(declaim (inline f))
(let (...)
  (defun f ...))

the function `f` could not get inlined later on in the same file. This
is fixed now by calling the code which should run during compilation
directly when macro expanding defun.
2022-12-30 16:14:53 +01:00
Daniel Kochmański
de1b587d78 define-compiler-macro: fix the documentation expansion
Previously it set the documentation slot for the function - it should do
it for the compiler-macro. Fixes #658.
2021-11-06 09:34:25 +01:00
Marius Gerbershagen
f5c2416ea1 prog1: fix return values for the case of a single form with multiple values
prog1 returns only the first value.

Closes #617.
2021-02-15 21:14:44 +01:00
Daniel Kochmański
f9db80dcbf cmp: for LAMBDA use an associated function-block-name
That makes lambda with a declaration si:function-block-name behave
consistently with ext:lambda-block (and in eval-macros
ext:lambda-block expands to have this declaration too to behave in
turn consistently with how the compiler treats ext:lambda-block).
2020-06-15 12:34:10 +02:00
Marius Gerbershagen
a6ff11c8fc cmp: prevent inlining of stale function definitions
If a function which was previously proclaimed inline by the
    native compiler was redefined by the bytecodes compiler, the
    native compiler would still continue to inline the old
    definition (see also commit 892e21012a).
2018-12-18 20:26:52 +01:00
Daniel Kochmański
7517b55c08 loop: rename symbolics LOOP loop2.lsp to loop.lsp 2016-03-11 16:06:45 +01:00
Matthew Mondor
8f07cd58d8 The ECL code no longer uses tabulator characters, they were replaced
by spaces.

A custom script was used to insert/replace Emacs and ViM per-file editor
settings according to their type and the new ECL coding style.
2015-09-03 07:35:47 -04:00
Daniel Kochmański
0dab3c6d19 cosmetic: lsp: setq emacs local variable indent-tabs-mode to nil
This changes local variable indent-tabs-mode to nil for all *.lsp
files in src/lsp directory.

Signed-off-by: Daniel Kochmański <dkochmanski@turtle-solutions.eu>
2015-06-30 08:30:35 +02:00
Daniel Kochmański
cce2b39f10 define-compiler-macro: clhs compliance
This change is incorporated from CLASP. Fixes #82.

Signed-off-by: Daniel Kochmański <dkochmanski@turtle-solutions.eu>
2015-06-30 08:06:53 +02:00
Daniel Kochmański
4d19a27424 cosmetic: untabify
Signed-off-by: Daniel Kochmański <dkochmanski@turtle-solutions.eu>
2015-06-21 14:38:20 +02:00
Juanjo Garcia-Ripoll
1752b034a4 Add Juanjo's copyright to files that did not have it. 2012-04-26 17:33:14 +02:00
Juan Jose Garcia Ripoll
b053cd80ec The macroexpander for CASE also warns about an improper order of statements. 2012-04-06 18:49:09 +02:00
Juan Jose Garcia Ripoll
edee87b62b Another THE->TRULY-THE change in evalmacros.lsp 2012-01-01 19:31:22 +01:00
Juan Jose Garcia Ripoll
ca0222fd19 Implemented EXT:TRULY-THE and made THE expand to either EXT:TRULY-THE or EXT:CHECKED-VALUE depending on the optimization settings. 2011-12-31 19:37:13 +01:00
Juan Jose Garcia Ripoll
866be07c35 Added some declarations for the new type check model. 2011-12-28 23:24:13 +01:00
Juan Jose Garcia Ripoll
7a2d30770b Add IGNORE declarations and remove some unused variables. 2011-12-23 15:38:37 +01:00
Juan Jose Garcia Ripoll
8d64c2fbad Avoid using CONSTANTLY before it is defined 2011-12-18 14:22:09 +01:00
Juan Jose Garcia Ripoll
e786001fd9 DECLAIM got redefined when building ECL 2011-12-17 11:19:47 +01:00
Juan Jose Garcia Ripoll
14990a8250 THE is now a special operator in the interpreter, not a macro. 2011-12-03 09:11:11 +01:00
Juan Jose Garcia Ripoll
cbcb905d28 Needed compile-time side effects for DEFVAR/DEFPARAMETER/DEFCONSTANT also in the bytecodes compiler 2011-06-05 12:35:03 +02:00
Juan Jose Garcia Ripoll
7218b10e1a DEFMACRO did not expand to an eval-when form 2011-06-04 16:20:54 +02:00
Juan Jose Garcia Ripoll
d1a2961707 DEFINE-SYMBOL-MACRO did not have compile-time side effects. 2011-01-12 22:48:09 +01:00
Juan Jose Garcia Ripoll
2495ae0b8e Toplevel DEFMACRO forms are processed differently and stored by the compiler in a local table. These definitions do not propagate beyond the currently compiled file. 2010-05-07 22:20:14 +02:00
Juan Jose Garcia Ripoll
6b1e70042e The documentation file can now store other annotations. 2010-02-23 15:56:39 +01:00
Juan Jose Garcia Ripoll
e305e5c9c6 Missing documentation for DEFUN/DEFMACRO 2010-02-19 21:35:10 +01:00
Juan Jose Garcia Ripoll
f26fcc9001 Removed a spurious warning in ffi:def-foreign-var (Andy Hefner) 2009-11-07 22:27:29 +01:00
Juan Jose Garcia Ripoll
cd89447eec DEFCONSTANT must also define the constant at compile time. 2009-06-28 19:36:24 +02:00
Juan Jose Garcia Ripoll
005dc07061 Added the possibility of bytecompiling forms and saving them. New module bytecmp uses this to implement COMPILE and COMPILE-FILE. 2009-04-01 02:29:48 +02:00
Juan Jose Garcia Ripoll
786affb7c5 ECL now follows the AMOP in the uses of SLOT-DEFINITION-INITFORM and SLOT-DEFINITION-INITFUNCTION. 2008-12-29 11:33:28 +01:00
Juan Jose Garcia Ripoll
82dfdc15b8 Move some documentation from help.lsp to the files where functions are defined. Add documentation for a few functions. 2008-10-05 13:24:42 +02:00
Juan Jose Garcia Ripoll
ec5647915a DEFCONSTANT cannot have implicit compile-time side effects because it breaks our constants that use FFI 2008-08-19 12:21:58 +02:00
Juan Jose Garcia Ripoll
a0d259d0ad DEFCONSTANT now has compile time side effects 2008-08-19 10:13:23 +02:00
Juan Jose Garcia Ripoll
d2a9486aa6 DEFUN was still missing from the functions where REGISTER-WITH-PDE is used 2008-07-12 19:11:44 +02:00
Juan Jose Garcia Ripoll
7607ec041c Added hooks for registering DEF* forms and their locations with some database. 2008-07-12 16:09:53 +02:00
jgarcia
504fe5df73 LOAD-TIME-VALUE is no longer a macro 2008-04-24 11:15:34 +00:00
jgarcia
a59f90871a Emacs modelines for better editing 2008-02-02 19:14:05 +00:00
jgarcia
683b938169 Compiler macro functions for MAPCAR and friends. 2006-10-01 21:09:39 +00:00
jgarcia
ab2da5b861 EXPAND-DEFMACRO now outputs a lambda block. 2006-06-12 08:51:38 +00:00
jjgarcia
cf49eca290 Implicitely declared constants as globals 2006-03-09 08:53:32 +00:00
jjgarcia
5643e40059 Implemented DOLIST/DOTIMES as macros, without magic in the interpreter. 2005-10-24 08:33:32 +00:00
jjgarcia
92757131b4 Several improvements related to inline of logical and cons functions, hardcoding frequently used symbols and a smaller version of TIME 2005-07-28 14:05:40 +00:00
jjgarcia
c882e22bdc Speed improvements in the subtypep implementation, plus additional type declarations to enforce inlining of CDR/CAR 2005-07-25 09:08:06 +00:00
jjgarcia
f76c1888c6 - The T1 and T3 forms of the compiler have been almost removed. Now, handling of
DEFUN as a toplevel form is made via some new declaration C-GLOBAL and some
  magic both in the optimizer for FSET and in the compiler C1COMPILE-FUNCTION.
- CLINES is now handled with a macro and all lines from CLINES are written
  together in the header.
- It is now illegal to have SI::C-LOCAL inside a macro function.
2005-07-04 09:20:24 +00:00
jjgarcia
e52a6e31aa DEFCBODY, DEFLA and DEFENTRY reimplemented. DEFVAR and DEFPARAMETER are no longer treated specially by the compiler. Globals declared by DEFPARAMETER toplevel forms are now recognized by the compiler. 2005-04-11 08:43:48 +00:00
jjgarcia
3882176d59 Fixes to the scope of special variable declarations 2005-01-11 09:57:22 +00:00
jjgarcia
1d03bcda98 Simplify the macroexpansion of M-V-BIND, since it is not used anyway. 2004-05-17 07:30:48 +00:00
jjgarcia
4e3189eddd Big changes in the way functions are compiled, unifying the code that handles DEFUN, DEFMACRO and LAMBDA, and fixing an important bug in the optimizer for tail-recursive calls. 2004-05-05 08:38:07 +00:00