From 53f92425856734cb680525f3d4ede2a7b3e3dde3 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 19 Jun 2025 21:28:26 -0700 Subject: compiler: opt-tail-calls compiler option. * stdlib/comp-opts.tl (compile-opts): New slot, opt-tail-calls. (%warning-syms%): Variable removed; this just lists the slots of compile-opts, which can be obtained with the slots function. Moreover, it is badly named, since there is now a non-diagnostic option. (*compile-opts*): Specify an initial value of : for opt-tail-calls. This means that *opt-level* controls whether it is enabled. * stdlib/compiler.tl: Update comment about optimization levels, since level 2 now does tail calls. (compiler comp-lambda-impl): Only enable tail calls if the option has the default value : and *opt-level* is at least two, or else if the option has value t. (with-compile-opts): Recognize : as valid option value. Don't refer to %warning-syms% but the slots of compile-opts. We use load-time to avoid calculating this repeatedly. The wording of the error message has to be adjusted since not all options are diagnosic any more. * autoload.c (compiler_set_entries): Add opt-tail-calls to slot-name autoload triggers for the compiler module. * txr.1: Mention tail calls and the opt-tail-calls option in the description of *opt-level* 2. Document opt-tail-calls under compile-opts section. We describe what tail calls are there and also adjust the wording since not all options diagnostic. Describe the three-valued system for code generation options. --- autoload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'autoload.c') diff --git a/autoload.c b/autoload.c index 1f513829..64db4901 100644 --- a/autoload.c +++ b/autoload.c @@ -686,7 +686,7 @@ static val compiler_set_entries(val fun) }; val slname[] = { lit("shadow-fun"), lit("shadow-var"), lit("shadow-cross"), - lit("unused"), lit("log-level"), nil + lit("unused"), lit("log-level"), lit("opt-tail-calls"), nil }; autoload_sys_set(al_struct, sys_name, fun); autoload_set(al_struct, sname, fun); -- cgit v1.2.3