RFR: 8337237: Use FFM instead of Unsafe for Java 2D RenderBuffer class [v2]
Phil Race
prr at openjdk.org
Fri Jul 26 22:59:26 UTC 2024
On Fri, 26 Jul 2024 06:51:12 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8337237
>
> src/java.desktop/share/classes/sun/java2d/pipe/RenderBuffer.java line 60:
>
>> 58: private static final int SIZEOF_FLOAT = 4;
>> 59: private static final int SIZEOF_LONG = 8;
>> 60: private static final int SIZEOF_DOUBLE = 8;
>
> These fields could be eliminated and replaced with e.g. `JAVA_LONG.byteSize()` . I do not think the `int` vs. `long` matters that much if at all.
I thought about doing that but I didn't see a problem with using these consts.
I changed to int because the copy API wanted an int for some parameter, so I changed that var, and
then to avoid casts from long to ints I changed these .. I could perhaps unwind the above since I'm now changing
what triggered it but I think I'm fine with int here, since I'm using int for curOffset now.
The Unsafe API was all absolute addresses as longs.
> src/java.desktop/share/classes/sun/java2d/pipe/RenderBuffer.java line 70:
>
>> 68: private static final int COPY_FROM_ARRAY_THRESHOLD = 10;
>> 69:
>> 70: MemorySegment segment;
>
> Could we use `private final` for this field?
will do
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20339#discussion_r1693467135
PR Review Comment: https://git.openjdk.org/jdk/pull/20339#discussion_r1693422887
More information about the client-libs-dev
mailing list