RFR: 8334492: DiagnosticCommands (jcmd) should accept %p in output filenames and substitute PID [v5]

Thomas Stuefe stuefe at openjdk.org
Sun Jul 21 10:11:31 UTC 2024


On Sun, 21 Jul 2024 08:55:35 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> @jdksjolen 
>> 
>>> Also, @SoniaZaldana, would you mind changing the code to this 
>> 
>> Even simpler (did not test, but you get my drift):
>> 
>> 
>> #define ALL_TYPES_DO_XX(what) \
>>   what(char*, "STRING") \
>>   what(NanoTimeArgument, NANOTIME) \
>>   what(jlong, "JLONG") 
>> ... etc
>> 
>> then
>> 
>> 
>> #define XX(TYPE, NAME) \
>> if (strcmp(type, NAME) == 0) { \
>>     DCmdArgument<TYPE>* argument = new DCmdArgument<TYPE>(name, desc, NAME, mandatory, mandatory, default_value); \
>> }
>> ALL_TYPES_DO_XX(XX)
>> #undef XX
>> 
>> 
>> ;-)
>
> Sonia, my bad if you already know this stuff but since it's fairly esoteric knowledge nowadays I'd like to help you out in advance: Thomas is proposing the usage of a X macro https://en.wikipedia.org/wiki/X_macro
> 
> These can be found throughout Hotspot, you can find an example definition and usage in `logTag.hpp` and `logTag.cpp`.

@SoniaZaldana Note that this is very much optional.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20198#discussion_r1685701779


More information about the hotspot-dev mailing list