summaryrefslogtreecommitdiffstats
path: root/share
Commit message (Collapse)AuthorAgeFilesLines
...
* debugger: initial backtrace support.Kaz Kylheku2019-04-161-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * debug.c (debug_state): Switch to unsigned, since this is now a bitmask. (sys_print_backtrace_s): New symbol variable. (dbg_clear, dbg_set, dbg_restore): New static functions. (debug_init): Initialize sys_print_backtrace_s. Register dbg-clear, dbg-set, dbg-restore intrinsics. Register dbg-enable, dbg-step, dbg-backtrace and dbg-all bitmask variables, Lisp equivalents of DBG_ENABLE, DBG_SETP, DBG_BACKTRACE and DBG_ALL. (debug_dump_backtrace): New function. * debug.h (opt_debugger): Declaration removed. (debug_state): Declaration updated. (DBG_ENABLE, DBG_STEP, DBG_BACKTRACE, DBG_ALL): New preprocessor symbols. (debug_set_state): Inline function removed. (debug_clear, debug_set, debug_restore): New inline functions. (dbg_backtrace, dbg_fcall_begin, dbg_fcall_end): New macros. (debug_dump_backtrace): Declared. * eval.c (error_trace): Invoke debug_dump_backtrace if support is compiled in and backtraces are enabled. * lib.c (do_generic_funcall): New function, copy of generic_funcall. (generic_funcall): Now a wrapper for do_generic_funcall which registers fcall frames if backtrace support is enabled. (funcall, funcall1, funcall2, funcall3, funcall4): Route to slow generic_funcall path if backtraces are enabled. * lisplib.c (debugger_instantiate, debugger_set_entries): New static functions. (lisplib_init): Autload support for debug module via above new functions. (lisplib_try_load): Save and restore debugger state in new way using debug_set and debug_restore, with specific mask values. * parser.y (parse_once): Disable debugging in new way. * share/txr/stdlib/debug.tl New file. * sighal.h (EJ_DBG_MEMB, EJ_DBG_SAVE, EJ_DBG_REST): New macros for saving/restoring debug state. (EJ_OPT_MEMB, EJ_OPT_SAVE, EJ_OPT_REST): Reference the above macros to include debug state in extended jump context. * txr.c (help): Document --backtrace and that that -d implies --backtrace. (txr_main): Enable debugger using debug_set. Provide new --backtrace option to enable backtraces only. * unwind.c (args_s): New symbol variable. (fcall_frame_type): New static variable. (unwind_to_exit_point): Save pointer to original frame stack and restore it when calling error_trace. This is so that error_trace can walk the stack to collect a backtrace. (uw_find_frames_by_mask, uw_push_fcall): New functions. (uw_late_init): Initialize args_s and fcall_frame_type. gc-protect fcall_frame_type. Register uw-* variables corresponding to the UW_* frame types. * unwind.h (uw_frtype_t): New enum constant UW_FCALL. (struct uw_fcall): New frame structure. (union uw_frame): New member fc. (uw_push_fcall, uw_find_frames_by_mask): Declared.
* compiler: frame level mismatch bug.Kaz Kylheku2019-04-161-1/+1
| | | | | | | | | | | | | | | | | | Repro test case: (defvar v) (defun f (: (v v))) (call (compile 'f)) ;; blows up * share/txr/stdlib/compiler.tl (compiler comp-lambda): The specials variable is wrongly used as a Boolean to decide whether we need an extra environment level for specials. The problem occurs when all of the specials are optional parameters. Optionals are handled specially and removed from the specials list. If all the specials are optional parameters, then the special list becomes empty. This cannot be intepreted as "there are no specials". The correct Boolean which indicates "there are specials" is need-dframe.
* compiler: stray debug print.Kaz Kylheku2019-04-161-1/+0
| | | | | | | * share/txr/stdlib/compiler.tl (compiler comp-lambda): Stray prinl removed, issued in the rare case when the present flag parameter of an optional parameter is present and is a special var.
* New catch** macro.Kaz Kylheku2019-04-101-0/+14
| | | | | | | | | * lisplib.c (except_set_entries): Autoload for catch** symbol. * share/txr/stdlib/except.tl (catch**): New macro. * txr.1: Document catch** macro, and the desc slot of the catch-frame struct.
* exceptions: allow description field in catch frames.Kaz Kylheku2019-04-103-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (op_catch): Extra argument in sys:catch syntax specifies an expression that evaluates to a description field. (expand_catch): Expand the desc expression in sys:catch syntax. * parser.c (read_file_common): Increase acceptance of compiled files from versions 1-4 to 1-5, since we are now marking compiled files with version 5.0 rather than 4.0. * share/txr/stdlib/asm.tl (op-catch catch): Support new argument in the opcode syntax. Turns out we have a spare field in the instruction format which was previously set to zero We can use that for the description. Thus, the instruction set and VM remain backward compatible: old code works. * share/txr/stdlib/compiler.tl (compiler comp-catch): Handle the desc argument introduced into the sys:catch form. We must compile it as an expression, then inject the code into the instruction template, and reference the output register of that code block in the catch instruction. (%tlo-ver%): Bump up the compiled file version to 5.0. * share/txr/stdlib/except.tl (usr:catch, catch*): Add desc argument to generated sys:catch form, specifying it as nil. * unwind.c (desc_s): New symbol variable. (uw_find_frames_impl): Set the desc member of the extracted catch structure from the corresponding field in the catch frame. (uw_late_init): Initialize desc_s with interned symbol. Add desc slot to catch-frame type. * unwind.h (struct uw_catch): New member, desc. (uw_catch_begin_w_desc): New macro. * vm.c (vm_catch): Extract the desc field from the catch instruction, and use uw_catch_begin_w_desc to propagate that to the catch frame.
* compiler: better shared test for sys:switch.Kaz Kylheku2019-04-051-1/+6
| | | | | | | | | * share/txr/stdlib/compiler.tl (compiler comp-switch): The shared test here is both inaccurate and O(n^2). It tests that all the remaining branches of the code are tails of the first branch. However, this is not strict enough: we need to also test that the tails are in their order of appearance. We can do that in O(n) time.
* Version 215.txr-215Kaz Kylheku2019-03-301-1/+1
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* Version 214.txr-214Kaz Kylheku2019-03-221-1/+1
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* Version 213.txr-213Kaz Kylheku2019-03-081-1/+1
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* defset: eliminate the get-form argument.Kaz Kylheku2019-03-081-26/+33
| | | | | | | | | | | | | * share/txr/stdlib/defset.tl (defset-expander): Drop getform argument. Obtain the arguments of the place in a variable called args, which is then explicitly destructured with tree-case to match the params list. Having all of the original arguments in args, we can work backwards to replace some of them with gensyms. The resulting gensym-ized list is used to generate the access call to the operator named by name. * txr.1: Update doc to get rid of get-form. Updated and corrected the long form example.
* defset: support improper list places.Kaz Kylheku2019-03-081-4/+7
| | | | | | | | | | | * share/txr/stdlib/defset.tl (defset-expander): Check for restpar being an atom and handle differently. We still don't handle the case where (b . c) is matched against a rest parameter; in this case the mapcar will process an improper list. I.e. the improper form must have an atom which matches the position of the rest parameter. * txr.1: Updated.
* defset: support parameter macros.Kaz Kylheku2019-03-081-15/+17
| | | | | | | | | | | * defset.tl (defset-expander): Add logic to expand parameter list to determine additional paramters that may come out of the expansion, as well as additional symbols that may be visible as a result as a result of processing in the expanded body. These symbols are included in the same way as original the original parameters. * txr.1: Documented defset's support for parameter list macros.
* New macro: defset.Kaz Kylheku2019-03-062-2/+102
| | | | | | | | | | | | | | * lisplib.c (defset_instantiate, defset_set_entries): New static functions. (lisplib_init): Register auto-load of defset.tl, keyed on defset symbol. * share/txr/stdlib/defset.tl: New file. * share/txr/stdlib/paramt.tl (param-parser-base opt-syms): New method. * txr.1: Documented.
* compiler: use new load-for.Kaz Kylheku2019-03-021-2/+1
| | | | | * share/txr/stdlib/compiler.tl: use load-for macro to load the param module.
* compiler: fix (fun (lambda ...)).Kaz Kylheku2019-02-281-4/+8
| | | | | | | | * share/txr/stdlib/compiler.tl (compiler comp-fun): Recognize a lambda expression argument. The neglect to do this is causing a miscompilation of (fun (lambda ...)) to a single getf instruction that processes raw syntax at run time and yields an interpreted lambda.
* compiler: fix broken inline lambda.Kaz Kylheku2019-02-281-6/+9
| | | | | | | | | | | | | | * share/txr/stdlib/compiler.tl (lambda-apply-transform): Fix failure to bind the additional expresions to the rest variable, causing a too many arguments error to be reported. That is ((lambda (. x)) 1) would fail to compile. When binding the trailing fixed arguments to rest, we also pull in the apply list; this matches interpreted behavior, for instance ((lambda (a . b) (list a b)) 1 2 . 3) must return (1 (2 . 3)). In this case, the 3 comes into this function as (3) via the apply-list-expr argument; if we don't include that and bind only the remaining fix-args, then we get the output (1 (2)).
* compiler: fix (apply (fun (lambda ..))).Kaz Kylheku2019-02-281-1/+1
| | | | | | | * share/txr/stdlib/compiler.tl (compiler comp-fun-form): Fix an instance of sym not being unquoted into the quasiquote template, causing the compiler to compile a call to the nonexistent function called sym.
* compiler: move parameter parsing to separate file.Kaz Kylheku2019-02-282-38/+68
| | | | | | | | | | Some upcoming work is going to use these structures. * share/txr/stdlib/compiler.tl (param-parser-base fun-param-parser, mac-param-parser): These struct definitions move to param.tl. * share/txr/stdlib/param.tl: New file.
* asm: getlx, setlx: disassembler bug.Kaz Kylheku2019-02-271-2/+2
| | | | | * share/txr/stdlib/asm.tl (op-getlx dis, op-setlx dis): Decode the small operand destination field correctly as such.
* Version 212.txr-212Kaz Kylheku2019-02-241-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* compiler: prof instruction tries to modify t0.Kaz Kylheku2019-02-191-2/+2
| | | | | | | | | | * share/txr/stdlib/compiler.tl (compiler comp-prof): We must use the incoming oreg as the destination for prof, and not try to use output register indicated by the compiled fragment. That fragment may indicate nil as its output, which we may not clobber. Since we are telling the sub-compile to try to put the fragment's output into our oreg, in most cases they still get merged so a single register is re-used.
* struct: optimizations in new operator.Kaz Kylheku2019-02-191-2/+4
| | | | | | | | | | * share/txr/stdlib/struct.tl (new): Use struct-from-args and struct-from-plist whenever possible; don't use make-struct unless the syntax specifies both BOA and plist arguments. Using struct-from-plist instead of make-struct means we can now entirely avoid consing a list in compiled code. Code like (new point x 0 y 0) now allocates nothing but the struct.
* Version 211.txr-211Kaz Kylheku2019-02-181-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* save-exe: new function.Kaz Kylheku2019-02-171-0/+38
| | | | | | | | | | | | | | * lisplib.c (save_exe_instantiate, save_exe_set_entries): New static functions. (lisplib_init): Register auto-load of save-exe module, keyed to save-exe symbol. * share/txr/stdlib/save-exe.tl: New file. * txr.1: Removing txr-embedded-arg.txr documentation and documenting save-exe in its place. * txr-embedded-arg.txr: File removed.
* Version 210.txr-210Kaz Kylheku2019-02-141-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Version 209.txr-209Kaz Kylheku2019-02-081-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* compiler: new dump-compiled-objects function.Kaz Kylheku2019-02-011-6/+30
| | | | | | | | | | | | | * lisplib.c (compiler_set_entries): Register dump-compiled-objects for auto-loading. * share/txr/stdlib/compiler.tl (usr:dmp-to-tlo): New function. (compile-file): Code to be shared with dump-compiled-objects moved into dump-to-tlo function. (usr:dump-compiled-objects): New function. * txr.1: Documented.
* compiler: de-dupe strings and bignum literals.Kaz Kylheku2019-01-311-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's squash duplicate strings and bignum integers in the virtual machine data tables. We can safely do it for these objects. For lists and vectors, things are tricky because these aggregates can contain circularity; so we leave those alone for now. Text processing code can generate a lot of duplicate strings. For instance `@a @b @c` generates three copies of the " " literal. * share/txr/stdlib/compiler.tl (*dedup*): New special variable. This is our de-dupe table, but it is globally nil, so that we don't retain cruft between compile jobs. (dedup): New function. (get-dreg): Map the incoming object through dedup. (dreg-key): New function. This converts a literal object to key for the dreg hash. Objects that can be de-duped represent themselves. Objects that cannot be de-duped are keyed by a gensym. (compiler get-dreg): Use dreg-key to reduce the incoming object to a key, and work with that, with the effect that strings, characters and numbers in the data table get de-duped: multiple occurrences of a character, string or number in the code get the same dreg. (usr:compile-toplevel, usr:with-compilation-unit): Establish a dedup hash for the dynamically enclosed compile job. If one is already established by the surroundign dynamic environment, then use that one, otherwise create a new hash.
* Version 208.txr-208Kaz Kylheku2019-01-281-1/+1
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Version 207.txr-207Kaz Kylheku2019-01-261-1/+1
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* disassemble: tidier data table.Kaz Kylheku2019-01-261-1/+1
| | | | | | * share/txr/stdlib/asm.tl (dissassemble-cdf): Print the rows of the data table with simple numeric offsets, with no d prefix or leading zeros.
* Version 206.txr-206Kaz Kylheku2019-01-181-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Copyright year bump 2019.Kaz Kylheku2019-01-1632-32/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl, share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl, share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl, share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl, share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl, share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl, signal.c, signal.h, socket.c, socket.h, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr: Extended Copyright line to 2018.
* ffi: diagnose missing with-dyn-lib.Kaz Kylheku2019-01-161-24/+23
| | | | | | | | | | | | | | | If the programmer writes a deffi, deffi-sym or deffi-var that makes simple references, and that macro is not wrapped in with-dyn-lib, an unhelpful error message results about sys:ffi-lib being unbound. We can detect this situation and provide a warning. * share/txr/stdlib/ffi.tl (sys:with-dyn-lib-check, sys:expand-sym-ref): New functions. (deffi, deffi-sym, deffi-var): Capture environment parameter. Common code replaced by call to sys:expand-sym-ref, where the missing sys:ffi-lib situation is diagnosed. This is only done in cases when the simple reference syntax occurs.
* Version 205.txr-205Kaz Kylheku2019-01-151-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* asm: fix wrong level check in operand parsing.Kaz Kylheku2019-01-091-1/+1
| | | | | | | | * share/txr/stdlib/asm.tl (parse-compound-operand): The index of a (v <lev> <index>) operand must be compard to the maximum index constant, not to the maximum level constant. This bug will prevent compiling frames that have more than 64 variables, which is a serious limitation from 1024.
* asm: fix incorrect level check in frame opcode.Kaz Kylheku2019-01-091-2/+2
| | | | | | * share/txr/stdlib/asm.tl (op-frame): Check the level of the operand against %max-v-lev%, not %max-lev-idx%, which gives the maximum index within a level.
* asm/compiler: fix incorrect frame-related constant.Kaz Kylheku2019-01-091-1/+1
| | | | | | * share/txr/stdlib/vm-param.tl (%max-lev-idx%): The maximum index within a level is one less than the maximum level size, not two less. Use pred rather than ppred to derive it.
* asm/compiler: rename small level/index constants.Kaz Kylheku2019-01-092-3/+4
| | | | | | | | | | | | | | | | * share/txr/stdlib/vm-param.tl (%max-sm-lev-idx%): This constant is named inconsistently relative to %max-lev-idx%. It is providing the maximum level (encodable in a small operand), whereas %max-lev-idx% provides the maximum index within a level. It is hereby renamed to %max-sm-lev%. The %max-sm-lev-idx% name is re-used to denote the quantity which it suggests: the maximum index within a level (encodable in a small operand), which is 63. * share/txr/stdlib/asm.tl (small-op-p): Use the new %max-sm-lev-idx% in place of %sm-lev-size%, getting rid of the funny range starting with -1. Replace the original %max-sm-lev-idx% with its new name, %max-sm-lev%.
* Version 204.txr-204Kaz Kylheku2018-12-171-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* compiler: move variable down in file.Kaz Kylheku2018-12-131-2/+2
| | | | | | * share/txr/stdlib/compiler.tl (assumed-fun): This variable shouldn't be the first item in the compiler. It is moved after the definitions of structs and important constants.
* Version 203.txr-203Kaz Kylheku2018-11-291-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Version 202.txr-202Kaz Kylheku2018-11-221-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* compiler: use binary versions of common math functions.Kaz Kylheku2018-11-161-0/+17
| | | | | | | | | | | | | | | * arith.c (arith_init): Register functions in the sys package: b<, b>, b<=, b=, b+, b-, b*, b/ and neg. * share/txr/stdlib/compiler.tl (%nary-ops%, %bin-ops%, %bin-op%): New global variables. (compiler comp-fun-form): Transform two-argument calls to any of the variadic functions in %nary-ops% functions into calls to their binary counterpart. These calls are faster, since they bypass the wrapper which deals with the variable argument list. Also, we detect unary - and map it to the new sys:neg function, and reduce the one-argument cases of certain functions to noops.
* compile: handle functions that have environments.Kaz Kylheku2018-11-131-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this patch, the compile function can handle interpreted function objects that have captured environments. For instance, if the following expression is evaluated (let ((counter 0)) (labels ((bm () (bump)) (bump () (inc counter))) (lambda () (bm)))) then a function object emerges. We can now feed this function object to the compile function; the environment will now be handled. Of course, the above expression is already compileable; compile-toplevel handles it and so does the file compiler. This patch allows the expression to be interpreted and then the function object to be compiled, without access to the surrounding expression. The compiled function will contain a compiled version of the environment, carrying compiled versions of the captured variables and their contents. * eval.c (env_vbindings, env_fbindings, env_next): New static functions. (eval_init): Register env-vbinding, env-fbindings and env-next intrinsics. * share/txr/stdlib/compiler.tl (sys:env-to-let): New function. (usr:compile): Wrap the interpreted lambda terms with let bindings carefully reconstructed from their captured environments. * txr.1: Documented new intrinsic functions.
* Version 201.Kaz Kylheku2018-11-071-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* compiler: bugfix: handle defpackage and such properly.Kaz Kylheku2018-11-051-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that the file compiler is emitting one big form that contains all of the compiled top-level forms. For obvious reasons, this doesn't work when that form contains symbols that are in a package which is defined by one of those forms; the compiled file will not load due to qualified symbols referencing a nonexistent package. The solution is to break up that big form when it contains forms that manipulate the package system in ways that possibly affect the read time of subsequent forms. * lib.c (delete_package): Use a non-destructive deletion on the *package-alist*, because we are going to be referring to this variable in the compiler to detect whether the list of packages has changed. * share/txr/stdlib/compiler.tl (%package-manip%): New global variable. This is a list of functions that manipulate the package system in suspicious ways. (user:compile-file): When compiling a form which is a call to any of the suspicious functions, add a :fence symbol into the compiled form list. Also do this if the evaluation of the compiled form modifies the *package-alist* variable. When emitting the list of forms into the output file, remove the :fence symbols and break it up into multiple lists along these fence boundaries. * txr.1: Documented the degenerate situation that can arise.
* Version 200.txr-200Kaz Kylheku2018-11-051-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* compiler: optimize dwim.Kaz Kylheku2018-11-042-17/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* The code expander becomes a public API.Kaz Kylheku2018-11-023-13/+11
| | | | | | | | | | | | | | | | | | | | | | | The functions sys:expand, sys:expand* and sys:expand-with-free-refs are now in the usr package and documented for public use. * eval.c (eval_init): Move registrations of the symbools expand, expand* and expand-with-free-refs from the system package to the user package. * share/txr/stdlib/awk.tl (sys:awk-mac-let, awk): Uses of sys:expand drop the sys: prefix. * share/txr/stdlib/op.tl (sys:op-alpha-rename): Likewise. * share/txr/stdlib/place.tl (call-upudate-expander, call-clobber-expander, call-delete-expander, sys:placelet-1): Likewise. * tests/011/macros-2.txr, tests/012/struct.tl: Likewise. * txr.1: Documented expand, expand* and expand-with-free-refs.