RFR(XXS): 8151100: Test java/lang/instrument/NativeMethodPrefixAgent.java can't attempt to do CheckIntrinsics

Markus Gronlund markus.gronlund at oracle.com
Thu Mar 3 10:48:36 UTC 2016


Thank you Serguei!

 

Markus

 

From: Serguei Spitsyn 
Sent: den 3 mars 2016 10:18
To: Markus Gronlund; serviceability-dev at openjdk.java.net
Subject: Re: RFR(XXS): 8151100: Test java/lang/instrument/NativeMethodPrefixAgent.java can't attempt to do CheckIntrinsics

 

Hi Markus,

The fix looks good.

Thanks,
Serguei


On 3/2/16 16:15, Markus Gronlund wrote:

Greetings,

 

Could a please ask for reviews for the following simple fix to resolve a test issue associated with test/java/lang/instrument/NativeMethodPrefixAgent.java

 

Bug: https://bugs.openjdk.java.net/browse/JDK-8151100 

 

Webrev/diff:

 

diff --git a/test/java/lang/instrument/NativeMethodPrefixAgent.java b/test/java/lang/instrument/NativeMethodPrefixAgent.java

--- a/test/java/lang/instrument/NativeMethodPrefixAgent.java

+++ b/test/java/lang/instrument/NativeMethodPrefixAgent.java

@@ -31,7 +31,7 @@

  *          java.management

  *          java.instrument

  * @run shell/timeout=240 MakeJAR2.sh NativeMethodPrefixAgent NativeMethodPrefixApp 'Can-Retransform-Classes: true' 'Can-Set-Native-Method-Prefix: true'

- * @run main/othervm -javaagent:NativeMethodPrefixAgent.jar NativeMethodPrefixApp

+ * @run main/othervm -XX:-CheckIntrinsics -javaagent:NativeMethodPrefixAgent.jar NativeMethodPrefixApp

  */

 import java.lang.instrument.*;

 

Description:

 

The java/lang/instrument/NativeMethodPrefixAgent.java modifies (wraps) the names of native methods.

If a class is loaded that contain the @HotSpotIntrinsicCandidate annotation on a native method, one step of the class file parser is an attempt to validate the method name against a registered intrinsic in the VM.

 

By default, the flag CheckIntrinsics is true, which will yield:

 

"Method [<class>.wrapped_tr0_wrapped_tr1_wrapped_tr2_<original_method_name>()<return>] is annotated with @HotSpotIntrinsicCandidate, but no compiler intrinsic is defined for the method. Exiting."

This "wrapped" prepending to the method name invalidates the intrinsic check. 

 

In order for the test to pass even when loading a class with a native method containing the @HotSpotIntrinsicCandidate annotation, the test should explicitly disable the CheckIntrinsics flag: 

 

-XX:-CheckIntrinsics

 

Thanks in advance

Markus

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20160303/eb0d9f78/attachment-0001.html>


More information about the serviceability-dev mailing list