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

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Apr 30 06:17:15 PDT 2013


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