RFR: 8074319: barrier_set_cast defined via friend injection

Volker Simonis volker.simonis at gmail.com
Tue Mar 3 17:55:06 UTC 2015

Hi Kim,

I was looking at the same problem today because it also fails on AIX
with xlC 12.1.

I'm not one hundred percent sure but I currently more tend to say it
is a compiler bug although I'll have to dive deeper into the C++
standard before I can give a qualified answer here.

But your change looks good and it also works on AIX. So if you like,
you can consider it reviewed.

However, with your change "barrier_set_cast()" won't be an inline
function any more which may have performance impacts (this is
something you'll have to judge).

I'd like to propose a similar change which keeps "barrier_set_cast()"
as inline function and still works with Xcode5 and xlC 12 on AIX:

diff -r 71f4ed3c627f src/share/vm/memory/barrierSet.hpp
--- a/src/share/vm/memory/barrierSet.hpp        Tue Mar 03 13:25:23 2015 +0000
+++ b/src/share/vm/memory/barrierSet.hpp        Tue Mar 03 18:51:47 2015 +0100
@@ -32,6 +32,10 @@
 // This class provides the interface between a barrier implementation and
 // the rest of the system.

+class BarrierSet;
+template<typename T>
+T* barrier_set_cast(BarrierSet* bs);
 class BarrierSet: public CHeapObj<mtGC> {
   friend class VMStructs;


PS: I'm a little bit confused that this error hasn't been catched by
JPRT because the OpenJDK Wiki
lists clang 5.1 as official build platform for MacOS X?

On Tue, Mar 3, 2015 at 5:28 PM, Kim Barrett <kim.barrett at oracle.com> wrote:
> On Mar 3, 2015, at 11:26 AM, Kim Barrett <kim.barrett at oracle.com> wrote:
>> Please review this small change to the recently added barrier_set_cast
>> (see https://bugs.openjdk.java.net/browse/JDK-8069016). The way that
>> new function is being defined is unintentionally not standards
>> conforming and should not compile, but all of our present official
>> test platforms accept it anyway. The code is presently only known to
>> fail with the more recent Xcode6.
> That should be Xcode5.  Xcode4 is the present test platform.

More information about the hotspot-gc-dev mailing list