On Thu, 17 Apr 2025 03:13:05 GMT, Nicole Xu <d...@openjdk.org> wrote:
>> The UnsafeOps JMH benchmark fails with the following error: >> >> ``` >> java.lang.IllegalAccessError: class >> org.openjdk.bench.sun.misc.UnsafeOps (in unnamed module @0x520a3426) cannot >> access class jdk.internal.misc.Unsafe (in module java.base) because module >> java.base does not export jdk.internal.misc to unnamed module @0x520a3426 >> ``` >> >> Since this micro-benchmark is created for `sun.misc.Unsafe` rather than >> `jdk.internal.misc.Unsafe`, we change it back as before JDK-8332744. >> >> Note that even it will raise "proprietary API" warnings after this >> patch, it is acceptable because the relevant APIs are bound for removal >> for the integrity of the platform. > > Nicole Xu 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 four additional commits since > the last revision: > > - Merge remote-tracking branch 'upstream/master' into JDK-8349944-add-args > > Change-Id: Ib60ccfc5d411f095d1c2fe6e8154a44529e84631 > - 8349944: [JMH] sun.misc.UnsafeOps cannot access class > jdk.internal.misc.Unsafe > > The UnsafeOps JMH benchmark fails with the following error: > > ``` > java.lang.IllegalAccessError: class > org.openjdk.bench.sun.misc.UnsafeOps (in unnamed module @0x520a3426) cannot > access class jdk.internal.misc.Unsafe (in module java.base) because module > java.base does not export jdk.internal.misc to unnamed module @0x520a3426 > ``` > > Since this micro-benchmark is created for `sun.misc.Unsafe` rather than > `jdk.internal.misc.Unsafe`, we change it back as before JDK-8332744. > > Note that even it will raise "proprietary API" warnings after this > patch, it is acceptable because the relevant APIs are bound for removal > for the integrity of the platform. > > Change-Id: Ia7c57c2ca09af4b2b3c6cc10ef4ae5a9f3c38a4c > - Revert "8349944: [JMH] sun.misc.UnsafeOps cannot access class > jdk.internal.misc.Unsafe" > > This reverts commit ebc32ae2c6e448075fedbdbb2b4879c43829c44b. > - 8349944: [JMH] sun.misc.UnsafeOps cannot access class > jdk.internal.misc.Unsafe > > The UnsafeOps JMH benchmark fails with the following error: > > ``` > java.lang.IllegalAccessError: class > org.openjdk.bench.sun.misc.UnsafeOps (in unnamed module @0x520a3426) cannot > access class jdk.internal.misc.Unsafe (in module java.base) because module > java.base does not export jdk.internal.misc to unnamed module @0x520a3426 > ``` > > To resolve this, we add the required `--add-opens` flag to grant access > for the benchmark. > > Change-Id: I30de213daa9160ee872a4364eb332dcd1636a9ac >>>@AlanBateman Can you review this if this patch looks good in principle? >> >> It needs confirmation that it doesn't break the build, I haven't looked into >> which parts of Liam's change weren't backed out. So if there are no build >> issues then it should be okay to integrate. > > All of the functional changes from JDK-8331081 and the redo got backed out, > the only thing that stayed was test coverage, so I wouldn't expect this to > break anything today. Yes. This PR doesn't break the build today as I tested locally. As for the build failure as mentioned by @cushon , I can reproduce the build failure in my local environment. 1. how to reproduce the failure It's important to note that we must revert the commit [1ab1c1d](https://github.com/openjdk/jdk/commit/1ab1c1d53b86228be85aac96fa5d69db39ac6317) firstly in order to reproduce the build failure. the code: this PR with commit 1ab1c1d reverted create the JMH bundle configure with --with-jmh=path/to/the/jmh/jar make images make test-image # <--- we encounter build error here 2. possible way to mitigate the failure As mentioned by @xyyNicole , new configure option `--disable-java-warnings-as-errors` is introduced recently in [7aeaa3c](https://github.com/openjdk/jdk/commit/7aeaa3c21c1420191fe8ff59e4cf99eae830754d). As I checked locally, the build failure is gone if we add this option. the code: this PR with commit 1ab1c1d reverted create the JMH bundle configure with --with-jmh=path/to/the/jmh/jar --disable-java-warnings-as-errors make images make test-image # <--- no build error now To be honest, I didn't fully understand [JDK-8349846](https://bugs.openjdk.org/browse/JDK-8349846). I was wondering if `--disable-java-warnings-as-errors` could help to address your concern about this PR. @cushon Here is my understanding for this PR: 1. As mentioned by @AlanBateman , "this micro was created for sun.misc.Unsafe, not jdk.internal.misc.Unsafe". We should keep this test intention as it was. 2. This PR doesn't break the build today. 3. As for the build error as mentioned by @cushon, it would be nice if `--disable-java-warnings-as-errors` can mitigate the error. If not, I agree with @liach that it's a different thing and out of the scope of this PR and we should handle it in a separate task. ------------- Marked as reviewed by haosun (Committer). PR Review: https://git.openjdk.org/jdk/pull/23686#pullrequestreview-2774494500