<div dir="ltr">Here is the issue for mainline: <a href="https://bugs.openjdk.org/browse/JDK-8335921">https://bugs.openjdk.org/browse/JDK-8335921</a><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">- Ashutosh Mehra</div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 8, 2024 at 2:10 PM Vladimir Kozlov <<a href="mailto:vladimir.kozlov@oracle.com">vladimir.kozlov@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Ashutosh, please file bug for mainline hotspot/jvmti component.<br>
<br>
Thanks,<br>
Vladimir K<br>
<br>
On 7/8/24 9:43 AM, Ashutosh Mehra wrote:<br>
> Hi Sanne,<br>
> For the record I am able to recreate this issue if I create a custom variant and omit jvmti feature using the following <br>
> configure command:<br>
> <br>
> bash ./configure --with-conf-name=no-jvmti-release <br>
> --with-jvm-features=cds,compiler1,compiler2,g1gc,serialgc,jfr,jni-check,jvmci,management,services --with-jvm-variants=custom<br>
> <br>
> I tried to fix it by enclosing the code in SCCache.cpp with INCLUDE_JVMTI but the build failed again in premain specific <br>
> code with this error:<br>
> <br>
> /home/asmehra/data/ashu-mehra/leyden/src/hotspot/share/interpreter/interpreterRuntime.cpp:1804:23: error: <br>
> ‘_perf_InterpreterRuntime_member_name_arg_or_null_timer’ was not declared in this scope; did you mean <br>
> ‘_perf_InterpreterRuntime_prepare_native_call_timer’?<br>
>   1804 |   NEWPERFTICKCOUNTERS(_perf_##sub##_##name##_timer, SUN_CI, #sub "::" #name); \<br>
>        |                       ^~~~~~<br>
> /home/asmehra/data/ashu-mehra/leyden/src/hotspot/share/runtime/perfData.hpp:854:4: note: in definition of macro <br>
> ‘NEWPERFTICKCOUNTERS’<br>
>    854 |   {counter = PerfDataManager::create_tick_counters(counter_ns, counter_name, counter_name "_elapsed_time", \<br>
>        |    ^~~~~~~<br>
> /home/asmehra/data/ashu-mehra/leyden/src/hotspot/share/interpreter/interpreterRuntime.cpp:1798:3: note: in expansion of <br>
> macro ‘INIT_COUNTER’<br>
>   1798 |   macro(InterpreterRuntime, member_name_arg_or_null)<br>
>        |   ^~~~~<br>
> /home/asmehra/data/ashu-mehra/leyden/src/hotspot/share/interpreter/interpreterRuntime.cpp:1812:5: note: in expansion of <br>
> macro ‘DO_JVMTI_COUNTERS’<br>
>   1812 |     DO_JVMTI_COUNTERS(INIT_COUNTER)<br>
>        |     ^~~~~~~~~~~~~~~~~<br>
> <br>
> I worked around it and it next failed with following errors:<br>
> <br>
> /usr/bin/ld: <br>
> /home/asmehra/data/ashu-mehra/leyden/build/premain-release/hotspot/variant-custom/libjvm/objs/jfrJvmtiAgent.o: in <br>
> function `JvmtiUtil::error_name(int)':<br>
> make/hotspot/src/hotspot/share/prims/jvmtiUtil.hpp:51: undefined reference to `JvmtiUtil::_error_names'<br>
> /usr/bin/ld: <br>
> /home/asmehra/data/ashu-mehra/leyden/build/premain-release/hotspot/variant-custom/libjvm/objs/jfrJvmtiAgent.o: in <br>
> function `JvmtiEnvBase::get_phase()':<br>
> make/hotspot/src/hotspot/share/prims/jvmtiEnvBase.hpp:77: undefined reference to `JvmtiEnvBase::_phase'<br>
> /usr/bin/ld: <br>
> /home/asmehra/data/ashu-mehra/leyden/build/premain-release/hotspot/variant-custom/libjvm/objs/jfrPeriodic.o: in function <br>
> `JfrPeriodicEventSet::requestJavaAgent()':<br>
> make/hotspot/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp:294: undefined reference to `JvmtiAgentList::java_agents()'<br>
> /usr/bin/ld: <br>
> /home/asmehra/data/ashu-mehra/leyden/build/premain-release/hotspot/variant-custom/libjvm/objs/jfrPeriodic.o: in function <br>
> `JfrPeriodicEventSet::requestNativeAgent()':<br>
> make/hotspot/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp:314: undefined reference to `JvmtiAgentList::native_agents()'<br>
> /usr/bin/ld: make/hotspot/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp:316: undefined reference to <br>
> `JvmtiAgentList::xrun_agents()'<br>
> /usr/bin/ld: <br>
> /home/asmehra/data/ashu-mehra/leyden/build/premain-release/hotspot/variant-custom/libjvm/objs/jvmciCompilerToVMInit.o: <br>
> in function `CompilerToVM::Data::initialize(JVMCIEnv*)':<br>
> make/hotspot/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp:212: undefined reference to <br>
> `JvmtiExport::_should_notify_object_alloc'<br>
> collect2: error: ld returned 1 exit status<br>
> <br>
> This is not specific to premain, and I can reproduce it with mainline as well. It doesn't look like it is <br>
> straightforward to remove the jvmti feature. Seems like there may be other components (like jfr) missing INCLUDE_JVMTI <br>
> macro.<br>
> My suggestion, if you are interested in pursuing it further, would be to try and wrinkle out the problems with the <br>
> mainline first.<br>
> <br>
> Meanwhile I will push the changes to use INCLUDE_JVMTI in the premain specific code.<br>
> <br>
> - Ashutosh Mehra<br>
> <br>
> <br>
> On Mon, Jul 8, 2024 at 11:17 AM Ashutosh Mehra <<a href="mailto:asmehra@redhat.com" target="_blank">asmehra@redhat.com</a> <mailto:<a href="mailto:asmehra@redhat.com" target="_blank">asmehra@redhat.com</a>>> wrote:<br>
> <br>
>     Hi Sanne, thanks for reporting this. It looks like a bug. It can be fixed by enclosing the relevant code under the<br>
>     "INCLUDE_JVMTI" macro.<br>
> <br>
>     - Ashutosh Mehra<br>
> <br>
> <br>
>     On Mon, Jul 8, 2024 at 9:58 AM Sanne Grinovero <<a href="mailto:sanne@redhat.com" target="_blank">sanne@redhat.com</a> <mailto:<a href="mailto:sanne@redhat.com" target="_blank">sanne@redhat.com</a>>> wrote:<br>
> <br>
>         Hello all,<br>
> <br>
>         I'm experimenting building Leyden locally with non-default configurations, with the intent of comparing its<br>
>         potential as an alternative to GraalVM native-images, and one of my goals would be to produce a minimal JVM<br>
>         build which exclusively includes the components that our applications are going to need at runtime.<br>
> <br>
>         This implies being very selective with the JVM features I choose at configuration time; I've already opened some<br>
>         minor issues identified during such experiments.<br>
> <br>
>         Today I noticed today that if I exclude the "jvmti" feature, the premain branch of Leyden doesn't compile:<br>
> <br>
> <br>
>         === Output from failing command(s) repeated here ===<br>
>         * For target hotspot_variant-custom_libjvm_objs_SCCache.o:<br>
>         /home/sanne/sources/leyden/src/hotspot/share/code/SCCache.cpp: In member function ‘void<br>
>         SCAddressTable::init_opto()’:<br>
>         /home/sanne/sources/leyden/src/hotspot/share/code/SCCache.cpp:3815:39: error: ‘notify_jvmti_vthread_start’ is<br>
>         not a member of ‘OptoRuntime’<br>
>           3815 |   SET_ADDRESS(_C2_blobs, OptoRuntime::notify_jvmti_vthread_start());<br>
>                |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~<br>
>         /home/sanne/sources/leyden/src/hotspot/share/code/SCCache.cpp:3511:47: note: in definition of macro ‘SET_ADDRESS’<br>
>           3511 |     type##_addr[type##_length++] = (address) (addr);      \<br>
>                |                                               ^~~~<br>
>         /home/sanne/sources/leyden/src/hotspot/share/code/SCCache.cpp:3816:39: error: ‘notify_jvmti_vthread_end’ is not<br>
>         a member of ‘OptoRuntime’<br>
>           3816 |   SET_ADDRESS(_C2_blobs, OptoRuntime::notify_jvmti_vthread_end());<br>
>                |                                       ^~~~~~~~~~~~~~~~~~~~~~~~<br>
>         /home/sanne/sources/leyden/src/hotspot/share/code/SCCache.cpp:3511:47: note: in definition of macro ‘SET_ADDRESS’<br>
>           3511 |     type##_addr[type##_length++] = (address) (addr);      \<br>
>                |                                               ^~~~<br>
>         /home/sanne/sources/leyden/src/hotspot/share/code/SCCache.cpp:3817:39: error: ‘notify_jvmti_vthread_mount’ is<br>
>         not a member of ‘OptoRuntime’<br>
>           3817 |   SET_ADDRESS(_C2_blobs, OptoRuntime::notify_jvmti_vthread_mount());<br>
>                |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~<br>
>         /home/sanne/sources/leyden/src/hotspot/share/code/SCCache.cpp:3511:47: note: in definition of macro ‘SET_ADDRESS’<br>
>           3511 |     type##_addr[type##_length++] = (address) (addr);      \<br>
>                |                                               ^~~~<br>
>         /home/sanne/sources/leyden/src/hotspot/share/code/SCCache.cpp:3818:39: error: ‘notify_jvmti_vthread_unmount’ is<br>
>         not a member of ‘OptoRuntime’<br>
>           3818 |   SET_ADDRESS(_C2_blobs, OptoRuntime::notify_jvmti_vthread_unmount());<br>
>                |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
>         /home/sanne/sources/leyden/src/hotspot/share/code/SCCache.cpp:3511:47: note: in definition of macro ‘SET_ADDRESS’<br>
>           3511 |     type##_addr[type##_length++] = (address) (addr);      \<br>
>                |                                               ^~~~<br>
>             ... (rest of output omitted)<br>
> <br>
>         I'm wondering if I should open an issue for this case? I appreciate it's early days and that such aspects might<br>
>         not be a priority currently!<br>
> <br>
>         Thanks,<br>
>         Sanne<br>
> <br>
<br>
</blockquote></div>