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

Christian Thalinger christian.thalinger at oracle.com
Wed Sep 18 19:09:38 PDT 2013


I'd rather have the #ifdef in the body of the method.  Besides that it looks good.

On Sep 18, 2013, at 9:39 AM, BILL PITTORE <bill.pittore at oracle.com> 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/
> 
> thanks,
> bill
> 



More information about the hotspot-runtime-dev mailing list