[foreign-preview] RFR: 8282070: Drop workaround from memory segment implementation [v2]
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri Feb 18 10:14:34 UTC 2022
> Following some preliminary experiments (see [1]) it is now finally time to drop the various workarounds we have in the memory segment implementation. This patch removes two workarounds:
>
> * special treatment for "small" segments (e.g. segments whose size fits in an int) - see `MemorySegment::isSmall`; these segments were special cased so that bound checks would only involve `int` comparisons. This has now been fixed in JDK-8276116, and special treatment is no longer required.
>
> * special shortcuts to avoid extra alignment checks. Since when generating var handles from a layout we check most of the alignment constraints (except those involving the base address), in the past we have added a fastpath for these var handles, as C2 had trouble hoisting alignment checks outside of the loops. This has now been fixed in JDK-8277850 and is no longer required.
>
> I have run benchmarks before and after and got identical results. Some benchmarkks in `ParallelSum` got a boost, but those always have noise, due to multi-threading.
Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
Address review comments:
* inlined Utils::scaleOffset into callsites
* drop redundant check from AbstractMemorySegment::checkBounds
-------------
Changes:
- all: https://git.openjdk.java.net/panama-foreign/pull/644/files
- new: https://git.openjdk.java.net/panama-foreign/pull/644/files/ea2d79ec..a5fbef94
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=644&range=01
- incr: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=644&range=00-01
Stats: 36 lines in 3 files changed: 14 ins; 7 del; 15 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/644.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/644/head:pull/644
PR: https://git.openjdk.java.net/panama-foreign/pull/644
More information about the panama-dev
mailing list