| 2089 |
2089 |
|
| 2090 |
2090 |
void rb_vm_mark(void *ptr);
|
| 2091 |
2091 |
|
|
2092 |
static VALUE *ruby_stack_lower_bound = 0,
|
|
2093 |
*ruby_stack_upper_bound = 0;
|
|
2094 |
|
|
2095 |
void
|
|
2096 |
ruby_bind_stack(void *lower, void *upper)
|
|
2097 |
{
|
|
2098 |
ruby_stack_lower_bound = lower;
|
|
2099 |
ruby_stack_upper_bound = upper;
|
|
2100 |
}
|
|
2101 |
|
|
2102 |
static void
|
|
2103 |
get_machine_stack_bounds(rb_thread_t *th, VALUE **stack_start, VALUE **stack_end, unsigned stack_end_increment)
|
|
2104 |
{
|
|
2105 |
#if STACK_GROW_DIRECTION < 0
|
|
2106 |
*stack_start = th->machine_stack_end;
|
|
2107 |
*stack_end = th->machine_stack_start;
|
|
2108 |
#elif STACK_GROW_DIRECTION > 0
|
|
2109 |
*stack_start = th->machine_stack_start;
|
|
2110 |
*stack_end = th->machine_stack_end + stack_end_increment;
|
|
2111 |
#else
|
|
2112 |
if (th->machine_stack_end < th->machine_stack_start) {
|
|
2113 |
*stack_start = th->machine_stack_end;
|
|
2114 |
*stack_end = th->machine_stack_start;
|
|
2115 |
}
|
|
2116 |
else {
|
|
2117 |
*stack_start = th->machine_stack_start;
|
|
2118 |
*stack_end = th->machine_stack_end + stack_end_increment;
|
|
2119 |
}
|
|
2120 |
#endif
|
|
2121 |
|
|
2122 |
if (th == th->vm->main_thread) {
|
|
2123 |
if (ruby_stack_lower_bound && *stack_start < ruby_stack_lower_bound) {
|
|
2124 |
*stack_start = ruby_stack_lower_bound;
|
|
2125 |
}
|
|
2126 |
|
|
2127 |
if (ruby_stack_upper_bound && *stack_end > ruby_stack_upper_bound) {
|
|
2128 |
*stack_end = ruby_stack_upper_bound;
|
|
2129 |
}
|
|
2130 |
}
|
|
2131 |
}
|
|
2132 |
|
| 2092 |
2133 |
static void
|
| 2093 |
2134 |
mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
|
| 2094 |
2135 |
{
|
| ... | ... | |
| 2100 |
2141 |
rb_setjmp(save_regs_gc_mark);
|
| 2101 |
2142 |
|
| 2102 |
2143 |
SET_STACK_END;
|
| 2103 |
|
#if STACK_GROW_DIRECTION < 0
|
| 2104 |
|
stack_start = th->machine_stack_end;
|
| 2105 |
|
stack_end = th->machine_stack_start;
|
| 2106 |
|
#elif STACK_GROW_DIRECTION > 0
|
| 2107 |
|
stack_start = th->machine_stack_start;
|
| 2108 |
|
stack_end = th->machine_stack_end + 1;
|
| 2109 |
|
#else
|
| 2110 |
|
if (th->machine_stack_end < th->machine_stack_start) {
|
| 2111 |
|
stack_start = th->machine_stack_end;
|
| 2112 |
|
stack_end = th->machine_stack_start;
|
| 2113 |
|
}
|
| 2114 |
|
else {
|
| 2115 |
|
stack_start = th->machine_stack_start;
|
| 2116 |
|
stack_end = th->machine_stack_end + 1;
|
| 2117 |
|
}
|
| 2118 |
|
#endif
|
|
2144 |
get_machine_stack_bounds(th, &stack_start, &stack_end, 1);
|
| 2119 |
2145 |
|
| 2120 |
2146 |
mark_locations_array(objspace,
|
| 2121 |
2147 |
(VALUE*)save_regs_gc_mark,
|
| ... | ... | |
| 2219 |
2245 |
void
|
| 2220 |
2246 |
rb_gc_mark_machine_stack(rb_thread_t *th)
|
| 2221 |
2247 |
{
|
|
2248 |
VALUE *stack_start, *stack_end;
|
|
2249 |
get_machine_stack_bounds(th, &stack_start, &stack_end, 0);
|
|
2250 |
|
| 2222 |
2251 |
rb_objspace_t *objspace = &rb_objspace;
|
| 2223 |
|
#if STACK_GROW_DIRECTION < 0
|
| 2224 |
|
rb_gc_mark_locations(th->machine_stack_end, th->machine_stack_start);
|
| 2225 |
|
#elif STACK_GROW_DIRECTION > 0
|
| 2226 |
|
rb_gc_mark_locations(th->machine_stack_start, th->machine_stack_end);
|
| 2227 |
|
#else
|
| 2228 |
|
if (th->machine_stack_start < th->machine_stack_end) {
|
| 2229 |
|
rb_gc_mark_locations(th->machine_stack_start, th->machine_stack_end);
|
| 2230 |
|
}
|
| 2231 |
|
else {
|
| 2232 |
|
rb_gc_mark_locations(th->machine_stack_end, th->machine_stack_start);
|
| 2233 |
|
}
|
| 2234 |
|
#endif
|
|
2252 |
rb_gc_mark_locations(stack_start, stack_end);
|
|
2253 |
|
| 2235 |
2254 |
#ifdef __ia64
|
| 2236 |
2255 |
rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
|
| 2237 |
2256 |
#endif
|