summaryrefslogtreecommitdiff
path: root/vm_insnhelper.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-10 18:39:46 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-10 18:39:46 (GMT)
commit46cdb8f18766383a9e11b5a6e9a0c010e7e8653a (patch)
treedb3496b8d312e6a7123f176591262e10dc9c3a1a /vm_insnhelper.h
parent9d937bb08640107e13a3f6afece074c753afd974 (diff)
* vm_insnhelper.h: define struct THROW_DATA to represent
throwing data. Also define accessor functions. * eval_intern.h: move related changes into vm_insnhelper.h. Now these MACROs (functions) are only used in vm*.c. There is only THROW_DATA_P(err) to check this data type or not. * vm.c: catch up these changes. * vm_eval.c: ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.h')
-rw-r--r--vm_insnhelper.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index c17f3d8..6060a26 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -239,4 +239,48 @@ struct SVAR {
VALUE others;
};
+struct THROW_DATA {
+ VALUE flags;
+ VALUE reserved;
+ VALUE throw_obj;
+ const rb_control_frame_t *catch_frame;
+ VALUE throw_state;
+};
+
+static inline struct THROW_DATA *
+NEW_THROW_DATA(VALUE val, rb_control_frame_t *cf, VALUE st)
+{
+ return (struct THROW_DATA *)rb_node_newnode(NODE_LIT, val, (VALUE)cf, st);
+}
+
+static inline void
+THROW_DATA_CATCH_FRAME_SET(struct THROW_DATA *obj, const rb_control_frame_t *cfp)
+{
+ obj->catch_frame = cfp;
+}
+
+static inline void
+THROW_DATA_STATE_SET(struct THROW_DATA *obj, VALUE st)
+{
+ obj->throw_state = st;
+}
+
+static inline VALUE
+THROW_DATA_VAL(const struct THROW_DATA *obj)
+{
+ return obj->throw_obj;
+}
+
+static inline const rb_control_frame_t *
+THROW_DATA_CATCH_FRAME(const struct THROW_DATA *obj)
+{
+ return obj->catch_frame;
+}
+
+static VALUE
+THROW_DATA_STATE(const struct THROW_DATA *obj)
+{
+ return obj->throw_state;
+}
+
#endif /* RUBY_INSNHELPER_H */