aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2012-07-03 10:37:55 -0400
committerStefan Monnier2012-07-03 10:37:55 -0400
commit7555c33f15ef5ae98508daf9b17b03aea379c78f (patch)
treeb64021001a7474b69a73ad67a1fa59d3702000cc /src
parentd12e8f5a194b64e25eb57d5f6ea19f663c0e4f2b (diff)
downloademacs-7555c33f15ef5ae98508daf9b17b03aea379c78f.tar.gz
emacs-7555c33f15ef5ae98508daf9b17b03aea379c78f.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/alloc.c66
-rw-r--r--src/lisp.h130
3 files changed, 108 insertions, 94 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9861fe76ca3..aca64a79961 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12012-07-03 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * lisp.h (Lisp_Misc, Lisp_Fwd): Move around to group better.
4
5 * alloc.c (mark_object): Revert part of last patch to use `switch'.
6
12012-07-03 Dmitry Antipov <dmantipov@yandex.ru> 72012-07-03 Dmitry Antipov <dmantipov@yandex.ru>
2 8
3 * alloc.c (allocate_vector_block): Remove redundant 9 * alloc.c (allocate_vector_block): Remove redundant
diff --git a/src/alloc.c b/src/alloc.c
index 0d4491e8472..19972d54670 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5730,15 +5730,15 @@ mark_vectorlike (struct Lisp_Vector *ptr)
5730 ptrdiff_t i; 5730 ptrdiff_t i;
5731 5731
5732 eassert (!VECTOR_MARKED_P (ptr)); 5732 eassert (!VECTOR_MARKED_P (ptr));
5733 VECTOR_MARK (ptr); /* Else mark it */ 5733 VECTOR_MARK (ptr); /* Else mark it. */
5734 if (size & PSEUDOVECTOR_FLAG) 5734 if (size & PSEUDOVECTOR_FLAG)
5735 size &= PSEUDOVECTOR_SIZE_MASK; 5735 size &= PSEUDOVECTOR_SIZE_MASK;
5736 5736
5737 /* Note that this size is not the memory-footprint size, but only 5737 /* Note that this size is not the memory-footprint size, but only
5738 the number of Lisp_Object fields that we should trace. 5738 the number of Lisp_Object fields that we should trace.
5739 The distinction is used e.g. by Lisp_Process which places extra 5739 The distinction is used e.g. by Lisp_Process which places extra
5740 non-Lisp_Object fields at the end of the structure. */ 5740 non-Lisp_Object fields at the end of the structure... */
5741 for (i = 0; i < size; i++) /* and then mark its elements */ 5741 for (i = 0; i < size; i++) /* ...and then mark its elements. */
5742 mark_object (ptr->contents[i]); 5742 mark_object (ptr->contents[i]);
5743} 5743}
5744 5744
@@ -5875,11 +5875,11 @@ mark_object (Lisp_Object arg)
5875 if (STRING_MARKED_P (ptr)) 5875 if (STRING_MARKED_P (ptr))
5876 break; 5876 break;
5877 CHECK_ALLOCATED_AND_LIVE (live_string_p); 5877 CHECK_ALLOCATED_AND_LIVE (live_string_p);
5878 MARK_INTERVAL_TREE (ptr->intervals);
5879 MARK_STRING (ptr); 5878 MARK_STRING (ptr);
5879 MARK_INTERVAL_TREE (ptr->intervals);
5880#ifdef GC_CHECK_STRING_BYTES 5880#ifdef GC_CHECK_STRING_BYTES
5881 /* Check that the string size recorded in the string is the 5881 /* Check that the string size recorded in the string is the
5882 same as the one recorded in the sdata structure. */ 5882 same as the one recorded in the sdata structure. */
5883 CHECK_STRING_BYTES (ptr); 5883 CHECK_STRING_BYTES (ptr);
5884#endif /* GC_CHECK_STRING_BYTES */ 5884#endif /* GC_CHECK_STRING_BYTES */
5885 } 5885 }
@@ -6034,7 +6034,7 @@ mark_object (Lisp_Object arg)
6034 ptr = ptr->next; 6034 ptr = ptr->next;
6035 if (ptr) 6035 if (ptr)
6036 { 6036 {
6037 ptrx = ptr; /* Use of ptrx avoids compiler bug on Sun */ 6037 ptrx = ptr; /* Use of ptrx avoids compiler bug on Sun. */
6038 XSETSYMBOL (obj, ptrx); 6038 XSETSYMBOL (obj, ptrx);
6039 goto loop; 6039 goto loop;
6040 } 6040 }
@@ -6044,34 +6044,42 @@ mark_object (Lisp_Object arg)
6044 case Lisp_Misc: 6044 case Lisp_Misc:
6045 CHECK_ALLOCATED_AND_LIVE (live_misc_p); 6045 CHECK_ALLOCATED_AND_LIVE (live_misc_p);
6046 6046
6047 if (XMISCTYPE (obj) == Lisp_Misc_Overlay) 6047 if (XMISCANY (obj)->gcmarkbit)
6048 mark_overlay (XOVERLAY (obj)); 6048 break;
6049 else 6049
6050 switch (XMISCTYPE (obj))
6050 { 6051 {
6051 if (XMISCANY (obj)->gcmarkbit) 6052 case Lisp_Misc_Marker:
6052 break; 6053 /* DO NOT mark thru the marker's chain.
6054 The buffer's markers chain does not preserve markers from gc;
6055 instead, markers are removed from the chain when freed by gc. */
6053 XMISCANY (obj)->gcmarkbit = 1; 6056 XMISCANY (obj)->gcmarkbit = 1;
6057 break;
6054 6058
6055 /* Note that we don't mark thru the marker's 6059 case Lisp_Misc_Save_Value:
6056 chain. The buffer's markers chain does not 6060 XMISCANY (obj)->gcmarkbit = 1;
6057 preserve markers from GC; instead, markers
6058 are removed from the chain when freed by GC. */
6059
6060#if GC_MARK_STACK 6061#if GC_MARK_STACK
6061 if (XMISCTYPE (obj) == Lisp_Misc_Save_Value) 6062 {
6062 { 6063 register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj);
6063 register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj); 6064 /* If DOGC is set, POINTER is the address of a memory
6064 /* If DOGC is set, POINTER is the address of a memory 6065 area containing INTEGER potential Lisp_Objects. */
6065 area containing INTEGER potential Lisp_Objects. */ 6066 if (ptr->dogc)
6066 if (ptr->dogc) 6067 {
6067 { 6068 Lisp_Object *p = (Lisp_Object *) ptr->pointer;
6068 Lisp_Object *p = (Lisp_Object *) ptr->pointer; 6069 ptrdiff_t nelt;
6069 ptrdiff_t nelt; 6070 for (nelt = ptr->integer; nelt > 0; nelt--, p++)
6070 for (nelt = ptr->integer; nelt > 0; nelt--, p++) 6071 mark_maybe_object (*p);
6071 mark_maybe_object (*p); 6072 }
6072 } 6073 }
6073 }
6074#endif 6074#endif
6075 break;
6076
6077 case Lisp_Misc_Overlay:
6078 mark_overlay (XOVERLAY (obj));
6079 break;
6080
6081 default:
6082 abort ();
6075 } 6083 }
6076 break; 6084 break;
6077 6085
diff --git a/src/lisp.h b/src/lisp.h
index 1e40ff7e773..8cec1600692 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -542,11 +542,11 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
542 542
543/* The cast to struct vectorlike_header * avoids aliasing issues. */ 543/* The cast to struct vectorlike_header * avoids aliasing issues. */
544#define XSETPSEUDOVECTOR(a, b, code) \ 544#define XSETPSEUDOVECTOR(a, b, code) \
545 XSETTYPED_PSEUDOVECTOR(a, b, \ 545 XSETTYPED_PSEUDOVECTOR (a, b, \
546 (((struct vectorlike_header *) \ 546 (((struct vectorlike_header *) \
547 XUNTAG (a, Lisp_Vectorlike)) \ 547 XUNTAG (a, Lisp_Vectorlike)) \
548 ->size), \ 548 ->size), \
549 code) 549 code)
550#define XSETTYPED_PSEUDOVECTOR(a, b, size, code) \ 550#define XSETTYPED_PSEUDOVECTOR(a, b, size, code) \
551 (XSETVECTOR (a, b), \ 551 (XSETVECTOR (a, b), \
552 eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \ 552 eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \
@@ -1258,6 +1258,63 @@ struct Lisp_Marker
1258 ptrdiff_t bytepos; 1258 ptrdiff_t bytepos;
1259}; 1259};
1260 1260
1261/* START and END are markers in the overlay's buffer, and
1262 PLIST is the overlay's property list. */
1263struct Lisp_Overlay
1264/* An overlay's real data content is:
1265 - plist
1266 - buffer
1267 - insertion type of both ends
1268 - start & start_byte
1269 - end & end_byte
1270 - next (singly linked list of overlays).
1271 - start_next and end_next (singly linked list of markers).
1272 I.e. 9words plus 2 bits, 3words of which are for external linked lists.
1273*/
1274 {
1275 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */
1276 unsigned gcmarkbit : 1;
1277 int spacer : 15;
1278 struct Lisp_Overlay *next;
1279 Lisp_Object start, end, plist;
1280 };
1281
1282/* Hold a C pointer for later use.
1283 This type of object is used in the arg to record_unwind_protect. */
1284struct Lisp_Save_Value
1285 {
1286 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */
1287 unsigned gcmarkbit : 1;
1288 int spacer : 14;
1289 /* If DOGC is set, POINTER is the address of a memory
1290 area containing INTEGER potential Lisp_Objects. */
1291 unsigned int dogc : 1;
1292 void *pointer;
1293 ptrdiff_t integer;
1294 };
1295
1296
1297/* A miscellaneous object, when it's on the free list. */
1298struct Lisp_Free
1299 {
1300 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */
1301 unsigned gcmarkbit : 1;
1302 int spacer : 15;
1303 union Lisp_Misc *chain;
1304 };
1305
1306/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
1307 It uses one of these struct subtypes to get the type field. */
1308
1309union Lisp_Misc
1310 {
1311 struct Lisp_Misc_Any u_any; /* Supertype of all Misc types. */
1312 struct Lisp_Free u_free;
1313 struct Lisp_Marker u_marker;
1314 struct Lisp_Overlay u_overlay;
1315 struct Lisp_Save_Value u_save_value;
1316 };
1317
1261/* Forwarding pointer to an int variable. 1318/* Forwarding pointer to an int variable.
1262 This is allowed only in the value cell of a symbol, 1319 This is allowed only in the value cell of a symbol,
1263 and it means that the symbol's value really lives in the 1320 and it means that the symbol's value really lives in the
@@ -1324,13 +1381,13 @@ struct Lisp_Buffer_Objfwd
1324struct Lisp_Buffer_Local_Value 1381struct Lisp_Buffer_Local_Value
1325 { 1382 {
1326 /* 1 means that merely setting the variable creates a local 1383 /* 1 means that merely setting the variable creates a local
1327 binding for the current buffer */ 1384 binding for the current buffer. */
1328 unsigned int local_if_set : 1; 1385 unsigned int local_if_set : 1;
1329 /* 1 means this variable can have frame-local bindings, otherwise, it is 1386 /* 1 means this variable can have frame-local bindings, otherwise, it is
1330 can have buffer-local bindings. The two cannot be combined. */ 1387 can have buffer-local bindings. The two cannot be combined. */
1331 unsigned int frame_local : 1; 1388 unsigned int frame_local : 1;
1332 /* 1 means that the binding now loaded was found. 1389 /* 1 means that the binding now loaded was found.
1333 Presumably equivalent to (defcell!=valcell) */ 1390 Presumably equivalent to (defcell!=valcell). */
1334 unsigned int found : 1; 1391 unsigned int found : 1;
1335 /* If non-NULL, a forwarding to the C var where it should also be set. */ 1392 /* If non-NULL, a forwarding to the C var where it should also be set. */
1336 union Lisp_Fwd *fwd; /* Should never be (Buffer|Kboard)_Objfwd. */ 1393 union Lisp_Fwd *fwd; /* Should never be (Buffer|Kboard)_Objfwd. */
@@ -1355,27 +1412,6 @@ struct Lisp_Buffer_Local_Value
1355#define BLV_VALUE(blv) (XCDR ((blv)->valcell)) 1412#define BLV_VALUE(blv) (XCDR ((blv)->valcell))
1356#define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v)) 1413#define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v))
1357 1414
1358/* START and END are markers in the overlay's buffer, and
1359 PLIST is the overlay's property list. */
1360struct Lisp_Overlay
1361/* An overlay's real data content is:
1362 - plist
1363 - buffer
1364 - insertion type of both ends
1365 - start & start_byte
1366 - end & end_byte
1367 - next (singly linked list of overlays).
1368 - start_next and end_next (singly linked list of markers).
1369 I.e. 9words plus 2 bits, 3words of which are for external linked lists.
1370*/
1371 {
1372 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */
1373 unsigned gcmarkbit : 1;
1374 int spacer : 15;
1375 struct Lisp_Overlay *next;
1376 Lisp_Object start, end, plist;
1377 };
1378
1379/* Like Lisp_Objfwd except that value lives in a slot in the 1415/* Like Lisp_Objfwd except that value lives in a slot in the
1380 current kboard. */ 1416 current kboard. */
1381struct Lisp_Kboard_Objfwd 1417struct Lisp_Kboard_Objfwd
@@ -1384,42 +1420,6 @@ struct Lisp_Kboard_Objfwd
1384 int offset; 1420 int offset;
1385 }; 1421 };
1386 1422
1387/* Hold a C pointer for later use.
1388 This type of object is used in the arg to record_unwind_protect. */
1389struct Lisp_Save_Value
1390 {
1391 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */
1392 unsigned gcmarkbit : 1;
1393 int spacer : 14;
1394 /* If DOGC is set, POINTER is the address of a memory
1395 area containing INTEGER potential Lisp_Objects. */
1396 unsigned int dogc : 1;
1397 void *pointer;
1398 ptrdiff_t integer;
1399 };
1400
1401
1402/* A miscellaneous object, when it's on the free list. */
1403struct Lisp_Free
1404 {
1405 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */
1406 unsigned gcmarkbit : 1;
1407 int spacer : 15;
1408 union Lisp_Misc *chain;
1409 };
1410
1411/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
1412 It uses one of these struct subtypes to get the type field. */
1413
1414union Lisp_Misc
1415 {
1416 struct Lisp_Misc_Any u_any; /* Supertype of all Misc types. */
1417 struct Lisp_Free u_free;
1418 struct Lisp_Marker u_marker;
1419 struct Lisp_Overlay u_overlay;
1420 struct Lisp_Save_Value u_save_value;
1421 };
1422
1423union Lisp_Fwd 1423union Lisp_Fwd
1424 { 1424 {
1425 struct Lisp_Intfwd u_intfwd; 1425 struct Lisp_Intfwd u_intfwd;
@@ -1429,7 +1429,7 @@ union Lisp_Fwd
1429 struct Lisp_Kboard_Objfwd u_kboard_objfwd; 1429 struct Lisp_Kboard_Objfwd u_kboard_objfwd;
1430 }; 1430 };
1431 1431
1432/* Lisp floating point type */ 1432/* Lisp floating point type. */
1433struct Lisp_Float 1433struct Lisp_Float
1434 { 1434 {
1435 union 1435 union