Commit graph

38 commits

Author SHA1 Message Date
Marius Gerbershagen
b8bd5f4026 cmp: fix constant folding
Fixes a regression introduced in commit
816c08340b. After the changes in that
commit, c1forms of name variable can denote constants as well.

Since we are now more aggressive with inlining constant access, we
have to fix a bad defconstant definition in clos/boot.lsp as well (the
new definition makes sure that the compile-time and load-time
evaluations of the constant are eql).
2025-11-15 16:52:31 +01:00
Daniel Kochmański
3ae6fadac7 cmp: small changes to c1form-*-p
c1form-movable-p uses c1form-pure-p

  The predicate opencoded the exact body of the latter.

c1form-unmodified-p does not explicitly check for global-var-p

  The function VAR-CHANGED-IN-FORM-LIST takes care of special and global
  variables, so there is no need for an explicit check. When the variable is
  global and no form has sp-change, then it is still unmodified.
2024-01-26 12:07:20 +01:00
Daniel Kochmański
63ca129a79 cmp: cleanup: use with-c1form-env in applicable places
c2expr, t2expr, t3function all uses the macro now. That yields gives better
introspection environment and more regular handling.

Additionally bind a new variable *CURRENT-C1FORM*.
2024-01-26 12:07:20 +01: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
Daniel Kochmański
3628a843ab cmp: rename c1form VAR to VARIABLE
This is more consistent with LOCATION and is less likely to be confused with
arguments named var.
2023-11-17 11:21:21 +01: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
523460b874 cmp: cleanup to avoid some forward-references 2023-02-21 16:16:30 +01:00
Daniel Kochmański
b4eeff082d cmp: move refs to a separate file cmprefs
Also load cmptype-arith.lsp much sooner than before.
2023-02-21 16:16:30 +01:00
Marius Gerbershagen
80c53f0e2b cmp: fix (values (values))
This must return nil as a single value while we were returning no
values.
2021-03-18 20:20:35 +01:00
Daniel Kochmanski
48d5420b16 cmp: all baboon have now error message
This is useful for identification, where the problem occured. Also add some
indent and line wrap fixes which are estetic. Comment out unused variable.
2018-02-05 18:11:35 +01:00
Daniel Kochmański
9b82583884 newcmp: remove obsolete newcmp package 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
4d19a27424 cosmetic: untabify
Signed-off-by: Daniel Kochmański <dkochmanski@turtle-solutions.eu>
2015-06-21 14:38:20 +02:00
Juan Jose Garcia Ripoll
d9d6d6864d C2 functions now receive the C1FORM as an argument. 2011-12-28 12:00:01 +01:00
Juan Jose Garcia Ripoll
ecd9dd2470 Implemented type assertions using EXT:COMPILER-TYPECASE so that they can be optimized away. 2011-12-26 20:42:11 +01:00
Juan Jose Garcia Ripoll
c724eacb24 New function c1form-constant-p in src/cmp/cmpform.lsp 2011-12-01 22:25:39 +01:00
Juan Jose Garcia Ripoll
9a10cd1767 Removed obsolete optimizers for PRINC and TERPRI 2011-11-05 20:18:02 +01:00
Juan Jose Garcia Ripoll
1523ae8a5c EXT package created containing the original set of symbols (not yet filtered) and re-exported from SYS 2011-02-27 23:20:12 +01:00
Juan Jose Garcia Ripoll
3994456543 Implemented a type propagation phase 2010-05-26 22:01:55 +02:00
Juan Jose Garcia Ripoll
0a0175d98a Move DELETE-C1FORMS to cmpforms.lsp 2010-05-25 22:16:59 +02:00
Juan Jose Garcia Ripoll
7457f9524d Minor fixes in the inference of C1FORM types 2010-05-23 16:32:36 +02:00
Juan Jose Garcia Ripoll
8a29b98f94 C1FORM-REPLACE-WITH now replaces entirely the form, not just creating a VALUES proxy. 2010-05-19 15:20:59 +02:00
Juan Jose Garcia Ripoll
ef797cb513 Management of variable references, read and set nodes, and type updates is now done through the functions in cmpvar.lsp. 2010-05-19 14:20:17 +02:00
Juan Jose Garcia Ripoll
ae8090a67f When traversing a C1FORM, pay attention to non-cons, non-c1form objects 2010-05-16 17:31:22 +02:00
Juan Jose Garcia Ripoll
0389fe11be When inlining, set the environment to that of the inlined form, to properly capture things like speed / safety optimizations. 2010-05-14 16:08:03 +02:00
Juan Jose Garcia Ripoll
5f1b459879 Move ASSOC from a C1 OPTIMIZED form to a compiler macro 2010-05-13 23:03:53 +02:00
Juan Jose Garcia Ripoll
34233787c6 Replaced the C1 special form for MEMBER with a compiler macro. 2010-05-13 22:34:04 +02:00
Juan Jose Garcia Ripoll
2e3b7b0d6b When replacing variables with their values uses VALUES to extract the first value 2010-05-13 18:18:29 +02:00
Juan Jose Garcia Ripoll
aca68e9fc6 Improve the code generated for VALUES eliminating the intermediate variable when there is only one output value 2010-05-13 17:24:27 +02:00
Juan Jose Garcia Ripoll
7c92b0fc8c The function C1FORM-VALUES-NUMBER is now factored and grouped with the other C1FORM functions in cmpform. 2010-05-13 17:03:28 +02:00
Juan Jose Garcia Ripoll
82898a7e0f We can also replace variables with values that are 'pure' or unmodified by the forms after it 2010-05-13 14:12:15 +02:00
Juan Jose Garcia Ripoll
ffecddc3b9 In principle LET forms can also be moved around 2010-05-13 11:30:11 +02:00
Juan Jose Garcia Ripoll
f6bddc7b0b VALUES forms are more efficiently inlined. 2010-05-13 10:04:37 +02:00
Juan Jose Garcia Ripoll
124e0427ec New function for deciding when and how to replace LET/LET* variables with their values. 2010-05-12 23:44:07 +02:00
Juan Jose Garcia Ripoll
d8dac21c8f The c1form-parents field is now a list of the nodes above the current one. We provide functions to rewrite the list when moving the node and speed up FIND-NODE-IN-LIST using this list. 2010-05-11 17:25:16 +02:00
Juan Jose Garcia Ripoll
6c245096be In the database of C1FORMs, store information about side effects and use the field C1FORM-SIDE-EFFECTS to speed up computation of those. 2010-05-11 16:04:28 +02:00
Juan Jose Garcia Ripoll
db84803241 Create a database of C1FORM types 2010-05-11 15:08:53 +02:00
Juan Jose Garcia Ripoll
6a91d3b45a Refactored code so that it is shared by cmp and new-cmp:
* Use the new proclamations/sysfun.lsp files from the new compiler.
* We split src/cmp/cmpdefs.lsp into cmpdefs, cmppackage, cmptypes and cmpglobals
* Split cmpform.lsp out of cmpmac.lsp
* Merged in {cmp,new-cmp}/cmpc-wt.lsp some of the cmpmac wt routines
* Use functions instead of macros for the WT-* operations
* Split out from *cmp/cmpenv.lsp a file cmppolicy.lsp
* A single file, cmpenv-api.lsp for the manipulation of environments.
* The type comparison functions go into cmptype-arith.lsp and are cached.
* The code that propagates types in function calls goes into cmptype-prop.lsp.
* The remainings of cmpenv go into cmpenv-{declare,proclaim,declaim}.

Associated fixes:
* Fixed typo and wrong proclamation for SI:GET-SYSPROP.
* Fixed typo in SIMPLIFY-ARITHMETIC.
* Explicitely set the debug level when building ECL
* All declarations are stored in the compiler environment.
* Each function and form stores the compilation environment.
* Declaration POLICY-DEBUG-IHS-FRAME is acts only on the function environment.
* Make the definition if ihs_env only happen when it is used.
* Eliminated *notinline*, *inline-functions*  and *function-declarations*
* Slightly more efficient creation of accessors in kernel.lsp
* Remove the proxy C2DECL-BODY
* Fix the order of declarations in SI:PROCESS-DECLARATIONS
* Reimplemented C1BODY using SI:PROCESS-DECLARATIONS
* DECLAIM's proclamation do not propagate beyond the compiled file.
2010-05-05 17:36:19 +02:00