* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,

eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
  thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
  vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
  fix typo (rb_thead_t -> rb_thread_t).

* eval_intern.h: remove unused definitions.

* common.mk: fix around vm_opts.h path
  and remove harmful argument passed to insns2vm.rb.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-02-08 06:37:46 +00:00
Родитель 522f948a0c
Коммит 9c574383a4
23 изменённых файлов: 243 добавлений и 247 удалений

Просмотреть файл

@ -1,3 +1,16 @@
Thu Feb 8 15:00:14 2007 Koichi Sasada <ko1@atdot.net>
* blockinlining.c, error.c, eval.c, eval_error.h, eval_intern.h,
eval_jump.h, eval_load.c, eval_safe.h, gc.c, proc.c, signal.c,
thread.c, thread_pthread.ci, thread_win32.ci, vm.c, vm.h,
vm_dump.c, vm_evalbody.ci, yarvcore.c, yarvcore.h:
fix typo (rb_thead_t -> rb_thread_t).
* eval_intern.h: remove unused definitions.
* common.mk: fix around vm_opts.h path
and remove harmful argument passed to insns2vm.rb.
Wed Feb 7 23:25:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (specific_eval): suppress warning.

Просмотреть файл

@ -183,7 +183,7 @@ build_Integer_times_node(rb_iseq_t *iseq, NODE * node, NODE * lnode,
VALUE
yarv_invoke_Integer_times_special_block(VALUE num)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
if (orig_block && BUILTIN_TYPE(orig_block->iseq) != T_NODE) {
@ -300,7 +300,7 @@ VALUE
yarv_invoke_Range_each_special_block(VALUE range,
VALUE beg, VALUE end, int excl)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
if (BUILTIN_TYPE(orig_block->iseq) != T_NODE) {
@ -431,7 +431,7 @@ build_Array_each_node(rb_iseq_t *iseq, NODE * node, NODE * lnode,
VALUE
yarv_invoke_Array_each_special_block(VALUE ary)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
if (BUILTIN_TYPE(orig_block->iseq) != T_NODE) {

Просмотреть файл

@ -543,7 +543,7 @@ MATZRUBY = $(MATZRUBYDIR)ruby
INSNS = opt_sc.inc optinsn.inc optunifs.inc insns.inc \
vmtc.inc vm.inc vm_macro.inc
INSNS2VMOPT = $(CPPFLAGS) --srcdir="$(srcdir)"
INSNS2VMOPT = --srcdir="$(srcdir)"
minsns.inc: $(srcdir)/template/minsns.inc.tmpl
@ -563,7 +563,7 @@ vm.inc: $(srcdir)/template/vm.inc.tmpl
vm_macro.inc: $(srcdir)/vm_macro.def
$(INSNS): $(srcdir)/insns.def vm_opts.h
$(INSNS): $(srcdir)/insns.def {$(VPATH)}vm_opts.h
$(BASERUBY) $(srcdir)/tool/insns2vm.rb $(INSNS2VMOPT)
incs: $(INSNS)

Просмотреть файл

@ -1473,7 +1473,7 @@ Init_syserr(void)
static void
err_append(const char *s)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (th->parse_in_eval) {
if (NIL_P(th->errinfo)) {
th->errinfo = rb_exc_new2(rb_eSyntaxError, s);

40
eval.c
Просмотреть файл

@ -871,7 +871,7 @@ rb_mod_protected_method_defined(VALUE mod, VALUE mid)
return Qfalse;
}
NORETURN(void th_iter_break _((rb_thead_t *)));
NORETURN(void th_iter_break _((rb_thread_t *)));
void
rb_iter_break()
@ -888,7 +888,7 @@ rb_longjmp(tag, mesg)
VALUE mesg;
{
VALUE at;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
/*
//while (th->cfp->pc == 0 || th->cfp->iseq == 0) {
@ -1073,7 +1073,7 @@ rb_jump_tag(tag)
int
rb_block_given_p()
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (GC_GUARDED_PTR_REF(th->cfp->lfp[0])) {
return Qtrue;
}
@ -1113,7 +1113,7 @@ rb_iterator_p()
VALUE
rb_f_block_given_p()
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
cfp = th_get_ruby_level_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
if (GC_GUARDED_PTR_REF(cfp->lfp[0])) {
@ -1230,7 +1230,7 @@ rb_iterate(VALUE (*it_proc) (VALUE), VALUE data1,
int state;
volatile VALUE retval = Qnil;
NODE *node = NEW_IFUNC(bl_proc, data2);
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
TH_PUSH_TAG(th);
@ -1505,7 +1505,7 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj)
VALUE exc = rb_eNoMethodError;
char *format = 0;
NODE *cnode = ruby_current_node;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
int last_call_status = th->method_missing_reason;
if (argc == 0 || !SYMBOL_P(argv[0])) {
rb_raise(rb_eArgError, "no id given");
@ -1697,7 +1697,7 @@ VALUE
rb_f_send(int argc, VALUE *argv, VALUE recv)
{
int scope = NOEX_PUBLIC;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
if (SPECIAL_CONST_P(cfp->sp[0])) {
@ -1860,7 +1860,7 @@ rb_frame_this_func(void)
ID
rb_frame_callee(void)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
/* check if prev_cfp can be accessible */
if ((void *)(th->stack + th->stack_size) == (void *)(prev_cfp)) {
@ -1872,7 +1872,7 @@ rb_frame_callee(void)
void
rb_frame_pop(void)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
}
@ -1895,7 +1895,7 @@ rb_sourcefile(void)
int
rb_sourceline(void)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
return th_get_sourceline(th->cfp);
}
@ -1906,7 +1906,7 @@ eval(VALUE self, VALUE src, VALUE scope, char *file, int line)
VALUE result = Qundef;
VALUE envval;
rb_binding_t *bind = 0;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_env_t *env = NULL;
NODE *stored_cref_stack = 0;
@ -2051,7 +2051,7 @@ static VALUE
exec_under(VALUE (*func) (VALUE), VALUE under, VALUE self, VALUE args)
{
VALUE val = Qnil; /* OK */
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
rb_control_frame_t *pcfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
VALUE stored_self = pcfp->self;
@ -2707,7 +2707,7 @@ VALUE rb_f_untrace_var();
static VALUE
get_errinfo(void)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
rb_control_frame_t *end_cfp = RUBY_VM_END_CONTROL_FRAME(th);
@ -2790,13 +2790,13 @@ errat_setter(VALUE val, ID id, VALUE *var)
* local_variables #=> ["fred", "i"]
*/
int th_collect_local_variables_in_heap(rb_thead_t *th, VALUE *dfp, VALUE ary);
int th_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, VALUE ary);
static VALUE
rb_f_local_variables(void)
{
VALUE ary = rb_ary_new();
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp =
th_get_ruby_level_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp));
int i;
@ -2940,7 +2940,7 @@ Init_eval(void)
VALUE
rb_dvar_defined(ID id)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_iseq_t *iseq;
if (th->base_block && (iseq = th->base_block->iseq)) {
while (iseq->type == ISEQ_TYPE_BLOCK ||
@ -2964,7 +2964,7 @@ rb_dvar_defined(ID id)
void
rb_scope_setup_top_local_tbl(ID *tbl)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (tbl) {
if (th->top_local_tbl) {
xfree(th->top_local_tbl);
@ -2980,7 +2980,7 @@ rb_scope_setup_top_local_tbl(ID *tbl)
int
rb_scope_base_local_tbl_size(void)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (th->base_block) {
return th->base_block->iseq->local_iseq->local_size +
2 /* $_, $~ */ - 1 /* svar */ ;
@ -2993,7 +2993,7 @@ rb_scope_base_local_tbl_size(void)
ID
rb_scope_base_local_tbl_id(int i)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
switch (i) {
case 0:
return rb_intern("$_");
@ -3008,7 +3008,7 @@ rb_scope_base_local_tbl_id(int i)
int
rb_dvar_current(void)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (th->base_block) {
return 1;
}

Просмотреть файл

@ -198,7 +198,7 @@ static int
error_handle(int ex)
{
int status = EXIT_FAILURE;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (thread_set_raised(th))
return EXIT_FAILURE;

Просмотреть файл

@ -118,7 +118,7 @@ char *strrchr _((const char *, const char));
#include <sys/stat.h>
#define TH_PUSH_TAG(th) do { \
rb_thead_t * const _th = th; \
rb_thread_t * const _th = th; \
struct rb_vm_tag _tag; \
_tag.tag = 0; \
_tag.prev = _th->tag; \
@ -183,23 +183,6 @@ char *strrchr _((const char *, const char));
{ \
ruby_cref()->nd_visi = (f); \
}
struct ruby_env {
struct ruby_env *prev;
struct FRAME *frame;
struct SCOPE *scope;
struct BLOCK *block;
struct iter *iter;
struct tag *tag;
NODE *cref;
};
typedef struct thread *rb_thread_t;
extern VALUE rb_cBinding;
extern VALUE rb_eThreadError;
extern VALUE rb_eLocalJumpError;
extern VALUE rb_eSysStackError;
extern VALUE exception_error;
extern VALUE sysstack_error;
@ -207,8 +190,8 @@ extern VALUE sysstack_error;
void rb_thread_cleanup _((void));
void rb_thread_wait_other_threads _((void));
int thread_set_raised(rb_thead_t *th);
int thread_reset_raised(rb_thead_t *th);
int thread_set_raised(rb_thread_t *th);
int thread_reset_raised(rb_thread_t *th);
VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
VALUE rb_make_exception _((int argc, VALUE *argv));
@ -218,14 +201,14 @@ NORETURN(void print_undef _((VALUE, ID)));
NORETURN(void th_localjump_error(const char *, VALUE, int));
NORETURN(void th_jump_tag_but_local_jump(int, VALUE));
VALUE th_compile(rb_thead_t *th, VALUE str, VALUE file, VALUE line);
VALUE th_compile(rb_thread_t *th, VALUE str, VALUE file, VALUE line);
NODE *th_get_cref(rb_thead_t *th, rb_iseq_t *iseq, rb_control_frame_t *cfp);
NODE *th_cref_push(rb_thead_t *th, VALUE, int);
NODE *th_set_special_cref(rb_thead_t *th, VALUE *lfp, NODE * cref_stack);
NODE *th_get_cref(rb_thread_t *th, rb_iseq_t *iseq, rb_control_frame_t *cfp);
NODE *th_cref_push(rb_thread_t *th, VALUE, int);
NODE *th_set_special_cref(rb_thread_t *th, VALUE *lfp, NODE * cref_stack);
static rb_control_frame_t *
th_get_ruby_level_cfp(rb_thead_t *th, rb_control_frame_t *cfp)
th_get_ruby_level_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
{
rb_iseq_t *iseq = 0;
while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) {
@ -244,12 +227,12 @@ th_get_ruby_level_cfp(rb_thead_t *th, rb_control_frame_t *cfp)
static inline NODE *
ruby_cref()
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
return th_get_cref(th, cfp->iseq, cfp);
}
VALUE th_get_cbase(rb_thead_t *th);
VALUE th_get_cbase(rb_thread_t *th);
VALUE rb_obj_is_proc(VALUE);
void rb_vm_check_redefinition_opt_method(NODE *node);
void rb_thread_terminate_all(void);

Просмотреть файл

@ -22,7 +22,7 @@ static VALUE
rb_f_throw(int argc, VALUE *argv)
{
VALUE tag, value;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
struct rb_vm_tag *tt = th->tag;
rb_scan_args(argc, argv, "11", &tag, &value);
@ -94,7 +94,7 @@ rb_f_catch(VALUE dmy, VALUE tag)
{
int state;
VALUE val = Qnil; /* OK */
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
tag = ID2SYM(rb_to_id(tag));
PUSH_TAG(tag);

Просмотреть файл

@ -119,7 +119,7 @@ rb_load_internal(char *file)
{
NODE *node;
VALUE iseq;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
{
th->parse_in_eval++;
@ -365,7 +365,7 @@ rb_require_safe(VALUE fname, int safe)
{
VALUE result = Qnil;
volatile VALUE errinfo = GET_THREAD()->errinfo;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
int state;
char *volatile ftptr = 0;

Просмотреть файл

@ -36,7 +36,7 @@ static void safe_setter _((VALUE val));
void
rb_set_safe_level(int level)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (level > th->safe_level) {
if (level > SAFE_LEVEL_MAX) {
@ -56,7 +56,7 @@ static void
safe_setter(VALUE val)
{
int level = NUM2INT(val);
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (level < th->safe_level) {
rb_raise(rb_eSecurityError,

14
gc.c
Просмотреть файл

@ -482,7 +482,7 @@ rb_newobj_from_heap(void)
#if USE_VALUE_CACHE
static VALUE
rb_fill_value_cache(rb_thead_t *th)
rb_fill_value_cache(rb_thread_t *th)
{
int i;
VALUE rv;
@ -505,7 +505,7 @@ VALUE
rb_newobj(void)
{
#if USE_VALUE_CACHE && 1
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
VALUE v = *th->value_cache_ptr;
if (v) {
@ -562,7 +562,7 @@ static int grow_direction;
static int
stack_grow_direction(VALUE *addr)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
SET_STACK_END;
if (STACK_END > addr) return grow_direction = 1;
@ -582,7 +582,7 @@ stack_grow_direction(VALUE *addr)
int
ruby_stack_length(VALUE **p)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
SET_STACK_END;
if (p) *p = STACK_UPPER(STACK_END, STACK_START, STACK_END);
return STACK_LENGTH;
@ -592,7 +592,7 @@ int
ruby_stack_check(void)
{
int ret;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
CHECK_STACK(ret);
return ret;
}
@ -1337,7 +1337,7 @@ garbage_collect(void)
{
struct gc_list *list;
jmp_buf save_regs_gc_mark;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (GC_NOTIFY) printf("start garbage_collect()\n");
@ -1442,7 +1442,7 @@ garbage_collect(void)
}
void
yarv_machine_stack_mark(rb_thead_t *th)
yarv_machine_stack_mark(rb_thread_t *th)
{
#if STACK_GROW_DIRECTION < 0
rb_gc_mark_locations(th->machine_stack_end, th->machine_stack_start);

4
proc.c
Просмотреть файл

@ -171,7 +171,7 @@ binding_clone(VALUE self)
VALUE
rb_binding_new(void)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
VALUE bindval = binding_alloc(rb_cBinding);
rb_binding_t *bind;
@ -241,7 +241,7 @@ static VALUE
proc_new(VALUE klass, int is_lambda)
{
VALUE procval = Qnil;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
rb_block_t *block;

Просмотреть файл

@ -496,7 +496,7 @@ rb_trap_exit(void)
}
void
rb_signal_exec(rb_thead_t *th, int sig)
rb_signal_exec(rb_thread_t *th, int sig)
{
VALUE cmd = rb_get_trap_cmd(sig);

128
thread.c
Просмотреть файл

@ -52,14 +52,14 @@
#define THREAD_DEBUG 0
static void sleep_for_polling();
static void sleep_timeval(rb_thead_t *th, struct timeval time);
static void sleep_wait_for_interrupt(rb_thead_t *th, double sleepsec);
static void sleep_forever(rb_thead_t *th);
static void sleep_timeval(rb_thread_t *th, struct timeval time);
static void sleep_wait_for_interrupt(rb_thread_t *th, double sleepsec);
static void sleep_forever(rb_thread_t *th);
static double timeofday();
struct timeval rb_time_interval(VALUE);
static int rb_thread_dead(rb_thead_t *th);
static int rb_thread_dead(rb_thread_t *th);
void rb_signal_exec(rb_thead_t *th, int sig);
void rb_signal_exec(rb_thread_t *th, int sig);
void rb_disable_interrupt();
static VALUE eKillSignal = INT2FIX(0);
@ -76,12 +76,12 @@ st_delete_wrap(st_table * table, VALUE key)
#define THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
static void native_thread_interrupt(rb_thead_t *th);
static void yarv_set_interrupt_function(rb_thead_t *th, rb_interrupt_function_t *func, int is_return);
static void yarv_clear_interrupt_function(rb_thead_t *th);
static void native_thread_interrupt(rb_thread_t *th);
static void yarv_set_interrupt_function(rb_thread_t *th, rb_interrupt_function_t *func, int is_return);
static void yarv_clear_interrupt_function(rb_thread_t *th);
#define GVL_UNLOCK_RANGE(exec) do { \
rb_thead_t *__th = GET_THREAD(); \
rb_thread_t *__th = GET_THREAD(); \
int __prev_status = __th->status; \
yarv_set_interrupt_function(__th, native_thread_interrupt, 0); \
__th->status = THREAD_STOPPED; \
@ -148,7 +148,7 @@ thread_debug(const char *fmt, ...)
static void
yarv_set_interrupt_function(rb_thead_t *th, rb_interrupt_function_t *func, int is_return)
yarv_set_interrupt_function(rb_thread_t *th, rb_interrupt_function_t *func, int is_return)
{
check_ints:
RUBY_VM_CHECK_INTS();
@ -169,7 +169,7 @@ yarv_set_interrupt_function(rb_thead_t *th, rb_interrupt_function_t *func, int i
}
static void
yarv_clear_interrupt_function(rb_thead_t *th)
yarv_clear_interrupt_function(rb_thread_t *th)
{
native_mutex_lock(&th->interrupt_lock);
th->interrupt_function = 0;
@ -177,7 +177,7 @@ yarv_clear_interrupt_function(rb_thead_t *th)
}
static void
rb_thread_interrupt(rb_thead_t *th)
rb_thread_interrupt(rb_thread_t *th)
{
native_mutex_lock(&th->interrupt_lock);
th->interrupt_flag = 1;
@ -193,10 +193,10 @@ rb_thread_interrupt(rb_thead_t *th)
static int
terminate_i(st_data_t key, st_data_t val, rb_thead_t *main_thread)
terminate_i(st_data_t key, st_data_t val, rb_thread_t *main_thread)
{
VALUE thval = key;
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thval, th);
if (th != main_thread) {
@ -214,7 +214,7 @@ terminate_i(st_data_t key, st_data_t val, rb_thead_t *main_thread)
void
rb_thread_terminate_all(void)
{
rb_thead_t *th = GET_THREAD(); /* main thread */
rb_thread_t *th = GET_THREAD(); /* main thread */
rb_vm_t *vm = th->vm;
if (vm->main_thread != th) {
rb_bug("rb_thread_terminate_all: called by child thread (%p, %p)", vm->main_thread, th);
@ -232,18 +232,18 @@ rb_thread_terminate_all(void)
static void
thread_cleanup_func(void *th_ptr)
{
rb_thead_t *th = th_ptr;
rb_thread_t *th = th_ptr;
th->status = THREAD_KILLED;
th->machine_stack_start = th->machine_stack_end = 0;
}
static int
thread_start_func_2(rb_thead_t *th, VALUE *stack_start)
thread_start_func_2(rb_thread_t *th, VALUE *stack_start)
{
int state;
VALUE args = th->first_args;
rb_proc_t *proc;
rb_thead_t *join_th;
rb_thread_t *join_th;
th->machine_stack_start = stack_start;
th->thgroup = th->vm->thgroup_default;
@ -292,7 +292,7 @@ thread_start_func_2(rb_thead_t *th, VALUE *stack_start)
static VALUE
thread_create_core(VALUE klass, VALUE args, VALUE (*fn)(ANYARGS), void *arg)
{
rb_thead_t *th;
rb_thread_t *th;
VALUE thval;
/* create thread object */
@ -342,9 +342,9 @@ rb_thread_create(VALUE (*fn)(ANYARGS), void *arg)
VALUE th_make_jump_tag_but_local_jump(int state, VALUE val);
static VALUE
thread_join(rb_thead_t *target_th, double delay)
thread_join(rb_thread_t *target_th, double delay)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
double now, limit = timeofday() + delay;
thread_debug("thread_join (thid: %p)\n", target_th->thread_id);
@ -434,7 +434,7 @@ thread_join(rb_thead_t *target_th, double delay)
static VALUE
thread_join_m(int argc, VALUE *argv, VALUE self)
{
rb_thead_t *target_th;
rb_thread_t *target_th;
double delay = DELAY_INFTY;
VALUE limit;
@ -461,7 +461,7 @@ thread_join_m(int argc, VALUE *argv, VALUE self)
static VALUE
thread_value(VALUE self)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(self, th);
thread_join(th, DELAY_INFTY);
return th->value;
@ -486,14 +486,14 @@ double2timeval(double d)
}
static void
sleep_forever(rb_thead_t *th)
sleep_forever(rb_thread_t *th)
{
native_sleep(th, 0);
RUBY_VM_CHECK_INTS();
}
static void
sleep_timeval(rb_thead_t *th, struct timeval tv)
sleep_timeval(rb_thread_t *th, struct timeval tv)
{
native_sleep(th, &tv);
}
@ -514,13 +514,13 @@ timeofday(void)
}
static void
sleep_wait_for_interrupt(rb_thead_t *th, double sleepsec)
sleep_wait_for_interrupt(rb_thread_t *th, double sleepsec)
{
sleep_timeval(th, double2timeval(sleepsec));
}
static void
sleep_for_polling(rb_thead_t *th)
sleep_for_polling(rb_thread_t *th)
{
struct timeval time;
time.tv_sec = 0;
@ -531,7 +531,7 @@ sleep_for_polling(rb_thead_t *th)
void
rb_thread_wait_for(struct timeval time)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
sleep_timeval(th, time);
}
@ -539,7 +539,7 @@ void
rb_thread_polling(void)
{
if (!rb_thread_alone()) {
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
sleep_for_polling(th);
}
}
@ -557,7 +557,7 @@ rb_thread_schedule()
{
thread_debug("rb_thread_schedule\n");
if (!rb_thread_alone()) {
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
thread_debug("rb_thread_schedule/switch start\n");
@ -586,10 +586,10 @@ rb_thread_s_critical(VALUE self)
VALUE
rb_thread_run_parallel(VALUE(*func)(rb_thead_t *th, void *), void *data)
rb_thread_run_parallel(VALUE(*func)(rb_thread_t *th, void *), void *data)
{
VALUE val;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
GVL_UNLOCK_RANGE({
val = func(th, data);
@ -631,7 +631,7 @@ thread_s_pass(VALUE klass)
*/
void
rb_thread_execute_interrupts(rb_thead_t *th)
rb_thread_execute_interrupts(rb_thread_t *th)
{
while (th->interrupt_flag) {
int status = th->status;
@ -685,13 +685,13 @@ rb_gc_mark_threads()
/*****************************************************/
static void
rb_thread_ready(rb_thead_t *th)
rb_thread_ready(rb_thread_t *th)
{
rb_thread_interrupt(th);
}
static VALUE
yarv_thread_raise(int argc, VALUE *argv, rb_thead_t *th)
yarv_thread_raise(int argc, VALUE *argv, rb_thread_t *th)
{
VALUE exc;
@ -711,7 +711,7 @@ rb_thread_signal_raise(void *thptr, const char *sig)
{
VALUE argv[1];
char buf[BUFSIZ];
rb_thead_t *th = thptr;
rb_thread_t *th = thptr;
if (sig == 0) {
return; /* should not happen */
@ -726,7 +726,7 @@ rb_thread_signal_exit(void *thptr)
{
VALUE argv[1];
VALUE args[2];
rb_thead_t *th = thptr;
rb_thread_t *th = thptr;
args[0] = INT2NUM(EXIT_SUCCESS);
args[1] = rb_str_new2("exit");
@ -735,7 +735,7 @@ rb_thread_signal_exit(void *thptr)
}
int
thread_set_raised(rb_thead_t *th)
thread_set_raised(rb_thread_t *th)
{
if (th->raised_flag) {
return 1;
@ -745,7 +745,7 @@ thread_set_raised(rb_thead_t *th)
}
int
thread_reset_raised(rb_thead_t *th)
thread_reset_raised(rb_thread_t *th)
{
if (th->raised_flag == 0) {
return 0;
@ -782,7 +782,7 @@ rb_thread_fd_close(int fd)
static VALUE
thread_raise_m(int argc, VALUE *argv, VALUE self)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(self, th);
yarv_thread_raise(argc, argv, th);
return Qnil;
@ -804,7 +804,7 @@ thread_raise_m(int argc, VALUE *argv, VALUE self)
VALUE
rb_thread_kill(VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
@ -884,7 +884,7 @@ rb_thread_exit()
VALUE
rb_thread_wakeup(VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
if (th->status == THREAD_KILLED) {
@ -959,7 +959,7 @@ static int
thread_list_i(st_data_t key, st_data_t val, void *data)
{
VALUE ary = (VALUE)data;
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr((VALUE)key, th);
switch (th->status) {
@ -1101,7 +1101,7 @@ rb_thread_s_abort_exc_set(VALUE self, VALUE val)
static VALUE
rb_thread_abort_exc(VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
return th->abort_on_exception ? Qtrue : Qfalse;
}
@ -1119,7 +1119,7 @@ rb_thread_abort_exc(VALUE thread)
static VALUE
rb_thread_abort_exc_set(VALUE thread, VALUE val)
{
rb_thead_t *th;
rb_thread_t *th;
rb_secure(4);
GetThreadPtr(thread, th);
@ -1141,7 +1141,7 @@ rb_thread_abort_exc_set(VALUE thread, VALUE val)
VALUE
rb_thread_group(VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
VALUE group;
GetThreadPtr(thread, th);
group = th->thgroup;
@ -1170,7 +1170,7 @@ thread_status_name(enum rb_thread_status status)
}
static int
rb_thread_dead(rb_thead_t *th)
rb_thread_dead(rb_thread_t *th)
{
return th->status == THREAD_KILLED;
}
@ -1202,7 +1202,7 @@ rb_thread_dead(rb_thead_t *th)
static VALUE
rb_thread_status(VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
if (rb_thread_dead(th)) {
@ -1231,7 +1231,7 @@ rb_thread_status(VALUE thread)
static VALUE
rb_thread_alive_p(VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
if (rb_thread_dead(th))
@ -1254,7 +1254,7 @@ rb_thread_alive_p(VALUE thread)
static VALUE
rb_thread_stop_p(VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
if (rb_thread_dead(th))
@ -1279,7 +1279,7 @@ rb_thread_stop_p(VALUE thread)
static VALUE
rb_thread_safe_level(VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
return INT2NUM(th->safe_level);
@ -1296,7 +1296,7 @@ static VALUE
rb_thread_inspect(VALUE thread)
{
char *cname = rb_obj_classname(thread);
rb_thead_t *th;
rb_thread_t *th;
const char *status;
VALUE str;
@ -1311,7 +1311,7 @@ rb_thread_inspect(VALUE thread)
VALUE
rb_thread_local_aref(VALUE thread, ID id)
{
rb_thead_t *th;
rb_thread_t *th;
VALUE val;
GetThreadPtr(thread, th);
@ -1357,7 +1357,7 @@ rb_thread_aref(VALUE thread, VALUE id)
VALUE
rb_thread_local_aset(VALUE thread, ID id, VALUE val)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
if (rb_safe_level() >= 4 && th != GET_THREAD()) {
@ -1407,7 +1407,7 @@ rb_thread_aset(VALUE self, ID id, VALUE val)
static VALUE
rb_thread_key_p(VALUE self, ID id)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(self, th);
if (!th->local_storage) {
@ -1454,7 +1454,7 @@ rb_thread_alone()
static VALUE
rb_thread_keys(VALUE self)
{
rb_thead_t *th;
rb_thread_t *th;
VALUE ary = rb_ary_new();
GetThreadPtr(self, th);
@ -1477,7 +1477,7 @@ rb_thread_keys(VALUE self)
static VALUE
rb_thread_priority(VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
return INT2NUM(th->priority);
}
@ -1509,7 +1509,7 @@ rb_thread_priority(VALUE thread)
static VALUE
rb_thread_priority_set(VALUE thread, VALUE prio)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
rb_secure(4);
@ -1727,7 +1727,7 @@ rb_gc_set_stack_end(VALUE **stack_end_p)
}
void
rb_gc_save_machine_context(rb_thead_t *th)
rb_gc_save_machine_context(rb_thread_t *th)
{
rb_gc_set_stack_end(&th->machine_stack_end);
setjmp(th->machine_regs);
@ -1779,7 +1779,7 @@ rb_thread_start_timer_thread(void)
void
rb_thread_atfork(void)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_vm_t *vm = th->vm;
vm->main_thread = th;
@ -1830,7 +1830,7 @@ thgroup_list_i(st_data_t key, st_data_t val, st_data_t data)
VALUE thread = (VALUE)key;
VALUE ary = ((struct thgroup_list_params *)data)->ary;
VALUE group = ((struct thgroup_list_params *)data)->group;
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thread, th);
if (th->thgroup == group) {
@ -1941,7 +1941,7 @@ thgroup_enclosed_p(VALUE group)
static VALUE
thgroup_add(VALUE group, VALUE thread)
{
rb_thead_t *th;
rb_thread_t *th;
struct thgroup *data;
rb_secure(4);
@ -1977,7 +1977,7 @@ thgroup_add(VALUE group, VALUE thread)
*/
typedef struct mutex_struct {
rb_thead_t *th;
rb_thread_t *th;
rb_thread_lock_t lock;
} mutex_t;
@ -2352,7 +2352,7 @@ Init_Thread(void)
rb_define_method(cThGroup, "add", thgroup_add, 1);
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
th->thgroup = th->vm->thgroup_default = rb_obj_alloc(cThGroup);
rb_define_const(cThGroup, "Default", th->thgroup);
}

Просмотреть файл

@ -21,8 +21,8 @@
#define native_cleanup_pop pthread_cleanup_pop
#define native_thread_yield() sched_yield()
static void yarv_add_signal_thread_list(rb_thead_t *th);
static void yarv_remove_signal_thread_list(rb_thead_t *th);
static void yarv_add_signal_thread_list(rb_thread_t *th);
static void yarv_remove_signal_thread_list(rb_thread_t *th);
static rb_thread_lock_t signal_thread_list_lock;
@ -40,7 +40,7 @@ Init_native_thread()
}
NOINLINE(static int
thread_start_func_2(rb_thead_t *th, VALUE *stack_start));
thread_start_func_2(rb_thread_t *th, VALUE *stack_start));
void static thread_cleanup_func(void *th_ptr);
#define USE_THREAD_CACHE 0
@ -52,7 +52,7 @@ thread_start_func_1(void *th_ptr)
thread_start:
#endif
{
rb_thead_t *th = th_ptr;
rb_thread_t *th = th_ptr;
VALUE stack_start;
/* ignore self and klass */
@ -68,8 +68,8 @@ thread_start_func_1(void *th_ptr)
#if USE_THREAD_CACHE
if (1) {
/* cache thread */
rb_thead_t *th;
static rb_thead_t *register_cached_thread_and_wait(void);
rb_thread_t *th;
static rb_thread_t *register_cached_thread_and_wait(void);
if ((th = register_cached_thread_and_wait()) != 0) {
th_ptr = (void *)th;
th->thread_id = pthread_self();
@ -83,7 +83,7 @@ thread_start_func_1(void *th_ptr)
void rb_thread_create_control_thread(void);
struct cached_thread_entry {
volatile rb_thead_t **th_area;
volatile rb_thread_t **th_area;
pthread_cond_t *cond;
struct cached_thread_entry *next;
};
@ -93,11 +93,11 @@ struct cached_thread_entry {
static pthread_mutex_t thread_cache_lock = PTHREAD_MUTEX_INITIALIZER;
struct cached_thread_entry *cached_thread_root;
static rb_thead_t *
static rb_thread_t *
register_cached_thread_and_wait(void)
{
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
volatile rb_thead_t *th_area = 0;
volatile rb_thread_t *th_area = 0;
struct cached_thread_entry *entry =
(struct cached_thread_entry *)malloc(sizeof(struct cached_thread_entry));
@ -140,12 +140,12 @@ register_cached_thread_and_wait(void)
}
pthread_mutex_unlock(&thread_cache_lock);
return (rb_thead_t *)th_area;
return (rb_thread_t *)th_area;
}
#endif
static int
use_cached_thread(rb_thead_t *th)
use_cached_thread(rb_thread_t *th)
{
int result = 0;
#if USE_THREAD_CACHE
@ -171,7 +171,7 @@ use_cached_thread(rb_thead_t *th)
}
static int
native_thread_create(rb_thead_t *th)
native_thread_create(rb_thread_t *th)
{
int err = 0;
@ -216,7 +216,7 @@ native_thread_join(pthread_t th)
}
static void
native_thread_apply_priority(rb_thead_t *th)
native_thread_apply_priority(rb_thread_t *th)
{
struct sched_param sp;
int policy;
@ -238,14 +238,14 @@ native_thread_apply_priority(rb_thead_t *th)
}
static void
interrupt_using_pthread_cond_signal(rb_thead_t *th)
interrupt_using_pthread_cond_signal(rb_thread_t *th)
{
thread_debug("interrupt_using_pthread_cond_signal (%p)\n", th);
pthread_cond_signal(&th->native_thread_data.sleep_cond);
}
static void
native_thread_send_interrupt_signal(rb_thead_t *th)
native_thread_send_interrupt_signal(rb_thread_t *th)
{
thread_debug("native_thread_send_interrupt_signal (%p)\n", th->thread_id);
if (th) {
@ -254,7 +254,7 @@ native_thread_send_interrupt_signal(rb_thead_t *th)
}
static void
native_sleep(rb_thead_t *th, struct timeval *tv)
native_sleep(rb_thread_t *th, struct timeval *tv)
{
int prev_status = th->status;
struct timespec ts;
@ -309,13 +309,13 @@ native_sleep(rb_thead_t *th, struct timeval *tv)
}
static void
native_thread_interrupt(rb_thead_t *th)
native_thread_interrupt(rb_thread_t *th)
{
yarv_add_signal_thread_list(th);
}
struct yarv_signal_thread_list {
rb_thead_t *th;
rb_thread_t *th;
struct yarv_signal_thread_list *prev;
struct yarv_signal_thread_list *next;
};
@ -348,7 +348,7 @@ print_signal_list(char *str)
#endif
static void
yarv_add_signal_thread_list(rb_thead_t *th)
yarv_add_signal_thread_list(rb_thread_t *th)
{
if (!th->native_thread_data.signal_thread_list) {
FGLOCK(&signal_thread_list_lock, {
@ -374,7 +374,7 @@ yarv_add_signal_thread_list(rb_thead_t *th)
}
static void
yarv_remove_signal_thread_list(rb_thead_t *th)
yarv_remove_signal_thread_list(rb_thread_t *th)
{
if (th->native_thread_data.signal_thread_list) {
FGLOCK(&signal_thread_list_lock, {

Просмотреть файл

@ -23,7 +23,7 @@
static void
Init_native_thread()
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
DuplicateHandle(GetCurrentProcess(),
GetCurrentThread(),
GetCurrentProcess(),
@ -53,7 +53,7 @@ w32_show_error_message()
}
static int
w32_wait_event(HANDLE event, DWORD timeout, rb_thead_t *th)
w32_wait_event(HANDLE event, DWORD timeout, rb_thread_t *th)
{
HANDLE events[2];
int count = 0;
@ -94,7 +94,7 @@ w32_wait_event(HANDLE event, DWORD timeout, rb_thead_t *th)
}
static void
native_sleep(rb_thead_t *th, struct timeval *tv)
native_sleep(rb_thread_t *th, struct timeval *tv)
{
DWORD msec;
if (tv) {
@ -199,13 +199,13 @@ native_mutex_initialize(rb_thread_lock_t *lock)
}
NOINLINE(static int
thread_start_func_2(rb_thead_t *th, VALUE *stack_start));
thread_start_func_2(rb_thread_t *th, VALUE *stack_start));
void static thread_cleanup_func(void *th_ptr);
static unsigned int _stdcall
thread_start_func_1(void *th_ptr)
{
rb_thead_t *th = th_ptr;
rb_thread_t *th = th_ptr;
VALUE stack_start;
/* run */
th->native_thread_data.interrupt_event = CreateEvent(0, TRUE, FALSE, 0);
@ -241,7 +241,7 @@ w32_create_thread(DWORD stack_size, void *func, void *val)
}
static int
native_thread_create(rb_thead_t *th)
native_thread_create(rb_thread_t *th)
{
size_t stack_size = 4 * 1024 - sizeof(int); /* 4KB */
@ -266,7 +266,7 @@ native_thread_join(HANDLE th)
}
static void
native_thread_apply_priority(rb_thead_t *th)
native_thread_apply_priority(rb_thread_t *th)
{
int priority = th->priority;
if (th->priority > 0) {
@ -283,7 +283,7 @@ native_thread_apply_priority(rb_thead_t *th)
}
static void
native_thread_interrupt(rb_thead_t *th)
native_thread_interrupt(rb_thread_t *th)
{
thread_debug("native_thread_interrupt: %p\n", th);
SetEvent(th->native_thread_data.interrupt_event);

Просмотреть файл

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-02-07"
#define RUBY_RELEASE_DATE "2007-02-08"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070207
#define RUBY_RELEASE_CODE 20070208
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 2
#define RUBY_RELEASE_DAY 7
#define RUBY_RELEASE_DAY 8
RUBY_EXTERN const char ruby_version[];
RUBY_EXTERN const char ruby_release_date[];

74
vm.c
Просмотреть файл

@ -41,12 +41,12 @@ void vm_analysis_register(int reg, int isset);
void vm_analysis_insn(int insn);
static inline VALUE
th_invoke_yield_cfunc(rb_thead_t *th, rb_block_t *block,
th_invoke_yield_cfunc(rb_thread_t *th, rb_block_t *block,
VALUE self, int argc, VALUE *argv);
VALUE th_invoke_proc(rb_thead_t *th, rb_proc_t *proc,
VALUE th_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
VALUE self, int argc, VALUE *argv);
VALUE th_eval_body(rb_thead_t *th);
VALUE th_eval_body(rb_thread_t *th);
static NODE *lfp_get_special_cref(VALUE *lfp);
static NODE *lfp_set_special_cref(VALUE *lfp, NODE * cref);
@ -70,7 +70,7 @@ rb_vm_change_state(void)
* prepare stack frame
*/
static inline rb_control_frame_t *
push_frame(rb_thead_t *th, rb_iseq_t *iseq, VALUE magic,
push_frame(rb_thread_t *th, rb_iseq_t *iseq, VALUE magic,
VALUE self, VALUE specval, VALUE *pc,
VALUE *sp, VALUE *lfp, int local_size)
{
@ -115,7 +115,7 @@ push_frame(rb_thead_t *th, rb_iseq_t *iseq, VALUE magic,
}
static inline void
pop_frame(rb_thead_t *th)
pop_frame(rb_thread_t *th)
{
#if COLLECT_PROFILE
rb_control_frame_t *cfp = th->cfp;
@ -140,7 +140,7 @@ pop_frame(rb_thead_t *th)
EXTERN VALUE ruby_top_self;
VALUE
th_set_finish_env(rb_thead_t *th)
th_set_finish_env(rb_thread_t *th)
{
push_frame(th, 0, FRAME_MAGIC_FINISH,
Qnil, th->cfp->lfp[0], 0,
@ -150,7 +150,7 @@ th_set_finish_env(rb_thead_t *th)
}
void
th_set_top_stack(rb_thead_t *th, VALUE iseqval)
th_set_top_stack(rb_thread_t *th, VALUE iseqval)
{
rb_iseq_t *iseq;
GetISeqPtr(iseqval, iseq);
@ -168,7 +168,7 @@ th_set_top_stack(rb_thead_t *th, VALUE iseqval)
}
VALUE
th_set_eval_stack(rb_thead_t *th, VALUE iseqval)
th_set_eval_stack(rb_thread_t *th, VALUE iseqval)
{
rb_iseq_t *iseq;
rb_block_t *block = th->base_block;
@ -240,7 +240,7 @@ env_alloc(void)
static int check_env(rb_env_t *env);
static VALUE
th_make_env_each(rb_thead_t *th, rb_control_frame_t *cfp,
th_make_env_each(rb_thread_t *th, rb_control_frame_t *cfp,
VALUE *envptr, VALUE *endptr)
{
VALUE envval, penvval = 0;
@ -388,7 +388,7 @@ collect_local_variables_in_env(rb_env_t *env, VALUE ary)
}
int
th_collect_local_variables_in_heap(rb_thead_t *th, VALUE *dfp, VALUE ary)
th_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, VALUE ary)
{
if (ENV_IN_HEAP_P(dfp)) {
rb_env_t *env;
@ -403,7 +403,7 @@ th_collect_local_variables_in_heap(rb_thead_t *th, VALUE *dfp, VALUE ary)
VALUE
th_make_env_object(rb_thead_t *th, rb_control_frame_t *cfp)
th_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp)
{
VALUE envval;
// SDR2(cfp);
@ -415,7 +415,7 @@ th_make_env_object(rb_thead_t *th, rb_control_frame_t *cfp)
}
static VALUE
th_make_proc_from_block(rb_thead_t *th, rb_control_frame_t *cfp,
th_make_proc_from_block(rb_thread_t *th, rb_control_frame_t *cfp,
rb_block_t *block)
{
VALUE procval;
@ -435,7 +435,7 @@ th_make_proc_from_block(rb_thead_t *th, rb_control_frame_t *cfp,
struct RObject *rb;
VALUE
th_make_proc(rb_thead_t *th, rb_control_frame_t *cfp,
th_make_proc(rb_thread_t *th, rb_control_frame_t *cfp,
rb_block_t *block)
{
VALUE procval, envval, blockprocval = 0;
@ -482,7 +482,7 @@ th_make_proc(rb_thead_t *th, rb_control_frame_t *cfp,
}
static inline VALUE
th_invoke_bmethod(rb_thead_t *th, ID id, VALUE procval, VALUE recv,
th_invoke_bmethod(rb_thread_t *th, ID id, VALUE procval, VALUE recv,
VALUE klass, int argc, VALUE *argv)
{
rb_control_frame_t *cfp = th->cfp;
@ -500,7 +500,7 @@ th_invoke_bmethod(rb_thead_t *th, ID id, VALUE procval, VALUE recv,
}
VALUE
th_call0(rb_thead_t *th, VALUE klass, VALUE recv,
th_call0(rb_thread_t *th, VALUE klass, VALUE recv,
VALUE id, ID oid, int argc, const VALUE *argv,
NODE * body, int nosuper)
{
@ -602,7 +602,7 @@ search_super_klass(VALUE klass, VALUE recv)
}
VALUE
th_call_super(rb_thead_t *th, int argc, const VALUE *argv)
th_call_super(rb_thread_t *th, int argc, const VALUE *argv)
{
VALUE recv = th->cfp->self;
VALUE klass;
@ -641,7 +641,7 @@ th_call_super(rb_thead_t *th, int argc, const VALUE *argv)
}
static inline VALUE
th_invoke_yield_cfunc(rb_thead_t *th, rb_block_t *block,
th_invoke_yield_cfunc(rb_thread_t *th, rb_block_t *block,
VALUE self, int argc, VALUE *argv)
{
NODE *ifunc = (NODE *) block->iseq;
@ -747,7 +747,7 @@ th_yield_setup_args(rb_iseq_t *iseq, int argc, VALUE *argv)
}
static VALUE
invoke_block(rb_thead_t *th, rb_block_t *block, VALUE self, int argc, VALUE *argv, int magic)
invoke_block(rb_thread_t *th, rb_block_t *block, VALUE self, int argc, VALUE *argv, int magic)
{
VALUE val;
if (BUILTIN_TYPE(block->iseq) != T_NODE) {
@ -780,7 +780,7 @@ invoke_block(rb_thead_t *th, rb_block_t *block, VALUE self, int argc, VALUE *arg
}
VALUE
th_invoke_yield(rb_thead_t *th, int argc, VALUE *argv)
th_invoke_yield(rb_thread_t *th, int argc, VALUE *argv)
{
rb_block_t *block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
@ -792,7 +792,7 @@ th_invoke_yield(rb_thead_t *th, int argc, VALUE *argv)
}
VALUE
th_invoke_proc(rb_thead_t *th, rb_proc_t *proc,
th_invoke_proc(rb_thread_t *th, rb_proc_t *proc,
VALUE self, int argc, VALUE *argv)
{
VALUE val = Qundef;
@ -848,7 +848,7 @@ static VALUE *
lfp_svar(VALUE *lfp, int cnt)
{
struct RValues *val;
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
if (th->local_lfp != lfp) {
val = (struct RValues *)lfp[-1];
@ -895,7 +895,7 @@ th_cfp_svar(rb_control_frame_t *cfp, int cnt)
}
static VALUE *
th_svar(rb_thead_t *th, int cnt)
th_svar(rb_thread_t *th, int cnt)
{
rb_control_frame_t *cfp = th->cfp;
return th_cfp_svar(cfp, cnt);
@ -964,7 +964,7 @@ th_get_sourceline(rb_control_frame_t *cfp)
}
static VALUE
th_backtrace_each(rb_thead_t *th,
th_backtrace_each(rb_thread_t *th,
rb_control_frame_t *limit_cfp,
rb_control_frame_t *cfp,
char *file, int line_no, VALUE ary)
@ -997,7 +997,7 @@ th_backtrace_each(rb_thead_t *th,
}
VALUE
th_backtrace(rb_thead_t *th, int lev)
th_backtrace(rb_thread_t *th, int lev)
{
VALUE ary;
rb_control_frame_t *cfp = th->cfp;
@ -1026,7 +1026,7 @@ th_backtrace(rb_thead_t *th, int lev)
VALUE
thread_backtrace(VALUE self, int level)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(self, th);
return th_backtrace(th, level);
}
@ -1051,7 +1051,7 @@ lfp_get_special_cref(VALUE *lfp)
static void
check_svar(void)
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
while ((void *)(cfp + 1) < (void *)(th->stack + th->stack_size)) {
/* printf("cfp: %p\n", cfp->magic); */
@ -1087,7 +1087,7 @@ lfp_set_special_cref(VALUE *lfp, NODE * cref)
}
NODE *
th_set_special_cref(rb_thead_t *th, VALUE *lfp, NODE * cref_stack)
th_set_special_cref(rb_thread_t *th, VALUE *lfp, NODE * cref_stack)
{
return lfp_set_special_cref(lfp, cref_stack);
}
@ -1119,13 +1119,13 @@ get_cref(rb_iseq_t *iseq, VALUE *lfp)
}
NODE *
th_get_cref(rb_thead_t *th, rb_iseq_t *iseq, rb_control_frame_t *cfp)
th_get_cref(rb_thread_t *th, rb_iseq_t *iseq, rb_control_frame_t *cfp)
{
return get_cref(iseq, cfp->lfp);
}
NODE *
th_cref_push(rb_thead_t *th, VALUE klass, int noex)
th_cref_push(rb_thread_t *th, VALUE klass, int noex)
{
NODE *cref = NEW_BLOCK(klass);
rb_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
@ -1137,7 +1137,7 @@ th_cref_push(rb_thead_t *th, VALUE klass, int noex)
}
VALUE
th_get_cbase(rb_thead_t *th)
th_get_cbase(rb_thread_t *th)
{
rb_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
NODE *cref = get_cref(cfp->iseq, cfp->lfp);
@ -1153,7 +1153,7 @@ th_get_cbase(rb_thead_t *th)
}
EVALBODY_HELPER_FUNCTION VALUE
eval_get_ev_const(rb_thead_t *th, rb_iseq_t *iseq,
eval_get_ev_const(rb_thread_t *th, rb_iseq_t *iseq,
VALUE klass, ID id, int is_defined)
{
VALUE val;
@ -1224,7 +1224,7 @@ eval_get_ev_const(rb_thead_t *th, rb_iseq_t *iseq,
}
EVALBODY_HELPER_FUNCTION VALUE
eval_get_cvar_base(rb_thead_t *th, rb_iseq_t *iseq)
eval_get_cvar_base(rb_thread_t *th, rb_iseq_t *iseq)
{
NODE *cref = get_cref(iseq, th->cfp->lfp);
VALUE klass = Qnil;
@ -1242,7 +1242,7 @@ eval_get_cvar_base(rb_thead_t *th, rb_iseq_t *iseq)
}
EVALBODY_HELPER_FUNCTION void
eval_define_method(rb_thead_t *th, VALUE obj,
eval_define_method(rb_thread_t *th, VALUE obj,
ID id, rb_iseq_t *miseq, num_t is_singleton, NODE *cref)
{
NODE *newbody;
@ -1278,7 +1278,7 @@ eval_define_method(rb_thead_t *th, VALUE obj,
}
EVALBODY_HELPER_FUNCTION VALUE
eval_method_missing(rb_thead_t *th, ID id, VALUE recv, int num,
eval_method_missing(rb_thread_t *th, ID id, VALUE recv, int num,
rb_block_t *blockptr, int opt)
{
rb_control_frame_t *reg_cfp = th->cfp;
@ -1407,7 +1407,7 @@ th_jump_tag_but_local_jump(int state, VALUE val)
}
void
th_iter_break(rb_thead_t *th)
th_iter_break(rb_thread_t *th)
{
rb_control_frame_t *cfp = th->cfp;
VALUE *dfp = GC_GUARDED_PTR_REF(*cfp->dfp);
@ -1586,7 +1586,7 @@ yarv_init_redefined_flag(void)
VALUE
th_eval_body(rb_thead_t *th)
th_eval_body(rb_thread_t *th)
{
int state;
VALUE result, err;
@ -1791,7 +1791,7 @@ th_eval_body(rb_thead_t *th)
}
VALUE
rb_thread_eval(rb_thead_t *th, VALUE iseqval)
rb_thread_eval(rb_thread_t *th, VALUE iseqval)
{
VALUE val;
volatile VALUE tmp;

4
vm.h
Просмотреть файл

@ -102,11 +102,11 @@ error !
#define LABEL_PTR(x) &LABEL(x)
typedef rb_control_frame_t *
(*insn_func_type) (rb_thead_t *, rb_control_frame_t *)FASTCALL;
(*insn_func_type) (rb_thread_t *, rb_control_frame_t *)FASTCALL;
#define INSN_ENTRY(insn) \
rb_control_frame_t * \
LABEL(insn)(rb_thead_t *th, rb_control_frame_t *reg_cfp) FASTCALL {
LABEL(insn)(rb_thread_t *th, rb_control_frame_t *reg_cfp) FASTCALL {
#define END_INSN(insn) return reg_cfp;}

Просмотреть файл

@ -19,7 +19,7 @@
#define MAX_POSBUF 128
static void
control_frame_dump(rb_thead_t *th, rb_control_frame_t *cfp)
control_frame_dump(rb_thread_t *th, rb_control_frame_t *cfp)
{
int pc = -1, bp = -1, line = 0;
unsigned int lfp = cfp->lfp - th->stack;
@ -139,7 +139,7 @@ control_frame_dump(rb_thead_t *th, rb_control_frame_t *cfp)
}
void
vm_stack_dump_raw(rb_thead_t *th, rb_control_frame_t *cfp)
vm_stack_dump_raw(rb_thread_t *th, rb_control_frame_t *cfp)
{
VALUE *sp = cfp->sp, *bp = cfp->bp;
VALUE *lfp = cfp->lfp;
@ -217,13 +217,13 @@ proc_dump_raw(rb_proc_t *proc)
void
stack_dump_th(VALUE thval)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thval, th);
vm_stack_dump_raw(th, th->cfp);
}
void
stack_dump_each(rb_thead_t *th, rb_control_frame_t *cfp)
stack_dump_each(rb_thread_t *th, rb_control_frame_t *cfp)
{
int i;
@ -316,7 +316,7 @@ stack_dump_each(rb_thead_t *th, rb_control_frame_t *cfp)
void
debug_print_register(rb_thead_t *th)
debug_print_register(rb_thread_t *th)
{
rb_control_frame_t *cfp = th->cfp;
int pc = -1;
@ -341,13 +341,13 @@ debug_print_register(rb_thead_t *th)
void
thread_dump_regs(VALUE thval)
{
rb_thead_t *th;
rb_thread_t *th;
GetThreadPtr(thval, th);
debug_print_register(th);
}
void
debug_print_pre(rb_thead_t *th, rb_control_frame_t *cfp)
debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp)
{
rb_iseq_t *iseq = cfp->iseq;
@ -365,7 +365,7 @@ debug_print_pre(rb_thead_t *th, rb_control_frame_t *cfp)
}
void
debug_print_post(rb_thead_t *th, rb_control_frame_t *cfp
debug_print_post(rb_thread_t *th, rb_control_frame_t *cfp
#if OPT_STACK_CACHING
, VALUE reg_a, VALUE reg_b
#endif
@ -563,7 +563,7 @@ vm_analysis_register(int reg, int isset)
VALUE
thread_dump_state(VALUE self)
{
rb_thead_t *th;
rb_thread_t *th;
rb_control_frame_t *cfp;
GetThreadPtr(self, th);
cfp = th->cfp;
@ -578,7 +578,7 @@ thread_dump_state(VALUE self)
void
yarv_bug()
{
rb_thead_t *th = GET_THREAD();
rb_thread_t *th = GET_THREAD();
VALUE bt;
if (GET_THREAD()->vm) {

Просмотреть файл

@ -30,7 +30,7 @@ typedef rb_iseq_t *ISEQ;
#if !OPT_CALL_THREADED_CODE
VALUE
th_eval(rb_thead_t *th, VALUE initial)
th_eval(rb_thread_t *th, VALUE initial)
{
#if OPT_STACK_CACHING
@ -123,7 +123,7 @@ get_insns_address_table()
}
VALUE
th_eval(rb_thead_t *th, VALUE initial)
th_eval(rb_thread_t *th, VALUE initial)
{
register rb_control_frame_t *reg_cfp = th->cfp;
SET_PC(reg_cfp->iseq->iseq_encoded);

Просмотреть файл

@ -74,7 +74,7 @@ unsigned long yarvGlobalStateVersion = 1;
/* YARVCore */
/************/
rb_thead_t *yarvCurrentThread = 0;
rb_thread_t *yarvCurrentThread = 0;
rb_vm_t *theYarvVM = 0;
static VALUE yarvVMArray = Qnil;
@ -100,7 +100,7 @@ yarvcore_eval_iseq(VALUE iseq)
}
static VALUE
th_compile_from_node(rb_thead_t *th, NODE * node, VALUE file)
th_compile_from_node(rb_thread_t *th, NODE * node, VALUE file)
{
VALUE iseq;
if (th->base_block) {
@ -118,7 +118,7 @@ th_compile_from_node(rb_thead_t *th, NODE * node, VALUE file)
}
VALUE
th_compile(rb_thead_t *th, VALUE str, VALUE file, VALUE line)
th_compile(rb_thread_t *th, VALUE str, VALUE file, VALUE line)
{
NODE *node = (NODE *) compile_string(str, file, line);
return th_compile_from_node(th, (NODE *) node, file);
@ -211,7 +211,7 @@ vm_init2(rb_vm_t *vm)
static void
thread_free(void *ptr)
{
rb_thead_t *th;
rb_thread_t *th;
FREE_REPORT_ENTER("thread");
if (ptr) {
@ -245,12 +245,12 @@ thread_free(void *ptr)
FREE_REPORT_LEAVE("thread");
}
void yarv_machine_stack_mark(rb_thead_t *th);
void yarv_machine_stack_mark(rb_thread_t *th);
static void
thread_mark(void *ptr)
{
rb_thead_t *th = NULL;
rb_thread_t *th = NULL;
MARK_REPORT_ENTER("thread");
if (ptr) {
th = ptr;
@ -298,16 +298,16 @@ static VALUE
thread_alloc(VALUE klass)
{
VALUE volatile obj;
rb_thead_t *th;
obj = Data_Make_Struct(klass, rb_thead_t,
rb_thread_t *th;
obj = Data_Make_Struct(klass, rb_thread_t,
thread_mark, thread_free, th);
return obj;
}
static void
th_init2(rb_thead_t *th)
th_init2(rb_thread_t *th)
{
MEMZERO(th, rb_thead_t, 1);
MEMZERO(th, rb_thread_t, 1);
/* allocate thread stack */
th->stack = ALLOC_N(VALUE, RUBY_VM_THREAD_STACK_SIZE);
@ -336,7 +336,7 @@ th_init2(rb_thead_t *th)
}
static void
th_init(rb_thead_t *th)
th_init(rb_thread_t *th)
{
th_init2(th);
}
@ -344,7 +344,7 @@ th_init(rb_thead_t *th)
static VALUE
thread_init(VALUE self)
{
rb_thead_t *th;
rb_thread_t *th;
rb_vm_t *vm = GET_THREAD()->vm;
GetThreadPtr(self, th);
@ -514,7 +514,7 @@ Init_VM(void)
VALUE thval;
rb_vm_t *vm;
rb_thead_t *th;
rb_thread_t *th;
vm = theYarvVM;
xfree(RDATA(vmval)->data);
@ -548,7 +548,7 @@ Init_yarv(void)
{
/* VM bootstrap: phase 1 */
rb_vm_t *vm = ALLOC(rb_vm_t);
rb_thead_t *th = ALLOC(rb_thead_t);
rb_thread_t *th = ALLOC(rb_thread_t);
vm_init2(vm);
theYarvVM = vm;

Просмотреть файл

@ -358,7 +358,7 @@ typedef struct {
} rb_block_t;
#define GetThreadPtr(obj, ptr) \
Data_Get_Struct(obj, rb_thead_t, ptr)
Data_Get_Struct(obj, rb_thread_t, ptr)
enum rb_thread_status {
THREAD_TO_KILL,
@ -456,7 +456,7 @@ typedef struct rb_thread_struct
/* misc */
int method_missing_reason;
int abort_on_exception;
} rb_thead_t;
} rb_thread_t;
/** node -> yarv instruction sequence object */
VALUE rb_iseq_compile(VALUE self, NODE *node);
@ -584,7 +584,7 @@ VALUE rb_thread_alloc(VALUE klass);
VALUE rb_proc_alloc(void);
/* for debug */
extern void vm_stack_dump_raw(rb_thead_t *, rb_control_frame_t *);
extern void vm_stack_dump_raw(rb_thread_t *, rb_control_frame_t *);
#define SDR() vm_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
#define SDR2(cfp) vm_stack_dump_raw(GET_THREAD(), (cfp))
void yarv_bug(void);
@ -592,20 +592,20 @@ void yarv_bug(void);
/* functions about thread/vm execution */
VALUE rb_thread_eval(rb_thead_t *th, VALUE iseqval);
VALUE rb_thread_eval(rb_thread_t *th, VALUE iseqval);
void rb_enable_interrupt(void);
void rb_disable_interrupt(void);
VALUE th_eval_body(rb_thead_t *th);
VALUE th_set_eval_stack(rb_thead_t *, VALUE iseq);
VALUE th_call_super(rb_thead_t *th, int argc, const VALUE *argv);
VALUE th_invoke_proc(rb_thead_t *th, rb_proc_t *proc, VALUE self, int argc, VALUE *argv);
VALUE th_make_proc(rb_thead_t *th, rb_control_frame_t *cfp, rb_block_t *block);
VALUE th_make_env_object(rb_thead_t *th, rb_control_frame_t *cfp);
VALUE th_backtrace(rb_thead_t *, int);
VALUE th_eval_body(rb_thread_t *th);
VALUE th_set_eval_stack(rb_thread_t *, VALUE iseq);
VALUE th_call_super(rb_thread_t *th, int argc, const VALUE *argv);
VALUE th_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self, int argc, VALUE *argv);
VALUE th_make_proc(rb_thread_t *th, rb_control_frame_t *cfp, rb_block_t *block);
VALUE th_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
VALUE th_backtrace(rb_thread_t *, int);
VALUE th_invoke_yield(rb_thead_t *th, int argc, VALUE *argv);
VALUE th_call0(rb_thead_t *th, VALUE klass, VALUE recv,
VALUE th_invoke_yield(rb_thread_t *th, int argc, VALUE *argv);
VALUE th_call0(rb_thread_t *th, VALUE klass, VALUE recv,
VALUE id, ID oid, int argc, const VALUE *argv,
NODE * body, int nosuper);
@ -617,7 +617,7 @@ VALUE yarvcore_eval(VALUE self, VALUE str, VALUE file, VALUE line);
/* for thread */
#if RUBY_VM_THREAD_MODEL == 2
extern rb_thead_t *yarvCurrentThread;
extern rb_thread_t *yarvCurrentThread;
extern rb_vm_t *theYarvVM;
#define GET_VM() theYarvVM
@ -633,7 +633,7 @@ extern rb_vm_t *theYarvVM;
#endif
#define GVL_UNLOCK_BEGIN() do { \
rb_thead_t *_th_stored = GET_THREAD(); \
rb_thread_t *_th_stored = GET_THREAD(); \
rb_gc_save_machine_context(_th_stored); \
native_mutex_unlock(&_th_stored->vm->global_interpreter_lock)
@ -643,9 +643,9 @@ extern rb_vm_t *theYarvVM;
} while(0)
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
NOINLINE(void rb_gc_save_machine_context(rb_thead_t *));
NOINLINE(void rb_gc_save_machine_context(rb_thread_t *));
void rb_thread_execute_interrupts(rb_thead_t *);
void rb_thread_execute_interrupts(rb_thread_t *);
#define RUBY_VM_CHECK_INTS_TH(th) do { \
if(th->interrupt_flag){ \