On Wed, 18 May 2022 19:05:03 GMT, Dmitry Chuyko <dchu...@openjdk.org> wrote:
> On AArch64 it is sometimes convenient to have LSE atomics right from the > start. Currently they are enabled after feature detection and RR reverse > debugger works incorrectly. > > New build configuration feature 'hardlse' is added. If it is enabled for > aarch64 type of build, then statically compiled stubs replace the initial > pessimistic implementation and dynamically generated replacements (when LSE > support is detected). The feature works for builds of all debug levels. > > New file atomic_linux_aarch64_lse.S is derived from atomic_linux_aarch64.S > and inherits its copyright. This alternative static implementation > corresponds to the dynamically generated code. > > Note, this configuration part is necessary but not sufficient to fully avoid > strex instructions for practical purposes. Other parts are: > > * Run on the OS built without strex family instructions. E.g. Amazon Linux > 2022. > * Compile with outline atomics enabled and the configuration flag enabled. > E.g. configure with > --with-extra-cflags='-march=armv8.3-a+crc+crypto -moutline-atomics' > --with-extra-cxxflags='-march=armv8.3-a+crc+crypto -moutline-atomics' > --with-extra-ldflags='-Wl,--allow-multiple-definition' > --with-jvm-features=hardlse > > Testing: tier1, tier2 on linux-aarch64 release builds with feature off and > feature on. Configure files need a bit more work. make/autoconf/jvm-features.m4 line 47: > 45: ifdef([custom_jvm_features_valid], custom_jvm_features_valid) \ > 46: \ > 47: cds compiler1 compiler2 dtrace epsilongc g1gc hardlse jfr jni-check \ The feature should be named `hard-lse` to match the `HARD_LSE` define in Hotspot code. (Also, it improves readability.) make/autoconf/jvm-features.m4 line 442: > 440: JVM_FEATURES_VARIANT_FILTER="link-time-opt opt-size" > 441: fi > 442: # Filter out hardlse feature by default You should not set up a PLATFORM filter in `JVM_FEATURES_PREPARE_VARIANT`. In fact, you will need a `JVM_FEATURES_CHECK_HARD_LSE`, which verifies that it can only be enabled on aarch64. See e.g. `JVM_FEATURES_CHECK_JVMCI` foor inspiration on how to write this and where to call it. I suggest you set up `JVM_FEATURES_PLATFORM_FILTER` in that function as well. ------------- Changes requested by ihse (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/8779