[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Diversity - existence, value, and pursuit.



At 04:11 PM 12/3/01, Simon Cozens wrote:
>On Mon, Dec 03, 2001 at 03:55:57PM -0500, Guillaume Marceau wrote:
>
> > Some of Java's sementics were originaly though to be optimizable, but it
> > turned out they weren't. They are : stack allocatable objects, array
> > bound checks and dynamic method call lookup.
>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>This is turning into a major bummer for dynamic language optimization.
>I'm surprised (he says, looking around) there's no successful work on this.

As for stack-allocation of objects, that has always looked hard to me,
but there are awfully good GCs out there.  I think that Appel claimed
that heap-allocation with a good GC beats out stack allocation every
time in his implementations of SML.  I can easily believe that this
might be a true result in general.

As for bounds-checking, an awful lot of my array/collection hacking
code looks like the following.  It seems to me that a bit of type analysis
can prove that it is safe to optimize out the bounds-checking, at least
if there are no other threads bashing the length of 'v' behind your back.

   for (int i = 0; i < v.length; i++) {
      v[i].doSomething();
   }

Is it the case that threads defeats this optimization, or that Java
compilers don't do it, or that Java JITs don't have enough information
at run-time to do it?

Jonathan Bachrach and Craig Chambers are whizzes at fast method
call lookup.  The Dylan code I've written -- full of multiple inheritance
and multi-methods -- compiled by JB's compiler typically gets about
90% of its method calls done statically (at compile time), so I have
to think that either I or the Java folks are missing something on the
dynamic-dispatch front.