Integrated: 8276217: Harmonize StrictMath intrinsics handling

Aleksey Shipilev shade at openjdk.java.net
Thu Nov 4 08:11:18 UTC 2021


On Mon, 1 Nov 2021 11:23:16 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> This blocks JDK-8276215: `StrictMath` intrinsics are handled peculiarly by giving failing intrinsics a second chance to match against the similar `Math` intrinsics. This has interesting consequence for matchers: we can match the native `StrictMath.sqrt` to non-native intrinsic for `Math.sqrt`. Interpreter would then have to disambiguate the two. It could be made simpler and more consistent.
> 
> For `min`/`max` methods, `StrictMath` already delegates to `Math` methods, so we can just drop the intrinsics for them. `sqrt` is harder to delegate, because it is `native` and a part of public API, so we can instead do the proper special intrinsic for it.
> 
> There seem to be no performance regressions with this patch at least on Linux x86_64:
> 
> 
> $ CONF=linux-x86_64-server-release make test TEST="micro:StrictMathBench" 
> 
> Benchmark                   Mode  Cnt       Score     Error   Units
> 
> ### Before
> 
> StrictMathBench.minDouble  thrpt    4  230921.558 ± 234.238  ops/ms
> StrictMathBench.minFloat   thrpt    4  230932.303 ± 126.721  ops/ms
> StrictMathBench.minInt     thrpt    4  230917.256 ±  73.008  ops/ms
> StrictMathBench.minLong    thrpt    4  194460.828 ± 178.079  ops/ms
> 
> 
> StrictMathBench.maxDouble  thrpt    4  230983.180 ± 161.211  ops/ms
> StrictMathBench.maxFloat   thrpt    4  230969.290 ± 277.500  ops/ms
> StrictMathBench.maxInt     thrpt    4  231033.581 ± 200.015  ops/ms
> StrictMathBench.maxLong    thrpt    4  194590.744 ± 114.295  ops/ms
> 
> 
> StrictMathBench.sqrtDouble  thrpt    4  230722.037 ± 2222.080  ops/ms
> 
> ### After
> 
> StrictMathBench.minDouble  thrpt    4  230976.625 ±  67.338  ops/ms
> StrictMathBench.minFloat   thrpt    4  230896.021 ± 270.434  ops/ms
> StrictMathBench.minInt     thrpt    4  230859.741 ± 403.147  ops/ms
> StrictMathBench.minLong    thrpt    4  194456.673 ± 111.557  ops/ms
> 
> StrictMathBench.maxDouble  thrpt    4  230890.776 ±  89.924  ops/ms
> StrictMathBench.maxFloat   thrpt    4  230918.334 ±  63.160  ops/ms
> StrictMathBench.maxInt     thrpt    4  231059.128 ±  51.224  ops/ms
> StrictMathBench.maxLong    thrpt    4  194488.210 ± 495.224  ops/ms
> 
> StrictMathBench.sqrtDouble  thrpt    4  231023.703 ± 247.330  ops/ms
> 
> 
> Additional testing:
>  - [x] `StrictMath` benchmarks
>  - [x] Linux x86_64 fastdebug `java/lang/StrictMath`, `java/lang/Math`
>  - [x] Linux x86_64 fastdebug `tier1`

This pull request has now been integrated.

Changeset: 9eadcbb4
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/9eadcbb47e902f42d933ba68e24f2bfb0ee20915
Stats:     125 lines in 15 files changed: 80 ins; 27 del; 18 mod

8276217: Harmonize StrictMath intrinsics handling

Reviewed-by: aph, kvn

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

PR: https://git.openjdk.java.net/jdk/pull/6184


More information about the core-libs-dev mailing list