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
Daniel Kochmański
b7ad56faff
cmp: cleanup: remove a misleading comment for VAR-LOC
...
In the past VAR-LOC in the first pass could have a value 'CLB to indicate, that
it can't be allocated on the C stack. But somewhere along the way the structure
gained a separate slot REF-CLB that indicates that and VAR-LOC in the 1st pass
is /always/ OBJECT.
Update comments to reflect that fact and remove no-op assignments.
2023-11-23 08:02:38 +01:00
Daniel Kochmański
b9301789d0
cmp: add a new utility cl:emptyp for collections
2023-11-23 08:02:38 +01:00
Daniel Kochmański
e536bc56ab
cmp: cxx: don't waste space when printing comments
...
We make the line length 80ch and print comment immedietely after "/* ".
2023-11-23 08:02:38 +01:00
Daniel Kochmański
6722d4b9da
cmp: cxx: move the cxx code generator to cmppass2-top
2023-11-23 08:02:38 +01:00
Daniel Kochmański
e287445b98
cmp: exit manager: remove obsolete tags and fix typos
...
- remove tags number and jump (unknown purpose)
- update the comment to include RETURN-{LONG-FLOAT,C?FLOAT}
- fix typos where RETURN-CSFLOAT was repeated thrice
2023-11-23 08:02:38 +01:00
Daniel Kochmański
ec2a74b300
cmp: remove obsolete specialized c1form named CL:RPLACD
...
This c1form is not created nor handled in the compiler anymore.
2023-11-23 08:02:38 +01:00
Daniel Kochmański
b228ae7867
cmp: cleanup: c2mvb: don't create unused local variable
2023-11-23 08:02:38 +01:00
Daniel Kochmański
3f95f88573
cmp: rename C?VAR to C?VARIABLE
2023-11-23 08:02:38 +01:00
Daniel Kochmański
44f33cb251
cmp: cleanup of predicates loc-with-*-p
...
We first explicitly test for an ATOM and after that we use CASE.
2023-11-23 08:02:38 +01:00
Daniel Kochmański
fa9a985b08
cmp: cosmetic changes
2023-11-23 08:02:38 +01:00
Daniel Kochmański
be68897012
cmp: defpackage uses strings instead of uninterned symbols
2023-11-23 08:02:38 +01:00
Daniel Kochmański
d308c5cdfb
cmp: object-type: do not depend on an exact type name
...
Previously object-type first called (TYPE-OF THING) and then matched it with
exact type names. This fails when we have a more precise type, i.e
(type-of 3) -> (integer 3 3)
(eq 'fixnum '(integer 3 3)) -> nil
=>
(object-type 3) -> T
and that left us with subpar optimizations down the road.
2023-11-20 12:22:30 +01:00
Daniel Kochmański
6e161b5f44
cmp: add a comment that explains the purpose of the structure VV
2023-11-20 12:22:22 +01:00
Daniel Kochmański
edfaec9a6b
cmp: add a comment that explains the purpose of OPTIMIZE-CXX-DATA
2023-11-17 11:21:21 +01:00
Daniel Kochmański
1b8d1041dd
cmp: optimize-cxx-data: reorder optimizations
...
Previously we've tried first to add-static-constnat, although that led to a
situation where we've created static constant even if we had that value in the
core. Right now a static constant is the last thing to try when we attempt to
optimize the object. The order is quite arbitrary - the comment before the
function explains that we could avoid coercion with some additional work.
2023-11-17 11:21:21 +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
16a6ef5e04
cmp: group c1form types in a more readable order
2023-11-17 11:21:21 +01:00
Daniel Kochmański
b70fac0112
cosmetic: minor fixes to the compiler
2023-11-17 11:21:21 +01:00
Daniel Kochmański
29d038a93c
cmpc: fix the inliner for cl:expt to return 1 (not 0) for (expt 0 0)
...
The CL standard expects to always return 1 in that case.
2023-11-17 11:21:21 +01:00
Daniel Kochmański
7e63354631
cmpc: constant optimizers: don't create an intermediate location
...
We use now constant optimizers to update existing VV and there is no need to
box them in a location node.
2023-11-17 11:21:21 +01:00
Daniel Kochmański
2e732782ac
cmp: move data inlining to the second pass
...
c1constant-value etc does not attempt to create inlined vv - it is the
responsibility of the data pre-processing pass.
2023-11-17 11:21:21 +01:00
Daniel Kochmański
fb4cd1ef26
cmpc: move more variables to the cxx backend
2023-11-17 11:21:21 +01:00
Daniel Kochmański
2304da9a83
cmpc: separate the data segment creation passes
2023-11-17 11:21:21 +01:00
Daniel Kochmański
debec42950
cmp: cleanup: move the function NEW-LOCAL to cmppass2-fun
2023-11-17 11:21:21 +01:00
Daniel Kochmański
e8f3609078
cmpc: split CALL-UNKNOWN-GLOBAL-LOC to -LOC and -FUN
...
Both variants have distinct and mutually exclusive (based on the code) usages.
Moreover, when dealing with a function name, always use FDEFINITION location.
This is a speculation, but only basic cases were handled with FDEFINITION
because WT-FDEFINITION could only handle symbols in CL package and otherwise a
slower method was used. WT-FDEFINITION can handle now all valid function names
including (SETF FOO) and function names not contained in core packages.
2023-11-17 11:21:21 +01:00