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

Do not optimize case with null value to switch #6443

Merged
merged 2 commits into from Oct 21, 2020

Conversation

headius
Copy link
Member

@headius headius commented Oct 21, 2020

Optimized Fixnum switch is only possible when we have a case
value and the when values are all int-ranged literal numbers.
The NPE in #6440 was due to us also trying to optimize homogeneous
int case/when even if the case value was null (omitted in source).

This patch limits the optimized switch generation to situations
where we have a non-null case value.

Fixes #6440.

Optimized Fixnum switch is only possible when we have a `case`
value and the `when` values are all int-ranged literal numbers.
The NPE in jruby#6440 was due to us also trying to optimize homogeneous
int case/when even if the case value was null (omitted in source).

This patch limits the optimized switch generation to situations
where we have a non-null `case` value.

Fixes jruby#6440.
@headius headius added this to the JRuby 9.2.14.0 milestone Oct 21, 2020
See jruby#6440 for an example of this situation breaking
homogeneous case optimizations.
@headius headius merged commit 69da94a into jruby:jruby-9.2 Oct 21, 2020
1 check was pending
@headius headius deleted the no_switch_with_null_case branch October 21, 2020 22:07
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

Successfully merging this pull request may close these issues.

Java::JavaLang::NullPointerException () --> JRuby 9.2.13.0 on Windows 10
1 participant