diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-07-16 23:40:26 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-07-16 23:40:26 -0700 |
commit | 858aa11f2dbd5db5245bd3a0b1aa5fe9d91c7f65 (patch) | |
tree | ad88dc5233a908ba64539c1067698f2d01cade57 /tests | |
parent | 339d41fabd0f41e2c1008d38f215327cc36af783 (diff) | |
download | txr-858aa11f2dbd5db5245bd3a0b1aa5fe9d91c7f65.tar.gz txr-858aa11f2dbd5db5245bd3a0b1aa5fe9d91c7f65.tar.bz2 txr-858aa11f2dbd5db5245bd3a0b1aa5fe9d91c7f65.zip |
Simplify top-level variable and function environments.
Since their inception, the top_fb and top_fb hashes associated
symbols with bindings cells, causing an extra cons cell to be
allocated for each entry. I don't remember why this is. It
might have been that way so that gethash(top_fb, sym) would
return a cell when the variable exists, or else nil. This was
before we had functions like gethash_e and inhash that return
the hash cell itself. A hash cell is also a cons and can serve
as a binding just fine by itself.Let's make it so.
For now, the macro and symbol macro environments stay the
way they are; I will likely convert them also.
* eval.c (env_fbind, env_vbind, lookup_global_var, lookup_sym_lisp1,
lookup_fun, func_get_name, rt_defv, rt_defun, set_symbol_value,
reg_fun, reg_varl): Update all these functions so they treat the
hash cell from top_vb or top_fb as the binding cell, rather than
putting or expecting the cdr of that cell (i.e the hash value)
to be a binding cell.
* hash.[ch] (gethash_d): New function. Jus gethash_e without the
pesky self argument, that would only be needed for error
reporting if we pass an object that isn't a hash.
* stdlib/place.tl (sys:get-fun-getter-setter, sys:get-vb):
These two functions must be adjusted since they refer to the
top-fb and top-vb variables. sys:get-vb isn't used anywhere;
it continues to exist in order to provide run-time support
to files that were compiled with an buggy version of the
symbol-value place.
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions