| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.c (gc_mutated): Return the value.
* gc.h (gc_mutated): Declaration updated.
* hash.c (remhash): Fix unsafe assignment to use set macro.
* lib.c (sort): Fix wrong use of mut macro on the list
before it is sorted rather than after.
* lib.h (mut): Trivial version of macro updated to return argument.
* unwind.c (uw_init): The toplevel environment's match_context
should be gc_protected. Though this is probably not used,
which is why it has not been a problem.
|
|
|
|
| |
useless use of *vecref_l() with vecref().
|
|
|
|
|
|
| |
Help section added for gen_gc variable.
* gc.c (gc): Some missing CONFIG_GEN_GC added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.c (backptr_oflow): Static variable removed.
(freshq_head, freshq_tail, partial_gc_count): Static variables removed.
(freshq): Array renamed to freshobj.
(full): Variable renamed to full_gc.
(freshobj_idx): New varaible.
(make_obj): Add newly born objects to freshobj array rather than
freshq. If freshobj array is full on entry to this function,
trigger gc to empty it. make_obj no longer updates the free_tail;
the gc routine takes care of restoring this invariant.
(mark_obj): Follows rename of full_gc. Some code was not wrapped
in #if CONFIG_GEN_GC.
(mark, sweep_one): Follow rename of full_gc.
(sweep): On entry, restore free_tail invariant in the empty
free_list case. Code which processes freshq from tail to head
replaced by simple array walk of freshobj. Code wrapped properly
in #if CONFIG_GEN_GC.
(gc): Logic for triggering full gc simplified.
Check added for situations when a partial gc is called when
the free list empties, and it doesn't liberate enough memory.
This prevents the situation of partial gc being called over and over
again by make_obj, squeezing less and less memory each time until
finally it returns 0 objects, and more() is called.
(gc_is_reachable): Follows rename of full_gc, and #if CONFIG_GEN_GC
added.
(gc_set, gc_mutated): Simplified. Check if the backptr array
is full and trigger gc if so to flush it, then just add to the array.
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.c (BACKPTR_VEC_SIZE): Increase greatly, so that we don't
trigger gc due to overflow of the backptr array. This is not likely
to yield a lot of free objects except in a full GC.
(FULL_GC_INTERVAL): From 10 to 20.
(gc): Take a not of whether or not gc was entered with free_list
being exhausted or not. Call more() only if the free_list was
empty, and a full sweep was done.
Reset partial_gc_count only when a full gc is triggered.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (lazy_str_force, lazy_str_force_upto): Use set macro
when assigning lim. This won't cause a problem unless lim is
in the bignum range, however.
(acons_new, aconsq_new): When overwriting the cdr value of
the existing entry, use set. This is the smoking gun;
these functions are used for manipulating bindings.
(sort): After sorting a list, we must mark it as having
been mutated. If a list contains only mature conses or only
fresh conses, there is no problem. But if it contains a mixture,
then sorting could reverse their relationship, causing mature
conses to backpoint to the fresh ones.
(obj_init): Use set when installing the t symbol into the user package.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
test suite fails.
* gc.c (FRESHQ_SIZE): New preprocessor symbol.
(backptr_oflow, freshq, freshq_head, freshq_tail): New static
variables.
(make_obj): Place newly allocated generation 0 object into
freshq. If freshq becomes full, transfer oldest item into
generation 1.
(mark_obj): If doing only a partial gc, then do not mark
objects which are not generation 0.
(mark_mem_region): Valgrind support: cannot mark t.type field undefined
because it is a bitfield. Just mark the first SIZEOF_PTR bytes
of the object defined.
(mark): Under partial gc, mark the table of back pointers.
(sweep_one): New static function from the prior guts of sweep.
Reachable objects now get promoted to generation 1.
(sweep): Under partial gc, sweep just the freshq which identifies
the generation 0 objects, rather than the entire linked list of all the
heaps.
(gc): Trigger full gc also if the backptr list has overflowed
due to gc having been disabled.
Under generational gc, reset the static variables afterward:
clear the list of backpointers, and the freshq.
(gc_is_reachable): Under partial gc, report any mature object
as reachable.
(gc_set, gc_mutated): Handle backptr array overflow situation
when gc is disabled.
(gc_push): Bugfix: it is the newly pushed cons cell that has to be
marked as a root, not the value being pushed.
* hash.c (sethash): Use set macro for storing value.
* lib.h (set, mut, mpush): Fix wrong-way #if test for these macros.
The trivial versions were being defined uner CONFIG_GEN_GC and vice
versa!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.c (gc_push): New function.
* gc.h (gc_push): Declared.
* hash.c (pushhash): Use mpush.
* lib.c (push): Reverted to unsafe operation. TODO comment replaced
with warning.
(lazy_flatten_scan): push occurence commented as safe.
(lazy_stream_func): Unsafe push replaced with mpush.
* lib.h (mpush): New macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
causes CONFIG_GEN_GC to be defined as 1 in config.h.
* eval.c (op_defvar, dwim_loc, op_modplace, transform_op): Handle
mutating assignments via set macro.
(op_dohash): Inform gc about mutated variables. TODO here.
* filter.c (trie_add, trie_compress): Handle mutating assignments
via set macro.
* gc.c (BACKPTR_VEC_SIZE, FULL_GC_INTERVAL): New preprocessor symbols.
(backptr, backptr_idx, partial_gc_count, full): New static variables.
(make_obj): Initialize generation to zero.
(gc): Added logic for deciding between full and partial gc.
(gc_set, gc_mutated): New functions.
* gc.h (gc_set, gc_mutated): Declared.
* hash.c (hash_mark): Changed useless use of vecref_l to vecref.
(gethash_f): Use set when assigning through *found since it
is a possible mutation.
* lib.c (car_l, cdr_l, vecref_l): Got rid of loc macro uses. Using the
value properly is going to be the caller's responsibility.
(push): push may be a mutation, so use set.
(intern): Uset set to mutate a hash entry.
(acons_new_l, aconsq_new_l): Use set when replacing *list.
* lib.h (PTR_BIT): New preprocessor symbol.
(obj_common): New macro for defining common object fields.
type_t is split into two bitfields, half a pointer wide,
allowing for generation to be represented.
(struct any, struct cons, struct string, struct sym, struct package,
struct func, struct vec, struct lazy_cons, struct cobj, struct env,
struct bignum, struct flonum): Use obj_common macro to defined
common fields.
(loc): Macro removed.
(set, mut): Macros conditionally defined for real functionality.
(list_collect, list_collect_nconc, list_collect_append): Replace
mutating operations with set.
* match.c (dest_set, v_cat, v_output, v_filter): Replace
mutating operations with set.
* stream.c (string_in_get_line, string_in_get_char,
strlist_out_put_string, strlist_out_put_char): Replace mutating
operations with set.
* unwind.c (uw_register_subtype): Replace mutating operation with set.
|
|
|
|
|
|
|
|
| |
(vecref_l): Use loc to lift address of cell.
(replace_vec): Use macro mut to indicate the object is being
mutated.
* lib.h (mut): New macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to places where we potentially assign a reference to a younger object
inside a field located in an older object (chronological
backreference) and also where we take the address of an object
field, making it possible that the user of the address will do so.
This patch does not take care of vectors.
No, this is not an April Fool's joke.
* eval.c (env_fbind, env_vbind, env_replace_vbind, lookup_var,
lookup_sym_lisp1): Use set macro instead of assignment.
* hash.c (hash_grow, set_hash_userdata, hash_next):
Use set macro instead of assignment.
* lib.c (rplaca, rplacd, string_extend, length_str, replace_str,
rehome_sym, lazy_stream_func, lazy_str, lazy_str_force,
lazy_str_force_upto, obj_init): Use set macro instead of assignment.
(car_l, cdr_l): Use loc instead of address-of operator.
* lib.h (set, loc): New macros.
|
|
|
|
|
|
|
| |
(equal_hash): Caching optimization implemented.
(eql_hash): Optimization extended to those objects that have
equal semantics.
(hash_process_weak): Clear the cached hash during gc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
happen to request a successful termination by invoking @(accept)
the position must not advance into the trailer material.
* match.c (v_trailer): Added an unwind protect which
detects that an accept is taking place and adjusts the return value to
restrict the input position at the point given to trailer.
(accept_fail): Use uw_block_return_proto instead of uw_block_return
and pass the symbol as the protocol identifier.
* unwind.c (uw_current_exit_point): New function.
(uw_block_return): Function renamed to uw_block_return_proto;
takes new parameter which is stored in the block structure.
* unwind.h (struct uw_block): New member, protocol.
(uw_block_return): Becomes an inline wrapper for uw_block_return_proto.
(uw_block_return_proto, uw_current_exit_point): Declared.
* txr.1: Interaction between @(trailer) and @(accept) documented.
|
|
|
|
|
|
|
|
| |
by throwing an exception. Allow nil, but wherever nil occurs,
do not produce a binding.
* txr.1: State the restrictions against using t in the section
on Variables and also describe the nil ignore feature.
|
|
|
|
| |
which completed.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
* RELNOTES: Updated.
|
|
|
|
|
|
|
|
|
| |
to treat the number as floating or integer. We can't just look
for the presence of E, e or . because these coudl be part of
trailing junk for instance "123XYZE." should convert
to the integer 123, where "XYZE." is trailing junk.
* txr.1: Documented int-str, flo-str and num-str.
|
| |
|
|
|
|
|
|
| |
favor the left one.
* txr.1: Documented min and max.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(exptmod): Bugfix: was no normalizing the bignum, ouch.
Also was reporting "non-integral operands" for other
errors.
* eval.c (eval_init): Registered = intrinsic function.
* lib.c (numeqv): New function.
* lib.h (numeq, numeqv): Declared.
* txr.1: Documented expt, sqrt, isqrt, exptmod, fixnump, bignump,
integerp, floatp, numberp, zerop, evenp, oddp, >, <, >=, <= and =.
* txr.vim: Highlight =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
exception if MPI fails.
(floorf, ceili): Map integer argument to itself.
(tang, asine, acosi): New functions.
* eval.c (eval_init): New intrinsics: tan, asin, acos.
* lib.h (tang, asine, acosi): Declared.
* txr.1: Documented gcd, abs, floor, ceil, sin, cos, tan
asin, acos, atan, log, and exp.
* txr.vim: Highlighting for tang, asine, acosi.
|
|
|
|
|
|
|
|
| |
(mod): Use dmod instead of fmod directly, to calculate
the correct semantics for combinations of
negative operands in the floating point domain also.
* txr.1: Documented /, trunc and mod.
|
| |
|
|
|
|
| |
* txr.vim: num-str added.
|
|
|
|
| |
notation for lazy strings that have been forced.
|
|
|
|
|
|
|
| |
implementations with regard to printing floating point exponents.
by deleting any plus sign and leading zeros after the 'e'.
* tests/009/json.expected: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For instance given @(bind a ("a" "b" "c")) it is now possible
to do @(filter :upcase a) whereby a promptly takes on the value
("A" "B" "C").
* filter.c (string_filter): Function renamed to string_tree_filter.
(compound_filter): Follows rename.
(filter_string): Function renamed to filter string tree.
Can filter tree of strings, or possibly other objects,
if the filter function allows.
(filter_equal): No special case test for objects that are strings.
Just put them through the filter.
* filter.h (filter_string): Declaration updated.
* match.c (format_field, subst_vars, v_filter): Follow rename.
|
|
|
|
|
|
|
| |
after each @(output) block. Otherwise if output blocks
that go to standard output are interleaved with output blocks
which pipe to some command which then goes to standard out,
the output won't be in the proper order.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c (tonumber_k, tointeger_k, tofloat_k, hextoint_k):
New keyword variables.
(filter_init): New variables initialized; new filters registered.
* filter.h (tonumber_k, tointeger_k, tofloat_k, hextoint_k):
Declared.
* lib.c (num_str): New function.
* lib.h (num_str): Declared.
* txr.1: New filters documented.
|
|
|
|
| |
* lib.c (funcall): Likewise.
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (rebind_s): Declared.
* match.c (v_rebind): New static function.
(dir_tables_init): Registered rebind_s to v_rebind,
and also to hv_trampoline in the horizontal directive table.
* txr.1: Documented it.
|
|
|
|
|
| |
* match.c (syms_init): text_s must be in the system
package because it's not a user-visible operator.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
of free space, so programs close to exhausting a heap do not
waste cycles frequently calling the collector.
* gc.c (more): Do not assert that free_list is null; this will
not be the case any more.
(make_obj): Comment added regarding why we the free_tail variable
is fixed up.
(sweep): Now returns a count of the objects that are free.
(gc): If sweep reports that less than 75% of the objects are free
then let us add another heap.
|
|
|
|
|
|
|
|
|
|
| |
intrinsics.
* lib.c (match_str, match_str_tree): Default position to zero.
* txr.1: Doc stubs created.
* txr.vim: Highlighting for match-str and match-str-tree.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the regular expression does not match all the way to
the end of the line was getting by the check for
a complete match.
* match.c (do_match_line): Loses the second parameter
named completely. The check whether the line was matched
completely is done higher up, in match_line_completely.
This is needed because do_match_line has some early
successful return cases which bypass the check.
(match_line): Remove second paramter in call to do_match_line.
(match_line_completely): Do the check here that the line
was matched completely. Nothing can get by this.
(v_freeform): Do notpass second nil argument to do_match_line.
|
|
|
|
| |
This is needed for this to work right as an optional argument.
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
|
|
|
|
| |
* txr.1: Describe floating-point constants.
|
|
|
|
|
|
|
|
|
|
| |
* tests/009/json.expected: Updated.
* tests/009/json.txr: Updated source. Translates to a more native
representation with vectors and hash tables. Numbers go to
floating point instead of remaining as strings.
* tests/009/pass1.json: New file: a test case from json.org.
|
|\
| |
| |
| |
| | |
Conflicts:
ChangeLog
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* eval.c (eval_init): expo registered as intrinsic exp.
* lib.h (expo): Declared.
* txr.1: Added to stub heading.
* txr.vim: Highlighting for exp.
|
| |
| |
| |
| |
| | |
Not all numbers are integers now, and that situation
requires an integer.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
with no decimal point like 1E1.
* stream.c: (vformat): Keep track of whether or not precision was
given in precision_p local variable.
When printing #<bad-float> pass a precision of 0
to vformat_str, not precision, since precision does not apply.
In ~f and ~e, if the precision was not given, default
it to 3.
Restructured float printing in ~a and ~s. It now just uses sprintf's %g
with a precision. If user does not specify precision, it defaults
to DBL_DIG to print the number with reasonable accuracy.
A .0 is added if it sprintf produces an integer, and the conversion
is ~s rather than ~a.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
for the integer square root.
* arith.c (sqroot_fixnum): Renamed back to isqrt_fixnum.
(sqroot): Rewritten to handle only floating-point square root.
(isqrt): New function, based on previous sqroot,
handles only integers.
* eval.c (eval_init): New intrinsic, isqrt.
* lib.h (isqrt): New declaration.
* txr.1: Doc stubs.
* txr.vim: Highlighting for isqrt.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* eval.c (eval_init): New intrinsic functions registered:
floor, ceil, sin, cons, atan, log.
* lib.h (floorf, ceili, sine, cosi, atang, loga): Declared.
* txr.1: Doc stub section for new functions.
* txr.vim: Highighting added.
|
| |
| |
| |
| |
| |
| |
| |
| | |
that doesn't begin with a digit, it's most likely NaN or Inf.
We can turn that into an exception.
* stream.c (vformat): If sprintf produces a non-number,
turn it into the printed representation #<bad-float>.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
(divi): Uses to_float.
(zerop, gt, lt, ge, le, expt): Floating support.
(isqrt_fixnum): Static function renamed to sqroot_fixnum.
(isqrt): Renamed to sqroot. Floating support.
(evenp, oddp, exptmod, gcd): Work with integers, not floats.
* eval.c (eval_init): intrinsic registration of sqrt follows rename of
isqrt to sqroot.
* lib.h (isqrt): Declaration replaced.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* eval.c (eval_init): divi registered as / intrinsic.
* lib.h (divi): Declared.
* txr.1: divi added to stub heading.
* txr.vim: / operator highlighted.
|
| | |
|