On Mon, 11 Aug 2025 10:55:44 GMT, Francesco Andreuzzi <d...@openjdk.org> wrote:
> In this PR I add an `autoconfigure` check to make sure that `jfr` is not > built without the feature `services`, which would lead to the following error: > > /jdk/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp: In member function > ‘virtual void VM_GC_SendObjectCountEvent::doit()’: > /jdk/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp:402:5: error: > ‘ObjectCountEventSender’ has not been declared > 402 | ObjectCountEventSender::enable_requestable_event(); > | ^~~~~~~~~~~~~~~~~~~~~~ > /jdk/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp:404:5: error: > ‘ObjectCountEventSender’ has not been declared > 404 | ObjectCountEventSender::disable_requestable_event(); > | ^~~~~~~~~~~~~~~~~~~~~~ > > > To reproduce: > > sh configure --with-jvm-variants=custom --with-conf-name=cstm > --enable-jvm-feature-jfr --enable-jvm-feature-serialgc > make -j hotspot CONF_NAME=cstm I think it is not that simple, unfortunately. I tried changing the ifdef but ran into additional issues. In gcTrace.cpp we have: virtual void do_cinfo(KlassInfoEntry* entry) { if (should_send_event(entry)) { ObjectCountEventSender::send(entry, _timestamp); } } private: bool should_send_event(const KlassInfoEntry* entry) const { double percentage_of_heap = ((double) entry->words()) / _total_size_in_words; return percentage_of_heap >= _size_threshold_percentage; } which requires KlassInfoEntry (defined in src/hotspot/share/memory/heapInspection.hpp). When I tried to change that ifdef to INCLUDE_JFR, building with the `jfr` feature succeeded, but building with `services` failed. So it seems there is some shared code here. Either heapInspection needs to be included if either `jfr` or `services` are enabled, or we should go the route of this PR and say that JFR is dependent on services. I think the latter seems cleaner. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26723#issuecomment-3175002573