RFR 8014911 - Use SUPPORTS_NATIVE_CX8 to help C++ compiler elide code

BILL PITTORE bill.pittore at oracle.com
Thu Sep 19 07:13:52 PDT 2013


On 9/19/2013 1:02 AM, David Holmes wrote:
> On 19/09/2013 2:41 PM, David Holmes wrote:
>> On 19/09/2013 2:39 AM, BILL PITTORE wrote:
>>> Would like a review for this simple fix that leverages the macro
>>> 'SUPPORTS_NATIVE_CX8' that was added in hotspot revision:
>>> changeset:   4611:6b388e7d4905
>>> parent:      4547:e01e02a9fcb6
>>> user:        bpittore
>>> date:        Tue May 07 10:19:33 2013 -0400
>>> summary:     8013633: Cleanup platform ifdefs in unsafe.cpp
>>>
>>> SUPPORTS_NATIVE_CX8 is defined in globalDefinitions_<arch>.hpp based on
>>> whether the platform supports 64bit cmpxchg natively. This change uses
>>> the define to force the supports_cx8() function to return hard-coded
>>> 'true' value. GCC and other compilers will then optimize code that uses
>>> supports_cx8() function call by removing the actual reference to
>>> _supports_cx8 variable as well as eliminating code for the
>>> !supports_cx8() case.
>>> Webrev is here: http://cr.openjdk.java.net/~bpittore/8014911/webrev.00/
>>
>> Can't we also delete the field itself?
>
> To answer my own question ...
>
> Yes _but_ then we'd have to make all the platform specific code that 
> sets _supports_cx8 conditional on SUPPORTS_NATIVE_CX8 as well. That's 
> unnecessarily intrusive.
>
Correct. Plus in at least one place _supports_cx8 is used for an 
assertion test which would need to be tweaked as well.

bill

> David
>
>
>> David
>>
>>> thanks,
>>> bill
>>>



More information about the hotspot-runtime-dev mailing list