Skip to content
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

YJIT: Avoid identity-based known-class guards for IO objects #7911

Merged
merged 1 commit into from Jun 6, 2023

Conversation

XrXr
Copy link
Member

@XrXr XrXr commented Jun 5, 2023

IO#reopen is very special in that it is able to change the class and
singleton class of IO instances. In its presence, it is not correct to
assume that IO instances have a stable class/singleton class and guard
by comparing identity.


Discovered after looking at https://bugs.ruby-lang.org/issues/19712. Thanks Peter!

  • make a ticket for this for backport

@matzbot matzbot requested a review from a team June 5, 2023 22:57
`IO#reopen` is very special in that it is able to change the class and
singleton class of IO instances. In its presence, it is not correct to
assume that IO instances has a stable class/singleton class and guard
by comparing identity.
Copy link
Member

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's annoying that IO#reopen does stuff like this. I wonder if it could cause other problems when it changes the class of a receiver, but I can't think of any.

@maximecb
Copy link
Contributor

maximecb commented Jun 6, 2023

It's annoying that IO#reopen does stuff like this. I wonder if it could cause other problems when it changes the class of a receiver, but I can't think of any.

I hate this behavior as well 😅 Should not be in the language.

@maximecb maximecb merged commit 2b54c13 into ruby:master Jun 6, 2023
95 checks passed
@XrXr XrXr deleted the yjit-io-reopen branch June 6, 2023 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants