RFR: 8325859: potential information loss during type inference [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu May 15 18:02:52 UTC 2025


On Thu, 15 May 2025 17:56:40 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>>> Maybe we can replace the visitor with asking `supplimentaryIC.free(t)` ? e.g. this could maybe use recusion?
>>> 
>>> ```
>>> Type result = t;
>>> if (current.free(t)) {
>>>     result = types.subst(t, inferencevars, instTypes());
>>> }
>>> if (supplimentaryIC != null) {
>>>     return supplimentaryIC.asInstTypes(t);
>>>  }
>>> ```
>> 
>> right but won't this solution imply to recursively visit the whole chain of supplementaryICs? the current approach should stop as soon as there are no more supplementaryICs to visit. Actually I think that one of our performance tests failed and that was why I had to introduce this visitor if I recall correctly
>
>> Actually I think that one of our performance tests failed and that was why I had to introduce this visitor if I recall correctly
> 
> I wanted to ask about this -- e.g. how much fixing this undoes the benefit of minimization. It seems we're in tricky territory.
> 
> Now, the problem with the visitor is that it picks up any type-variables -- it should at least filter out class type-variables and focus on method type-variables.

How feasible would it be to collect all the variables from all the supplimentary contexts, and then to only one subst? I assume the cost is with `types.subst` which is a visitor?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25011#discussion_r2091713194


More information about the compiler-dev mailing list