On Tue, 11 Jun 2024 02:10:46 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
>> Can I please get a review of this test-only change which fixes an issue that >> was introduced due to the refactoring that we did in >> https://bugs.openjdk.org/browse/JDK-8333130? This PR addresses the failure >> reported in https://bugs.openjdk.org/browse/JDK-8333756. >> >> The `NativeMethodPrefixApp` test uses a `javaagent` >> `NativeMethodPrefixAgent` which modifies the name of the native methods >> using the `java.lang.instrument.Instrumentation` instance: >> >> public static void premain (String agentArgs, Instrumentation instArg) { >> inst = instArg; >> System.out.println("Premain"); >> >> ... >> instArg.setNativeMethodPrefix(t0, "wrapped_tr0_"); >> instArg.setNativeMethodPrefix(t1, "wrapped_tr1_"); >> instArg.setNativeMethodPrefix(t2, "wrapped_tr2_"); >> >> >> The Hotspot VM allows for methods on a class to be annotated with an (VM >> internal) `jdk.internal.vm.annotation.IntrinsicCandidate` annotation. When a >> class that contains any methods that are annotated with >> `@IntrinsicCandidate` is loaded, the VM checks that the corresponding >> method(s) have an intrinsic available. It uses the method name to check for >> the presence of the intrinsic. In the absence of an intrinsic for a >> `@IntrinsicCandidate` method, the VM throws an error and exits. This >> behaviour is controlled by the `-XX:+/-CheckIntrinsics` option. By default >> that option is enabled, implying that an error will be thrown if the >> intrinsic isn't found. >> >> In the case where/when this test fails, it so happens that the JVM loads a >> class which has a `@IntrinsicCandidate` on a `native` Java method. For >> example, on the failing host, I could see this class loading sequence: >> >> >> tr2: Loading java/util/Date >> tr1: Loading java/util/Date >> tr0: Loading java/util/Date >> tr2: Loading sun/util/calendar/CalendarSystem >> tr1: Loading sun/util/calendar/CalendarSystem >> tr0: Loading sun/util/calendar/CalendarSystem >> tr2: Loading sun/util/calendar/CalendarSystem$GregorianHolder >> tr1: Loading sun/util/calendar/CalendarSystem$GregorianHolder >> tr0: Loading sun/util/calendar/CalendarSystem$GregorianHolder >> ... >> tr2: Loading sun/util/calendar/ZoneInfoFile$Checksum >> tr1: Loading sun/util/calendar/ZoneInfoFile$Checksum >> tr0: Loading sun/util/calendar/ZoneInfoFile$Checksum >> tr2: Loading java/util/zip/Checksum >> tr1: Loading java/util/zip/Checksum >> tr0: Loading java/util/zip/Checksum >> tr2: Loading java/util/zip/CRC32 >> tr1: Loading java/util/zip/CRC32 >> tr0: Loading java/util/zip/CRC32 >> Method [java.util.zi... > > Jaikiran Pai has updated the pull request incrementally with one additional > commit since the last revision: > > update code comment Marked as reviewed by cjplummer (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/19595#pullrequestreview-2109149823