Put default interface support behind a COMPlus switch (#15233)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Tue, 28 Nov 2017 15:43:38 +0000 (16:43 +0100)
committerGitHub <noreply@github.com>
Tue, 28 Nov 2017 15:43:38 +0000 (16:43 +0100)
src/inc/clrconfigvalues.h
src/vm/classcompat.cpp
src/vm/methodtablebuilder.cpp
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj
tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj
tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj
tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj
tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj
tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj
tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj

index 968aed5b11e54908211c3970d8063835a738ff67..20bd891ab221e75d18c4e7f086fd17b012beac4a 100644 (file)
@@ -873,6 +873,7 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TieredCompilation, W("EXPERIMENTAL_TieredCo
 // TypeLoader
 // 
 CONFIG_DWORD_INFO(INTERNAL_TypeLoader_InjectInterfaceDuplicates, W("INTERNAL_TypeLoader_InjectInterfaceDuplicates"), 0, "Injects duplicates in interface map for all types.")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TypeLoader_DefaultInterfaces, W("UNSUPPORTED_TypeLoader_DefaultInterfaces"), 0, "Enables support for default interfaces.")
 
 // 
 // Virtual call stubs
index fb97a79e85d1f62194db768059de998bfd4f78c2..fb48a15221aa5504835af457c1510446af9ebfce 100644 (file)
@@ -2612,6 +2612,26 @@ VOID    MethodTableBuilder::EnumerateClassMethods()
             }
         }
 
+        // Some interface checks.
+        if (fIsClassInterface)
+        {
+            if (IsMdVirtual(dwMemberAttrs))
+            {
+                if (!IsMdAbstract(dwMemberAttrs) && (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_TypeLoader_DefaultInterfaces) == 0))
+                {
+                    BuildMethodTableThrowException(BFA_VIRTUAL_NONAB_INT_METHOD);
+                }
+            } 
+            else
+            {
+                // Instance field/method
+                if (!IsMdStatic(dwMemberAttrs) && (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_TypeLoader_DefaultInterfaces) == 0))
+                {
+                    BuildMethodTableThrowException(BFA_NONVIRT_INST_INT_METHOD);
+                }
+            }
+        }
+
         // No synchronized methods in ValueTypes
         if(fIsClassValueType && IsMiSynchronized(dwImplFlags))
         {
index caf906fe9c22c6ef37cd0fd91efc02948675bcad..1d524cc5a28b5af1f31beb1c2a70425cd7f9cc34 100644 (file)
@@ -2900,6 +2900,26 @@ MethodTableBuilder::EnumerateClassMethods()
             }
         }
 
+        // Some interface checks.
+        if (fIsClassInterface)
+        {
+            if (IsMdVirtual(dwMemberAttrs))
+            {
+                if (!IsMdAbstract(dwMemberAttrs) && (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_TypeLoader_DefaultInterfaces) == 0))
+                {
+                    BuildMethodTableThrowException(BFA_VIRTUAL_NONAB_INT_METHOD);
+                }
+            }
+            else
+            {
+                // Instance field/method
+                if (!IsMdStatic(dwMemberAttrs) && (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_TypeLoader_DefaultInterfaces) == 0))
+                {
+                    BuildMethodTableThrowException(BFA_NONVIRT_INST_INT_METHOD);
+                }
+            }
+        }
+
         // No synchronized methods in ValueTypes
         if(fIsClassValueType && IsMiSynchronized(dwImplFlags))
         {
index e170b2b467ba4405c3181bccbb4efbcf213e9f0b..de431d50eb9b88ec66739ce8cbe940a7e8147e18 100644 (file)
     <CLRTestKind>BuildAndRun</CLRTestKind>
     <CLRTestPriority>0</CLRTestPriority>
     <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
-    <UseCustomILAsm>True</UseCustomILAsm>    
+    <UseCustomILAsm>True</UseCustomILAsm>
+
+    <CLRTestBatchPreCommands>
+<![CDATA[
+      $(CLRTestBatchPreCommands)
+set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </CLRTestBatchPreCommands>
+    <BashCLRTestPreCommands>
+<![CDATA[
+      $(BashCLRTestPreCommands)
+export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </BashCLRTestPreCommands>
+    
   </PropertyGroup>
 
   <ItemGroup>
index 34df037a0de7d7d3fe4d8737bc4ea0c907f53073..78d9162d9f2bb047d0ba89b38bea35006e4c0464 100644 (file)
     <CLRTestPriority>0</CLRTestPriority>
     <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
     <UseCustomILAsm>True</UseCustomILAsm>    
+
+    <CLRTestBatchPreCommands>
+<![CDATA[
+      $(CLRTestBatchPreCommands)
+set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </CLRTestBatchPreCommands>
+    <BashCLRTestPreCommands>
+<![CDATA[
+      $(BashCLRTestPreCommands)
+export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </BashCLRTestPreCommands>
+
   </PropertyGroup>
 
   <ItemGroup>
index 909dbe94dc780c3b18d356d121a7f9a677e04105..03db9c544c442487680cec533598d3609beccc98 100644 (file)
     <CLRTestPriority>0</CLRTestPriority>
     <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
     <UseCustomILAsm>True</UseCustomILAsm>
+
+    <CLRTestBatchPreCommands>
+<![CDATA[
+      $(CLRTestBatchPreCommands)
+set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </CLRTestBatchPreCommands>
+    <BashCLRTestPreCommands>
+<![CDATA[
+      $(BashCLRTestPreCommands)
+export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </BashCLRTestPreCommands>
+
   </PropertyGroup>
 
   <ItemGroup>
index 16a1cadcd21544dfff76ebc4a32370920455ff09..03f4842fb478aa9187325b22c07726d52fbf25db 100644 (file)
     <CLRTestPriority>0</CLRTestPriority>
     <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
     <UseCustomILAsm>True</UseCustomILAsm>
+
+    <CLRTestBatchPreCommands>
+<![CDATA[
+      $(CLRTestBatchPreCommands)
+set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </CLRTestBatchPreCommands>
+    <BashCLRTestPreCommands>
+<![CDATA[
+      $(BashCLRTestPreCommands)
+export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </BashCLRTestPreCommands>
+
   </PropertyGroup>
 
   <ItemGroup>
index be40d201ffacf2b9c50087bd0d486d20b6d7e865..7b6f274c1f3108fa1cc98c5d6960e1cc4c8e9375 100644 (file)
     <CLRTestPriority>0</CLRTestPriority>
     <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
     <UseCustomILAsm>True</UseCustomILAsm>
+
+    <CLRTestBatchPreCommands>
+<![CDATA[
+      $(CLRTestBatchPreCommands)
+set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </CLRTestBatchPreCommands>
+    <BashCLRTestPreCommands>
+<![CDATA[
+      $(BashCLRTestPreCommands)
+export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </BashCLRTestPreCommands>
+
   </PropertyGroup>
 
   <ItemGroup>
index 0bf910b7665ba74276b671905dcee3ac997ef3e0..aa2f06c9bf948966e3f46a1247fa5912541d2802 100644 (file)
     <CLRTestKind>BuildAndRun</CLRTestKind>
     <CLRTestPriority>0</CLRTestPriority>
     <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
-    <UseCustomILAsm>True</UseCustomILAsm>    
+    <UseCustomILAsm>True</UseCustomILAsm>  
+
+    <CLRTestBatchPreCommands>
+<![CDATA[
+      $(CLRTestBatchPreCommands)
+set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </CLRTestBatchPreCommands>
+    <BashCLRTestPreCommands>
+<![CDATA[
+      $(BashCLRTestPreCommands)
+export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </BashCLRTestPreCommands>
+  
   </PropertyGroup>
 
   <ItemGroup>
index 12973e7559b18f42fceebe79ada3116984fadf95..f928997846f6e4db4ae092ddf56b2c34e12b543f 100644 (file)
     <CLRTestPriority>0</CLRTestPriority>
     <!-- Use ILAsm that we just built for the new fixes required in default interface methods -->
     <UseCustomILAsm>True</UseCustomILAsm>    
+
+    <CLRTestBatchPreCommands>
+<![CDATA[
+      $(CLRTestBatchPreCommands)
+set COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </CLRTestBatchPreCommands>
+    <BashCLRTestPreCommands>
+<![CDATA[
+      $(BashCLRTestPreCommands)
+export COMPlus_UNSUPPORTED_TypeLoader_DefaultInterfaces=1
+    ]]>
+    </BashCLRTestPreCommands>
+
   </PropertyGroup>
 
   <ItemGroup>