summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--lib.c18
2 files changed, 29 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 73eb66f9..4441ad2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2012-04-03 Kaz Kylheku <kaz@kylheku.com>
+ Fix failing test case tests/006/freeform-1.txr.
+
+ * 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.
+
+2012-04-03 Kaz Kylheku <kaz@kylheku.com>
+
Generational GC showing signs of working. One test case in
test suite fails.
diff --git a/lib.c b/lib.c
index 4cef5ba4..0f4a33fe 100644
--- a/lib.c
+++ b/lib.c
@@ -3385,7 +3385,7 @@ val lazy_str_force(val lstr)
}
if (lim)
- *cdr_l(lstr->ls.opts) = lim;
+ set(*cdr_l(lstr->ls.opts), lim);
return lstr->ls.prefix;
}
@@ -3408,7 +3408,7 @@ val lazy_str_force_upto(val lstr, val index)
}
if (lim)
- *cdr_l(lstr->ls.opts) = lim;
+ set(*cdr_l(lstr->ls.opts), lim);
return lt(index, length_str(lstr->ls.prefix));
}
@@ -3602,7 +3602,7 @@ val acons_new(val key, val value, val list)
val existing = assoc(key, list);
if (existing) {
- *cdr_l(existing) = value;
+ set(*cdr_l(existing), value);
return list;
} else {
return cons(cons(key, value), list);
@@ -3631,7 +3631,7 @@ val aconsq_new(val key, val value, val list)
val existing = assq(key, list);
if (existing) {
- *cdr_l(existing) = value;
+ set(*cdr_l(existing), value);
return list;
} else {
return cons(cons(key, value), list);
@@ -3848,8 +3848,14 @@ val sort(val seq, val lessfun, val keyfun)
if (!keyfun)
keyfun = identity_f;
- if (consp(seq))
+ if (consp(seq)) {
+ /* The list could have a mixture of generation 0 and 1
+ objects. Sorting the list could reverse some of the
+ pointers between the generations resulting in a backpointer.
+ Thus we better inform the collector about this object. */
+ mut(seq);
return sort_list(seq, lessfun, keyfun);
+ }
sort_vec(seq, lessfun, keyfun);
return seq;
@@ -4050,7 +4056,7 @@ static void obj_init(void)
*gethash_l(user_package->pk.symhash, nil_string, 0) = nil;
/* t can't be interned, because gethash_l needs t in order to do its job. */
- t = *gethash_l(user_package->pk.symhash, lit("t"), 0) = make_sym(lit("t"));
+ t = set(*gethash_l(user_package->pk.symhash, lit("t"), 0), make_sym(lit("t")));
set(t->s.package, user_package);
null = intern(lit("null"), user_package);