On Tue, 5 May 2026 13:29:23 GMT, Andrew Dinn <[email protected]> wrote:

>> Improve startup and warmup time by making optimized native code for an 
>> application instantly available when the HotSpot Java Virtual Machine 
>> starts. Achieve this by compiling application code to native code in a 
>> training run, storing the native code in the [AOT 
>> cache](https://openjdk.org/jeps/483#Description) for use in subsequent 
>> production runs.
>> 
>> More details in the [JEP](https://openjdk.org/jeps/544).
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/hotspot/share/code/aotCodeCache.cpp line 2056:
> 
>> 2054:     log_info(aot, codecache, nmethod)("%d (L%d) '%s' AOT%s is skipped: 
>> method is not in AOT cache",
>> 2055:              compile_id(), comp_level(), 
>> method->name_and_sig_as_C_string(), (for_preload ? " preload" : ""));
>> 2056:     assert(AOTCacheAccess::can_generate_aot_code(method), "sanity");
> 
> Why do we assert the opposite of the condition that led us into this branch 
> and then return nullptr? If we intend to fail then surely we should be 
> calling ShouldNotReachHere()

In production VM I want just skip this method. In debug VM I want assert. I 
could use `assert(false)` but it is not informative. So I used positive 
condition which guarantee fail because of condition above.

> src/hotspot/share/code/aotCodeCache.cpp line 2066:
> 
>> 2064:              compile_id(), comp_level(), 
>> method->name_and_sig_as_C_string(),
>> 2065:              (for_preload ? " preload" : ""), 
>> holder->class_loader_data()->loader_name());
>> 2066:     assert(builtin_loader, "sanity");
> 
> Same question as above: ShouldNotReachHere()?

same

> src/hotspot/share/code/aotCodeCache.cpp line 3524:
> 
>> 3522:   
>> ADD_EXTERNAL_ADDRESS(MountUnmountDisabler::global_vthread_transition_disable_count_address());
>> 3523: 
>> 3524: #if INCLUDE_JFR
> 
> In libraryKit we create a few raw pointer constants
> 
>     makecon(TypeRawPtr::make(<address_expr>));
> 
> which don't seem to have a corresponding `ADD_EXTERNAL_ADDRESS`:
> 
> src/hotspot/share/opto/library_call.cpp:3086:
>     Node* epoch_address = 
> makecon(TypeRawPtr::make(JfrIntrinsicSupport::epoch_address()));
> 
> src/hotspot/share/opto/library_call.cpp:3120:
>     Node* signaled_flag_address = 
> makecon(TypeRawPtr::make(JfrIntrinsicSupport::signal_address()));
> 
> src/hotspot/share/opto/library_call.cpp:3375:
>   Node* global_addr = makecon(TypeRawPtr::make((address)&VMContinuations));
> 
> src/hotspot/share/opto/library_call.cpp:3403:
>   Node* epoch_generation_address = 
> makecon(TypeRawPtr::make(JfrIntrinsicSupport::epoch_generation_address()));
> 
> I believe they all relate to JFR. Is there a reason to exclude them?

But there is no call to `inline_native_classID()` from 
`LibraryCallKit::try_to_inline()`.  And `C2Compiler::is_intrinsic_supported()` 
does not list it. Seems bug in implementation: 
https://github.com/openjdk/jdk/pull/3470/changes

`_getEventWriter` is there but I am not sure it is used.

There is test `‎test/jdk/jdk/jfr/jvm/TestJFRIntrinsic.java` but we don't 
directly create AOT cache for it - we use pre-generated cache to run it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30778#discussion_r3203335027
PR Review Comment: https://git.openjdk.org/jdk/pull/30778#discussion_r3203337345
PR Review Comment: https://git.openjdk.org/jdk/pull/30778#discussion_r3204466000

Reply via email to