Add IMEMO_NEW

Rather than exposing that an imemo has a flag and four fields, this
changes the implementation to only expose one field (the klass) and
fills the rest with 0. The type will have to fill in the values themselves.
This commit is contained in:
Peter Zhu 2024-02-20 15:58:10 -05:00
parent 2e6f8554f8
commit 330830dd1a
12 changed files with 69 additions and 33 deletions

View file

@ -182,8 +182,11 @@ CC_SET_FASTPATH(const struct rb_callcache *cc, vm_call_handler func, bool enable
static inline struct vm_throw_data *
THROW_DATA_NEW(VALUE val, const rb_control_frame_t *cf, int st)
{
struct vm_throw_data *obj = (struct vm_throw_data *)rb_imemo_new(imemo_throw_data, val, (VALUE)cf, 0, 0);
struct vm_throw_data *obj = IMEMO_NEW(struct vm_throw_data, imemo_throw_data, 0);
*((VALUE *)&obj->throw_obj) = val;
*((struct rb_control_frame_struct **)&obj->catch_frame) = (struct rb_control_frame_struct *)cf;
obj->throw_state = st;
return obj;
}