Hotspot loves PHP.reboot

Charles Oliver Nutter headius at headius.com
Tue Sep 6 13:18:39 PDT 2011


On Tue, Sep 6, 2011 at 3:04 PM, John Rose <john.r.rose at oracle.com> wrote:
> (1) Write a compelling API for something like Integer.addDetectingOverflow.
> (2) Roll it into JDK 8+epsilon.
> (3) Do the JIT work.
> People have thought on and off about (1) for many years, but with no clear
> winner.  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.
> (This is a case where tuples would make things simple, but it is not enough
> to motivate introducing tuples.)

Not that it matters, but JRuby's integer math is all 64-bit...so we
want a 65th bit of data out of maths :)

A couple observations:

* I think I speak for the entire JVM dynlang community when I say that
we'd be happy to smuggle features into Java 6 via unsupported
packages. In other words, if there were a sun.misc intrinsic we could
link against, we'd happily do it when running on Hotspot and move to
the formal way in JDK 8.
* I was about to suggest a closure-based approach to handling the
overflow (a callback, basically) but then realized constructing the
closure instance has a nontrivial cost too. Yep, that's a fun little
API design problem to solve. Hmm.

- Charlie


More information about the mlvm-dev mailing list