Anand Palaniswamy wrote:
>
> sunwjit, symcjit and even hotspot do "implicit exceptions." Meaning a
> null pointer exception is detected from a SIGSEGV, and the VM raises
> the related NullPointerExcetion from the signal handler. This offers
> the best performance for the normal case where there isn't a NPE. In
> general, doing control flow through exceptions is a bad idea (because
> of the machinery required to find the handler, and also because Java's
> design requires stack traces to be filled into an exception object at
> the time of creation). Exceptions are for exceptional circumstances.
>
> That said, the sunwjit port of Linux does NOT do implicit exceptions.
> There is a lot of code in the JIT that generates machine code that
> explicitly tests for NPEs, StackOverflows, ArithmeticExceptions. So
> if you compared the performance of sunwjit or Solaris vs. sunwjit on
> Linux, the Solaris one will be slightly ahead (I haven't measured
> exactly how much).
>
> Personally I prefer explicit checks. But an ex-Self person (and now
> HotSpot person) once told me that explicit checks in the Self system
> cost about 5-10% in performance depending on the application you are
> running.
Thanks for the info, Anand. The original article
(http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/perf2.html)
mentioned a reliance on signals for other conditions, such as array
out-of-bounds exceptions. True? Maybe Java's radically different, but
C/C++ programmers certainly can't rely on a SIGSEGV from that condition.
Nathan
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]