Feature #2294 » ruby_bind_stack_1.9.2p0.patch
| ChangeLog | ||
|---|---|---|
|
* io.c (io_cntl): F_DUPFD is platform dependent.
|
||
|
Mon Oct 25 13:28:00 2009 Suraj N. Kurapati <sunaku@gmail.com>
|
||
|
* include/ruby/ruby.h: declare ruby_bind_stack(). [ruby-core:26361]
|
||
|
* gc.c: implement ruby_bind_stack(). restrict GC marking
|
||
|
region to ruby_bind_stack() boundaries for main thread.
|
||
|
Sun Oct 25 10:19:09 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||
|
* ext/dl/handle.c (rb_dlhandle_close): fixed an invalid local
|
||
| gc.c | ||
|---|---|---|
|
#include "vm_core.h"
|
||
|
#include "gc.h"
|
||
|
#include <stdio.h>
|
||
|
#include <assert.h>
|
||
|
#include <setjmp.h>
|
||
|
#include <sys/types.h>
|
||
| ... | ... | |
|
(start = STACK_END, end = STACK_START) : (start = STACK_START, end = STACK_END+appendix))
|
||
|
#endif
|
||
|
static VALUE *ruby_stack_lower_bound = 0, *ruby_stack_upper_bound = 0;
|
||
|
static char ruby_stack_is_bound = 0;
|
||
|
void
|
||
|
ruby_bind_stack(void *lower_bound, void *upper_bound)
|
||
|
{
|
||
|
assert(upper_bound > lower_bound && lower_bound > 0);
|
||
|
ruby_stack_lower_bound = lower_bound;
|
||
|
ruby_stack_upper_bound = upper_bound;
|
||
|
ruby_stack_is_bound = 1;
|
||
|
}
|
||
|
#define FIX_STACK_BOUNDS(start, end, th) \
|
||
|
if (ruby_stack_is_bound && th == th->vm->main_thread) { \
|
||
|
if (start < ruby_stack_lower_bound) { start = ruby_stack_lower_bound; } \
|
||
|
if (end > ruby_stack_upper_bound) { end = ruby_stack_upper_bound; } \
|
||
|
}
|
||
|
static void
|
||
|
mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
|
||
|
{
|
||
| ... | ... | |
|
SET_STACK_END;
|
||
|
GET_STACK_BOUNDS(stack_start, stack_end, 1);
|
||
|
FIX_STACK_BOUNDS(stack_start, stack_end, th);
|
||
|
mark_locations_array(objspace,
|
||
|
(VALUE*)save_regs_gc_mark,
|
||
| ... | ... | |
|
VALUE *stack_start, *stack_end;
|
||
|
GET_STACK_BOUNDS(stack_start, stack_end, 0);
|
||
|
FIX_STACK_BOUNDS(stack_start, stack_end, th);
|
||
|
rb_gc_mark_locations(stack_start, stack_end);
|
||
|
#ifdef __ia64
|
||
|
rb_gc_mark_locations(th->machine_register_stack_start, th->machine_register_stack_end);
|
||
| include/ruby/ruby.h | ||
|---|---|---|
|
#define RUBY_INIT_STACK \
|
||
|
VALUE variable_in_this_stack_frame; \
|
||
|
ruby_init_stack(&variable_in_this_stack_frame);
|
||
|
/*
|
||
|
* Binds the stack of Ruby's main thread to the region of memory that spans
|
||
|
* inclusively from the given lower boundary to the given upper boundary:
|
||
|
*
|
||
|
* (lower) <= (stack pointer of Ruby's main thread) <= (upper)
|
||
|
*
|
||
|
* These boundaries do not protect Ruby's main thread against stack
|
||
|
* overflow and they do not apply to non-main Ruby threads (whose stacks
|
||
|
* are dynamically allocated and managed by the native Operating System).
|
||
|
*/
|
||
|
void ruby_bind_stack(void *lower_bound, void *upper_bound);
|
||
|
void ruby_init(void);
|
||
|
void *ruby_options(int, char**);
|
||
|
int ruby_run_node(void *);
|
||
- « Previous
- 1
- …
- 24
- 25
- 26
- Next »