RFR: 8367149: Add ergonomic construction for creating ad-hoc VMErrorCallback [v2]
Stefan Karlsson
stefank at openjdk.org
Thu Sep 11 06:51:18 UTC 2025
On Thu, 11 Sep 2025 05:27:53 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> src/hotspot/share/utilities/vmError.hpp line 254:
>>
>>> 252: };
>>> 253:
>>> 254: // Ergonomic construction for creating ad-hoc VMErrorCallback which automatically
>>
>> Does `Ergonomic construction` have specific meanings in cpp/this context? If not, I wonder if `lightweight` is clearer, as it is less technical.
>
> Not that I know of.
>
> I ment it to mean that this is type with makes it ergonomic (as in, efficient and comfortable) to create an ad-hoc VMErrorCallback. So rather than having to do something like:
> ```C++
> struct AdHocVMErrorCallback : public VMErrorCallback {
> ThisType& _instance;
> ValueType _value;
>
> AdHocVMErrorCallback(ThisType& instance)
> : _instance(instance),
> _value(_instance.get_important_value) {}
>
> void call(outputStream* st) final {
> // Dump the important bits.
> st->print("Prior value: ");
> _value.print_on(st);
> st->print("During crash: ")
> _instance.get_the_value().print_on(st);
> // Dump whole the whole state.
> _instance.print_on(st);
> }
> } on_error(*this);
>
> you can use this construction with a lambda.
>
> Not sure if lightweight capture I intended to convey, but it also seems like `Ergonomic construction` missed the mark. Maybe just call it `A construction for creating ad-hoc VMErrorCallback`
Maybe `convenient` would be an apt word here?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27159#discussion_r2338932845
More information about the hotspot-dev
mailing list