mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Implement optimize send in yjit (#6488)
* Implement optimize send in yjit This successfully makes all our benchmarks exit way less for optimize send reasons. It makes some benchmarks faster, but not by as much as I'd like. I think this implementation works, but there are definitely more optimial arrangements. For example, what if we compiled send to a jump table? That seems like perhaps the most optimal we could do, but not obvious (to me) how to implement give our current setup. Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> * Attempt at fixing the issues raised by @XrXr * fix allowlist * returns 0 instead of nil when not found * remove comment about encoding exception * Fix up c changes * Update assert Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> * get rid of unneeded code and fix the flags * Apply suggestions from code review Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> * rename and fix typo Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
This commit is contained in:
parent
913979bede
commit
467992ee35
Notes:
git
2022-10-12 05:37:32 +09:00
Merged-By: maximecb <maximecb@ruby-lang.org>
8 changed files with 262 additions and 17 deletions
22
symbol.c
22
symbol.c
|
@ -1112,6 +1112,28 @@ rb_check_id(volatile VALUE *namep)
|
|||
return lookup_str_id(name);
|
||||
}
|
||||
|
||||
// Used by yjit for handling .send without throwing exceptions
|
||||
ID
|
||||
rb_get_symbol_id(VALUE name)
|
||||
{
|
||||
if (STATIC_SYM_P(name)) {
|
||||
return STATIC_SYM2ID(name);
|
||||
}
|
||||
else if (DYNAMIC_SYM_P(name)) {
|
||||
if (SYMBOL_PINNED_P(name)) {
|
||||
return RSYMBOL(name)->id;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
RUBY_ASSERT_ALWAYS(RB_TYPE_P(name, T_STRING));
|
||||
return lookup_str_id(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VALUE
|
||||
rb_check_symbol(volatile VALUE *namep)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue