<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Sep 6, 2011, at 8:51 AM, Charles Oliver Nutter wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Did we ever figure out if it's possible to trick Hotspot into doing a<br>JO instead of the raw bit-level operations? John/Christian/Tom: what<br>would it take to get HS to "know" that we're doing an integer<br>overflow-after-maths check and do the (faster?) JO?<br></span></blockquote></div><br><div>(1) Write a compelling API for something like Integer.addDetectingOverflow.</div><div>(2) Roll it into JDK 8+epsilon.</div><div>(3) Do the JIT work.</div><div><br></div><div>People have thought on and off about (1) for many years, but with no clear winner. &nbsp;Exceptions or boxed objects have unpleasant interactions and are hard to use, while smuggling out the 33rd bit some other way (TLS, a long or double, a return-by-reference, a sentinel value) is painful.</div><div><br></div><div>(This is a case where tuples would make things simple, but it is not enough to motivate introducing tuples.)</div><div><br></div><div>-- John</div></body></html>