summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-11 01:27:44 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-11 01:27:44 -0800
commit512fa869e31d3fde5eb9422a5ed46e3fec58c94a (patch)
treec75c916943bd5a23ef22870144a41c2a3994a95b /parser.c
parent4e32c77f590b5191d488da142d3009522f0127ba (diff)
downloadtxr-512fa869e31d3fde5eb9422a5ed46e3fec58c94a.tar.gz
txr-512fa869e31d3fde5eb9422a5ed46e3fec58c94a.tar.bz2
txr-512fa869e31d3fde5eb9422a5ed46e3fec58c94a.zip
compiler: frame-eliminating optimization.
This optimization identifies let blocks whose variables are not captured by closures. The variables are relocated to registers and the frame M N ... end reg wrapping is removed. * parser.c (read_file_common): Load version 6 files. We remain backwards-compatible. * share/txr/stdlib/compiler.tl (var-spy, capture-var-spy): New structure types. (struct compiler): New slot, var-spies. (with-var-spy): New macro. (compiler (alloc-new-treg, unalloc-reg-count, push-var-spy, pop-var-spy)): New methods. (compiler (comp-atom, compt-setq, comp-list-setq, comp-lisp1-value)): Inform the spies in the spy notification stack about assignments and accesses. (compiler eliminate-frame): New method. (compiler comp-let): Use spies to determine which variables from this frame are captured, and if none are, then use eliminate-frame to rename all the variables to t-registers and drop the frame setup/teardown. (compiler comp-lambda): Set up a capture-var-spy which intercepts accesses and assignments within a lambda, and informs other spies about the captures. (%tlo-ver%): Bump compiled file version to to (6 0), because of some behavioral changes necessary in the VM. We might revert this if the issues are solved differently. * vm.c (vm_getz): Do not null out T registers. (vm_execute_toplevel, vm_execute_closure): Use zalloca to allocate the register part of the frame, so T registers are initialized to nil.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parser.c b/parser.c
index d0c60578..5282b75f 100644
--- a/parser.c
+++ b/parser.c
@@ -741,7 +741,7 @@ static val read_file_common(val self, val stream, val error_stream, val compiled
if (compiled && first) {
val major = car(form);
- if (lt(major, one) || gt(major, num_fast(5)))
+ if (lt(major, one) || gt(major, num_fast(6)))
uw_throwf(error_s,
lit("cannot load ~s: version number mismatch"),
stream, nao);