* 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:
parent
522f948a0c
commit
9c574383a4
13
ChangeLog
13
ChangeLog
@ -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>
|
Wed Feb 7 23:25:31 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (specific_eval): suppress warning.
|
* eval.c (specific_eval): suppress warning.
|
||||||
|
@ -183,7 +183,7 @@ build_Integer_times_node(rb_iseq_t *iseq, NODE * node, NODE * lnode,
|
|||||||
VALUE
|
VALUE
|
||||||
yarv_invoke_Integer_times_special_block(VALUE num)
|
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]);
|
rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
|
||||||
|
|
||||||
if (orig_block && BUILTIN_TYPE(orig_block->iseq) != T_NODE) {
|
if (orig_block && BUILTIN_TYPE(orig_block->iseq) != T_NODE) {
|
||||||
@ -300,7 +300,7 @@ VALUE
|
|||||||
yarv_invoke_Range_each_special_block(VALUE range,
|
yarv_invoke_Range_each_special_block(VALUE range,
|
||||||
VALUE beg, VALUE end, int excl)
|
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]);
|
rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
|
||||||
|
|
||||||
if (BUILTIN_TYPE(orig_block->iseq) != T_NODE) {
|
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
|
VALUE
|
||||||
yarv_invoke_Array_each_special_block(VALUE ary)
|
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]);
|
rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
|
||||||
|
|
||||||
if (BUILTIN_TYPE(orig_block->iseq) != T_NODE) {
|
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 \
|
INSNS = opt_sc.inc optinsn.inc optunifs.inc insns.inc \
|
||||||
vmtc.inc vm.inc vm_macro.inc
|
vmtc.inc vm.inc vm_macro.inc
|
||||||
|
|
||||||
INSNS2VMOPT = $(CPPFLAGS) --srcdir="$(srcdir)"
|
INSNS2VMOPT = --srcdir="$(srcdir)"
|
||||||
|
|
||||||
minsns.inc: $(srcdir)/template/minsns.inc.tmpl
|
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
|
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)
|
$(BASERUBY) $(srcdir)/tool/insns2vm.rb $(INSNS2VMOPT)
|
||||||
|
|
||||||
incs: $(INSNS)
|
incs: $(INSNS)
|
||||||
|
2
error.c
2
error.c
@ -1473,7 +1473,7 @@ Init_syserr(void)
|
|||||||
static void
|
static void
|
||||||
err_append(const char *s)
|
err_append(const char *s)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
if (th->parse_in_eval) {
|
if (th->parse_in_eval) {
|
||||||
if (NIL_P(th->errinfo)) {
|
if (NIL_P(th->errinfo)) {
|
||||||
th->errinfo = rb_exc_new2(rb_eSyntaxError, s);
|
th->errinfo = rb_exc_new2(rb_eSyntaxError, s);
|
||||||
|
40
eval.c
40
eval.c
@ -871,7 +871,7 @@ rb_mod_protected_method_defined(VALUE mod, VALUE mid)
|
|||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN(void th_iter_break _((rb_thead_t *)));
|
NORETURN(void th_iter_break _((rb_thread_t *)));
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_iter_break()
|
rb_iter_break()
|
||||||
@ -888,7 +888,7 @@ rb_longjmp(tag, mesg)
|
|||||||
VALUE mesg;
|
VALUE mesg;
|
||||||
{
|
{
|
||||||
VALUE at;
|
VALUE at;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//while (th->cfp->pc == 0 || th->cfp->iseq == 0) {
|
//while (th->cfp->pc == 0 || th->cfp->iseq == 0) {
|
||||||
@ -1073,7 +1073,7 @@ rb_jump_tag(tag)
|
|||||||
int
|
int
|
||||||
rb_block_given_p()
|
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])) {
|
if (GC_GUARDED_PTR_REF(th->cfp->lfp[0])) {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
}
|
}
|
||||||
@ -1113,7 +1113,7 @@ rb_iterator_p()
|
|||||||
VALUE
|
VALUE
|
||||||
rb_f_block_given_p()
|
rb_f_block_given_p()
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
cfp = th_get_ruby_level_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
|
cfp = th_get_ruby_level_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
|
||||||
if (GC_GUARDED_PTR_REF(cfp->lfp[0])) {
|
if (GC_GUARDED_PTR_REF(cfp->lfp[0])) {
|
||||||
@ -1230,7 +1230,7 @@ rb_iterate(VALUE (*it_proc) (VALUE), VALUE data1,
|
|||||||
int state;
|
int state;
|
||||||
volatile VALUE retval = Qnil;
|
volatile VALUE retval = Qnil;
|
||||||
NODE *node = NEW_IFUNC(bl_proc, data2);
|
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;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
|
|
||||||
TH_PUSH_TAG(th);
|
TH_PUSH_TAG(th);
|
||||||
@ -1505,7 +1505,7 @@ rb_method_missing(int argc, const VALUE *argv, VALUE obj)
|
|||||||
VALUE exc = rb_eNoMethodError;
|
VALUE exc = rb_eNoMethodError;
|
||||||
char *format = 0;
|
char *format = 0;
|
||||||
NODE *cnode = ruby_current_node;
|
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;
|
int last_call_status = th->method_missing_reason;
|
||||||
if (argc == 0 || !SYMBOL_P(argv[0])) {
|
if (argc == 0 || !SYMBOL_P(argv[0])) {
|
||||||
rb_raise(rb_eArgError, "no id given");
|
rb_raise(rb_eArgError, "no id given");
|
||||||
@ -1697,7 +1697,7 @@ VALUE
|
|||||||
rb_f_send(int argc, VALUE *argv, VALUE recv)
|
rb_f_send(int argc, VALUE *argv, VALUE recv)
|
||||||
{
|
{
|
||||||
int scope = NOEX_PUBLIC;
|
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);
|
rb_control_frame_t *cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
|
||||||
|
|
||||||
if (SPECIAL_CONST_P(cfp->sp[0])) {
|
if (SPECIAL_CONST_P(cfp->sp[0])) {
|
||||||
@ -1860,7 +1860,7 @@ rb_frame_this_func(void)
|
|||||||
ID
|
ID
|
||||||
rb_frame_callee(void)
|
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);
|
rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
|
||||||
/* check if prev_cfp can be accessible */
|
/* check if prev_cfp can be accessible */
|
||||||
if ((void *)(th->stack + th->stack_size) == (void *)(prev_cfp)) {
|
if ((void *)(th->stack + th->stack_size) == (void *)(prev_cfp)) {
|
||||||
@ -1872,7 +1872,7 @@ rb_frame_callee(void)
|
|||||||
void
|
void
|
||||||
rb_frame_pop(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);
|
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1895,7 +1895,7 @@ rb_sourcefile(void)
|
|||||||
int
|
int
|
||||||
rb_sourceline(void)
|
rb_sourceline(void)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
return th_get_sourceline(th->cfp);
|
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 result = Qundef;
|
||||||
VALUE envval;
|
VALUE envval;
|
||||||
rb_binding_t *bind = 0;
|
rb_binding_t *bind = 0;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_env_t *env = NULL;
|
rb_env_t *env = NULL;
|
||||||
NODE *stored_cref_stack = 0;
|
NODE *stored_cref_stack = 0;
|
||||||
|
|
||||||
@ -2051,7 +2051,7 @@ static VALUE
|
|||||||
exec_under(VALUE (*func) (VALUE), VALUE under, VALUE self, VALUE args)
|
exec_under(VALUE (*func) (VALUE), VALUE under, VALUE self, VALUE args)
|
||||||
{
|
{
|
||||||
VALUE val = Qnil; /* OK */
|
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 *cfp = th->cfp;
|
||||||
rb_control_frame_t *pcfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
rb_control_frame_t *pcfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
||||||
VALUE stored_self = pcfp->self;
|
VALUE stored_self = pcfp->self;
|
||||||
@ -2707,7 +2707,7 @@ VALUE rb_f_untrace_var();
|
|||||||
static VALUE
|
static VALUE
|
||||||
get_errinfo(void)
|
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 *cfp = th->cfp;
|
||||||
rb_control_frame_t *end_cfp = RUBY_VM_END_CONTROL_FRAME(th);
|
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"]
|
* 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
|
static VALUE
|
||||||
rb_f_local_variables(void)
|
rb_f_local_variables(void)
|
||||||
{
|
{
|
||||||
VALUE ary = rb_ary_new();
|
VALUE ary = rb_ary_new();
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_control_frame_t *cfp =
|
rb_control_frame_t *cfp =
|
||||||
th_get_ruby_level_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp));
|
th_get_ruby_level_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp));
|
||||||
int i;
|
int i;
|
||||||
@ -2940,7 +2940,7 @@ Init_eval(void)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_dvar_defined(ID id)
|
rb_dvar_defined(ID id)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_iseq_t *iseq;
|
rb_iseq_t *iseq;
|
||||||
if (th->base_block && (iseq = th->base_block->iseq)) {
|
if (th->base_block && (iseq = th->base_block->iseq)) {
|
||||||
while (iseq->type == ISEQ_TYPE_BLOCK ||
|
while (iseq->type == ISEQ_TYPE_BLOCK ||
|
||||||
@ -2964,7 +2964,7 @@ rb_dvar_defined(ID id)
|
|||||||
void
|
void
|
||||||
rb_scope_setup_top_local_tbl(ID *tbl)
|
rb_scope_setup_top_local_tbl(ID *tbl)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
if (tbl) {
|
if (tbl) {
|
||||||
if (th->top_local_tbl) {
|
if (th->top_local_tbl) {
|
||||||
xfree(th->top_local_tbl);
|
xfree(th->top_local_tbl);
|
||||||
@ -2980,7 +2980,7 @@ rb_scope_setup_top_local_tbl(ID *tbl)
|
|||||||
int
|
int
|
||||||
rb_scope_base_local_tbl_size(void)
|
rb_scope_base_local_tbl_size(void)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
if (th->base_block) {
|
if (th->base_block) {
|
||||||
return th->base_block->iseq->local_iseq->local_size +
|
return th->base_block->iseq->local_iseq->local_size +
|
||||||
2 /* $_, $~ */ - 1 /* svar */ ;
|
2 /* $_, $~ */ - 1 /* svar */ ;
|
||||||
@ -2993,7 +2993,7 @@ rb_scope_base_local_tbl_size(void)
|
|||||||
ID
|
ID
|
||||||
rb_scope_base_local_tbl_id(int i)
|
rb_scope_base_local_tbl_id(int i)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
return rb_intern("$_");
|
return rb_intern("$_");
|
||||||
@ -3008,7 +3008,7 @@ rb_scope_base_local_tbl_id(int i)
|
|||||||
int
|
int
|
||||||
rb_dvar_current(void)
|
rb_dvar_current(void)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
if (th->base_block) {
|
if (th->base_block) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ static int
|
|||||||
error_handle(int ex)
|
error_handle(int ex)
|
||||||
{
|
{
|
||||||
int status = EXIT_FAILURE;
|
int status = EXIT_FAILURE;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
if (thread_set_raised(th))
|
if (thread_set_raised(th))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -118,7 +118,7 @@ char *strrchr _((const char *, const char));
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define TH_PUSH_TAG(th) do { \
|
#define TH_PUSH_TAG(th) do { \
|
||||||
rb_thead_t * const _th = th; \
|
rb_thread_t * const _th = th; \
|
||||||
struct rb_vm_tag _tag; \
|
struct rb_vm_tag _tag; \
|
||||||
_tag.tag = 0; \
|
_tag.tag = 0; \
|
||||||
_tag.prev = _th->tag; \
|
_tag.prev = _th->tag; \
|
||||||
@ -183,23 +183,6 @@ char *strrchr _((const char *, const char));
|
|||||||
{ \
|
{ \
|
||||||
ruby_cref()->nd_visi = (f); \
|
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 exception_error;
|
||||||
extern VALUE sysstack_error;
|
extern VALUE sysstack_error;
|
||||||
|
|
||||||
@ -207,8 +190,8 @@ extern VALUE sysstack_error;
|
|||||||
void rb_thread_cleanup _((void));
|
void rb_thread_cleanup _((void));
|
||||||
void rb_thread_wait_other_threads _((void));
|
void rb_thread_wait_other_threads _((void));
|
||||||
|
|
||||||
int thread_set_raised(rb_thead_t *th);
|
int thread_set_raised(rb_thread_t *th);
|
||||||
int thread_reset_raised(rb_thead_t *th);
|
int thread_reset_raised(rb_thread_t *th);
|
||||||
|
|
||||||
VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
|
VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
|
||||||
VALUE rb_make_exception _((int argc, VALUE *argv));
|
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_localjump_error(const char *, VALUE, int));
|
||||||
NORETURN(void th_jump_tag_but_local_jump(int, VALUE));
|
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_get_cref(rb_thread_t *th, rb_iseq_t *iseq, rb_control_frame_t *cfp);
|
||||||
NODE *th_cref_push(rb_thead_t *th, VALUE, int);
|
NODE *th_cref_push(rb_thread_t *th, VALUE, int);
|
||||||
NODE *th_set_special_cref(rb_thead_t *th, VALUE *lfp, NODE * cref_stack);
|
NODE *th_set_special_cref(rb_thread_t *th, VALUE *lfp, NODE * cref_stack);
|
||||||
|
|
||||||
static rb_control_frame_t *
|
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;
|
rb_iseq_t *iseq = 0;
|
||||||
while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) {
|
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 *
|
static inline NODE *
|
||||||
ruby_cref()
|
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);
|
rb_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
|
||||||
return th_get_cref(th, cfp->iseq, 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);
|
VALUE rb_obj_is_proc(VALUE);
|
||||||
void rb_vm_check_redefinition_opt_method(NODE *node);
|
void rb_vm_check_redefinition_opt_method(NODE *node);
|
||||||
void rb_thread_terminate_all(void);
|
void rb_thread_terminate_all(void);
|
||||||
|
@ -22,7 +22,7 @@ static VALUE
|
|||||||
rb_f_throw(int argc, VALUE *argv)
|
rb_f_throw(int argc, VALUE *argv)
|
||||||
{
|
{
|
||||||
VALUE tag, value;
|
VALUE tag, value;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
struct rb_vm_tag *tt = th->tag;
|
struct rb_vm_tag *tt = th->tag;
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "11", &tag, &value);
|
rb_scan_args(argc, argv, "11", &tag, &value);
|
||||||
@ -94,7 +94,7 @@ rb_f_catch(VALUE dmy, VALUE tag)
|
|||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
VALUE val = Qnil; /* OK */
|
VALUE val = Qnil; /* OK */
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
tag = ID2SYM(rb_to_id(tag));
|
tag = ID2SYM(rb_to_id(tag));
|
||||||
PUSH_TAG(tag);
|
PUSH_TAG(tag);
|
||||||
|
@ -119,7 +119,7 @@ rb_load_internal(char *file)
|
|||||||
{
|
{
|
||||||
NODE *node;
|
NODE *node;
|
||||||
VALUE iseq;
|
VALUE iseq;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
{
|
{
|
||||||
th->parse_in_eval++;
|
th->parse_in_eval++;
|
||||||
@ -365,7 +365,7 @@ rb_require_safe(VALUE fname, int safe)
|
|||||||
{
|
{
|
||||||
VALUE result = Qnil;
|
VALUE result = Qnil;
|
||||||
volatile VALUE errinfo = GET_THREAD()->errinfo;
|
volatile VALUE errinfo = GET_THREAD()->errinfo;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
int state;
|
int state;
|
||||||
char *volatile ftptr = 0;
|
char *volatile ftptr = 0;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ static void safe_setter _((VALUE val));
|
|||||||
void
|
void
|
||||||
rb_set_safe_level(int level)
|
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 > th->safe_level) {
|
||||||
if (level > SAFE_LEVEL_MAX) {
|
if (level > SAFE_LEVEL_MAX) {
|
||||||
@ -56,7 +56,7 @@ static void
|
|||||||
safe_setter(VALUE val)
|
safe_setter(VALUE val)
|
||||||
{
|
{
|
||||||
int level = NUM2INT(val);
|
int level = NUM2INT(val);
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
if (level < th->safe_level) {
|
if (level < th->safe_level) {
|
||||||
rb_raise(rb_eSecurityError,
|
rb_raise(rb_eSecurityError,
|
||||||
|
14
gc.c
14
gc.c
@ -482,7 +482,7 @@ rb_newobj_from_heap(void)
|
|||||||
|
|
||||||
#if USE_VALUE_CACHE
|
#if USE_VALUE_CACHE
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_fill_value_cache(rb_thead_t *th)
|
rb_fill_value_cache(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
VALUE rv;
|
VALUE rv;
|
||||||
@ -505,7 +505,7 @@ VALUE
|
|||||||
rb_newobj(void)
|
rb_newobj(void)
|
||||||
{
|
{
|
||||||
#if USE_VALUE_CACHE && 1
|
#if USE_VALUE_CACHE && 1
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
VALUE v = *th->value_cache_ptr;
|
VALUE v = *th->value_cache_ptr;
|
||||||
|
|
||||||
if (v) {
|
if (v) {
|
||||||
@ -562,7 +562,7 @@ static int grow_direction;
|
|||||||
static int
|
static int
|
||||||
stack_grow_direction(VALUE *addr)
|
stack_grow_direction(VALUE *addr)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
SET_STACK_END;
|
SET_STACK_END;
|
||||||
|
|
||||||
if (STACK_END > addr) return grow_direction = 1;
|
if (STACK_END > addr) return grow_direction = 1;
|
||||||
@ -582,7 +582,7 @@ stack_grow_direction(VALUE *addr)
|
|||||||
int
|
int
|
||||||
ruby_stack_length(VALUE **p)
|
ruby_stack_length(VALUE **p)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
SET_STACK_END;
|
SET_STACK_END;
|
||||||
if (p) *p = STACK_UPPER(STACK_END, STACK_START, STACK_END);
|
if (p) *p = STACK_UPPER(STACK_END, STACK_START, STACK_END);
|
||||||
return STACK_LENGTH;
|
return STACK_LENGTH;
|
||||||
@ -592,7 +592,7 @@ int
|
|||||||
ruby_stack_check(void)
|
ruby_stack_check(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
CHECK_STACK(ret);
|
CHECK_STACK(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1337,7 +1337,7 @@ garbage_collect(void)
|
|||||||
{
|
{
|
||||||
struct gc_list *list;
|
struct gc_list *list;
|
||||||
jmp_buf save_regs_gc_mark;
|
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");
|
if (GC_NOTIFY) printf("start garbage_collect()\n");
|
||||||
|
|
||||||
@ -1442,7 +1442,7 @@ garbage_collect(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
yarv_machine_stack_mark(rb_thead_t *th)
|
yarv_machine_stack_mark(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
#if STACK_GROW_DIRECTION < 0
|
#if STACK_GROW_DIRECTION < 0
|
||||||
rb_gc_mark_locations(th->machine_stack_end, th->machine_stack_start);
|
rb_gc_mark_locations(th->machine_stack_end, th->machine_stack_start);
|
||||||
|
4
proc.c
4
proc.c
@ -171,7 +171,7 @@ binding_clone(VALUE self)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_binding_new(void)
|
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);
|
rb_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
|
||||||
VALUE bindval = binding_alloc(rb_cBinding);
|
VALUE bindval = binding_alloc(rb_cBinding);
|
||||||
rb_binding_t *bind;
|
rb_binding_t *bind;
|
||||||
@ -241,7 +241,7 @@ static VALUE
|
|||||||
proc_new(VALUE klass, int is_lambda)
|
proc_new(VALUE klass, int is_lambda)
|
||||||
{
|
{
|
||||||
VALUE procval = Qnil;
|
VALUE procval = Qnil;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
rb_block_t *block;
|
rb_block_t *block;
|
||||||
|
|
||||||
|
2
signal.c
2
signal.c
@ -496,7 +496,7 @@ rb_trap_exit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
VALUE cmd = rb_get_trap_cmd(sig);
|
||||||
|
|
||||||
|
128
thread.c
128
thread.c
@ -52,14 +52,14 @@
|
|||||||
#define THREAD_DEBUG 0
|
#define THREAD_DEBUG 0
|
||||||
|
|
||||||
static void sleep_for_polling();
|
static void sleep_for_polling();
|
||||||
static void sleep_timeval(rb_thead_t *th, struct timeval time);
|
static void sleep_timeval(rb_thread_t *th, struct timeval time);
|
||||||
static void sleep_wait_for_interrupt(rb_thead_t *th, double sleepsec);
|
static void sleep_wait_for_interrupt(rb_thread_t *th, double sleepsec);
|
||||||
static void sleep_forever(rb_thead_t *th);
|
static void sleep_forever(rb_thread_t *th);
|
||||||
static double timeofday();
|
static double timeofday();
|
||||||
struct timeval rb_time_interval(VALUE);
|
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();
|
void rb_disable_interrupt();
|
||||||
|
|
||||||
static VALUE eKillSignal = INT2FIX(0);
|
static VALUE eKillSignal = INT2FIX(0);
|
||||||
@ -76,12 +76,12 @@ st_delete_wrap(st_table * table, VALUE key)
|
|||||||
|
|
||||||
#define THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
|
#define THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
|
||||||
|
|
||||||
static void native_thread_interrupt(rb_thead_t *th);
|
static void native_thread_interrupt(rb_thread_t *th);
|
||||||
static void yarv_set_interrupt_function(rb_thead_t *th, rb_interrupt_function_t *func, int is_return);
|
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_thead_t *th);
|
static void yarv_clear_interrupt_function(rb_thread_t *th);
|
||||||
|
|
||||||
#define GVL_UNLOCK_RANGE(exec) do { \
|
#define GVL_UNLOCK_RANGE(exec) do { \
|
||||||
rb_thead_t *__th = GET_THREAD(); \
|
rb_thread_t *__th = GET_THREAD(); \
|
||||||
int __prev_status = __th->status; \
|
int __prev_status = __th->status; \
|
||||||
yarv_set_interrupt_function(__th, native_thread_interrupt, 0); \
|
yarv_set_interrupt_function(__th, native_thread_interrupt, 0); \
|
||||||
__th->status = THREAD_STOPPED; \
|
__th->status = THREAD_STOPPED; \
|
||||||
@ -148,7 +148,7 @@ thread_debug(const char *fmt, ...)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
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:
|
check_ints:
|
||||||
RUBY_VM_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
|
static void
|
||||||
yarv_clear_interrupt_function(rb_thead_t *th)
|
yarv_clear_interrupt_function(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
native_mutex_lock(&th->interrupt_lock);
|
native_mutex_lock(&th->interrupt_lock);
|
||||||
th->interrupt_function = 0;
|
th->interrupt_function = 0;
|
||||||
@ -177,7 +177,7 @@ yarv_clear_interrupt_function(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_thread_interrupt(rb_thead_t *th)
|
rb_thread_interrupt(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
native_mutex_lock(&th->interrupt_lock);
|
native_mutex_lock(&th->interrupt_lock);
|
||||||
th->interrupt_flag = 1;
|
th->interrupt_flag = 1;
|
||||||
@ -193,10 +193,10 @@ rb_thread_interrupt(rb_thead_t *th)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
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;
|
VALUE thval = key;
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thval, th);
|
GetThreadPtr(thval, th);
|
||||||
|
|
||||||
if (th != main_thread) {
|
if (th != main_thread) {
|
||||||
@ -214,7 +214,7 @@ terminate_i(st_data_t key, st_data_t val, rb_thead_t *main_thread)
|
|||||||
void
|
void
|
||||||
rb_thread_terminate_all(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;
|
rb_vm_t *vm = th->vm;
|
||||||
if (vm->main_thread != th) {
|
if (vm->main_thread != th) {
|
||||||
rb_bug("rb_thread_terminate_all: called by child thread (%p, %p)", 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
|
static void
|
||||||
thread_cleanup_func(void *th_ptr)
|
thread_cleanup_func(void *th_ptr)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = th_ptr;
|
rb_thread_t *th = th_ptr;
|
||||||
th->status = THREAD_KILLED;
|
th->status = THREAD_KILLED;
|
||||||
th->machine_stack_start = th->machine_stack_end = 0;
|
th->machine_stack_start = th->machine_stack_end = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
int state;
|
||||||
VALUE args = th->first_args;
|
VALUE args = th->first_args;
|
||||||
rb_proc_t *proc;
|
rb_proc_t *proc;
|
||||||
rb_thead_t *join_th;
|
rb_thread_t *join_th;
|
||||||
th->machine_stack_start = stack_start;
|
th->machine_stack_start = stack_start;
|
||||||
th->thgroup = th->vm->thgroup_default;
|
th->thgroup = th->vm->thgroup_default;
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ thread_start_func_2(rb_thead_t *th, VALUE *stack_start)
|
|||||||
static VALUE
|
static VALUE
|
||||||
thread_create_core(VALUE klass, VALUE args, VALUE (*fn)(ANYARGS), void *arg)
|
thread_create_core(VALUE klass, VALUE args, VALUE (*fn)(ANYARGS), void *arg)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
VALUE thval;
|
VALUE thval;
|
||||||
|
|
||||||
/* create thread object */
|
/* 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);
|
VALUE th_make_jump_tag_but_local_jump(int state, VALUE val);
|
||||||
|
|
||||||
static VALUE
|
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;
|
double now, limit = timeofday() + delay;
|
||||||
|
|
||||||
thread_debug("thread_join (thid: %p)\n", target_th->thread_id);
|
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
|
static VALUE
|
||||||
thread_join_m(int argc, VALUE *argv, VALUE self)
|
thread_join_m(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
rb_thead_t *target_th;
|
rb_thread_t *target_th;
|
||||||
double delay = DELAY_INFTY;
|
double delay = DELAY_INFTY;
|
||||||
VALUE limit;
|
VALUE limit;
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ thread_join_m(int argc, VALUE *argv, VALUE self)
|
|||||||
static VALUE
|
static VALUE
|
||||||
thread_value(VALUE self)
|
thread_value(VALUE self)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(self, th);
|
GetThreadPtr(self, th);
|
||||||
thread_join(th, DELAY_INFTY);
|
thread_join(th, DELAY_INFTY);
|
||||||
return th->value;
|
return th->value;
|
||||||
@ -486,14 +486,14 @@ double2timeval(double d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sleep_forever(rb_thead_t *th)
|
sleep_forever(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
native_sleep(th, 0);
|
native_sleep(th, 0);
|
||||||
RUBY_VM_CHECK_INTS();
|
RUBY_VM_CHECK_INTS();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sleep_timeval(rb_thead_t *th, struct timeval tv)
|
sleep_timeval(rb_thread_t *th, struct timeval tv)
|
||||||
{
|
{
|
||||||
native_sleep(th, &tv);
|
native_sleep(th, &tv);
|
||||||
}
|
}
|
||||||
@ -514,13 +514,13 @@ timeofday(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static 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));
|
sleep_timeval(th, double2timeval(sleepsec));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sleep_for_polling(rb_thead_t *th)
|
sleep_for_polling(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
struct timeval time;
|
struct timeval time;
|
||||||
time.tv_sec = 0;
|
time.tv_sec = 0;
|
||||||
@ -531,7 +531,7 @@ sleep_for_polling(rb_thead_t *th)
|
|||||||
void
|
void
|
||||||
rb_thread_wait_for(struct timeval time)
|
rb_thread_wait_for(struct timeval time)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
sleep_timeval(th, time);
|
sleep_timeval(th, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ void
|
|||||||
rb_thread_polling(void)
|
rb_thread_polling(void)
|
||||||
{
|
{
|
||||||
if (!rb_thread_alone()) {
|
if (!rb_thread_alone()) {
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
sleep_for_polling(th);
|
sleep_for_polling(th);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,7 +557,7 @@ rb_thread_schedule()
|
|||||||
{
|
{
|
||||||
thread_debug("rb_thread_schedule\n");
|
thread_debug("rb_thread_schedule\n");
|
||||||
if (!rb_thread_alone()) {
|
if (!rb_thread_alone()) {
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
thread_debug("rb_thread_schedule/switch start\n");
|
thread_debug("rb_thread_schedule/switch start\n");
|
||||||
|
|
||||||
@ -586,10 +586,10 @@ rb_thread_s_critical(VALUE self)
|
|||||||
|
|
||||||
|
|
||||||
VALUE
|
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;
|
VALUE val;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
GVL_UNLOCK_RANGE({
|
GVL_UNLOCK_RANGE({
|
||||||
val = func(th, data);
|
val = func(th, data);
|
||||||
@ -631,7 +631,7 @@ thread_s_pass(VALUE klass)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_thread_execute_interrupts(rb_thead_t *th)
|
rb_thread_execute_interrupts(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
while (th->interrupt_flag) {
|
while (th->interrupt_flag) {
|
||||||
int status = th->status;
|
int status = th->status;
|
||||||
@ -685,13 +685,13 @@ rb_gc_mark_threads()
|
|||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_thread_ready(rb_thead_t *th)
|
rb_thread_ready(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
rb_thread_interrupt(th);
|
rb_thread_interrupt(th);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
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;
|
VALUE exc;
|
||||||
|
|
||||||
@ -711,7 +711,7 @@ rb_thread_signal_raise(void *thptr, const char *sig)
|
|||||||
{
|
{
|
||||||
VALUE argv[1];
|
VALUE argv[1];
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
rb_thead_t *th = thptr;
|
rb_thread_t *th = thptr;
|
||||||
|
|
||||||
if (sig == 0) {
|
if (sig == 0) {
|
||||||
return; /* should not happen */
|
return; /* should not happen */
|
||||||
@ -726,7 +726,7 @@ rb_thread_signal_exit(void *thptr)
|
|||||||
{
|
{
|
||||||
VALUE argv[1];
|
VALUE argv[1];
|
||||||
VALUE args[2];
|
VALUE args[2];
|
||||||
rb_thead_t *th = thptr;
|
rb_thread_t *th = thptr;
|
||||||
|
|
||||||
args[0] = INT2NUM(EXIT_SUCCESS);
|
args[0] = INT2NUM(EXIT_SUCCESS);
|
||||||
args[1] = rb_str_new2("exit");
|
args[1] = rb_str_new2("exit");
|
||||||
@ -735,7 +735,7 @@ rb_thread_signal_exit(void *thptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
thread_set_raised(rb_thead_t *th)
|
thread_set_raised(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
if (th->raised_flag) {
|
if (th->raised_flag) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -745,7 +745,7 @@ thread_set_raised(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
thread_reset_raised(rb_thead_t *th)
|
thread_reset_raised(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
if (th->raised_flag == 0) {
|
if (th->raised_flag == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -782,7 +782,7 @@ rb_thread_fd_close(int fd)
|
|||||||
static VALUE
|
static VALUE
|
||||||
thread_raise_m(int argc, VALUE *argv, VALUE self)
|
thread_raise_m(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(self, th);
|
GetThreadPtr(self, th);
|
||||||
yarv_thread_raise(argc, argv, th);
|
yarv_thread_raise(argc, argv, th);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
@ -804,7 +804,7 @@ thread_raise_m(int argc, VALUE *argv, VALUE self)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_thread_kill(VALUE thread)
|
rb_thread_kill(VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
|
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
|
|
||||||
@ -884,7 +884,7 @@ rb_thread_exit()
|
|||||||
VALUE
|
VALUE
|
||||||
rb_thread_wakeup(VALUE thread)
|
rb_thread_wakeup(VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
|
|
||||||
if (th->status == THREAD_KILLED) {
|
if (th->status == THREAD_KILLED) {
|
||||||
@ -959,7 +959,7 @@ static int
|
|||||||
thread_list_i(st_data_t key, st_data_t val, void *data)
|
thread_list_i(st_data_t key, st_data_t val, void *data)
|
||||||
{
|
{
|
||||||
VALUE ary = (VALUE)data;
|
VALUE ary = (VALUE)data;
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr((VALUE)key, th);
|
GetThreadPtr((VALUE)key, th);
|
||||||
|
|
||||||
switch (th->status) {
|
switch (th->status) {
|
||||||
@ -1101,7 +1101,7 @@ rb_thread_s_abort_exc_set(VALUE self, VALUE val)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_abort_exc(VALUE thread)
|
rb_thread_abort_exc(VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
return th->abort_on_exception ? Qtrue : Qfalse;
|
return th->abort_on_exception ? Qtrue : Qfalse;
|
||||||
}
|
}
|
||||||
@ -1119,7 +1119,7 @@ rb_thread_abort_exc(VALUE thread)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_abort_exc_set(VALUE thread, VALUE val)
|
rb_thread_abort_exc_set(VALUE thread, VALUE val)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
|
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
@ -1141,7 +1141,7 @@ rb_thread_abort_exc_set(VALUE thread, VALUE val)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_thread_group(VALUE thread)
|
rb_thread_group(VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
VALUE group;
|
VALUE group;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
group = th->thgroup;
|
group = th->thgroup;
|
||||||
@ -1170,7 +1170,7 @@ thread_status_name(enum rb_thread_status status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rb_thread_dead(rb_thead_t *th)
|
rb_thread_dead(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
return th->status == THREAD_KILLED;
|
return th->status == THREAD_KILLED;
|
||||||
}
|
}
|
||||||
@ -1202,7 +1202,7 @@ rb_thread_dead(rb_thead_t *th)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_status(VALUE thread)
|
rb_thread_status(VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
|
|
||||||
if (rb_thread_dead(th)) {
|
if (rb_thread_dead(th)) {
|
||||||
@ -1231,7 +1231,7 @@ rb_thread_status(VALUE thread)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_alive_p(VALUE thread)
|
rb_thread_alive_p(VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
|
|
||||||
if (rb_thread_dead(th))
|
if (rb_thread_dead(th))
|
||||||
@ -1254,7 +1254,7 @@ rb_thread_alive_p(VALUE thread)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_stop_p(VALUE thread)
|
rb_thread_stop_p(VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
|
|
||||||
if (rb_thread_dead(th))
|
if (rb_thread_dead(th))
|
||||||
@ -1279,7 +1279,7 @@ rb_thread_stop_p(VALUE thread)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_safe_level(VALUE thread)
|
rb_thread_safe_level(VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
|
|
||||||
return INT2NUM(th->safe_level);
|
return INT2NUM(th->safe_level);
|
||||||
@ -1296,7 +1296,7 @@ static VALUE
|
|||||||
rb_thread_inspect(VALUE thread)
|
rb_thread_inspect(VALUE thread)
|
||||||
{
|
{
|
||||||
char *cname = rb_obj_classname(thread);
|
char *cname = rb_obj_classname(thread);
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
const char *status;
|
const char *status;
|
||||||
VALUE str;
|
VALUE str;
|
||||||
|
|
||||||
@ -1311,7 +1311,7 @@ rb_thread_inspect(VALUE thread)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_thread_local_aref(VALUE thread, ID id)
|
rb_thread_local_aref(VALUE thread, ID id)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
VALUE val;
|
VALUE val;
|
||||||
|
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
@ -1357,7 +1357,7 @@ rb_thread_aref(VALUE thread, VALUE id)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_thread_local_aset(VALUE thread, ID id, VALUE val)
|
rb_thread_local_aset(VALUE thread, ID id, VALUE val)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
|
|
||||||
if (rb_safe_level() >= 4 && th != GET_THREAD()) {
|
if (rb_safe_level() >= 4 && th != GET_THREAD()) {
|
||||||
@ -1407,7 +1407,7 @@ rb_thread_aset(VALUE self, ID id, VALUE val)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_key_p(VALUE self, ID id)
|
rb_thread_key_p(VALUE self, ID id)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(self, th);
|
GetThreadPtr(self, th);
|
||||||
|
|
||||||
if (!th->local_storage) {
|
if (!th->local_storage) {
|
||||||
@ -1454,7 +1454,7 @@ rb_thread_alone()
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_keys(VALUE self)
|
rb_thread_keys(VALUE self)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
VALUE ary = rb_ary_new();
|
VALUE ary = rb_ary_new();
|
||||||
GetThreadPtr(self, th);
|
GetThreadPtr(self, th);
|
||||||
|
|
||||||
@ -1477,7 +1477,7 @@ rb_thread_keys(VALUE self)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_priority(VALUE thread)
|
rb_thread_priority(VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
return INT2NUM(th->priority);
|
return INT2NUM(th->priority);
|
||||||
}
|
}
|
||||||
@ -1509,7 +1509,7 @@ rb_thread_priority(VALUE thread)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_thread_priority_set(VALUE thread, VALUE prio)
|
rb_thread_priority_set(VALUE thread, VALUE prio)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
@ -1727,7 +1727,7 @@ rb_gc_set_stack_end(VALUE **stack_end_p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
rb_gc_set_stack_end(&th->machine_stack_end);
|
||||||
setjmp(th->machine_regs);
|
setjmp(th->machine_regs);
|
||||||
@ -1779,7 +1779,7 @@ rb_thread_start_timer_thread(void)
|
|||||||
void
|
void
|
||||||
rb_thread_atfork(void)
|
rb_thread_atfork(void)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_vm_t *vm = th->vm;
|
rb_vm_t *vm = th->vm;
|
||||||
vm->main_thread = th;
|
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 thread = (VALUE)key;
|
||||||
VALUE ary = ((struct thgroup_list_params *)data)->ary;
|
VALUE ary = ((struct thgroup_list_params *)data)->ary;
|
||||||
VALUE group = ((struct thgroup_list_params *)data)->group;
|
VALUE group = ((struct thgroup_list_params *)data)->group;
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thread, th);
|
GetThreadPtr(thread, th);
|
||||||
|
|
||||||
if (th->thgroup == group) {
|
if (th->thgroup == group) {
|
||||||
@ -1941,7 +1941,7 @@ thgroup_enclosed_p(VALUE group)
|
|||||||
static VALUE
|
static VALUE
|
||||||
thgroup_add(VALUE group, VALUE thread)
|
thgroup_add(VALUE group, VALUE thread)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
struct thgroup *data;
|
struct thgroup *data;
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
@ -1977,7 +1977,7 @@ thgroup_add(VALUE group, VALUE thread)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct mutex_struct {
|
typedef struct mutex_struct {
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
rb_thread_lock_t lock;
|
rb_thread_lock_t lock;
|
||||||
} mutex_t;
|
} mutex_t;
|
||||||
|
|
||||||
@ -2352,7 +2352,7 @@ Init_Thread(void)
|
|||||||
rb_define_method(cThGroup, "add", thgroup_add, 1);
|
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);
|
th->thgroup = th->vm->thgroup_default = rb_obj_alloc(cThGroup);
|
||||||
rb_define_const(cThGroup, "Default", th->thgroup);
|
rb_define_const(cThGroup, "Default", th->thgroup);
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#define native_cleanup_pop pthread_cleanup_pop
|
#define native_cleanup_pop pthread_cleanup_pop
|
||||||
#define native_thread_yield() sched_yield()
|
#define native_thread_yield() sched_yield()
|
||||||
|
|
||||||
static void yarv_add_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_thead_t *th);
|
static void yarv_remove_signal_thread_list(rb_thread_t *th);
|
||||||
|
|
||||||
static rb_thread_lock_t signal_thread_list_lock;
|
static rb_thread_lock_t signal_thread_list_lock;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ Init_native_thread()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NOINLINE(static int
|
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);
|
void static thread_cleanup_func(void *th_ptr);
|
||||||
|
|
||||||
#define USE_THREAD_CACHE 0
|
#define USE_THREAD_CACHE 0
|
||||||
@ -52,7 +52,7 @@ thread_start_func_1(void *th_ptr)
|
|||||||
thread_start:
|
thread_start:
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
rb_thead_t *th = th_ptr;
|
rb_thread_t *th = th_ptr;
|
||||||
VALUE stack_start;
|
VALUE stack_start;
|
||||||
/* ignore self and klass */
|
/* ignore self and klass */
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ thread_start_func_1(void *th_ptr)
|
|||||||
#if USE_THREAD_CACHE
|
#if USE_THREAD_CACHE
|
||||||
if (1) {
|
if (1) {
|
||||||
/* cache thread */
|
/* cache thread */
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
static rb_thead_t *register_cached_thread_and_wait(void);
|
static rb_thread_t *register_cached_thread_and_wait(void);
|
||||||
if ((th = register_cached_thread_and_wait()) != 0) {
|
if ((th = register_cached_thread_and_wait()) != 0) {
|
||||||
th_ptr = (void *)th;
|
th_ptr = (void *)th;
|
||||||
th->thread_id = pthread_self();
|
th->thread_id = pthread_self();
|
||||||
@ -83,7 +83,7 @@ thread_start_func_1(void *th_ptr)
|
|||||||
void rb_thread_create_control_thread(void);
|
void rb_thread_create_control_thread(void);
|
||||||
|
|
||||||
struct cached_thread_entry {
|
struct cached_thread_entry {
|
||||||
volatile rb_thead_t **th_area;
|
volatile rb_thread_t **th_area;
|
||||||
pthread_cond_t *cond;
|
pthread_cond_t *cond;
|
||||||
struct cached_thread_entry *next;
|
struct cached_thread_entry *next;
|
||||||
};
|
};
|
||||||
@ -93,11 +93,11 @@ struct cached_thread_entry {
|
|||||||
static pthread_mutex_t thread_cache_lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t thread_cache_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
struct cached_thread_entry *cached_thread_root;
|
struct cached_thread_entry *cached_thread_root;
|
||||||
|
|
||||||
static rb_thead_t *
|
static rb_thread_t *
|
||||||
register_cached_thread_and_wait(void)
|
register_cached_thread_and_wait(void)
|
||||||
{
|
{
|
||||||
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
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 *entry =
|
||||||
(struct cached_thread_entry *)malloc(sizeof(struct cached_thread_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);
|
pthread_mutex_unlock(&thread_cache_lock);
|
||||||
|
|
||||||
return (rb_thead_t *)th_area;
|
return (rb_thread_t *)th_area;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
use_cached_thread(rb_thead_t *th)
|
use_cached_thread(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
#if USE_THREAD_CACHE
|
#if USE_THREAD_CACHE
|
||||||
@ -171,7 +171,7 @@ use_cached_thread(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
native_thread_create(rb_thead_t *th)
|
native_thread_create(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ native_thread_join(pthread_t th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
native_thread_apply_priority(rb_thead_t *th)
|
native_thread_apply_priority(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
struct sched_param sp;
|
struct sched_param sp;
|
||||||
int policy;
|
int policy;
|
||||||
@ -238,14 +238,14 @@ native_thread_apply_priority(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
thread_debug("interrupt_using_pthread_cond_signal (%p)\n", th);
|
||||||
pthread_cond_signal(&th->native_thread_data.sleep_cond);
|
pthread_cond_signal(&th->native_thread_data.sleep_cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
thread_debug("native_thread_send_interrupt_signal (%p)\n", th->thread_id);
|
||||||
if (th) {
|
if (th) {
|
||||||
@ -254,7 +254,7 @@ native_thread_send_interrupt_signal(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
int prev_status = th->status;
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
@ -309,13 +309,13 @@ native_sleep(rb_thead_t *th, struct timeval *tv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
native_thread_interrupt(rb_thead_t *th)
|
native_thread_interrupt(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
yarv_add_signal_thread_list(th);
|
yarv_add_signal_thread_list(th);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct yarv_signal_thread_list {
|
struct yarv_signal_thread_list {
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
struct yarv_signal_thread_list *prev;
|
struct yarv_signal_thread_list *prev;
|
||||||
struct yarv_signal_thread_list *next;
|
struct yarv_signal_thread_list *next;
|
||||||
};
|
};
|
||||||
@ -348,7 +348,7 @@ print_signal_list(char *str)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
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) {
|
if (!th->native_thread_data.signal_thread_list) {
|
||||||
FGLOCK(&signal_thread_list_lock, {
|
FGLOCK(&signal_thread_list_lock, {
|
||||||
@ -374,7 +374,7 @@ yarv_add_signal_thread_list(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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) {
|
if (th->native_thread_data.signal_thread_list) {
|
||||||
FGLOCK(&signal_thread_list_lock, {
|
FGLOCK(&signal_thread_list_lock, {
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
static void
|
static void
|
||||||
Init_native_thread()
|
Init_native_thread()
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
DuplicateHandle(GetCurrentProcess(),
|
DuplicateHandle(GetCurrentProcess(),
|
||||||
GetCurrentThread(),
|
GetCurrentThread(),
|
||||||
GetCurrentProcess(),
|
GetCurrentProcess(),
|
||||||
@ -53,7 +53,7 @@ w32_show_error_message()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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];
|
HANDLE events[2];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -94,7 +94,7 @@ w32_wait_event(HANDLE event, DWORD timeout, rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
native_sleep(rb_thead_t *th, struct timeval *tv)
|
native_sleep(rb_thread_t *th, struct timeval *tv)
|
||||||
{
|
{
|
||||||
DWORD msec;
|
DWORD msec;
|
||||||
if (tv) {
|
if (tv) {
|
||||||
@ -199,13 +199,13 @@ native_mutex_initialize(rb_thread_lock_t *lock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NOINLINE(static int
|
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);
|
void static thread_cleanup_func(void *th_ptr);
|
||||||
|
|
||||||
static unsigned int _stdcall
|
static unsigned int _stdcall
|
||||||
thread_start_func_1(void *th_ptr)
|
thread_start_func_1(void *th_ptr)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = th_ptr;
|
rb_thread_t *th = th_ptr;
|
||||||
VALUE stack_start;
|
VALUE stack_start;
|
||||||
/* run */
|
/* run */
|
||||||
th->native_thread_data.interrupt_event = CreateEvent(0, TRUE, FALSE, 0);
|
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
|
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 */
|
size_t stack_size = 4 * 1024 - sizeof(int); /* 4KB */
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ native_thread_join(HANDLE th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
native_thread_apply_priority(rb_thead_t *th)
|
native_thread_apply_priority(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
int priority = th->priority;
|
int priority = th->priority;
|
||||||
if (th->priority > 0) {
|
if (th->priority > 0) {
|
||||||
@ -283,7 +283,7 @@ native_thread_apply_priority(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
native_thread_interrupt(rb_thead_t *th)
|
native_thread_interrupt(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
thread_debug("native_thread_interrupt: %p\n", th);
|
thread_debug("native_thread_interrupt: %p\n", th);
|
||||||
SetEvent(th->native_thread_data.interrupt_event);
|
SetEvent(th->native_thread_data.interrupt_event);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#define RUBY_VERSION "1.9.0"
|
#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_VERSION_CODE 190
|
||||||
#define RUBY_RELEASE_CODE 20070207
|
#define RUBY_RELEASE_CODE 20070208
|
||||||
#define RUBY_PATCHLEVEL 0
|
#define RUBY_PATCHLEVEL 0
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2007
|
#define RUBY_RELEASE_YEAR 2007
|
||||||
#define RUBY_RELEASE_MONTH 2
|
#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_version[];
|
||||||
RUBY_EXTERN const char ruby_release_date[];
|
RUBY_EXTERN const char ruby_release_date[];
|
||||||
|
74
vm.c
74
vm.c
@ -41,12 +41,12 @@ void vm_analysis_register(int reg, int isset);
|
|||||||
void vm_analysis_insn(int insn);
|
void vm_analysis_insn(int insn);
|
||||||
|
|
||||||
static inline VALUE
|
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 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 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_get_special_cref(VALUE *lfp);
|
||||||
static NODE *lfp_set_special_cref(VALUE *lfp, NODE * cref);
|
static NODE *lfp_set_special_cref(VALUE *lfp, NODE * cref);
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ rb_vm_change_state(void)
|
|||||||
* prepare stack frame
|
* prepare stack frame
|
||||||
*/
|
*/
|
||||||
static inline rb_control_frame_t *
|
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 self, VALUE specval, VALUE *pc,
|
||||||
VALUE *sp, VALUE *lfp, int local_size)
|
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
|
static inline void
|
||||||
pop_frame(rb_thead_t *th)
|
pop_frame(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
#if COLLECT_PROFILE
|
#if COLLECT_PROFILE
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
@ -140,7 +140,7 @@ pop_frame(rb_thead_t *th)
|
|||||||
EXTERN VALUE ruby_top_self;
|
EXTERN VALUE ruby_top_self;
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
th_set_finish_env(rb_thead_t *th)
|
th_set_finish_env(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
push_frame(th, 0, FRAME_MAGIC_FINISH,
|
push_frame(th, 0, FRAME_MAGIC_FINISH,
|
||||||
Qnil, th->cfp->lfp[0], 0,
|
Qnil, th->cfp->lfp[0], 0,
|
||||||
@ -150,7 +150,7 @@ th_set_finish_env(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
rb_iseq_t *iseq;
|
||||||
GetISeqPtr(iseqval, iseq);
|
GetISeqPtr(iseqval, iseq);
|
||||||
@ -168,7 +168,7 @@ th_set_top_stack(rb_thead_t *th, VALUE iseqval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
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_iseq_t *iseq;
|
||||||
rb_block_t *block = th->base_block;
|
rb_block_t *block = th->base_block;
|
||||||
@ -240,7 +240,7 @@ env_alloc(void)
|
|||||||
static int check_env(rb_env_t *env);
|
static int check_env(rb_env_t *env);
|
||||||
|
|
||||||
static VALUE
|
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 *envptr, VALUE *endptr)
|
||||||
{
|
{
|
||||||
VALUE envval, penvval = 0;
|
VALUE envval, penvval = 0;
|
||||||
@ -388,7 +388,7 @@ collect_local_variables_in_env(rb_env_t *env, VALUE ary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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)) {
|
if (ENV_IN_HEAP_P(dfp)) {
|
||||||
rb_env_t *env;
|
rb_env_t *env;
|
||||||
@ -403,7 +403,7 @@ th_collect_local_variables_in_heap(rb_thead_t *th, VALUE *dfp, VALUE ary)
|
|||||||
|
|
||||||
|
|
||||||
VALUE
|
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;
|
VALUE envval;
|
||||||
// SDR2(cfp);
|
// SDR2(cfp);
|
||||||
@ -415,7 +415,7 @@ th_make_env_object(rb_thead_t *th, rb_control_frame_t *cfp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
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)
|
rb_block_t *block)
|
||||||
{
|
{
|
||||||
VALUE procval;
|
VALUE procval;
|
||||||
@ -435,7 +435,7 @@ th_make_proc_from_block(rb_thead_t *th, rb_control_frame_t *cfp,
|
|||||||
struct RObject *rb;
|
struct RObject *rb;
|
||||||
|
|
||||||
VALUE
|
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)
|
rb_block_t *block)
|
||||||
{
|
{
|
||||||
VALUE procval, envval, blockprocval = 0;
|
VALUE procval, envval, blockprocval = 0;
|
||||||
@ -482,7 +482,7 @@ th_make_proc(rb_thead_t *th, rb_control_frame_t *cfp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline VALUE
|
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)
|
VALUE klass, int argc, VALUE *argv)
|
||||||
{
|
{
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
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
|
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,
|
VALUE id, ID oid, int argc, const VALUE *argv,
|
||||||
NODE * body, int nosuper)
|
NODE * body, int nosuper)
|
||||||
{
|
{
|
||||||
@ -602,7 +602,7 @@ search_super_klass(VALUE klass, VALUE recv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
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 recv = th->cfp->self;
|
||||||
VALUE klass;
|
VALUE klass;
|
||||||
@ -641,7 +641,7 @@ th_call_super(rb_thead_t *th, int argc, const VALUE *argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline VALUE
|
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 self, int argc, VALUE *argv)
|
||||||
{
|
{
|
||||||
NODE *ifunc = (NODE *) block->iseq;
|
NODE *ifunc = (NODE *) block->iseq;
|
||||||
@ -747,7 +747,7 @@ th_yield_setup_args(rb_iseq_t *iseq, int argc, VALUE *argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
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;
|
VALUE val;
|
||||||
if (BUILTIN_TYPE(block->iseq) != T_NODE) {
|
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
|
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]);
|
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
|
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 self, int argc, VALUE *argv)
|
||||||
{
|
{
|
||||||
VALUE val = Qundef;
|
VALUE val = Qundef;
|
||||||
@ -848,7 +848,7 @@ static VALUE *
|
|||||||
lfp_svar(VALUE *lfp, int cnt)
|
lfp_svar(VALUE *lfp, int cnt)
|
||||||
{
|
{
|
||||||
struct RValues *val;
|
struct RValues *val;
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
|
|
||||||
if (th->local_lfp != lfp) {
|
if (th->local_lfp != lfp) {
|
||||||
val = (struct RValues *)lfp[-1];
|
val = (struct RValues *)lfp[-1];
|
||||||
@ -895,7 +895,7 @@ th_cfp_svar(rb_control_frame_t *cfp, int cnt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE *
|
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;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
return th_cfp_svar(cfp, cnt);
|
return th_cfp_svar(cfp, cnt);
|
||||||
@ -964,7 +964,7 @@ th_get_sourceline(rb_control_frame_t *cfp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
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 *limit_cfp,
|
||||||
rb_control_frame_t *cfp,
|
rb_control_frame_t *cfp,
|
||||||
char *file, int line_no, VALUE ary)
|
char *file, int line_no, VALUE ary)
|
||||||
@ -997,7 +997,7 @@ th_backtrace_each(rb_thead_t *th,
|
|||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
th_backtrace(rb_thead_t *th, int lev)
|
th_backtrace(rb_thread_t *th, int lev)
|
||||||
{
|
{
|
||||||
VALUE ary;
|
VALUE ary;
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
@ -1026,7 +1026,7 @@ th_backtrace(rb_thead_t *th, int lev)
|
|||||||
VALUE
|
VALUE
|
||||||
thread_backtrace(VALUE self, int level)
|
thread_backtrace(VALUE self, int level)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(self, th);
|
GetThreadPtr(self, th);
|
||||||
return th_backtrace(th, level);
|
return th_backtrace(th, level);
|
||||||
}
|
}
|
||||||
@ -1051,7 +1051,7 @@ lfp_get_special_cref(VALUE *lfp)
|
|||||||
static void
|
static void
|
||||||
check_svar(void)
|
check_svar(void)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
while ((void *)(cfp + 1) < (void *)(th->stack + th->stack_size)) {
|
while ((void *)(cfp + 1) < (void *)(th->stack + th->stack_size)) {
|
||||||
/* printf("cfp: %p\n", cfp->magic); */
|
/* printf("cfp: %p\n", cfp->magic); */
|
||||||
@ -1087,7 +1087,7 @@ lfp_set_special_cref(VALUE *lfp, NODE * cref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE *
|
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);
|
return lfp_set_special_cref(lfp, cref_stack);
|
||||||
}
|
}
|
||||||
@ -1119,13 +1119,13 @@ get_cref(rb_iseq_t *iseq, VALUE *lfp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE *
|
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);
|
return get_cref(iseq, cfp->lfp);
|
||||||
}
|
}
|
||||||
|
|
||||||
NODE *
|
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);
|
NODE *cref = NEW_BLOCK(klass);
|
||||||
rb_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
|
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
|
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);
|
rb_control_frame_t *cfp = th_get_ruby_level_cfp(th, th->cfp);
|
||||||
NODE *cref = get_cref(cfp->iseq, cfp->lfp);
|
NODE *cref = get_cref(cfp->iseq, cfp->lfp);
|
||||||
@ -1153,7 +1153,7 @@ th_get_cbase(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
EVALBODY_HELPER_FUNCTION VALUE
|
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 klass, ID id, int is_defined)
|
||||||
{
|
{
|
||||||
VALUE val;
|
VALUE val;
|
||||||
@ -1224,7 +1224,7 @@ eval_get_ev_const(rb_thead_t *th, rb_iseq_t *iseq,
|
|||||||
}
|
}
|
||||||
|
|
||||||
EVALBODY_HELPER_FUNCTION VALUE
|
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);
|
NODE *cref = get_cref(iseq, th->cfp->lfp);
|
||||||
VALUE klass = Qnil;
|
VALUE klass = Qnil;
|
||||||
@ -1242,7 +1242,7 @@ eval_get_cvar_base(rb_thead_t *th, rb_iseq_t *iseq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
EVALBODY_HELPER_FUNCTION void
|
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)
|
ID id, rb_iseq_t *miseq, num_t is_singleton, NODE *cref)
|
||||||
{
|
{
|
||||||
NODE *newbody;
|
NODE *newbody;
|
||||||
@ -1278,7 +1278,7 @@ eval_define_method(rb_thead_t *th, VALUE obj,
|
|||||||
}
|
}
|
||||||
|
|
||||||
EVALBODY_HELPER_FUNCTION VALUE
|
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_block_t *blockptr, int opt)
|
||||||
{
|
{
|
||||||
rb_control_frame_t *reg_cfp = th->cfp;
|
rb_control_frame_t *reg_cfp = th->cfp;
|
||||||
@ -1407,7 +1407,7 @@ th_jump_tag_but_local_jump(int state, VALUE val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
th_iter_break(rb_thead_t *th)
|
th_iter_break(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
VALUE *dfp = GC_GUARDED_PTR_REF(*cfp->dfp);
|
VALUE *dfp = GC_GUARDED_PTR_REF(*cfp->dfp);
|
||||||
@ -1586,7 +1586,7 @@ yarv_init_redefined_flag(void)
|
|||||||
|
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
th_eval_body(rb_thead_t *th)
|
th_eval_body(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
VALUE result, err;
|
VALUE result, err;
|
||||||
@ -1791,7 +1791,7 @@ th_eval_body(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_thread_eval(rb_thead_t *th, VALUE iseqval)
|
rb_thread_eval(rb_thread_t *th, VALUE iseqval)
|
||||||
{
|
{
|
||||||
VALUE val;
|
VALUE val;
|
||||||
volatile VALUE tmp;
|
volatile VALUE tmp;
|
||||||
|
4
vm.h
4
vm.h
@ -102,11 +102,11 @@ error !
|
|||||||
#define LABEL_PTR(x) &LABEL(x)
|
#define LABEL_PTR(x) &LABEL(x)
|
||||||
|
|
||||||
typedef rb_control_frame_t *
|
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) \
|
#define INSN_ENTRY(insn) \
|
||||||
rb_control_frame_t * \
|
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;}
|
#define END_INSN(insn) return reg_cfp;}
|
||||||
|
|
||||||
|
20
vm_dump.c
20
vm_dump.c
@ -19,7 +19,7 @@
|
|||||||
#define MAX_POSBUF 128
|
#define MAX_POSBUF 128
|
||||||
|
|
||||||
static void
|
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;
|
int pc = -1, bp = -1, line = 0;
|
||||||
unsigned int lfp = cfp->lfp - th->stack;
|
unsigned int lfp = cfp->lfp - th->stack;
|
||||||
@ -139,7 +139,7 @@ control_frame_dump(rb_thead_t *th, rb_control_frame_t *cfp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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 *sp = cfp->sp, *bp = cfp->bp;
|
||||||
VALUE *lfp = cfp->lfp;
|
VALUE *lfp = cfp->lfp;
|
||||||
@ -217,13 +217,13 @@ proc_dump_raw(rb_proc_t *proc)
|
|||||||
void
|
void
|
||||||
stack_dump_th(VALUE thval)
|
stack_dump_th(VALUE thval)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thval, th);
|
GetThreadPtr(thval, th);
|
||||||
vm_stack_dump_raw(th, th->cfp);
|
vm_stack_dump_raw(th, th->cfp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
int i;
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ stack_dump_each(rb_thead_t *th, rb_control_frame_t *cfp)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
debug_print_register(rb_thead_t *th)
|
debug_print_register(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
rb_control_frame_t *cfp = th->cfp;
|
rb_control_frame_t *cfp = th->cfp;
|
||||||
int pc = -1;
|
int pc = -1;
|
||||||
@ -341,13 +341,13 @@ debug_print_register(rb_thead_t *th)
|
|||||||
void
|
void
|
||||||
thread_dump_regs(VALUE thval)
|
thread_dump_regs(VALUE thval)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
GetThreadPtr(thval, th);
|
GetThreadPtr(thval, th);
|
||||||
debug_print_register(th);
|
debug_print_register(th);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
rb_iseq_t *iseq = cfp->iseq;
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ debug_print_pre(rb_thead_t *th, rb_control_frame_t *cfp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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
|
#if OPT_STACK_CACHING
|
||||||
, VALUE reg_a, VALUE reg_b
|
, VALUE reg_a, VALUE reg_b
|
||||||
#endif
|
#endif
|
||||||
@ -563,7 +563,7 @@ vm_analysis_register(int reg, int isset)
|
|||||||
VALUE
|
VALUE
|
||||||
thread_dump_state(VALUE self)
|
thread_dump_state(VALUE self)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
rb_control_frame_t *cfp;
|
rb_control_frame_t *cfp;
|
||||||
GetThreadPtr(self, th);
|
GetThreadPtr(self, th);
|
||||||
cfp = th->cfp;
|
cfp = th->cfp;
|
||||||
@ -578,7 +578,7 @@ thread_dump_state(VALUE self)
|
|||||||
void
|
void
|
||||||
yarv_bug()
|
yarv_bug()
|
||||||
{
|
{
|
||||||
rb_thead_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
VALUE bt;
|
VALUE bt;
|
||||||
|
|
||||||
if (GET_THREAD()->vm) {
|
if (GET_THREAD()->vm) {
|
||||||
|
@ -30,7 +30,7 @@ typedef rb_iseq_t *ISEQ;
|
|||||||
|
|
||||||
#if !OPT_CALL_THREADED_CODE
|
#if !OPT_CALL_THREADED_CODE
|
||||||
VALUE
|
VALUE
|
||||||
th_eval(rb_thead_t *th, VALUE initial)
|
th_eval(rb_thread_t *th, VALUE initial)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if OPT_STACK_CACHING
|
#if OPT_STACK_CACHING
|
||||||
@ -123,7 +123,7 @@ get_insns_address_table()
|
|||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
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;
|
register rb_control_frame_t *reg_cfp = th->cfp;
|
||||||
SET_PC(reg_cfp->iseq->iseq_encoded);
|
SET_PC(reg_cfp->iseq->iseq_encoded);
|
||||||
|
28
yarvcore.c
28
yarvcore.c
@ -74,7 +74,7 @@ unsigned long yarvGlobalStateVersion = 1;
|
|||||||
/* YARVCore */
|
/* YARVCore */
|
||||||
/************/
|
/************/
|
||||||
|
|
||||||
rb_thead_t *yarvCurrentThread = 0;
|
rb_thread_t *yarvCurrentThread = 0;
|
||||||
rb_vm_t *theYarvVM = 0;
|
rb_vm_t *theYarvVM = 0;
|
||||||
static VALUE yarvVMArray = Qnil;
|
static VALUE yarvVMArray = Qnil;
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ yarvcore_eval_iseq(VALUE iseq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
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;
|
VALUE iseq;
|
||||||
if (th->base_block) {
|
if (th->base_block) {
|
||||||
@ -118,7 +118,7 @@ th_compile_from_node(rb_thead_t *th, NODE * node, VALUE file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
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);
|
NODE *node = (NODE *) compile_string(str, file, line);
|
||||||
return th_compile_from_node(th, (NODE *) node, file);
|
return th_compile_from_node(th, (NODE *) node, file);
|
||||||
@ -211,7 +211,7 @@ vm_init2(rb_vm_t *vm)
|
|||||||
static void
|
static void
|
||||||
thread_free(void *ptr)
|
thread_free(void *ptr)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
FREE_REPORT_ENTER("thread");
|
FREE_REPORT_ENTER("thread");
|
||||||
|
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
@ -245,12 +245,12 @@ thread_free(void *ptr)
|
|||||||
FREE_REPORT_LEAVE("thread");
|
FREE_REPORT_LEAVE("thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
void yarv_machine_stack_mark(rb_thead_t *th);
|
void yarv_machine_stack_mark(rb_thread_t *th);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
thread_mark(void *ptr)
|
thread_mark(void *ptr)
|
||||||
{
|
{
|
||||||
rb_thead_t *th = NULL;
|
rb_thread_t *th = NULL;
|
||||||
MARK_REPORT_ENTER("thread");
|
MARK_REPORT_ENTER("thread");
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
th = ptr;
|
th = ptr;
|
||||||
@ -298,16 +298,16 @@ static VALUE
|
|||||||
thread_alloc(VALUE klass)
|
thread_alloc(VALUE klass)
|
||||||
{
|
{
|
||||||
VALUE volatile obj;
|
VALUE volatile obj;
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
obj = Data_Make_Struct(klass, rb_thead_t,
|
obj = Data_Make_Struct(klass, rb_thread_t,
|
||||||
thread_mark, thread_free, th);
|
thread_mark, thread_free, th);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 */
|
/* allocate thread stack */
|
||||||
th->stack = ALLOC_N(VALUE, RUBY_VM_THREAD_STACK_SIZE);
|
th->stack = ALLOC_N(VALUE, RUBY_VM_THREAD_STACK_SIZE);
|
||||||
@ -336,7 +336,7 @@ th_init2(rb_thead_t *th)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
th_init(rb_thead_t *th)
|
th_init(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
th_init2(th);
|
th_init2(th);
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ th_init(rb_thead_t *th)
|
|||||||
static VALUE
|
static VALUE
|
||||||
thread_init(VALUE self)
|
thread_init(VALUE self)
|
||||||
{
|
{
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
rb_vm_t *vm = GET_THREAD()->vm;
|
rb_vm_t *vm = GET_THREAD()->vm;
|
||||||
GetThreadPtr(self, th);
|
GetThreadPtr(self, th);
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ Init_VM(void)
|
|||||||
VALUE thval;
|
VALUE thval;
|
||||||
|
|
||||||
rb_vm_t *vm;
|
rb_vm_t *vm;
|
||||||
rb_thead_t *th;
|
rb_thread_t *th;
|
||||||
vm = theYarvVM;
|
vm = theYarvVM;
|
||||||
|
|
||||||
xfree(RDATA(vmval)->data);
|
xfree(RDATA(vmval)->data);
|
||||||
@ -548,7 +548,7 @@ Init_yarv(void)
|
|||||||
{
|
{
|
||||||
/* VM bootstrap: phase 1 */
|
/* VM bootstrap: phase 1 */
|
||||||
rb_vm_t *vm = ALLOC(rb_vm_t);
|
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);
|
vm_init2(vm);
|
||||||
theYarvVM = vm;
|
theYarvVM = vm;
|
||||||
|
34
yarvcore.h
34
yarvcore.h
@ -358,7 +358,7 @@ typedef struct {
|
|||||||
} rb_block_t;
|
} rb_block_t;
|
||||||
|
|
||||||
#define GetThreadPtr(obj, ptr) \
|
#define GetThreadPtr(obj, ptr) \
|
||||||
Data_Get_Struct(obj, rb_thead_t, ptr)
|
Data_Get_Struct(obj, rb_thread_t, ptr)
|
||||||
|
|
||||||
enum rb_thread_status {
|
enum rb_thread_status {
|
||||||
THREAD_TO_KILL,
|
THREAD_TO_KILL,
|
||||||
@ -456,7 +456,7 @@ typedef struct rb_thread_struct
|
|||||||
/* misc */
|
/* misc */
|
||||||
int method_missing_reason;
|
int method_missing_reason;
|
||||||
int abort_on_exception;
|
int abort_on_exception;
|
||||||
} rb_thead_t;
|
} rb_thread_t;
|
||||||
|
|
||||||
/** node -> yarv instruction sequence object */
|
/** node -> yarv instruction sequence object */
|
||||||
VALUE rb_iseq_compile(VALUE self, NODE *node);
|
VALUE rb_iseq_compile(VALUE self, NODE *node);
|
||||||
@ -584,7 +584,7 @@ VALUE rb_thread_alloc(VALUE klass);
|
|||||||
VALUE rb_proc_alloc(void);
|
VALUE rb_proc_alloc(void);
|
||||||
|
|
||||||
/* for debug */
|
/* 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 SDR() vm_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
|
||||||
#define SDR2(cfp) vm_stack_dump_raw(GET_THREAD(), (cfp))
|
#define SDR2(cfp) vm_stack_dump_raw(GET_THREAD(), (cfp))
|
||||||
void yarv_bug(void);
|
void yarv_bug(void);
|
||||||
@ -592,20 +592,20 @@ void yarv_bug(void);
|
|||||||
|
|
||||||
/* functions about thread/vm execution */
|
/* 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_enable_interrupt(void);
|
||||||
void rb_disable_interrupt(void);
|
void rb_disable_interrupt(void);
|
||||||
|
|
||||||
VALUE th_eval_body(rb_thead_t *th);
|
VALUE th_eval_body(rb_thread_t *th);
|
||||||
VALUE th_set_eval_stack(rb_thead_t *, VALUE iseq);
|
VALUE th_set_eval_stack(rb_thread_t *, VALUE iseq);
|
||||||
VALUE th_call_super(rb_thead_t *th, int argc, const VALUE *argv);
|
VALUE th_call_super(rb_thread_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_invoke_proc(rb_thread_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_proc(rb_thread_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_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
|
||||||
VALUE th_backtrace(rb_thead_t *, int);
|
VALUE th_backtrace(rb_thread_t *, int);
|
||||||
|
|
||||||
VALUE th_invoke_yield(rb_thead_t *th, int argc, VALUE *argv);
|
VALUE th_invoke_yield(rb_thread_t *th, int argc, VALUE *argv);
|
||||||
VALUE th_call0(rb_thead_t *th, VALUE klass, VALUE recv,
|
VALUE th_call0(rb_thread_t *th, VALUE klass, VALUE recv,
|
||||||
VALUE id, ID oid, int argc, const VALUE *argv,
|
VALUE id, ID oid, int argc, const VALUE *argv,
|
||||||
NODE * body, int nosuper);
|
NODE * body, int nosuper);
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ VALUE yarvcore_eval(VALUE self, VALUE str, VALUE file, VALUE line);
|
|||||||
/* for thread */
|
/* for thread */
|
||||||
|
|
||||||
#if RUBY_VM_THREAD_MODEL == 2
|
#if RUBY_VM_THREAD_MODEL == 2
|
||||||
extern rb_thead_t *yarvCurrentThread;
|
extern rb_thread_t *yarvCurrentThread;
|
||||||
extern rb_vm_t *theYarvVM;
|
extern rb_vm_t *theYarvVM;
|
||||||
|
|
||||||
#define GET_VM() theYarvVM
|
#define GET_VM() theYarvVM
|
||||||
@ -633,7 +633,7 @@ extern rb_vm_t *theYarvVM;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GVL_UNLOCK_BEGIN() do { \
|
#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); \
|
rb_gc_save_machine_context(_th_stored); \
|
||||||
native_mutex_unlock(&_th_stored->vm->global_interpreter_lock)
|
native_mutex_unlock(&_th_stored->vm->global_interpreter_lock)
|
||||||
|
|
||||||
@ -643,9 +643,9 @@ extern rb_vm_t *theYarvVM;
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
|
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 { \
|
#define RUBY_VM_CHECK_INTS_TH(th) do { \
|
||||||
if(th->interrupt_flag){ \
|
if(th->interrupt_flag){ \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user