RFR: 8309390: [JVMCI] improve copying system properties into libgraal [v2]

Doug Simon dnsimon at openjdk.org
Wed Jun 7 22:56:23 UTC 2023


On Wed, 7 Jun 2023 22:51:48 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

>> This PR improves the startup time for libgraal by speeding up how `VM.savedProps` is copied into libgraal. This data structure is now serialized to a native buffer directly from C++ and the native buffer is then directly decoded by libgraal.
>> 
>> ## Times
>> 
>> The basic benchmarking below shows that this change brings the time for a nop Java app with eager libgraal initialization (2) down to almost the same time as lazy libgraal initialization (1). The latter typically means no libgraal initialization happens as a top tier JIT compilation is never scheduled in such a short running app.
>> 
>> 
>> public class Nop {
>>     public static void main(String[] args) {}
>> }
>> 
>> 
>> (1) Baseline (no options):
>> 
>>> for i in (seq 10); java Nop; end
>>         0.05 real         0.04 user         0.01 sys
>>         0.04 real         0.03 user         0.01 sys
>>         0.04 real         0.03 user         0.01 sys
>>         0.04 real         0.03 user         0.01 sys
>>         0.03 real         0.03 user         0.00 sys
>>         0.04 real         0.03 user         0.01 sys
>>         0.04 real         0.03 user         0.00 sys
>>         0.03 real         0.03 user         0.00 sys
>>         0.04 real         0.03 user         0.01 sys
>>         0.03 real         0.03 user         0.00 sys
>> 
>> 
>> (2) Eagerly initialize libgraal (with PR):
>> 
>>> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end
>>         0.06 real         0.04 user         0.01 sys
>>         0.05 real         0.03 user         0.01 sys
>>         0.05 real         0.03 user         0.01 sys
>>         0.05 real         0.03 user         0.01 sys
>>         0.05 real         0.03 user         0.01 sys
>>         0.05 real         0.03 user         0.01 sys
>>         0.05 real         0.03 user         0.01 sys
>>         0.05 real         0.03 user         0.01 sys
>>         0.05 real         0.03 user         0.01 sys
>>         0.05 real         0.03 user         0.01 sys
>> 
>> 
>> (3) Eagerly initialize libgraal (without PR):
>> 
>>> for i in (seq 10); /usr/bin/time java -XX:+EagerJVMCI Nop; end
>>         0.11 real         0.08 user         0.02 sys
>>         0.08 real         0.06 user         0.01 sys
>>         0.08 real         0.07 user         0.01 sys
>>         0.10 real         0.07 user         0.01 sys
>>         0.08 real         0.06 user         0.01 sys
>>         0.10 real         0.07 user         0.01 sys
>>         0.08 real         0.07 user         0.01 sys
>>         0.08 real     ...
>
> Doug Simon has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
> 
>  - [skip ci] snapshot Arguments::system_properties() in JVMCI instead of System.savedProps
>  - more efficient copying of system properties into libjvmci

src/hotspot/share/jvmci/jvmciJavaClasses.hpp line 60:

> 58:                          jvmci_constructor) \
> 59:   start_class(Services, jdk_vm_ci_services_Services)                                                          \
> 60:     jvmci_method(CallStaticVoidMethod, GetStaticMethodID, call_static, void, Services, initializeSavedProperties, byte_array_void_signature, (JVMCIObject serializedProperties)) \

The final arg for the `jvmci_method` macro is never used so I removed it everywhere.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14291#discussion_r1222257086


More information about the hotspot-dev mailing list