| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler compile): The message
will show (car form) followed by a colon, so the wording
should refer to that object rather than the entire form.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Expose raw expand function as
sys:expand*, since sys:expand squelches warnings.
* share/txr/stdlib/compiler.tl (usr:compile-toplevel): Use
expand* instead of expand.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler compile): Add
sys:quasi case, dispatching new comp-quasi method.
(compiler comp-quasi): New method.
(expand-quasi-mods, expand-quasi-args, expand-quasi): New
functions.
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-lambda): When
we have specials we must generate an extra (end ...), to
terminate the (dframe ...) that we inserted.
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-lambda): Frame
size can't be calculated from nfixed, because that doesn't
account for the extra variables in optional parameters.
It can't be calculated from the number of lexical variables
either, because parameters that are special variables consume
vXXYY frame entries without being counted as lexicals.
Rather, the accurate frame size is given to us by the value
of the counter in the newly created environment.
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (compiler_instantiate, compiler_set_entries): New
static functions.
(lisplib_init): Register auto-load for compiler via new
functions.
* share/txr/stdlib/compiler.tl: New file.
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl: block comment with copyright and
BSD license added.
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (op-close asm): Check that the list
of registers has the right number of registers indicated by
the previous operands.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (op-ifq, op-ifql): New opcode
types.
* vm.c (vm_ifq, vm_ifql): New static functions.
(vm_execute): Handle IFQ and IFQL opcodes.
* vmop.h (vm_op_t): Regenerated.
|
|
|
|
|
|
|
|
|
|
|
| |
push doesn't unconditionally require a temporary location for
operational correctness; a temporary is used only for
evaluation order. Therefore it is safe to use alet
to eliminate the temporary when (after all expansion) the
item is a trivial symbolic expression.
* share/txr/stdlib/place.tl (push): Use alet to bind the
temp which holds the new item.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (op-block, op-catch): Some operands
that are destinations need to be parsed as "d", so the
assembler diagnoses invalid destinations. Otherwise we don't
catch the problem until VM run time.
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (assembler asm): Allow
instruction 0 to have a label L labeled by checking for the
range 0 <= L < N.
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (parse-compound-operand): Add the
forgotten increment by two to the level number of the v
operand, since (v 0 n) is in the third display level.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (asm_set_entries): Autoload on usr:disassemble.
* share/txr/stdlib/asm.tl (assembler): Drop initializer
from bstr slot. Requires complex initialization for the
case when the buf is supplied by the constructor caller
for the sake of disassembling existing code.
(assembler :postinit): Handle cases when only one of
buf or bstr are set, and when both are not set,
for the greatest flexibility.
(disassemble-c-d, disassemble): New functions.
* vm.c (vm_desc_datavec): New static function.
(vm_init): Registered vm-desc-datavec intrinsic.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (assembler dis-listing): Use
tostringp when converting the opcode and arguments to text, so
package prefixes won't be shown when the current package isn't
sys.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (parse-args): Include the type spec
in the diagnostic for invalid type spec.
(op-setv): Fix use of invalid type spec s, which should
be rs.
|
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (assembler): All :method definitions
and the :postinit become defmeth forms outside of the
defstruct.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (sys:defmeth): Rename
function to sys:define-method. Otherwise it hides
usr:defmethod when the current package is sys.
(defmeth): Refer to sys:define-method rather than
sys:defmeth.
|
|
|
|
|
|
|
|
|
|
|
|
| |
In additon to the encoded notation like t13 and v013f,
we allow forms like (t 19) and (v 1 63) which
mean the same thing. These are a much more convenient
representation for a compiler.
* share/txr/stdlib/asm.tl (assembler parse-operand): Recognize
a compound expression as an operand, and handle via
parse-compound-operand function.
(parse-compound-operand): New function.
|
|
|
|
|
|
|
|
|
|
|
| |
Remove restriction that labels are keywords; a compiler
cannot pollute the keyword space to generate labels.
We allow them to be uninterned symbols also.
* share/txr/stdlib/asm.tl (assembler parse-args, assembler
asm-one): Use is-label instead of keywordp.
(is-label): New function.
(op-label): Use is-label test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is for allocating a new frame purely on the stack. The
frame will not be captured by lexical closures, and so can
only be used for non-shared variables and additional
compiler-generated temporaries (if registers run out, for
instance).
* share/txr/stdlib/asm.tl (op-sframe, sframe): New opcode
class and opcode.
* vm.c (vm_do_frame): New static function for the common
implementation of frame and sframe.
(vm_frame): Now just a call with vm_do_frame, passing the flag
indicating that closure capture is enabled for this
environment frame.
(vm_sframe): New static function.
* vmop.h: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit is the start of compiler work to make TXR Lisp
execute faster. In six days of part time work, we now have a
register-style virtual machine with 32 instructions, handling
exceptions, unwind-protect, lexical closures, and global
environment access/mutation. We have a complete assembler and
disassembler for this machine. The assembler supports labels
with forward referencing with backpatching, and features
pseudo-ops: for instance the (mov ...) pseudo-instruction
chooses one of three kinds of specific move instruction based
on the operands.
* Makelfile (OBJS): Add vm.o.
* eval.c (lookup_sym_lisp1): Static function becomes external;
the virtual machine needs to use this to support that style
of lookup.
* genvmop.txr: New file. This is the generator for the
"vmop.h" header.
* lib.c (func_vm): New function.
(generic_funcall): Handle the FVM function type via new
vm_execute_closure function. In the variadic case, we want
to avoid the argument copying which we do for the sake of C
functions that get their fixed arguments directly, and then
just the trailing arguments. Thus the code is restructured a
bit in order to switch twice on the function type.
(init): Call vm_init.
* lib.h (functype_t): New enum member FVM.
(struct func): New member in the .f union: vm_desc.
(func_vm): Declared.
* lisplib.c (set_dlt_entries_impl): New static function,
formed from set_dlt_entries.
(set_dlt_entries): Reduced to wrapper for
set_dlt_entries_impl, passing in the user package.
(set_dlt_entries_sys): New static function: like
set_dlt_entries but targetting the sys package.
(asm_instantiate, asm_set_entries): New static functions.
(lisplib_init): Auto-load the sys:assembler class.
* share/txr/stdlib/asm.tl: New file.
* vm.c, vm.h, vmop.h: New files.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: 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.c, 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/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.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/txr-case.tl, share/txr/stdlib/type.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, win/cleansvg.txr:
Extended Copyright line to 2018.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that the lop macro in op.tl generates code
that uses sys:l1-val. That requires the place.tl module.
But there is no autoload trigger for sys:l1-val. Even if
there were, it wouldn't work because op.tl is lower level
w.r.t. place.tl; place.tl uses op.tl.
Let's just rewrite sys:l1-val and sys:l1-setq in C, so they
live in the run-time core.
* eval.c (sys_l1_val_s, sys_l1_setq_s): New symbol variables.
(me_l1_val, me_l1_setq): New static functions.
(eval_init): Intern sys:l1-setq and sys:l1-val symbols,
binding these to the macro expanding functions.
* share/txr/stdlib/place.tl (sys:l1-setq, sys:l1-val): Macros
removed.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Move repeated
boiler-plate code from the various rng macrolets into an
the implementation of the sys:rng macro they rely on.
That implementation is split into two macros: sys:rng is
now the name of a wrapper which adds the boiler-plate, and the
bulky implementation macrolet is now called sys:rng-impl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A new kind of stream object which redirects its operations to
the methods of a structure.
* Makefile (OBJS): New object file, strudel.o.
* lib.c (init): Call new strudel_init function.
* lisplib.c (stream_wrap_set_entries,
stream_wrap_instantiate): New static functions.
(lisplib_init): Arrange for autloading of new stream-wrap.tl.
* share/txr/stdlib/stream-wrap.tl: New file.
* stream.c (put_string_s, put_char_s, put_byte_s, get_line_s,
get_char_s, get_byte_s, unget_char_s, unget_byte_s, put_buf_s,
fill_buf_s, flush_s, seek_s, truncate_s, get_prop_s,
set_prop_s, get_error_s, get_error_str_s, clear_error_s,
get_fd_s): New symbol variables.
(stream_init): New symbol variables initialized. Numerous
functions registered via these variables now rather than
intern(...) expressions.
* stream.h (put_string_s, put_char_s, put_byte_s, get_line_s,
get_char_s, get_byte_s, unget_char_s, unget_byte_s, put_buf_s,
fill_buf_s, flush_s, seek_s, truncate_s, get_prop_s,
set_prop_s, get_error_s, get_error_str_s, clear_error_s,
get_fd_s): Declared.
* strudel.c, strudel.h: New files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a method is traced with (trace (meth class slot)),
a spurious warning occurs. This is because the function
is recorded in the trace hash first and then the hook
is installed, and the hook is installed using the
static-slot-ensure function which performs the trace
warning check.
* share/txr/stdlib/trace.tl (sys:trace): Swap the order:
install the hook first, and then put the the previous function
into the trace hash. Doing this in parallel with pset would
also work.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim: Regenerated.
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-mac-let): A few occurrences
of the deprecated set-diff function are replaced with diff.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, using "rb" in open-command reports an error on
GNU/Linux, due to popen not liking the "b" mode.
On Cygwin, the "b" flag is useful with popen.
* stream.c (normalize_mode_no_bin): New function.
(open_command): Use normalize_mode_no_bin instead of
normalize_mode to strip out the binary flag.
This doesn't happen on Cygwin, though.
* stream.h (normalize_mode_no_bin): Declared.
* share/txr/stdlib/getput.tl (command-get-buf): Since
we are getting binary data, pass the "rb" mode to
open-command, now that it works.
(command-put-buf): Add "b" flag to mode passed
to open-command.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk%--rng, sys:awk%--rng-,
sys:awk%rng+, sys:awk%-rng+, sys:awk%--rng+): New functions.
(sys:awk-mac-let): Rewritten range expander. The four basic
ranges rng, rng-, -rng and -rng- are handled with in-line
expansion, because by doing that we avoid unnecessarily
evaluating the from-expression. The remaining cases expand
to function calls to the new functions, which receive the
flag vector, the index position in that vector and the values
of the from and to expressions. The behavior change is that
that the -- forms now do the right thing: they hide all
leading records that satisfy the from-expression, right to the
last record of the range if necessary.
* tests/015/awk-rng.expected: Updated.
* txr.1: Revise semantic description the -- range types, plus
minor fixes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (getput_set_entries): New autoload entries for
file-get-buf, file-put-buf, file-append-buf, command-get-buf
and command-put-buf.
* share/txr/stdlib/getput.tl (sys:get-buf-common): New
function.
(file-get-buf, file-put-buf, file-append-buf, command-get-buf,
command-put-buf): New functions.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that when records appear in the middle
of the range which again match from-expr, they
get suppressed.
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Get rid of the
flag-mid variable. It cannot work because middle is a state
in its own right that cannot be inferred from the existing
states (nil, t, :end) and the value of from-expr. We get rid
of the flag and introduce a :mid state value.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/op.tl (sys:op-expand): Throw error if
argument list is empty. We refer to the compile-error
function by quote to avoid triggering the auto-load of
the module which defines it, due to the circular dependency
on op.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code is using a non-hygienic variable called flag
as a placelet alias. This binding is visible to range
expressions. For instance (rng #/x/ flag) actually
references the range expression's internal flag, rather
than producing a warning about an unbound variable.
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Allocate a gensym
for the flag. Then use ,flag throughout the code templates
rather than flag to insert the gensym wherever the symbol
flag previously appeared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an improvement in the code generation related
to awk range expressions. Previously, on each iteration,
for each range expression, the awk state structure is
accessed to retrieve the flag vector, which is then kept
in a lexical variable. With this change, the retrieval
is done once for all the range expressions, which share
the same variable to access it.
* share/txr/stdlib/awk.tl (sys:awk-compile-time): New slot,
rng-vec-temp.
(sys:awk-mac-let): Alias the flag variable to a simplified
vecref expression which accesses the vector assumed to
have been retrieved and bound to the variable named by
the rng-vec-temp gensym.
(awk): Add one more variable binding into the scope of
the ranges: the binding of the variable named by the
rng-vec-temp gensym, to an expression which retrieves the
rng-vec from the Awk run-time state structure.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys;awk-mac-let): Provide the
implementation for the local macros --rng, --rng-,
rng+, -rng+ and --rng+.
* tests/015/awk-rng.tl: New file.
* tests/015/awk-rng.expected: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (op_set_entries): Add lop to auto-load list.
* share/txr/stdlib/op.tl (sys:op-expand): Recognize lop
and implement its transformation.
(lop) New macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A test case for this very subtle bug is this:
(let ((v (list 1 2 3)))
(symacrolet ((x v))
(flet ((x () 42))
(set [x 0] 0))))
Because x is being evaluated in the DWIM brackets which
flatten the two namespaces into one, it must be treated as a
reference to the flet, and so [x 0] denotes the function call.
The assignment is erroneous.
The incorrect behavior being fixed is that the places code
macro-expands x in the Lisp-2 style under which the symacrolet
is not shadowed by the flet. The substitution of v takes
place, and the assignment assigns to [v 0].
* share/txr/stdlib/place.tl (sys:l1-setq, sys:l1-val):
Use macroexpand-lisp1 rather than macroexpand.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:l1-val): Use the expanded
version of the place in the resulting form, because some
of the operators like sys:lisp1-value will not expand it.
Previously we were getting away with (sys:l1-val @1)
expanding to (sys:lisp1-value @1) because the op expander
would traverse through this blindly and replace @1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new implementation treats the @1, @2 ... @rest
op arguments as local macros, leveraging the power of the
macro expander to perform the substitution which renames these
to gensyms.
As a result, the implementation is correct.
The old implementation blindly walks the tree
structure doing the substitution, so that @1 is substituted
even though it is in a quoted literal:
[(op list '(@1)) 42] -> ((#:arg-01-0166))
under the new implementation, '(@1) is left alone:
[(op list '(@1)) 42] -> ((@1) 42)
* eval.c (expand_quasi): Because the new op macro doesn't
rudely reach into quasi forms to substitute sys:var
elements, relying on macro expansion, we must now macro-expand
sys:var elements. The sys:var macro created by op is
smart enough to skip the compound ones that have modifiers;
they are handled via the inner expansion of the symbol.
That is to say, `@@1` contains the structure
(sys:var (sys:var 1)). The sys:var macro ignores the outer
sys:var. But existing behavior in expand_quasi expands the
inner (sys:var 1), so the substitution takes place.
(eval_init): Do not register the hacky old op and do macros,
except in compatibility mode with 184 or older.
* lisplib.c (op_set_entries, op_instantiate): New functions.
(dlt_register): Register auto-loads for op and do macros via
new functions, except when in compatibility mode with 184
or older, in which case we want the old build-in hacky op
to be used.
* share/txr/stdlib/op.tl: New file.
* txr.1: Fixed or removed no-longer-true text which hints at
special hacks implemented in the op expander. Added
compatibility notes for all new compat-switched op behaviors.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (struct buf_strm): New struct type.
(buf_strm_mark, int buf_strm_put_byte_callback,
buf_strm_put_string, buf_strm_put_char, buf_strm_put_byte,
buf_strm_get_byte_callback, buf_strm_get_char,
buf_strm_get_byte, buf_strm_unget_char, buf_strm_unget_byte,
buf_strm_seek, buf_strm_truncate, buf_strm_get_prop,
buf_strm_set_prop, buf_strm_get_error,
buf_strm_get_error_str): New static functions.
(buf_strm_ops): New static struct.
(buf_strm): New static function.
(make_buf_stream, get_buf_from_stream): New functions.
(buf_init): Register new intrinsic functiions make-buf-stream
and get-buf-from-stream.
Call fill_stream_ops on new buf_strm_ops to fill
default operations in place of function pointers
that have been left null.
* buf.h (make_buf_stream, get_buf_from_stream): Declared.
* lisplib.c (with_stream_set_entries): Add with-out-buf-stream
and with-in-buf-stream to auto-load symbols for with-stream.tl
module.
* share/txr/stdlib/with-stream.tl (with-out-buf-stream,
with-in-buf-stream): New macros.
* txr.1: New section about buffer streams.
|
|
|
|
|
|
|
|
|
|
| |
This eliminates one incompatibility between doloop
and ANSI CL do.
* share/txr/stdlib/doloop.tl (sys:expand-doloop): Wrap body in
tagbody form.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/tagbody.tl (tagbody): Reduce unnecessary
use of DWIM brackets to parentheses in calculation of bblocks.
Remove entry-lbl local variable, propagating its initform
to its one and only use site.
|