r/java • u/-beleon • Jul 05 '26
The mask that compiles to nothing: how HotSpot's JIT learned to reason about bits
https://questdb.com/blog/jvm-jit-known-bits/
27
Upvotes
r/java • u/-beleon • Jul 05 '26
7
u/cal-cheese Jul 06 '26
Correction: The intersection of a signed range and an unsigned range often results in 1 or 2 disjoint intervals, each of which has its bounds either both negative or both non-negative. This is what called the simple interval. Since the bounds are either both negative or both non-negative, it is both a signed range and an unsigned range.
For example, if the signed range is [-5, 5] and the unsigned range is [2, max_uint], then their intersection is 2 ranges [-5, -1] and [2, 5].
1
u/BarkiestDog Jul 07 '26
This is cool, but what sort of coffee would do this in real life?
I’m guessing that maybe if everything is hidden behind constants it wouldn’t be clear to the developer that this is happening?
That is, how much coffee does this really help? Or is this underpinning some other optimization that makes more sense?