Mercurial > emacs
comparison src/alloc.c @ 1168:2b07af77d7ec
(mark_object): Save last 500 values of objptr.
Check for clobberage of ptr, when marking a vector.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 19 Sep 1992 17:52:29 +0000 |
parents | 903883eed4de |
children | a9241dc503ab |
comparison
equal
deleted
inserted
replaced
1167:a9aeeaa9da8f | 1168:2b07af77d7ec |
---|---|
1267 is threaded into a chain of such slots, pointed to from | 1267 is threaded into a chain of such slots, pointed to from |
1268 the `size' field of the string. The actual string size | 1268 the `size' field of the string. The actual string size |
1269 lives in the last slot in the chain. We recognize the end | 1269 lives in the last slot in the chain. We recognize the end |
1270 because it is < (unsigned) STRING_BLOCK_SIZE. */ | 1270 because it is < (unsigned) STRING_BLOCK_SIZE. */ |
1271 | 1271 |
1272 #define LAST_MARKED_SIZE 500 | |
1273 Lisp_Object *last_marked[LAST_MARKED_SIZE]; | |
1274 int last_marked_index; | |
1275 | |
1272 static void | 1276 static void |
1273 mark_object (objptr) | 1277 mark_object (objptr) |
1274 Lisp_Object *objptr; | 1278 Lisp_Object *objptr; |
1275 { | 1279 { |
1276 register Lisp_Object obj; | 1280 register Lisp_Object obj; |
1281 loop: | 1285 loop: |
1282 | 1286 |
1283 if ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) ((char *) pure + PURESIZE) | 1287 if ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) ((char *) pure + PURESIZE) |
1284 && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure) | 1288 && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure) |
1285 return; | 1289 return; |
1290 | |
1291 last_marked[last_marked_index++] = objptr; | |
1292 if (last_marked_index == LAST_MARKED_SIZE) | |
1293 last_marked_index = 0; | |
1286 | 1294 |
1287 #ifdef SWITCH_ENUM_BUG | 1295 #ifdef SWITCH_ENUM_BUG |
1288 switch ((int) XGCTYPE (obj)) | 1296 switch ((int) XGCTYPE (obj)) |
1289 #else | 1297 #else |
1290 switch (XGCTYPE (obj)) | 1298 switch (XGCTYPE (obj)) |
1326 case Lisp_Window_Configuration: | 1334 case Lisp_Window_Configuration: |
1327 case Lisp_Compiled: | 1335 case Lisp_Compiled: |
1328 { | 1336 { |
1329 register struct Lisp_Vector *ptr = XVECTOR (obj); | 1337 register struct Lisp_Vector *ptr = XVECTOR (obj); |
1330 register int size = ptr->size; | 1338 register int size = ptr->size; |
1339 struct Lisp_Vector *volatile ptr1 = ptr; | |
1331 register int i; | 1340 register int i; |
1332 | 1341 |
1333 if (size & ARRAY_MARK_FLAG) break; /* Already marked */ | 1342 if (size & ARRAY_MARK_FLAG) break; /* Already marked */ |
1334 ptr->size |= ARRAY_MARK_FLAG; /* Else mark it */ | 1343 ptr->size |= ARRAY_MARK_FLAG; /* Else mark it */ |
1335 for (i = 0; i < size; i++) /* and then mark its elements */ | 1344 for (i = 0; i < size; i++) /* and then mark its elements */ |
1336 mark_object (&ptr->contents[i]); | 1345 { |
1346 if (ptr != ptr1) | |
1347 abort (); | |
1348 mark_object (&ptr->contents[i]); | |
1349 } | |
1337 } | 1350 } |
1338 break; | 1351 break; |
1339 | 1352 |
1340 #ifdef MULTI_FRAME | 1353 #ifdef MULTI_FRAME |
1341 case Lisp_Frame: | 1354 case Lisp_Frame: |