RFR: 8283689: Update the foreign linker VM implementation [v4]

Jorn Vernee jvernee at openjdk.java.net
Sat May 7 13:05:45 UTC 2022


On Sat, 7 May 2022 12:51:12 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Hi,
>> 
>> This PR updates the VM implementation of the foreign linker, by bringing over commits from the panama-foreign repo.
>> 
>> This is split off from the main JEP integration for 19, since we have limited resources to handle this. As such, this PR might fall over to 20.
>> 
>> I've written up an overview of the Linker architecture here: http://cr.openjdk.java.net/~jvernee/docs/FL_Overview.html it might be useful to read that first.
>> 
>> This patch moves from the "legacy" implementation, to what is currently implemented in the panama-foreign repo, except for replacing the use of method handle combinators with ASM. That will come in a later path. To recap. This PR contains the following changes:
>> 
>> 1. VM stubs for downcalls are now generated up front, instead of lazily by C2 [1].
>> 2. the VM support for upcalls/downcalls now support all possible call shapes. And VM stubs and Java code implementing the buffered invocation strategy has been removed  [2], [3], [4], [5].
>> 3. The existing C2 intrinsification support for the `linkToNative` method handle linker was no longer needed and has been removed [6] (support might be re-added in another form later).
>> 4. Some other cleanups, such as: OptimizedEntryBlob (for upcalls) now implements RuntimeBlob directly. Binding to java classes has been rewritten to use javaClasses.h/cpp (this wasn't previously possible due to these java classes being in an incubator module) [7], [8], [9].
>> 
>> While the patch mostly consists of VM changes, there are also some Java changes to support (2).
>> 
>> The original commit structure has been mostly retained, so it might be useful to look at a specific commit, or the corresponding patch in the [panama-foreign](https://github.com/openjdk/panama-foreign/pulls?q=is%3Apr) repo as well. I've also left some inline comments to explain some of the changes, which will hopefully make reviewing easier.
>> 
>> Testing: Tier1-4
>> 
>> Thanks,
>> Jorn
>> 
>> [1]: https://github.com/openjdk/jdk/pull/7959/commits/048b88156814579dca1f70742061ad24942fd358
>> [2]: https://github.com/openjdk/jdk/pull/7959/commits/2fbbef472b4c2b4fee5ede2f18cd81ab61e88f49
>> [3]: https://github.com/openjdk/jdk/pull/7959/commits/8a957a4ed9cc8d1f708ea8777212eb51ab403dc3
>> [4]: https://github.com/openjdk/jdk/pull/7959/commits/35ba1d964f1de4a77345dc58debe0565db4b0ff3
>> [5]: https://github.com/openjdk/jdk/pull/7959/commits/4e72aae22920300c5ffa16fed805b62ed9092120
>> [6]: https://github.com/openjdk/jdk/pull/7959/commits/08e22e1b468c5c8f0cfd7135c72849944068aa7a
>> [7]: https://github.com/openjdk/jdk/pull/7959/commits/451cd9edf54016c182dab21a8b26bd8b609fc062
>> [8]: https://github.com/openjdk/jdk/pull/7959/commits/4c851d2795afafec3a3ab17f4142ee098692068f
>> [9]: https://github.com/openjdk/jdk/pull/7959/commits/d025377799424f31512dca2ffe95491cd5ae22f9
>
> Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 90 commits:
> 
>  - Merge branch 'foreign-preview-m' into JEP-19-VM-IMPL2
>  - Merge branch 'master' into JEP-19-VM-IMPL2
>  - 8284161: Implementation of Virtual Threads (Preview)
>    
>    Co-authored-by: Ron Pressler <rpressler at openjdk.org>
>    Co-authored-by: Alan Bateman <alanb at openjdk.org>
>    Co-authored-by: Erik Österlund <eosterlund at openjdk.org>
>    Co-authored-by: Andrew Haley <aph at openjdk.org>
>    Co-authored-by: Rickard Bäckman <rbackman at openjdk.org>
>    Co-authored-by: Markus Grönlund <mgronlun at openjdk.org>
>    Co-authored-by: Leonid Mesnik <lmesnik at openjdk.org>
>    Co-authored-by: Serguei Spitsyn <sspitsyn at openjdk.org>
>    Co-authored-by: Chris Plummer <cjplummer at openjdk.org>
>    Co-authored-by: Coleen Phillimore <coleenp at openjdk.org>
>    Co-authored-by: Robbin Ehn <rehn at openjdk.org>
>    Co-authored-by: Stefan Karlsson <stefank at openjdk.org>
>    Co-authored-by: Thomas Schatzl <tschatzl at openjdk.org>
>    Co-authored-by: Sergey Kuksenko <skuksenko at openjdk.org>
>    Reviewed-by: lancea, eosterlund, rehn, sspitsyn, stefank, tschatzl, dfuchs, lmesnik, dcubed, kevinw, amenkov, dlong, mchung, psandoz, bpb, coleenp, smarks, egahlin, mseledtsov, coffeys, darcy
>  - 8282218: C1: Missing side effects of dynamic class loading during constant linkage
>    
>    Reviewed-by: thartmann, kvn
>  - 8286342: ProblemList compiler/c2/irTests/TestEnumFinalFold.java
>    
>    Reviewed-by: mikael
>  - 8286263: compiler/c1/TestPinnedIntrinsics.java failed with "RuntimeException: testCurrentTimeMillis failed with -3"
>    
>    Reviewed-by: thartmann, kvn
>  - 8285295: Need better testing for IdentityHashMap
>    
>    Reviewed-by: jpai, lancea
>  - 8286190: Add test to verify constant folding for Enum fields
>    
>    Reviewed-by: kvn, thartmann
>  - 8286154: Fix 3rd party notices in test files
>    
>    Reviewed-by: darcy, joehw, iris
>  - 8286291: G1: Remove unused segment allocator printouts
>    
>    Reviewed-by: ayang, iwalulya
>  - ... and 80 more: https://git.openjdk.java.net/jdk/compare/f823bf84...5cef96f7

I brought in the changes from master after the Virtual Threads integration, but because the PR branch I'm basing on doesn't have those changes, they showed up in the diff. I've undone this mistake by rebasing onto the target branch, which gives a clean diff that should be unchanged from before (but shuffles the commit history to the end of the convo tab).

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

PR: https://git.openjdk.java.net/jdk/pull/7959


More information about the core-libs-dev mailing list