> This PR reduces the amount of code executed during libgraal initialization.
> This not only improves VM startup overall but all fixes a number of JDK test
> failures that are caused by Java code executing "too early". For example,
> `java/util/Locale/CompatWarning.java` can fail if
> `sun.util.locale.provider.LocaleProviderAdapter` is initialized before the
> `CheckWarning` handler is registered.
>
> Instead of serializing `VM.savedProps` via
> `VMSupport.serializeSavedPropertiesToByteArray`, the
> `jdk.vm.ci.services.Services` class now directly reads
> `Arguments::system_properties()` using `Unsafe`. Furthermore, the value of a
> system property is lazily converted to a `String` from a C string pointer.
>
> ## 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 ...
Doug Simon has updated the pull request with a new target base due to a merge
or a rebase. The incremental webrev excludes the unrelated changes brought in
by the merge/rebase. The pull request contains six additional commits since the
last revision:
- [skip-ci] Merge remote-tracking branch 'openjdk-jdk/master' into JDK-8309390
- [skip-ci] remove debug code
- fix copyright dates
- fix reference in comments
- reduced complexity of SystemProperties based on it being unmodifiable
- copy system properties into libgraal more efficiently
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/14291/files
- new: https://git.openjdk.org/jdk/pull/14291/files/6c346d35..15a07e98
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=14291&range=04
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=14291&range=03-04
Stats: 3104 lines in 166 files changed: 1842 ins; 420 del; 842 mod
Patch: https://git.openjdk.org/jdk/pull/14291.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14291/head:pull/14291
PR: https://git.openjdk.org/jdk/pull/14291