This is the mail archive of the
mailing list for the Java project.
Re: ReRe: performance (shellsort experiments)
Kresten Krab Thorup writes:
| With a dynamic compiler that does code-specialization, mosts of such
| casts can be eliminated.
| In context of static compilation, I expect that we could get a
| significant win by just adding a mono-morphic inline cache. That is,
| for each expression at the form
| x = (Foo)y
| we'd generate code like:
| static _Jv_VTable* __tmp = 0;
| if (y->vtable != __tmp)
| _Jv_CheckArrayStore (y, Foo.class); // may throw exc
| __tmp = y->vtable;
| x = y;
| Experiments with Self/Smalltalk in context of dynamic method
| dispatch have shown that this kind of thing improves performance
| dramatically, since most call sites are in fact mono-morphic. My bet
| is, that this is also the case for most type-cast operations.
| This would of cause require compiler changes.
Might be worth a peek at Martin Odersky's GJ,
http://www.cis.unisa.edu.au/~pizza/gj/, which provides a Java superset
with "generics" (read: C++ templates), and provides annotiations within
the class files enabling a suitable VM to know of such uses.