зеркало из https://github.com/github/ruby.git
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:
Родитель
a399badeeb
Коммит
e47a687c83
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 *
|
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)) {
|
if (VM_FRAME_RUBYFRAME_P(cfp)) {
|
||||||
return (rb_control_frame_t *)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);
|
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)) {
|
if (VM_FRAME_RUBYFRAME_P(cfp)) {
|
||||||
return (rb_control_frame_t *)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
|
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)) {
|
if (VM_ENV_ESCAPED_P(ep)) {
|
||||||
collect_local_variables_in_env(VM_ENV_ENVVAL_PTR(ep), vars);
|
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 inline VALUE vm_yield_force_blockarg(rb_thread_t *th, VALUE args);
|
||||||
static VALUE vm_exec(rb_thread_t *th);
|
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 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 VALUE rb_eUncaughtThrow;
|
||||||
static ID id_result, id_tag, id_value;
|
static ID id_result, id_tag, id_value;
|
||||||
|
@ -2079,9 +2079,8 @@ static VALUE
|
||||||
rb_f_local_variables(void)
|
rb_f_local_variables(void)
|
||||||
{
|
{
|
||||||
struct local_var_list vars;
|
struct local_var_list vars;
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_execution_context_t *ec = GET_EC();
|
||||||
rb_control_frame_t *cfp =
|
rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(ec, RUBY_VM_PREVIOUS_CONTROL_FRAME(ec->cfp));
|
||||||
vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(th->ec->cfp));
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
local_var_list_init(&vars);
|
local_var_list_init(&vars);
|
||||||
|
@ -2095,7 +2094,7 @@ rb_f_local_variables(void)
|
||||||
/* block */
|
/* block */
|
||||||
const VALUE *ep = VM_CF_PREV_EP(cfp);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2136,9 +2135,9 @@ rb_f_local_variables(void)
|
||||||
VALUE
|
VALUE
|
||||||
rb_f_block_given_p(void)
|
rb_f_block_given_p(void)
|
||||||
{
|
{
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_execution_context_t *ec = GET_EC();
|
||||||
rb_control_frame_t *cfp = th->ec->cfp;
|
rb_control_frame_t *cfp = ec->cfp;
|
||||||
cfp = vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(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) {
|
if (cfp != NULL && VM_CF_BLOCK_HANDLER(cfp) != VM_BLOCK_HANDLER_NONE) {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
|
@ -2151,9 +2150,9 @@ rb_f_block_given_p(void)
|
||||||
VALUE
|
VALUE
|
||||||
rb_current_realfilepath(void)
|
rb_current_realfilepath(void)
|
||||||
{
|
{
|
||||||
rb_thread_t *th = GET_THREAD();
|
const rb_execution_context_t *ec = GET_EC();
|
||||||
rb_control_frame_t *cfp = th->ec->cfp;
|
rb_control_frame_t *cfp = ec->cfp;
|
||||||
cfp = vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
|
cfp = vm_get_ruby_level_caller_cfp(ec, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
|
||||||
if (cfp != 0) return rb_iseq_realpath(cfp->iseq);
|
if (cfp != 0) return rb_iseq_realpath(cfp->iseq);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
/* control stack frame */
|
/* 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
|
VALUE
|
||||||
ruby_vm_special_exception_copy(VALUE exc)
|
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);
|
prev_cref = vm_env_cref(ep);
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
if (cfp) {
|
||||||
prev_cref = vm_env_cref(cfp->ep);
|
prev_cref = vm_env_cref(cfp->ep);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче