From 41c88bc395ab8c927bcafca9dc6c8a77de72dfc7 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Tue, 11 Jun 2024 03:48:03 +0000 Subject: [PATCH] 8333756: java/lang/instrument/NativeMethodPrefixApp.java failed due to missing intrinsic Reviewed-by: amenkov, cjplummer --- test/jdk/java/lang/instrument/NativeMethodPrefixApp.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java b/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java index 5060e67ca87..65cc54793cb 100644 --- a/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java +++ b/test/jdk/java/lang/instrument/NativeMethodPrefixApp.java @@ -25,6 +25,7 @@ import java.io.File; import java.nio.file.Path; import java.lang.management.*; +import java.util.zip.CRC32; import bootreporter.*; import jdk.test.lib.helpers.ClassFileInstaller; @@ -96,6 +97,10 @@ public class NativeMethodPrefixApp implements StringIdCallback { final OutputAnalyzer oa = ProcessTools.executeTestJava( "--enable-preview", // due to usage of ClassFile API PreviewFeature in the agent "-javaagent:" + agentJar.toString(), + // We disable CheckIntrinsic because the NativeMethodPrefixAgent modifies + // the native method names, which then causes a failure in the VM check + // for the presence of an intrinsic on a @IntrinsicCandidate native method. + "-XX:+UnlockDiagnosticVMOptions", "-XX:-CheckIntrinsics", NativeMethodPrefixApp.class.getName()); oa.shouldHaveExitValue(0); // make available stdout/stderr in the logs, even in case of successful completion @@ -109,6 +114,10 @@ public class NativeMethodPrefixApp implements StringIdCallback { java.lang.reflect.Array.getLength(new short[5]); RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean(); System.err.println(mxbean.getVmVendor()); + // Simply load a class containing an @IntrinsicCandidate on a native method + // to exercise the VM code which verifies the presence of the intrinsic + // implementation for that method. + System.err.println(new CRC32()); NativeMethodPrefixAgent.checkErrors();