RFR: 8282194: C1: Missing side effects of dynamic constant linkage

Vladimir Ivanov vlivanov at openjdk.java.net
Wed Feb 23 10:17:53 UTC 2022


On Mon, 21 Feb 2022 13:20:08 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> After [JDK-8280473](https://bugs.openjdk.java.net/browse/JDK-8280473), C1 handles unresolved dynamic constants by performing
> constant resolution at runtime and then putting the constant value into the
> generated code by patching it. But it treats the not-yet-resolved constant as a
> pure value, dynamic constants are produced by user-defined bootstrap methods
> and there are no guarantees that they don't have any side effects.
> 
> Proposed fix conservatively kills the whole memory state after any unresolved
> dynamic constant.
> 
> Testing:
> - [x] jck:vm/constantpool/resolveDynamicConstant w/ -Xcomp
> - [x] hs-tier1 - hs-tier4

Thanks for the reviews, Vladimir and Tobias.

> Is it worth adding a regression test?

Strictly speaking, `jck:vm/constantpool/resolveDynamicConstant` tests catch the problem. 
But I plan to add new test as part of [JDK-8282218](https://bugs.openjdk.java.net/browse/JDK-8282218). Will consider adding a case for dynamic constants there.

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

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


More information about the hotspot-compiler-dev mailing list