8000 YJIT: Replace Array#each only when YJIT is enabled by k0kubun · Pull Request #11955 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

YJIT: Replace Array#each only when YJIT is enabled #11955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000 Prev Previous commit
Next Next commit
Use method_basic_definition_p to detect patches
  • Loading branch information
k0kubun committed Nov 1, 2024
commit 218776d8aa1a651151c88b449036ef0d23b12387
2 changes: 1 addition & 1 deletion array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def fetch_values(*indexes, &block)
end

with_yjit do
if Array.instance_method(:each).source_location == nil # preserve monkey patches
if Primitive.rb_builtin_basic_definition_p(:each)
undef :each

def each # :nodoc:
Expand Down
6 changes: 6 additions & 0 deletions builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ rb_vm_lvar(rb_execution_context_t *ec, int index)
#endif
}

static inline VALUE
rb_builtin_basic_definition_p(rb_execution_context_t *ec, VALUE klass, VALUE id_sym)
{
return rb_method_basic_definition_p(klass, rb_sym2id(id_sym)) ? Qtrue : Qfalse;
}

#define LOCAL_PTR(local) local ## __ptr

// dump/load
Expand Down
0