logoalt Hacker News

The mask that compiles to nothing: how HotSpots JIT learned to reason about bits

61 pointsby rowbinlast Sunday at 10:33 PM6 commentsview on HN

Comments

piinbinarytoday at 1:51 PM

The part of this that's the most interesting to me is the fact that it is worthwhile for the compiler to expend the effort looking for this optimization opportunity. I would expect (x << 2) & -4 to be a fairly rare pattern, and even then removing the & -4 only saves one or two assembly instructions.

show 2 replies
CalChristoday at 2:39 PM

Why is this known bits optimization being done by the JIT rather than the Java compiler?

show 1 reply