From 44c8e70f810ad52b0f26f06147d5613ed1271900 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 4 Nov 2018 11:52:03 -0800 Subject: 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. --- parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'parser.c') diff --git a/parser.c b/parser.c index 8212fdd7..11557be8 100644 --- a/parser.c +++ b/parser.c @@ -636,7 +636,7 @@ static val read_file_common(val stream, val error_stream, val compiled) if (compiled && first) { val major = car(form); - if (lt(major, one) || gt(major, three)) + if (lt(major, one) || gt(major, four)) uw_throwf(error_s, lit("cannot load ~s: version number mismatch"), stream, nao); -- cgit v1.2.3