emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/pvsize c9b173e: Please revew: PVSIZE, pseudovector


From: Lars Brinkhoff
Subject: [Emacs-diffs] scratch/pvsize c9b173e: Please revew: PVSIZE, pseudovector size.
Date: Mon, 10 Apr 2017 02:32:59 -0400 (EDT)

branch: scratch/pvsize
commit c9b173eff5154cfd2d7567cdf400e48c88fd51d2
Author: Lars Brinkhoff <address@hidden>
Commit: Lars Brinkhoff <address@hidden>

    Please revew: PVSIZE, pseudovector size.
---
 src/chartab.c | 2 +-
 src/data.c    | 9 ++++-----
 src/doc.c     | 4 ++--
 src/eval.c    | 9 ++++-----
 src/fns.c     | 5 ++---
 src/font.h    | 6 +++---
 src/lisp.h    | 6 ++++++
 src/lread.c   | 2 +-
 src/print.c   | 2 +-
 9 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/src/chartab.c b/src/chartab.c
index fa5a8e4..8392c0c 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -185,7 +185,7 @@ Lisp_Object
 copy_char_table (Lisp_Object table)
 {
   Lisp_Object copy;
-  int size = XCHAR_TABLE (table)->header.size & PSEUDOVECTOR_SIZE_MASK;
+  int size = PVSIZE (table);
   int i;
 
   copy = Fmake_vector (make_number (size), Qnil);
diff --git a/src/data.c b/src/data.c
index 903e809..141b26c 100644
--- a/src/data.c
+++ b/src/data.c
@@ -270,7 +270,7 @@ for example, (type-of 1) returns `integer'.  */)
         case PVEC_RECORD:
           {
             Lisp_Object t = AREF (object, 0);
-            if (RECORDP (t) && 1 < (ASIZE (t) & PSEUDOVECTOR_SIZE_MASK))
+            if (RECORDP (t) && 1 < PVSIZE (t))
               /* Return the type name field of the class!  */
               return AREF (t, 1);
             else
@@ -902,7 +902,7 @@ Value, if non-nil, is a list (interactive SPEC).  */)
     }
   else if (COMPILEDP (fun))
     {
-      if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE)
+      if (PVSIZE (fun) > COMPILED_INTERACTIVE)
        return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE));
     }
   else if (AUTOLOADP (fun))
@@ -2306,7 +2306,7 @@ or a byte-code object.  IDX starts at 0.  */)
       if (VECTORP (array))
        size = ASIZE (array);
       else if (COMPILEDP (array) || RECORDP (array))
-       size = ASIZE (array) & PSEUDOVECTOR_SIZE_MASK;
+       size = PVSIZE (array);
       else
        wrong_type_argument (Qarrayp, array);
 
@@ -2349,8 +2349,7 @@ bool-vector.  IDX starts at 0.  */)
     }
   else if (RECORDP (array))
     {
-      ptrdiff_t size = ASIZE (array) & PSEUDOVECTOR_SIZE_MASK;
-      if (idxval < 0 || idxval >= size)
+      if (idxval < 0 || idxval >= PVSIZE (array))
        args_out_of_range (array, idx);
       ASET (array, idxval, newelt);
     }
diff --git a/src/doc.c b/src/doc.c
index 1e7e3fc..dd674e3 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -342,7 +342,7 @@ string is passed through `substitute-command-keys'.  */)
     doc = make_number (XSUBR (fun)->doc);
   else if (COMPILEDP (fun))
     {
-      if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING)
+      if (PVSIZE (fun) <= COMPILED_DOC_STRING)
        return Qnil;
       else
        {
@@ -500,7 +500,7 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset)
     {
       /* This bytecode object must have a slot for the
         docstring, since we've found a docstring for it.  */
-      if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_DOC_STRING)
+      if (PVSIZE (fun) > COMPILED_DOC_STRING)
        ASET (fun, COMPILED_DOC_STRING, make_number (offset));
       else
        {
diff --git a/src/eval.c b/src/eval.c
index 16d1cf8..af0912f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1881,8 +1881,7 @@ then strings and vectors are not accepted.  */)
      have an element whose index is COMPILED_INTERACTIVE, which is
      where the interactive spec is stored.  */
   else if (COMPILEDP (fun))
-    return ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE
-           ? Qt : if_prop);
+    return (PVSIZE (fun) > COMPILED_INTERACTIVE ? Qt : if_prop);
 
   /* Strings and vectors are keyboard macros.  */
   if (STRINGP (fun) || VECTORP (fun))
@@ -2922,7 +2921,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
     }
   else if (COMPILEDP (fun))
     {
-      ptrdiff_t size = ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK;
+      ptrdiff_t size = PVSIZE (fun);
       if (size <= COMPILED_STACK_DEPTH)
        xsignal1 (Qinvalid_function, fun);
       syms_left = AREF (fun, COMPILED_ARGLIST);
@@ -3103,7 +3102,7 @@ lambda_arity (Lisp_Object fun)
     }
   else if (COMPILEDP (fun))
     {
-      ptrdiff_t size = ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK;
+      ptrdiff_t size = PVSIZE (fun);
       if (size <= COMPILED_STACK_DEPTH)
        xsignal1 (Qinvalid_function, fun);
       syms_left = AREF (fun, COMPILED_ARGLIST);
@@ -3148,7 +3147,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
 
   if (COMPILEDP (object))
     {
-      ptrdiff_t size = ASIZE (object) & PSEUDOVECTOR_SIZE_MASK;
+      ptrdiff_t size = PVSIZE (object);
       if (size <= COMPILED_STACK_DEPTH)
        xsignal1 (Qinvalid_function, object);
       if (CONSP (AREF (object, COMPILED_BYTECODE)))
diff --git a/src/fns.c b/src/fns.c
index 2f07c2c..10d35b6 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -107,7 +107,7 @@ To get the number of bytes, use `string-bytes'.  */)
   else if (BOOL_VECTOR_P (sequence))
     XSETFASTINT (val, bool_vector_size (sequence));
   else if (COMPILEDP (sequence) || RECORDP (sequence))
-    XSETFASTINT (val, ASIZE (sequence) & PSEUDOVECTOR_SIZE_MASK);
+    XSETFASTINT (val, PVSIZE (sequence));
   else if (CONSP (sequence))
     {
       intptr_t i = 0;
@@ -484,8 +484,7 @@ shared with the original.  */)
 
   if (RECORDP (arg))
     {
-      ptrdiff_t size = ASIZE (arg) & PSEUDOVECTOR_SIZE_MASK;
-      return Frecord (size, XVECTOR (arg)->contents);
+      return Frecord (PVSIZE (arg), XVECTOR (arg)->contents);
     }
 
   if (CHAR_TABLE_P (arg))
diff --git a/src/font.h b/src/font.h
index a469b20..53e3fc2 100644
--- a/src/font.h
+++ b/src/font.h
@@ -424,7 +424,7 @@ FONTP (Lisp_Object x)
 INLINE bool
 FONT_SPEC_P (Lisp_Object x)
 {
-  return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX;
+  return FONTP (x) && PVSIZE (x) == FONT_SPEC_MAX;
 }
 
 /* Like FONT_SPEC_P, but can be used in the garbage collector.  */
@@ -438,7 +438,7 @@ GC_FONT_SPEC_P (Lisp_Object x)
 INLINE bool
 FONT_ENTITY_P (Lisp_Object x)
 {
-  return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX;
+  return FONTP (x) && PVSIZE (x) == FONT_ENTITY_MAX;
 }
 
 /* Like FONT_ENTITY_P, but can be used in the garbage collector.  */
@@ -452,7 +452,7 @@ GC_FONT_ENTITY_P (Lisp_Object x)
 INLINE bool
 FONT_OBJECT_P (Lisp_Object x)
 {
-  return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX;
+  return FONTP (x) && PVSIZE (x) == FONT_OBJECT_MAX;
 }
 
 /* Like FONT_OBJECT_P, but can be used in the garbage collector.  */
diff --git a/src/lisp.h b/src/lisp.h
index 5e7d41b..678e261 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1401,6 +1401,12 @@ ASIZE (Lisp_Object array)
   return size;
 }
 
+INLINE ptrdiff_t
+PVSIZE (Lisp_Object pv)
+{
+  return ASIZE (pv) & PSEUDOVECTOR_SIZE_MASK;
+}
+
 INLINE bool
 VECTORP (Lisp_Object x)
 {
diff --git a/src/lread.c b/src/lread.c
index 513f63e..3b2e123 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3402,7 +3402,7 @@ substitute_object_recurse (Lisp_Object object, 
Lisp_Object placeholder, Lisp_Obj
        else if (CHAR_TABLE_P (subtree) || SUB_CHAR_TABLE_P (subtree)
                 || COMPILEDP (subtree) || HASH_TABLE_P (subtree)
                 || RECORDP (subtree))
-         length = ASIZE (subtree) & PSEUDOVECTOR_SIZE_MASK;
+         length = PVSIZE (subtree);
        else if (VECTORP (subtree))
          length = ASIZE (subtree);
        else
diff --git a/src/print.c b/src/print.c
index 76f2639..872103b 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1966,7 +1966,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
 
       case PVEC_RECORD:
        {
-         ptrdiff_t n, size = ASIZE (obj) & PSEUDOVECTOR_SIZE_MASK;
+         ptrdiff_t n, size = PVSIZE (obj);
          int i;
 
          /* Don't print more elements than the specified maximum.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]