Mercurial > emacs
comparison src/alloc.c @ 90667:dbe3f29e61d6
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 505-522)
- Update from CVS
- Merge from gnus--rel--5.10
- Update from CVS: etc/TUTORIAL.cn: Updated.
- Merge from erc--emacs--22
* gnus--rel--5.10 (patch 164-167)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-137
| author | Miles Bader <miles@gnu.org> |
|---|---|
| date | Tue, 21 Nov 2006 08:56:38 +0000 |
| parents | 6823a91487f2 b684c6771753 |
| children | 95d0cdf160ea |
comparison
equal
deleted
inserted
replaced
| 90666:00d54c8fa693 | 90667:dbe3f29e61d6 |
|---|---|
| 476 static int live_cons_p P_ ((struct mem_node *, void *)); | 476 static int live_cons_p P_ ((struct mem_node *, void *)); |
| 477 static int live_symbol_p P_ ((struct mem_node *, void *)); | 477 static int live_symbol_p P_ ((struct mem_node *, void *)); |
| 478 static int live_float_p P_ ((struct mem_node *, void *)); | 478 static int live_float_p P_ ((struct mem_node *, void *)); |
| 479 static int live_misc_p P_ ((struct mem_node *, void *)); | 479 static int live_misc_p P_ ((struct mem_node *, void *)); |
| 480 static void mark_maybe_object P_ ((Lisp_Object)); | 480 static void mark_maybe_object P_ ((Lisp_Object)); |
| 481 static void mark_memory P_ ((void *, void *)); | 481 static void mark_memory P_ ((void *, void *, int)); |
| 482 static void mem_init P_ ((void)); | 482 static void mem_init P_ ((void)); |
| 483 static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type)); | 483 static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type)); |
| 484 static void mem_insert_fixup P_ ((struct mem_node *)); | 484 static void mem_insert_fixup P_ ((struct mem_node *)); |
| 485 static void mem_rotate_left P_ ((struct mem_node *)); | 485 static void mem_rotate_left P_ ((struct mem_node *)); |
| 486 static void mem_rotate_right P_ ((struct mem_node *)); | 486 static void mem_rotate_right P_ ((struct mem_node *)); |
| 4282 mark_object (obj); | 4282 mark_object (obj); |
| 4283 } | 4283 } |
| 4284 } | 4284 } |
| 4285 | 4285 |
| 4286 | 4286 |
| 4287 /* Mark Lisp objects referenced from the address range START..END. */ | 4287 /* Mark Lisp objects referenced from the address range START+OFFSET..END |
| 4288 or END+OFFSET..START. */ | |
| 4288 | 4289 |
| 4289 static void | 4290 static void |
| 4290 mark_memory (start, end) | 4291 mark_memory (start, end, offset) |
| 4291 void *start, *end; | 4292 void *start, *end; |
| 4293 int offset; | |
| 4292 { | 4294 { |
| 4293 Lisp_Object *p; | 4295 Lisp_Object *p; |
| 4294 void **pp; | 4296 void **pp; |
| 4295 | 4297 |
| 4296 #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES | 4298 #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES |
| 4305 start = end; | 4307 start = end; |
| 4306 end = tem; | 4308 end = tem; |
| 4307 } | 4309 } |
| 4308 | 4310 |
| 4309 /* Mark Lisp_Objects. */ | 4311 /* Mark Lisp_Objects. */ |
| 4310 for (p = (Lisp_Object *) start; (void *) p < end; ++p) | 4312 for (p = (Lisp_Object *) ((char *) start + offset); (void *) p < end; ++p) |
| 4311 mark_maybe_object (*p); | 4313 mark_maybe_object (*p); |
| 4312 | 4314 |
| 4313 /* Mark Lisp data pointed to. This is necessary because, in some | 4315 /* Mark Lisp data pointed to. This is necessary because, in some |
| 4314 situations, the C compiler optimizes Lisp objects away, so that | 4316 situations, the C compiler optimizes Lisp objects away, so that |
| 4315 only a pointer to them remains. Example: | 4317 only a pointer to them remains. Example: |
| 4326 | 4328 |
| 4327 Here, `obj' isn't really used, and the compiler optimizes it | 4329 Here, `obj' isn't really used, and the compiler optimizes it |
| 4328 away. The only reference to the life string is through the | 4330 away. The only reference to the life string is through the |
| 4329 pointer `s'. */ | 4331 pointer `s'. */ |
| 4330 | 4332 |
| 4331 for (pp = (void **) start; (void *) pp < end; ++pp) | 4333 for (pp = (void **) ((char *) start + offset); (void *) pp < end; ++pp) |
| 4332 mark_maybe_pointer (*pp); | 4334 mark_maybe_pointer (*pp); |
| 4333 } | 4335 } |
| 4334 | 4336 |
| 4335 /* setjmp will work with GCC unless NON_SAVING_SETJMP is defined in | 4337 /* setjmp will work with GCC unless NON_SAVING_SETJMP is defined in |
| 4336 the GCC system configuration. In gcc 3.2, the only systems for | 4338 the GCC system configuration. In gcc 3.2, the only systems for |
| 4505 | 4507 |
| 4506 static void | 4508 static void |
| 4507 mark_stack () | 4509 mark_stack () |
| 4508 { | 4510 { |
| 4509 int i; | 4511 int i; |
| 4510 jmp_buf j; | 4512 /* jmp_buf may not be aligned enough on darwin-ppc64 */ |
| 4513 union aligned_jmpbuf { | |
| 4514 Lisp_Object o; | |
| 4515 jmp_buf j; | |
| 4516 } j; | |
| 4511 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; | 4517 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; |
| 4512 void *end; | 4518 void *end; |
| 4513 | 4519 |
| 4514 /* This trick flushes the register windows so that all the state of | 4520 /* This trick flushes the register windows so that all the state of |
| 4515 the process is contained in the stack. */ | 4521 the process is contained in the stack. */ |
| 4536 setjmp_tested_p = 1; | 4542 setjmp_tested_p = 1; |
| 4537 test_setjmp (); | 4543 test_setjmp (); |
| 4538 } | 4544 } |
| 4539 #endif /* GC_SETJMP_WORKS */ | 4545 #endif /* GC_SETJMP_WORKS */ |
| 4540 | 4546 |
| 4541 setjmp (j); | 4547 setjmp (j.j); |
| 4542 end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; | 4548 end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; |
| 4543 #endif /* not GC_SAVE_REGISTERS_ON_STACK */ | 4549 #endif /* not GC_SAVE_REGISTERS_ON_STACK */ |
| 4544 | 4550 |
| 4545 /* This assumes that the stack is a contiguous region in memory. If | 4551 /* This assumes that the stack is a contiguous region in memory. If |
| 4546 that's not the case, something has to be done here to iterate | 4552 that's not the case, something has to be done here to iterate |
| 4551 #else | 4557 #else |
| 4552 #define GC_LISP_OBJECT_ALIGNMENT sizeof (Lisp_Object) | 4558 #define GC_LISP_OBJECT_ALIGNMENT sizeof (Lisp_Object) |
| 4553 #endif | 4559 #endif |
| 4554 #endif | 4560 #endif |
| 4555 for (i = 0; i < sizeof (Lisp_Object); i += GC_LISP_OBJECT_ALIGNMENT) | 4561 for (i = 0; i < sizeof (Lisp_Object); i += GC_LISP_OBJECT_ALIGNMENT) |
| 4556 mark_memory ((char *) stack_base + i, end); | 4562 mark_memory (stack_base, end, i); |
| 4557 /* Allow for marking a secondary stack, like the register stack on the | 4563 /* Allow for marking a secondary stack, like the register stack on the |
| 4558 ia64. */ | 4564 ia64. */ |
| 4559 #ifdef GC_MARK_SECONDARY_STACK | 4565 #ifdef GC_MARK_SECONDARY_STACK |
| 4560 GC_MARK_SECONDARY_STACK (); | 4566 GC_MARK_SECONDARY_STACK (); |
| 4561 #endif | 4567 #endif |
