Some of j.l.Math::* functions can't be redefined (dynamically instrumented): is it expected?

Daniel D. Daugherty daniel.daugherty at oracle.com
Tue Apr 30 07:00:33 PDT 2013


Vladimir,

Adding the Serviceability Team to the thread also.

Dan


On 4/30/13 7:17 AM, Vladimir Ivanov wrote:
> Hi,
>
> I stumbled upon a fact that some of Math.* functions, though they are 
> written in Java, can't be instrumented/redefined (using 
> j.l.i.Instrumentation or JVMTI RedefineClasses).
>
> Looking at the code, I see that the interpreter handles such functions 
> specially:
> src/share/vm/interpreter/interpreter.cpp:
> ...
> 184 AbstractInterpreter::MethodKind 
> AbstractInterpreter::method_kind(methodHandle m) {
> ...
> 228   switch (m->intrinsic_id()) {
> 229     case vmIntrinsics::_dsin  : return java_lang_math_sin  ;
> ...
>
> but
>
> src/share/classes/java/lang/Math.java:
> ...
> 138    public static double sin(double a) {
> 139        return StrictMath.sin(a); // default impl. delegates to 
> StrictMath
> 140    }
> ...
>
> and
>
> src/share/classes/java/lang/StrictMath.java:
> ...
> 110     public static native double sin(double a);
> ...
>
> Shouldn't StrictMath counterparts be intrinsified instead? At least, 
> when class redefinition is allowed.
> Best regards,
> Vladimir Ivanov



More information about the hotspot-runtime-dev mailing list