Does the JIT take advantage of my CPU?

  Short answer is yes. One of the advantages of generating native code at runtime is that we know what processor you are running on and we can tune the code accordingly. Why would we do that for x86? Every generation of x86 processors has its own personality. Their personality comes usually in 2 ways:…

14

CLR and floating point: Some answers to common questions

Some very common questions I get from customers regarding floating point are:   –          I get different results when compiling with optimizations vs without optimizations! –          My == checks are failing when the expressions are the same!   The answer for this question is most of the time ‘This is by design’, but it does…

6

Lazy init singleton

I’ve seen some confusion in some MS internal mailing lists about when singletons are instantiated for the pattern described in:   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/singletondespatt.asp     // .NET Singleton sealed class Singleton {     private Singleton() {}     public static readonly Singleton Instance = new Singleton(); }   The confusion comes from trying to understand when the…

7

Interested in working in the CLR?

Would you like to join the CLR’s development team?  We have 2 job openings for the Rotor project, the shared source CLR that brings managed code to BSD, Mac and Windows. You can find more about Rotor here: http://msdn.microsoft.com/msdnmag/issues/02/07/SharedSourceCLI/ For additional information on the positions or submitting your resume, check out the following URLs http://members.microsoft.com/careers/search/details.aspx?JobID=be2065d1-0943-4ebf-9560-ada9673a6cd6 http://members.microsoft.com/careers/search/details.aspx?JobID=b02cafac-c95a-46e1-b110-e3faef0c1db2…

3

What is mscorsvw.exe and why is it eating up my CPU? What is this new CLR Optimization Service?

[Update – 8/2013]  Please refer to our more recent post: Wondering why mscorsvw.exe has high CPU usage? You can speed it up. The content below is now out-of-date, applying to early versions of the .NET Framework running on Windows XP.    Short version: mscorsvw.exe is precompiling .NET assemblies in the background. Once it’s done, it will…

35

JIT compiler and type constructors (.cctors)

I get this question a lot ‘When do class constructors (.cctor) get run’ My answer is usually: ‘It depends’ From Partition 1 of the ECMA spec (http://msdn.microsoft.com/netframework/programming/clr/default.aspx) The semantics of when, and what triggers execution of such type initialization methods, is as follows: 1.             A type may have a type-initializer method, or not. 2.              A…

9

The world is a better place if you generate verifiable IL

If you are writing a compiler that targets IL or just emitting IL, you may find this an interesting read:   The JIT compiler will always try to generate code, even if the IL is bad. From the JIT’s point of view, IL code falls in 3 categories:   1)       Verifiable IL. Most of the…

14