[LLVMdev] Iterator protocols

Marc B. Reynolds marc.reynolds at orange.fr
Wed May 14 01:03:02 PDT 2008


> So the question is, what's the trade-off. In most languages that support 
> exceptions, you tend to think of exceptions as expensive operations that 
> should only be thrown if something truly "exceptional" happens. 

Certainly the vast majority of cases, but is it also reasonable to write a
method that will likely or always throw an exception, but cheaper to setup,
unwind and tear-down the exception than to litter a computational expensive
routine with explicit end-condition testing. 

> OTOH, the Java case is also made worse by the fact that a large part of
> the time you'll be using the more expensive interface dispatching,
> rather than simple vtable dispatching.

What I've seen is that when runtime compiling: most 'invokeinterface' calls
can
be converted into direct vtable dispatches, specifically when the type of
the
object in question is a class (as opposed to an interface). And in the
remaining
cases, when the type is an interface, the methods tend to be short and
suitable
for inlining. (mileage may vary)







More information about the llvm-dev mailing list