[SERVER-12064] AtomicIntrinsics is not portable Created: 12/Dec/13 Updated: 11/Jul/16 Resolved: 07/Jan/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 2.5.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Robie Basak | Assignee: | Andy Schwerin |
| Resolution: | Done | Votes: | 0 |
| Labels: | pull-request | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
Pull request to follow. Existing tests in src/mongo/platform/atomic_word_test.cpp are sufficient to cover this change, as the AtomicIntrinsics API remains unchanged. |
| Comments |
| Comment by Githook User [ 09/May/14 ] |
|
Author: {u'name': u'Robie Basak', u'email': u'robie.basak@canonical.com'}Message: Switch to using gcc atomic builtins for atomic operations if using a new Signed-off-by: Benety Goh <benety@mongodb.com> |
| Comment by Matt Kangas [ 07/Jan/14 ] |
|
Successor ticket for 2.7 is |
| Comment by Githook User [ 07/Jan/14 ] |
|
Author: {u'name': u'Robie Basak', u'email': u'robie.basak@canonical.com'}Message: Add support for non-Intel architectures by using gcc builtins where atomic_intrinsics_gcc.h contains non-portable Intel assembly, so move it Adjust atomic_intrinsics.h to use atomic_intrinsics_gcc_intel.h in the This does not change behaviour or compatibility in the common IA-32 and This does make this code fully portable to any architecture supported by |
| Comment by Andy Schwerin [ 13/Dec/13 ] |
|
Thanks, rwbb, for doing the extra work. I'll look it over and get back to you, hopefully early next week. |
| Comment by Robie Basak [ 13/Dec/13 ] |
|
@Andy Schwerin, Done, in https://github.com/mongodb/mongo/pull/582 I took a conservative approach initially, by adding use of gcc builtins as you suggest, but only in the case of non-Intel architectures, to minimise regression risk. But I've added a third commit for you to switch to using them on Intel architectures too where they are available. |
| Comment by Andy Schwerin [ 12/Dec/13 ] |
|
rwbb, I recommend implementing a version in terms of the GCC intrinsics, if they're available on your platform. Those could actually be used on all platforms that support them, and would probably optimize better than the inline assembly, which the compiler is required to treat as opaque. A config check in the build system to look for the GCC intrinsics and setting an environment variable, and defaulting to them when available, would be a highly desirable implementation. |