Le 04/06/2010 23:08, Charles Oliver Nutter a écrit :
On Fri, Jun 4, 2010 at 1:36 PM, Rémi Forax<[email protected]> wrote:
Le 03/06/2010 08:17, Charles Oliver Nutter a écrit :
[...]
I'm curious why your base perf is so close to this final number, since
it seems pretty amazing to me, and still doesn't have the guards it
needs to be really valid.
erjang uses a trick: tailcall optimization.
Well that could explain a lot; the tail calls in JRuby are normally
going back through the full dyncall path at minimum, and even in the
dynopt version they're still doing a static Java dispatch. At any
rate, I'm less concerned now :)
Maybe you can post the tak bytecode for the final result in Ejang? I'd
love to see what you're doing...
Here is the bytecode generated with invokedynamic and no optimization.
The first argument is the environment (where to print, etc), the second
is a thin wrapper over a MethodHandle ; in my language all functions
are lambdas ; here the method handle references tak itself because
the function is recursive and the others arguments are the arguments of tak.
As you can see all casts are removed.
I assume this is for your PHP, not for Erjang.
Yes.
Very nice that you can remove the casts; in JRuby currently I am not
doing any runtime type inference yet...just wiring a direct Object
(IRubyObject) path to the next method, or direct plus primitive
argument for known "intrinsics" like Fixnum and Float math operations.
Sorry, I wasn't clear.
This code is the code without any optimizations, so no cast removal.
If there is no cast in the sample it's not because they are removed
but because they are done by the method handle trees
behind each invokedynamic.
I'll go as far as I can with this and meanwhile Tom and Subbu will
continue working on the newer JRuby compiler that can actually do
things like constant and type propagation. Fun times ahead for us
mixed-mode JVM languages :)
I'm not far from being able to do constant propagation of lambdas,
I hope to come with that for the JVM'Summit :)
- Charlie
Rémi
--
You received this message because you are subscribed to the Google Groups "JVM
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jvm-languages?hl=en.