RFR: 8281548: Add escape analysis tracing flag [v4]
Xin Liu
xliu at openjdk.java.net
Wed Feb 23 19:23:52 UTC 2022
On Wed, 23 Feb 2022 19:06:53 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Ok, so if I understand correctly, the issue is with the `NOT_PRODUCT(COMMA ...)` in the arguments list.
>>
>> I think it doesn't look great either, but it seems like the best alternative if we want to make sure no code is generated in product builds. I think using macros in this way is the best way of doing that. If we were to depend on compiler optimizations to eliminate bits in product builds, I think we should just make the reason parameter unconditional, rather than piggybacking on a field of PointsToNode. The compiler should see that it is unused on product builds. That seems even cleaner. But I think the intent is much clearer with the NOT_PRODUCT macro, since it's more obvious that this code will not be in product builds from the call site.
>>
>> I don't like the idea of splitting the reason string out of the parameter list either, since it requires callers to remember to also separately set the reason string. Having it as a parameter forces callers to think about it.
>>
>> An alternative idea is to declare new macros for setting the escape state and scalar replaceability like so:
>>
>> #ifndef PRODUCT
>> #define SET_ESCAPE_STATE(node, es, reason) set_escape_sate(node, es, reason)
>> #else
>> #define SET_ESCAPE_STATE(node, es, reason) set_escape_sate(node, es)
>> #endif
>>
>> Where the product version drops the reason string. But, I think this is also a bit too magic, and a bit worse than the current solution.
>>
>> Sorry, but I think I'd rather stick with what I have now.
>
> I agree with @JornVernee here.
fair enough.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7428
More information about the hotspot-compiler-dev
mailing list