Dynamic dispatch to super.initialize_[dup,clone] in native Set#6910
Merged
headius merged 2 commits intojruby:jruby-9.2from Oct 26, 2021
Merged
Dynamic dispatch to super.initialize_[dup,clone] in native Set#6910headius merged 2 commits intojruby:jruby-9.2from
headius merged 2 commits intojruby:jruby-9.2from
Conversation
b8710b9 to
0146b21
Compare
headius
added a commit
to headius/jruby
that referenced
this pull request
Dec 3, 2021
We can't blindly get the current object's class's superclass because the object's class may be multiple descendants below the Set class, causing super calls to super back into a lower point in the hierarchy. This is the cause of jruby#6958. The fix here is to request a frame be pushed for Set#init_dup and init_clone so that we can redispatch from the proper point in the hierarchy. This also properly uses SuperCallSite, passing in the class from which to super. The original code was flawed in two ways: * It always acquired the superclass via object.class.superclass, which does not work for a two-deep descendant of Set. * It passed the superclass in for the frame class, which allowed the flawed logic to work for one level deep. It is broken for two levels deep or no levels deep because it passes the wrong frame class. This was not found during testing of jruby#6910 because the original example only has one descendant.
headius
added a commit
to headius/jruby
that referenced
this pull request
Dec 3, 2021
We can't blindly get the current object's class's superclass because the object's class may be multiple descendants below the Set class, causing super calls to super back into a lower point in the hierarchy. This is the cause of jruby#6958. The fix here is to request a frame be pushed for Set#init_dup and init_clone so that we can redispatch from the proper point in the hierarchy. This also properly uses SuperCallSite, passing in the class from which to super. The original code was flawed in two ways: * It always acquired the superclass via object.class.superclass, which does not work for a two-deep descendant of Set. * It passed the superclass in for the frame class, which allowed the flawed logic to work for one level deep. It is broken for two levels deep or no levels deep because it passes the wrong frame class. This was not found during testing of jruby#6910 because the original example only has one descendant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6903