mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* vm_exec.c, insns.def (leave): solve problems on
OPT_CALL_THREADED_CODE. Catch up finish frame structure on OPT_CALL_THREADED_CODE. * vm_core.h: add rb_thread_t#retval for temporary space on OPT_CALL_THREADED_CODE. * vm.c (th_init): clear rb_thread_t#retval as Qundef. * vm_dump.c (rb_vmdebug_debug_print_pre): fix debug print format. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									fca3c408a7
								
							
						
					
					
						commit
						0d1a905edb
					
				
					 6 changed files with 43 additions and 19 deletions
				
			
		
							
								
								
									
										13
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								ChangeLog
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,16 @@
 | 
			
		|||
Tue Aug 07 20:12:39 2012  Koichi Sasada  <ko1@atdot.net>
 | 
			
		||||
 | 
			
		||||
	* vm_exec.c, insns.def (leave): solve problems on
 | 
			
		||||
	  OPT_CALL_THREADED_CODE.
 | 
			
		||||
	  Catch up finish frame structure on OPT_CALL_THREADED_CODE.
 | 
			
		||||
 | 
			
		||||
	* vm_core.h: add rb_thread_t#retval for temporary space on
 | 
			
		||||
	  OPT_CALL_THREADED_CODE.
 | 
			
		||||
 | 
			
		||||
	* vm.c (th_init): clear rb_thread_t#retval as Qundef.
 | 
			
		||||
 | 
			
		||||
	* vm_dump.c (rb_vmdebug_debug_print_pre): fix debug print format.
 | 
			
		||||
 | 
			
		||||
Tue Aug  7 11:58:27 2012  NAKAMURA Usaku  <usa@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* test/ruby/test_require.rb (TestRequire#test_require_twice): added.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1116,10 +1116,12 @@ leave
 | 
			
		|||
    RUBY_VM_CHECK_INTS(th);
 | 
			
		||||
 | 
			
		||||
    if (UNLIKELY(VM_FRAME_TYPE_FINISH_P(GET_CFP()))) {
 | 
			
		||||
#if OPT_CALL_THREADED_CODE
 | 
			
		||||
	rb_bug("unused instruction on OPT_CALL_THREADED_CODE");
 | 
			
		||||
#else
 | 
			
		||||
	vm_pop_frame(th);
 | 
			
		||||
 | 
			
		||||
#if OPT_CALL_THREADED_CODE
 | 
			
		||||
	th->retval = val;
 | 
			
		||||
	return 0;
 | 
			
		||||
#else
 | 
			
		||||
	return val;
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								vm.c
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								vm.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1796,6 +1796,10 @@ th_init(rb_thread_t *th, VALUE self)
 | 
			
		|||
    th->errinfo = Qnil;
 | 
			
		||||
    th->last_status = Qnil;
 | 
			
		||||
    th->waiting_fd = -1;
 | 
			
		||||
 | 
			
		||||
#if OPT_CALL_THREADED_CODE
 | 
			
		||||
    th->retval = Qundef;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -454,6 +454,11 @@ typedef struct rb_thread_struct {
 | 
			
		|||
    /* temporary place of errinfo */
 | 
			
		||||
    VALUE errinfo;
 | 
			
		||||
 | 
			
		||||
    /* temporary place of retval on OPT_CALL_THREADED_CODE */
 | 
			
		||||
#if OPT_CALL_THREADED_CODE
 | 
			
		||||
    VALUE retval;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    /* async errinfo queue */
 | 
			
		||||
    VALUE async_errinfo_queue;
 | 
			
		||||
    int async_errinfo_queue_checked;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -345,7 +345,7 @@ rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp)
 | 
			
		|||
{
 | 
			
		||||
    rb_iseq_t *iseq = cfp->iseq;
 | 
			
		||||
 | 
			
		||||
    if (iseq != 0 && !VM_FRAME_TYPE_FINISH_P(cfp)) {
 | 
			
		||||
    if (iseq != 0) {
 | 
			
		||||
	VALUE *seq = iseq->iseq;
 | 
			
		||||
	ptrdiff_t pc = cfp->pc - iseq->iseq_encoded;
 | 
			
		||||
	int i;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										30
									
								
								vm_exec.c
									
										
									
									
									
								
							
							
						
						
									
										30
									
								
								vm_exec.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -105,39 +105,39 @@ rb_vm_get_insns_address_table(void)
 | 
			
		|||
    return (const void **)vm_exec_core(0, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
#else /* OPT_CALL_THREADED_CODE */
 | 
			
		||||
 | 
			
		||||
#include "vm.inc"
 | 
			
		||||
#include "vmtc.inc"
 | 
			
		||||
 | 
			
		||||
const void *const *
 | 
			
		||||
const void **
 | 
			
		||||
rb_vm_get_insns_address_table(void)
 | 
			
		||||
{
 | 
			
		||||
    return insns_address_table;
 | 
			
		||||
    return (const void **)insns_address_table;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
vm_exec_core(rb_thread_t *th, VALUE initial)
 | 
			
		||||
{
 | 
			
		||||
    register rb_control_frame_t *reg_cfp = th->cfp;
 | 
			
		||||
    VALUE ret;
 | 
			
		||||
 | 
			
		||||
    while (*GET_PC()) {
 | 
			
		||||
    while (1) {
 | 
			
		||||
	reg_cfp = ((rb_insn_func_t) (*GET_PC()))(th, reg_cfp);
 | 
			
		||||
 | 
			
		||||
	if (reg_cfp == 0) {
 | 
			
		||||
	    VALUE err = th->errinfo;
 | 
			
		||||
	    th->errinfo = Qnil;
 | 
			
		||||
	    return err;
 | 
			
		||||
	if (UNLIKELY(reg_cfp == 0)) {
 | 
			
		||||
	    break;
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (VM_FRAME_TYPE_FINISH_P(th->cfp)) {
 | 
			
		||||
	rb_bug("cfp consistency error");
 | 
			
		||||
    if (th->retval != Qundef) {
 | 
			
		||||
	VALUE ret = th->retval;
 | 
			
		||||
	th->retval = Qundef;
 | 
			
		||||
	return ret;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
	VALUE err = th->errinfo;
 | 
			
		||||
	th->errinfo = Qnil;
 | 
			
		||||
	return err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ret = *(th->cfp->sp-1); /* pop */
 | 
			
		||||
    th->cfp++; /* pop cf */
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue