RyuJIT and .NET 4.6

It’s been a while since we’ve posted here, and a lot has happened with RyuJIT since the last post.

First and foremost, RyuJIT is the default x64 JIT for .NET 4.6! As a result, there is no need to use a RyuJIT CTP to try out RyuJIT. If you install the .NET 4.6 Preview (included in Visual Studio 2015 Preview), or later build, such as Visual Studio 2015 RC, you will be using it. See here or the .NET blog for more details.

One thing we need to point out, though: if you have previously configured your machine to use a RyuJIT CTP (using the instruction here), and you update to .NET 4.6, you need to make sure the COMPLUS_AltJit environment variable and the HKLM\SOFTWARE\Microsoft\.NETFramework\AltJit registry value do not exist. If they do exist, every .NET application will fail to run. You don’t want that!

Update: the specific failure you will get is exception number -2146233082 (in hex: 0x80131506), otherwise known as COR_E_EXECUTIONENGINE or "Internal CLR error". This will be the process exit code. For console applications, you can see this by examining %ERRORLEVEL% after the process terminates (if you are working in a CMD.EXE window). You may also see a dialog box stating "<application> has stopped working", and if you expand "View problem details", you will see "Fault Module Name: clr.dll" and "Exception Code: 80131506". You will also see an entry in the Event Viewer, Application log, source ".NET Runtime", listing this error code. Note that there are other reasons this exception number could be generated; a stray AltJit configuration is not the only reason for this exception.

Note that this information has also been published as KB3065367 here.

Secondly, RyuJIT is now open source! See here for details. 

We hope you enjoy the benefits of all the work we’ve put into RyuJIT. If you have any feedback on RyuJIT, send us mail at ryujit@microsoft.com. We want to hear from you!

Comments

  • Anonymous
    May 27, 2015
    Have there been improvements in code quality in the last few month? I have not notice any since a few CTP's back and I did extensive testing. The latest public VC prerelease version has none, either.

  • Anonymous
    May 27, 2015
    But for x86 you still use the "old" JIT, correct?

  • Anonymous
    May 27, 2015
    Is it the case that the current 4.6 Preview does not support SIMD? I tried and my SIMD stuff did not work :(

  • Anonymous
    May 27, 2015
    That whole "every .NET application failing to run" was not a fun experience to run into.  Glad you're trying to get the word out there about this incompatibility.

  • Anonymous
    May 28, 2015
    Why not completely get rid of COMPLUS_AltJit and AltJit?Temporary/testing flags must never exist before (never reused a previous one) and they should never remain after test period.

  • Anonymous
    May 28, 2015
    @mark: There may be some, but not extensive. We've mostly been focused on fixing bugs and incompatibilities (with the previous x64 JIT) through extensive testing.@Andrew: yes. The x86 JIT is essentially unchanged.@David: it should. Try the RC build.@Betty: sounds like you ran into this issue. Sorry about that...@MuiBienCarlota: we're working on a real fix that won't require user action. We have to be able to see into the future a bit, because we want to be able to ship RyuJIT CTPs again, in the future, that will be based on .NET 4.6. We've always wanted to do this by only shipping a side-by-side JIT .dll that doesn't affect your existing install (instead of shipping a "full" .NET that includes the right "test hook"). This makes the process of shipping a CTP much, much easier. So, we need to insert the right hook now into the shipping .NET to allow that to happen in the future. That's what the "AltJit" mechanism was: an existing hook in .NET that could be used for our CTP.

  • Anonymous
    May 28, 2015
    Which SIMD instruction set does RyuJIT support now (AVX2)? How big is the perf hit of RyuJIT x86 compared to the existing x86 JIT? It would be great to have one common JIT code base. I really hope that your team can make it faster than the guy that did write the x86 JIT.

  • Anonymous
    May 28, 2015
    @Alois: (1) RyuJIT supports AVX2, if available, else SSE2. (2) There is no RyuJIT x86 currently, so there is no comparison to the existing x86 JIT. We certainly agree about having a common code base.

  • Anonymous
    May 29, 2015
    @Betty i had the same problem and have spend ~1,5 days in WinDBG figuring out why the .NET CLR tries to free a memory address not mapped to it´s process.. turned out it was RyuJIT CTP5 enabled with .NET 4.6, i dropped Bruce Forstall a mail and i guess he created this blog entry in response. Hope this saves some people some time figuring this out.. However as soon as you know it´s RyuJIT you will remember you installed CTP x some weeks ago probably, so you are already on the right track, getting there is another story..

  • Anonymous
    July 13, 2015
    Is the new x64 JIT compiler only used if an application targets .NET 4.6+ or is it used for older apps too?

  • Anonymous
    July 22, 2015
    @Thomas Z: it is used for all applications running on .NET 4.6, not just applications targeting .NET 4.6+. This page might help explain .NET versioning: msdn.microsoft.com/.../bb822049(v=vs.110).aspx

  • Anonymous
    July 26, 2015
    We had to disable the new compiler for our application. All of our applications fail without HKLMSOFTWAREMicrosoft.NETFrameworkUseRyuJIT set to 0. We have had to send out instructions on how to modify your registry to any of our customers who have 4.6 installed.

  • Anonymous
    July 27, 2015
    I didn't  download the RyuJIT CTP, and still find that my managed apps won't load after installing Visual Studio 2015 (.NET 4.6).  Disabled HKLMSOFTWAREMicrosoft.NETFrameworkUseRyuJIT but that didn't help.  There is no AltJIT entry in the registry. Will uninstalling VS 2015 and .NET 4.6 fix this?  My development had been stopped.