diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-01-29 21:59:23 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-29 21:59:23 -0800 |
commit | 1be771848455687da7a3a96a159f75a6a5bde9f1 (patch) | |
tree | 9e9cf4d206a70b74237da98b6485de45ef2c6da8 /tests/015/trim.expected | |
parent | 58c1642901889829eb55ceea2ae868dea848eab9 (diff) | |
download | txr-1be771848455687da7a3a96a159f75a6a5bde9f1.tar.gz txr-1be771848455687da7a3a96a159f75a6a5bde9f1.tar.bz2 txr-1be771848455687da7a3a96a159f75a6a5bde9f1.zip |
matcher: prune @nil in cons and vector matches.
Elimination of unused temporaries is really the job of the
compiler, but we can do some simple things to get better code
from the matcher in the meanwhile. In list and vector matches,
@nil gets used just for placeholding. We can avoid generating
the code which binds the corresponding value to an unused
gensym.
share/txr/stdlib/match.tl (compile-var-match): When the
variable is nil, then do not generate a match-guard with
empty content. Just generate an empty guard-chain.
The higher level compiler can then check for this empty guard
chain and prune its own material away.
(compile-vec-match, compile-cons-structure): Eliminate every
gensym and its initializing expression, whose corresponding
compiled sub-match has an empty guard chain.
Diffstat (limited to 'tests/015/trim.expected')
0 files changed, 0 insertions, 0 deletions