RFR: 8367149: Add ergonomic construction for creating ad-hoc VMErrorCallback [v2]
Axel Boldt-Christmas
aboldtch at openjdk.org
Thu Sep 11 05:31:11 UTC 2025
On Wed, 10 Sep 2025 09:03:40 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> Axel Boldt-Christmas has updated the pull request incrementally with three additional commits since the last revision:
>>
>> - Add a comment explaining the deduction rules
>> - Skip multiple inheritance and allow more than lambda like callables.
>> - Update doc example
>
> 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`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27159#discussion_r2338631227
More information about the hotspot-dev
mailing list