diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-04-01 19:47:56 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-04-01 19:47:56 -0700 |
commit | 87ed8a692c059f1e81f8deeea3b4f727044a45fa (patch) | |
tree | b8f86e21ef965c2dbb0c3f8e8621760a62cf1943 /hash.c | |
parent | 34d0567bce45cc89fc6f476353b00b2649bcce4d (diff) | |
download | txr-87ed8a692c059f1e81f8deeea3b4f727044a45fa.tar.gz txr-87ed8a692c059f1e81f8deeea3b4f727044a45fa.tar.bz2 txr-87ed8a692c059f1e81f8deeea3b4f727044a45fa.zip |
Start of ground-work for ephemeral GC. We must add some abstraction
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.
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -346,7 +346,7 @@ static void hash_grow(struct hash *h) } h->modulus = new_modulus; - h->table = new_table; + set(h->table, new_table); } val make_hash(val weak_keys, val weak_vals, val equal_based) @@ -451,7 +451,7 @@ val set_hash_userdata(val hash, val data) { struct hash *h = (struct hash *) cobj_handle(hash, hash_s); val olddata = h->userdata; - h->userdata = data; + set(h->userdata, data); return olddata; } @@ -502,7 +502,7 @@ val hash_next(val *iter) *iter = nil; return nil; } - hi->cons = vecref(h->table, num(hi->chain)); + set(hi->cons, vecref(h->table, num(hi->chain))); } return car(hi->cons); } |