RFR: 8264711: More runtime TRAPS cleanups
David Holmes
david.holmes at oracle.com
Mon Apr 5 23:42:43 UTC 2021
On 6/04/2021 5:14 am, Patricio Chilano Mateo wrote:
> src/hotspot/share/prims/jni.cpp line 2738:
>
>> 2736:
>> 2737: Handle obj(THREAD, JNIHandles::resolve_non_null(jobj));
>> 2738: ObjectSynchronizer::jni_exit(THREAD->as_Java_thread(), obj());
>
> Here we would return JNI_ERR if we throw IMSE from jni_exit().
Strictly speaking we probably should return JNI_ERR in that case, but
the spec (as usual) is non-specific about the relationship between error
codes and throwing exceptions. I would not suggest making such a change
now. Note that we would have to be careful to only return JNI_ERR in the
single case of IMSE, and even then we would have to be certain that the
IMSE came from the actual "exit" and not e.g.
err = MonitorEnter(obj);
...
throwIMSE()
...
err = MonitorExit(obj)
Cheers,
David
> src/hotspot/share/runtime/synchronizer.cpp line 609:
>
>> 607: // intentionally do not use CHECK on check_owner because we must exit the
>> 608: // monitor even if an exception was already pending.
>> 609: if (monitor->check_owner(current)) {
>
> We can actually throw IMSE from check_owner() if this thread is not the real owner.
>
> -------------
>
> PR: https://git.openjdk.java.net/jdk/pull/3345
>
More information about the hotspot-dev
mailing list