RFR (S): 7196277: JSR 292: Two jck/runtime tests crash on java.lang.invoke.MethodHandle.invokeExact

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu May 2 19:32:02 PDT 2013


Add comments for new MH_*_UOE explaining how they used. Did we call them 
as native functions and on return process the exception as they 
currently do but with NULL returned value to avoid crush?

About comment in sharedRuntime.cpp. How about this?:

The exception is then caught and forwarded on the return from lookup() 
call and before the call to a native function.

Thanks,
Vladimir

On 5/2/13 6:10 PM, Christian Thalinger wrote:
>
> On Apr 29, 2013, at 7:26 PM, Christian Thalinger <christian.thalinger at oracle.com> wrote:
>
>> Withdrawn.  There might be a better way to do it.  -- Chris
>
> Like this:
>
> http://cr.openjdk.java.net/~twisti/7196277/
>
> The fix is to resurrect the original throwing code and not overwrite already registered native entries when linking methods.
>
> -- Chris
>
>>
>> On Apr 29, 2013, at 5:36 PM, Christian Thalinger <christian.thalinger at oracle.com> wrote:
>>
>>> http://cr.openjdk.java.net/~twisti/7196277
>>>
>>> 7196277: JSR 292: Two jck/runtime tests crash on java.lang.invoke.MethodHandle.invokeExact
>>> Reviewed-by:
>>>
>>> The problem is the logic in InterpreterGenerator::generate_native_entry: it checks for an oop return value and tries to unbox it before pending exceptions are thrown.
>>>
>>> If throw_unsupported_operation_exception (which is a void method!) is called for a native method that has an oop return type the native entry tries to unbox the value in the return register. Which happens to be okay for debug builds but for product builds contains a random value and that crashes the VM.
>>>
>>> The fix is to not install a native entry point to eventually throw the exception when being called but throw the UnsupportedOperationException in NativeLookup::lookup.
>>>
>>> This patch also hardens throw_unsatisfied_link_error to find a similar issue more easily in the future.
>>>
>>> src/share/vm/prims/nativeLookup.cpp
>>> src/share/vm/runtime/sharedRuntime.cpp
>>>
>>
>


More information about the hotspot-compiler-dev mailing list