Skip to content

Commit

Permalink
RB_OBJ_FREEZE_RAW: Set the object shape
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Apr 16, 2024
1 parent 39b13e5 commit 7380e3d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
13 changes: 5 additions & 8 deletions include/ruby/internal/fl_type.h
Expand Up @@ -905,6 +905,10 @@ RB_OBJ_FROZEN(VALUE obj)
}
}

RUBY_SYMBOL_EXPORT_BEGIN
void rb_obj_freeze_inline(VALUE obj);
RUBY_SYMBOL_EXPORT_END

RBIMPL_ATTR_ARTIFICIAL()
/**
* This is an implementation detail of RB_OBJ_FREEZE(). 3rd parties need not
Expand All @@ -915,14 +919,7 @@ RBIMPL_ATTR_ARTIFICIAL()
static inline void
RB_OBJ_FREEZE_RAW(VALUE obj)
{
RB_FL_SET_RAW(obj, RUBY_FL_FREEZE);
if (TYPE(obj) == T_STRING) {
RB_FL_UNSET_RAW(obj, FL_USER3); // STR_CHILLED
}
rb_obj_freeze_inline(obj);
}

RUBY_SYMBOL_EXPORT_BEGIN
void rb_obj_freeze_inline(VALUE obj);
RUBY_SYMBOL_EXPORT_END

#endif /* RBIMPL_FL_TYPE_H */
5 changes: 4 additions & 1 deletion variable.c
Expand Up @@ -1815,7 +1815,10 @@ rb_shape_set_shape_id(VALUE obj, shape_id_t shape_id)
void rb_obj_freeze_inline(VALUE x)
{
if (RB_FL_ABLE(x)) {
RB_OBJ_FREEZE_RAW(x);
RB_FL_SET_RAW(x, RUBY_FL_FREEZE);
if (TYPE(x) == T_STRING) {
RB_FL_UNSET_RAW(x, FL_USER3); // STR_CHILLED
}

rb_shape_t * next_shape = rb_shape_transition_shape_frozen(x);

Expand Down

0 comments on commit 7380e3d

Please sign in to comment.