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

properly synchronize globalInlineCount #5943

Merged
merged 1 commit into from Oct 26, 2019
Merged

properly synchronize globalInlineCount #5943

merged 1 commit into from Oct 26, 2019

Conversation

@ahorek
Copy link
Contributor

ahorek commented Oct 23, 2019

synchronization using a boxed primitive isn't reliable, because the field's value could be changed while a thread is in a synchronized block.

@kares

This comment has been minimized.

Copy link
Member

kares commented Oct 24, 2019

nice find, this piece is just quite weird (there's still globalInlineCount++ against the boxed int).
@ahorek how do you feel about refactoring to simply use an AtomicInt (without synchronize) ?

@enebo

This comment has been minimized.

Copy link
Member

enebo commented Oct 24, 2019

with PR as it is globalInlineCount should be made an int. The usage of this synchronize was so narrow I don't think in practice we would ever see the field change while it is synched. That said, either suggested fix is better (I would prefer AtomicInt myself).

@ahorek ahorek force-pushed the ahorek:icount branch from 7fb7cd4 to 03a2bc8 Oct 24, 2019
@kares kares merged commit 1908176 into jruby:master Oct 26, 2019
5 checks passed
5 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jruby.jruby Build #20191024.6 succeeded
Details
jruby.jruby (Job linux) Job linux succeeded
Details
jruby.jruby (Job mac) Job mac succeeded
Details
jruby.jruby (Job windows) Job windows succeeded
Details
@kares kares added this to the JRuby 9.2.9.0 milestone Oct 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.