-
Notifications
You must be signed in to change notification settings - Fork 31
Implement proper thread-safety for concurrent ObjectMarker #137
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
base: master
Are you sure you want to change the base?
Conversation
Introduce a ConcurrentBitField backed by an AtomicLongArray, and use it to do proper CAS-based state tracking in the concurrent ObjectMarker. This is a potential fix to issue #57.
| import org.junit.Test; | ||
| import org.junit.rules.ExpectedException; | ||
|
|
||
| public class ConcurrentBitFieldTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please suggest any additional / fixes to tests.
| Bundle-SymbolicName: org.eclipse.mat.report;singleton:=true | ||
| Bundle-Version: 1.17.0.qualifier | ||
| Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
| Bundle-RequiredExecutionEnvironment: JavaSE-17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was required to support compareAndExchange. If we cannot do xchg, it can be done with compareAndSet, but involves additional CAS operations.
| // Therefore, we need to use full compare and exchange rather than | ||
| // compare and set. | ||
|
|
||
| while (true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate any extra eyes on this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A colleague suggested adding a jcstress, did so in 9499a38.
Using a standalone project and readme since the jcstress modules are not made available for use with tycho or packaged in orbit. Added a README to explain.
Introduce a ConcurrentBitField backed by an AtomicLongArray, and use it to do proper CAS-based state tracking in the concurrent ObjectMarker.
This is a potential fix to issue #57.