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

Fix a NPE #2864

Merged
merged 1 commit into from
Jul 12, 2020
Merged

Fix a NPE #2864

merged 1 commit into from
Jul 12, 2020

Conversation

ericvergnaud
Copy link
Contributor

@parrt
bumped into this bug with the JS runtime, caused I suspect by a bug which may affect all targets.

The root cause would come from PredictionContext.merge, lines 169 and 172, where an ArrayPredictionContext is created from a SingletonPredictionContext, which is some cases is an EmptyPredictionContext, with a null parent.
This translates into ArrayPredictionContext.parents being initialized to { null }, which is a nasty code smell...

I'll happily fix it if you think it makes sense, just let me know.

@ericvergnaud
Copy link
Contributor Author

Forgot to mention that the JS bug only appears starting with 4.8, thanks to a dramatic improvement by @lmy269 in PredictionContext. combineCommonParents, which on significant inputs (like 500 lines of code) improves performance by 40% <- yes

@parrt
Copy link
Member

parrt commented Jul 12, 2020

Wow. Good catch. I'm really nervous about touching this stuff in Java target after so many years though..

@ericvergnaud
Copy link
Contributor Author

I'll give a try to see how it affects tests and performance, just don't accept the PR

@ericvergnaud ericvergnaud deleted the fix-javascript-NPE branch July 13, 2020 00:24
@parrt
Copy link
Member

parrt commented Jul 13, 2020

Mostly concerned with breaking something! nervous about changing that stuff haha

@parrt parrt added this to the 4.9 milestone Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants