aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2006-11-13 08:20:48 +0000
committerYAMAMOTO Mitsuharu2006-11-13 08:20:48 +0000
commit55a314a5c2c62d5059e10b844af34d17726c0d02 (patch)
tree110f6016b938f0aff0f3791cd594c531db8b2290 /src/alloc.c
parent2f984b39101aec06b7ce07b36ff0132c2711d1df (diff)
downloademacs-55a314a5c2c62d5059e10b844af34d17726c0d02.tar.gz
emacs-55a314a5c2c62d5059e10b844af34d17726c0d02.zip
(mark_memory): New argument OFFSET. All uses changed.
Fix address calculations for case END < START. (mark_stack): Impose Lisp_Object alignment on jmp_buf.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 2fd50009649..f3ca3e71a29 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -478,7 +478,7 @@ static int live_symbol_p P_ ((struct mem_node *, void *));
478static int live_float_p P_ ((struct mem_node *, void *)); 478static int live_float_p P_ ((struct mem_node *, void *));
479static int live_misc_p P_ ((struct mem_node *, void *)); 479static int live_misc_p P_ ((struct mem_node *, void *));
480static void mark_maybe_object P_ ((Lisp_Object)); 480static void mark_maybe_object P_ ((Lisp_Object));
481static void mark_memory P_ ((void *, void *)); 481static void mark_memory P_ ((void *, void *, int));
482static void mem_init P_ ((void)); 482static void mem_init P_ ((void));
483static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type)); 483static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type));
484static void mem_insert_fixup P_ ((struct mem_node *)); 484static void mem_insert_fixup P_ ((struct mem_node *));
@@ -4327,11 +4327,13 @@ mark_maybe_pointer (p)
4327} 4327}
4328 4328
4329 4329
4330/* Mark Lisp objects referenced from the address range START..END. */ 4330/* Mark Lisp objects referenced from the address range START+OFFSET..END
4331 or END+OFFSET..START. */
4331 4332
4332static void 4333static void
4333mark_memory (start, end) 4334mark_memory (start, end, offset)
4334 void *start, *end; 4335 void *start, *end;
4336 int offset;
4335{ 4337{
4336 Lisp_Object *p; 4338 Lisp_Object *p;
4337 void **pp; 4339 void **pp;
@@ -4350,7 +4352,7 @@ mark_memory (start, end)
4350 } 4352 }
4351 4353
4352 /* Mark Lisp_Objects. */ 4354 /* Mark Lisp_Objects. */
4353 for (p = (Lisp_Object *) start; (void *) p < end; ++p) 4355 for (p = (Lisp_Object *) ((char *) start + offset); (void *) p < end; ++p)
4354 mark_maybe_object (*p); 4356 mark_maybe_object (*p);
4355 4357
4356 /* Mark Lisp data pointed to. This is necessary because, in some 4358 /* Mark Lisp data pointed to. This is necessary because, in some
@@ -4371,7 +4373,7 @@ mark_memory (start, end)
4371 away. The only reference to the life string is through the 4373 away. The only reference to the life string is through the
4372 pointer `s'. */ 4374 pointer `s'. */
4373 4375
4374 for (pp = (void **) start; (void *) pp < end; ++pp) 4376 for (pp = (void **) ((char *) start + offset); (void *) pp < end; ++pp)
4375 mark_maybe_pointer (*pp); 4377 mark_maybe_pointer (*pp);
4376} 4378}
4377 4379
@@ -4550,7 +4552,11 @@ static void
4550mark_stack () 4552mark_stack ()
4551{ 4553{
4552 int i; 4554 int i;
4553 jmp_buf j; 4555 /* jmp_buf may not be aligned enough on darwin-ppc64 */
4556 union aligned_jmpbuf {
4557 Lisp_Object o;
4558 jmp_buf j;
4559 } j;
4554 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; 4560 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base;
4555 void *end; 4561 void *end;
4556 4562
@@ -4581,7 +4587,7 @@ mark_stack ()
4581 } 4587 }
4582#endif /* GC_SETJMP_WORKS */ 4588#endif /* GC_SETJMP_WORKS */
4583 4589
4584 setjmp (j); 4590 setjmp (j.j);
4585 end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; 4591 end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j;
4586#endif /* not GC_SAVE_REGISTERS_ON_STACK */ 4592#endif /* not GC_SAVE_REGISTERS_ON_STACK */
4587 4593
@@ -4596,7 +4602,7 @@ mark_stack ()
4596#endif 4602#endif
4597#endif 4603#endif
4598 for (i = 0; i < sizeof (Lisp_Object); i += GC_LISP_OBJECT_ALIGNMENT) 4604 for (i = 0; i < sizeof (Lisp_Object); i += GC_LISP_OBJECT_ALIGNMENT)
4599 mark_memory ((char *) stack_base + i, end); 4605 mark_memory (stack_base, end, i);
4600 /* Allow for marking a secondary stack, like the register stack on the 4606 /* Allow for marking a secondary stack, like the register stack on the
4601 ia64. */ 4607 ia64. */
4602#ifdef GC_MARK_SECONDARY_STACK 4608#ifdef GC_MARK_SECONDARY_STACK