Commit 8834c57a authored by Paul Eggert's avatar Paul Eggert

Improve fix for macroexp crash with debugging.

* lisp.h (ASET) [ENABLE_CHECKING]: Pay attention to
ARRAY_MARK_FLAG when checking subscripts, because ASET is
not supposed to be invoked from the garbage collector.
See Andreas Schwab in <http://bugs.gnu.org/12118#25>.
(gc_aset): New function, which is like ASET but can be
used in the garbage collector.
(set_hash_key, set_hash_value, set_hash_next, set_hash_hash)
(set_hash_index): Use it instead of ASET.
parent ef834897
2012-08-03 Paul Eggert <eggert@cs.ucla.edu>
Improve fix for macroexp crash with debugging (Bug#12118).
* lisp.h (ASET) [ENABLE_CHECKING]: Pay attention to
ARRAY_MARK_FLAG when checking subscripts, because ASET is
not supposed to be invoked from the garbage collector.
See Andreas Schwab in <http://bugs.gnu.org/12118#25>.
(gc_aset): New function, which is like ASET but can be
used in the garbage collector.
(set_hash_key, set_hash_value, set_hash_next, set_hash_hash)
(set_hash_index): Use it instead of ASET.
2012-08-03 Eli Zaretskii <eliz@gnu.org>
Support symlinks on latest versions of MS-Windows.
......
......@@ -608,7 +608,7 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
/* The IDX==IDX tries to detect when the macro argument is side-effecting. */
#define ASET(ARRAY, IDX, VAL) \
(eassert ((IDX) == (IDX)), \
eassert ((IDX) >= 0 && (IDX) < (ASIZE (ARRAY) & ~ARRAY_MARK_FLAG)), \
eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \
XVECTOR (ARRAY)->contents[IDX] = (VAL))
/* Convenience macros for dealing with Lisp strings. */
......@@ -2355,34 +2355,42 @@ aref_addr (Lisp_Object array, ptrdiff_t idx)
return & XVECTOR (array)->contents[idx];
}
LISP_INLINE void
gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
{
/* Like ASET, but also can be used in the garbage collector. */
eassert (0 <= idx && idx < (ASIZE (array) & ~ARRAY_MARK_FLAG));
XVECTOR (array)->contents[idx] = val;
}
LISP_INLINE void
set_hash_key (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
{
ASET (h->key_and_value, 2 * idx, val);
gc_aset (h->key_and_value, 2 * idx, val);
}
LISP_INLINE void
set_hash_value (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
{
ASET (h->key_and_value, 2 * idx + 1, val);
gc_aset (h->key_and_value, 2 * idx + 1, val);
}
LISP_INLINE void
set_hash_next (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
{
ASET (h->next, idx, val);
gc_aset (h->next, idx, val);
}
LISP_INLINE void
set_hash_hash (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
{
ASET (h->hash, idx, val);
gc_aset (h->hash, idx, val);
}
LISP_INLINE void
set_hash_index (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
{
ASET (h->index, idx, val);
gc_aset (h->index, idx, val);
}
/* Defined in data.c. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment