mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Prefer stdbool in vm_exec
Make the code a bit modern and consistent with some other places.
This commit is contained in:
		
							parent
							
								
									03f2b09320
								
							
						
					
					
						commit
						692af8e8f8
					
				
					 6 changed files with 15 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -61,7 +61,7 @@ MJIT_STATIC VALUE ruby_vm_special_exception_copy(VALUE);
 | 
			
		|||
PUREFUNC(st_table *rb_vm_fstring_table(void));
 | 
			
		||||
 | 
			
		||||
MJIT_SYMBOL_EXPORT_BEGIN
 | 
			
		||||
VALUE vm_exec(struct rb_execution_context_struct *, int); /* used in JIT-ed code */
 | 
			
		||||
VALUE vm_exec(struct rb_execution_context_struct *, bool); /* used in JIT-ed code */
 | 
			
		||||
MJIT_SYMBOL_EXPORT_END
 | 
			
		||||
 | 
			
		||||
/* vm_eval.c */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -280,7 +280,7 @@ compile_inlined_cancel_handler(FILE *f, const struct rb_iseq_constant_body *body
 | 
			
		|||
    }
 | 
			
		||||
    // We're not just returning Qundef here so that caller's normal cancel handler can
 | 
			
		||||
    // push back `stack` to `cfp->sp`.
 | 
			
		||||
    fprintf(f, "    return vm_exec(ec, FALSE);\n");
 | 
			
		||||
    fprintf(f, "    return vm_exec(ec, false);\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Print the block to cancel JIT execution.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,12 +85,12 @@
 | 
			
		|||
                fprintf(f, "        vm_call_iseq_setup_normal(ec, reg_cfp, &calling, cc_cme, 0, %d, %d);\n", iseq->body->param.size, iseq->body->local_table_size);
 | 
			
		||||
                if (iseq->body->catch_except_p) {
 | 
			
		||||
                    fprintf(f, "        VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n");
 | 
			
		||||
                    fprintf(f, "        val = vm_exec(ec, TRUE);\n");
 | 
			
		||||
                    fprintf(f, "        val = vm_exec(ec, true);\n");
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    fprintf(f, "        if ((val = mjit_exec(ec)) == Qundef) {\n");
 | 
			
		||||
                    fprintf(f, "            VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); // This is vm_call0_body's code after vm_call_iseq_setup
 | 
			
		||||
                    fprintf(f, "            val = vm_exec(ec, FALSE);\n");
 | 
			
		||||
                    fprintf(f, "            val = vm_exec(ec, false);\n");
 | 
			
		||||
                    fprintf(f, "        }\n");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@
 | 
			
		|||
% #   GET_SP(): refers to `reg_cfp->sp`, or `(stack + stack_size)` if local_stack_p
 | 
			
		||||
% #   GET_SELF(): refers to `cfp_self`
 | 
			
		||||
% #   GET_LEP(): refers to `VM_EP_LEP(reg_cfp->ep)`
 | 
			
		||||
% #   EXEC_EC_CFP(): refers to `val = vm_exec(ec, TRUE)` with frame setup
 | 
			
		||||
% #   EXEC_EC_CFP(): refers to `val = vm_exec(ec, true)` with frame setup
 | 
			
		||||
% #   CALL_METHOD(): using `GET_CFP()` and `EXEC_EC_CFP()`
 | 
			
		||||
% #   TOPN(): refers to `reg_cfp->sp`, or `*(stack + (stack_size - num - 1))` if local_stack_p
 | 
			
		||||
% #   STACK_ADDR_FROM_TOP(): refers to `reg_cfp->sp`, or `stack + (stack_size - num)` if local_stack_p
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										12
									
								
								vm.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								vm.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -57,7 +57,7 @@ RUBY_FUNC_EXPORTED
 | 
			
		|||
#else
 | 
			
		||||
MJIT_FUNC_EXPORTED
 | 
			
		||||
#endif
 | 
			
		||||
VALUE vm_exec(rb_execution_context_t *, int);
 | 
			
		||||
VALUE vm_exec(rb_execution_context_t *, bool);
 | 
			
		||||
 | 
			
		||||
PUREFUNC(static inline const VALUE *VM_EP_LEP(const VALUE *));
 | 
			
		||||
static inline const VALUE *
 | 
			
		||||
| 
						 | 
				
			
			@ -1262,7 +1262,7 @@ invoke_block(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE self, cons
 | 
			
		|||
		  ec->cfp->sp + arg_size,
 | 
			
		||||
		  iseq->body->local_table_size - arg_size,
 | 
			
		||||
		  iseq->body->stack_max);
 | 
			
		||||
    return vm_exec(ec, TRUE);
 | 
			
		||||
    return vm_exec(ec, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -1292,7 +1292,7 @@ invoke_bmethod(rb_execution_context_t *ec, const rb_iseq_t *iseq, VALUE self, co
 | 
			
		|||
                                me->def->original_id, me->called_id, me->owner, Qnil, FALSE);
 | 
			
		||||
    }
 | 
			
		||||
    VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);
 | 
			
		||||
    ret = vm_exec(ec, TRUE);
 | 
			
		||||
    ret = vm_exec(ec, true);
 | 
			
		||||
 | 
			
		||||
    EXEC_EVENT_HOOK(ec, RUBY_EVENT_RETURN, self, me->def->original_id, me->called_id, me->owner, ret);
 | 
			
		||||
    if ((hooks = me->def->body.bmethod.hooks) != NULL &&
 | 
			
		||||
| 
						 | 
				
			
			@ -2151,7 +2151,7 @@ vm_exec_handle_exception(rb_execution_context_t *ec, enum ruby_tag_type state,
 | 
			
		|||
                         VALUE errinfo, VALUE *initial);
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
vm_exec(rb_execution_context_t *ec, int mjit_enable_p)
 | 
			
		||||
vm_exec(rb_execution_context_t *ec, bool mjit_enable_p)
 | 
			
		||||
{
 | 
			
		||||
    enum ruby_tag_type state;
 | 
			
		||||
    VALUE result = Qundef;
 | 
			
		||||
| 
						 | 
				
			
			@ -2408,7 +2408,7 @@ rb_iseq_eval(const rb_iseq_t *iseq)
 | 
			
		|||
    rb_execution_context_t *ec = GET_EC();
 | 
			
		||||
    VALUE val;
 | 
			
		||||
    vm_set_top_stack(ec, iseq);
 | 
			
		||||
    val = vm_exec(ec, TRUE);
 | 
			
		||||
    val = vm_exec(ec, true);
 | 
			
		||||
    return val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2419,7 +2419,7 @@ rb_iseq_eval_main(const rb_iseq_t *iseq)
 | 
			
		|||
    VALUE val;
 | 
			
		||||
 | 
			
		||||
    vm_set_main_stack(ec, iseq);
 | 
			
		||||
    val = vm_exec(ec, TRUE);
 | 
			
		||||
    val = vm_exec(ec, true);
 | 
			
		||||
    return val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ static inline VALUE vm_yield_with_cref(rb_execution_context_t *ec, int argc, con
 | 
			
		|||
static inline VALUE vm_yield(rb_execution_context_t *ec, int argc, const VALUE *argv, int kw_splat);
 | 
			
		||||
static inline VALUE vm_yield_with_block(rb_execution_context_t *ec, int argc, const VALUE *argv, VALUE block_handler, int kw_splat);
 | 
			
		||||
static inline VALUE vm_yield_force_blockarg(rb_execution_context_t *ec, VALUE args);
 | 
			
		||||
VALUE vm_exec(rb_execution_context_t *ec, int mjit_enable_p);
 | 
			
		||||
VALUE vm_exec(rb_execution_context_t *ec, bool mjit_enable_p);
 | 
			
		||||
static void vm_set_eval_stack(rb_execution_context_t * th, const rb_iseq_t *iseq, const rb_cref_t *cref, const struct rb_block *base_block);
 | 
			
		||||
static int vm_collect_local_variables_in_heap(const VALUE *dfp, const struct local_var_list *vars);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -137,7 +137,7 @@ vm_call0_body(rb_execution_context_t *ec, struct rb_calling_info *calling, const
 | 
			
		|||
 | 
			
		||||
            vm_call_iseq_setup(ec, reg_cfp, calling);
 | 
			
		||||
	    VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);
 | 
			
		||||
	    return vm_exec(ec, TRUE); /* CHECK_INTS in this function */
 | 
			
		||||
            return vm_exec(ec, true); /* CHECK_INTS in this function */
 | 
			
		||||
	}
 | 
			
		||||
      case VM_METHOD_TYPE_NOTIMPLEMENTED:
 | 
			
		||||
      case VM_METHOD_TYPE_CFUNC:
 | 
			
		||||
| 
						 | 
				
			
			@ -1544,7 +1544,7 @@ eval_string_with_cref(VALUE self, VALUE src, rb_cref_t *cref, VALUE file, int li
 | 
			
		|||
    vm_set_eval_stack(ec, iseq, cref, &block);
 | 
			
		||||
 | 
			
		||||
    /* kick */
 | 
			
		||||
    return vm_exec(ec, TRUE);
 | 
			
		||||
    return vm_exec(ec, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -1565,7 +1565,7 @@ eval_string_with_scope(VALUE scope, VALUE src, VALUE file, int line)
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    /* kick */
 | 
			
		||||
    return vm_exec(ec, TRUE);
 | 
			
		||||
    return vm_exec(ec, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue