emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r108842: * src/alloc.c (mark_object):


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108842: * src/alloc.c (mark_object): Revert part of last patch to use `switch'.
Date: Tue, 03 Jul 2012 10:37:55 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108842
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2012-07-03 10:37:55 -0400
message:
  * src/alloc.c (mark_object): Revert part of last patch to use `switch'.
  * src/lisp.h (Lisp_Misc, Lisp_Fwd): Move around to group better.
modified:
  src/ChangeLog
  src/alloc.c
  src/lisp.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-03 11:09:36 +0000
+++ b/src/ChangeLog     2012-07-03 14:37:55 +0000
@@ -1,3 +1,9 @@
+2012-07-03  Stefan Monnier  <address@hidden>
+
+       * lisp.h (Lisp_Misc, Lisp_Fwd): Move around to group better.
+
+       * alloc.c (mark_object): Revert part of last patch to use `switch'.
+
 2012-07-03  Dmitry Antipov  <address@hidden>
 
        * alloc.c (allocate_vector_block): Remove redundant

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-03 11:09:36 +0000
+++ b/src/alloc.c       2012-07-03 14:37:55 +0000
@@ -5730,15 +5730,15 @@
   ptrdiff_t i;
 
   eassert (!VECTOR_MARKED_P (ptr));
-  VECTOR_MARK (ptr);           /* Else mark it */
+  VECTOR_MARK (ptr);           /* Else mark it.  */
   if (size & PSEUDOVECTOR_FLAG)
     size &= PSEUDOVECTOR_SIZE_MASK;
 
   /* Note that this size is not the memory-footprint size, but only
      the number of Lisp_Object fields that we should trace.
      The distinction is used e.g. by Lisp_Process which places extra
-     non-Lisp_Object fields at the end of the structure.  */
-  for (i = 0; i < size; i++) /* and then mark its elements */
+     non-Lisp_Object fields at the end of the structure...  */
+  for (i = 0; i < size; i++) /* ...and then mark its elements.  */
     mark_object (ptr->contents[i]);
 }
 
@@ -5875,11 +5875,11 @@
        if (STRING_MARKED_P (ptr))
          break;
        CHECK_ALLOCATED_AND_LIVE (live_string_p);
+       MARK_STRING (ptr);
        MARK_INTERVAL_TREE (ptr->intervals);
-       MARK_STRING (ptr);
 #ifdef GC_CHECK_STRING_BYTES
        /* Check that the string size recorded in the string is the
-          same as the one recorded in the sdata structure. */
+          same as the one recorded in the sdata structure.  */
        CHECK_STRING_BYTES (ptr);
 #endif /* GC_CHECK_STRING_BYTES */
       }
@@ -6034,7 +6034,7 @@
        ptr = ptr->next;
        if (ptr)
          {
-           ptrx = ptr;         /* Use of ptrx avoids compiler bug on Sun */
+           ptrx = ptr;         /* Use of ptrx avoids compiler bug on Sun.  */
            XSETSYMBOL (obj, ptrx);
            goto loop;
          }
@@ -6044,34 +6044,42 @@
     case Lisp_Misc:
       CHECK_ALLOCATED_AND_LIVE (live_misc_p);
 
-      if (XMISCTYPE (obj) == Lisp_Misc_Overlay)
-       mark_overlay (XOVERLAY (obj));
-      else
+      if (XMISCANY (obj)->gcmarkbit)
+       break;
+
+      switch (XMISCTYPE (obj))
        {
-         if (XMISCANY (obj)->gcmarkbit)
-           break;
-         XMISCANY (obj)->gcmarkbit = 1;
-
-         /* Note that we don't mark thru the marker's
-            chain.  The buffer's markers chain does not
-            preserve markers from GC; instead, markers
-            are removed from the chain when freed by GC.  */
-
+       case Lisp_Misc_Marker:
+         /* DO NOT mark thru the marker's chain.
+            The buffer's markers chain does not preserve markers from gc;
+            instead, markers are removed from the chain when freed by gc.  */
+         XMISCANY (obj)->gcmarkbit = 1;
+         break;
+
+       case Lisp_Misc_Save_Value:
+         XMISCANY (obj)->gcmarkbit = 1;
 #if GC_MARK_STACK
-         if (XMISCTYPE (obj) == Lisp_Misc_Save_Value)
-           {
-             register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj);
-             /* If DOGC is set, POINTER is the address of a memory
-                area containing INTEGER potential Lisp_Objects.  */
-             if (ptr->dogc)
-               {
-                 Lisp_Object *p = (Lisp_Object *) ptr->pointer;
-                 ptrdiff_t nelt;
-                 for (nelt = ptr->integer; nelt > 0; nelt--, p++)
-                   mark_maybe_object (*p);
-               }
-           }
+         {
+           register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj);
+           /* If DOGC is set, POINTER is the address of a memory
+              area containing INTEGER potential Lisp_Objects.  */
+           if (ptr->dogc)
+             {
+               Lisp_Object *p = (Lisp_Object *) ptr->pointer;
+               ptrdiff_t nelt;
+               for (nelt = ptr->integer; nelt > 0; nelt--, p++)
+                 mark_maybe_object (*p);
+             }
+         }
 #endif
+         break;
+
+       case Lisp_Misc_Overlay:
+         mark_overlay (XOVERLAY (obj));
+         break;
+
+       default:
+         abort ();
        }
       break;
 

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-06-30 09:13:54 +0000
+++ b/src/lisp.h        2012-07-03 14:37:55 +0000
@@ -542,11 +542,11 @@
 
 /* The cast to struct vectorlike_header * avoids aliasing issues.  */
 #define XSETPSEUDOVECTOR(a, b, code) \
-  XSETTYPED_PSEUDOVECTOR(a, b,       \
-                        (((struct vectorlike_header *) \
-                          XUNTAG (a, Lisp_Vectorlike)) \
-                         ->size),                      \
-                        code)
+  XSETTYPED_PSEUDOVECTOR (a, b,                                        \
+                         (((struct vectorlike_header *)        \
+                           XUNTAG (a, Lisp_Vectorlike))        \
+                          ->size),                             \
+                         code)
 #define XSETTYPED_PSEUDOVECTOR(a, b, size, code)                       \
   (XSETVECTOR (a, b),                                                  \
    eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK))              \
@@ -1258,6 +1258,63 @@
   ptrdiff_t bytepos;
 };
 
+/* START and END are markers in the overlay's buffer, and
+   PLIST is the overlay's property list.  */
+struct Lisp_Overlay
+/* An overlay's real data content is:
+   - plist
+   - buffer
+   - insertion type of both ends
+   - start & start_byte
+   - end & end_byte
+   - next (singly linked list of overlays).
+   - start_next and end_next (singly linked list of markers).
+   I.e. 9words plus 2 bits, 3words of which are for external linked lists.
+*/
+  {
+    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Overlay */
+    unsigned gcmarkbit : 1;
+    int spacer : 15;
+    struct Lisp_Overlay *next;
+    Lisp_Object start, end, plist;
+  };
+
+/* Hold a C pointer for later use.
+   This type of object is used in the arg to record_unwind_protect.  */
+struct Lisp_Save_Value
+  {
+    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Save_Value */
+    unsigned gcmarkbit : 1;
+    int spacer : 14;
+    /* If DOGC is set, POINTER is the address of a memory
+       area containing INTEGER potential Lisp_Objects.  */
+    unsigned int dogc : 1;
+    void *pointer;
+    ptrdiff_t integer;
+  };
+
+
+/* A miscellaneous object, when it's on the free list.  */
+struct Lisp_Free
+  {
+    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Free */
+    unsigned gcmarkbit : 1;
+    int spacer : 15;
+    union Lisp_Misc *chain;
+  };
+
+/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
+   It uses one of these struct subtypes to get the type field.  */
+
+union Lisp_Misc
+  {
+    struct Lisp_Misc_Any u_any;           /* Supertype of all Misc types.  */
+    struct Lisp_Free u_free;
+    struct Lisp_Marker u_marker;
+    struct Lisp_Overlay u_overlay;
+    struct Lisp_Save_Value u_save_value;
+  };
+
 /* Forwarding pointer to an int variable.
    This is allowed only in the value cell of a symbol,
    and it means that the symbol's value really lives in the
@@ -1324,13 +1381,13 @@
 struct Lisp_Buffer_Local_Value
   {
     /* 1 means that merely setting the variable creates a local
-       binding for the current buffer */
+       binding for the current buffer.  */
     unsigned int local_if_set : 1;
     /* 1 means this variable can have frame-local bindings, otherwise, it is
        can have buffer-local bindings.  The two cannot be combined.  */
     unsigned int frame_local : 1;
     /* 1 means that the binding now loaded was found.
-       Presumably equivalent to (defcell!=valcell) */
+       Presumably equivalent to (defcell!=valcell).  */
     unsigned int found : 1;
     /* If non-NULL, a forwarding to the C var where it should also be set.  */
     union Lisp_Fwd *fwd;       /* Should never be (Buffer|Kboard)_Objfwd.  */
@@ -1355,27 +1412,6 @@
 #define BLV_VALUE(blv) (XCDR ((blv)->valcell))
 #define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v))
 
-/* START and END are markers in the overlay's buffer, and
-   PLIST is the overlay's property list.  */
-struct Lisp_Overlay
-/* An overlay's real data content is:
-   - plist
-   - buffer
-   - insertion type of both ends
-   - start & start_byte
-   - end & end_byte
-   - next (singly linked list of overlays).
-   - start_next and end_next (singly linked list of markers).
-   I.e. 9words plus 2 bits, 3words of which are for external linked lists.
-*/
-  {
-    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Overlay */
-    unsigned gcmarkbit : 1;
-    int spacer : 15;
-    struct Lisp_Overlay *next;
-    Lisp_Object start, end, plist;
-  };
-
 /* Like Lisp_Objfwd except that value lives in a slot in the
    current kboard.  */
 struct Lisp_Kboard_Objfwd
@@ -1384,42 +1420,6 @@
     int offset;
   };
 
-/* Hold a C pointer for later use.
-   This type of object is used in the arg to record_unwind_protect.  */
-struct Lisp_Save_Value
-  {
-    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Save_Value */
-    unsigned gcmarkbit : 1;
-    int spacer : 14;
-    /* If DOGC is set, POINTER is the address of a memory
-       area containing INTEGER potential Lisp_Objects.  */
-    unsigned int dogc : 1;
-    void *pointer;
-    ptrdiff_t integer;
-  };
-
-
-/* A miscellaneous object, when it's on the free list.  */
-struct Lisp_Free
-  {
-    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Free */
-    unsigned gcmarkbit : 1;
-    int spacer : 15;
-    union Lisp_Misc *chain;
-  };
-
-/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
-   It uses one of these struct subtypes to get the type field.  */
-
-union Lisp_Misc
-  {
-    struct Lisp_Misc_Any u_any;           /* Supertype of all Misc types.  */
-    struct Lisp_Free u_free;
-    struct Lisp_Marker u_marker;
-    struct Lisp_Overlay u_overlay;
-    struct Lisp_Save_Value u_save_value;
-  };
-
 union Lisp_Fwd
   {
     struct Lisp_Intfwd u_intfwd;
@@ -1429,7 +1429,7 @@
     struct Lisp_Kboard_Objfwd u_kboard_objfwd;
   };
 
-/* Lisp floating point type */
+/* Lisp floating point type.  */
 struct Lisp_Float
   {
     union


reply via email to

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