[foreign-memaccess+abi] Integrated: 8269807: Implement the fix for JDK-8269240 in the panama-foreign repo

Jorn Vernee jvernee at openjdk.java.net
Thu Jul 8 13:24:05 UTC 2021


On Wed, 7 Jul 2021 18:20:18 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Hi,
> 
> This patch re-writes the prologue and epilogue code of upcalls to model what is done for JNI by `JavaCallWrapper`. The old code did more or less the inverse of what was happening for downcalls, but this is not correct. The new code uses a pair of calls in the prologue and epilogue to `ProgrammableUpcallHandler::on_entry` and `ProgrammableUpcallHandler::on_exit`.
> 
> We now also need to save a little bit more information about the entry frame, namely the `JNIHandle` block that the prologue allocates, and the old handle block to restore later and for the GC to inspect. I've expanded the existing `AuxiliarySaves` struct for this and renamed and moved it to be a nested type in `OptimizedEntryBlob`. The move is mostly to avoid circular dependencies between headers.
> 
> During this rewrite, I also noticed that the return value of an upcall was not properly spilled around a call to detach a thread in the epilogue (only needed when we attached it in the prologue). Since we now always have a call in the epilogue, I've added the missing spill and fill code.
> 
> Since this was not caught by our existing testing, I've added an additional mode to TestUpcall to run test cases on a separate thread as well. I've split the three cases in TestUpcall into separate jtreg tests to keep execution times down, and to make it easier to see what failed if there is a test failure. (I'm not sure if there's a better way to ignore some testng test methods in jtreg other than throwing a `SkipException`, which also fills the console log unfortunately).
> 
> I've also added cases for testing with concurrent GCs to the test (`AsyncStackWalk`) against which the original failure was reported.
> 
> Besides that, there is a minor cleanup of some existing assert code that was copy/pasted, as well as a change to `TestByteBuffer` that was failing on WSL because of an function not being implemented, which I've now handled by skipping the test in that case.
> 
> Thanks,
> Jorn

This pull request has now been integrated.

Changeset: fed85e7e
Author:    Jorn Vernee <jvernee at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/fed85e7eaf8c33adc6b6f3857d3f4211adf485fa
Stats:     772 lines in 22 files changed: 591 ins; 147 del; 34 mod

8269807: Implement the fix for JDK-8269240 in the panama-foreign repo

Reviewed-by: mcimadamore

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

PR: https://git.openjdk.java.net/panama-foreign/pull/565


More information about the panama-dev mailing list