RFR: 8342090: Infer::IncorporationBinaryOp::equals can produce side-effects [v7]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Oct 24 13:20:11 UTC 2024
On Thu, 24 Oct 2024 13:07:25 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Type inference uses a cache to store incorporation operations already done. This way we can avoid redoing operations that once done won't produce any change. This can reduce the compilation time when the number of inference variables involved is not trivial. The elements in the cache are implemented with class `com.sun.tools.javac.comp.Infer::IncorporationBinaryOp` the problem here is that the equals method of this class can produce side effects, implying that after a comparison the compared objects can mutate. This patch is fixing this issue,
>>
>> TIA
>
> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
>
> review comments
Looks very good - thanks!
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 3331:
> 3329: }
> 3330:
> 3331: /* this class won't substitute all types for example UndetVars are never substituted, this is like this
Suggestion:
/* this class won't substitute all types for example UndetVars are never substituted, this is
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 3332:
> 3330:
> 3331: /* this class won't substitute all types for example UndetVars are never substituted, this is like this
> 3332: * by design as UndetVars are used locally during inference and shouldn't scape from inference rutines,
Suggestion:
* by design as UndetVars are used locally during inference and shouldn't escape from inference routines,
-------------
Marked as reviewed by mcimadamore (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/21651#pullrequestreview-2392487943
PR Review Comment: https://git.openjdk.org/jdk/pull/21651#discussion_r1814974259
PR Review Comment: https://git.openjdk.org/jdk/pull/21651#discussion_r1814974727
More information about the compiler-dev
mailing list