RFR: 8359335: Template-Framework Library: Primitive Types subtyping

Manuel Hässig mhaessig at openjdk.org
Wed Jan 21 16:09:27 UTC 2026


On Wed, 21 Jan 2026 15:56:36 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:

> This PR implements the subtype relation for primitive types in the Template Framework Library according to JLS §4.10.1. Further, this PR extends the primitive type example to test the addition.
> 
> Testing:
>  - [ ] Github Actions
>  - [ ] tier1, tier2

test/hotspot/jtreg/compiler/lib/template_framework/library/Operations.java line 133:

> 131:             ops.add(Expression.make(type, "(", type, " * ", type, ")"));
> 132:             ops.add(Expression.make(type, "(", type, " / ", type, ")", WITH_ARITHMETIC_EXCEPTION));
> 133:             ops.add(Expression.make(type, "(", type, " % ", type, ")", WITH_ARITHMETIC_EXCEPTION));

Because all integer primitives are subtypes of the floating point primitives, the new subtype relation can lead to a situation where a fuzzer generates a float modulo expression and then generates two integer expressions for the left- and right-hand sides. Hence, the modulo operation that is actually executed is an integer expression that may throw an `ArithmeticException` if the divisor is zero.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29349#discussion_r2713239125


More information about the hotspot-compiler-dev mailing list