mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* vm.c: add a prefix "rb_" to exposed functions
vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(), vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(), vm_get_sourceline(), vm_cref(), vm_localjump_error(), vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump(). This changes may affect only core because most of renamed functions require a pointer of not-exposed struct such as rb_thread_t or NODE. In short, they are core functions. * cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c, vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									2aa6644acd
								
							
						
					
					
						commit
						cf23d0f0f0
					
				
					 14 changed files with 92 additions and 77 deletions
				
			
		
							
								
								
									
										15
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								ChangeLog
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,18 @@
 | 
			
		|||
Mon Jan 19 11:27:39 2009  Koichi Sasada  <ko1@atdot.net>
 | 
			
		||||
 | 
			
		||||
	* vm.c: add a prefix "rb_" to exposed functions
 | 
			
		||||
	  vm_get_ruby_level_next_cfp(), rb_vm_make_env_object(),
 | 
			
		||||
	  vm_stack_to_heap(), vm_make_proc(), vm_invoke_proc(),
 | 
			
		||||
	  vm_get_sourceline(), vm_cref(), vm_localjump_error(),
 | 
			
		||||
	  vm_make_jump_tag_but_local_jump(), vm_jump_tag_but_local_jump().
 | 
			
		||||
  	  This changes may affect only core because most of renamed functions
 | 
			
		||||
	  require a pointer of not-exposed struct such as rb_thread_t or NODE.
 | 
			
		||||
	  In short, they are core functions.
 | 
			
		||||
 | 
			
		||||
	* cont.c, eval.c, eval_intern.h, load.c, proc.c, thread.c,
 | 
			
		||||
	  vm_core.h, vm_dump.c, vm_eval.c, vm_exec.c, vm_insnhelper.c:
 | 
			
		||||
	  ditto.
 | 
			
		||||
 | 
			
		||||
Mon Jan 19 11:22:51 2009  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* ext/socket/rubysocket.h (rb_cUNIXSocket, rb_cUNIXServer),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -506,11 +506,11 @@ int
 | 
			
		|||
rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
 | 
			
		||||
{
 | 
			
		||||
#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
 | 
			
		||||
    extern const void **vm_get_insns_address_table(void);
 | 
			
		||||
    extern const void **rb_vm_get_insns_address_table(void);
 | 
			
		||||
#if OPT_DIRECT_THREADED_CODE
 | 
			
		||||
    const void * const *table = vm_get_insns_address_table();
 | 
			
		||||
    const void * const *table = rb_vm_get_insns_address_table();
 | 
			
		||||
#else
 | 
			
		||||
    const void * const *table = vm_get_insns_address_table();
 | 
			
		||||
    const void * const *table = rb_vm_get_insns_address_table();
 | 
			
		||||
#endif
 | 
			
		||||
    int i;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								cont.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								cont.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -247,7 +247,7 @@ cont_new(VALUE klass)
 | 
			
		|||
    return cont;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void vm_stack_to_heap(rb_thread_t *th);
 | 
			
		||||
void rb_vm_stack_to_heap(rb_thread_t *th);
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
cont_capture(volatile int *stat)
 | 
			
		||||
| 
						 | 
				
			
			@ -256,7 +256,7 @@ cont_capture(volatile int *stat)
 | 
			
		|||
    rb_thread_t *th = GET_THREAD(), *sth;
 | 
			
		||||
    volatile VALUE contval;
 | 
			
		||||
 | 
			
		||||
    vm_stack_to_heap(th);
 | 
			
		||||
    rb_vm_stack_to_heap(th);
 | 
			
		||||
    cont = cont_new(rb_cContinuation);
 | 
			
		||||
    contval = cont->self;
 | 
			
		||||
    sth = &cont->saved_thread;
 | 
			
		||||
| 
						 | 
				
			
			@ -785,7 +785,7 @@ rb_fiber_start(void)
 | 
			
		|||
	th->local_svar = Qnil;
 | 
			
		||||
 | 
			
		||||
	fib->status = RUNNING;
 | 
			
		||||
	cont->value = vm_invoke_proc(th, proc, proc->block.self, argc, argv, 0);
 | 
			
		||||
	cont->value = rb_vm_invoke_proc(th, proc, proc->block.self, argc, argv, 0);
 | 
			
		||||
    }
 | 
			
		||||
    TH_POP_TAG();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -795,7 +795,7 @@ rb_fiber_start(void)
 | 
			
		|||
	}
 | 
			
		||||
	else {
 | 
			
		||||
	    th->thrown_errinfo =
 | 
			
		||||
	      vm_make_jump_tag_but_local_jump(state, th->errinfo);
 | 
			
		||||
	      rb_vm_make_jump_tag_but_local_jump(state, th->errinfo);
 | 
			
		||||
	}
 | 
			
		||||
	RUBY_VM_SET_INTERRUPT(th);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								eval.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								eval.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -251,7 +251,7 @@ static VALUE
 | 
			
		|||
rb_mod_nesting(void)
 | 
			
		||||
{
 | 
			
		||||
    VALUE ary = rb_ary_new();
 | 
			
		||||
    const NODE *cref = vm_cref();
 | 
			
		||||
    const NODE *cref = rb_vm_cref();
 | 
			
		||||
 | 
			
		||||
    while (cref && cref->nd_next) {
 | 
			
		||||
	VALUE klass = cref->nd_clss;
 | 
			
		||||
| 
						 | 
				
			
			@ -280,7 +280,7 @@ rb_mod_nesting(void)
 | 
			
		|||
static VALUE
 | 
			
		||||
rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
 | 
			
		||||
{
 | 
			
		||||
    const NODE *cref = vm_cref();
 | 
			
		||||
    const NODE *cref = rb_vm_cref();
 | 
			
		||||
    VALUE klass;
 | 
			
		||||
    VALUE cbase = 0;
 | 
			
		||||
    void *data = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -592,7 +592,7 @@ void
 | 
			
		|||
rb_need_block()
 | 
			
		||||
{
 | 
			
		||||
    if (!rb_block_given_p()) {
 | 
			
		||||
	vm_localjump_error("no block given", Qnil, 0);
 | 
			
		||||
	rb_vm_localjump_error("no block given", Qnil, 0);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -162,9 +162,9 @@ enum ruby_tag_type {
 | 
			
		|||
#define GET_THROWOBJ_CATCH_POINT(obj) ((VALUE*)RNODE((obj))->u2.value)
 | 
			
		||||
#define GET_THROWOBJ_STATE(obj)       ((int)RNODE((obj))->u3.value)
 | 
			
		||||
 | 
			
		||||
#define SCOPE_TEST(f)  (vm_cref()->nd_visi & (f))
 | 
			
		||||
#define SCOPE_CHECK(f) (vm_cref()->nd_visi == (f))
 | 
			
		||||
#define SCOPE_SET(f)   (vm_cref()->nd_visi = (f))
 | 
			
		||||
#define SCOPE_TEST(f)  (rb_vm_cref()->nd_visi & (f))
 | 
			
		||||
#define SCOPE_CHECK(f) (rb_vm_cref()->nd_visi == (f))
 | 
			
		||||
#define SCOPE_SET(f)   (rb_vm_cref()->nd_visi = (f))
 | 
			
		||||
 | 
			
		||||
#define CHECK_STACK_OVERFLOW(cfp, margin) do \
 | 
			
		||||
  if (((VALUE *)(cfp)->sp) + (margin) + sizeof(rb_control_frame_t) >= ((VALUE *)cfp)) { \
 | 
			
		||||
| 
						 | 
				
			
			@ -193,11 +193,11 @@ VALUE rb_make_exception(int argc, VALUE *argv);
 | 
			
		|||
NORETURN(void rb_fiber_start(void));
 | 
			
		||||
 | 
			
		||||
NORETURN(void rb_print_undef(VALUE, ID, int));
 | 
			
		||||
NORETURN(void vm_localjump_error(const char *,VALUE, int));
 | 
			
		||||
NORETURN(void vm_jump_tag_but_local_jump(int, VALUE));
 | 
			
		||||
NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
 | 
			
		||||
NORETURN(void rb_vm_jump_tag_but_local_jump(int, VALUE));
 | 
			
		||||
 | 
			
		||||
VALUE vm_make_jump_tag_but_local_jump(int state, VALUE val);
 | 
			
		||||
NODE *vm_cref(void);
 | 
			
		||||
VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
 | 
			
		||||
NODE *rb_vm_cref(void);
 | 
			
		||||
rb_control_frame_t *vm_get_ruby_level_caller_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
 | 
			
		||||
VALUE rb_obj_is_proc(VALUE);
 | 
			
		||||
VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								load.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								load.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -315,7 +315,7 @@ rb_load(VALUE fname, int wrap)
 | 
			
		|||
	rb_exc_raise(GET_THREAD()->errinfo);
 | 
			
		||||
    }
 | 
			
		||||
    if (state) {
 | 
			
		||||
	vm_jump_tag_but_local_jump(state, Qundef);
 | 
			
		||||
	rb_vm_jump_tag_but_local_jump(state, Qundef);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!NIL_P(GET_THREAD()->errinfo)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								proc.c
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								proc.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -274,13 +274,13 @@ binding_clone(VALUE self)
 | 
			
		|||
    return bindval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rb_control_frame_t *vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
 | 
			
		||||
rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_binding_new(void)
 | 
			
		||||
{
 | 
			
		||||
    rb_thread_t *th = GET_THREAD();
 | 
			
		||||
    rb_control_frame_t *cfp = vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
    rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
    VALUE bindval = binding_alloc(rb_cBinding);
 | 
			
		||||
    rb_binding_t *bind;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -289,7 +289,7 @@ rb_binding_new(void)
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    GetBindingPtr(bindval, bind);
 | 
			
		||||
    bind->env = vm_make_env_object(th, cfp);
 | 
			
		||||
    bind->env = rb_vm_make_env_object(th, cfp);
 | 
			
		||||
    return bindval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -385,7 +385,7 @@ proc_new(VALUE klass, int is_lambda)
 | 
			
		|||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    procval = vm_make_proc(th, block, klass);
 | 
			
		||||
    procval = rb_vm_make_proc(th, block, klass);
 | 
			
		||||
 | 
			
		||||
    if (is_lambda) {
 | 
			
		||||
	rb_proc_t *proc;
 | 
			
		||||
| 
						 | 
				
			
			@ -524,8 +524,8 @@ proc_call(int argc, VALUE *argv, VALUE procval)
 | 
			
		|||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
 | 
			
		||||
			  argc, argv, blockptr);
 | 
			
		||||
    return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
 | 
			
		||||
			     argc, argv, blockptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -533,8 +533,8 @@ rb_proc_call(VALUE self, VALUE args)
 | 
			
		|||
{
 | 
			
		||||
    rb_proc_t *proc;
 | 
			
		||||
    GetProcPtr(self, proc);
 | 
			
		||||
    return vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
 | 
			
		||||
			  RARRAY_LEN(args), RARRAY_PTR(args), 0);
 | 
			
		||||
    return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
 | 
			
		||||
			     RARRAY_LEN(args), RARRAY_PTR(args), 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -550,8 +550,8 @@ rb_proc_call_with_block(VALUE self, int argc, VALUE *argv, VALUE pass_procval)
 | 
			
		|||
	block = &pass_proc->block;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
 | 
			
		||||
			  argc, argv, block);
 | 
			
		||||
    return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
 | 
			
		||||
			     argc, argv, block);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								thread.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								thread.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -383,8 +383,8 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
 | 
			
		|||
		    th->errinfo = Qnil;
 | 
			
		||||
		    th->local_lfp = proc->block.lfp;
 | 
			
		||||
		    th->local_svar = Qnil;
 | 
			
		||||
		    th->value = vm_invoke_proc(th, proc, proc->block.self,
 | 
			
		||||
					       RARRAY_LEN(args), RARRAY_PTR(args), 0);
 | 
			
		||||
		    th->value = rb_vm_invoke_proc(th, proc, proc->block.self,
 | 
			
		||||
						  RARRAY_LEN(args), RARRAY_PTR(args), 0);
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
		    th->value = (*th->first_func)((void *)th->first_args);
 | 
			
		||||
| 
						 | 
				
			
			@ -647,7 +647,7 @@ thread_join(rb_thread_t *target_th, double delay)
 | 
			
		|||
	    /* */
 | 
			
		||||
	}
 | 
			
		||||
	else if (TYPE(target_th->errinfo) == T_NODE) {
 | 
			
		||||
	    rb_exc_raise(vm_make_jump_tag_but_local_jump(
 | 
			
		||||
	    rb_exc_raise(rb_vm_make_jump_tag_but_local_jump(
 | 
			
		||||
		GET_THROWOBJ_STATE(err), GET_THROWOBJ_VAL(err)));
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										60
									
								
								vm.c
									
										
									
									
									
								
							
							
						
						
									
										60
									
								
								vm.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -128,14 +128,14 @@ vm_set_main_stack(rb_thread_t *th, VALUE iseqval)
 | 
			
		|||
    /* save binding */
 | 
			
		||||
    GetISeqPtr(iseqval, iseq);
 | 
			
		||||
    if (bind && iseq->local_size > 0) {
 | 
			
		||||
	bind->env = vm_make_env_object(th, th->cfp);
 | 
			
		||||
	bind->env = rb_vm_make_env_object(th, th->cfp);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rb_control_frame_t *
 | 
			
		||||
vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
 | 
			
		||||
rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
 | 
			
		||||
{
 | 
			
		||||
    while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp)) {
 | 
			
		||||
	if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -390,7 +390,7 @@ vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, VALUE ary)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
vm_make_env_object(rb_thread_t * th, rb_control_frame_t *cfp)
 | 
			
		||||
rb_vm_make_env_object(rb_thread_t * th, rb_control_frame_t *cfp)
 | 
			
		||||
{
 | 
			
		||||
    VALUE envval;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -409,11 +409,11 @@ vm_make_env_object(rb_thread_t * th, rb_control_frame_t *cfp)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
vm_stack_to_heap(rb_thread_t * const th)
 | 
			
		||||
rb_vm_stack_to_heap(rb_thread_t * const th)
 | 
			
		||||
{
 | 
			
		||||
    rb_control_frame_t *cfp = th->cfp;
 | 
			
		||||
    while ((cfp = vm_get_ruby_level_next_cfp(th, cfp)) != 0) {
 | 
			
		||||
	vm_make_env_object(th, cfp);
 | 
			
		||||
    while ((cfp = rb_vm_get_ruby_level_next_cfp(th, cfp)) != 0) {
 | 
			
		||||
	rb_vm_make_env_object(th, cfp);
 | 
			
		||||
	cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -429,21 +429,21 @@ vm_make_proc_from_block(rb_thread_t *th, rb_block_t *block)
 | 
			
		|||
	return block->proc;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    proc = vm_make_proc(th, block, rb_cProc);
 | 
			
		||||
    proc = rb_vm_make_proc(th, block, rb_cProc);
 | 
			
		||||
    block->proc = proc;
 | 
			
		||||
 | 
			
		||||
    return proc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass)
 | 
			
		||||
rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass)
 | 
			
		||||
{
 | 
			
		||||
    VALUE procval, envval, blockprocval = 0;
 | 
			
		||||
    rb_proc_t *proc;
 | 
			
		||||
    rb_control_frame_t *cfp = RUBY_VM_GET_CFP_FROM_BLOCK_PTR(block);
 | 
			
		||||
 | 
			
		||||
    if (block->proc) {
 | 
			
		||||
	rb_bug("vm_make_proc: Proc value is already created.");
 | 
			
		||||
	rb_bug("rb_vm_make_proc: Proc value is already created.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (GC_GUARDED_PTR_REF(cfp->lfp[0])) {
 | 
			
		||||
| 
						 | 
				
			
			@ -458,7 +458,7 @@ vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass)
 | 
			
		|||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    envval = vm_make_env_object(th, cfp);
 | 
			
		||||
    envval = rb_vm_make_env_object(th, cfp);
 | 
			
		||||
 | 
			
		||||
    if (PROCDEBUG) {
 | 
			
		||||
	check_env_value(envval);
 | 
			
		||||
| 
						 | 
				
			
			@ -534,7 +534,7 @@ check_block(rb_thread_t *th)
 | 
			
		|||
    const rb_block_t *blockptr = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
 | 
			
		||||
 | 
			
		||||
    if (blockptr == 0) {
 | 
			
		||||
	vm_localjump_error("no block given", Qnil, 0);
 | 
			
		||||
	rb_vm_localjump_error("no block given", Qnil, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return blockptr;
 | 
			
		||||
| 
						 | 
				
			
			@ -555,8 +555,8 @@ vm_yield(rb_thread_t *th, int argc, const VALUE *argv)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
 | 
			
		||||
	       int argc, const VALUE *argv, rb_block_t * blockptr)
 | 
			
		||||
rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
 | 
			
		||||
		  int argc, const VALUE *argv, rb_block_t * blockptr)
 | 
			
		||||
{
 | 
			
		||||
    VALUE val = Qundef;
 | 
			
		||||
    int state;
 | 
			
		||||
| 
						 | 
				
			
			@ -666,7 +666,7 @@ rb_lastline_set(VALUE val)
 | 
			
		|||
/* backtrace */
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
vm_get_sourceline(const rb_control_frame_t *cfp)
 | 
			
		||||
rb_vm_get_sourceline(const rb_control_frame_t *cfp)
 | 
			
		||||
{
 | 
			
		||||
    int line_no = 0;
 | 
			
		||||
    const rb_iseq_t *iseq = cfp->iseq;
 | 
			
		||||
| 
						 | 
				
			
			@ -700,7 +700,7 @@ vm_backtrace_each(rb_thread_t *th,
 | 
			
		|||
	    if (cfp->pc != 0) {
 | 
			
		||||
		rb_iseq_t *iseq = cfp->iseq;
 | 
			
		||||
 | 
			
		||||
		line_no = vm_get_sourceline(cfp);
 | 
			
		||||
		line_no = rb_vm_get_sourceline(cfp);
 | 
			
		||||
		file = RSTRING_PTR(iseq->filename);
 | 
			
		||||
		str = rb_sprintf("%s:%d:in `%s'",
 | 
			
		||||
				 file, line_no, RSTRING_PTR(iseq->name));
 | 
			
		||||
| 
						 | 
				
			
			@ -749,7 +749,7 @@ const char *
 | 
			
		|||
rb_sourcefile(void)
 | 
			
		||||
{
 | 
			
		||||
    rb_thread_t *th = GET_THREAD();
 | 
			
		||||
    rb_control_frame_t *cfp = vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
    rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
 | 
			
		||||
    if (cfp) {
 | 
			
		||||
	return RSTRING_PTR(cfp->iseq->filename);
 | 
			
		||||
| 
						 | 
				
			
			@ -763,10 +763,10 @@ int
 | 
			
		|||
rb_sourceline(void)
 | 
			
		||||
{
 | 
			
		||||
    rb_thread_t *th = GET_THREAD();
 | 
			
		||||
    rb_control_frame_t *cfp = vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
    rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
 | 
			
		||||
    if (cfp) {
 | 
			
		||||
	return vm_get_sourceline(cfp);
 | 
			
		||||
	return rb_vm_get_sourceline(cfp);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
	return 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -774,10 +774,10 @@ rb_sourceline(void)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
NODE *
 | 
			
		||||
vm_cref(void)
 | 
			
		||||
rb_vm_cref(void)
 | 
			
		||||
{
 | 
			
		||||
    rb_thread_t *th = GET_THREAD();
 | 
			
		||||
    rb_control_frame_t *cfp = vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
    rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
    return vm_get_cref(cfp->iseq, cfp->lfp, cfp->dfp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -797,7 +797,7 @@ VALUE
 | 
			
		|||
rb_vm_cbase(void)
 | 
			
		||||
{
 | 
			
		||||
    rb_thread_t *th = GET_THREAD();
 | 
			
		||||
    rb_control_frame_t *cfp = vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
    rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
 | 
			
		||||
    return vm_get_cbase(cfp->iseq, cfp->lfp, cfp->dfp);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -837,14 +837,14 @@ make_localjump_error(const char *mesg, VALUE value, int reason)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
vm_localjump_error(const char *mesg, VALUE value, int reason)
 | 
			
		||||
rb_vm_localjump_error(const char *mesg, VALUE value, int reason)
 | 
			
		||||
{
 | 
			
		||||
    VALUE exc = make_localjump_error(mesg, value, reason);
 | 
			
		||||
    rb_exc_raise(exc);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
vm_make_jump_tag_but_local_jump(int state, VALUE val)
 | 
			
		||||
rb_vm_make_jump_tag_but_local_jump(int state, VALUE val)
 | 
			
		||||
{
 | 
			
		||||
    VALUE result = Qnil;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -876,10 +876,10 @@ vm_make_jump_tag_but_local_jump(int state, VALUE val)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
vm_jump_tag_but_local_jump(int state, VALUE val)
 | 
			
		||||
rb_vm_jump_tag_but_local_jump(int state, VALUE val)
 | 
			
		||||
{
 | 
			
		||||
    if (val != Qnil) {
 | 
			
		||||
	VALUE exc = vm_make_jump_tag_but_local_jump(state, val);
 | 
			
		||||
	VALUE exc = rb_vm_make_jump_tag_but_local_jump(state, val);
 | 
			
		||||
	rb_exc_raise(exc);
 | 
			
		||||
    }
 | 
			
		||||
    JUMP_TAG(state);
 | 
			
		||||
| 
						 | 
				
			
			@ -1341,7 +1341,7 @@ rb_thread_current_status(const rb_thread_t *th)
 | 
			
		|||
    if (cfp->iseq != 0) {
 | 
			
		||||
	if (cfp->pc != 0) {
 | 
			
		||||
	    rb_iseq_t *iseq = cfp->iseq;
 | 
			
		||||
	    int line_no = vm_get_sourceline(cfp);
 | 
			
		||||
	    int line_no = rb_vm_get_sourceline(cfp);
 | 
			
		||||
	    char *file = RSTRING_PTR(iseq->filename);
 | 
			
		||||
	    str = rb_sprintf("%s:%d:in `%s'",
 | 
			
		||||
			     file, line_no, RSTRING_PTR(iseq->name));
 | 
			
		||||
| 
						 | 
				
			
			@ -1720,7 +1720,7 @@ static VALUE
 | 
			
		|||
m_core_define_method(VALUE self, VALUE cbase, VALUE sym, VALUE iseqval)
 | 
			
		||||
{
 | 
			
		||||
    REWIND_CFP({
 | 
			
		||||
	vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 0, vm_cref());
 | 
			
		||||
	vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 0, rb_vm_cref());
 | 
			
		||||
    });
 | 
			
		||||
    return Qnil;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1729,7 +1729,7 @@ static VALUE
 | 
			
		|||
m_core_define_singleton_method(VALUE self, VALUE cbase, VALUE sym, VALUE iseqval)
 | 
			
		||||
{
 | 
			
		||||
    REWIND_CFP({
 | 
			
		||||
	vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 1, vm_cref());
 | 
			
		||||
	vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 1, rb_vm_cref());
 | 
			
		||||
    });
 | 
			
		||||
    return Qnil;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1769,7 +1769,7 @@ m_core_set_postexe(VALUE self, VALUE iseqval)
 | 
			
		|||
	rb_iseq_t *blockiseq;
 | 
			
		||||
	rb_block_t *blockptr;
 | 
			
		||||
	rb_thread_t *th = GET_THREAD();
 | 
			
		||||
	rb_control_frame_t *cfp = vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
	rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
 | 
			
		||||
	VALUE proc;
 | 
			
		||||
	extern void rb_call_end_proc(VALUE data);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1779,7 +1779,7 @@ m_core_set_postexe(VALUE self, VALUE iseqval)
 | 
			
		|||
	blockptr->iseq = blockiseq;
 | 
			
		||||
	blockptr->proc = 0;
 | 
			
		||||
 | 
			
		||||
	proc = vm_make_proc(th, blockptr, rb_cProc);
 | 
			
		||||
	proc = rb_vm_make_proc(th, blockptr, rb_cProc);
 | 
			
		||||
	rb_set_end_proc(rb_call_end_proc, proc);
 | 
			
		||||
    });
 | 
			
		||||
    return Qnil;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -583,10 +583,10 @@ void rb_enable_interrupt(void);
 | 
			
		|||
void rb_disable_interrupt(void);
 | 
			
		||||
int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
 | 
			
		||||
 | 
			
		||||
VALUE vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
 | 
			
		||||
		     int argc, const VALUE *argv, rb_block_t *blockptr);
 | 
			
		||||
VALUE vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
 | 
			
		||||
VALUE vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
 | 
			
		||||
VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
 | 
			
		||||
			int argc, const VALUE *argv, rb_block_t *blockptr);
 | 
			
		||||
VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
 | 
			
		||||
VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
 | 
			
		||||
 | 
			
		||||
void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
 | 
			
		||||
int ruby_thread_has_gvl_p(void);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,11 +102,11 @@ control_frame_dump(rb_thread_t *th, rb_control_frame_t *cfp)
 | 
			
		|||
	    iseq_name = "<ifunc>";
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
	    int vm_get_sourceline(rb_control_frame_t *);
 | 
			
		||||
	    int rb_vm_get_sourceline(rb_control_frame_t *);
 | 
			
		||||
 | 
			
		||||
	    pc = cfp->pc - cfp->iseq->iseq_encoded;
 | 
			
		||||
	    iseq_name = RSTRING_PTR(cfp->iseq->name);
 | 
			
		||||
	    line = vm_get_sourceline(cfp);
 | 
			
		||||
	    line = rb_vm_get_sourceline(cfp);
 | 
			
		||||
	    if (line) {
 | 
			
		||||
		snprintf(posbuf, MAX_POSBUF, "%s:%d", RSTRING_PTR(cfp->iseq->filename), line);
 | 
			
		||||
	    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -735,7 +735,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
 | 
			
		|||
	/* save new env */
 | 
			
		||||
	GetISeqPtr(iseqval, iseq);
 | 
			
		||||
	if (bind && iseq->local_size > 0) {
 | 
			
		||||
	    bind->env = vm_make_env_object(th, th->cfp);
 | 
			
		||||
	    bind->env = rb_vm_make_env_object(th, th->cfp);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* kick */
 | 
			
		||||
| 
						 | 
				
			
			@ -899,7 +899,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int level)
 | 
			
		|||
    POP_TAG();
 | 
			
		||||
 | 
			
		||||
    rb_set_safe_level_force(safe);
 | 
			
		||||
    if (state) vm_jump_tag_but_local_jump(state, val);
 | 
			
		||||
    if (state) rb_vm_jump_tag_but_local_jump(state, val);
 | 
			
		||||
    return val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -113,7 +113,7 @@ vm_exec_core(rb_thread_t *th, VALUE initial)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
const void **
 | 
			
		||||
vm_get_insns_address_table(void)
 | 
			
		||||
rb_vm_get_insns_address_table(void)
 | 
			
		||||
{
 | 
			
		||||
    return (const void **)vm_exec_core(0, 0);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -124,7 +124,7 @@ vm_get_insns_address_table(void)
 | 
			
		|||
#include "vmtc.inc"
 | 
			
		||||
 | 
			
		||||
const void *const *
 | 
			
		||||
vm_get_insns_address_table(void)
 | 
			
		||||
rb_vm_get_insns_address_table(void)
 | 
			
		||||
{
 | 
			
		||||
    return insns_address_table;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -185,7 +185,7 @@ vm_callee_setup_arg_complex(rb_thread_t *th, const rb_iseq_t * iseq,
 | 
			
		|||
	    /* make Proc object */
 | 
			
		||||
	    if (blockptr->proc == 0) {
 | 
			
		||||
		rb_proc_t *proc;
 | 
			
		||||
		blockval = vm_make_proc(th, blockptr, rb_cProc);
 | 
			
		||||
		blockval = rb_vm_make_proc(th, blockptr, rb_cProc);
 | 
			
		||||
		GetProcPtr(blockval, proc);
 | 
			
		||||
		*block = &proc->block;
 | 
			
		||||
	    }
 | 
			
		||||
| 
						 | 
				
			
			@ -397,7 +397,7 @@ vm_call_bmethod(rb_thread_t *th, ID id, VALUE procval, VALUE recv,
 | 
			
		|||
    (cfp-2)->method_class = klass;
 | 
			
		||||
 | 
			
		||||
    GetProcPtr(procval, proc);
 | 
			
		||||
    val = vm_invoke_proc(th, proc, recv, argc, argv, blockptr);
 | 
			
		||||
    val = rb_vm_invoke_proc(th, proc, recv, argc, argv, blockptr);
 | 
			
		||||
    return val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -665,7 +665,7 @@ vm_yield_with_cfunc(rb_thread_t *th, const rb_block_t *block,
 | 
			
		|||
	    blockarg = blockargptr->proc;
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
	    blockarg = vm_make_proc(th, blockargptr, rb_cProc);
 | 
			
		||||
	    blockarg = rb_vm_make_proc(th, blockargptr, rb_cProc);
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
| 
						 | 
				
			
			@ -861,7 +861,7 @@ vm_invoke_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_num_t num, rb_n
 | 
			
		|||
    int argc = num;
 | 
			
		||||
 | 
			
		||||
    if (GET_ISEQ()->local_iseq->type != ISEQ_TYPE_METHOD || block == 0) {
 | 
			
		||||
	vm_localjump_error("no block given (yield)", Qnil, 0);
 | 
			
		||||
	rb_vm_localjump_error("no block given (yield)", Qnil, 0);
 | 
			
		||||
    }
 | 
			
		||||
    iseq = block->iseq;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1313,7 +1313,7 @@ vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp,
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		if (is_orphan) {
 | 
			
		||||
		    vm_localjump_error("break from proc-closure", throwobj, TAG_BREAK);
 | 
			
		||||
		    rb_vm_localjump_error("break from proc-closure", throwobj, TAG_BREAK);
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
	    else if (state == TAG_RETRY) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1352,7 +1352,7 @@ vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp,
 | 
			
		|||
		    cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		vm_localjump_error("unexpected return", throwobj, TAG_RETURN);
 | 
			
		||||
		rb_vm_localjump_error("unexpected return", throwobj, TAG_RETURN);
 | 
			
		||||
 | 
			
		||||
	      valid_return:
 | 
			
		||||
		pt = dfp;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue