зеркало из https://github.com/github/ruby.git
vm_exec_core() accepts `ec` instead of `th`.
* vm_exec.c (vm_exec_core): accepts `ec` instead of `th`. * vm_args.c (vm_caller_setup_arg_block): also accepts `ec`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
88910e94a8
Коммит
04dc3a0ca6
58
insns.def
58
insns.def
|
@ -95,7 +95,7 @@ getblockparam
|
|||
VM_ASSERT(VM_ENV_LOCAL_P(ep));
|
||||
|
||||
if (!VM_ENV_FLAGS(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM)) {
|
||||
val = rb_vm_bh_to_procval(th->ec, VM_ENV_BLOCK_HANDLER(ep));
|
||||
val = rb_vm_bh_to_procval(ec, VM_ENV_BLOCK_HANDLER(ep));
|
||||
vm_env_write(ep, -(int)idx, val);
|
||||
VM_ENV_FLAGS_SET(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ getspecial
|
|||
()
|
||||
(VALUE val)
|
||||
{
|
||||
val = vm_getspecial(th->ec, GET_LEP(), key, type);
|
||||
val = vm_getspecial(ec, GET_LEP(), key, type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -152,7 +152,7 @@ setspecial
|
|||
(VALUE obj)
|
||||
()
|
||||
{
|
||||
lep_svar_set(th->ec, GET_LEP(), key, obj);
|
||||
lep_svar_set(ec, GET_LEP(), key, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -230,7 +230,7 @@ getconstant
|
|||
(VALUE klass)
|
||||
(VALUE val)
|
||||
{
|
||||
val = vm_get_ev_const(th->ec, klass, id, 0);
|
||||
val = vm_get_ev_const(ec, klass, id, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -740,7 +740,7 @@ defined
|
|||
(VALUE v)
|
||||
(VALUE val)
|
||||
{
|
||||
val = vm_defined(th->ec, GET_CFP(), op_type, obj, needstr, v);
|
||||
val = vm_defined(ec, GET_CFP(), op_type, obj, needstr, v);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -789,8 +789,8 @@ trace
|
|||
{
|
||||
rb_event_flag_t flag = (rb_event_flag_t)nf;
|
||||
|
||||
vm_dtrace(flag, th);
|
||||
EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0, 0 /* id and klass are resolved at callee */,
|
||||
vm_dtrace(flag, rb_ec_thread_ptr(ec));
|
||||
EXEC_EVENT_HOOK(rb_ec_thread_ptr(ec), flag, GET_SELF(), 0, 0, 0 /* id and klass are resolved at callee */,
|
||||
(flag & (RUBY_EVENT_RETURN | RUBY_EVENT_B_RETURN)) ? TOPN(0) : Qundef);
|
||||
}
|
||||
|
||||
|
@ -807,8 +807,8 @@ trace2
|
|||
{
|
||||
rb_event_flag_t flag = (rb_event_flag_t)nf;
|
||||
|
||||
vm_dtrace(flag, th);
|
||||
EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0, 0 /* id and klass are resolved at callee */, data);
|
||||
vm_dtrace(flag, rb_ec_thread_ptr(ec));
|
||||
EXEC_EVENT_HOOK(rb_ec_thread_ptr(ec), flag, GET_SELF(), 0, 0, 0 /* id and klass are resolved at callee */, data);
|
||||
}
|
||||
|
||||
/**********************************************************/
|
||||
|
@ -835,9 +835,9 @@ defineclass
|
|||
rb_iseq_check(class_iseq);
|
||||
|
||||
/* enter scope */
|
||||
vm_push_frame(th->ec, class_iseq, VM_FRAME_MAGIC_CLASS | VM_ENV_FLAG_LOCAL, klass,
|
||||
vm_push_frame(ec, class_iseq, VM_FRAME_MAGIC_CLASS | VM_ENV_FLAG_LOCAL, klass,
|
||||
GET_BLOCK_HANDLER(),
|
||||
(VALUE)vm_cref_push(th->ec, klass, NULL, FALSE),
|
||||
(VALUE)vm_cref_push(ec, klass, NULL, FALSE),
|
||||
class_iseq->body->iseq_encoded, GET_SP(),
|
||||
class_iseq->body->local_table_size,
|
||||
class_iseq->body->stack_max);
|
||||
|
@ -863,7 +863,7 @@ send
|
|||
{
|
||||
struct rb_calling_info calling;
|
||||
|
||||
vm_caller_setup_arg_block(th, reg_cfp, &calling, ci, blockiseq, FALSE);
|
||||
vm_caller_setup_arg_block(ec, reg_cfp, &calling, ci, blockiseq, FALSE);
|
||||
vm_search_method(ci, cc, calling.recv = TOPN(calling.argc = ci->orig_argc));
|
||||
CALL_METHOD(&calling, ci, cc);
|
||||
}
|
||||
|
@ -947,9 +947,9 @@ invokesuper
|
|||
struct rb_calling_info calling;
|
||||
calling.argc = ci->orig_argc;
|
||||
|
||||
vm_caller_setup_arg_block(th, reg_cfp, &calling, ci, blockiseq, TRUE);
|
||||
vm_caller_setup_arg_block(ec, reg_cfp, &calling, ci, blockiseq, TRUE);
|
||||
calling.recv = GET_SELF();
|
||||
vm_search_super_method(th->ec, GET_CFP(), &calling, ci, cc);
|
||||
vm_search_super_method(ec, GET_CFP(), &calling, ci, cc);
|
||||
CALL_METHOD(&calling, ci, cc);
|
||||
}
|
||||
|
||||
|
@ -969,7 +969,7 @@ invokeblock
|
|||
calling.block_handler = VM_BLOCK_HANDLER_NONE;
|
||||
calling.recv = GET_SELF();
|
||||
|
||||
val = vm_invoke_block(th->ec, GET_CFP(), &calling, ci);
|
||||
val = vm_invoke_block(ec, GET_CFP(), &calling, ci);
|
||||
if (val == Qundef) {
|
||||
RESTORE_REGS();
|
||||
NEXT_INSN();
|
||||
|
@ -990,13 +990,13 @@ leave
|
|||
if (OPT_CHECKED_RUN) {
|
||||
const VALUE *const bp = vm_base_ptr(reg_cfp);
|
||||
if (reg_cfp->sp != bp) {
|
||||
vm_stack_consistency_error(th->ec, reg_cfp, bp);
|
||||
vm_stack_consistency_error(ec, reg_cfp, bp);
|
||||
}
|
||||
}
|
||||
|
||||
RUBY_VM_CHECK_INTS(th);
|
||||
RUBY_VM_CHECK_INTS(rb_ec_thread_ptr(ec));
|
||||
|
||||
if (vm_pop_frame(th->ec, GET_CFP(), GET_EP())) {
|
||||
if (vm_pop_frame(ec, GET_CFP(), GET_EP())) {
|
||||
#if OPT_CALL_THREADED_CODE
|
||||
th->retval = val;
|
||||
return 0;
|
||||
|
@ -1024,8 +1024,8 @@ throw
|
|||
(VALUE throwobj)
|
||||
(VALUE val)
|
||||
{
|
||||
RUBY_VM_CHECK_INTS(th);
|
||||
val = vm_throw(th->ec, GET_CFP(), throw_state, throwobj);
|
||||
RUBY_VM_CHECK_INTS(rb_ec_thread_ptr(ec));
|
||||
val = vm_throw(ec, GET_CFP(), throw_state, throwobj);
|
||||
THROW_EXCEPTION(val);
|
||||
/* unreachable */
|
||||
}
|
||||
|
@ -1045,7 +1045,7 @@ jump
|
|||
()
|
||||
()
|
||||
{
|
||||
RUBY_VM_CHECK_INTS(th);
|
||||
RUBY_VM_CHECK_INTS(rb_ec_thread_ptr(ec));
|
||||
JUMP(dst);
|
||||
}
|
||||
|
||||
|
@ -1061,7 +1061,7 @@ branchif
|
|||
()
|
||||
{
|
||||
if (RTEST(val)) {
|
||||
RUBY_VM_CHECK_INTS(th);
|
||||
RUBY_VM_CHECK_INTS(rb_ec_thread_ptr(ec));
|
||||
JUMP(dst);
|
||||
}
|
||||
}
|
||||
|
@ -1078,7 +1078,7 @@ branchunless
|
|||
()
|
||||
{
|
||||
if (!RTEST(val)) {
|
||||
RUBY_VM_CHECK_INTS(th);
|
||||
RUBY_VM_CHECK_INTS(rb_ec_thread_ptr(ec));
|
||||
JUMP(dst);
|
||||
}
|
||||
}
|
||||
|
@ -1095,7 +1095,7 @@ branchnil
|
|||
()
|
||||
{
|
||||
if (NIL_P(val)) {
|
||||
RUBY_VM_CHECK_INTS(th);
|
||||
RUBY_VM_CHECK_INTS(rb_ec_thread_ptr(ec));
|
||||
JUMP(dst);
|
||||
}
|
||||
}
|
||||
|
@ -1112,7 +1112,7 @@ branchiftype
|
|||
()
|
||||
{
|
||||
if (TYPE(val) == (int)type) {
|
||||
RUBY_VM_CHECK_INTS(th);
|
||||
RUBY_VM_CHECK_INTS(rb_ec_thread_ptr(ec));
|
||||
JUMP(dst);
|
||||
}
|
||||
}
|
||||
|
@ -1164,7 +1164,7 @@ once
|
|||
()
|
||||
(VALUE val)
|
||||
{
|
||||
val = vm_once_dispatch(iseq, ic, th);
|
||||
val = vm_once_dispatch(iseq, ic, rb_ec_thread_ptr(ec));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1675,11 +1675,11 @@ opt_call_c_function
|
|||
()
|
||||
()
|
||||
{
|
||||
reg_cfp = (funcptr)(th, reg_cfp);
|
||||
reg_cfp = (funcptr)(rb_ec_thread_ptr(ec), reg_cfp);
|
||||
|
||||
if (reg_cfp == 0) {
|
||||
VALUE err = th->ec->errinfo;
|
||||
th->ec->errinfo = Qnil;
|
||||
VALUE err = ec->errinfo;
|
||||
ec->errinfo = Qnil;
|
||||
THROW_EXCEPTION(err);
|
||||
}
|
||||
|
||||
|
|
2
vm.c
2
vm.c
|
@ -1794,7 +1794,7 @@ vm_exec(rb_thread_t *th)
|
|||
_tag.retval = Qnil;
|
||||
if ((state = EXEC_TAG()) == TAG_NONE) {
|
||||
vm_loop_start:
|
||||
result = vm_exec_core(th, initial);
|
||||
result = vm_exec_core(th->ec, initial);
|
||||
VM_ASSERT(th->ec->tag == &_tag);
|
||||
if ((state = _tag.state) != TAG_NONE) {
|
||||
err = (struct vm_throw_data *)result;
|
||||
|
|
|
@ -825,7 +825,7 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
|
|||
}
|
||||
|
||||
static void
|
||||
vm_caller_setup_arg_block(const rb_thread_t *th, rb_control_frame_t *reg_cfp,
|
||||
vm_caller_setup_arg_block(const rb_execution_context_t *th, rb_control_frame_t *reg_cfp,
|
||||
struct rb_calling_info *calling, const struct rb_call_info *ci, rb_iseq_t *blockiseq, const int is_super)
|
||||
{
|
||||
if (ci->flag & VM_CALL_ARGS_BLOCKARG) {
|
||||
|
|
22
vm_exec.c
22
vm_exec.c
|
@ -45,7 +45,7 @@ vm_stack_overflow_for_insn(void)
|
|||
|
||||
#if !OPT_CALL_THREADED_CODE
|
||||
static VALUE
|
||||
vm_exec_core(rb_thread_t *th, VALUE initial)
|
||||
vm_exec_core(rb_execution_context_t *ec, VALUE initial)
|
||||
{
|
||||
|
||||
#if OPT_STACK_CACHING
|
||||
|
@ -84,7 +84,7 @@ vm_exec_core(rb_thread_t *th, VALUE initial)
|
|||
#undef RESTORE_REGS
|
||||
#define RESTORE_REGS() \
|
||||
{ \
|
||||
VM_REG_CFP = th->ec->cfp; \
|
||||
VM_REG_CFP = ec->cfp; \
|
||||
reg_pc = reg_cfp->pc; \
|
||||
}
|
||||
|
||||
|
@ -98,11 +98,11 @@ vm_exec_core(rb_thread_t *th, VALUE initial)
|
|||
|
||||
#if OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE
|
||||
#include "vmtc.inc"
|
||||
if (UNLIKELY(th == 0)) {
|
||||
if (UNLIKELY(ec == 0)) {
|
||||
return (VALUE)insns_address_table;
|
||||
}
|
||||
#endif
|
||||
reg_cfp = th->ec->cfp;
|
||||
reg_cfp = ec->cfp;
|
||||
reg_pc = reg_cfp->pc;
|
||||
|
||||
#if OPT_STACK_CACHING
|
||||
|
@ -140,26 +140,26 @@ rb_vm_get_insns_address_table(void)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
vm_exec_core(rb_thread_t *th, VALUE initial)
|
||||
vm_exec_core(rb_execution_cntext_t *ec, VALUE initial)
|
||||
{
|
||||
register rb_control_frame_t *reg_cfp = th->ec->cfp;
|
||||
register rb_control_frame_t *reg_cfp = ec->cfp;
|
||||
|
||||
while (1) {
|
||||
reg_cfp = ((rb_insn_func_t) (*GET_PC()))(th, reg_cfp);
|
||||
reg_cfp = ((rb_insn_func_t) (*GET_PC()))(ec, reg_cfp);
|
||||
|
||||
if (UNLIKELY(reg_cfp == 0)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (th->retval != Qundef) {
|
||||
if (rb_ec_thread_ptr(ec)->retval != Qundef) {
|
||||
VALUE ret = th->retval;
|
||||
th->retval = Qundef;
|
||||
rb_ec_thread_ptr(ec)->retval = Qundef;
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
VALUE err = th->ec->errinfo;
|
||||
th->ec->errinfo = Qnil;
|
||||
VALUE err = ec->errinfo;
|
||||
ec->errinfo = Qnil;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ RUBY_SYMBOL_EXPORT_END
|
|||
#define VM_REG_EP (VM_REG_CFP->ep)
|
||||
|
||||
#define RESTORE_REGS() do { \
|
||||
VM_REG_CFP = th->ec->cfp; \
|
||||
VM_REG_CFP = ec->cfp; \
|
||||
} while (0)
|
||||
|
||||
#define REG_A reg_a
|
||||
|
@ -129,7 +129,7 @@ enum vm_regan_acttype {
|
|||
/**********************************************************/
|
||||
|
||||
#define CALL_METHOD(calling, ci, cc) do { \
|
||||
VALUE v = (*(cc)->call)(th->ec, GET_CFP(), (calling), (ci), (cc)); \
|
||||
VALUE v = (*(cc)->call)(ec, GET_CFP(), (calling), (ci), (cc)); \
|
||||
if (v == Qundef) { \
|
||||
RESTORE_REGS(); \
|
||||
NEXT_INSN(); \
|
||||
|
|
Загрузка…
Ссылка в новой задаче