RFR: 8282194: C1: Missing side effects of dynamic constant linkage
Vladimir Ivanov
vlivanov at openjdk.java.net
Mon Feb 21 22:00:47 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
Forgot to mention that the problem is not specific to dynamic constants. It turns out all non-String constants are affected, because their linkage involves class loading. Custom class loaders may produce (provide no guarantees) side effects which are noticeable by an application, but not necessarily preserved across a patched constant in C1-generated code. Filed [JDK-8282218](https://bugs.openjdk.java.net/browse/JDK-8282218) to cover such cases.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7557
More information about the hotspot-compiler-dev
mailing list