mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_core.h: rename macros and make them inline functions.
* rename VM_FRAME_TYPE_FINISH_P() to VM_FRAME_FINISHED_P(). * rename VM_FRAME_TYPE_BMETHOD_P() to VM_FRAME_BMETHOD_P(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1cc78637e3
commit
0cd7f5fe87
6 changed files with 28 additions and 12 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Aug 3 09:25:16 2016 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm_core.h: rename macros and make them inline functions.
|
||||
|
||||
* rename VM_FRAME_TYPE_FINISH_P() to VM_FRAME_FINISHED_P().
|
||||
* rename VM_FRAME_TYPE_BMETHOD_P() to VM_FRAME_BMETHOD_P().
|
||||
|
||||
Wed Aug 03 09:15:02 2016 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm_core.h: introduce VM_FRAME_FLAG_CFRAME to represent cfp->iseq
|
||||
|
|
6
vm.c
6
vm.c
|
@ -1595,7 +1595,7 @@ hook_before_rewind(rb_thread_t *th, rb_control_frame_t *cfp, int will_finish_vm_
|
|||
break;
|
||||
case VM_FRAME_MAGIC_BLOCK:
|
||||
case VM_FRAME_MAGIC_LAMBDA:
|
||||
if (VM_FRAME_TYPE_BMETHOD_P(th->cfp)) {
|
||||
if (VM_FRAME_BMETHOD_P(th->cfp)) {
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_B_RETURN, th->cfp->self, 0, 0, Qnil);
|
||||
|
||||
if (!will_finish_vm_exec) {
|
||||
|
@ -1751,7 +1751,7 @@ vm_exec(rb_thread_t *th)
|
|||
|
||||
if (cfp == escape_cfp) {
|
||||
if (state == TAG_RETURN) {
|
||||
if (!VM_FRAME_TYPE_FINISH_P(cfp)) {
|
||||
if (!VM_FRAME_FINISHED_P(cfp)) {
|
||||
THROW_DATA_CATCH_FRAME_SET(err, cfp + 1);
|
||||
THROW_DATA_STATE_SET(err, state = TAG_BREAK);
|
||||
}
|
||||
|
@ -1916,7 +1916,7 @@ vm_exec(rb_thread_t *th)
|
|||
/* skip frame */
|
||||
hook_before_rewind(th, th->cfp, FALSE);
|
||||
|
||||
if (VM_FRAME_TYPE_FINISH_P(th->cfp)) {
|
||||
if (VM_FRAME_FINISHED_P(th->cfp)) {
|
||||
rb_vm_pop_frame(th);
|
||||
th->errinfo = (VALUE)err;
|
||||
TH_TMPPOP_TAG();
|
||||
|
|
19
vm_core.h
19
vm_core.h
|
@ -986,11 +986,6 @@ enum {
|
|||
VM_ENV_FLAG_WB_REQUIRED = 0x0008
|
||||
};
|
||||
|
||||
static inline void VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value);
|
||||
|
||||
#define VM_FRAME_TYPE_FINISH_P(cfp) (VM_ENV_FLAGS((cfp)->ep, VM_FRAME_FLAG_FINISH ) != 0)
|
||||
#define VM_FRAME_TYPE_BMETHOD_P(cfp) (VM_ENV_FLAGS((cfp)->ep, VM_FRAME_FLAG_BMETHOD) != 0)
|
||||
|
||||
#define VM_ENV_DATA_SIZE ( 3)
|
||||
|
||||
#define VM_ENV_DATA_INDEX_ME_CREF (-2) /* ep[-2] */
|
||||
|
@ -1001,6 +996,8 @@ static inline void VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_
|
|||
|
||||
#define VM_ENV_INDEX_LAST_LVAR (-VM_ENV_DATA_SIZE)
|
||||
|
||||
static inline void VM_FORCE_WRITE_SPECIAL_CONST(const VALUE *ptr, VALUE special_const_value);
|
||||
|
||||
static inline void
|
||||
VM_ENV_FLAGS_SET(const VALUE *ep, VALUE flag)
|
||||
{
|
||||
|
@ -1031,6 +1028,18 @@ VM_FRAME_TYPE(const rb_control_frame_t *cfp)
|
|||
return VM_ENV_FLAGS(cfp->ep, VM_FRAME_MAGIC_MASK);
|
||||
}
|
||||
|
||||
static inline int
|
||||
VM_FRAME_FINISHED_P(const rb_control_frame_t *cfp)
|
||||
{
|
||||
return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_FINISH ) != 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
VM_FRAME_BMETHOD_P(const rb_control_frame_t *cfp)
|
||||
{
|
||||
return VM_ENV_FLAGS(cfp->ep, VM_FRAME_FLAG_BMETHOD) != 0;
|
||||
}
|
||||
|
||||
#define RUBYVM_CFUNC_FRAME_P(cfp) \
|
||||
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ control_frame_dump(rb_thread_t *th, rb_control_frame_t *cfp)
|
|||
if (line) {
|
||||
fprintf(stderr, " %s", posbuf);
|
||||
}
|
||||
if (VM_FRAME_TYPE_FINISH_P(cfp)) {
|
||||
if (VM_FRAME_FINISHED_P(cfp)) {
|
||||
fprintf(stderr, " [FINISH]");
|
||||
}
|
||||
if (0) {
|
||||
|
@ -295,7 +295,7 @@ vm_stack_dump_each(rb_thread_t *th, rb_control_frame_t *cfp)
|
|||
(ptr - th->stack));
|
||||
}
|
||||
}
|
||||
else if (VM_FRAME_TYPE_FINISH_P(cfp)) {
|
||||
else if (VM_FRAME_FINISHED_P(cfp)) {
|
||||
if ((th)->stack + (th)->stack_size > (VALUE *)(cfp + 1)) {
|
||||
vm_stack_dump_each(th, cfp + 1);
|
||||
}
|
||||
|
|
|
@ -1507,7 +1507,7 @@ vm_call_iseq_setup_tailcall(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_
|
|||
const rb_iseq_t *iseq = def_iseq_ptr(me->def);
|
||||
VALUE *src_argv = argv;
|
||||
VALUE *sp_orig, *sp;
|
||||
VALUE finish_flag = VM_FRAME_TYPE_FINISH_P(cfp) ? VM_FRAME_FLAG_FINISH : 0;
|
||||
VALUE finish_flag = VM_FRAME_FINISHED_P(cfp) ? VM_FRAME_FLAG_FINISH : 0;
|
||||
|
||||
if (VM_BH_FROM_CFP_P(calling->block_handler, cfp)) {
|
||||
struct rb_captured_block *dst_captured = VM_CFP_TO_CAPTURED_BLOCK(RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
|
||||
|
|
|
@ -359,7 +359,7 @@ rb_threadptr_exec_event_hooks_orig(rb_trace_arg_t *trace_arg, int pop_p)
|
|||
|
||||
if (state) {
|
||||
if (pop_p) {
|
||||
if (VM_FRAME_TYPE_FINISH_P(th->cfp)) {
|
||||
if (VM_FRAME_FINISHED_P(th->cfp)) {
|
||||
th->tag = th->tag->prev;
|
||||
}
|
||||
rb_vm_pop_frame(th);
|
||||
|
|
Loading…
Reference in a new issue