[llvm-dev] Managed Languages BOF @ Dev Meeting
Joachim Durchholz via llvm-dev
llvm-dev at lists.llvm.org
Mon Oct 19 03:11:20 PDT 2015
Am 19.10.2015 um 10:56 schrieb David Chisnall via llvm-dev:
> My knowledge of common Java idioms
> is slightly rusty, but my impression was that, while lots of Java
> code abuses exceptions for non-exceptional behaviour, this is quite
> rare for null-pointer exceptions.
Actually such abuse is heavily frowned upon. They use it only where
unavoidable - i.e. when calling into the JDK's implementations of file
I/O and JDBC.
They certainly don't expect the exceptional path to be fast; I have yet
to see code where the hot path goes through a catch clause.
> Is there much (any?) real-world
> code where the handling of null pointer exceptions is performance
> critical?
I doubt that NPEs are really used for that purpose. The catch block
would never be sure that the NPE doesn't originate from a true null
pointer dereference somewhere in the code.
If I must imagine a Java programmer who uses exceptions for control
flow, they'd likely use some exception that they think cannot happen. If
they are mildly compentent, they'll define their own exception class
just to be on the safe side.
Of cousre, there are shoddy programmers who do that kind of thing, and
worse. I don't think LLVM needs to worry about the speed of that kind of
code though :-)
More information about the llvm-dev
mailing list