RFR: 8325858: Replace Unsafe usage in XEmbeddingContainer with FFM API [v3]

Brent Christian bchristi at openjdk.org
Wed Feb 21 22:47:54 UTC 2024


On Wed, 14 Feb 2024 18:09:15 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposes to remove the use of `Unsafe` in the class `XEmbeddingContainer ` and replace it with the supported FFM API.
>> 
>> I tried to make this PR as small as possible while opening up for migration of other classes later on (such as `XEmbedServer` which can be modified similarly under a separate PR).
>> 
>> There are also three drive-by fixes in this PR:
>>  * Moved JavaDocs for `XAtom` to its proper location and fixed two typos in the text
>>  * Declared a field in `XEmbeddingContainer` as `private final`
>>  * In `XAtom`, use a utility method `assertAtomInitialized()` instead of the current duplicated code
>> 
>> Tested and passed tier1-5
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Suppress restricted warning

src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java line 150:

> 148:                 }
> 149:             } finally {
> 150:                 Reference.reachabilityFence(data);

Can you explain the need for this `reachabilityFence()`? I don't understand how `data` could become unreachable before the `Arena` is closed. Also, it's an in-scope local variable. Thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17846#discussion_r1498404216


More information about the client-libs-dev mailing list