RFR: 8334137: Marlin: replace sun.misc.Unsafe memory access methods with FFM [v5]

Kevin Rushforth kcr at openjdk.org
Wed Jun 11 20:14:40 UTC 2025


On Mon, 9 Jun 2025 15:34:31 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/marlin/OffHeapArray.java line 79:
>> 
>>> 77:      * @return number of used bytes
>>> 78:      */
>>> 79:     int getUsed() {
>> 
>> wait, length is `long`, but used is `int`?
>
> I noticed this too. This is preexisting, so I don't want to change it as part of this PR (to minimize changes). It might or might not be worth a follow-up.

[JDK-8359259](https://bugs.openjdk.org/browse/JDK-8359259)

>> modules/javafx.graphics/src/main/java/com/sun/marlin/OffHeapArray.java line 97:
>> 
>>> 95:      */
>>> 96:     void incrementUsed(int increment) {
>>> 97:         this.used += increment;
>> 
>> if used > 2B, it will overflow, right?
>
> Yes. It seems worth checking and throw an exception. Other invariants could also be enforced such as used <= length.
> 
> I'll file a follow-up issue for this, since this behavior is preexisting.

[JDK-8359259](https://bugs.openjdk.org/browse/JDK-8359259)

>> modules/javafx.graphics/src/main/java/com/sun/marlin/RendererNoAA.java line 379:
>> 
>>> 377:             // note: throw IOOB if neededSize > 2Gb:
>>> 378:             final long edgeNewSize = ArrayCacheConst.getNewLargeSize(
>>> 379:                                         _edges.getLength(),
>> 
>> L377 is unclear - is this a TODO to throw IOOBE or a description of what would happen?
>> (this is a separate issue from FFM changes, really)
>
> Yes, this is preexisting and not something to look at as part of this PR.

[JDK-8359259](https://bugs.openjdk.org/browse/JDK-8359259)

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1814#discussion_r2140969093
PR Review Comment: https://git.openjdk.org/jfx/pull/1814#discussion_r2140969190
PR Review Comment: https://git.openjdk.org/jfx/pull/1814#discussion_r2140968533


More information about the openjfx-dev mailing list