1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* gc.c (GET_STACK_BOUNDS): refactored common code. based on a

patch from Suraj N. Kurapati <sunaku AT gmail.com> in
  [ruby-core:26443].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-10-31 23:17:52 +00:00
parent c0a0aa0c47
commit 0243c024f8
2 changed files with 21 additions and 28 deletions

View file

@ -1,3 +1,9 @@
Sun Nov 1 08:17:48 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (GET_STACK_BOUNDS): refactored common code. based on a
patch from Suraj N. Kurapati <sunaku AT gmail.com> in
[ruby-core:26443].
Sat Oct 31 23:44:35 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* enum.c (enum_count): remove optimization using #size.

43
gc.c
View file

@ -2089,6 +2089,16 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
void rb_vm_mark(void *ptr);
#if STACK_GROW_DIRECTION < 0
#define GET_STACK_BOUNDS(start, end, appendix) (start = STACK_END, end = STACK_START)
#elif STACK_GROW_DIRECTION > 0
#define GET_STACK_BOUNDS(start, end, appendix) (start = STACK_START, end = STACK_END+appendix)
#else
#define GET_STACK_BOUNDS(stack_start, stack_end, appendix) \
((STACK_END < STACK_START) ? \
(start = STACK_END, end = STACK_START) : (start = STACK_START, end = STACK_END+appendix))
#endif
static void
mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
{
@ -2100,22 +2110,7 @@ mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
rb_setjmp(save_regs_gc_mark);
SET_STACK_END;
#if STACK_GROW_DIRECTION < 0
stack_start = th->machine_stack_end;
stack_end = th->machine_stack_start;
#elif STACK_GROW_DIRECTION > 0
stack_start = th->machine_stack_start;
stack_end = th->machine_stack_end + 1;
#else
if (th->machine_stack_end < th->machine_stack_start) {
stack_start = th->machine_stack_end;
stack_end = th->machine_stack_start;
}
else {
stack_start = th->machine_stack_start;
stack_end = th->machine_stack_end + 1;
}
#endif
GET_STACK_BOUNDS(stack_start, stack_end, 1);
mark_locations_array(objspace,
(VALUE*)save_regs_gc_mark,
@ -2220,18 +2215,10 @@ void
rb_gc_mark_machine_stack(rb_thread_t *th)
{
rb_objspace_t *objspace = &rb_objspace;
#if STACK_GROW_DIRECTION < 0
rb_gc_mark_locations(th->machine_stack_end, th->machine_stack_start);
#elif STACK_GROW_DIRECTION > 0
rb_gc_mark_locations(th->machine_stack_start, th->machine_stack_end);
#else
if (th->machine_stack_start < th->machine_stack_end) {
rb_gc_mark_locations(th->machine_stack_start, th->machine_stack_end);
}
else {
rb_gc_mark_locations(th->machine_stack_end, th->machine_stack_start);
}
#endif
VALUE *stack_start, *stack_end;
GET_STACK_BOUNDS(stack_start, stack_end, 0);
rb_gc_mark_locations(stack_start, stack_end);
#ifdef __ia64
rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
#endif