RFR(L): 8161259: Simplify including platform files.

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Thu Jul 14 19:18:35 UTC 2016

Hi everybody,

please take into account that these macros are only used within 20 lines of 
the file macro.hpp.  The code everybody needs to understand is 
    #include cpu_header(bytes) 
which, in this example, is in file bytes.hpp and expands to bytes_<cpu>.hpp.
There are six of these, for cpu/os/os_cpu and .hpp/.inline.hpp.

I really would appreciate if I don't have to spend days editing the 
12 lines that use SUB().

I'm working on the s390 port, and posted my current progress claiming
that the biggest shared change I need to do is adding the #includes.
This arose the discussion about the includes.
Later I posted a prototype of what Volker proposed in that discussion
to that thread:
which I now turned into a RFR.

Best regards,

> -----Original Message-----
> From: Kim Barrett [mailto:kim.barrett at oracle.com]
> Sent: Thursday, July 14, 2016 7:43 PM
> To: Lindenmaier, Goetz <goetz.lindenmaier at sap.com>
> Cc: Andrew Haley <aph at redhat.com>; hotspot-compiler-
> dev at openjdk.java.net; hotspot-runtime-dev at openjdk.java.net
> Subject: Re: RFR(L): 8161259: Simplify including platform files.
> > On Jul 14, 2016, at 1:19 PM, Kim Barrett <kim.barrett at oracle.com> wrote:
> >
> >> On Jul 14, 2016, at 8:42 AM, Lindenmaier, Goetz
> <goetz.lindenmaier at sap.com> wrote:
> >>
> >> Hi Andrew,
> >>
> >> unfortunately it's not that simple ...
> >> It does not grok the macro INCLUDE_SUFFIX_CPU, nor the dot in .hpp:
> >>
> >> #define CONCAT4(a, b, c, d) a ## b ## c ## d
> >> #define xcpu_header(x, y)    XSTR(CONCAT4(x, _, INCLUDE_SUFFIX_CPU,
> y))
> >> #define cpu_header(basename)            xcpu_header(basename,.hpp)
> >> cpu_header(globalDefinitions)
> >>
> >> error: pasting "globalDefinitions_INCLUDE_SUFFIX_CPU" and "." does not
> give a valid preprocessing token
> >
> > I think part of what you want is called PASTE_TOKENS in macros.hpp.
> >
> > The “.” might be a significant impediment though.  I need to think about
> that one.
> >
> > Note that we can’t make use PP string concatenation here to include a
> period.
> > But stringification operates on expressions, so maybe don’t try to paste the
> file type,
> > instead just including it directly in the token stream.  But that might run into
> whitespace
> > problems if not careful.
> But looking more closely at what’s being discussed and interpolating a bit (I
> seem to be
> missing some messages in this thread for some reason?), I think token
> pasting doesn’t
> work for the suffix part of this, because we’re dealing with something that is
> not syntactically
> an identifier.
> The original approach seems okay to me, modulo the name SUB (or even
> If token pasting were used to construct the stem and the suffix is expanded
> using this
> substitution macro, then there’s generally only one occurrence of it and its
> length no
> longer matters much.
> Stringizing is fine with any expression.  Just need to be careful not to
> inadvertently
> insert any whitespace into the mix.

More information about the hotspot-compiler-dev mailing list