summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-03 00:28:12 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-03 00:28:12 +0000
commit0cd7f5fe87fb2d047a5423cd24c24f9fea530502 (patch)
treea016e1c7a87c63f63b0cd5bacba5935f6956282f
parent1cc78637e3435eeb6cd26a6ebbb4e164d18cf0e1 (diff)
downloadruby-0cd7f5fe87fb2d047a5423cd24c24f9fea530502.tar.gz
* 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
-rw-r--r--ChangeLog7
-rw-r--r--vm.c6
-rw-r--r--vm_core.h19
-rw-r--r--vm_dump.c4
-rw-r--r--vm_insnhelper.c2
-rw-r--r--vm_trace.c2
6 files changed, 28 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 37b7593ce7..dce2f41b02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/vm.c b/vm.c
index 6f9a7f8a3d..9d596bbd93 100644
--- a/vm.c
+++ b/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();
diff --git a/vm_core.h b/vm_core.h
index 385c482698..d7cf0bb2d8 100644
--- a/vm_core.h
+++ b/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)
diff --git a/vm_dump.c b/vm_dump.c
index c40b0e6625..3e8d98e3fa 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -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);
}
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 834bbdb2ff..16a467f30d 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -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));
diff --git a/vm_trace.c b/vm_trace.c
index b85839af35..fe14c64918 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -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);