Make rb_check_frozen_inline() static inline again

Since 730e3b2ce0
("Stop exposing `rb_str_chilled_p`"), we noticed a speed loss on a few
benchmarks that are string operations heavy. This is partially due to
routines no longer having the options to inline rb_check_frozen_inline()
in non-LTO builds. Make it an inlining candidate again to recover speed.

Testing this patch on my machine, the fannkuchredux benchmark gets a
1.15 speed-up with YJIT and 1.03 without YJIT.
This commit is contained in:
Alan Wu 2024-07-19 15:53:16 -04:00
parent 30f2d69825
commit 8cf708d7b4
Notes: git 2024-07-19 21:47:29 +00:00
2 changed files with 20 additions and 8 deletions

View file

@ -4001,13 +4001,7 @@ rb_error_frozen_object(VALUE frozen_obj)
void
rb_check_frozen(VALUE obj)
{
if (RB_UNLIKELY(RB_OBJ_FROZEN(obj))) {
rb_error_frozen_object(obj);
}
if (RB_UNLIKELY(CHILLED_STRING_P(obj))) {
rb_str_modify(obj);
}
rb_check_frozen_inline(obj);
}
void