Commit graph

8617 commits

Author SHA1 Message Date
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
Tarn W. Burton
ac0f992296
Add tests for Gray read-line 2023-12-04 15:23:38 -05:00
Daniel Kochmański
5a5b327124 cmp: t1/c1expr: top-level symbol macro expansions remain top-level 2023-12-04 21:10:00 +01:00
Daniel Kochmański
6db9231366 cmp: t1epxr*: account for top level forms expanding to atoms 2023-12-04 20:59:29 +01:00
Tarn W. Burton
4ede355c26
Allow empty string for EOF in read-line 2023-12-04 13:01:40 -05:00
Daniel Kochmański
af9d9092c8 cmp: add a comment explaning slots in the structure LABEL 2023-11-25 18:50:13 +01:00
Daniel Kochmański
c2057879e4 cmp: utils: introduce a macro with-lexical-scope
This macro introduces a semantical demarcation of an inner lexical scope.
2023-11-25 18:50:13 +01:00
Daniel Kochmański
f57fa4fab3 cmp: set-loc: accept explicit destination argument
Most of the time when we've used SET-LOC we've rebound *DESTINATION* for that
particular operation. Instead of doing so right now the argument is explicit and
when we want to use the *DESTINATION* then we simply use it (literally 2 cases).
2023-11-25 18:50:13 +01:00
Daniel Kochmański
ef4ab04eda cmp: implement foreign data locations
Instead of directly opencoding them in t3-defcallback we take a more organized
approach where we work with locations. This is part of larger refactor.
2023-11-25 18:50:13 +01:00
Daniel Kochmański
ef36cf53e0 cmp: abstract away STACK emitter with a macro
We also get rid of (STACK <int>) exit in favor of an explicit frame. This was
used only by UNWIND-PROTECT for no apparent reason.
2023-11-25 18:50:13 +01:00
Daniel Kochmański
f72726a032 cmp: abstract away FRAME emitter with a macro 2023-11-25 18:50:13 +01:00
Daniel Kochmański
11aa544292 cmp: rewrite c2progn for readibility 2023-11-25 18:50:13 +01:00
Daniel Kochmański
521e815158 cmp: rewrite c2tagbody-body for readibility 2023-11-25 18:50:13 +01:00
Daniel Kochmański
938a757220 cmp: merge operators with-exit-label and with-optional-exit-label
Their core difference was that the latter coudl reuse the destination. We make
the exit argument explicit and optional in with-exit-label.
2023-11-25 18:50:13 +01:00
Daniel Kochmański
62c68c5bbc cmp: factor out emit-entry-fun from ctop-write 2023-11-25 18:50:13 +01:00
Daniel Kochmański
abd109c982 cmp: further rewrite the exit manager for clearity
This commit makes the exit type explicit and removes a need to test the result
of UNWIND-COND.
2023-11-25 18:50:13 +01:00
Daniel Kochmański
c03d856556 cmp: rewrite the exit manager for clearity
This commit rewrites UNWIND-EXIT to explicitly handle conditional jumps. We
remove misleading SET-JUMP-{TRUE,FALSE} and implement them locally.
2023-11-25 18:50:11 +01:00
Daniel Kochmański
f0634e3301 cmp: remove invalid optimization from unwind-exit
The optimization assumed, that we don't need to unwind stacks when there are no
bds nor stack frame changes. That leads to a corrupted IHS environment among
other things.
2023-11-25 18:48:59 +01:00
Daniel Kochmański
38e45ad026 cmp: exit manager has now two main ops UNWIND-EXIT and UNWIND-JUMP
unwind-exit assigns the destination and jumps to the target
unwind-jump ignores the destination and jumps to the target
2023-11-25 18:48:59 +01:00
Daniel Kochmański
4d412cc6f9 cmp: LABEL captures the current *UNWIND-PROTECT* as LABEL-DENV
Thanks to this change we may get rid of explicit TAG-UNWIND-PROTECT slot in
favor of relying on the tag label. Also rename TAG-LABEL to TAG-JUMP to
emphasize similarity to BLK-EXIT.
2023-11-25 18:48:59 +01:00
Daniel Kochmański
2f997ab990 cmp: refactor the exit manager to compute unwind-exit delta 2023-11-25 18:48:59 +01:00
Daniel Kochmański
94148e0e34 cmp: rename the location tag VALUES to VALUEZ
This tag is distinct from the Common Lisp operator so we use a distinct name to
avoid possible confusion.
2023-11-25 18:48:59 +01:00
Daniel Kochmański
55863c3f28 cmp: rename the location tag RETURN to LEAVE
This tag is distinct from the Common Lisp operator so we use a distinct name to
avoid possible confusion.
2023-11-25 18:48:59 +01:00
Daniel Kochmański
b8528d0d1c cmp: exit manager: remove the dead code for typed return locations
We never bind *EXIT* to returns other than 'RETURN.
2023-11-25 18:48:59 +01:00
Daniel Kochmański
2e941b417c cmp: small cleanup of internal errors in the exit manager 2023-11-25 18:48:59 +01:00
Daniel Kochmański
c879cb16c0 cmp: make LABEL an instance (not a cons) 2023-11-25 18:48:59 +01:00
Daniel Kochmański
77f0810d22 cmp: c2catch uses GENSYM instead of incrementing *last-label*
The assigned "code" is only part of the comment, so it is clearly not the label.
2023-11-25 18:48:59 +01:00
Daniel Kochmański
97411d9e32 cmp: unwind-exit: remove unused optional argument
We move jump-p flag to aux variables.
2023-11-25 18:48:59 +01:00
Daniel Kochmański
255e229519 cmp: factor out wt-install-function from c2fset 2023-11-25 18:48:59 +01:00
Daniel Kochmański
cebb13f979 cmp: don't allow for t2expr arguments not being c1forms. 2023-11-25 18:48:59 +01:00
Daniel Kochmański
51da30dd61 cmp: move build-debug-lexical-env to cmppass2-var 2023-11-25 18:48:59 +01:00
Daniel Kochmański
0041e7d8da cmp: use correctly with-exit-label
Previusly we've duplicated some code with regard to this macro, most notably
we've bound *exit* separately to label instead of passing it as a first arg.
2023-11-25 18:48:59 +01:00
Daniel Kochmański
7541d813ea cmp: improve code locality in cmppass2-var 2023-11-25 18:48:59 +01:00
Daniel Kochmański
cd936a36f4 cmp: update *destinations* description and remove dead code 2023-11-25 18:48:59 +01:00
Daniel Kochmański
af3d3a00c8 cmp: with-compiler-env: handle COMPILER-INTERNAL-ERROR first
We've handled COMPILER-ERROR before COMPILER-INTERNAL-ERROR, but the latter is
a subclass of the former, so it was never triggered.
2023-11-25 18:48:59 +01:00
Daniel Kochmański
3f2f935411 cmp: minor changes to emit-functions 2023-11-25 18:48:59 +01:00
Daniel Kochmański
e54b944e7a cmp: don't refer to module functions as local-funs
It is a historical baggage from before FSET. Functions stored in *local-funs*
are both local and global, so sipmly rename it to *functions*.
2023-11-25 18:48:56 +01:00
Daniel Kochmański
746f853b70 cmp: remove unused mechanism for "sharing" function bodies 2023-11-23 08:02:38 +01:00