The Artima Developer Community
Sponsored Link

Java Buzz Forum
I don't need invokedynamic

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Toyokazu Tomatsu

Posts: 66
Nickname: tomatsu
Registered: Jul, 2003

Toyokazu Tomatsu is a developer of Pnuts.
I don't need invokedynamic Posted: Jan 24, 2008 1:22 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Toyokazu Tomatsu.
Original Post: I don't need invokedynamic
Feed Title: Pnuts Addict
Feed URL: http://jroller.com/tomatsu/feed/entries/rss
Feed Description: Toyokazu Tomatsu's Weblog
Latest Java Buzz Posts
Latest Java Buzz Posts by Toyokazu Tomatsu
Latest Posts From Pnuts Addict

Advertisement
As an implementor of Pnuts, I have to write about JSR292, a.k.a invokedynamic. My conclusion is that invokedynamic definitely won't help. If I were a member of EC, I'd vote NO, because it is not worth adding a new mnemonic to the VM spec. Even if the capability is provided as an API, it will rarely be used by JVM languages. (I'm not talking about hotswapping here.)

Pnuts is one of the fastest scripting language on JVM. One secret of the efficient implementation is sophisticated method caching. Pnuts usually does not use Reflection API to call methods, even when accessing JavaBeans properties. Pnuts generates method proxies on-the-fly and reuse them. Reflection API is used only when method proxy can't be used because of classloader mismatch. It is true that searching appropriate methods from actual arguments is expensive, but the impact is almost completely invisible, thanks to the method cache. In fact, method call in Pnuts is even faster than that of Ruby. Is it still worth adding a new mnemonic? Or the mnemonic is for other language implementors?

In Pnuts, it is possible to give a hint to select a particular method, assuming that the method is overloaded and two or more methods match the actual arguments. When some of the actual arguments have "cast" to some type, the information is used to choose an appropriate method. e.g. String.valueOf((char[])array). How can it be achieved using invokedynamic?

Also, Pnuts searches methods through JavaBeans method descriptors, but not Class.getMethods(..). And the way of searching methods/constructors can be customized. Under some configuration, private methods can be selected. This kind of flexibility can be achieved only at application-level.

The cause of slow down is not just invoking methods. Some other JVM languages don't generate bytecode and interpret the code in their implementation. They can't be faster unless a bytecode compiler is implemented. Even JVM languages with bytecode compiler, the generated code and the runtime library should be efficient. If the generated code and the runtime library is not efficient, invokedynamic would have no effect.

Read: I don't need invokedynamic

Topic: Links for 2008-01-16 [del.icio.us] Previous Topic   Next Topic Topic: barcampESM this weekend, in Austin from PeopleOverProcess.com

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use