summaryrefslogtreecommitdiff
path: root/vm_insnhelper.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-06 02:56:23 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-06 02:56:23 +0000
commite2fc01efa54a8df00c19de0b7f9dfc2f26e62e86 (patch)
tree55c317d2f1391a309fbc501dd0db8c28d3eade37 /vm_insnhelper.h
parente4262e991d50a211572da66c7fafbb3cba9e6651 (diff)
downloadruby-e2fc01efa54a8df00c19de0b7f9dfc2f26e62e86.tar.gz
fix TracePoint#return_value with non-local exits
* vm.c: get return_value from imemo_throw_data object (THROW_DATA_VAL()). imemo_throw_data (TAG_BREAK) contains returned value. However, imemo_throw_data (TAG_BREAK) can skip several frames so that we need to use it only once (at most internal frame). To record it, we introduced THROW_DATA_CONSUMED and check it. * internal.h: define THROW_DATA_CONSUMED flag. * test/ruby/test_settracefunc.rb: add tests for [Bug #13369] * vm_insnhelper.h: add THROW_DATA_CONSUMED_P() and THROW_DATA_CONSUMED_SET(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r--vm_insnhelper.h42
1 files changed, 29 insertions, 13 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index 33e3f434cd..9790230e9e 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -196,18 +196,6 @@ THROW_DATA_NEW(VALUE val, const rb_control_frame_t *cf, VALUE st)
return (struct vm_throw_data *)rb_imemo_new(imemo_throw_data, val, (VALUE)cf, st, 0);
}
-static inline void
-THROW_DATA_CATCH_FRAME_SET(struct vm_throw_data *obj, const rb_control_frame_t *cfp)
-{
- obj->catch_frame = cfp;
-}
-
-static inline void
-THROW_DATA_STATE_SET(struct vm_throw_data *obj, int st)
-{
- obj->throw_state = (VALUE)st;
-}
-
static inline VALUE
THROW_DATA_VAL(const struct vm_throw_data *obj)
{
@@ -220,10 +208,38 @@ THROW_DATA_CATCH_FRAME(const struct vm_throw_data *obj)
return obj->catch_frame;
}
-static int
+static inline int
THROW_DATA_STATE(const struct vm_throw_data *obj)
{
return (int)obj->throw_state;
}
+static inline int
+THROW_DATA_CONSUMED_P(const struct vm_throw_data *obj)
+{
+ VM_ASSERT(THROW_DATA_P(obj));
+ return obj->flags & THROW_DATA_CONSUMED;
+}
+
+static inline void
+THROW_DATA_CATCH_FRAME_SET(struct vm_throw_data *obj, const rb_control_frame_t *cfp)
+{
+ obj->catch_frame = cfp;
+}
+
+static inline void
+THROW_DATA_STATE_SET(struct vm_throw_data *obj, int st)
+{
+ obj->throw_state = (VALUE)st;
+}
+
+static inline void
+THROW_DATA_CONSUMED_SET(struct vm_throw_data *obj)
+{
+ if (THROW_DATA_P(obj) &&
+ THROW_DATA_STATE(obj) == TAG_BREAK) {
+ obj->flags |= THROW_DATA_CONSUMED;
+ }
+}
+
#endif /* RUBY_INSNHELPER_H */