mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	use getblockparamproxy to pass blocks.
				
					
				
			* compile.c (setup_args): use `getblockparamproxy` (`rb_block_param_proxy`) to represent a block parameter passing. * vm_args.c (vm_caller_setup_arg_block): check `rb_block_param_proxy` instead of using `VM_CALL_ARGS_BLOCKARG_BLOCKPARAM` call flag. * vm_core.h (VM_CALL_ARGS_BLOCKARG_BLOCKPARAM): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									b4960648bf
								
							
						
					
					
						commit
						8a83cd100b
					
				
					 4 changed files with 5 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -4514,8 +4514,7 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn,
 | 
			
		|||
	    if (elem->type == ISEQ_ELEMENT_INSN) {
 | 
			
		||||
		INSN *iobj = (INSN *)elem;
 | 
			
		||||
		if (iobj->insn_id == BIN(getblockparam)) {
 | 
			
		||||
		    iobj->insn_id = BIN(getlocal);
 | 
			
		||||
		    *flag |= VM_CALL_ARGS_BLOCKARG_BLOCKPARAM;
 | 
			
		||||
		    iobj->insn_id = BIN(getblockparamproxy);
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								iseq.c
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								iseq.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1558,7 +1558,6 @@ rb_insn_operand_intern(const rb_iseq_t *iseq,
 | 
			
		|||
# define CALL_FLAG(n) if (ci->flag & VM_CALL_##n) rb_ary_push(flags, rb_str_new2(#n))
 | 
			
		||||
		CALL_FLAG(ARGS_SPLAT);
 | 
			
		||||
		CALL_FLAG(ARGS_BLOCKARG);
 | 
			
		||||
		CALL_FLAG(ARGS_BLOCKARG_BLOCKPARAM);
 | 
			
		||||
		CALL_FLAG(FCALL);
 | 
			
		||||
		CALL_FLAG(VCALL);
 | 
			
		||||
		CALL_FLAG(ARGS_SIMPLE);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -835,13 +835,12 @@ vm_caller_setup_arg_block(const rb_execution_context_t *ec, rb_control_frame_t *
 | 
			
		|||
    if (ci->flag & VM_CALL_ARGS_BLOCKARG) {
 | 
			
		||||
	VALUE block_code = *(--reg_cfp->sp);
 | 
			
		||||
 | 
			
		||||
	if ((ci->flag & VM_CALL_ARGS_BLOCKARG_BLOCKPARAM) &&
 | 
			
		||||
	    !VM_ENV_FLAGS(VM_CF_LEP(reg_cfp), VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM)) {
 | 
			
		||||
	    calling->block_handler = VM_CF_BLOCK_HANDLER(reg_cfp);
 | 
			
		||||
	}
 | 
			
		||||
	else if (NIL_P(block_code)) {
 | 
			
		||||
	if (NIL_P(block_code)) {
 | 
			
		||||
	    calling->block_handler = VM_BLOCK_HANDLER_NONE;
 | 
			
		||||
	}
 | 
			
		||||
	else if (block_code == rb_block_param_proxy) {
 | 
			
		||||
	    calling->block_handler = VM_CF_BLOCK_HANDLER(reg_cfp);
 | 
			
		||||
	}
 | 
			
		||||
	else if (SYMBOL_P(block_code) && rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) {
 | 
			
		||||
	    const rb_cref_t *cref = vm_env_cref(reg_cfp->ep);
 | 
			
		||||
	    if (cref && !NIL_P(cref->refinements)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -952,7 +952,6 @@ enum vm_check_match_type {
 | 
			
		|||
enum vm_call_flag_bits {
 | 
			
		||||
    VM_CALL_ARGS_SPLAT_bit,     /* m(*args) */
 | 
			
		||||
    VM_CALL_ARGS_BLOCKARG_bit,  /* m(&block) */
 | 
			
		||||
    VM_CALL_ARGS_BLOCKARG_BLOCKPARAM_bit,  /* m(&block) and block is a passed block parameter */
 | 
			
		||||
    VM_CALL_FCALL_bit,          /* m(...) */
 | 
			
		||||
    VM_CALL_VCALL_bit,          /* m */
 | 
			
		||||
    VM_CALL_ARGS_SIMPLE_bit,    /* (ci->flag & (SPLAT|BLOCKARG)) && blockiseq == NULL && ci->kw_arg == NULL */
 | 
			
		||||
| 
						 | 
				
			
			@ -967,7 +966,6 @@ enum vm_call_flag_bits {
 | 
			
		|||
 | 
			
		||||
#define VM_CALL_ARGS_SPLAT      (0x01 << VM_CALL_ARGS_SPLAT_bit)
 | 
			
		||||
#define VM_CALL_ARGS_BLOCKARG   (0x01 << VM_CALL_ARGS_BLOCKARG_bit)
 | 
			
		||||
#define VM_CALL_ARGS_BLOCKARG_BLOCKPARAM (0x01 << VM_CALL_ARGS_BLOCKARG_BLOCKPARAM_bit)
 | 
			
		||||
#define VM_CALL_FCALL           (0x01 << VM_CALL_FCALL_bit)
 | 
			
		||||
#define VM_CALL_VCALL           (0x01 << VM_CALL_VCALL_bit)
 | 
			
		||||
#define VM_CALL_ARGS_SIMPLE     (0x01 << VM_CALL_ARGS_SIMPLE_bit)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue