Invokedynamic
We’re looking to improve support for dynamically typed languages on the Java platform.
Tangent : that’s dynamically typed languages - not the increasingly common horrible misnomer dynamic languages (as opposed to static languages, where nothing moves, like hieroglyphics, perhaps?).
A lot of hype has been generated over the .Net VM’s support for multiple programming languages.
Another tangent: I always refer to the .Net VM and not the the CLR. It’s a VM, such things have always been called VMs, and the only reason I can think of for giving it a different name is to confuse people. Confusing people might be useful if you wanted to convince them that you’ve invented something when you actually copied it from somebody else.
More generally, jargon has been used throughout the ages to intimidate and exclude. This is a tradition in every profession: don’t say parameterized type when you can say parametric polymorphism .
Introducing non-standard terminology is popular in industry, as it prevents people from easily comparing your product to others, so that they aren’t tempted to defect. It’s a common trick used by many large companies throughout the history of computing. For extra credit - what’s a long, complicated term for a B-tree?
The fact is, the .Net VM provides support for all manner of statically-typed, single-inheritance imperative object-oriented languages. It could potentially host C#, or Java, or Oberon or Ada or Modula-3 just fine. In other words, you can program in whatever you want, as long as it is basically C#.
Despite the hype, languages with fundamentally different models won’t work all that well. For example, if you don’t have static type information, you cannot use the VM’s highly tuned dynamic dispatch for method calls, and end up doing your own emulation in software. This is tiresome for the implementor, and more importantly, really slow.
The JVM is not really that different. In fact, a study done by some folks at Aarhus University, part of the culture that invented object-orientation, found that there was no significant difference in difficulty between porting Beta to the JVM or the .Net VM.
So what can we really do to make dynamically typed languages easy to port, and port so they run well, to the JVM?
Last winter we had a meeting with various people who work on such languages - things like Groovy, Perl, Python/Jython. Our conclusion was that the most practicable thing was to support dynamically typed method invocation at the byte code level.
The new byte code, invokedynamic , is coming to a JSR near you very soon. I’m forming an expert group which I will chair (because of my deep fondness for standards, committees, meetings and process). This group will get to argue over various fine details of how this instruction should work.
Basically, it will be a lot like invokevirtual (if you don’t know what that is, either open a JVM spec and find out, or stop reading). The big difference is that the verifier won’t insist that the type of the target of the method invocation (the receiver, in Smalltalk speak) be known to support the method being invoked, or that the types of the arguments be known to match the signature of that method. Instead, these checks will be done dynamically.
There will probably be a mechanism for trapping failures (a bit like messageNotUnderstood in Smalltalk).
Does this do everything everyone wants? No, but that is not the point. It isn’t really feasible to accommodate the exact needs of a wide variety of disparate languages. Instead, one should provide a good general purpose primitive, that all these languages can build on.
Some might like the new byte code to support multiple inheritance - but each language has its own multiple inheritance rules, and supporting all of them is hopeless. In most cases, the lookup process for multiple inheritance can be benefit from this primitive.
Dynamic languages with a clean single inheritance semantics like E will be able to use this primitive directly for most calls.
Another problem is calling methods written in Java from a dynamically typed language. Static overloading makes this tedious. Languages may have varying mechanisms for dealing with this, often reminiscent of multiple dispatch. This is way too complicated to put into the VM, but the trap mechanism mentioned above should help implementors deal with that problem relatively efficiently.
All of this should eventually make it the use of dynamically typed languages on the Java platform easy, efficient and common place. That’s a good thing. I’ve long been a fan of such languages (well, not the popular ones; rather, languages like APL, Scheme, Smalltalk and Self; face it, I’m a snob and proud of it).
Why does this matter: I’m convinced these languages have a growing role to play in the practice of computing in the coming years. The extra flexibility of dynamic typing will become more and more important as software evolves.
This is not to say that static type checking is to be avoided. As I indicated in my prior posting about pluggable types, the static-vs-dynamic typechecking wars are pointless; one can eat one’s cake and have (most of it) too. Invokedynamic is a modest, pragmatic yet very important step that helps the JVM become a hospitable environment for such cake-eating and having.
Posted at 04:30PM Sep 28, 2005 by gbracha in Java | Comments[92]
Posted by Panasonic Youth on September 28, 2005 at 07:33 PM PDT #
Posted by eu on September 29, 2005 at 01:14 AM PDT #
Posted by 61.17.242.113 on September 29, 2005 at 02:16 AM PDT #
Posted by AnonymousCoward on September 29, 2005 at 10:27 AM PDT #
Posted by The Sidharth Kuruvila Blog on September 30, 2005 at 07:25 AM PDT #
Posted by D. Bones on September 30, 2005 at 07:27 AM PDT #
Last time I checked Groovy was based on Ruby and far less mature.
JRuby (a ruby implementation targeting the JVM)is Ruby 1.8.2-compatible ( http://jruby.sf.net )
You guys forgot to invite Mr Yukihiro Matsumoto to this party, a little more recognition for his work would be kindly appreciated.
See proceedings of LL2 at: http://ll2.ai.mit.edu (The Ruby Programming Language)
His english may not be perfect, but the design of his language is years ahead of anything else.
Posted by vruz on September 30, 2005 at 10:16 PM PDT #
Some might like the new byte code to support multiple inheritance - but each language has its own multiple inheritance rules, and supporting all of them is hopeless. In most cases, the lookup process for multiple inheritance can be benefit from this primitive.
I sincerely hope that the lookup is performed based only on the method selector, not the inheritance hierarchy. Otherwise <code>invokedynamic</code> will be useless for languages like Smalltalk and E, where selection of a method is independent of where it was inherited from.
Dynamic languages with a clean single inheritance semantics like E will be able to use this primitive directly for most calls.
E uses single delegation, not inheritance. Specifically, it uses a variant of delegation in which the parent object is fixed when the child object is constructed (unlike Self where the parent can be changed dynamically). This is more expressive than inheritance because the parent does not have to be of a statically determined class.
Posted by David Hopwood on October 01, 2005 at 09:07 AM PDT #
Posted by Doug Ransom on October 02, 2005 at 07:41 AM PDT #
Posted by sma on October 03, 2005 at 09:50 AM PDT #
All Groovy-side method calls are redirected to a MetaClass object at the moment, which does the dispatching using the dynamic type. there is no real difference between caling a Groovy or a Java method from Groovy. Until this point no reflection is needed, but of course we need a String and a Object[] to describe the call. To actually call the method from Java we need Reflection unless we use a special dynamically created class which comes into play after the method is choosen.
To make a call this way is very flexible and allows to exchange methods in the MetaClass object during runtime. But this possibility to exchange the method gives problems with invokedynamic. If invokedynamic first calls the object's method then it is possible a method is used which has been overwritten, or maybe the MetaClass object has a more special method which should be used instead.
So you can see Groovy will not really benefit from invokedynamic. If it would be possible to extend a class with methods, then Groovy may benefit. But still it's not that easy. Vargs and autoboxing are compilerwork, nothing a dynamic language can do at that time. So method dispatching will always require special handling for autoboxing or even coercisons. invokedynamic can't do this. It's always possible it will call a method it should not call.
I think some languages will benefit from invokedynamic, but Groovy will not. But I think these languages can't have any kind of type transformation for a method call besides casts or what java allows with primitives.
Mayvbe I made a big error in may thinking somewhere here, if so please write me.
Posted by blackdrag on October 08, 2005 at 09:48 AM PDT #
Posted by Dino on October 18, 2005 at 10:24 PM PDT #
Posted by 203.117.31.241 on October 19, 2005 at 12:38 AM PDT #
From my perspective as a researcher who has studied how to implement first-class generics with minimal changes to the JVM, I would dearly love to see future editions of the JVM support the dynamic addition of methods to classes and interfaces. It would enormously simplify the implementation of polymorphic methods. We could use essentially the same techniques in NextGen to support new polymorphic method instantiations that we use support new generic class instantiations (by dynamically loading lightweight instantiation classes).
The remarks by the Groovy developer suggest that such a feature would also simplify the implementation of dynamically typed languages.
On the subject of language generality in the .NET CLR versus the JVM, my understanding from discussions with Jim Miller and other principals involved in developing the CLR is that the CLR offers only a few features that are missing in the JVM. The only two that I recall are: (i) mandated support for tail-call optimization and (ii) an interface method naming scheme that implicitly includes the interface name as part of the method signature (so two methods with the same explicit signature in different interfaces do not collide if they are in herited by the same class). Of course .NET 2 includes explicit support for generics, but this support is specifically directed at C#. There is no explicit support in CLR for continuations.
P.S. Speaking of non-standard terminology, why doesn't the Java Language Specification use the well-understood and accepted term "receiver" instead of "target" to refer to the primary argument of a (non-static) method call?
Posted by Corky Cartwright on November 22, 2005 at 10:03 PM PST #
Posted by Gilad Bracha on November 29, 2005 at 10:02 PM PST #
Posted by Puszczak on June 05, 2006 at 05:07 AM PDT #
Posted by huihui on October 10, 2006 at 07:25 PM PDT #
Posted by www on October 12, 2006 at 10:59 PM PDT #
Posted by Ming on October 16, 2006 at 02:06 PM PDT #
Posted by huihui on October 17, 2006 at 11:11 PM PDT #
Posted by GMLvL.com on October 29, 2006 at 05:50 PM PST #
Posted by globalleveling on October 29, 2006 at 07:07 PM PST #
Posted by trtrt on November 04, 2006 at 01:06 PM PST #
Posted by viagra on November 06, 2006 at 12:33 AM PST #
Posted by phentermine on November 06, 2006 at 12:34 AM PST #
Posted by WOW GOLDxadaa on November 07, 2006 at 09:38 PM PST #
Posted by fsdfsdfsrfgrAdministrator on November 07, 2006 at 09:38 PM PST #
Posted by zelanda on November 08, 2006 at 05:13 AM PST #
Posted by 60.176.139.252 on November 19, 2006 at 05:06 PM PST #
Posted by www on November 21, 2006 at 07:01 AM PST #
Posted by www on November 21, 2006 at 07:02 AM PST #
Posted by immergruen on November 23, 2006 at 12:59 PM PST #
Posted by backgammon on November 23, 2006 at 11:01 PM PST #
http://www.SexToySex.com/toys-bdsm bondage restraints
http://www.SexToySex.com/gaysextoy-store Butt Plugs
http://vod.sextoytv.com/index.k?a=gaysextoy-store porno gay
http://vod.sextoytv.com/index.k?a=toys-bdsm Bondage Porn
http://vod.sextoytv.com/index.php?a=lesbian-strap-on Lesbian Porn
Posted by discount sex toys on November 30, 2006 at 04:27 AM PST #
Posted by backgammon on December 03, 2006 at 03:37 PM PST #
Posted by vacek on December 19, 2006 at 02:54 PM PST #
Posted by olo on January 05, 2007 at 02:06 PM PST #
Posted by xiaonan on January 06, 2007 at 12:46 AM PST #
Posted by xiaonan on January 06, 2007 at 12:47 AM PST #
Posted by olo on January 24, 2007 at 12:01 PM PST #
Posted by olo on January 26, 2007 at 06:03 AM PST #
Posted by www on January 27, 2007 at 08:43 AM PST #
Posted by google排名 on January 30, 2007 at 07:16 PM PST #
Posted by 病院 on February 09, 2007 at 03:28 AM PST #
Posted by Chantix on March 16, 2007 at 11:23 AM PDT #
Posted by WOW on March 26, 2007 at 07:23 AM PDT #
Posted by SDF on March 26, 2007 at 07:24 AM PDT #
Posted by aa on March 29, 2007 at 02:24 PM PDT #
Posted by publish articles free on April 13, 2007 at 02:10 AM PDT #
Posted by antibiotics online on April 13, 2007 at 02:44 AM PDT #
Posted by Jimmy King on May 02, 2007 at 07:24 AM PDT #
Posted by Jimmy King on May 02, 2007 at 07:25 AM PDT #
Posted by Jimmy King on May 02, 2007 at 07:26 AM PDT #
Posted by Jimmy King on May 02, 2007 at 07:26 AM PDT #
Posted by Jimmy King on May 02, 2007 at 07:27 AM PDT #
Posted by Jimmy King on May 02, 2007 at 07:27 AM PDT #
租车|快来租提供(上海租车二手车|)服务,专业汽车租赁公司. Google排名 翻译公司 北京翻译公司 北京翻译公司 上海翻译公司 深圳翻译公司 广州翻译公司 北京印刷公司 印刷 小游戏 flash小游戏 休闲小游戏 美眉小游戏 化妆小游戏 休闲小游戏 mm小游戏 迷你小游戏 上海办公用品 北京办公用品 办公用品 北京整形医院 机票 数据恢复 成人用品 减肥 注册公司 注册香港公司 注册香港公司 租车 数据恢复 搬家 整形 数据恢复 小游戏下载 休闲小游戏 迷你小游戏 标签 在线小游戏 网站优化 搬场 机票 轴承 阀门 室内设计 深圳租车 留学
Posted by 二手车 on May 07, 2007 at 12:03 AM PDT #
Posted by 混合机 on May 11, 2007 at 07:04 AM PDT #
Choosing an Online Adult Sex Toys Shop can be quite overwhelming. With literally thousands of online adult sex toy shop offering an abundance of adult sex toys it can be a very stressful process when all you are looking for is to relieve some stress. There are several key factors when choosing an adult sex toy shop. It's essential that you follow these adult sex toy buying tips to ensure your complete overall satisfaction. The first step in choosing an online adult sex toys shop is how many years has the company been in business.
sex toys vibrators
sex toys vibrators
sextoys vibrators
sextoys vibrators
Penis Extension sex toys
Penis Extension sex toys
Posted by sex toy vibrator on June 10, 2007 at 04:28 PM PDT #
<a href="http://sexmachines.ouradulttoys.com">sex machines</a>
<a href="http://sexmachines.ouradulttoys.com">fucking machines</a>
<a href="http://sexmachines.ouradulttoys.com">sex machine</a>
<a href="http://sexmachines.ouradulttoys.com">bondage restraints</a>
<a href="http://sexmachines.ouradulttoys.com">electro sex</a>
<a href="http://sexmachines.ouradulttoys.com">chastity devices</a>
<a href="http://sexmachines.ouradulttoys.com">mouth gags</a>
<a href="http://sexmachines.ouradulttoys.com">bedroom bondage</a>
Posted by adult toys on August 07, 2007 at 05:07 AM PDT #
<a href="http://www.ansenterprises.com.hk/buying-office-representative.htm">buying office</a>
<a href="http://www.ansenterprises.com.hk">project management</a>
<a href="http://www.ansenterprises.com.hk/direct-import-logistics-management.htm">logistics management</a>
<a href="http://www.23799298.com">搬屋公司</a>|
<a href="http://www.richcomming.com">搬屋</a>|
<a href="http://www.hkyanda.com">搬屋</a>|
Posted by 货架 on August 09, 2007 at 12:49 AM PDT #
<A href="http://www.ls-lawtrans.com/" rel="nofollow">北京翻译公司</a>
Posted by 网站建设 on August 23, 2007 at 06:52 PM PDT #
http://www.runescape2gold.net
http://www.goldsrunescape.com
http://www.runescapegold.us
Posted by runescape on August 30, 2007 at 11:21 AM PDT #
http://www.runescape2gold.net
http://www.goldsrunescape.com
http://www.runescapegold.us
Posted by runescape gold on August 30, 2007 at 11:22 AM PDT #
[url=http://www.gopowerlevel.com/]wow power leveling[/url] [url=http://www.gopowerlevel.com/]wow powerleveling[/url] [url=http://www.gopowerlevel.com/]world of warcraft power leveling[/url] [url=http://www.gopowerlevel.com/]world of warcraft powerleveling[/url] [url=http://www.game-win.com/wow-powerleveling.html]wow power leveling[/url] [url=http://www.paper-cup-machine.com]paper cone machine[/url] [url=http://www.cardel.cn]briefcase[/url] [url=http://www.sinceremachine.com/]paper cup machine[/url]
Posted by fdgfgdfg on September 02, 2007 at 08:08 PM PDT #
[url=http://www.game-win.com]wow powerleveling[/url] [url=http://www.game-win.com/]powerleveling[/url] [url=http://www.game-win.com]world of warcraft powerleveling[/url] [url=http://www.game-win.com/]power leveling[/url] [url=http://www.game-win.com]wow power leveling[/url] [url=http://www.game-win.com]world of warcraft power leveling[/url] [url=http://www.game-win.com/World-of-Warcraft-power-leveling.html]world of warcraft power leveling[/url] [url=http://www.high-replica.com]replica handbags[/url] [url=http://www.game-win.com/wow-powerleveling.html]wow powerleveling[/url] [url=http://www.paper-cup-machine.com/cn/index.html]纸杯机[/url] [url=http://www.paper-cup-machine.com]paper cup machine[/url]
Posted by fdgfgdfg on September 02, 2007 at 08:09 PM PDT #
[url=http://www.juliankfashion.com]leather jackets[/url] The essential one-step product for complete leather care. URAD NEUTRAL [url=http://www.cigars-and-cigarettes.com]buy cigarettes[/url]
<a href="http://www.official-casino-news.net">online casino</a> | <a href="http://www.official-casino-news.net/japan/index.htm">オンラインカジノ</a> | <a href="http://www.official-casino-news.net/spain/index.htm">casino en linea</a>
Posted by best online casinos on September 06, 2007 at 11:09 PM PDT #
[url=http://www.blog-for-all.com ]casino, online casino, internet casino, beste casino [/url]
[url=http://www.blog-for-all.com/sitemap.asp ]sitemap, das beste casino [/url]
[url=http://www.blog-for-all.com/2.asp ]blackjack, online blackjack, internet blackjack, beste blackjack [/url]
[url=http://www.blog-for-all.com/3.asp ]slots, online slots, internet slots, beste slots [/url]
[url=http://www.blog-for-all.com/4.asp ]roulette, online roulette, internet roulette, beste roulette [/url]
[url=http://www.blog-for-all.com/5.asp ]craps, online craps, internet craps, beste craps [/url]
[url=http://www.blog-for-all.com/6.asp ]video poker, online video poker, internet video poker, beste video poker [/url]
Posted by online casino bonus on September 06, 2007 at 11:18 PM PDT #
hello all
Posted by prescription zyban on September 06, 2007 at 11:21 PM PDT #
[url=http://www.blog-for-all.com/7.asp ]poker, online poker, internet poker, beste poker [/url]
[url=http://www.blog-for-all.com/8.asp ]baccarat, online baccarat, internet baccarat, beste baccarat [/url]
[url=http://www.blog-for-all.com/9.asp ]keno, online keno, internet keno, beste keno [/url]
Posted by internet casinos usa on September 06, 2007 at 11:22 PM PDT #
experts who master the most professional skills. Even with no more than 17hours' work, a better service is of avail as promised than those freshman ,rookie or the nasty bots and macros.
www.lvlnirvana.com
www.lvlnirvana.com
www.lvlnirvana.com
[url=http://www.lvlnirvana.com//
Posted by 121 on September 28, 2007 at 10:25 PM PDT #
the most professional skills. Even with no more than 17hours' work, a better service is of avail as promised than those freshman ,rookie or the nasty bots and m