Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
15
-
b21
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8248214 | 11.0.9 | Patrick Zhang | P3 | Resolved | Fixed | b01 |
Description
The array elements in a GenericTaskQueue are declared volatile. This doesn't serve any useful purpose. If the necessary memory and compiler barriers are present then making the elements volatile doesn't provide any needed ordering. If if those barriers are not present then the volatile usage isn't sufficient, at least on platforms with weak memory ordering.
On the contrary, having the array elements declared volatile forces element type to support volatile copy assignment. That leads to problems. For C++14 we need to have some additional user-defined special functions to avoid deprecation warnings from gcc9. But if we have multiple assignment operators then we need to suppress warnings from Visual Studio. And really, we want the element type to be trivially copyable. By removing the unneeded volatile qualification of the array element type we can change most of the used classes to be trivially copyable. (oop is an exception.)
Another place where the current use of volatile leads to problems is around the manipulation of the _age member. By using explicit relaxed Atomic accesses we can simplify the Age class and its use, eliminating the need for all the volatile-qualified functions in the Age class.
On the contrary, having the array elements declared volatile forces element type to support volatile copy assignment. That leads to problems. For C++14 we need to have some additional user-defined special functions to avoid deprecation warnings from gcc9. But if we have multiple assignment operators then we need to suppress warnings from Visual Studio. And really, we want the element type to be trivially copyable. By removing the unneeded volatile qualification of the array element type we can change most of the used classes to be trivially copyable. (oop is an exception.)
Another place where the current use of volatile leads to problems is around the manipulation of the _age member. By using explicit relaxed Atomic accesses we can simplify the Age class and its use, eliminating the need for all the volatile-qualified functions in the Age class.
Attachments
Issue Links
- backported by
-
JDK-8248214 Add paddings for TaskQueueSuper to reduce false-sharing cache contention
-
- Resolved
-
- blocks
-
JDK-8208089 JEP 347: Enable C++14 Language Features
-
- Closed
-
- relates to
-
JDK-8244307 Improve assertions against taskqueue underflow
-
- Resolved
-
-
JDK-8245594 Remove volatile-qualified member functions and parameters from oop class
-
- Resolved
-
-
JDK-8254239 G1ConcurrentMark.hpp unnecessarily disables MSVC++ warning 4522.
-
- Resolved
-