| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
| |
This was caused by the recent work to reduce consing in
generic_funcall.
* lib.c (generic_funcall): Correct test for too many
arguments. Because we don't normalize the argument list to the
exact number of fixed args, but to at least the fixed args,
the excess args can possibly be part of the fill rather than
part of the list.
|
|
|
|
|
| |
* vm.c (vm_init): Register vm_execute_toplevel as
vm-execute-toplevel rather than vm-interpret-toplevel.
|
|
|
|
|
|
| |
* 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 broke when I moved asm.tl into the library directory
and set it up for auto-load.
* genvmop.txr: We must not include "asm" any more.
But then there is no auto-load on any other feature of the
assembler other than the class name. The @(mdo)
directive comes in handy; at expansion time we can trigger
auto-load by doing a lookup on the sys:assembler
struct name.
|
|
|
|
|
|
| |
* vm.c (vm_make_closure): When copying captured environment
from stack to heap, use memcpy instead of a loop with
assignments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Once upon a time when we didn't have continuable warning
exceptions, it was easy to debug internal error throws in TXR:
just set a breakpoint on uw_throw and catch it in the
debugger. This approach became unworkable with uw_throw being
executed numerous times as part of the ordinary program
control flow. With this change, we get that debugging
experience back.
* unwind.c (uw_break_on_error): New static variable.
(uw_throw): If the break-on-error variable is set and we
are processing an exception derived from error, then
call the breakpt function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
* lib.c (obj_init): Give the system package a fallback list
consisting of one element: the user package.
This will make it easier to develop some library features
that have lots of internal symbols that ought to be hidden
in the system package, without having to put sys: on
everything. That code will just switch to the system package.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Removing the restriction that qualified pkg:sym syntax may not
cause interning to take place if pkg has a nonempty fallback
list. This serves no purpose, only hindering the flexibility
of the package system.
* parser.y (sym_helper): When processing a qualified symbol,
if the package exists, just intern it.
* txr.1: Revise all text which touched on the removed rule,
to remove all traces of it from the documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* args.c (args_normalize): Renamed to args_normalize_exact,
because this tries to split the arguments between an exact
array fill quantity and trailing list. Not all places using
this function actually need an exact fill, which causes
unnecessary consing when args->fill is reduced in order to
move items to args->list.
(args_normalize_least): New function. Variant of
args_normalize that can be used by functions which only
require a minimum fill.
(args_normalize_fill): Use args_normalize_least rather than
args_normalize_exact. This reduces consing in generic_funcall,
in handling variadic calls where arrayed arguments have been
supplied for trailing parameters.
* args.h (args_normalize): Renamed to args_normalize_exact.
(args_normalize_least): Declared.
(args_get_list, args_get_rest): Use args_normalize_exact.
(args_clear): Inline function removed. Was used only in one
place in generic_funcall and is no longer.
* eval.c (gather_free_refs): Use args_normalize_least.
(prod_common): Use args_normalize_exact.
* ffi.c (ffi_call_wrap): Use args_normalize_least.
* lib.c (generic_funcall): Use args_normalize_least in switch
statement that handles various callable non-function objects.
When copying args, ensure that there are ARGS_MIN.
A different strategy is used for producing the trailing args
for variadic calls, further reducing consing. Rather than
normalize the args to the fixed number, and then set
args->fill to zero so that args contains just the list, we use
args_cat_zap_from to create a copy of the args in which the
fixed ones are trimmed out. The resulting args is not
renormalized to be purely a list so no consing or list traversal
takes place. If the rebalancing is needed, the called
function will have to do it.
(dwim_set): Streamline the code that handles hashes assigned
via two or three args.
* struct.c (method_args_fun, umethod_args_fun): Use
args_normalize_exact.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* mpi/mpi.c (s_mp_mul_d): The test used for deciding
whether or not the multiplication will carry, and possibly
needs another digit of space, is broken. There are situations
in which a carry occurs (k > 0) in spite of the test being
negative. We code this the way it should have been done in
the first place: resize the object when carry actually occurs.
This still avoids calling s_mp_pad unless absolutely
necessary, as the removed comment says. Also, in the carry
case, we need not try to clamp away leading zeros.
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (c_unum): Add fallthrough comment.
(minus): Add missing break after case that handles char minus
heap object.. This luckily isn't a bug because type(anum)
isn't RNG, and so when it falls through, the next case also
falls through.
* lib.c (car): Add missing fallthrough comment.
|
|
|
|
|
|
|
|
|
| |
* arith.c (bignum_len): Wew function.
(arith_init): Register bignum-len intrinsic.
* arith.h (bignum_len): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the trace module has been loaded, we can't
define methods. Repro:
1> (trace)
nil
2> (defmeth time foo (me))
** static-slot-home: #<struct-type time> has no static slot named foo
* struct.c (static_slot_ensure): Do the trace_check
after calling static_slot_ens_rec so that the slot exists.
If the slot doesn't exist, an exception occurs when
sys:trace-canonicalize-name calls static-slot-home.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* struct.c (reset_struct): Perform the post-init
actions are performed, not only the init actions.
Also, catch exceptions and call finalizers,
just like in a new structure instantiation.
* txr.1: Document the requirements for finalizers
being called by reset-struct, and clarify the issue of
possible duplicate finalization registration.
Add compat notes.
|
|
|
|
|
|
|
| |
* buf.c (buf_get_bytes): Fix off-by-one test for reading past
end of buffer. This prevents, e.g. a buf-get-u32
from the last four bytes of a buffer (or from a four-byte-long
buffer, period).
|
|
|
|
|
|
| |
* txr.1: Fix three unrelated occurrences of the
same mistake: "functions is", in reference to
a single function.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (static_forward, static_def): At least the C version
of these now require a trailing semicolon.
* struct.c (struct_type_ops): Add required semicolon after
static_def.
* syslog.c (syslog_strm_ops): Add required semicolon after
static_forward and after static_def.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_intrinsic_noerr): New function.
* eval.h (eval_intrinsic_noerr): Declared.
* parser.c (listener_greedy_eval_s): New symbol variable.
(repl): Implement greedy evaluation loop, enabled by
the *listener-greedy-eval-p* special.
(parse_init): Intern the *listener-greedy-eval-p* symbol,
storing it in the listener_greedy_eval_s variable.
Register the symbol as a special variable.
* txr.1: Documented *listener-greedy-eval-p* variable
and the greedy evaluation feature that it controls.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (load): Instead of throwing error when a .txr file
is opened, process it according to sensible requirements.
* match.c (v_load): Store bindings in the current environment
frame before evaluating Lisp, and then update afterward.
This allows .txr files loaded from Lisp to continue matching
with the current bindings and extend those bindings.
* txr.1: Update documentation of load.
|
|
|
|
|
|
| |
* txr.c (txr_main): Since parser.errors being nonzero
is handled earlier, it must be zero at the final
return point and need not be tested.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bug shows up as a spurious warning and incorrect
expansion from a from like (do set [@1 x] y).
In this situation, sys:lisp1-setq is involved in the
assignment to the place denoted by @1, because of the way the
do operator expands the (set [@1 x] y) expression. The @1
meta-variable is replaced by a gensym, but some intermediate
expansion takes place in an environment which has no binding
for the gensym, causing the place to be treated as if it were
a global variable, using sys:lisp1-setq. The subsequent real
expansion in the environment in which the gensym is now bound
then calls upon the expansion of sys:lisp1-setq, which
proceeds via the expand_lisp1_setq function. But now the
variable has a lexical binding.
This bug doesn't show up in ordinary expressions like
(set [foo x] y) which is why it went undetected for a year.
* eval.c (expand_lisp1_setq): Fix the missing symbol in
the generated code for the case when the symbol has a lexical
variable binding. We must emit (sys:setq <sym> <value>), not
(sys:setq <new-value>).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (sys_lisp1_value_s): Declaration moved to be
collocated with lisp1_setq_s.
(lisp1_setq_s): Variable renamed to sys_lisp1_setq_s to
match sys_lisp1_value_s.
(do_expand): Follow rename of lisp1_setq_s.
(eval_init): Follow rename; collocate initialization of
vars.
* protsym.c (lisp1_setq_s): Manually renamed to
sys_lisp1_setq_s instead of full regeneration, which we
do at release time.
|
|
|
|
|
|
| |
* txr.1: Add missing text to compensate for text that was
accidentally edited out, regarding the return value of
the empty case of caseq/caseql/casequal.
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (listener_pprint_s): New symbol variable.
(repl): Check new variable after each evaluation and print
accordingly.
(parse_init): Initialize listener_print_s with interned symbol
and register the variable.
* txr.1: Document *listener-pprint-s*.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit addresses a bug of the following type:
(defpackage p (:fallback usr))
(in-package p)
(let ((lb (new list-builder)))
lb.(add 1)) ;; problem: this add is p:add
the add symbol is not on the auto-load list; it occurs
as a slot of the list-builder class, but is not interned
when TXR starts. Thus the (:fallback usr) doesn't pick it up.
Expected behavior is that add is usr:add.
* lisplib.c (intern_only): New static function.
(sock_set_entries, build_set_entries, getopts_set_entries,
stream_wrap_set_entries): Define additional lists of
supplemenary symbols which are passed to intern_only
just to be interned in the usr package without autoload
registratiions. These symbols are all slots documented for
public use in various structures defined by the respective
modules managed by these autoload functions.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This prevents a bug which manifests itself as a totally bogus
file name and line number being reported in a diagnostic.
The cause is that source loc info is recorded for an interned
symbol when it is first encountered in one place in the
code. Then that symbol occurs again in another place (perhaps
a different file) in such a way that its source loc info is
inherited into a surrounding generated form which now has
incorrect source loc info: the location of the first
occurrence of the symbol not of this form. Then when some
error is reported against the form, the bogus source loc info
is shown.
* parser.y (rlviable): New static function.
(rlset): Only record source loc for forms which satisfy
rlviable.
|
|
|
|
|
|
| |
* txr.1: Several places in the document refer to a section
called Equality Substitution which supposedly exists under the
Structures section. As of now, it actually does!
|
|
|
|
|
| |
* txr.1: Restructure long sentence for readability, fixing
awkward comma in the process.
|
|
|
|
|
|
| |
* txr.1: Describe fallback of ref and refset onto
list-like operations if lambda/lambda-set are
not supported.
|
|
|
|
| |
* txr.1: "behavior ... becomes" second person agreement.
|
|
|
|
| |
* txr.1: Fix run-on parenthesis.
|
|
|
|
|
| |
* txr.1: a :maxgap of zero also means that the collected items
must match immediately.
|
|
|
|
|
|
| |
Reported by Martin Dvořák.
* txr.1: Word "five" should be "n".
|
|
|
|
|
|
|
| |
Reported by Martin Dvořák.
* txr.1: In pattern matching clauses, repeat and rep are
shorthands for collect and coll.
|
|
|
|
| |
* txr.1: use mono font for @(output).
|
|
|
|
|
|
| |
txr.1: The equivalences between [x i] and some functions like
ref are dynamic; they depend not only on the type ofx, but
also whether i is a range or integer.
|
|
|
|
|
|
|
| |
* lisplib.c (sock_set_entries): Add missing sock-bind,
sock-connect, sock-listen, sock-accept, sock-shutdown,
open-socket, open-socket-pair, sock-send-timeout and
sock-recv-timeout.
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.1: Update the documentation to reflect the current
handling of objects, eliminating some contradictions
in the process, like text which says that rplacd is
erroneous on anything but conses and lazy conses, followed by
text which states other kinds of objects are allowed.
The semantics of car and cdr forms as places is described
strictly in terms of rplaca and rplacd, so the mechanism is
then described in one place.
|
|
|
|
|
|
| |
* lib.c (tail): Don't call cdr on the same cell twice in the
loop body. tail is used in list_collect and friends, which are
used all over the place.
|
|
|
|
|
|
|
|
|
| |
* eval.c (term): Function here from lib.c, and changed to
static. It is used only by iapply.
* lib.c (term): Function moved to eval.c.
* lib.h (term): Declaration removed.
|
|
|
|
|
|
| |
* lib.c (listref_l): Unused function removed.
* lib.h (listref_l): Declaration removed.
|