RFR: 8359335: Template-Framework Library: Primitive Types subtyping
Emanuel Peter
epeter at openjdk.org
Fri Jan 23 13:33:45 UTC 2026
On Fri, 23 Jan 2026 12:34:27 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:
> > it would be nice to restrict Expression nesting to exact type matches, rather than isSubtypeOf
>
> This breaks the assumptions of current template framework tests, but that should be easy enough to fix.
I wasn't aware. Do you have an example?
> Generally, I think that we will not get around annotating float division operators with the possibility for an `ArithmeticException`. Saying that we want to nest on exact types would only push that out into the future. Also, I do not really see the problem with the extra try-catch since C2 should be able to prove it is not necessary when all involved types are floats.
It's only a small point for me, so I could live with the annotation. But it is a small loss. If we ever don't want operations with exceptions, we'd have to filter them out, meaning we cannot have the float modulo.
Ah: we could also add explicit float/double casts to the modulo operator arguments. That would at least force away any exception, and ensure we are choosing the float/double modulo, rather than int modulo.
And why can't we get around adding the exception? Is there some fundamental restriction, or just the fear that we will continue to hit subtle bugs, and it's just not worth it?
> Thus, my proposal is slightly different:
>
> * Add the possibility for `Expression` to nest with exact or subtypes.
> * Make the `ExpressionFuzzer` nest on exact types to preserve the current behavior and mitigate the sampling problem you laid out above.
I'm fine with that :)
> * Keep the exception annotation on the float division operations.
This we can keep discussing ;)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29349#issuecomment-3790251512
More information about the hotspot-compiler-dev
mailing list