diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-11-04 11:52:03 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-11-04 11:52:03 -0800 |
commit | 44c8e70f810ad52b0f26f06147d5613ed1271900 (patch) | |
tree | 6ac8814ce1c8f5a7f2159e19f53f530a072b3aa1 /vm.c | |
parent | 167ae958a8a4376703ade38a8f9c56763e3626f3 (diff) | |
download | txr-44c8e70f810ad52b0f26f06147d5613ed1271900.tar.gz txr-44c8e70f810ad52b0f26f06147d5613ed1271900.tar.bz2 txr-44c8e70f810ad52b0f26f06147d5613ed1271900.zip |
compiler: optimize dwim.
* share/txr/stdlib/asm.tl (op-getf): Rename to op-oldgetf.
This opcode becomes obsolescent.
(op-getf): New opcode.
* share/txr/stdlib/compiler.tl
(assumed-fun): New global variable.
(compiler comp-fun): Use the new getf instruction which takes
a function table index instead of a data table index.
(compiler comp-lisp1-value): Don't use getl1 opcode any more
for dynamic lisp1-style lookup. Instead, we bake the behavior
at compile time perform a function lookup if the symbol is
completely unbound, a variable lookup if it is bound to a
variable (where we decide at compile tie whether it is lexical
or dynamic) or else a function if a function binding exists at
compile time. Also, if we assume that an unbound symbol is a
function, put it on the assumed-fun list.
(compiler comp-dwim): If the first argument is a symbol
with no lexical binding, and is not bound as a variable, then
treat it as a function by transforming the form into a
function call form with that symbol in the car position.
Put the symbol on the assumed-fun list.
(compiler-emit-warnings): New function.
(with-compilation-unit): Call compiler-emit-warnings when
bailing out of most enclosing compilation unit.
(%tlo-ver%): Bump compiled file version to 4, since
we added an opcode.
* vm.c (vm_execute): Follow rename of GETF to OLDGETF.
Implement the new GETF.
* parser.c (read_file_common): Extend version range to allow
version 4 compiled files.
* txr.1: Documented everything.
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -991,7 +991,7 @@ NOINLINE static val vm_execute(struct vm *vm) case GETV: vm_getsym(vm, insn, lookup_var, lit("variable")); break; - case GETF: + case OLDGETF: vm_getsym(vm, insn, lookup_fun, lit("function")); break; case GETL1: @@ -1024,6 +1024,9 @@ NOINLINE static val vm_execute(struct vm *vm) case SETLX: vm_settab(vm, insn, lookup_var, lit("variable")); break; + case GETF: + vm_gettab(vm, insn, lookup_fun, lit("function")); + break; default: uw_throwf(error_s, lit("invalid opcode ~s"), num_fast(opcode), nao); } |