On Thu, 6 Nov 2025 09:30:56 GMT, Roland Westrelin <[email protected]> wrote:

>> I disagree. The issue only surfaces in this particular occasion does not 
>> mean it will not appear in other circumstances, possibly in the future. Even 
>> if the code is there on purpose, it seems that the purpose is executed 
>> incorrectly.
>> 
>> Additionally, an empty speculative type is supposed to mean that the path is 
>> speculatively unreachable, which is not the case here. So, another approach 
>> may be to fix the injection of speculative and assert that we should not 
>> obtain an empty speculative type?
>
>> Additionally, an empty speculative type is supposed to mean that the path is 
>> speculatively unreachable,
> 
> Or that profile data for 2 different points in the execution is inconsistent 
> which given how profile data is collected seems as likely to me.
> 
> Speculative types were added as a mechanism to fight profile pollution for 
> scripting languages running on the JVM (specifically nashorn). They work 
> really well in some cases. But they also have limited applicability. To me, 
> it doesn't seem like a good use of developer time or our complexity budget to 
> go with a complicated fix.

I'm trying to understand why `cleanup_speculative` is doing so. It seems to 
come from [JDK-8031755: Type speculation should be used to optimize explicit 
null checks](https://bugs.openjdk.org/browse/JDK-8031755). Maybe @rwestrel 
would remember something about it, but it has been quite a while since!

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

PR Comment: https://git.openjdk.org/valhalla/pull/1717#issuecomment-3496451968

Reply via email to