The .NET Native Tool-Chain
blogs.msdn.com
blogs.msdn.com
Fun fact, MonoTouch applications are built with a very similar pipeline, except that LLVM does the compilation in the end.
The steps 4 and 5 in the blog post map quite exactly to the Mono.Linker and the Mono.Tuner. Both tools are using a XML file format for whitelisting pieces of code that need to be included, that's useful if you're calling code with reflection at runtime which is not statically discoverable at build time.
.class public Foo
{
.method public static int32 Add(int32, int32) cil managed
{
.maxstack 2
ldarg.0 // load the first argument;
ldarg.1 // load the second argument;
add // add them;
ret // return the result;
}
}If you ever look at a disassembled CLR executable, expect to see a heap of lines like:
valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.CallConvThiscall) 'A.{ctor}'(valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.IsConst) modopt([mscorlib]System.Runtime.CompilerServices.IsConst))
Clojure and Scala seem to be tied for 2nd place popularity behind Java, but Groovy's lagging far behind. Were you looking at the bintray-maven download stats at https://bintray.com/groovy/maven/groovy/view/statistics for Groovy when you put it in with Scala and Clojure? Even tho those stats show 660,000 downloads of Groovy over the past month, click on country and you'll see 625,000 of them came from a server in China, only 12,000 from the US, and 2000 from Germany, the 3 biggest countries. Obviously the China stats are fabricated. Groovy's true popularity is far behind Scala and Clojure.
MDIL is described to be the platform's native machine code + some extension tokens (to avoid direct encoding of pointers, for example).
A similar LLVM IR derivative would no longer be by a long shot something resembling LLVM IR, so the property of being "derivative" would not buy you anything.
It comes from the Singularity OS compiler toolchain, which is older than LLVM.
It is also used to deploy .NET applications as native code on Windows Phone 8 devices.
http://en.wikipedia.org/wiki/Singularity_%28operating_system...
Although the first published papers are indeed from 2004.
I'm going to guess that in this case, their reason to not go with LLVM was the most compelling one possible: When Microsoft was designing the .NET toolchain, LLVM didn't exist yet.
Given the timing of when it came out, I wouldn't even be surprised if LLVM wasn't at least partially envisioned as an open-source answer to .NET. In which case there's a hint of NIH behind LLVM, with Mono being the non-NIH open source option.
.NET Native uses MDIL to create a looser coupling between NUTC and the runtime. This means NUTC doesn't have to understand the precise binary layout of the runtime. The binder takes care of fixing that up!
MDIL has more advanced capabilities too. For more background on MDIL, I highly recommend watching the video I linked to in the blog post: http://channel9.msdn.com/Shows/Going+Deep/Mani-Ramaswamy-and...
At least for me, this was a small original appeal of C#/Mono
I hope so. In the 90's we had strong typed languages with native compilers, somehow we got into this VM detour because everyone wanted to create applets.
And those languages[1], for multiple reasons faded away.
[1] Oberon(-2), Object Pascal, Modula-2, Modula-3, ...
(I also strongly suspect that this entire "native" move was fueled purely by that top-of-the-bill Windows 8 computers take 5 seconds to start up the damn Weather app)
On the library side, there's a strong move towards the opposite, actually: you can now make a (MSIL) DLL that runs on Windows, Windows Phone, iPhone, Android, Mono, etc etc without having do distribute different versions (basically, what Java always had) of the binary. It's overdue, but it's really nice.
I'm not worried (and I run a dev team that runs a C# backend on mono/linux).
Bingo. Especially on 64-bit machines, the time it takes for apps to launch can be downright embarrassing.
If you fully understand Microsoft's portfolio it makes more sense.
Desktop Windows 8 is a scenario, but not a very good representative. While 64-bit JIT time can take a while and CLR startup time can be really long, both of these things can be addressed in a variety of ways in vanilla Windows machines, ranging from NGen improvements to CLR pre-loading strategies.
The real killer is alternate platforms. Every time you JIT in a mobile device it wastes time, CPU power, and battery life, all of which are much more limited than in a desktop machine. CLR startup can be mitigated somewhat, but resident memory is an especially precious commodity on mobile.
The last real kicker is that security concerns mean that many platforms (XBox) mark a lot of their pages as NX, making JIT-ing in these pages very difficult or impossible. Moreover, better security infrastructure means doing this on more platforms more of the time, so this will become increasingly problematic.
All together, this makes a very compelling case for AOT compilation.
Actually, the early designs from .NET were COM based and known as COM+ VOS. If you read the design document you will find many similarities with the new Windows Runtime.
Even now, having an intermediary binary format's still fairly valuable. I could conceivably get a component from a vendor and put it into production on a slew of different platforms - Intel chips running Windows, Linux and OS X, phones with A5 or ARM chips, etc. without having to mess around with source code distributions, other people's funky build configs, etc. The ones going on smartphones would eventually be native-compiled, but getting bytecode binaries means I don't need to fiddle with separate native binaries for different target platforms.
It's also worth noting that what the Java and .NET platforms have achieved in terms of language interoperability hasn't really been matched by interpreted and native-compiled languages. That's arguably a result of culture rather than any sort of technical limitation. OTOH, the technical limitation that the .NET and Java virtual machines define object formats, function signatures, and whatnot does go a long way in facilitating interoperability.
Finally, the .NET and Java assembly languages are dead easy to target, especially compared to those of complex architectures like x86. Even if shipping native binaries becomes dominant in the .NET space, MSIL won't be going away. And it makes everyone's life easier to not have to reinvent the "native code generation" wheel for every possible programming language/CPU architecture pairing. LLVM's a big deal for the same reason, and to some extent the only really big difference between it and .NET or Java is that it doesn't encourage people to package bytecode up into executables.
We've got boat-loads of it, and while we're slowly retiring it, we can't even diagnose trouble-spots because most monitoring tools (like New Relic) don't instrument it.
We are starting again, the mobile site for 1 of our 33,000 domains is in testing, but it will be over a year before we have most of our customers using it.
We're in the painful process of upgrading off ASP, DefaultHttpHandler code that requires 15-min recycle limits, 32bit DLLs with a GAC refresh process, 32bit IIS 6.0, MS NLBs, SQL 2000 DTS and undocumented built-in-house data-import processes, SQL 2005 main database servers, PowerEdge 2850s, and entirely non-cached nor accelerated sites.
Also, note that end users wouldn't be trying to transform MDIL back to source code. MDIL goes through the 'binding' step that transforms it to native machine code.
Golang is much more minimal. It does have some very nice concurrency features that could be a big win for some users. C# is fine at concurrency, but Golang's way of integrating it into the language is definitely more streamlined.
IMO pick the best tool for the job. In many cases, large enterprise pieces of software that want the mature tooling of C# will benefit from .NET Native. /rant