| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl: use load-for macro to
load the param module.
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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)).
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (op-getlx dis, op-setlx dis): Decode
the small operand destination field correctly as such.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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%.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Regenerated.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/op.tl (sys:*op-ctx*) Move definition before
the make-struct-type call which instantiates the sys:op-ctx
structure type, because the variable is referenced in that
expression and treated as lexical. This situation now
generates a warning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (read_file_common): Allow version three
object files.
* share/txr/stdlib/compiler.tl (compiler comp-var): If a
global variable isn't special, then treat it via the getlx
instruction. The symbol gets added to the symtab, and
referenced by index number.
(compiler comp-setq): Similarly, treat a non-special
global variable using the setlx instruction.
(%tlo-ver%): We bump the major version of .tlo files
from 2 to 3, since old txr executables won't recognize
these new instructions. However, we are backward compatible;
hence read_file_common still allows version 2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These instructions can be used for accessing cached global
variable bindings through the symtab of the vm descriptor.
The compiler will use these for optimizing access to global
lexical variables.
* share/txr/stdlib/asm.tl (op-getlx, op-setlx): New opcode
classes.
* vm.c (vm_stab): Take the lookup function as an argument,
so this can be used for variable bindings.
(vm_gcall, vm_gapply): Pass lookup_fun function to vm_stab,
as well as the appropriate string for the unbound error.
(vm_gettab, vm_settab): New static functions.
(vm_execute): Implement GETLX and SETLX using vm_gettab and
vm_settab.
* vmop.h: Regenerated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-code-move-check): A symbol
in the sys: package is being used just for the English word
that its name supplies, so print it using ~a so the sys:
prefix doesn't appear.
|