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

Reply via email to