Using C++11+ in hotspot

Martin Buchholz martinrb at google.com
Sun Aug 5 15:30:27 UTC 2018


On Fri, Aug 3, 2018 at 3:14 PM, Mikael Vidstedt <mikael.vidstedt at oracle.com>
wrote:

>
> Martin Buchholz suggested the topic and Mikael signed up to lead the
> session. Martin gave an introduction. He had observed some issues recently
> (“impossible null pointer exceptions”) which after investigation turned out
> to be caused by a toolchain upgrade and in turn revealed the fact that some
> code in hotspot requires atomicity but does not make this requirement very
> explicit and in the end assumes that the C++ compiler will produce suitable
> code to guarantee atomicity. Martin also observed that (on linux) hotspot
> is compiled targeting the c++98 standard, which is old enough to not even
> mention the concept of threads. Mikael also added that for extra fun the
> story is different on different platforms and toolchains.
>

I was surprised to hear that IBM AIX xlc compilers might not support C++11
- it's not the IBM way.  But from reading the tea leaves at

https://www-01.ibm.com/support/docview.wss?uid=swg27007322&aid=1

I concluded that IBM is a Linux company now!  Even for IBM, AIX is  a niche
legacy platform and they just couldn't keep up with the evolution of C++
(who can blame them?).  Meanwhile gcc is available for AIX and can/should
be used to build openjdk.  Has anyone tried?

Here's one example of code that actually did go wrong with Google's latest
internal toolchain, because the copy was not in fact word-atomic.  Thanks
to whoever added the comment long ago.

static inline void copy_table(address* from, address* to, int size) {
  // Copy non-overlapping tables. The copy has to occur word wise for MT
safety.
  while (size-- > 0) *to++ = *from++;
}

Recommendation: target C++11 for jdk12; use gcc to build openjdk on AIX.


More information about the workshop-discuss mailing list