/[emacs]/emacs/src/alloc.c
ViewVC logotype

Diff of /emacs/src/alloc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.318.2.4 by miles, Mon Jun 28 07:29:17 2004 UTC revision 1.318.2.5 by miles, Tue Jun 29 16:46:01 2004 UTC
# Line 579  xstrdup (s) Line 579  xstrdup (s)
579  }  }
580    
581    
582    /* Unwind for SAFE_ALLOCA */
583    
584    Lisp_Object
585    safe_alloca_unwind (arg)
586         Lisp_Object arg;
587    {
588      register struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
589    
590      p->dogc = 0;
591      xfree (p->pointer);
592      p->pointer = 0;
593      free_misc (arg);
594      return Qnil;
595    }
596    
597    
598  /* Like malloc but used for allocating Lisp data.  NBYTES is the  /* Like malloc but used for allocating Lisp data.  NBYTES is the
599     number of bytes to allocate, TYPE describes the intended use of the     number of bytes to allocate, TYPE describes the intended use of the
600     allcated memory block (for strings, for conses, ...).  */     allcated memory block (for strings, for conses, ...).  */
# Line 2863  allocate_misc () Line 2879  allocate_misc ()
2879            marker_block = new;            marker_block = new;
2880            marker_block_index = 0;            marker_block_index = 0;
2881            n_marker_blocks++;            n_marker_blocks++;
2882              total_free_markers += MARKER_BLOCK_SIZE;
2883          }          }
2884        XSETMISC (val, &marker_block->markers[marker_block_index]);        XSETMISC (val, &marker_block->markers[marker_block_index]);
2885        marker_block_index++;        marker_block_index++;
2886      }      }
2887    
2888      --total_free_markers;
2889    consing_since_gc += sizeof (union Lisp_Misc);    consing_since_gc += sizeof (union Lisp_Misc);
2890    misc_objects_consed++;    misc_objects_consed++;
2891    XMARKER (val)->gcmarkbit = 0;    XMARKER (val)->gcmarkbit = 0;
2892    return val;    return val;
2893  }  }
2894    
2895    /* Free a Lisp_Misc object */
2896    
2897    void
2898    free_misc (misc)
2899         Lisp_Object misc;
2900    {
2901      XMISC (misc)->u_marker.type = Lisp_Misc_Free;
2902      XMISC (misc)->u_free.chain = marker_free_list;
2903      marker_free_list = XMISC (misc);
2904    
2905      total_free_markers++;
2906    }
2907    
2908  /* Return a Lisp_Misc_Save_Value object containing POINTER and  /* Return a Lisp_Misc_Save_Value object containing POINTER and
2909     INTEGER.  This is used to package C values to call record_unwind_protect.     INTEGER.  This is used to package C values to call record_unwind_protect.
2910     The unwind function can get the C values back using XSAVE_VALUE.  */     The unwind function can get the C values back using XSAVE_VALUE.  */
# Line 2891  make_save_value (pointer, integer) Line 2922  make_save_value (pointer, integer)
2922    p = XSAVE_VALUE (val);    p = XSAVE_VALUE (val);
2923    p->pointer = pointer;    p->pointer = pointer;
2924    p->integer = integer;    p->integer = integer;
2925      p->dogc = 0;
2926    return val;    return val;
2927  }  }
2928    
# Line 2919  free_marker (marker) Line 2951  free_marker (marker)
2951       Lisp_Object marker;       Lisp_Object marker;
2952  {  {
2953    unchain_marker (XMARKER (marker));    unchain_marker (XMARKER (marker));
2954      free_misc (marker);
   XMISC (marker)->u_marker.type = Lisp_Misc_Free;  
   XMISC (marker)->u_free.chain = marker_free_list;  
   marker_free_list = XMISC (marker);  
   
   total_free_markers++;  
2955  }  }
2956    
2957    
# Line 4924  mark_object (arg) Line 4951  mark_object (arg)
4951        if (XMARKER (obj)->gcmarkbit)        if (XMARKER (obj)->gcmarkbit)
4952          break;          break;
4953        XMARKER (obj)->gcmarkbit = 1;        XMARKER (obj)->gcmarkbit = 1;
4954    
4955        switch (XMISCTYPE (obj))        switch (XMISCTYPE (obj))
4956          {          {
4957          case Lisp_Misc_Buffer_Local_Value:          case Lisp_Misc_Buffer_Local_Value:
# Line 4948  mark_object (arg) Line 4976  mark_object (arg)
4976            /* DO NOT mark thru the marker's chain.            /* DO NOT mark thru the marker's chain.
4977               The buffer's markers chain does not preserve markers from gc;               The buffer's markers chain does not preserve markers from gc;
4978               instead, markers are removed from the chain when freed by gc.  */               instead, markers are removed from the chain when freed by gc.  */
4979              break;
4980    
4981          case Lisp_Misc_Intfwd:          case Lisp_Misc_Intfwd:
4982          case Lisp_Misc_Boolfwd:          case Lisp_Misc_Boolfwd:
4983          case Lisp_Misc_Objfwd:          case Lisp_Misc_Objfwd:
# Line 4957  mark_object (arg) Line 4987  mark_object (arg)
4987               since all markable slots in current buffer marked anyway.  */               since all markable slots in current buffer marked anyway.  */
4988            /* Don't need to do Lisp_Objfwd, since the places they point            /* Don't need to do Lisp_Objfwd, since the places they point
4989               are protected with staticpro.  */               are protected with staticpro.  */
4990              break;
4991    
4992          case Lisp_Misc_Save_Value:          case Lisp_Misc_Save_Value:
4993              {
4994                register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj);
4995                /* If DOGC is set, POINTER is the address of a memory
4996                   area containing INTEGER potential Lisp_Objects.  */
4997                if (ptr->dogc)
4998                  {
4999                    Lisp_Object *p = (Lisp_Object *) ptr->pointer;
5000                    int nelt;
5001                    for (nelt = ptr->integer; nelt > 0; nelt--, p++)
5002                      mark_maybe_object (*p);
5003                  }
5004              }
5005            break;            break;
5006    
5007          case Lisp_Misc_Overlay:          case Lisp_Misc_Overlay:

Legend:
Removed from v.1.318.2.4  
changed lines
  Added in v.1.318.2.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26