Fix Complus_JitMinOpts for the first method (dotnet/coreclr#18555)
authorSergey Andreenko <seandree@microsoft.com>
Wed, 20 Jun 2018 01:01:36 +0000 (18:01 -0700)
committerGitHub <noreply@github.com>
Wed, 20 Jun 2018 01:01:36 +0000 (18:01 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/1731c34ffbffbe3157ebd1368ab5420483efe1fc

src/coreclr/src/jit/compiler.cpp

index 4af8d5f..9706ece 100644 (file)
@@ -4078,7 +4078,8 @@ void Compiler::compSetOptimizationLevel()
 
     if (!theMinOptsValue && (jitMinOpts > 0))
     {
-        unsigned methodCount     = Compiler::jitTotalMethodCompiled;
+        // jitTotalMethodCompiled does not include the method that is being compiled now, so make +1.
+        unsigned methodCount     = Compiler::jitTotalMethodCompiled + 1;
         unsigned methodCountMask = methodCount & 0xFFF;
         unsigned kind            = (jitMinOpts & 0xF000000) >> 24;
         switch (kind)