Fix vm_objtostring optimization for Symbol
Co-authored-by: John Hawthorn <john@hawthorn.email>
This commit is contained in:
parent
36f67f6bbb
commit
56fbf64a53
Notes:
git
2024-11-26 01:30:24 +00:00
@ -2338,6 +2338,12 @@ check_cfunc(const rb_callable_method_entry_t *me, cfunc_type func)
|
||||
}
|
||||
}
|
||||
|
||||
static inline int
|
||||
check_method_basic_definition(const rb_callable_method_entry_t *me)
|
||||
{
|
||||
return me && METHOD_ENTRY_BASIC(me);
|
||||
}
|
||||
|
||||
static inline int
|
||||
vm_method_cfunc_is(const rb_iseq_t *iseq, CALL_DATA cd, VALUE recv, cfunc_type func)
|
||||
{
|
||||
@ -6072,7 +6078,7 @@ vm_objtostring(const rb_iseq_t *iseq, VALUE recv, CALL_DATA cd)
|
||||
|
||||
switch (type) {
|
||||
case T_SYMBOL:
|
||||
if (check_cfunc(vm_cc_cme(cc), rb_sym_to_s)) {
|
||||
if (check_method_basic_definition(vm_cc_cme(cc))) {
|
||||
// rb_sym_to_s() allocates a mutable string, but since we are only
|
||||
// going to use this string for interpolation, it's fine to use the
|
||||
// frozen string.
|
||||
|
Loading…
x
Reference in New Issue
Block a user