summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--gc.c4
-rw-r--r--gc.h2
-rw-r--r--hash.c2
-rw-r--r--lib.c3
-rw-r--r--lib.h2
-rw-r--r--unwind.c4
7 files changed, 28 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ee8da268..4ed8c6c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2012-04-05 Kaz Kylheku <kaz@kylheku.com>
+
+ Bunch of fixes.
+
+ * 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.
+
2012-04-04 Kaz Kylheku <kaz@kylheku.com>
* hash.c (hash_grow, gethash_l, gethash, gethash_f): Replace
diff --git a/gc.c b/gc.c
index 5bbb88da..c5a66f57 100644
--- a/gc.c
+++ b/gc.c
@@ -623,11 +623,11 @@ out:
return val;
}
-void gc_mutated(val obj)
+val gc_mutated(val obj)
{
if (backptr_idx >= BACKPTR_VEC_SIZE)
gc();
- backptr[backptr_idx++] = obj;
+ return backptr[backptr_idx++] = obj;
}
val gc_push(val obj, val *plist)
diff --git a/gc.h b/gc.h
index 8fc83a4e..b1b29e0d 100644
--- a/gc.h
+++ b/gc.h
@@ -38,7 +38,7 @@ int gc_is_reachable(val);
#if CONFIG_GEN_GC
val gc_set(val *, val);
val gc_push(val, val *);
-void gc_mutated(val);
+val gc_mutated(val);
#endif
void unmark(void);
diff --git a/hash.c b/hash.c
index 384a741d..d0bd4ac5 100644
--- a/hash.c
+++ b/hash.c
@@ -427,7 +427,7 @@ val remhash(val hash, val key)
if (existing) {
val loc = memq(existing, *pchain);
- *pchain = nappend2(ldiff(*pchain, loc), cdr(loc));
+ set(*pchain, nappend2(ldiff(*pchain, loc), cdr(loc)));
h->count--;
bug_unless (h->count >= 0);
}
diff --git a/lib.c b/lib.c
index 0f4a33fe..77231478 100644
--- a/lib.c
+++ b/lib.c
@@ -3853,8 +3853,7 @@ val sort(val seq, val lessfun, val keyfun)
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);
+ return mut(sort_list(seq, lessfun, keyfun));
}
sort_vec(seq, lessfun, keyfun);
diff --git a/lib.h b/lib.h
index 6a3568db..2b6baecc 100644
--- a/lib.h
+++ b/lib.h
@@ -235,7 +235,7 @@ val gc_set(val *, val);
#define mpush(val, place) (gc_push(val, &(place)))
#else
#define set(place, val) ((place) = (val))
-#define mut(obj)
+#define mut(obj) (obj)
#define mpush(val, place) (push(val, &(place)))
#endif
diff --git a/unwind.c b/unwind.c
index 21ca499c..e76ace02 100644
--- a/unwind.c
+++ b/unwind.c
@@ -403,7 +403,9 @@ void uw_continue(uw_frame_t *current, uw_frame_t *cont)
void uw_init(void)
{
- protect(&toplevel_env.ev.func_bindings, &exception_subtypes, (val *) 0);
+ protect(&toplevel_env.ev.func_bindings,
+ &toplevel_env.ev.match_context,
+ &exception_subtypes, (val *) 0);
exception_subtypes = cons(cons(t, nil), exception_subtypes);
uw_register_subtype(type_error_s, error_s);
uw_register_subtype(internal_error_s, error_s);