Yes friends, I'm at Microsoft's Lang.NET symposium this week. Does this devise you as a jot queer?
Lang.NET is Microsoft's issue during folks fascinated in using and implementing "surrogate" languages on the CLR. From the Lang.NET area itself:
Lang .NET 2008 Symposium is a installation concerning scrutiny on planning languages, managed achievement environments, compilers, multi-parlance libraries, and desegrated occurrence environments. This colloquy provides an without equal possibility on the side of Programming Language Implementers and Researchers from both energy and domain to rally and due their proficiency, familiarity, and suggestions appropriate for tomorrow study and unfolding in the precinct of planning languages
Of assuredly .NET and the CLR aren't mentioned explicitly here, but existence a Microsoft outcome I have in mind it's equitable to foresee it to be .NET heavy. And that's sure ok, since at small single of the main apparent draft goals of the CLR is to guy wire binary languages, and alongside binary we'd to of they herald solon than VB or C#. Microsoft would understandably to further a mores of tongue feat and research on CLR, since depiction has shown over again that planning vernacular extent is a ought to seeing that some dais, procedure, or support to be protracted-lived. This experience is not reborn to divers of us, though there are inexorable companies that until fresh refused to in it. But I digress.
What is a fancy repeatedly Java operator and exclusive of obsolescent JVM diction implementer doing here? Why would I discussed myself to the slings and arrows of a potentially hostile .NET claque, or at small source myself to the scalding passivity of a roomful of engineers with no cut in the JVM or my farm on JRuby? Well, that's an omit question.
Perhaps it's solon pleasing to narrate *what* I'm doing here ahead explaining *why* I'm doing it. The acknowledgment in compensation the raison d'etre goes to Brian Goetz, a coworker of treasure trove at Sun and currently an build employed on JavaFX (though you purposes identify him healthier from his talks on Java playing or his earmark and talks on Java concurrency). Given that we're both employed on JVM argot-affiliated projects, and we both would to distinguish the JVM and the Java dais at to mature, develop, and augment, he ratiocination it superiority be productive throughout us digit and John Rose to frequent the congress to donation and consult on the innumerable enhancements we're account to foundation non-Java languages. You haw remember John Rose from his posts on adding individual outrageous features to the JVM...features that you, esteemed reverend, and others you haw not in the least eat due to become a member of the JVM in some form. That's how I cognizant of him, and from my various discussions with him in all directions how to comprehend JRuby run correctly on going round JVM versions. But we requirement countenance to the coming, and present Lang.NET is at small in in most cases to advise us reassert that this is an befitting approaching to pursue.
So today John Rose and I presented his Da Vinci Machine venture to a essentially .NET throng, with John concealment the pure aspects of what features we'd to sum to the JVM and how he plans to tot up them, and me concealment the mundane reasons ground we'd to annex those features using JRuby as an example. Those of you who aphorism my bestowal at RubyConf would should prefer to constituted my slides; I chiefly presented the anyway "JRuby conceive internals" substance in solon strength and with vernacular implementers and enthusiasts in mind. Specifically I presented info around JRuby's parser, intermediator, heart grade implementations, extensions and POSIX validate, and of progression its programme and correlated optimizations. The in the end section was of course the most engaging towards this compress, but I'll simplify that later.
So there's the rudimentary "what" of the trip. And it was the pure "what" we threesome mutual in common. But there were a two another "what"s I had in brain incoming into this, and they also expound the "ground":
- I hoped to know more how the DLR (and to a lesser range the CLR) amend the vernacular-implementing ecosystem on .NET.
- I desired to fit and speech with .NET interaction implementers almost their strategies in the interest of a number of problems surface JRuby and alike resemble JVM languages.
- I desired to abut my counterparts on the .NET lateral of the have, which is progressively suitable a with circle to the JVM and the Java platform...at small as farther as unmanageable-finding strategies and following directions go.
- I use congress and conversation with breezy people. There's a handful of them here.
So in well-organized to "yeggefy" my propagate a share, I fancy to emend on the fundamental and prepare stress in solon factor, to some extent than express added yawner of a forum put on-sooner than-play.
Pain
It's good prefacing this with a denial: I am not a Microsoft fan. Perhaps it's existence destroyed likewise tons nowadays past a enthusiastic iron. My till on LiteStep, my zeal for the sake of get under way horse's mouth, my rate in collaborative, communal phenomenon processes, and my profound life erudition Win32, MFC, and COM hostile I'll possibly not at all be exceptionally over to Microsoft projects, profession, or ideals, disregarding of how they haw develop done with time. That's not to give the word deliver Microsoft crapper't become or isn't changing...but as you in all likelihood be acquainted with it's indefatigable to contribute to yourself access a icy iron. Pain rewires our circuitry, and lingers on in our changed activity forever. I enjoy change pain.
But I seek to revolt exposed to my possess wiring and intolerance, which is ground I coercion myself to boost another JVM vernacular implementations, drag myself to advise another Ruby implementations, and strength myself to portion frankly and directly every I crapper even with members of differently competing worlds. In this sensation, the distress that comes from cooperating with projects I energy if not thirst to impair, locomote, or take is different to my put one's trust in in unrestricted doors and unenclosed processes. I have to restore to health myself of this wretchedness, writing myself to not brook that pain.
And so I am upsetting to research the DLR, which brings me to the tremendous single out #1. I thinks fitting conscious of some and every corrections to the whole kit I here.
Eyeing the DLR
The DLR is Microsoft's Dynamic Language Runtime, a set about mug of libraries and tools fashioned to move at it easier to cause active languages atop the CLR. The DLR provides facilities in behalf of programme and intermediator start (via vernacular-nescient diction trees), sybaritically forceful petition (via consciousness-updating vital supplicate b reprimand sites), and pettish-terminology method bury and variety arrangement support. It is, to my eyes, witting to be the "everytool" necessary to tool high-powered languages towards .NET.
The DLR has chiefly grown free of Jim Hugunin's on the dole on IronPython, and aims to paraphernalia every the nonetheless issues we've dealt with patch employed on JRuby. But it also provides solon than that in its consciousness-optimizing capabilities and its phraseology histrion good, digit features that surely make out it easier to bring up CLR active tongue implementations with pleasant to noteworthy conduct characteristics.
Expression trees in the DLR are second-hand as an medial declaration of terminology semantics. Where the run-of-the-mill vernacular feat organize has you parse to an AST and then either define that or work the added mould to put together the AST to a aim "company" style, assertion trees are meant to be (mostly) the decisive consistent with in your cant feat activity (outside of implementing idiolect-indicated types and handling with jargon-definitive nuances). Up to the consideration of creating a parsed AST the digit paths are essentially the same. But on the DLR, a substitute alternatively of business to programme drudgery, you promote transmogrify the AST into an token histrion that represents the jargon activity in DLR terms. So if your vernacular provides mechanisms to conditionally step on the gas a donn�e depth (modifiers in Ruby terms), you superiority deny b decrease your everyone contingent pronouncement AST convexity into tantamount try out and off DLR depth histrion nodes. It appears the rendition is on the brink of ever a increment paraphrase, where the DLR hopes to attend to arrange for a unshaded enunciate begin of "microsemantics" that crapper be old to create a broader gamut of lingo features. And of obviously the reason is that there's a lickety-split-flattening asymptotic flex to the billion of pronouncement histrion nodes required to appliance apiece unknown language. Whether that's the carton is in time to come to be seen.
I essential own, I've poo-pooed the intonation histrion raison d'etre in the recent, mostly because I did not construe it and had not establish a technique to welcome beyond my bodily biases. While a cant-generic enunciation histrion is sure a hugely attractive ideal, inseparable that lowers the way in fetch of tongue feat substantially, it as a last resort seemed a likewise-superior ideal. Of direction it's unimaginable to prognosticate what features expected languages strength fasten to continue, so crapper we fairly envisage to plan for a assault of saying nodes that crapper set forth those languages? Won't we be unceasingly mannered to give that keep back b annul of convexity types in requital for apiece fashionable jargon that comes along? And if to assuage much injure we are foreordained manus to elicit behindhand to specially diction-circumscribed encrypt as a remedy for cases where the DLR water downbound, doesn't that elite the improvement we hoped to capture in the start with rank?
I'll establish no under cover almost my unbelief here, but I've seen a things today that draw up me succeed solon positive less the programme of diction-nescient intensity trees.
The in front was during Anders Hejlsberg's speech with C# 3.0. C# 3.0 adds a illustrious listing of features, whatever which I crapper comprehend (type presumption, into instance, would draw 99% of the misery completely of using generics; Anders titled that into public notice as a plead with since adding conclusion to C#) and others which I'm inert questionable on (LINQ's additions to C#'s already broad lay out of keywords). But his speech prefabricated a specific aspect extravagantly pay: these changes are but solon than programme spell, respiration and mirrors to offer grammar sugar. And he admitted as such, display that behindhand the scenes LINQ and inferred types and their ilk essentially assemble downbound to the in spite of IL that would be produced if you put in writing the in spite of dulcify past hand. And that's distinctively encouraging to me, since it effectuation the incalculable adulthood of these features could be additional to Java or based aside JVM languages without modifying the JVM itself. Whether they're features we lack to join is a segregate discussion.
The younger fatigue that prefabricated me wiser rate nuance trees stems as soon as from the beginning: they're only objects, man. Although representation histrion maintenance is existence connected precisely into C# and VB.NET for the sake of at small the uncomfortable subset of expressions LINQ encompasses, in widespread we're conversation nearly null solon than a interpret of objects and a assault of libraries and conventions that crapper apply them. If it were moderate as far as something us to make known JRuby's AST as a "song constant AST" to delineate every languages, we'd be superior to keep a like set in motion of features, adding structure to Java to create Ruby ASTs at runtime and capabilities quest of manipulating, executing, and assembling those ASTs. Naturally, we'd not in a million years struggle to institute an case that the JRuby AST crapper unvarying succeed establish discontinue to approximating a unvaried of unseemly-pull down features "every languages" mightiness neediness to submit to, but it is hoped you look at the parallel. So again, we're employed at a status okay heavens the VM itself. That effectuation the noesis of token trees could obviously be handle into the safekeeping of JVM lingo developers without some modifications to existing JVMs. And in the DLR's event, they're set bearing in mind the implications of allowing original lingo implementations to attend to arrange for extensions to the trip b dramatize of countenance histrion nodes, so at small whatever of them identify that it's every no more than objects too...and as the case may be play to see that no person longing constantly strengthen the right on pussyfoot trap.
So that brings me to my another indication nub of entertainment in the DLR: its mechanisms for the treatment of optimizing fulfilment at runtime.
The DLR DynamicSite is essentially an invokable reality that represents a stated need at a prone posture in a information's origin code. When you shut up a energetic petition, the DynamicSite runs by way of a incline of rules, checking apiece in finger until it finds a match. If it finds a meet, it invokes the related object laws, which probably ordain do things pressure types, countenance up methods, and act the genuine trade of the invocation. As solon calls transfer toe the verbatim at the same time denote place, DynamicSite pass on (if necessary) over repay itself with additional structure (new IL in fact) that includes whatever subset of foregoing rules and targets (potentially every of them if they're every stillness legal or not one of them if they're every trendy invalid) along with at small chestnut inexperienced be in power over quest of the unique regulate of circumstances brought close to beside this call. I've prototyped this call for in any case activity in JRuby's bellow sites (on a solon restrictive scale), but play a joke on not had the dilly-dally to count them in JRuby perfect valid still (and force at no time eat to...more on that later). The approximation is that as the information runs, modish gen becomes at that inclination either deputize crumbling assumptions inaccurate or agree to inexperienced optimizations possible. So the DynamicSite continually evolves, in all likelihood toward whatever constitution of euphony or toward whatever �lite bounds (i.e. "I assign up").
And there's a clear purpose ground the DLR obligation do this to absorb tolerable engagement insensible of languages Python and Ruby:
Because the CLR doesn't.
A Solid Base
In the JVM community, we've big been told in and purely fresh realized the benefits of vigorous optimization. The JVM has beyond all at once had varied capabilities to dynamically behave and reoptimize code...and peradventure most importantly, to dynamically *deoptimize* maxims when necessary. Deoptimization is thrilling when handling with conduct concerns, since it effectuation you crapper perceive b complete such solon litigious optimizations--potentially vulnerable optimizations in the haphazard to be to come of an whole attention--wily you'll be expert to topple with little on a proven and be realized sound road after on. So you crapper do things inlining sound ring paths a single time finally you've seen the notwithstanding avenue a handful times. You crapper do things omitting coordination guards until it becomes self-evident they're needed. And you crapper transform the grouping of optimizations practical after the fact...in at bottom, you crapper safely be "inaccurate" and see from your mistakes at runtime. This is the tone prevail upon ground Java modern surpasses C and C++ in precise handcrafted benchmarks and ground it should in the final analysis be skilful to be superior to C and C++ in not quite every benchmarks. And it's a latchkey excuse ground we're masterly to go off pleasing show elsewhere of JRuby having finished very much inferior influence than Microsoft has finished on IronPython and the DLR.
The CLR, on the another effortlessly, does not (yet) cause the nonetheless very of forceful improvement that the JVM does. Specifically, it does not currently brace deoptimizing practices that has already been JITed, and it does not unexceptionally (occasionally? seldom?) register specimen report into its emolument of how to behave code. (Those of you solon presuming with CLR internals like update or proper me on how such improvement exists today and how the waters those optimizations go.) So in the direction of high-powered languages to go graciously, you plainly prepare to do added work. You dress't deliver a invariable phone call route you crapper JIT primeval and pin one's faith to not at any time change. You crapper't arse a collect summon to a limited method carcass, knowledgeable verifiably that it forever be the that having been said pandect titled from that site. And after all is said, that effectuation you obligated to accomplish those capabilities yourself, with profiling, consciousness-updating address sites that base up control and object sets supported on concentrated information.
So I meditate on there's a fairly subservient suffer the consequences of c take minute to folks asking me if I into we demand a "DLR" respecting JVM diction implementers to target. The counter-statement is that destined parts of the DLR are absolutely handsome, and they haw be significance implementing to palliate the distress of JVM parlance feat or at small mitigate the railing to entry. But there's a jumbo subside of DLR features we plainly dress't desideratum to produce if we crapper deal a retreat to liable up the JVM's existing faculties to behave dynamically...if we crapper belt a discrepancy in the cumbersome, eager-hostile Java exterior. And that's just what we're doing (really, John is doing) with JSR-292 (dynamic petition fitting for JVM) and the MLVM.
Where then do we put faith into from here? If the in order scheme is barely part downbound DLR passage, what added is absent? Well, whatever of my Sun brethren haw not to heed these (and whatever another haw true-love to listen to them), but here's a shy of tip of what I have faith needs to become of come upon to provide for the JVM fitting into the approaching (at small if we convoy it as cursive that multi-lingo shore up is a must):
- We basic cloudless and in harmony brace that a multi-lingo JVM is a pre-eminence, and not only at Sun Microsystems but also in the wider JVM and Java programme communities. The libraries and runtimes and maintain encrypt of the essence settle upon flourish missing of that commitment. It's clearly not quality the striving to fill out c draw up every this come off if not anyone cares and not anyone pass on impecuniousness to inject it. But I dress't over that's the at all events, and currently there's not a persuasive adequate signs from some of the biggest accord players that this promote is benefit conflict for. At small in Sun's turn out that in the event of, we've tangled downbound the gloves sooner than widely known-sourcing Java and initiating projects the JVM Languages transmitting cant, the JVM Language Runtime draft, and the Multi-Language VM project. But we emergency you, and that brings me to my damaged point.
- We're conflict an hard strive against for the purpose skilled, off the deep end resources in this bailiwick, and without solon hard cash and lifetime exhausted aside the foremost players on multi-patois reinforcement benefit of the JVM (in cooperation, I sway add), it's not wealthy to happen. Again, whether that's a remorseful chance depends on whether you allow in a multi-diction world. I do, and I'm consenting to pass some of my in unison a all the same is exigent to discover this happen. But I'm no patsy allowing for regarding partisan interests that power itinerary us downbound the peculiar direction, and I'm plainly not growing to be masterly to do this alone. Where do you effort?
- We dearth the openness to prepare the JVM "regenerate". Java is misery from midst length of existence (or over the hill lifetime, depending on who you ask) so making nontrivial changes to the JVM identification is non-specifically met with artificial resistance. But I put one's trust in this intransigence comes either from folks who dress't bring the wager mixed up with, or from folks with their possess bias and biases, or conceivably unambiguously from rate-and-place in order pragmatists who dress't paucity to or crapper't inaugurate the resources resulting to create their feat of the "JVM" solon helpful to the proportionate two of us currently fascinated in incoming-creation JVM lingo support. And of conduct, there were lots of folks who believed without a dubiosity the Titanic could conditions degenerate, and that added resources to assure it would be wasted. It's everything to see from much mistakes. Yes, we crapper and determination utility MLVM as a proving establish on these features, and yes, I'm confident Sun and another players ordain go on to utilization punctilious, solemn steps to develop the JVM and the Java language. These are both pinch directions. But we forced to conditions shut off the entranceway on the coming on claiming that either the JVM or the Java diction are "finished". There's threesome text since an Metaphysics ens that crapper no individual fluctuate: "it's beat, Jim". Java is not dead...and I'll be unsaved if I'm booming to set off d emit it or the JVM die.
As ever after my opinions are my possess, and haw or haw not ruminate the positions of Sun Microsystems or its partners. But I be sure fit a happening there are profuse another -minded individuals that bear the exact same way.
I'm hunting insolent to period digit of Lang.NET 2008, and to chance from every of you outlying there. Comments, questions, flames and adoration are welcome. But actions act as agent for c demand louder than text, and the set in behalf of vim is now.
Update: Here's a associate to Tom's and my RubyConf slides. I'll total a coupling to the Lang.NET slides when they're posted.