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

Kim Barrett kim.barrett at oracle.com
Thu Jul 14 17:43:00 UTC 2016

> 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 HSSUB).
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