Commit 7555c33f authored by Stefan Monnier's avatar Stefan Monnier

* 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.
parent d12e8f5a
2012-07-03 Stefan Monnier <monnier@iro.umontreal.ca>
* 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 <dmantipov@yandex.ru>
* alloc.c (allocate_vector_block): Remove redundant
......
......@@ -5730,15 +5730,15 @@ mark_vectorlike (struct Lisp_Vector *ptr)
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 @@ mark_object (Lisp_Object arg)
if (STRING_MARKED_P (ptr))
break;
CHECK_ALLOCATED_AND_LIVE (live_string_p);
MARK_INTERVAL_TREE (ptr->intervals);
MARK_STRING (ptr);
MARK_INTERVAL_TREE (ptr->intervals);
#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 @@ mark_object (Lisp_Object arg)
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 @@ mark_object (Lisp_Object arg)
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;
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;
/* 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_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;
......
......@@ -542,11 +542,11 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
/* 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 @@ struct Lisp_Marker
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_Objfwd
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 @@ struct Lisp_Buffer_Local_Value
#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 @@ struct Lisp_Kboard_Objfwd
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 @@ union Lisp_Fwd
struct Lisp_Kboard_Objfwd u_kboard_objfwd;
};
/* Lisp floating point type */
/* Lisp floating point type. */
struct Lisp_Float
{
union
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment