[foreign-memaccess+abi] RFR: Modernize code [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Sep 25 08:24:37 UTC 2023


On Mon, 25 Sep 2023 08:20:33 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Rename and reformat
>>  - Use allocation free constructs
>
> 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

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

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/894#discussion_r1335548806


More information about the panama-dev mailing list