aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2015-01-20 13:56:14 -0800
committerPaul Eggert2015-01-20 13:56:46 -0800
commit0dd19ac82662c5710e73852f438fd55e1d9225b7 (patch)
tree67074879f366306af045d28f68d208fc2cf1a0ff /src
parent3a8312d00e59b50e76121cd512177e999c18b06d (diff)
downloademacs-0dd19ac82662c5710e73852f438fd55e1d9225b7.tar.gz
emacs-0dd19ac82662c5710e73852f438fd55e1d9225b7.zip
Undo port to hypothetical nonzero Qnil case
This mostly undoes the previous change in this area. See: http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00570.html * alloc.c (allocate_pseudovector): * callint.c (Fcall_interactively): * dispnew.c (realloc_glyph_pool): * fringe.c (init_fringe): * lisp.h (memsetnil): * xdisp.c (init_iterator): Simplify by assuming that Qnil is zero, but verify the assumption. * lisp.h (NIL_IS_ZERO): Revert back to this symbol, removing NIL_IS_NONZERO. All uses changed.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/alloc.c5
-rw-r--r--src/callint.c3
-rw-r--r--src/dispnew.c13
-rw-r--r--src/fringe.c3
-rw-r--r--src/lisp.h14
-rw-r--r--src/xdisp.c15
7 files changed, 35 insertions, 33 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a320e22c65c..e5e4fe9edb0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12015-01-20 Paul Eggert <eggert@cs.ucla.edu>
2
3 Undo port to hypothetical nonzero Qnil case
4 This mostly undoes the previous change in this area. See:
5 http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00570.html
6 * alloc.c (allocate_pseudovector):
7 * callint.c (Fcall_interactively):
8 * dispnew.c (realloc_glyph_pool):
9 * fringe.c (init_fringe):
10 * lisp.h (memsetnil):
11 * xdisp.c (init_iterator):
12 Simplify by assuming that Qnil is zero, but verify the assumption.
13 * lisp.h (NIL_IS_ZERO): Revert back to this symbol, removing
14 NIL_IS_NONZERO. All uses changed.
15
12015-01-20 Jan Djärv <jan.h.d@swipnet.se> 162015-01-20 Jan Djärv <jan.h.d@swipnet.se>
2 17
3 * nsterm.m (EV_TRAILER2): Set Vinhibit_quit to Qt (Bug#19531). 18 * nsterm.m (EV_TRAILER2): Set Vinhibit_quit to Qt (Bug#19531).
diff --git a/src/alloc.c b/src/alloc.c
index d758ca18a7b..bf0456c6862 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3175,10 +3175,9 @@ allocate_pseudovector (int memlen, int lisplen,
3175 eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1); 3175 eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1);
3176 3176
3177 /* Only the first LISPLEN slots will be traced normally by the GC. 3177 /* Only the first LISPLEN slots will be traced normally by the GC.
3178 If Qnil is nonzero, clear the non-Lisp data separately. */ 3178 Since Qnil == 0, we can memset Lisp and non-Lisp data at one go. */
3179 verify (NIL_IS_ZERO);
3179 memsetnil (v->contents, zerolen); 3180 memsetnil (v->contents, zerolen);
3180 if (NIL_IS_NONZERO)
3181 memset (v->contents + lisplen, 0, (zerolen - lisplen) * word_size);
3182 3181
3183 XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); 3182 XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen);
3184 return v; 3183 return v;
diff --git a/src/callint.c b/src/callint.c
index 43566acfbe9..3a595b57d77 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -509,9 +509,8 @@ invoke it. If KEYS is omitted or nil, the return value of
509 visargs = args + nargs; 509 visargs = args + nargs;
510 varies = (signed char *) (visargs + nargs); 510 varies = (signed char *) (visargs + nargs);
511 511
512 verify (NIL_IS_ZERO);
512 memset (args, 0, nargs * (2 * word_size + 1)); 513 memset (args, 0, nargs * (2 * word_size + 1));
513 if (NIL_IS_NONZERO)
514 memsetnil (args, nargs * 2);
515 514
516 GCPRO5 (prefix_arg, function, *args, *visargs, up_event); 515 GCPRO5 (prefix_arg, function, *args, *visargs, up_event);
517 gcpro3.nvars = nargs; 516 gcpro3.nvars = nargs;
diff --git a/src/dispnew.c b/src/dispnew.c
index 06b34d88077..9af0ae57b2e 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1339,15 +1339,14 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
1339 ptrdiff_t old_nglyphs = pool->nglyphs; 1339 ptrdiff_t old_nglyphs = pool->nglyphs;
1340 pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs, 1340 pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs,
1341 needed - old_nglyphs, -1, sizeof *pool->glyphs); 1341 needed - old_nglyphs, -1, sizeof *pool->glyphs);
1342
1343 /* Redisplay relies on nil as the object of special glyphs
1344 (truncation and continuation glyphs and also blanks used to
1345 extend each line on a TTY), so verify that memset does this. */
1346 verify (NIL_IS_ZERO);
1347
1342 memset (pool->glyphs + old_nglyphs, 0, 1348 memset (pool->glyphs + old_nglyphs, 0,
1343 (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs); 1349 (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs);
1344
1345 /* Set the object of each glyph to nil. Redisplay relies on
1346 this for objects of special glyphs (truncation and continuation
1347 glyphs and also blanks used to extend each line on a TTY). */
1348 if (NIL_IS_NONZERO)
1349 for (ptrdiff_t i = old_nglyphs; i < pool->nglyphs; i++)
1350 pool->glyphs[i].object = Qnil;
1351 } 1350 }
1352 1351
1353 /* Remember the number of rows and columns because (a) we use them 1352 /* Remember the number of rows and columns because (a) we use them
diff --git a/src/fringe.c b/src/fringe.c
index a494f681cd7..464379d0cd0 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1727,9 +1727,8 @@ init_fringe (void)
1727 1727
1728 fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps); 1728 fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps);
1729 1729
1730 verify (NIL_IS_ZERO);
1730 fringe_faces = xzalloc (max_fringe_bitmaps * sizeof *fringe_faces); 1731 fringe_faces = xzalloc (max_fringe_bitmaps * sizeof *fringe_faces);
1731 if (NIL_IS_NONZERO)
1732 memsetnil (fringe_faces, max_fringe_bitmaps);
1733} 1732}
1734 1733
1735#ifdef HAVE_NTGUI 1734#ifdef HAVE_NTGUI
diff --git a/src/lisp.h b/src/lisp.h
index 119257bc4b9..8967d6e56ce 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1503,22 +1503,18 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
1503 XVECTOR (array)->contents[idx] = val; 1503 XVECTOR (array)->contents[idx] = val;
1504} 1504}
1505 1505
1506/* True if Qnil's representation is nonzero. This is always false currently, 1506/* True, since Qnil's representation is zero. Every place in the code
1507 but there is fallback code for hypothetical alternative implementations. 1507 that assumes Qnil is zero should verify (NIL_IS_ZERO), to make it easy
1508 Compile with -DNIL_IS_NONZERO to test the fallback code. */ 1508 to find such assumptions later if we change Qnil to be nonzero. */
1509#ifndef NIL_IS_NONZERO 1509enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 };
1510enum { NIL_IS_NONZERO = XLI_BUILTIN_LISPSYM (iQnil) != 0 };
1511#endif
1512 1510
1513/* Set a Lisp_Object array V's N entries to nil. */ 1511/* Set a Lisp_Object array V's N entries to nil. */
1514INLINE void 1512INLINE void
1515memsetnil (Lisp_Object *v, ptrdiff_t n) 1513memsetnil (Lisp_Object *v, ptrdiff_t n)
1516{ 1514{
1517 eassert (0 <= n); 1515 eassert (0 <= n);
1516 verify (NIL_IS_ZERO);
1518 memset (v, 0, n * sizeof *v); 1517 memset (v, 0, n * sizeof *v);
1519 if (NIL_IS_NONZERO)
1520 for (ptrdiff_t i = 0; i < n; i++)
1521 v[i] = Qnil;
1522} 1518}
1523 1519
1524/* If a struct is made to look like a vector, this macro returns the length 1520/* If a struct is made to look like a vector, this macro returns the length
diff --git a/src/xdisp.c b/src/xdisp.c
index 9abaeb0d777..9611952e970 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2747,17 +2747,12 @@ init_iterator (struct it *it, struct window *w,
2747 } 2747 }
2748 2748
2749 /* Clear IT. */ 2749 /* Clear IT. */
2750
2751 /* The code assumes it->object and other Lisp_Object components are
2752 set to nil, so verify that memset does this. */
2753 verify (NIL_IS_ZERO);
2750 memset (it, 0, sizeof *it); 2754 memset (it, 0, sizeof *it);
2751 if (NIL_IS_NONZERO) 2755
2752 {
2753 it->string = Qnil;
2754 it->from_overlay = Qnil;
2755 it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil;
2756 it->space_width = Qnil;
2757 it->font_height = Qnil;
2758 it->object = Qnil;
2759 it->bidi_it.string.lstring = Qnil;
2760 }
2761 it->current.overlay_string_index = -1; 2756 it->current.overlay_string_index = -1;
2762 it->current.dpvec_index = -1; 2757 it->current.dpvec_index = -1;
2763 it->base_face_id = remapped_base_face_id; 2758 it->base_face_id = remapped_base_face_id;