diff options
author | John Hawthorn <john@hawthorn.email> | 2022-06-10 09:43:05 -0700 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2022-06-10 14:48:21 -0700 |
commit | 52da90aceefd9f8de06666796f6a2d484ca18036 (patch) | |
tree | 2f09ab04c73ca979dd9561c36e0e51f184fac5af /include | |
parent | f4747958e546a5d3f2c0033b19c6ad69ce7278b1 (diff) | |
download | ruby-52da90aceefd9f8de06666796f6a2d484ca18036.tar.gz |
Make method id explicit in rb_exec_recursive_outer
Previously, because opt_aref and opt_aset don't push a frame, when they
would call rb_hash to determine the hash value of the key, the initial
level of recursion would incorrectly use the method id at the top of the
stack instead of "hash".
This commit replaces rb_exec_recursive_outer with
rb_exec_recursive_outer_mid, which takes an explicit method id, so that
we can make the hash calculation behave consistently.
rb_exec_recursive_outer was documented as being internal, so I believe
this should be okay to change.
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/internal/intern/thread.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/ruby/internal/intern/thread.h b/include/ruby/internal/intern/thread.h index 716375acd7..ef4274e4b3 100644 --- a/include/ruby/internal/intern/thread.h +++ b/include/ruby/internal/intern/thread.h @@ -292,6 +292,7 @@ VALUE rb_exec_recursive_paired(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VAL * @param[in] f The function that possibly recurs. * @param[in,out] g Passed as-is to `f`. * @param[in,out] h Passed as-is to `f`. + * @param[in] mid The ID of the method name being called * @return The return value of f. * * @internal @@ -299,7 +300,7 @@ VALUE rb_exec_recursive_paired(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VAL * It seems nobody uses the "it calls rb_throw_obj()" part of this function. * @shyouhei doesn't understand the needs. */ -VALUE rb_exec_recursive_outer(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h); +VALUE rb_exec_recursive_outer_mid(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h, ID mid); /** * Identical to rb_exec_recursive_outer(), except it checks for the recursion |