RFR: 8261075: Create stubRoutines.inline.hpp with SafeFetch implementation
Stefan Karlsson
stefank at openjdk.java.net
Mon Feb 15 19:56:39 UTC 2021
On Mon, 15 Feb 2021 15:47:47 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:
>>> > I would rename the new header safefetch.hpp, just because these functions were never part of the StubRoutines namespace, and the naming is much clearer.
>>>
>>> Good idea. It should be safefetch.inline.hpp, right?
>>
>> I don't think so? To my understanding, xxx.inline.hpp is a companion file to an xxx.hpp which you create if you want to remove some of the rarely used functions from a high traffic header. Here, we just have some independent global utility functions.
>
>> To my understanding, xxx.inline.hpp is a companion file to an xxx.hpp which you create if you want to remove some of the rarely used functions from a high traffic header.
>
> Oh, you're right. I had an impression that there are standalone inline.hpp files, and I could not find the opposite in the Hotspot Style Guide. However, now I see inline.hpp are just the way you've described. Thanks!
If you put non-trivial code in the header, then it should go into an .inline.hpp file (or .cpp file). From the style-guide:
Do not put non-trivial function implementations in .hpp files. If the implementation depends on other .hpp files, put it in a .cpp or a .inline.hpp file.
It doesn't matter if there exists a .hpp file or not. However, what's non-trivial becomes a judgment call. I tend to use rule that if it uses code from another header, then it's non-trivial, and should most likely be moved out of the .hpp file.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2542
More information about the hotspot-dev
mailing list