On Fri, 8 May 2026 11:39:18 GMT, Axel Boldt-Christmas <[email protected]> 
wrote:

> > The implementation looks good, thank you! I feel like it would be very 
> > valuable to introduce a regression test for this. Is that something that 
> > could be feasible?
> 
> We can add one but I don't think it will be that useful. All we can really do 
> is to check that these known runtime upcall places do things correctly.
> 
> I think there is a mainline RFE here which refactors the `JavaCalls::call` 
> style helpers and wrapper to return a type of `ReturnJavaValue`, which 
> captures if an exception is pending (directly) after the call returned.
> 
> So we will do:
> 
> 1. Check that there is no pending exception before the upcall
> 2. Store the pending exception state in the `ReturnJavaValue` type
> 3. Assert if one tries to get the result out of a `ReturnJavaValue` which was 
> created from a call with a pending exception.
> 
> This would make us catch this and any future similar mistakes. But would 
> require a bit of code churn / refactoring.

I'm prototyping a basic Java program that calls `System::identityHash` on a 
very large structure twice, and ensures that the second call fails if the first 
one does. AFAIU, this is _not_ the case before this fix.

-------------

PR Comment: https://git.openjdk.org/valhalla/pull/2410#issuecomment-4406147042

Reply via email to