In "Approaches to Reflective Method Invocation" to be presented at ICOOOLPS 2008, we show 4 ways to implement method reflection:
1) out-of-line machine code - what we currently have
2) opt compiler simplification of out-of-line - simplifying a out-of-line call to a regular call when the method argument is constant
3) bytecode generation upon initial reflect method/constructor object creation - create bytecode to perform the reflective method call when a reflective wrapper is created
4) deferred bytecode generation - as with 3, but create bytecode upon 1st reflective method invocation
Of the approaches 3 gives the greatest time saving, as it speeds eclipse up considerably. The best average performance is given by 4.
Schemes 3 and 4 require an extra class to work, putting pressure on the JTOC. However, they are able to speed both baseline and opt compiled code.
We should implement scheme 4 in the current trunk.