RFR (M): GRAAL-246: intrinsify Reflection.getCallerClass

Christian Thalinger christian.thalinger at oracle.com
Thu Apr 25 09:46:11 PDT 2013

[Resending because of missing CC.]

On Apr 25, 2013, at 3:42 AM, Andreas Woess <awx at gmx.at> wrote:

> In ReflectionGetCallerClassNode.getCallerClassNode(), case 0 is dead
> code (n starts at 1).

That's on purpose.  There are two (and now three) copies of this security sensitive code in HotSpot:

1)  JVM_GetCallerClass
2)  LibraryCallKit::inline_native_Reflection_getCallerClass
3)  ReflectionGetCallerClassNode.getCallerClassNode

When I reworked this code I tried to make the code as similar as possible to avoid future bugs.

There is a comment before the loop:

 67         // NOTE: Start the loop at depth 1 because the current frame state does
 68         // not include the Reflection.getCallerClass() frame.

and the exception which is really a should not reach here:

 73                     throw GraalInternalError.shouldNotReachHere("current frame state does not include the Reflection.getCallerClass frame");

I would like to keep it this way.

-- Chris

> - andreas
> On 25.04.2013 06:08, Christian Thalinger wrote:
>> [Now that the CallerSensitive changes have arrived in the jdk8 repository I finally had to time to finish this up.]
>> http://cr.openjdk.java.net/~twisti/GRAAL-246
>> GRAAL-246: intrinsify Reflection.getCallerClass
>> graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java
>> graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java
>> graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java
>> graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionSubstitutions.java
>> graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java
>> src/share/vm/graal/graalCompilerToVM.cpp
>> src/share/vm/graal/graalJavaAccess.hpp

More information about the graal-dev mailing list