mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_get_ruby_level_caller_cfp() accepts ec
instead of th
.
* vm.c (vm_get_ruby_level_caller_cfp): accepts `ec` instead of `th`. * vm.c (vm_collect_local_variables_in_heap): don't need `th` anymore. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a399badeeb
commit
e47a687c83
3 changed files with 15 additions and 16 deletions
6
vm.c
6
vm.c
|
@ -510,7 +510,7 @@ rb_vm_get_ruby_level_next_cfp(const rb_execution_context_t *ec, const rb_control
|
|||
}
|
||||
|
||||
static rb_control_frame_t *
|
||||
vm_get_ruby_level_caller_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp)
|
||||
vm_get_ruby_level_caller_cfp(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
|
||||
{
|
||||
if (VM_FRAME_RUBYFRAME_P(cfp)) {
|
||||
return (rb_control_frame_t *)cfp;
|
||||
|
@ -518,7 +518,7 @@ vm_get_ruby_level_caller_cfp(const rb_thread_t *th, const rb_control_frame_t *cf
|
|||
|
||||
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
||||
|
||||
while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th->ec, cfp)) {
|
||||
while (!RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(ec, cfp)) {
|
||||
if (VM_FRAME_RUBYFRAME_P(cfp)) {
|
||||
return (rb_control_frame_t *)cfp;
|
||||
}
|
||||
|
@ -773,7 +773,7 @@ collect_local_variables_in_env(const rb_env_t *env, const struct local_var_list
|
|||
}
|
||||
|
||||
static int
|
||||
vm_collect_local_variables_in_heap(rb_thread_t *th, const VALUE *ep, const struct local_var_list *vars)
|
||||
vm_collect_local_variables_in_heap(const VALUE *ep, const struct local_var_list *vars)
|
||||
{
|
||||
if (VM_ENV_ESCAPED_P(ep)) {
|
||||
collect_local_variables_in_env(VM_ENV_ENVVAL_PTR(ep), vars);
|
||||
|
|
21
vm_eval.c
21
vm_eval.c
|
@ -22,7 +22,7 @@ static inline VALUE vm_yield_with_block(rb_thread_t *th, int argc, const VALUE *
|
|||
static inline VALUE vm_yield_force_blockarg(rb_thread_t *th, VALUE args);
|
||||
static VALUE vm_exec(rb_thread_t *th);
|
||||
static void vm_set_eval_stack(rb_thread_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(rb_thread_t *th, const VALUE *dfp, const struct local_var_list *vars);
|
||||
static int vm_collect_local_variables_in_heap(const VALUE *dfp, const struct local_var_list *vars);
|
||||
|
||||
static VALUE rb_eUncaughtThrow;
|
||||
static ID id_result, id_tag, id_value;
|
||||
|
@ -2079,9 +2079,8 @@ static VALUE
|
|||
rb_f_local_variables(void)
|
||||
{
|
||||
struct local_var_list vars;
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
rb_control_frame_t *cfp =
|
||||
vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->ec->cfp));
|
||||
rb_execution_context_t *ec = GET_EC();
|
||||
rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(ec, RUBY_VM_PREVIOUS_CONTROL_FRAME(ec->cfp));
|
||||
unsigned int i;
|
||||
|
||||
local_var_list_init(&vars);
|
||||
|
@ -2095,7 +2094,7 @@ rb_f_local_variables(void)
|
|||
/* block */
|
||||
const VALUE *ep = VM_CF_PREV_EP(cfp);
|
||||
|
||||
if (vm_collect_local_variables_in_heap(th, ep, &vars)) {
|
||||
if (vm_collect_local_variables_in_heap(ep, &vars)) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
@ -2136,9 +2135,9 @@ rb_f_local_variables(void)
|
|||
VALUE
|
||||
rb_f_block_given_p(void)
|
||||
{
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
rb_control_frame_t *cfp = th->ec->cfp;
|
||||
cfp = vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
|
||||
rb_execution_context_t *ec = GET_EC();
|
||||
rb_control_frame_t *cfp = ec->cfp;
|
||||
cfp = vm_get_ruby_level_caller_cfp(ec, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
|
||||
|
||||
if (cfp != NULL && VM_CF_BLOCK_HANDLER(cfp) != VM_BLOCK_HANDLER_NONE) {
|
||||
return Qtrue;
|
||||
|
@ -2151,9 +2150,9 @@ rb_f_block_given_p(void)
|
|||
VALUE
|
||||
rb_current_realfilepath(void)
|
||||
{
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
rb_control_frame_t *cfp = th->ec->cfp;
|
||||
cfp = vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
|
||||
const rb_execution_context_t *ec = GET_EC();
|
||||
rb_control_frame_t *cfp = ec->cfp;
|
||||
cfp = vm_get_ruby_level_caller_cfp(ec, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
|
||||
if (cfp != 0) return rb_iseq_realpath(cfp->iseq);
|
||||
return Qnil;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
/* control stack frame */
|
||||
|
||||
static rb_control_frame_t *vm_get_ruby_level_caller_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp);
|
||||
static rb_control_frame_t *vm_get_ruby_level_caller_cfp(const rb_execution_context_t *ec, const rb_control_frame_t *cfp);
|
||||
|
||||
VALUE
|
||||
ruby_vm_special_exception_copy(VALUE exc)
|
||||
|
@ -742,7 +742,7 @@ vm_cref_push(rb_thread_t *th, VALUE klass, const VALUE *ep, int pushed_by_eval)
|
|||
prev_cref = vm_env_cref(ep);
|
||||
}
|
||||
else {
|
||||
rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(th, th->ec->cfp);
|
||||
rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(th->ec, th->ec->cfp);
|
||||
|
||||
if (cfp) {
|
||||
prev_cref = vm_env_cref(cfp->ep);
|
||||
|
|
Loading…
Reference in a new issue