comparison src/alloc.c @ 51668:0f333fd92a1d

(survives_gc_p): Simplify. (Fmake_marker, free_marker, gc_sweep): Update for new types.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 26 Jun 2003 23:16:05 +0000
parents 00b3e009b3f5
children fb960854a12c
comparison
equal deleted inserted replaced
51667:52d50e52438f 51668:0f333fd92a1d
2668 XMISCTYPE (val) = Lisp_Misc_Marker; 2668 XMISCTYPE (val) = Lisp_Misc_Marker;
2669 p = XMARKER (val); 2669 p = XMARKER (val);
2670 p->buffer = 0; 2670 p->buffer = 0;
2671 p->bytepos = 0; 2671 p->bytepos = 0;
2672 p->charpos = 0; 2672 p->charpos = 0;
2673 p->chain = Qnil; 2673 p->next = NULL;
2674 p->insertion_type = 0; 2674 p->insertion_type = 0;
2675 return val; 2675 return val;
2676 } 2676 }
2677 2677
2678 /* Put MARKER back on the free list after using it temporarily. */ 2678 /* Put MARKER back on the free list after using it temporarily. */
2679 2679
2680 void 2680 void
2681 free_marker (marker) 2681 free_marker (marker)
2682 Lisp_Object marker; 2682 Lisp_Object marker;
2683 { 2683 {
2684 unchain_marker (marker); 2684 unchain_marker (XMARKER (marker));
2685 2685
2686 XMISC (marker)->u_marker.type = Lisp_Misc_Free; 2686 XMISC (marker)->u_marker.type = Lisp_Misc_Free;
2687 XMISC (marker)->u_free.chain = marker_free_list; 2687 XMISC (marker)->u_free.chain = marker_free_list;
2688 marker_free_list = XMISC (marker); 2688 marker_free_list = XMISC (marker);
2689 2689
4928 case Lisp_Symbol: 4928 case Lisp_Symbol:
4929 survives_p = XSYMBOL (obj)->gcmarkbit; 4929 survives_p = XSYMBOL (obj)->gcmarkbit;
4930 break; 4930 break;
4931 4931
4932 case Lisp_Misc: 4932 case Lisp_Misc:
4933 /* FIXME: Maybe we should just use obj->mark for all? */ 4933 survives_p = XMARKER (obj)->gcmarkbit;
4934 switch (XMISCTYPE (obj))
4935 {
4936 case Lisp_Misc_Marker:
4937 survives_p = XMARKER (obj)->gcmarkbit;
4938 break;
4939
4940 case Lisp_Misc_Buffer_Local_Value:
4941 case Lisp_Misc_Some_Buffer_Local_Value:
4942 survives_p = XBUFFER_LOCAL_VALUE (obj)->gcmarkbit;
4943 break;
4944
4945 case Lisp_Misc_Intfwd:
4946 case Lisp_Misc_Boolfwd:
4947 case Lisp_Misc_Objfwd:
4948 case Lisp_Misc_Buffer_Objfwd:
4949 case Lisp_Misc_Kboard_Objfwd:
4950 survives_p = 1;
4951 break;
4952
4953 case Lisp_Misc_Overlay:
4954 survives_p = XOVERLAY (obj)->gcmarkbit;
4955 break;
4956
4957 default:
4958 abort ();
4959 }
4960 break; 4934 break;
4961 4935
4962 case Lisp_String: 4936 case Lisp_String:
4963 { 4937 {
4964 struct Lisp_String *s = XSTRING (obj); 4938 struct Lisp_String *s = XSTRING (obj);
5238 { 5212 {
5239 if (!mblk->markers[i].u_marker.gcmarkbit) 5213 if (!mblk->markers[i].u_marker.gcmarkbit)
5240 { 5214 {
5241 Lisp_Object tem; 5215 Lisp_Object tem;
5242 if (mblk->markers[i].u_marker.type == Lisp_Misc_Marker) 5216 if (mblk->markers[i].u_marker.type == Lisp_Misc_Marker)
5243 { 5217 unchain_marker (&mblk->markers[i].u_marker);
5244 /* tem1 avoids Sun compiler bug */
5245 struct Lisp_Marker *tem1 = &mblk->markers[i].u_marker;
5246 XSETMARKER (tem, tem1);
5247 unchain_marker (tem);
5248 }
5249 /* Set the type of the freed object to Lisp_Misc_Free. 5218 /* Set the type of the freed object to Lisp_Misc_Free.
5250 We could leave the type alone, since nobody checks it, 5219 We could leave the type alone, since nobody checks it,
5251 but this might catch bugs faster. */ 5220 but this might catch bugs faster. */
5252 mblk->markers[i].u_marker.type = Lisp_Misc_Free; 5221 mblk->markers[i].u_marker.type = Lisp_Misc_Free;
5253 mblk->markers[i].u_free.chain = marker_free_list; 5222 mblk->markers[i].u_free.chain = marker_free_list;