[foreign-memaccess+abi] RFR: Modernize code [v3]
Per Minborg
pminborg at openjdk.org
Mon Sep 25 10:21:34 UTC 2023
On Mon, 25 Sep 2023 08:20:49 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 569:
>>
>>> 567:
>>> 568: private static int getScaleFactor(Buffer buffer) {
>>> 569: return switch (buffer) {
>>
>> sorry, this is, I think, buggy. Note that you can have an IntBuffer wrapped around a byte[], in which case the calculation will misfire. I think the factory using this method should just call BaseAndScale::of (on the heap array) and then get the scale from there.
>
> We should probably add a test to detect regressions such as these
Perhaps we can do that under a separate issue as it is a broader effort than just modernizing the code?
-------------
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/894#discussion_r1335683016
More information about the panama-dev
mailing list