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

Simplify BNEInstr forms to eliminate non-identity comparisons #8189

Open
Tracked by #7588
headius opened this issue Apr 3, 2024 · 0 comments
Open
Tracked by #7588

Simplify BNEInstr forms to eliminate non-identity comparisons #8189

headius opened this issue Apr 3, 2024 · 0 comments

Comments

@headius
Copy link
Member

headius commented Apr 3, 2024

This came from #7588.

BNEInstr had a number of different paths to create, but it turns out all of them fall into these categories:

  • Comparison with true or false
  • Comparison with nil
  • Comparison with Undefined
  • Comparison with fixnum

The true/false cases have been replaced with construction of BTrueInstr and BFalse instr (flipped because this was BNE, nor BEQ). That leaves the other three cases.

For nil, there's BNilInstr for equality but nothing for inequality. Either that remains or we add a new BNotNilInstr or we flip branches using this form.

For Undefined, there's similarly BUndefInstr for equality but nothing for inequality.

The only fixnum cases are two uses of BNEInstr in flip-flop support to check the flip-flop gate status. They could also be implemented a different way.

In short, BNEInstr can be specialized to other forms and eliminated, or simplified to only have reference equality forms (nil and Undefined) moving the value equality uses to other instructions.

@headius headius changed the title BNEInstr logic used by JIT could be smarter about objects that are identical, if we do not need to actually call op_equal. It could also use indy and specialize better. (It turns out BNE is mostly reference equality except for two fixnum forms used by flip-flops. We can do those another way and then compile BNE as simple reference equality.) Simplify BNEInstr forms to eliminate non-identity comparisons Apr 3, 2024
@headius headius added this to the JRuby 10.0.0.0 milestone Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant