RFR: JDK-8221851: Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC

David Holmes david.holmes at oracle.com
Mon Apr 8 22:27:13 UTC 2019

Hi Erik,

On 9/04/2019 8:08 am, Erik Joelsson wrote:
> New webrev with "_simple_basename": 
> http://cr.openjdk.java.net/~erikj/8221851/webrev.05/

Given the usage is typically of the form:

  Exceptions::_throw(THREAD_AND_LOCATION, e);

which will expand to:

  Exceptions::_throw(THREAD, _simple_basename(__FILE__), __LINE__, e);

what does the compiler actually generate for this at the call sites? I'm 
struggling with the addition of an inline function to a .hpp which we 
generally frown upon and have been working to remove.

What affect does this have on code size?


> /Erik
> On 2019-04-08 12:20, Erik Joelsson wrote:
>> On 2019-04-08 11:40, Kim Barrett wrote:
>>>> On Apr 8, 2019, at 10:28 AM, Erik Joelsson 
>>>> <erik.joelsson at oracle.com> wrote:
>>>> Hello,
>>>> On 2019-04-05 15:46, Kim Barrett wrote:
>>>>> Assuming all that, consider instead putting this_file_helper in
>>>>> exceptions.hpp (perhaps with a better name?), don't bother with
>>>>> THIS_FILE, and define THREAD_AND_LOCATION as
>>>>> #define THREAD_AND_LOCATION THREAD, this_file_helper(__FILE__), 
>>>>> __LINE__
>>>> Moved to exceptions.hpp, renamed to "basename", and removed the 
>>>> THIS_FILE macro.
>>> “basename” might not count as a “better name”, as it conflicts with a 
>>> POSIX function,
>>> even though we don’t presently seem to be using that anywhere that I 
>>> could find.
>> How about "simple_basename" then? Or just prefix with an underscore? 
>> The idea is to keep it internal to the headerfile, but I'm not 
>> familiar with conventions in Hotspot to know how you usually 
>> prefix/namespace things as private.
>> /Erik

More information about the build-dev mailing list