emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/alloc.c [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/alloc.c [lexbind]
Date: Tue, 06 Jul 2004 07:12:00 -0400

Index: emacs/src/alloc.c
diff -c emacs/src/alloc.c:1.272.2.7 emacs/src/alloc.c:1.272.2.8
*** emacs/src/alloc.c:1.272.2.7 Tue Jul  6 09:14:34 2004
--- emacs/src/alloc.c   Tue Jul  6 09:23:52 2004
***************
*** 1893,1900 ****
  
  
  DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0,
!        doc: /* Return a newly created string of length LENGTH, with each 
element being INIT.
! Both LENGTH and INIT must be numbers.  */)
       (length, init)
       Lisp_Object length, init;
  {
--- 1893,1901 ----
  
  
  DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0,
!        doc: /* Return a newly created string of length LENGTH, with INIT in 
each element.
! LENGTH must be an integer.
! INIT must be an integer that represents a character.  */)
       (length, init)
       Lisp_Object length, init;
  {
***************
*** 2334,2340 ****
    cons_free_list = ptr;
  }
  
- 
  DEFUN ("cons", Fcons, Scons, 2, 2, 0,
         doc: /* Create a new cons, give it CAR and CDR as components, and 
return it.  */)
       (car, cdr)
--- 2335,2340 ----
***************
*** 4287,4292 ****
--- 4287,4294 ----
    /* If nargs is UNEVALLED, args points to slot holding list of
       unevalled args.  */
    char evalargs;
+   /* Nonzero means call value of debugger when done with this operation. */
+   char debug_on_exit;
  };
  
  
***************
*** 4466,4499 ****
      }
    mark_kboards ();
  
!   /* Look thru every buffer's undo list
!      for elements that update markers that were not marked,
!      and delete them.  */
    {
      register struct buffer *nextb = all_buffers;
  
      while (nextb)
        {
        /* If a buffer's undo list is Qt, that means that undo is
!          turned off in that buffer.  Calling truncate_undo_list on
!          Qt tends to return NULL, which effectively turns undo back on.
!          So don't call truncate_undo_list if undo_list is Qt.  */
        if (! EQ (nextb->undo_list, Qt))
          {
!           Lisp_Object tail, prev;
            tail = nextb->undo_list;
            prev = Qnil;
            while (CONSP (tail))
              {
!               if (GC_CONSP (XCAR (tail))
!                   && GC_MARKERP (XCAR (XCAR (tail)))
!                   && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit)
                  {
                    if (NILP (prev))
!                     nextb->undo_list = tail = XCDR (tail);
                    else
                      {
!                       tail = XCDR (tail);
                        XSETCDR (prev, tail);
                      }
                  }
--- 4468,4520 ----
      }
    mark_kboards ();
  
! #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
!   mark_stack ();
! #endif
! 
! #ifdef USE_GTK
!   {
!     extern void xg_mark_data ();
!     xg_mark_data ();
!   }
! #endif
! 
!   gc_sweep ();
! 
!   /* Look thru every buffer's undo list for elements that used to
!      contain update markers that were changed to Lisp_Misc_Free
!      objects and delete them.  This may leave a few cons cells
!      unchained, but we will get those on the next sweep.  */
    {
      register struct buffer *nextb = all_buffers;
  
      while (nextb)
        {
        /* If a buffer's undo list is Qt, that means that undo is
!          turned off in that buffer.  */
        if (! EQ (nextb->undo_list, Qt))
          {
!           Lisp_Object tail, prev, elt, car;
            tail = nextb->undo_list;
            prev = Qnil;
            while (CONSP (tail))
              {
!               if ((elt = XCAR (tail), GC_CONSP (elt))
!                   && (car = XCAR (elt), GC_MISCP (car))
!                   && XMISCTYPE (car) == Lisp_Misc_Free)
                  {
+                   Lisp_Object cdr = XCDR (tail);
+                   /* Do not use free_cons here, as we don't know if
+                      anybody else has a pointer to these conses.  */
+                   XSETCAR (elt, Qnil);
+                   XSETCDR (elt, Qnil);
+                   XSETCAR (tail, Qnil);
+                   XSETCDR (tail, Qnil);
                    if (NILP (prev))
!                     nextb->undo_list = tail = cdr;
                    else
                      {
!                       tail = cdr;
                        XSETCDR (prev, tail);
                      }
                  }
***************
*** 4509,4527 ****
        }
    }
  
- #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
-   mark_stack ();
- #endif
- 
- #ifdef USE_GTK
-   {
-     extern void xg_mark_data ();
-     xg_mark_data ();
-   }
- #endif
- 
-   gc_sweep ();
- 
    /* Clear the mark bits that we set in certain root slots.  */
  
    unmark_byte_stack ();
--- 4530,4535 ----
***************
*** 4977,4990 ****
        break;
  
      case Lisp_Misc:
-       if (XMISCTYPE (obj) == Lisp_Misc_Free)
-       {
-         /* This is (probably) a freed marker which may still exist on
-            a buffer undo list, so accept it here, as check below will
-            fail (not live).  KFS 2004-05-17 */
-         XMARKER (obj)->gcmarkbit = 1;
-         break;
-       }
        CHECK_ALLOCATED_AND_LIVE (live_misc_p);
        if (XMARKER (obj)->gcmarkbit)
        break;
--- 4985,4990 ----
***************
*** 5210,5225 ****
  static void
  gc_sweep ()
  {
-   /* Remove or mark entries in weak hash tables.
-      This must be done before any object is unmarked.  */
-   sweep_weak_hash_tables ();
- 
-   sweep_strings ();
- #ifdef GC_CHECK_STRING_BYTES
-   if (!noninteractive)
-     check_string_bytes (1);
- #endif
- 
    /* Put all unmarked conses on free list */
    {
      register struct cons_block *cblk;
--- 5210,5215 ----
***************
*** 5270,5275 ****
--- 5260,5275 ----
      total_free_conses = num_free;
    }
  
+   /* Remove or mark entries in weak hash tables.
+      This must be done before any object is unmarked.  */
+   sweep_weak_hash_tables ();
+ 
+   sweep_strings ();
+ #ifdef GC_CHECK_STRING_BYTES
+   if (!noninteractive)
+     check_string_bytes (1);
+ #endif
+ 
    /* Put all unmarked floats on free list */
    {
      register struct float_block *fblk;
***************
*** 5468,5473 ****
--- 5468,5476 ----
        /* If this block contains only free markers and we have already
           seen more than two blocks worth of free markers then deallocate
           this block.  */
+ #if 0
+       /* There may still be pointers to these markers from a buffer's
+          undo list, so don't free them.  KFS 2004-05-21  /
        if (this_free == MARKER_BLOCK_SIZE && num_free > MARKER_BLOCK_SIZE)
          {
            *mprev = mblk->next;
***************
*** 5477,5482 ****
--- 5480,5486 ----
            n_marker_blocks--;
          }
        else
+ #endif
          {
            num_free += this_free;
            mprev = &mblk->next;




reply via email to

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