[foreign-memaccess+abi] RFR: Prevent maxAlign virtual calls for polluted accesses [v2]

Radoslaw Smogura duke at openjdk.org
Mon Aug 8 02:45:07 UTC 2022


> In case of polluted accesses (when different kinds of segments are accessed
> from same code), `maxAlign()` can get virtual call which would prevent
> effective inlining and loop optimizations.
> 
> This patch moves `maxAlign` to `AbstractMemorySegmentImpl` field, and makes method
> final. The value of align is passed as constructor argument.
> 
> _Note: This patch can cause slightly bigger memory usage, as memory segment will carry `maxAlign` value, this can optimizaed by using smaller container for value i. e. `byte` or `short`_
> 
> After
> 
> Benchmark                                  (size)  Mode  Cnt       Score     Error  Units
> MixedAccessBenchmarks.directCopy          1048576  avgt   10   16410.733 ±  79.901  ns/op
> MixedAccessBenchmarks.pollutedAccessCopy  1048576  avgt   10  168497.502 ± 632.578  ns/op
> 
> 
> Before
> 
> Benchmark                                  (size)  Mode  Cnt        Score        Error  Units
> MixedAccessBenchmarks.directCopy          1048576  avgt   10    18336.054 ±     63.133  ns/op
> MixedAccessBenchmarks.pollutedAccessCopy  1048576  avgt   10  2069032.456 ± 167512.633  ns/op

Radoslaw Smogura has updated the pull request incrementally with one additional commit since the last revision:

  Previous version created performance drop for `LoopOverNonConstantHeap` benchamrk, this fixes this and keeps same results for tests with vectors.

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

Changes:
  - all: https://git.openjdk.org/panama-foreign/pull/700/files
  - new: https://git.openjdk.org/panama-foreign/pull/700/files/8f276c42..aadb8988

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=panama-foreign&pr=700&range=01
 - incr: https://webrevs.openjdk.org/?repo=panama-foreign&pr=700&range=00-01

  Stats: 67 lines in 4 files changed: 47 ins; 8 del; 12 mod
  Patch: https://git.openjdk.org/panama-foreign/pull/700.diff
  Fetch: git fetch https://git.openjdk.org/panama-foreign pull/700/head:pull/700

PR: https://git.openjdk.org/panama-foreign/pull/700


More information about the panama-dev mailing list