diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2017-11-28 16:43:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-28 16:43:38 +0100 |
commit | 9304ea213b7b41d1f40f9f8e891c570eae6f5473 (patch) | |
tree | 093d5d2125e2e213e10a39123b9c189ad9e8beec | |
parent | 52037f27cb8ce52225f0f26c7bdbc6c8a985f420 (diff) | |
download | coreclr-9304ea213b7b41d1f40f9f8e891c570eae6f5473.tar.gz coreclr-9304ea213b7b41d1f40f9f8e891c570eae6f5473.tar.bz2 coreclr-9304ea213b7b41d1f40f9f8e891c570eae6f5473.zip |
Put default interface support behind a COMPlus switch (#15233)
10 files changed, 141 insertions, 2 deletions
diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h index 968aed5b11..20bd891ab2 100644 --- a/src/inc/clrconfigvalues.h +++ b/src/inc/clrconfigvalues.h @@ -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 diff --git a/src/vm/classcompat.cpp b/src/vm/classcompat.cpp index fb97a79e85..fb48a15221 100644 --- a/src/vm/classcompat.cpp +++ b/src/vm/classcompat.cpp @@ -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)) { diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index caf906fe9c..1d524cc5a2 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -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)) { diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj index e170b2b467..de431d50eb 100644 --- a/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj +++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.ilproj @@ -16,7 +16,21 @@ <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> diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj index 34df037a0d..78d9162d9f 100644 --- a/tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj +++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/diamondshape/diamondshape.ilproj @@ -17,6 +17,20 @@ <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> diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj index 909dbe94dc..03db9c544c 100644 --- a/tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj +++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/genericmethods/genericmethods.ilproj @@ -17,6 +17,20 @@ <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> diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj index 16a1cadcd2..03f4842fb4 100644 --- a/tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj +++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/methodimpl/methodimpl.ilproj @@ -17,6 +17,20 @@ <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> diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj index be40d201ff..7b6f274c1f 100644 --- a/tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj +++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/sharedgenerics/sharedgenerics.ilproj @@ -17,6 +17,20 @@ <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> diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj index 0bf910b766..aa2f06c9bf 100644 --- a/tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj +++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/simple/simple.ilproj @@ -16,7 +16,21 @@ <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> diff --git a/tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj b/tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj index 12973e7559..f928997846 100644 --- a/tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj +++ b/tests/src/Loader/classloader/DefaultInterfaceMethods/valuetypes/valuetypes.ilproj @@ -17,6 +17,20 @@ <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> |