YJIT: Simplify Kernel#send guards and admit more cases (#9956)

Previously, our compile time check rejected dynamic symbols (e.g. what
String#to_sym could return) even though we could handle them just fine.
The runtime guards for the type of method name was also overly
restrictive and didn't accept dynamic symbols.

Fold the type check into the rb_get_symbol_id() and take advantage of
the guard already checking for 0. This also avoids generating the same
call twice in case the same method name is presented as different
types.
This commit is contained in:
Alan Wu 2024-02-14 11:19:04 -05:00 committed by GitHub
parent f4a0e1cdb4
commit ee3b4bec0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 41 deletions

View file

@ -1140,10 +1140,12 @@ rb_get_symbol_id(VALUE name)
return 0;
}
}
else {
RUBY_ASSERT_ALWAYS(RB_TYPE_P(name, T_STRING));
else if (RB_TYPE_P(name, T_STRING)) {
return lookup_str_id(name);
}
else {
return 0;
}
}