Here's a blog post from John Rose explaining that exception throwing
compiles to a goto in cases like this:
https://blogs.oracle.com/jrose/entry/longjumps_considered_inexpensive

Sent from my phone
On Jul 7, 2012 2:43 PM, "Rémi Forax" <fo...@univ-mlv.fr> wrote:

> On 07/07/2012 07:02 PM, Dain Sundstrom wrote:
> > On Jul 7, 2012, at 1:56 AM, Rémi Forax wrote:
> >
> >> You have also to figure out how to get two return values from a method
> call,
> >> but exceptions are your best friend here.
> > Can you give an example of what you mean here?  Also, from all the
> presentations I've seen on the JVM, exceptions are very expensive to throw
> and catch, so I would expect this to be way slower then say returning the
> multiple values using a generated results class.
>
> Exception are not expensive if you throw them and just catch them (and
> don't use them) in the same inlining horizon,
> so you can use them to implement non Java control flow without thinking
> too much.
>
> Anyway, the idea here is to use exception as an exceptional mechanism by
> example when
> something that should be an int is not. In that case, throwing an
> exception is not a big deal
> because the VM will have to deopt which usual have a bigger impact on
> the run time.
>
> >
> > -dain
>
> Rémi
>
> _______________________________________________
> mlvm-dev mailing list
> mlvm-dev@openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
>
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to