From 0abdbe5a7df4b1993a1e7a1e7a5dc03e2c114e45 Mon Sep 17 00:00:00 2001 From: "Xamarin Public Jenkins (auto-signing)" Date: Tue, 9 Oct 2018 08:20:59 +0000 Subject: [PATCH] Imported Upstream version 5.18.0.142 Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f --- Makefile.am | 7 +- Makefile.in | 16 +- README.md | 3 + acceptance-tests/Makefile.in.REMOVED.git-id | 2 +- acceptance-tests/coreclr.mk.REMOVED.git-id | 2 +- config.h.in | 26 +- configure.REMOVED.git-id | 2 +- configure.ac.REMOVED.git-id | 2 +- data/Makefile.in | 9 +- data/gdb/mono-gdb.py | 32 +- data/net_2_0/Browsers/Makefile.in | 9 +- data/net_2_0/Makefile.in | 9 +- data/net_4_0/Browsers/Makefile.in | 9 +- data/net_4_0/Makefile.in | 9 +- data/net_4_5/Browsers/Makefile.in | 9 +- data/net_4_5/Makefile.in | 9 +- docs/Makefile.in | 9 +- docs/deploy/mono-api-class.html | 2 +- docs/deploy/mono-api-exc.html | 26 +- docs/deploy/mono-api-internal.html | 4 +- docs/deploy/mono-api-string.html | 2 +- docs/deploy/mono-api-type.html | 2 +- .../Facades/netstandard.cs.REMOVED.git-id | 2 +- .../monodroid/System.Core.cs.REMOVED.git-id | 2 +- .../profiles/monodroid/System.Security.cs | 128 +- .../monodroid/System.cs.REMOVED.git-id | 2 +- .../monodroid/mscorlib.cs.REMOVED.git-id | 2 +- .../monotouch/System.Core.cs.REMOVED.git-id | 2 +- .../profiles/monotouch/System.Security.cs | 128 +- .../monotouch/System.cs.REMOVED.git-id | 2 +- .../monotouch/mscorlib.cs.REMOVED.git-id | 2 +- .../profiles/net_4_x/Mono.Debugger.Soft.cs | 8 + .../Novell.Directory.Ldap.cs.REMOVED.git-id | 2 +- .../net_4_x/System.Core.cs.REMOVED.git-id | 2 +- .../profiles/net_4_x/System.Security.cs | 69 +- .../System.ServiceModel.cs.REMOVED.git-id | 2 +- .../profiles/net_4_x/System.cs.REMOVED.git-id | 2 +- .../net_4_x/mscorlib.cs.REMOVED.git-id | 2 +- .../build/monodroid/Makefile | 8 +- .../build/monodroid/Mono.Android.dll | Bin 0 -> 5120 bytes .../monodroid/System.Core.dll.REMOVED.git-id | 2 +- .../build/monodroid/xa.pub | Bin 0 -> 160 bytes .../build/monotouch/Makefile | 2 +- .../monotouch/System.Core.dll.REMOVED.git-id | 2 +- .../src/monodroid/Mono.Android.cs | 34 + .../monodroid/System.Core.cs.REMOVED.git-id | 2 +- .../monotouch/System.Core.cs.REMOVED.git-id | 2 +- .../v4.7.1/Makefile | 2 +- external/bockbuild/bb | 3 + external/bockbuild/bockbuild.py | 3 + external/bockbuild/bockbuild/darwinprofile.py | 10 +- external/bockbuild/bockbuild/util/util.py | 5 + external/bockbuild/packages/autoconf.py | 2 +- external/bockbuild/packages/automake.py | 2 +- ...gtk-fix-find_nsview_at_pos-recursive.patch | 27 +- external/boringssl/CMakeLists.txt | 7 +- .../Interop.BCryptGenRandom.GetRandomBytes.cs | 1 - .../Windows/BCrypt/Interop.BCryptGenRandom.cs | 1 - .../Common/src/CoreLib/System/ArraySegment.cs | 1 - .../Text/FormattingHelpers.CountDigits.cs | 1 - .../src/CoreLib/System/Buffers/Utilities.cs | 2 +- .../src/Common/src/CoreLib/System/Char.cs | 1 - .../System/Collections/Generic/List.cs | 1 - .../Collections/Generic/ValueListBuilder.cs | 2 +- .../CoreLib/System/Collections/HashHelpers.cs | 2 +- .../src/CoreLib/System/Convert.Base64.cs | 1 - .../src/Common/src/CoreLib/System/Convert.cs | 1 - .../System/Globalization/CharUnicodeInfo.cs | 1 - .../Globalization/CompareInfo.Invariant.cs | 2 +- .../System/Globalization/CompareInfo.cs | 2 +- .../DateTimeParse.cs.REMOVED.git-id | 2 +- .../System/Globalization/TimeSpanFormat.cs | 1 - .../System/Globalization/TimeSpanParse.cs | 1 - .../src/Common/src/CoreLib/System/Guid.cs | 1 - .../src/Common/src/CoreLib/System/Lazy.cs | 1 - .../src/Common/src/CoreLib/System/Marvin.cs | 2 +- .../src/Common/src/CoreLib/System/Memory.cs | 1 - .../CoreLib/System/MemoryExtensions.Fast.cs | 2 +- .../src/CoreLib/System/Number.Formatting.cs | 1 - .../src/CoreLib/System/Number.Parsing.cs | 1 - .../Common/src/CoreLib/System/ParseNumbers.cs | 1 - .../src/Common/src/CoreLib/System/Progress.cs | 1 - .../src/CoreLib/System/ReadOnlyMemory.cs | 1 - .../src/CoreLib/System/ReadOnlySpan.Fast.cs | 1 - .../CustomAttributeFormatException.cs | 2 + .../CoreLib/System/Reflection/MemberInfo.cs | 3 + .../System/Resources/RuntimeResourceSet.cs | 1 - .../ConfiguredValueTaskAwaitable.cs | 1 - .../CompilerServices/ValueTaskAwaiter.cs | 1 - .../Runtime/InteropServices/MemoryMarshal.cs | 2 +- .../SerializationInfoEnumerator.cs | 1 - .../Common/src/CoreLib/System/Span.Fast.cs | 1 - .../src/CoreLib/System/SpanHelpers.Byte.cs | 2 +- .../src/CoreLib/System/SpanHelpers.Char.cs | 2 +- .../src/CoreLib/System/SpanHelpers.T.cs | 4 - .../Common/src/CoreLib/System/SpanHelpers.cs | 1 - .../src/CoreLib/System/String.Comparison.cs | 2 +- .../src/CoreLib/System/String.Manipulation.cs | 2 +- .../src/Common/src/CoreLib/System/String.cs | 1 - .../src/CoreLib/System/Text/ASCIIEncoding.cs | 1 - .../Common/src/CoreLib/System/Text/Decoder.cs | 1 - .../System/Text/DecoderBestFitFallback.cs | 1 - .../CoreLib/System/Text/DecoderFallback.cs | 1 - .../System/Text/DecoderReplacementFallback.cs | 1 - .../Common/src/CoreLib/System/Text/Encoder.cs | 1 - .../System/Text/EncoderBestFitFallback.cs | 1 - .../CoreLib/System/Text/EncoderFallback.cs | 1 - .../System/Text/EncoderReplacementFallback.cs | 1 - .../src/CoreLib/System/Text/Encoding.cs | 1 - .../src/CoreLib/System/Text/Latin1Encoding.cs | 1 - .../src/CoreLib/System/Text/StringBuilder.cs | 1 - .../src/CoreLib/System/Text/UTF32Encoding.cs | 1 - .../src/CoreLib/System/Text/UTF7Encoding.cs | 1 - .../Text/UTF8Encoding.cs.REMOVED.git-id | 2 +- .../CoreLib/System/Text/UnicodeEncoding.cs | 1 - .../CoreLib/System/Text/ValueStringBuilder.cs | 1 - .../CoreLib/System/Threading/AsyncLocal.cs | 1 - .../System/Threading/LazyInitializer.cs | 1 - .../System/Threading/Tasks/TaskToApm.cs | 2 +- .../System/Threading/Tasks/ValueTask.cs | 4 - .../src/Internal/Cryptography/Helpers.cs | 3 +- .../OSX/Interop.CoreFoundation.CFDate.cs | 2 +- .../OSX/Interop.CoreFoundation.CFError.cs | 2 +- .../OSX/Interop.CoreFoundation.CFString.cs | 2 +- .../src/Interop/OSX/Interop.CoreFoundation.cs | 2 +- .../Interop.Err.cs | 2 +- .../Interop.Random.cs | 1 - .../Interop.X509Store.cs | 4 +- .../Win32/SafeHandles/SafeHandleCache.cs | 1 - .../Concurrent/ConcurrentQueue_Segment.cs | 1 - .../System/Security/Cryptography/AsnWriter.cs | 6 + .../Tasks/BeginEndAwaitableAdapter.cs | 2 +- .../Threading/Tasks/RendezvousAwaitable.cs | 1 - ...o_system_native_la-pal_io.o.REMOVED.git-id | 2 +- .../libmono_system_native_la-pal_random.o | Bin 10960 -> 10776 bytes ...o_system_native_la-pal_io.o.REMOVED.git-id | 2 +- .../libmono_system_native_la-pal_random.o | Bin 10792 -> 10576 bytes .../pal_keychain.c | 1 + .../src/System/Buffers/Utilities.cs | 4 - .../Concurrent/ConcurrentDictionary.cs | 1 - .../Collections/Concurrent/ConcurrentQueue.cs | 1 - .../Collections/Concurrent/ConcurrentStack.cs | 1 - .../Concurrent/PartitionerStatic.cs | 2 +- .../src/System/Collections/SortedList.cs | 1 - .../src/System/Collections/BitArray.cs | 1 - .../EqualityComparer.Generic.Tests.cs | 4 - .../Configuration/ClientConfigurationHost.cs | 4 + .../ImplicitMachineConfigHost.cs | 18 + .../src/System/Configuration/TypeUtil.cs | 8 +- .../AnonymousPipeServerStream.Windows.cs | 29 +- .../IO/Pipes/NamedPipeClientStream.Windows.cs | 4 + .../IO/Pipes/NamedPipeServerStream.Unix.cs | 7 + .../IO/Pipes/NamedPipeServerStream.Windows.cs | 16 +- .../src/System/Buffers/ReadOnlySequence.cs | 1 - .../Buffers/ReadOnlySequence_helpers.cs | 2 +- .../src/System/Buffers/StandardFormat.cs | 2 +- .../Text/Utf8Formatter/FormattingHelpers.cs | 1 - .../Utf8Formatter/Utf8Formatter.Decimal.E.cs | 1 - .../Utf8Formatter/Utf8Formatter.Decimal.F.cs | 1 - .../Utf8Formatter/Utf8Formatter.Decimal.G.cs | 1 - .../Utf8Formatter/Utf8Formatter.Decimal.cs | 1 - .../Text/Utf8Formatter/Utf8Formatter.Float.cs | 1 - .../Utf8Formatter.Integer.Signed.Default.cs | 1 - .../Utf8Formatter.Integer.Unsigned.Default.cs | 1 - .../Utf8Formatter/Utf8Formatter.TimeSpan.cs | 1 - .../Text/Utf8Parser/Utf8Parser.Date.G.cs | 1 - .../Utf8Parser/Utf8Parser.Date.Helpers.cs | 1 - .../Text/Utf8Parser/Utf8Parser.Date.O.cs | 1 - .../Text/Utf8Parser/Utf8Parser.Date.cs | 1 - .../Text/Utf8Parser/Utf8Parser.Number.cs | 1 - .../Text/Utf8Parser/Utf8Parser.TimeSpan.cs | 1 - .../Utf8Parser/Utf8Parser.TimeSpanSplitter.cs | 1 - .../src/System/MemoryExtensions.Portable.cs | 2 +- .../System/Number/Number.FormatAndParse.cs | 1 - .../src/System/ReadOnlySpan.Portable.cs | 3 - .../System.Memory/src/System/Span.Portable.cs | 3 - .../System.Memory/src/System/SpanHelpers.cs | 4 +- .../Sockets/UnixDomainSocketEndPoint.Unix.cs | 5 +- .../Net/Sockets/UnixDomainSocketEndPoint.cs | 5 +- .../ObjectModel/KeyedCollection.cs | 1 - .../src/System/Collections/Hashtable.cs | 1 - .../src/System/OperatingSystem.cs | 1 - .../Serialization/SerializationEventsCache.cs | 1 - .../src/Internal/Cryptography/Helpers.cs | 12 +- ...RandomNumberGeneratorImplementation.OSX.cs | 1 - ...omNumberGeneratorImplementation.Windows.cs | 1 - ...em.Security.Cryptography.Algorithms.csproj | 3 + .../src/Internal/Cryptography/Helpers.cs | 12 +- .../System.Security.Cryptography.Cng.csproj | 3 + .../src/Internal/Cryptography/Helpers.cs | 12 +- .../System.Security.Cryptography.Csp.csproj | 3 + ...stem.Security.Cryptography.Encoding.csproj | 4 +- .../src/Internal/Cryptography/Helpers.cs | 7 +- .../Pal/Windows/PkcsPalWindows.cs | 11 +- .../System.Security.Cryptography.Pkcs.csproj | 3 + .../tests/Pkcs9AttributeTests.cs | 13 + .../tests/ProtectedDataTests.cs | 5 + .../src/Internal/Cryptography/Helpers.cs | 14 +- .../Cryptography/Pal.OSX/CertificateData.cs | 3 + .../Cryptography/Pal.OSX/CertificatePal.cs | 4 +- .../Pal.OSX/StorePal.AppleKeychainStore.cs | 3 +- .../Pal.Unix/OpenSslX509CertificateReader.cs | 7 +- .../Pal.Windows/CertificatePal.cs | 1 + ...urity.Cryptography.X509Certificates.csproj | 3 + .../X509Certificates/X509Certificate.cs | 12 +- .../X509Certificates/X509Certificate2.cs | 4 +- .../tests/CertTests.cs | 21 + .../tests/LoadFromFileTests.cs | 7 +- .../tests/TestData.cs.REMOVED.git-id | 2 +- .../src/Internal/ProducerConsumerQueues.cs | 1 - .../Tasks/Parallel.cs.REMOVED.git-id | 2 +- .../Threading/Tasks/ParallelLoopState.cs | 1 - .../Threading/Tasks/ParallelRangeManager.cs | 2 +- .../src/System/Threading/CountdownEvent.cs | 1 - .../tests/ThreadLocalTests.cs | 2 - .../shared/System/IO/Win32Marshal.cs | 3 - .../Threading/DeferredDisposableLifetime.cs | 3 - .../Collections/Generic/ArraySortHelper.cs | 3 - .../System/Decimal.DecCalc.cs.REMOVED.git-id | 2 +- .../src/System/Decimal.cs | 1 - .../src/System/Number.Unix.cs | 9 +- .../src/System/Number.Windows.cs | 7 +- .../Runtime/CompilerServices/TaskAwaiter.cs | 1 - .../src/System/String.cs | 2 +- .../Tasks/ConcurrentExclusiveSchedulerPair.cs | 1 - .../src/System/Threading/Tasks/Future.cs | 1 - .../Tasks/FutureFactory.cs.REMOVED.git-id | 2 +- .../Threading/Tasks/ProducerConsumerQueues.cs | 1 - .../Threading/Tasks/Task.cs.REMOVED.git-id | 2 +- .../Threading/Tasks/TaskContinuation.cs | 2 +- .../Threading/Tasks/TaskExceptionHolder.cs | 1 - .../Tasks/TaskFactory.cs.REMOVED.git-id | 2 +- .../System/Threading/Tasks/TaskScheduler.cs | 1 - ...readPoolNativeOverlapped.OverlappedData.cs | 3 - .../Win32ThreadPoolNativeOverlapped.cs | 3 - .../linker/linker/Linker.Steps/OutputStep.cs | 15 +- .../linker/Linker.Steps/ResolveFromXmlStep.cs | 32 +- external/linker/linker/Linker/Annotations.cs | 26 +- external/xunit-binaries/HTML.xslt | 240 -- external/xunit-binaries/NUnitXml.xslt | 166 - external/xunit-binaries/README.md | 4 +- external/xunit-binaries/xUnit1.xslt | 56 - .../xunit-binaries/xunit.console.exe.config | 19 +- ikvm-native/Makefile.in | 9 +- llvm/Makefile.am | 64 +- llvm/Makefile.in | 135 +- llvm/SUBMODULES.json | 6 +- llvm/build.mk | 80 + llvm/build_llvm_config.sh | 172 + m4/Makefile.in | 9 +- man/Makefile.in | 9 +- man/mono.1 | 40 +- mcs/build/Makefile | 3 +- mcs/build/common/Consts.cs | 4 +- mcs/build/common/Consts.cs.in | 2 +- mcs/build/config-default.make | 6 +- mcs/build/corcompare.make | 2 +- mcs/build/executable.make | 1 + mcs/build/gensources.cs | 593 +++- mcs/build/gensources.sh | 113 - mcs/build/library.make | 23 +- .../platforms/{darwin.make => macos.make} | 2 + mcs/build/platforms/unix.make | 36 + mcs/build/profiles/basic.make | 12 +- mcs/build/profiles/build.make | 3 +- mcs/build/profiles/net_4_x.make | 7 +- mcs/build/rules.make | 7 +- mcs/build/tests.make | 63 +- .../System.Drawing.Primitives/Makefile | 9 +- mcs/class/Facades/netstandard/Makefile | 7 +- mcs/class/Facades/subdirs.make | 6 +- mcs/class/I18N/EncodingTestBase.cs | 569 +++ mcs/class/I18N/Makefile | 1 + mcs/class/Makefile | 32 +- .../Microsoft.CSharp.dll.sources | 1 - .../Microsoft.CSharp_xtest.dll.sources | 4 + .../Mono.Btls.Interface/BtlsX509.cs | 5 +- ..._full_Mono.CSharp_test.dll.exclude.sources | 6 + ...ting_aot_full_Mono.CSharp_test.dll.sources | 1 + mcs/class/Mono.Cecil.Mdb/Makefile | 16 +- mcs/class/Mono.Cecil/Makefile | 12 +- ...onodroid_Mono.Data.Sqlite_test.dll.sources | 1 + .../Mono.Debugger.Soft/AssemblyMirror.cs | 88 +- .../Mono.Debugger.Soft/Connection.cs | 49 +- .../Mono.Debugger.Soft/VirtualMachine.cs | 94 +- .../Test/dtest.cs.REMOVED.git-id | 2 +- .../monodroid_Mono.Posix_test.dll.sources | 1 + mcs/class/Mono.Profiler.Log/Makefile | 11 +- .../Mono.Profiler.Log_xtest.dll.sources | 3 + .../Mono.Security.Win32_test.dll.sources | 9 + .../CertificateSelectionCallback.xml | 32 - .../CertificateValidationCallback.xml | 28 - .../CipherAlgorithmType.xml | 143 - .../ExchangeAlgorithmType.xml | 104 - .../HashAlgorithmType.xml | 70 - .../PrivateKeySelectionCallback.xml | 48 - .../SecurityCompressionType.xml | 53 - .../SecurityProtocolType.xml | 92 - .../SslClientStream.xml | 490 --- .../SslServerStream.xml | 511 --- .../SslStreamBase.xml | 564 --- .../Mono.Security/Documentation/en/index.xml | 13 - .../en/ns-Mono.Security.Protocol.Tls.xml | 6 - .../KeyPairPersistence.cs | 50 +- .../Mono.Security.Cryptography/MD5SHA1.cs | 148 - .../CertificateValidationHelper.cs | 1 - .../MonoTlsProvider.cs | 1 - .../Mono.Security.Protocol.Tls}/MD5SHA1.cs | 4 +- .../RSASslSignatureDeformatter.cs | 2 +- .../RSASslSignatureFormatter.cs | 2 +- .../Mono.Security.X509/PKCS12.cs | 18 +- .../Mono.Security.X509/X501Name.cs | 25 +- .../Mono.Security.X509/X509Certificate.cs | 7 +- .../Mono.Security/Mono.Security.dll.sources | 2 +- .../Test/Mono.Security.X509/X501NameTest.cs | 15 +- ...ity_test.dll.build-failure-exclude.sources | 20 + ...oid_Mono.Security_test.dll.exclude.sources | 2 + .../monodroid_Mono.Security_test.dll.sources | 1 + .../Novell.Directory.Ldap/Connection.cs | 149 +- .../LdapConnection.cs.REMOVED.git-id | 2 +- ...mponentModel.Composition_xtest.dll.sources | 18 + mcs/class/System.Core/Makefile | 17 +- .../SafePipeHandle.cs | 54 - mcs/class/System.Core/ReferenceSources/SR.cs | 253 -- .../System.Core/System.Core_xtest.dll.sources | 90 + .../AnonymousPipeClientStream.cs | 102 - .../AnonymousPipeServerStream.NotSupported.cs | 28 + .../AnonymousPipeServerStream.Unix.cs | 13 + .../AnonymousPipeServerStream.Windows.cs | 22 + .../AnonymousPipeServerStream.cs | 154 - .../NamedPipeClientStream.NotSupported.cs | 41 + .../NamedPipeClientStream.Unix.cs | 18 + .../NamedPipeClientStream.Windows.cs | 20 + .../System.IO.Pipes/NamedPipeClientStream.cs | 187 - .../NamedPipeServerStream.NotSupported.cs | 71 + .../NamedPipeServerStream.Unix.cs | 27 + .../NamedPipeServerStream.Windows.cs | 50 + .../System.IO.Pipes/NamedPipeServerStream.cs | 195 - .../System.IO.Pipes/PipeAccessRule.cs | 55 - .../System.IO.Pipes/PipeDirection.cs | 10 - .../System.IO.Pipes/PipeInterfaces.cs | 36 - .../System.IO.Pipes/PipeSecurity.cs | 153 - .../PipeStream.NotSupported.cs | 90 + .../System.Core/System.IO.Pipes/PipeStream.cs | 346 +- .../PipeStreamImpersonationWorker.cs | 4 - .../System.IO.Pipes/PipeTransmissionMode.cs | 9 - .../System.Core/System.IO.Pipes/PipeUnix.cs | 299 -- .../System.Core/System.IO.Pipes/PipeWin32.cs | 386 -- .../SafePipeHandle.NotSupported.cs | 16 + .../DSACertificateExtensions.cs | 64 + .../System.Security.Cryptography/ECCurve.cs | 85 - .../ECParameters.cs | 39 - .../System.Core/basic_System.Core.dll.sources | 1 + .../System.Core/build_System.Core.dll.sources | 1 + .../common_System.Core.dll.sources | 41 +- mcs/class/System.Core/corefx/SR.cs | 286 ++ mcs/class/System.Core/corefx/SR.missing.cs | 5 +- .../linux_net_4_x_System.Core.dll.sources | 1 + .../macos_net_4_x_System.Core.dll.sources | 1 + .../monodroid_System.Core.dll.sources | 1 + ...droid_System.Core_test.dll.exclude.sources | 1 + .../monodroid_System.Core_test.dll.sources | 1 + .../monotouch_System.Core.dll.sources | 1 + .../net_4_x_System.Core.dll.sources | 3 - mcs/class/System.Core/pipes_pns.sources | 5 + .../testing_aot_full_System.Core.dll.sources | 1 + ..._full_System.Core_test.dll.exclude.sources | 1 + ...ting_aot_full_System.Core_test.dll.sources | 1 + ...testing_aot_hybrid_System.Core.dll.sources | 1 + .../unix_net_4_x_System.Core.dll.sources | 39 + .../unreal_System.Core.dll.sources | 1 + .../win32_net_4_x_System.Core.dll.sources | 47 + .../xammac_System.Core.dll.sources | 2 +- .../xammac_net_4_5_System.Core.dll.sources | 2 +- .../Sugar/Expressions/GroupByExpression.cs | 160 - .../Linq/Sugar/Expressions/ScopeExpression.cs | 107 - .../src/DbLinq/System.Data.Linq/EntitySet.cs | 242 -- .../src/DbLinq/Util/CacheChecker.cs | 111 - .../AbstractCodeDomGenerator.cs | 270 -- .../src/DbMetal/Schema/SchemaPostprocess.cs | 131 - .../src/DbMetal/Util/TableSorter.cs | 126 - mcs/class/System.Data/Makefile | 4 +- .../System.Data/System.Data_xtest.dll.sources | 145 + .../linux_net_4_x_System.Data.dll.sources | 5 +- ... => macos_net_4_x_System.Data.dll.sources} | 0 .../unix_net_4_x_System.Data.dll.sources | 4 + .../xammac_net_4_5_System.Data.dll.sources | 2 +- .../System.Drawing/System.Drawing/Graphics.cs | 4 + .../System.Drawing/macFunctions.cs | 150 +- .../System.Drawing_xtest.dll.sources | 8 + mcs/class/System.Drawing/netstandard.sources | 10 + ...tem.IdentityModel_test.dll.exclude.sources | 37 + .../System.Json/System.Json_xtest.dll.sources | 2 + .../ProductHeaderValue.cs | 2 +- .../ProductHeaderValueTest.cs | 1 + .../System.Numerics_xtest.dll.sources | 8 + ....CompilerServices.Unsafe_xtest.dll.sources | 1 + .../System.Runtime.Serialization/Makefile | 6 +- .../JsonFormatReaderGenerator_static.cs | 4 +- ...em.Runtime.Serialization_xtest.dll.sources | 5 + .../JsonReaderTest.cs | 25 + mcs/class/System.Security/Makefile | 6 +- .../NativeDapiProtection.cs | 225 -- .../AlgorithmIdentifier.cs | 80 - .../CmsRecipient.cs | 74 - .../CmsRecipientCollection.cs | 114 - .../CmsSigner.cs | 123 - .../ContentInfo.cs | 112 - .../EnvelopedCms.cs | 208 +- .../KeyAgreeRecipientInfo.cs | 73 - .../KeyTransRecipientInfo.cs | 71 - .../Pkcs9Attribute.cs | 79 - .../Pkcs9ContentType.cs | 111 - .../Pkcs9DocumentDescription.cs | 105 - .../Pkcs9DocumentName.cs | 105 - .../Pkcs9MessageDigest.cs | 109 - .../Pkcs9SigningTime.cs | 114 - .../PublicKeyInfo.cs | 63 - .../RecipientInfo.cs | 65 - .../RecipientInfoCollection.cs | 94 - .../RecipientInfoEnumerator.cs | 72 - .../RecipientInfoType.cs | 41 - .../SignedCms.cs | 305 -- .../SignerInfo.cs | 127 - .../SignerInfoCollection.cs | 103 - .../SubjectIdentifier.cs | 57 - .../SubjectIdentifierOrKeyType.cs | 43 - .../SubjectIdentifierType.cs | 40 - .../SignedXml.cs | 1049 ------ .../DataProtectionScope.cs | 43 - .../ProtectedData.cs | 36 +- .../System.Security.dll.sources | 8 +- .../System.Security_test.dll.sources | 3 +- .../System.Security_xtest.dll.sources | 29 + .../AlgorithmIdentifierTest.cs | 140 - .../ContentInfoTest.cs | 3 +- .../Pkcs9SigningTimeTest.cs | 52 +- .../SignedCmsTest.cs | 2 +- .../SignerInfoTest.cs | 4 +- .../ProtectedDataTest.cs | 40 +- .../common_System.Security.dll.sources | 117 +- mcs/class/System.Security/corefx/SR.cs | 168 - ...d_System.Security_test.dll.exclude.sources | 1 + ...h_System.Security_test.dll.exclude.sources | 1 + .../win32_System.Security.dll.exclude.sources | 2 + .../win32_System.Security.dll.sources | 11 + ...winaot_System.Security.dll.exclude.sources | 1 + .../winaot_System.Security.dll.sources | 1 + .../CertificateSelectionCallback.xml | 29 - .../CertificateValidationCallback.xml | 25 - .../CertificateValidationCallback2.xml | 23 - .../CipherAlgorithmType.xml | 115 - .../ExchangeAlgorithmType.xml | 87 - .../HashAlgorithmType.xml | 59 - .../PrivateKeySelectionCallback.xml | 25 - .../SecurityCompressionType.xml | 45 - .../SecurityProtocolType.xml | 78 - .../SslClientStream.xml | 254 -- .../SslServerStream.xml | 230 -- .../SslStreamBase.xml | 549 --- .../ValidationResult.xml | 86 - .../Documentation/en/index.xml | 15 - .../en/ns-Mono.Security.Protocol.Tls.xml | 6 - .../Mono.Security.Cryptography/TlsHMAC.cs | 212 -- .../TlsClientCertificate.cs | 147 - .../TlsClientCertificateVerify.cs | 220 -- .../TlsClientFinished.cs | 87 - .../TlsClientHello.cs | 118 - .../TlsClientKeyExchange.cs | 98 - .../TlsServerCertificate.cs | 438 --- .../TlsServerCertificateRequest.cs | 111 - .../TlsServerFinished.cs | 102 - .../TlsServerHello.cs | 152 - .../TlsServerHelloDone.cs | 52 - .../TlsServerKeyExchange.cs | 121 - .../TlsClientCertificate.cs | 272 -- .../TlsClientCertificateVerify.cs | 86 - .../TlsClientFinished.cs | 88 - .../TlsClientHello.cs | 151 - .../TlsClientKeyExchange.cs | 116 - .../TlsServerCertificate.cs | 74 - .../TlsServerCertificateRequest.cs | 97 - .../TlsServerFinished.cs | 75 - .../TlsServerHello.cs | 122 - .../TlsServerHelloDone.cs | 52 - .../TlsServerKeyExchange.cs | 110 - .../ClientCertificateType.cs | 38 - .../HandshakeMessage.cs | 170 - .../HandshakeType.cs | 44 - .../Mono.Security.Protocol.Tls/Alert.cs | 267 -- .../CipherAlgorithmType.cs | 40 - .../Mono.Security.Protocol.Tls/CipherSuite.cs | 580 --- .../CipherSuiteCollection.cs | 254 -- .../CipherSuiteFactory.cs | 191 - .../ClientContext.cs | 82 - .../ClientRecordProtocol.cs | 179 - .../ClientSessionCache.cs | 254 -- .../Mono.Security.Protocol.Tls/ContentType.cs | 37 - .../Mono.Security.Protocol.Tls/Context.cs | 515 --- .../Mono.Security.Protocol.Tls/DebugHelper.cs | 95 - .../ExchangeAlgorithmType.cs | 38 - .../HandshakeState.cs | 36 - .../HashAlgorithmType.cs | 36 - .../HttpsClientStream.cs | 120 - .../RSASslSignatureDeformatter.cs | 104 - .../RSASslSignatureFormatter.cs | 101 - .../RecordProtocol.cs | 982 ------ .../SecurityCompressionType.cs | 37 - .../SecurityParameters.cs | 60 - .../SecurityProtocolType.cs | 38 - .../ServerContext.cs | 103 - .../ServerRecordProtocol.cs | 156 - .../SslCipherSuite.cs | 295 -- .../SslClientStream.cs | 469 --- .../SslHandshakeHash.cs | 185 - .../SslServerStream.cs | 346 -- .../SslStreamBase.cs | 1228 ------- .../TlsCipherSuite.cs | 182 - .../TlsClientSettings.cs | 124 - .../TlsException.cs | 93 - .../TlsServerSettings.cs | 129 - .../Mono.Security.Protocol.Tls/TlsStream.cs | 274 -- .../SpnegoSecurityTokenAuthenticator.cs | 322 -- .../SpnegoSecurityTokenProvider.cs | 203 -- .../SslSecurityTokenAuthenticator.cs | 306 -- .../SslSecurityTokenProvider.cs | 284 -- .../TlsClientSession.cs | 270 -- .../TlsServerSession.cs | 154 - .../ServiceCredentialsSecurityTokenManager.cs | 25 +- .../System.ServiceModel.dll.sources | 66 - .../ClientCredentialsSecurityTokenManager.cs | 28 +- .../System.ServiceModel_test.dll.sources | 2 - .../SslSecurityTokenParametersTest.cs | 280 -- .../SspiSecurityTokenParametersTest.cs | 259 -- ...viceCredentialsSecurityTokenManagerTest.cs | 182 - ...ientCredentialsSecurityTokenManagerTest.cs | 192 - ...stem.ServiceModel_test.dll.exclude.sources | 150 + ...stem.ServiceModel_test.dll.exclude.sources | 152 + ..._full_System.ServiceModel_test.dll.sources | 1 + ...stem.ServiceModel_test.dll.exclude.sources | 152 + ...Threading.Tasks.Dataflow_xtest.dll.sources | 3 + ...stem.Web.Services_test.dll.exclude.sources | 7 + ...stem.Web.Services_test.dll.exclude.sources | 8 + ..._full_System.Web.Services_test.dll.sources | 1 + ...stem.Web.Services_test.dll.exclude.sources | 8 + mcs/class/System.Web/Makefile | 2 - .../System.Web/System.Web.Mail/SmtpClient.cs | 25 +- .../System.Windows.Forms/DataGridViewCell.cs | 2 +- mcs/class/System.XML/Makefile | 3 + .../LocalAppContextSwitches.cs | 2 + mcs/class/System.XML/System.Xml.dll.sources | 528 +-- .../System.XML/System.Xml_xtest.dll.sources | 20 + mcs/class/System.XML/common.sources | 409 +++ .../System.XML/corefx/SR.cs.REMOVED.git-id | 1 + .../System.XML/mobile_System.Xml.dll.sources | 489 +-- .../Test/System.Xaml/XamlLanguageTest.cs | 6 +- .../System.Xml.Linq_xtest.dll.sources | 25 + mcs/class/System/Assembly/AssemblyInfo.cs | 2 +- .../OidLookup.Managed.cs | 77 + mcs/class/System/Makefile | 8 +- .../Mono.AppleTls/AppleCertificateHelper.cs | 33 +- .../System/Mono.AppleTls/AppleTlsContext.cs | 39 +- .../System/Mono.AppleTls/AppleTlsProvider.cs | 4 +- .../System/Mono.AppleTls/AppleTlsStream.cs | 2 - mcs/class/System/Mono.AppleTls/Certificate.cs | 450 --- mcs/class/System/Mono.AppleTls/Enums.cs | 2 - mcs/class/System/Mono.AppleTls/Items.cs | 356 -- .../MonoCertificatePal.Mobile.cs | 189 + ...ortExport.cs => MonoCertificatePal.OSX.cs} | 126 +- .../Mono.AppleTls/MonoCertificatePal.cs | 190 + mcs/class/System/Mono.AppleTls/Policy.cs | 2 - .../System/Mono.AppleTls/SafeHandles.Mono.cs | 94 + .../Mono.AppleTls/SafeHandles.cs} | 120 +- .../System/Mono.AppleTls/SecureTransport.cs | 2 - .../System/Mono.AppleTls/SslConnection.cs | 2 - mcs/class/System/Mono.AppleTls/Trust.cs | 38 +- .../X509CertificateImplApple.cs | 124 +- .../Mono.AppleTls/X509PalImpl.Apple.cs} | 109 +- mcs/class/System/Mono.Btls/MonoBtlsContext.cs | 11 +- mcs/class/System/Mono.Btls/MonoBtlsObject.cs | 12 +- mcs/class/System/Mono.Btls/MonoBtlsPkcs12.cs | 17 +- .../System/Mono.Btls/MonoBtlsProvider.cs | 19 +- mcs/class/System/Mono.Btls/MonoBtlsUtils.cs | 3 + .../Mono.Btls/X509CertificateImplBtls.cs | 130 +- .../System/Mono.Btls/X509PalImpl.Btls.cs | 74 + .../MonoTlsProviderFactory.cs | 7 +- .../System/Mono/SystemCertificateProvider.cs | 176 + .../System/Mono/SystemDependencyProvider.cs | 69 + .../Mono/X509Pal.cs} | 19 +- .../Mono/X509PalImpl.Mono.cs} | 49 +- mcs/class/System/Mono/X509PalImpl.cs | 88 + mcs/class/System/ReferenceSources/CAPI.cs | 160 - .../ReferenceSources/SR.cs.REMOVED.git-id | 1 - .../IPGlobalPropertiesFactory.cs} | 47 +- .../IPInterfaceProperties.cs | 484 --- .../LinuxIPInterfaceProperties.cs | 89 + .../LinuxIPv4InterfaceProperties.cs} | 60 +- ...ics.cs => LinuxIPv4InterfaceStatistics.cs} | 126 +- .../LinuxNetworkInterface.cs | 385 ++ .../LinuxNetworkInterfaceMarshal.cs | 1 - .../LinuxUnicastIPAddressInformation.cs | 98 + .../MacOsIPInterfaceProperties.cs | 78 + .../MacOsIPv4InterfaceProperties.cs} | 41 +- .../MacOsIPv4InterfaceStatistics.cs | 89 + .../MacOsNetworkInterface.cs | 220 ++ .../MacOsNetworkInterfaceMarshal.cs | 1 - .../NetworkInterface.cs | 845 +---- .../NetworkInterfaceFactory.cs | 52 + .../UnixIPGlobalProperties.cs | 393 +++ .../UnixIPGlobalStatistics.cs | 114 + .../UnixIPInterfaceProperties.cs | 226 ++ .../UnixIPv4InterfaceProperties.cs} | 61 +- .../UnixIcmpV4Statistics.cs | 126 + .../UnixIcmpV6Statistics.cs | 145 + .../UnixNetworkInterface.cs | 154 + .../UnixNetworkInterfaceFactory.cs} | 55 +- .../UnixTcpStatistics.cs | 90 + ...{UdpStatistics.cs => UnixUdpStatistics.cs} | 42 - ...lection.cs => Win32IPAddressCollection.cs} | 11 +- ...operties.cs => Win32IPGlobalProperties.cs} | 344 +- ...atistics.cs => Win32IPGlobalStatistics.cs} | 93 +- .../Win32IPInterfaceProperties.cs | 183 + ...ies.cs => Win32IPv4InterfaceProperties.cs} | 98 +- .../Win32IPv4InterfaceStatistics.cs | 91 + ...ies.cs => Win32IPv6InterfaceProperties.cs} | 5 +- ...Statistics.cs => Win32IcmpV4Statistics.cs} | 102 +- ...Statistics.cs => Win32IcmpV6Statistics.cs} | 122 +- .../Win32NetworkInterface.cs | 210 ++ .../Win32NetworkInterfaceFactory.cs} | 39 +- .../Win32NetworkInterfaceMarshal.cs | 16 +- ...TcpStatistics.cs => Win32TcpStatistics.cs} | 66 +- .../Win32UdpStatistics.cs} | 68 +- ...cs => Win32UnicastIPAddressInformation.cs} | 75 +- .../Win32UnixFactoryPal.cs} | 36 +- mcs/class/System/System.Net.Sockets/Socket.cs | 22 + mcs/class/System/System.Net/MacProxy.cs | 4 +- .../System/System.Net/WebResponseStream.cs | 2 +- .../X509Certificate2.cs | 95 +- .../X509Certificate2Collection.cs | 17 +- .../X509Certificate2Impl.cs | 10 +- .../X509Certificate2ImplMono.cs | 292 +- .../X509Helper2.cs | 176 +- .../AsnEncodedDataCollection.cs | 107 - .../AsnEncodedDataEnumerator.cs | 87 - mcs/class/System/System/AndroidPlatform.cs | 3 +- mcs/class/System/System_xtest.dll.sources | 112 + .../DeflateStreamTest.cs | 55 + .../Test/System.Net.Security/SslStreamTest.cs | 2 +- .../HttpWebRequestTest.cs.REMOVED.git-id | 2 +- .../X500DistinguishedNameTest.cs | 4 +- .../X509Cert20Test.cs | 2 + .../X509Certificate2Test.cs.REMOVED.git-id | 2 +- mcs/class/System/appletls.sources | 14 + mcs/class/System/basic_System.dll.sources | 1 + mcs/class/System/build_System.dll.sources | 1 + mcs/class/System/common.sources | 60 +- mcs/class/System/corefx.unix.sources | 2 + mcs/class/System/corefx/SR.cs | 555 --- mcs/class/System/corefx/SR.missing.cs | 6 - mcs/class/System/corefx/Unix/Interop.Read.cs | 51 + mcs/class/System/corefx/Unix/Interop.cs | 11 + .../System/linux_net_4_x_System.dll.sources | 18 +- mcs/class/System/linux_networkinfo.sources | 6 + ...urces => macos_net_4_x_System.dll.sources} | 6 +- mcs/class/System/macos_networkinfo.sources | 5 + mcs/class/System/mobile_System.dll.sources | 1 + .../monodroid_System_test.dll.exclude.sources | 81 + .../System/monodroid_System_test.dll.sources | 1 + mcs/class/System/monotouch_System.dll.sources | 3 + .../monotouch_System_test.dll.exclude.sources | 207 ++ ...monotouch_watch_System.dll.exclude.sources | 3 + ...g_aot_full_System_test.dll.exclude.sources | 209 ++ .../testing_aot_full_System_test.dll.sources | 1 + ...aot_hybrid_System_test.dll.exclude.sources | 209 ++ .../System/unix_net_4_x_System.dll.sources | 17 + mcs/class/System/unix_networkinfo.sources | 10 + .../wasm_System_test.dll.exclude.sources | 1 + .../win32_net_4_x_System.dll.exclude.sources | 3 + .../System/win32_net_4_x_System.dll.sources | 4 + mcs/class/System/win32_networkinfo.sources | 15 + .../System/winaot_System.dll.exclude.sources | 3 + mcs/class/System/winaot_System.dll.sources | 2 + .../winaot_System_test.dll.exclude.sources | 1 + mcs/class/System/xammac_System.dll.sources | 6 + .../System/xammac_net_4_5_System.dll.sources | 2 +- mcs/class/corlib/Assembly/AssemblyInfo.cs | 3 +- mcs/class/corlib/CommonCrypto/CommonCrypto.cs | 15 +- .../RNGCryptoServiceProvider.cryptor.cs | 5 + .../corlib/LinkerDescriptor/mscorlib.xml | 2 - mcs/class/corlib/Makefile | 41 +- .../Mono/CertificateImportFlags.cs} | 19 +- mcs/class/corlib/Mono/DependencyInjector.cs | 90 + .../corlib/Mono/ISystemCertificateProvider.cs | 43 + .../corlib/Mono/ISystemDependencyProvider.cs | 34 + .../corlib/ReferenceSources/ParseNumbers.cs | 426 --- .../ReferenceSources/SR.cs.REMOVED.git-id | 1 + .../ReferenceSources/SR2.cs | 0 mcs/class/corlib/ReferenceSources/String.cs | 4 +- .../System.Diagnostics/Debug.cs} | 44 +- mcs/class/corlib/System.IO/DriveInfo.cs | 3 +- mcs/class/corlib/System.IO/FileAttributes.cs | 66 - .../System.Reflection/CustomAttributeData.cs | 12 + .../CustomAttributeFormatException.cs | 63 - .../corlib/System.Reflection/FieldInfo.cs | 41 + .../corlib/System.Reflection/MonoMethod.cs | 31 + .../corlib/System.Reflection/ParameterInfo.cs | 37 +- .../ConditionalWeakTable.cs | 6 +- .../System.Runtime.InteropServices/Marshal.cs | 192 +- .../RegistrationConnectionType.cs | 21 - .../SafeBuffer.cs | 3 +- .../X509Certificate.cs | 826 +++-- .../X509Certificate20.cs | 262 -- .../X509CertificateImpl.cs | 109 +- .../X509CertificateImplMono.cs | 178 - .../X509Helper.Apple.cs | 39 - .../X509Helper.cs | 199 +- .../CryptoConfig.Mobile.cs | 39 +- .../RNGCryptoServiceProvider.cs | 86 +- .../System.Security.Policy/Publisher.cs | 116 - .../PublisherMembershipCondition.cs | 138 - .../WindowsPrincipal.cs | 5 +- .../corlib/System/AssemblyLoadEventHandler.cs | 37 - mcs/class/corlib/System/Environment.cs | 4 +- mcs/class/corlib/System/MonoCustomAttrs.cs | 214 +- mcs/class/corlib/System/Nullable.cs | 129 +- mcs/class/corlib/System/OperatingSystem.cs | 141 - .../corlib/System/ResolveEventHandler.cs | 38 - mcs/class/corlib/System/StringComparison.cs | 44 - mcs/class/corlib/System/TypeCode.cs | 65 - mcs/class/corlib/System/Void.cs | 40 - mcs/class/corlib/Test/System.IO/FileTest.cs | 22 + .../CustomAttributeDataTest.cs | 73 + .../X509CapiTest.cs | 3 + .../X509CertificateCas.cs | 1 + .../X509CertificateTest.cs.REMOVED.git-id | 2 +- .../X509SpcTest.cs | 1 + .../HashAlgorithmTestBase.cs | 37 + .../RSAPKCS1SignatureDeformatterTest.cs | 8 +- .../PublisherMembershipConditionTest.cs | 312 -- .../System.Security.Policy/PublisherTest.cs | 111 - mcs/class/corlib/Test/System/ExceptionTest.cs | 75 + mcs/class/corlib/Test/System/NullableTest.cs | 14 + .../NumberFormatterTest.cs.REMOVED.git-id | 2 +- .../Test/System/StringTest.cs.REMOVED.git-id | 2 +- mcs/class/corlib/Test/System/TimeSpanTest.cs | 4 +- .../corefx/Interop.GetRandomBytes.Mono.cs | 36 + .../corefx/Mono.SafePasswordHandle.Unix.cs | 18 + .../corefx/Mono.SafePasswordHandle.Windows.cs | 18 + mcs/class/corlib/corefx/RuntimeImports.cs | 2 +- mcs/class/corlib/corefx/SR.cs.REMOVED.git-id | 2 +- mcs/class/corlib/corefx/SR.missing.cs | 6 + mcs/class/corlib/corefx/TimeSpanParse.cs | 18 + mcs/class/corlib/corert/Debug.cs | 15 - .../corert/Decimal.DecCalc.cs.REMOVED.git-id | 1 + .../corlib/corert/Decimal.cs.REMOVED.git-id | 1 + mcs/class/corlib/corert/RuntimeImports.cs | 18 + mcs/class/corlib/corlib.dll.sources | 1777 ---------- .../corlib/corlib.dll.sources.REMOVED.git-id | 1 + mcs/class/corlib/corlib_test.dll.sources | 2 - mcs/class/corlib/corlib_xtest.dll.sources | 307 ++ .../linux_net_4_x_corlib.dll.exclude.sources | 1 + .../corlib/linux_net_4_x_corlib.dll.sources | 5 +- .../macos_net_4_x_corlib.dll.exclude.sources | 1 + .../corlib/macos_net_4_x_corlib.dll.sources | 1 + .../monodroid_corlib_test.dll.exclude.sources | 52 + .../corlib/monodroid_corlib_test.dll.sources | 1 + mcs/class/corlib/monotouch_corlib.dll.sources | 2 - .../monotouch_corlib_test.dll.exclude.sources | 155 + mcs/class/corlib/net_4_x_corlib.dll.sources | 2 - .../orbis_corlib_test.dll.exclude.sources | 1 + .../corlib/orbis_corlib_test.dll.sources | 1 + ...g_aot_full_corlib_test.dll.exclude.sources | 131 + .../testing_aot_full_corlib_test.dll.sources | 1 + ...aot_hybrid_corlib_test.dll.exclude.sources | 22 + .../unix_net_4_x_corlib.dll.exclude.sources | 1 + ...ources => unix_net_4_x_corlib.dll.sources} | 0 .../wasm_corlib_test.dll.exclude.sources | 131 + mcs/class/corlib/wasm_corlib_test.dll.sources | 1 + .../win32_net_4_x_corlib.dll.exclude.sources | 7 + .../corlib/win32_net_4_x_corlib.dll.sources | 6 + .../corlib/winaot_corlib.dll.exclude.sources | 7 + .../winaot_corlib_test.dll.exclude.sources | 1 + .../corlib/winaot_corlib_test.dll.sources | 1 + ...xammac_net_4_5_corlib.dll.exclude.sources} | 0 .../1051600011/Mono.Cecil.dll.REMOVED.git-id | 1 - .../Mono.Security.dll.REMOVED.git-id | 1 - .../System.Configuration.dll.REMOVED.git-id | 1 - .../1051600011/System.Core.dll.REMOVED.git-id | 1 - .../System.Numerics.dll.REMOVED.git-id | 1 - .../System.Security.dll.REMOVED.git-id | 1 - .../1051600011/System.Xml.dll.REMOVED.git-id | 1 - .../1051600011/System.dll.REMOVED.git-id | 1 - .../1051600011/mcs.exe.REMOVED.git-id | 1 - .../1051600011/mscorlib.dll.REMOVED.git-id | 1 - .../1051600011/Mono.Cecil.dll.REMOVED.git-id | 1 - .../Mono.Security.dll.REMOVED.git-id | 1 - .../System.Configuration.dll.REMOVED.git-id | 1 - .../1051600011/System.Core.dll.REMOVED.git-id | 1 - .../System.Numerics.dll.REMOVED.git-id | 1 - .../System.Security.dll.REMOVED.git-id | 1 - .../1051600011/System.Xml.dll.REMOVED.git-id | 1 - .../1051600011/System.dll.REMOVED.git-id | 1 - .../1051600011/mcs.exe.REMOVED.git-id | 1 - .../1051600011/mscorlib.dll.REMOVED.git-id | 1 - .../Facades/System.Collections.Concurrent.dll | Bin .../Facades/System.Collections.dll | Bin .../Facades/System.Diagnostics.Debug.dll | Bin .../System.Diagnostics.FileVersionInfo.dll | Bin .../Facades/System.Diagnostics.Tools.dll | Bin .../Facades/System.Dynamic.Runtime.dll | Bin .../Facades/System.Globalization.dll | Bin .../System.IO.FileSystem.Primitives.dll | Bin .../Facades/System.IO.FileSystem.dll | Bin .../Facades/System.IO.dll | Bin .../Facades/System.Linq.Expressions.dll | Bin .../Facades/System.Linq.dll | Bin .../Facades/System.Reflection.Extensions.dll | Bin .../Facades/System.Reflection.Primitives.dll | Bin .../Facades/System.Reflection.dll | Bin .../System.Resources.ResourceManager.dll | Bin .../Facades/System.Runtime.Extensions.dll | Bin .../System.Runtime.InteropServices.dll | Bin .../Facades/System.Runtime.Numerics.dll | Bin .../Facades/System.Runtime.dll | Bin ...ystem.Security.Cryptography.Algorithms.dll | Bin ...ystem.Security.Cryptography.Primitives.dll | Bin .../System.Text.Encoding.CodePages.dll | Bin .../System.Text.Encoding.Extensions.dll | Bin .../Facades/System.Text.Encoding.dll | Bin .../System.Threading.Tasks.Parallel.dll | Bin .../Facades/System.Threading.Tasks.dll | Bin .../Facades/System.Threading.dll | Bin .../Facades/System.ValueTuple.dll | Bin .../Facades/System.Xml.ReaderWriter.dll | Bin .../Facades/System.Xml.XDocument.dll | Bin .../Mono.Cecil.dll.REMOVED.git-id | 1 + .../Mono.Security.dll.REMOVED.git-id | 1 + .../System.Configuration.dll.REMOVED.git-id | 1 + .../System.Core.dll.REMOVED.git-id | 1 + .../System.IO.Compression.dll | Bin 99328 -> 99328 bytes .../System.Numerics.dll.REMOVED.git-id | 1 + .../System.Security.dll.REMOVED.git-id | 1 + .../System.Xml.Linq.dll.REMOVED.git-id | 0 .../System.Xml.dll.REMOVED.git-id | 1 + .../System.dll.REMOVED.git-id | 1 + .../mcs.exe.REMOVED.git-id | 1 + .../mscorlib.dll.REMOVED.git-id | 1 + .../Facades/System.Collections.Concurrent.dll | Bin .../Facades/System.Collections.dll | Bin .../Facades/System.Diagnostics.Debug.dll | Bin .../System.Diagnostics.FileVersionInfo.dll | Bin .../Facades/System.Diagnostics.Tools.dll | Bin .../Facades/System.Dynamic.Runtime.dll | Bin .../Facades/System.Globalization.dll | Bin .../System.IO.FileSystem.Primitives.dll | Bin .../Facades/System.IO.FileSystem.dll | Bin .../Facades/System.IO.dll | Bin .../Facades/System.Linq.Expressions.dll | Bin .../Facades/System.Linq.dll | Bin .../Facades/System.Reflection.Extensions.dll | Bin .../Facades/System.Reflection.Primitives.dll | Bin .../Facades/System.Reflection.dll | Bin .../System.Resources.ResourceManager.dll | Bin .../Facades/System.Runtime.Extensions.dll | Bin .../System.Runtime.InteropServices.dll | Bin .../Facades/System.Runtime.Numerics.dll | Bin .../Facades/System.Runtime.dll | Bin ...ystem.Security.Cryptography.Algorithms.dll | Bin ...ystem.Security.Cryptography.Primitives.dll | Bin .../System.Text.Encoding.CodePages.dll | Bin .../System.Text.Encoding.Extensions.dll | Bin .../Facades/System.Text.Encoding.dll | Bin .../System.Threading.Tasks.Parallel.dll | Bin .../Facades/System.Threading.Tasks.dll | Bin .../Facades/System.Threading.dll | Bin .../Facades/System.ValueTuple.dll | Bin .../Facades/System.Xml.ReaderWriter.dll | Bin .../Facades/System.Xml.XDocument.dll | Bin .../Mono.Cecil.dll.REMOVED.git-id | 1 + .../Mono.Security.dll.REMOVED.git-id | 1 + .../System.Configuration.dll.REMOVED.git-id | 1 + .../System.Core.dll.REMOVED.git-id | 1 + .../System.IO.Compression.dll | Bin 99328 -> 99328 bytes .../System.Numerics.dll.REMOVED.git-id | 1 + .../System.Security.dll.REMOVED.git-id | 1 + .../System.Xml.Linq.dll.REMOVED.git-id | 0 .../System.Xml.dll.REMOVED.git-id | 1 + .../System.dll.REMOVED.git-id | 1 + .../mcs.exe.REMOVED.git-id | 1 + .../mscorlib.dll.REMOVED.git-id | 1 + .../Facades/System.Collections.Concurrent.dll | Bin .../Facades/System.Collections.dll | Bin .../Facades/System.Diagnostics.Debug.dll | Bin .../System.Diagnostics.FileVersionInfo.dll | Bin .../Facades/System.Diagnostics.Tools.dll | Bin .../Facades/System.Dynamic.Runtime.dll | Bin .../Facades/System.Globalization.dll | Bin .../System.IO.FileSystem.Primitives.dll | Bin .../Facades/System.IO.FileSystem.dll | Bin .../Facades/System.IO.dll | Bin .../Facades/System.Linq.Expressions.dll | Bin .../Facades/System.Linq.dll | Bin .../Facades/System.Reflection.Extensions.dll | Bin .../Facades/System.Reflection.Primitives.dll | Bin .../Facades/System.Reflection.dll | Bin .../System.Resources.ResourceManager.dll | Bin .../Facades/System.Runtime.Extensions.dll | Bin .../System.Runtime.InteropServices.dll | Bin .../Facades/System.Runtime.Numerics.dll | Bin .../Facades/System.Runtime.dll | Bin ...ystem.Security.Cryptography.Algorithms.dll | Bin ...ystem.Security.Cryptography.Primitives.dll | Bin .../System.Text.Encoding.CodePages.dll | Bin .../System.Text.Encoding.Extensions.dll | Bin .../Facades/System.Text.Encoding.dll | Bin .../System.Threading.Tasks.Parallel.dll | Bin .../Facades/System.Threading.Tasks.dll | Bin .../Facades/System.Threading.dll | Bin .../Facades/System.ValueTuple.dll | Bin .../Facades/System.Xml.ReaderWriter.dll | Bin .../Facades/System.Xml.XDocument.dll | Bin .../Mono.Cecil.dll.REMOVED.git-id | 1 + .../Mono.Security.dll.REMOVED.git-id | 1 + .../System.Configuration.dll.REMOVED.git-id | 1 + .../System.Core.dll.REMOVED.git-id | 1 + .../System.IO.Compression.dll | Bin 99328 -> 99328 bytes .../System.Numerics.dll.REMOVED.git-id | 1 + .../System.Security.dll.REMOVED.git-id | 1 + .../System.Xml.Linq.dll.REMOVED.git-id | 0 .../System.Xml.dll.REMOVED.git-id | 1 + .../System.dll.REMOVED.git-id | 1 + .../mcs.exe.REMOVED.git-id | 1 + .../mscorlib.dll.REMOVED.git-id | 1 + .../1051600011/Mono.Cecil.dll.REMOVED.git-id | 1 - .../Mono.Security.dll.REMOVED.git-id | 1 - .../System.Configuration.dll.REMOVED.git-id | 1 - .../1051600011/System.Core.dll.REMOVED.git-id | 1 - .../System.Numerics.dll.REMOVED.git-id | 1 - .../System.Security.dll.REMOVED.git-id | 1 - .../1051600011/System.Xml.dll.REMOVED.git-id | 1 - .../1051600011/System.dll.REMOVED.git-id | 1 - .../1051600011/mcs.exe.REMOVED.git-id | 1 - .../1051600011/mscorlib.dll.REMOVED.git-id | 1 - .../Facades/System.Collections.Concurrent.dll | Bin 0 -> 5120 bytes .../Facades/System.Collections.dll | Bin 0 -> 5120 bytes .../Facades/System.Diagnostics.Debug.dll | Bin 0 -> 4608 bytes .../System.Diagnostics.FileVersionInfo.dll | Bin 0 -> 4608 bytes .../Facades/System.Diagnostics.Tools.dll | Bin 0 -> 4608 bytes .../Facades/System.Dynamic.Runtime.dll | Bin 0 -> 5632 bytes .../Facades/System.Globalization.dll | Bin 0 -> 5120 bytes .../System.IO.FileSystem.Primitives.dll | Bin 0 -> 4608 bytes .../Facades/System.IO.FileSystem.dll | Bin 0 -> 4608 bytes .../Facades/System.IO.dll | Bin 0 -> 4608 bytes .../Facades/System.Linq.Expressions.dll | Bin 0 -> 6656 bytes .../Facades/System.Linq.dll | Bin 0 -> 4096 bytes .../Facades/System.Reflection.Extensions.dll | Bin 0 -> 4608 bytes .../Facades/System.Reflection.Primitives.dll | Bin 0 -> 5120 bytes .../Facades/System.Reflection.dll | Bin 0 -> 5632 bytes .../System.Resources.ResourceManager.dll | Bin 0 -> 4608 bytes .../Facades/System.Runtime.Extensions.dll | Bin 0 -> 5120 bytes .../System.Runtime.InteropServices.dll | Bin 0 -> 7680 bytes .../Facades/System.Runtime.Numerics.dll | Bin 0 -> 4608 bytes .../Facades/System.Runtime.dll | Bin 0 -> 12800 bytes ...ystem.Security.Cryptography.Algorithms.dll | Bin 0 -> 6144 bytes ...ystem.Security.Cryptography.Primitives.dll | Bin 0 -> 5120 bytes .../System.Text.Encoding.CodePages.dll | Bin 0 -> 4608 bytes .../System.Text.Encoding.Extensions.dll | Bin 0 -> 4608 bytes .../Facades/System.Text.Encoding.dll | Bin 0 -> 5120 bytes .../System.Threading.Tasks.Parallel.dll | Bin 0 -> 4608 bytes .../Facades/System.Threading.Tasks.dll | Bin 0 -> 5632 bytes .../Facades/System.Threading.dll | Bin 0 -> 5632 bytes .../Facades/System.ValueTuple.dll | Bin 0 -> 4608 bytes .../Facades/System.Xml.ReaderWriter.dll | Bin 0 -> 5120 bytes .../Facades/System.Xml.XDocument.dll | Bin 0 -> 5120 bytes .../Mono.Cecil.dll.REMOVED.git-id | 1 + .../Mono.Security.dll.REMOVED.git-id | 1 + .../System.Configuration.dll.REMOVED.git-id | 1 + .../System.Core.dll.REMOVED.git-id | 1 + .../System.IO.Compression.dll | Bin 0 -> 99328 bytes .../System.Numerics.dll.REMOVED.git-id | 1 + .../System.Security.dll.REMOVED.git-id | 1 + .../System.Xml.Linq.dll.REMOVED.git-id | 1 + .../System.Xml.dll.REMOVED.git-id | 1 + .../System.dll.REMOVED.git-id | 1 + .../mcs.exe.REMOVED.git-id | 1 + .../mscorlib.dll.REMOVED.git-id | 1 + .../System/System.txt.REMOVED.git-id | 2 +- .../NetworkInformation/IPGlobalProperties.cs | 31 +- .../system/globalization/charunicodeinfo.cs | 4 + .../system/globalization/datetimeformat.cs | 16 + .../datetimeparse.cs.REMOVED.git-id | 2 +- .../mscorlib/system/io/binaryreader.cs | 4 +- .../referencesource/mscorlib/system/math.cs | 10 +- .../mscorlib/system/text/encoding.cs | 6 +- .../mscorlib/system/throwhelper.cs | 6 + mcs/class/test-helpers/AdminHelper.cs | 17 + mcs/class/test-helpers/Configuration.Http.cs | 26 + mcs/class/test-helpers/NunitHelpers.cs | 147 + mcs/class/test-helpers/PlatformDetection.cs | 36 + .../RemoteExecutorTestBase.Mobile.cs | 24 + .../RemoteExecutorTestBase.Mono.cs | 19 + mcs/errors/cs0280.cs | 22 + mcs/errors/cs1611-2.cs | 8 + mcs/errors/cs1644-63.cs | 22 + mcs/errors/cs1644-64.cs | 13 + mcs/errors/cs1644-65.cs | 13 + mcs/errors/cs1644-66.cs | 17 + mcs/errors/{cs0428-2.cs => cs8385-2.cs} | 2 +- mcs/errors/{cs0213-2.cs => cs8385.cs} | 2 +- mcs/mcs/argument.cs | 2 + mcs/mcs/cs-parser.jay.REMOVED.git-id | 2 +- mcs/mcs/expression.cs.REMOVED.git-id | 2 +- mcs/mcs/mcs.csproj | 107 +- mcs/mcs/report.cs | 11 +- mcs/mcs/settings.cs | 3 +- mcs/mcs/statement.cs.REMOVED.git-id | 2 +- .../NUnitMocks/mocks/nunit.mocks.csproj | 5 +- mcs/tests/test-961.cs | 6 + mcs/tests/test-decl-expr-05.cs | 5 + mcs/tests/test-fixed-01.cs | 20 + mcs/tests/ver-il-net_4_x.xml.REMOVED.git-id | 2 +- mcs/tools/Makefile | 3 +- mcs/tools/cil-stringreplacer/Makefile | 3 +- .../cil-stringreplacer/cil-stringreplacer.cs | 7 + mcs/tools/corcompare/AssemblyResolver.cs | 17 +- mcs/tools/corcompare/Util.cs | 98 +- mcs/tools/corcompare/WellFormedXmlWriter.cs | 6 +- mcs/tools/corcompare/mono-api-info.cs | 431 ++- mcs/tools/linker/Makefile | 57 +- mcs/tools/mono-api-diff/Makefile | 10 + mcs/tools/mono-api-diff/mono-api-diff.cs | 1938 ++++++++++ .../mono-api-diff/mono-api-diff.exe.sources | 2 + mcs/tools/mono-api-html/ApiChange.cs | 30 +- mcs/tools/mono-api-html/ApiDiff.cs | 277 +- mcs/tools/mono-api-html/AssemblyComparer.cs | 24 +- mcs/tools/mono-api-html/ClassComparer.cs | 32 +- mcs/tools/mono-api-html/Comparer.cs | 19 +- .../mono-api-html/ConstructorComparer.cs | 21 +- mcs/tools/mono-api-html/EventComparer.cs | 17 +- mcs/tools/mono-api-html/FieldComparer.cs | 17 +- mcs/tools/mono-api-html/Formatter.cs | 11 +- mcs/tools/mono-api-html/Helpers.cs | 18 +- mcs/tools/mono-api-html/HtmlFormatter.cs | 9 +- mcs/tools/mono-api-html/InterfaceComparer.cs | 11 +- mcs/tools/mono-api-html/MarkdownFormatter.cs | 9 +- mcs/tools/mono-api-html/MemberComparer.cs | 27 +- mcs/tools/mono-api-html/MethodComparer.cs | 9 +- mcs/tools/mono-api-html/NamespaceComparer.cs | 9 +- mcs/tools/mono-api-html/PropertyComparer.cs | 23 +- mk/Makefile.in | 9 +- mono/Makefile.in | 9 +- mono/arch/Makefile.in | 9 +- mono/arch/amd64/Makefile.in | 9 +- mono/arch/arm/Makefile.in | 9 +- mono/arch/arm64/Makefile.in | 9 +- mono/arch/mips/Makefile.in | 9 +- mono/arch/ppc/Makefile.in | 9 +- mono/arch/s390x/Makefile.in | 9 +- mono/arch/sparc/Makefile.in | 9 +- mono/arch/x86/Makefile.in | 9 +- mono/benchmark/Makefile.in | 9 +- mono/btls/CMakeLists.txt | 7 +- mono/btls/Makefile.in | 9 +- mono/btls/btls-pkcs12.c | 13 +- mono/btls/btls-x509.c | 25 +- mono/cil/Makefile.in | 9 +- mono/cil/cil-opcodes.xml | 4 +- mono/cil/opcode.def | 4 +- mono/dis/Makefile.in | 12 +- mono/dis/dump.c | 2 +- mono/dis/get.c.REMOVED.git-id | 2 +- mono/dis/main.c | 3 +- mono/eglib/Makefile.in | 9 +- mono/eglib/eglib-remap.h | 3 - mono/eglib/glib.h | 9 +- mono/eglib/goutput.c | 6 +- mono/eglib/gspawn.c | 7 +- mono/eglib/gstring.c | 55 - mono/metadata/Makefile.am | 36 +- mono/metadata/Makefile.in.REMOVED.git-id | 2 +- mono/metadata/abi-details.h | 2 + mono/metadata/appdomain-icalls.h | 43 +- mono/metadata/appdomain.c | 220 +- mono/metadata/appdomain.h | 24 +- mono/metadata/assembly-internals.h | 11 + mono/metadata/assembly.c.REMOVED.git-id | 2 +- mono/metadata/assembly.h | 31 +- mono/metadata/attach.c | 8 +- mono/metadata/boehm-gc.c | 27 +- mono/metadata/callspec.c | 3 +- mono/metadata/class-init.c.REMOVED.git-id | 2 +- mono/metadata/class-internals.h | 19 +- mono/metadata/class.c.REMOVED.git-id | 2 +- mono/metadata/class.h | 84 +- mono/metadata/cominterop.c.REMOVED.git-id | 2 +- mono/metadata/cominterop.h | 12 +- mono/metadata/console-io.h | 7 + mono/metadata/console-unix.c | 6 +- mono/metadata/custom-attrs-internals.h | 6 + mono/metadata/custom-attrs.c | 648 ++-- mono/metadata/debug-helpers.c | 15 +- mono/metadata/debug-mono-ppdb.c | 6 + mono/metadata/debug-mono-ppdb.h | 3 + mono/metadata/decimal-ms.c | 3135 ----------------- mono/metadata/decimal-ms.h | 66 - mono/metadata/domain.c | 35 +- mono/metadata/environment-internal.h | 24 + mono/metadata/environment.c | 3 +- mono/metadata/environment.h | 4 +- mono/metadata/exception-internals.h | 40 +- mono/metadata/exception.c | 512 +-- mono/metadata/exception.h | 70 +- mono/metadata/file-mmap.h | 8 + mono/metadata/filewatcher.c | 42 +- mono/metadata/filewatcher.h | 13 +- mono/metadata/gc-internals.h | 64 +- mono/metadata/gc.c | 107 +- mono/metadata/handle.c | 16 +- mono/metadata/handle.h | 264 +- mono/metadata/icall-def.h | 524 ++- mono/metadata/icall-table.c | 7 +- mono/metadata/icall-windows.c | 46 +- mono/metadata/icall.c.REMOVED.git-id | 2 +- mono/metadata/icalls.h | 20 + mono/metadata/image.c | 26 +- mono/metadata/image.h | 13 +- mono/metadata/loader.c | 40 +- mono/metadata/loader.h | 14 +- mono/metadata/locales.c | 4 +- mono/metadata/locales.h | 88 +- mono/metadata/marshal-ilgen.c.REMOVED.git-id | 2 +- mono/metadata/marshal-windows.c | 74 +- mono/metadata/marshal.c.REMOVED.git-id | 2 +- mono/metadata/marshal.h | 175 +- mono/metadata/metadata.c.REMOVED.git-id | 2 +- mono/metadata/metadata.h | 35 +- mono/metadata/method-builder-ilgen.c | 4 +- mono/metadata/monitor.c | 77 +- mono/metadata/monitor.h | 73 +- mono/metadata/mono-conc-hash.c | 46 +- mono/metadata/mono-config.c | 12 + mono/metadata/mono-debug.c | 14 +- mono/metadata/mono-debug.h | 3 + mono/metadata/mono-hash.c | 18 + mono/metadata/mono-mlist.h | 12 +- mono/metadata/mono-perfcounters.h | 21 + mono/metadata/mono-route.h | 4 +- .../mono-security-windows-internals.h | 9 +- mono/metadata/mono-security-windows.c | 151 +- mono/metadata/mono-security.c | 54 +- mono/metadata/null-gc.c | 19 +- mono/metadata/number-ms.c | 331 -- mono/metadata/number-ms.h | 40 +- mono/metadata/object-internals.h | 211 +- mono/metadata/object-offsets.h | 9 + mono/metadata/object.c.REMOVED.git-id | 2 +- mono/metadata/object.h | 169 +- mono/metadata/opcodes.c | 2 +- mono/metadata/opcodes.h | 2 +- mono/metadata/pal-icalls.c | 78 + mono/metadata/pal-icalls.h | 26 + mono/metadata/pal_config.h | 2 + mono/metadata/profiler-private.h | 1 + mono/metadata/profiler.c | 107 +- mono/metadata/rand.c | 17 +- mono/metadata/rand.h | 20 +- mono/metadata/reflection-cache.h | 13 +- mono/metadata/reflection.c | 76 +- mono/metadata/reflection.h | 110 +- mono/metadata/remoting.c | 32 +- mono/metadata/runtime.c | 2 +- mono/metadata/security-core-clr.h | 6 +- mono/metadata/security-manager.c | 4 +- mono/metadata/security-manager.h | 5 +- mono/metadata/security.h | 89 +- mono/metadata/sgen-bridge.c | 4 +- mono/metadata/sgen-client-mono.h | 8 +- mono/metadata/sgen-mono-ilgen.c | 8 +- mono/metadata/sgen-mono.c | 40 +- mono/metadata/sgen-stw.c | 65 +- mono/metadata/sgen-tarjan-bridge.c | 2 +- mono/metadata/sgen-toggleref.c | 5 +- mono/metadata/sre-encode.c | 4 +- mono/metadata/sre-save.c.REMOVED.git-id | 2 +- mono/metadata/sre.c.REMOVED.git-id | 2 +- mono/metadata/string-icalls.h | 6 + mono/metadata/sysmath.c | 10 +- mono/metadata/sysmath.h | 45 + mono/metadata/threadpool-io-epoll.c | 8 +- mono/metadata/threadpool-io-poll.c | 8 +- mono/metadata/threadpool-io.c | 5 +- mono/metadata/threadpool-io.h | 3 + mono/metadata/threadpool-worker-default.c | 58 +- mono/metadata/threadpool.c | 6 +- mono/metadata/threadpool.h | 25 + mono/metadata/threads-types.h | 170 +- mono/metadata/threads.c.REMOVED.git-id | 2 +- mono/metadata/threads.h | 35 +- mono/metadata/verify.c.REMOVED.git-id | 2 +- mono/metadata/w32event-unix.c | 4 +- mono/metadata/w32event.h | 6 + mono/metadata/w32file-unix.c.REMOVED.git-id | 2 +- mono/metadata/w32file-win32.c | 67 +- mono/metadata/w32file.c | 32 +- mono/metadata/w32file.h | 132 +- mono/metadata/w32handle-namespace.c | 2 +- mono/metadata/w32handle.c | 49 +- mono/metadata/w32handle.h | 6 +- mono/metadata/w32mutex-unix.c | 6 +- mono/metadata/w32mutex-win32.c | 6 +- mono/metadata/w32mutex.h | 4 + mono/metadata/w32process-unix-default.c | 89 +- .../metadata/w32process-unix.c.REMOVED.git-id | 2 +- mono/metadata/w32process-win32.c | 201 +- mono/metadata/w32process.c | 63 +- mono/metadata/w32process.h | 81 +- mono/metadata/w32semaphore-unix.c | 4 +- mono/metadata/w32semaphore-win32.c | 2 +- mono/metadata/w32semaphore.h | 5 +- mono/metadata/w32socket-unix.c | 8 +- mono/metadata/w32socket-win32.c | 4 +- mono/metadata/w32socket.c | 261 +- mono/metadata/w32socket.h | 47 +- mono/metadata/w32subset.h | 108 + mono/mini/Makefile.am | 43 +- mono/mini/Makefile.am.in | 43 +- mono/mini/Makefile.in.REMOVED.git-id | 2 +- mono/mini/abcremoval.c | 6 +- mono/mini/alias-analysis.c | 8 +- mono/mini/aot-compiler.c.REMOVED.git-id | 2 +- mono/mini/aot-runtime-wasm.c | 2 +- mono/mini/aot-runtime.c.REMOVED.git-id | 2 +- mono/mini/aot-runtime.h | 6 +- mono/mini/aot-tests.cs | 116 +- mono/mini/debugger-agent.c.REMOVED.git-id | 2 +- mono/mini/debugger-agent.h | 2 + mono/mini/debugger-engine.c | 1513 +++++++- mono/mini/debugger-engine.h | 104 +- mono/mini/debugger-state-machine.c | 410 +++ mono/mini/debugger-state-machine.h | 70 + mono/mini/decompose.c | 63 +- mono/mini/driver.c | 111 +- mono/mini/dwarfwriter.c | 37 +- mono/mini/ee.h | 4 +- mono/mini/exceptions-amd64.c | 53 +- mono/mini/exceptions-wasm.c | 10 +- mono/mini/exceptions-x86.c | 7 +- mono/mini/helpers.c | 4 +- mono/mini/image-writer.c | 30 +- mono/mini/interp-stubs.c | 2 +- mono/mini/interp/hacks.h | 75 - mono/mini/interp/interp-internals.h | 3 +- mono/mini/interp/interp.c.REMOVED.git-id | 2 +- mono/mini/interp/mintops.c | 2 +- mono/mini/interp/mintops.def | 27 +- mono/mini/interp/transform.c.REMOVED.git-id | 2 +- mono/mini/intrinsics.c | 12 +- mono/mini/ir-emit.h | 20 +- mono/mini/jit-icalls.c | 24 +- mono/mini/jit-icalls.h | 6 +- mono/mini/liveness.c | 67 +- mono/mini/local-propagation.c | 10 +- mono/mini/main.c | 17 +- mono/mini/memory-access.c | 45 +- mono/mini/method-to-ir.c.REMOVED.git-id | 2 +- mono/mini/mini-amd64.c.REMOVED.git-id | 2 +- mono/mini/mini-amd64.h | 30 +- mono/mini/mini-arm.c.REMOVED.git-id | 2 +- mono/mini/mini-arm64.c.REMOVED.git-id | 2 +- mono/mini/mini-codegen.c | 3 +- mono/mini/mini-exceptions.c.REMOVED.git-id | 2 +- mono/mini/mini-gc.c | 4 +- .../mini-generic-sharing.c.REMOVED.git-id | 2 +- mono/mini/mini-llvm.c.REMOVED.git-id | 2 +- mono/mini/mini-mips.c.REMOVED.git-id | 2 +- mono/mini/mini-native-types.c | 14 +- mono/mini/mini-posix.c | 286 +- mono/mini/mini-ppc.c.REMOVED.git-id | 2 +- mono/mini/mini-runtime.c.REMOVED.git-id | 2 +- mono/mini/mini-runtime.h | 53 +- mono/mini/mini-s390x.c.REMOVED.git-id | 2 +- mono/mini/mini-sparc.c.REMOVED.git-id | 2 +- mono/mini/mini-sparc.h | 2 +- mono/mini/mini-trampolines.c | 2 +- mono/mini/mini-wasm-debugger.c | 657 ++++ mono/mini/mini-wasm.c | 612 +--- mono/mini/mini-wasm.h | 4 + mono/mini/mini-windows.c | 18 +- mono/mini/mini-x86.c.REMOVED.git-id | 2 +- mono/mini/mini.c.REMOVED.git-id | 2 +- mono/mini/mini.h.REMOVED.git-id | 2 +- mono/mini/patch-info.h | 1 - mono/mini/simd-intrinsics.c | 227 +- mono/mini/trace.c | 16 +- mono/mini/tramp-amd64.c | 2 +- mono/mini/tramp-arm-gsharedvt.c | 14 +- mono/mini/tramp-arm.c | 71 +- mono/mini/tramp-arm64.c | 2 +- mono/mini/tramp-mips.c | 2 +- mono/mini/tramp-ppc.c | 4 +- mono/mini/tramp-s390x.c | 2 +- mono/mini/tramp-sparc.c | 2 +- mono/mini/tramp-wasm.c | 2 +- mono/mini/tramp-x86.c | 136 +- mono/mini/type-checking.c | 6 +- mono/mini/version.h | 2 +- mono/mini/wasm_m2n_invoke.g.h | 12 + mono/profiler/Makefile.in | 9 +- mono/profiler/aot.c | 4 +- mono/profiler/coverage.c | 13 +- mono/profiler/log-args.c | 2 +- mono/profiler/log.c.REMOVED.git-id | 2 +- mono/profiler/vtune.c | 2 +- mono/sgen/Makefile.am | 2 + mono/sgen/Makefile.in | 11 +- mono/sgen/sgen-cardtable.c | 20 + mono/sgen/sgen-cardtable.h | 5 + mono/sgen/sgen-conf.h | 18 +- mono/sgen/sgen-gc.c.REMOVED.git-id | 2 +- mono/sgen/sgen-protocol-def.h | 2 +- mono/tests/Makefile.am.REMOVED.git-id | 2 +- mono/tests/Makefile.in.REMOVED.git-id | 2 +- mono/tests/array-coop-1.cs | 31 + mono/tests/array-coop-2.cs | 272 ++ mono/tests/array-coop-bigvt.cs | 324 ++ mono/tests/array-coop-bigvt.sh | 29 + mono/tests/array-coop-int.cs | 310 ++ mono/tests/array-coop-int.sh | 15 + mono/tests/array-coop-smallvt.cs | 322 ++ mono/tests/array-coop-smallvt.sh | 27 + .../tests/assembly-load-reference/Makefile.in | 9 +- mono/tests/dynamic-method-churn.cs | 30 + mono/tests/exception18.cs | 6 +- mono/tests/gc-descriptors/Makefile.in | 9 +- mono/tests/generic-unmanaged-constraint.cs | 17 + mono/tests/install_eh_callback.cs | 84 +- mono/tests/libtest.c.REMOVED.git-id | 2 +- mono/tests/marshal2.cs | 3 +- mono/tests/pinvoke2.cs | 19 + mono/tests/sgen-toggleref.cs | 2 +- ...split-tailcall-interface-conservestack.cpp | 89 + .../tests/tailcall-interface-conservestack.il | 2207 ++++++------ mono/tests/tailcall-interface.cs | 198 +- mono/tests/tailcall-rgctxb-static.il | 4 +- .../fsharp-deeptail.il.REMOVED.git-id | 2 +- .../Seq.filter-length1.il.REMOVED.git-id | 1 + .../Seq.filter-length2.il.REMOVED.git-id | 1 + .../Seq.filter-length3.il.REMOVED.git-id | 1 + ...icTailCallLoop_DateTime_.il.REMOVED.git-id | 1 + .../StaticTailCallLoop_int_.il.REMOVED.git-id | 1 + ...eTime_.Method1_DateTime_.il.REMOVED.git-id | 1 + ..._DateTime_.Method1_byte_.il.REMOVED.git-id | 1 + ...s_DateTime_.Method1_int_.il.REMOVED.git-id | 1 + ...ateTime_.Method1_string_.il.REMOVED.git-id | 1 + ...ngeTime_.Method1_string_.il.REMOVED.git-id | 1 + ..._byte_.Method1_DateTime_.il.REMOVED.git-id | 1 + ...lass_byte_.Method1_byte_.il.REMOVED.git-id | 1 + ...Class_byte_.Method1_int_.il.REMOVED.git-id | 1 + ...ss_byte_.Method1_string_.il.REMOVED.git-id | 1 + ...s_int_.Method1_DateTime_.il.REMOVED.git-id | 1 + ...Class_int_.Method1_byte_.il.REMOVED.git-id | 1 + ...tClass_int_.Method1_int_.il.REMOVED.git-id | 1 + ...ass_int_.Method1_string_.il.REMOVED.git-id | 1 + ...tring_.Method1_DateTime_.il.REMOVED.git-id | 1 + ...ss_string_.Method1_byte_.il.REMOVED.git-id | 1 + ...ass_string_.Method1_int_.il.REMOVED.git-id | 1 + ...eTime_.Method1_DateTime_.il.REMOVED.git-id | 1 + ..._DateTime_.Method1_byte_.il.REMOVED.git-id | 1 + ...e_DateTime_.Method1_int_.il.REMOVED.git-id | 1 + ...ateTime_.Method1_string_.il.REMOVED.git-id | 1 + ...ngeTime_.Method1_string_.il.REMOVED.git-id | 1 + ..._byte_.Method1_DateTime_.il.REMOVED.git-id | 1 + ...face_byte_.Method1_byte_.il.REMOVED.git-id | 1 + ...rface_byte_.Method1_int_.il.REMOVED.git-id | 1 + ...ce_byte_.Method1_string_.il.REMOVED.git-id | 1 + ...e_int_.Method1_DateTime_.il.REMOVED.git-id | 1 + ...rface_int_.Method1_byte_.il.REMOVED.git-id | 1 + ...erface_int_.Method1_int_.il.REMOVED.git-id | 1 + ...ace_int_.Method1_string_.il.REMOVED.git-id | 1 + ...tring_.Method1_DateTime_.il.REMOVED.git-id | 1 + ...ce_string_.Method1_byte_.il.REMOVED.git-id | 1 + ...ace_string_.Method1_int_.il.REMOVED.git-id | 1 + ...eTime_.Method1_DateTime_.il.REMOVED.git-id | 1 + ..._DateTime_.Method1_byte_.il.REMOVED.git-id | 1 + ...d_DateTime_.Method1_int_.il.REMOVED.git-id | 1 + ...ateTime_.Method1_string_.il.REMOVED.git-id | 1 + ..._byte_.Method1_DateTime_.il.REMOVED.git-id | 1 + ...thod_byte_.Method1_byte_.il.REMOVED.git-id | 1 + ...ethod_byte_.Method1_int_.il.REMOVED.git-id | 1 + ...od_byte_.Method1_string_.il.REMOVED.git-id | 1 + ...d_int_.Method1_DateTime_.il.REMOVED.git-id | 1 + ...ethod_int_.Method1_byte_.il.REMOVED.git-id | 1 + ...Method_int_.Method1_int_.il.REMOVED.git-id | 1 + ...hod_int_.Method1_string_.il.REMOVED.git-id | 1 + ...tring_.Method1_DateTime_.il.REMOVED.git-id | 1 + ...od_string_.Method1_byte_.il.REMOVED.git-id | 1 + ...hod_string_.Method1_int_.il.REMOVED.git-id | 1 + ..._string_.Method1_string_.il.REMOVED.git-id | 1 + ...opGenericClass_DateTime_.il.REMOVED.git-id | 1 + ...allLoopGenericClass_int_.il.REMOVED.git-id | 1 + ...LoopGenericClass_string_.il.REMOVED.git-id | 1 + .../TailCallLoop_DateTime_.il.REMOVED.git-id | 1 + .../TailCallLoop_int_.il.REMOVED.git-id | 1 + .../mutualTail1IsEven.il.REMOVED.git-id | 1 + .../mutualTail1IsOdd.il.REMOVED.git-id | 1 + .../simpleTail1.il.REMOVED.git-id | 1 + .../simpleTail2.il.REMOVED.git-id | 1 + .../tailcall/interface-conservestack/1.il | 1191 +++++++ .../tailcall/interface-conservestack/10.il | 1191 +++++++ .../tailcall/interface-conservestack/11.il | 1191 +++++++ .../tailcall/interface-conservestack/12.il | 1191 +++++++ .../tailcall/interface-conservestack/13.il | 1191 +++++++ .../tailcall/interface-conservestack/14.il | 1191 +++++++ .../tailcall/interface-conservestack/15.il | 1191 +++++++ .../tailcall/interface-conservestack/16.il | 1193 +++++++ .../tailcall/interface-conservestack/17.il | 1193 +++++++ .../tailcall/interface-conservestack/18.il | 1193 +++++++ .../tailcall/interface-conservestack/19.il | 1193 +++++++ .../tailcall/interface-conservestack/2.il | 1191 +++++++ .../tailcall/interface-conservestack/20.il | 1193 +++++++ .../tailcall/interface-conservestack/21.il | 1193 +++++++ .../tailcall/interface-conservestack/22.il | 1194 +++++++ .../tailcall/interface-conservestack/23.il | 1193 +++++++ .../tailcall/interface-conservestack/24.il | 1193 +++++++ .../tailcall/interface-conservestack/25.il | 1193 +++++++ .../tailcall/interface-conservestack/26.il | 1193 +++++++ .../tailcall/interface-conservestack/27.il | 1193 +++++++ .../tailcall/interface-conservestack/28.il | 1193 +++++++ .../tailcall/interface-conservestack/29.il | 1193 +++++++ .../tailcall/interface-conservestack/3.il | 1192 +++++++ .../tailcall/interface-conservestack/30.il | 1193 +++++++ .../tailcall/interface-conservestack/31.il | 1193 +++++++ .../tailcall/interface-conservestack/32.il | 1193 +++++++ .../tailcall/interface-conservestack/33.il | 1193 +++++++ .../tailcall/interface-conservestack/34.il | 1193 +++++++ .../tailcall/interface-conservestack/35.il | 1193 +++++++ .../tailcall/interface-conservestack/36.il | 1193 +++++++ .../tailcall/interface-conservestack/37.il | 1193 +++++++ .../tailcall/interface-conservestack/38.il | 1193 +++++++ .../tailcall/interface-conservestack/39.il | 1193 +++++++ .../tailcall/interface-conservestack/4.il | 1191 +++++++ .../tailcall/interface-conservestack/40.il | 1193 +++++++ .../tailcall/interface-conservestack/41.il | 1193 +++++++ .../tailcall/interface-conservestack/42.il | 1193 +++++++ .../tailcall/interface-conservestack/43.il | 1193 +++++++ .../tailcall/interface-conservestack/44.il | 1193 +++++++ .../tailcall/interface-conservestack/45.il | 1193 +++++++ .../tailcall/interface-conservestack/46.il | 1193 +++++++ .../tailcall/interface-conservestack/47.il | 1193 +++++++ .../tailcall/interface-conservestack/48.il | 1193 +++++++ .../tailcall/interface-conservestack/49.il | 1193 +++++++ .../tailcall/interface-conservestack/5.il | 1191 +++++++ .../tailcall/interface-conservestack/50.il | 1193 +++++++ .../tailcall/interface-conservestack/51.il | 1193 +++++++ .../tailcall/interface-conservestack/52.il | 1193 +++++++ .../tailcall/interface-conservestack/53.il | 1185 +++++++ .../tailcall/interface-conservestack/6.il | 1191 +++++++ .../tailcall/interface-conservestack/7.il | 1191 +++++++ .../tailcall/interface-conservestack/8.il | 1191 +++++++ .../tailcall/interface-conservestack/9.il | 1191 +++++++ mono/tests/tailcall/split-fsharp.cpp | 175 + mono/tests/testing_gac/Makefile.in | 9 +- mono/tests/thread7.cs | 57 + mono/tests/verbose.cs | 157 + mono/unit-tests/Makefile.in | 27 +- mono/unit-tests/test-mono-callspec.c | 2 +- mono/utils/Makefile.am | 37 +- mono/utils/Makefile.in.REMOVED.git-id | 2 +- mono/utils/checked-build.c | 2 +- mono/utils/gc_wrapper.h | 4 +- mono/utils/jemalloc/Makefile.in | 11 +- mono/utils/lock-free-alloc.c | 2 + mono/utils/mono-codeman.c | 2 +- mono/utils/mono-compiler.h | 5 +- mono/utils/mono-conc-hashtable.c | 65 +- mono/utils/mono-coop-mutex.h | 14 + mono/utils/mono-dl.c | 11 +- mono/utils/mono-error-internals.h | 5 +- mono/utils/mono-error.c | 148 +- mono/utils/mono-error.h | 3 +- mono/utils/mono-flight-recorder.c | 153 + mono/utils/mono-flight-recorder.h | 66 + mono/utils/mono-internal-hash.c | 6 +- mono/utils/mono-internal-hash.h | 2 +- mono/utils/mono-log-flight-recorder.c | 225 ++ mono/utils/mono-logger-internals.h | 11 +- mono/utils/mono-logger.c | 29 +- mono/utils/mono-machine.h | 6 + mono/utils/mono-merp.c | 4 +- mono/utils/mono-mmap-windows.c | 103 +- mono/utils/mono-mmap.c | 40 + mono/utils/mono-mmap.h | 11 +- mono/utils/mono-os-wait-win32.c | 45 +- mono/utils/mono-proclib.c | 49 + mono/utils/mono-publib.h | 28 +- mono/utils/mono-rand-windows-internals.h | 37 - mono/utils/mono-rand-windows.c | 126 +- mono/utils/mono-rand.c | 122 +- mono/utils/mono-rand.h | 8 +- mono/utils/mono-state.c | 30 +- mono/utils/mono-state.h | 4 +- mono/utils/mono-threads-api.h | 10 +- mono/utils/mono-threads-coop.c | 167 +- mono/utils/mono-threads-coop.h | 17 + mono/utils/mono-threads-mach-helper.c | 13 +- mono/utils/mono-threads-mach.c | 10 +- mono/utils/mono-threads-posix.c | 2 +- mono/utils/mono-threads-state-machine.c | 45 +- mono/utils/mono-threads-wasm.c | 2 +- mono/utils/mono-threads-windows.c | 12 +- mono/utils/mono-threads.c | 239 +- mono/utils/mono-threads.h | 51 +- mono/utils/mono-time.h | 1 - mono/utils/mono-tls.c | 27 +- mono/utils/mono-tls.h | 4 - mono/utils/mono-utility-thread.c | 192 + mono/utils/mono-utility-thread.h | 58 + mono/utils/networking-posix.c | 2 +- mono/utils/strenc.h | 10 +- msvc/Makefile.in | 9 +- msvc/genmdesc.vcxproj | 4 +- msvc/libgc.vcxproj | 8 +- msvc/mono.props | 4 +- msvc/monoposixhelper.vcxproj | 8 +- msvc/winsetup.bat | 85 +- po/Makefile.in | 9 +- po/mcs/de.gmo | Bin 5406 -> 5406 bytes po/mcs/de.po.REMOVED.git-id | 2 +- po/mcs/es.gmo | Bin 16329 -> 16329 bytes po/mcs/es.po.REMOVED.git-id | 2 +- po/mcs/ja.gmo | Bin 20863 -> 20863 bytes po/mcs/ja.po.REMOVED.git-id | 2 +- po/mcs/mcs.pot | 310 +- po/mcs/pt_BR.gmo | Bin 72806 -> 72806 bytes po/mcs/pt_BR.po.REMOVED.git-id | 2 +- runtime/Makefile.in | 9 +- samples/Makefile.in | 9 +- scripts/Makefile.in | 9 +- scripts/submodules/versions.mk | 2 +- support/Makefile.in | 9 +- support/zlib-helper.c | 4 +- tools/Makefile.in | 9 +- tools/locale-builder/Makefile.in | 9 +- tools/monograph/Makefile.in | 13 +- tools/pedump/Makefile.in | 13 +- tools/sgen/Makefile.in | 9 +- winconfig.h | 50 +- 1547 files changed, 93792 insertions(+), 47893 deletions(-) create mode 100644 external/binary-reference-assemblies/build/monodroid/Mono.Android.dll create mode 100644 external/binary-reference-assemblies/build/monodroid/xa.pub create mode 100644 external/binary-reference-assemblies/src/monodroid/Mono.Android.cs rename external/corefx/src/{System.Security.Cryptography.Encoding => Common}/src/Internal/Cryptography/Helpers.cs (92%) delete mode 100644 external/xunit-binaries/HTML.xslt delete mode 100644 external/xunit-binaries/NUnitXml.xslt delete mode 100644 external/xunit-binaries/xUnit1.xslt create mode 100644 llvm/build.mk create mode 100755 llvm/build_llvm_config.sh delete mode 100755 mcs/build/gensources.sh rename mcs/build/platforms/{darwin.make => macos.make} (97%) create mode 100644 mcs/build/platforms/unix.make create mode 100644 mcs/class/I18N/EncodingTestBase.cs create mode 100644 mcs/class/Microsoft.CSharp/Microsoft.CSharp_xtest.dll.sources create mode 100644 mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.exclude.sources create mode 100644 mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.sources create mode 100644 mcs/class/Mono.Data.Sqlite/monodroid_Mono.Data.Sqlite_test.dll.sources create mode 100644 mcs/class/Mono.Posix/monodroid_Mono.Posix_test.dll.sources create mode 100644 mcs/class/Mono.Profiler.Log/Mono.Profiler.Log_xtest.dll.sources create mode 100644 mcs/class/Mono.Security.Win32/Mono.Security.Win32_test.dll.sources delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CertificateSelectionCallback.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CipherAlgorithmType.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/HashAlgorithmType.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/PrivateKeySelectionCallback.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SecurityCompressionType.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SecurityProtocolType.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslClientStream.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslServerStream.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslStreamBase.xml delete mode 100644 mcs/class/Mono.Security/Documentation/en/ns-Mono.Security.Protocol.Tls.xml delete mode 100644 mcs/class/Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs rename mcs/class/{System.ServiceModel/Mono.Security.Cryptography => Mono.Security/Mono.Security.Protocol.Tls}/MD5SHA1.cs (98%) create mode 100644 mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.build-failure-exclude.sources create mode 100644 mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.exclude.sources create mode 100644 mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.sources create mode 100644 mcs/class/System.ComponentModel.Composition.4.5/System.ComponentModel.Composition_xtest.dll.sources delete mode 100644 mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafePipeHandle.cs delete mode 100644 mcs/class/System.Core/ReferenceSources/SR.cs create mode 100644 mcs/class/System.Core/System.Core_xtest.dll.sources delete mode 100644 mcs/class/System.Core/System.IO.Pipes/AnonymousPipeClientStream.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.NotSupported.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.Unix.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.Windows.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.NotSupported.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.Unix.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.Windows.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.NotSupported.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.Unix.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.Windows.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/PipeAccessRule.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/PipeDirection.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/PipeInterfaces.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/PipeSecurity.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/PipeStream.NotSupported.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/PipeStreamImpersonationWorker.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/PipeTransmissionMode.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/PipeUnix.cs delete mode 100644 mcs/class/System.Core/System.IO.Pipes/PipeWin32.cs create mode 100644 mcs/class/System.Core/System.IO.Pipes/SafePipeHandle.NotSupported.cs create mode 100644 mcs/class/System.Core/System.Security.Cryptography.X509Certificates/DSACertificateExtensions.cs delete mode 100644 mcs/class/System.Core/System.Security.Cryptography/ECCurve.cs delete mode 100644 mcs/class/System.Core/System.Security.Cryptography/ECParameters.cs create mode 100644 mcs/class/System.Core/linux_net_4_x_System.Core.dll.sources create mode 100644 mcs/class/System.Core/macos_net_4_x_System.Core.dll.sources create mode 100644 mcs/class/System.Core/monodroid_System.Core_test.dll.exclude.sources create mode 100644 mcs/class/System.Core/monodroid_System.Core_test.dll.sources create mode 100644 mcs/class/System.Core/pipes_pns.sources create mode 100644 mcs/class/System.Core/testing_aot_full_System.Core_test.dll.exclude.sources create mode 100644 mcs/class/System.Core/testing_aot_full_System.Core_test.dll.sources create mode 100644 mcs/class/System.Core/unix_net_4_x_System.Core.dll.sources create mode 100644 mcs/class/System.Core/win32_net_4_x_System.Core.dll.sources delete mode 100644 mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/Expressions/GroupByExpression.cs delete mode 100644 mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/Expressions/ScopeExpression.cs delete mode 100644 mcs/class/System.Data.Linq/src/DbLinq/System.Data.Linq/EntitySet.cs delete mode 100644 mcs/class/System.Data.Linq/src/DbLinq/Util/CacheChecker.cs delete mode 100644 mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/AbstractCodeDomGenerator.cs delete mode 100644 mcs/class/System.Data.Linq/src/DbMetal/Schema/SchemaPostprocess.cs delete mode 100644 mcs/class/System.Data.Linq/src/DbMetal/Util/TableSorter.cs create mode 100644 mcs/class/System.Data/System.Data_xtest.dll.sources rename mcs/class/System.Data/{darwin_net_4_x_System.Data.dll.sources => macos_net_4_x_System.Data.dll.sources} (100%) create mode 100644 mcs/class/System.Data/unix_net_4_x_System.Data.dll.sources create mode 100644 mcs/class/System.Drawing/System.Drawing_xtest.dll.sources create mode 100644 mcs/class/System.Drawing/netstandard.sources create mode 100644 mcs/class/System.IdentityModel/monodroid_System.IdentityModel_test.dll.exclude.sources create mode 100644 mcs/class/System.Json/System.Json_xtest.dll.sources create mode 100644 mcs/class/System.Numerics/System.Numerics_xtest.dll.sources create mode 100644 mcs/class/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe_xtest.dll.sources create mode 100644 mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_xtest.dll.sources delete mode 100644 mcs/class/System.Security/Mono.Security.Cryptography/NativeDapiProtection.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/AlgorithmIdentifier.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipient.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipientCollection.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsSigner.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/ContentInfo.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyAgreeRecipientInfo.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyTransRecipientInfo.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9Attribute.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9ContentType.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescription.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentName.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9MessageDigest.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9SigningTime.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/PublicKeyInfo.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfo.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoCollection.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoEnumerator.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoType.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedCms.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfo.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoCollection.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifier.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography/DataProtectionScope.cs create mode 100644 mcs/class/System.Security/System.Security_xtest.dll.sources delete mode 100644 mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/AlgorithmIdentifierTest.cs delete mode 100644 mcs/class/System.Security/corefx/SR.cs create mode 100644 mcs/class/System.Security/monodroid_System.Security_test.dll.exclude.sources create mode 100644 mcs/class/System.Security/monotouch_System.Security_test.dll.exclude.sources create mode 100644 mcs/class/System.Security/win32_System.Security.dll.exclude.sources create mode 100644 mcs/class/System.Security/win32_System.Security.dll.sources create mode 100644 mcs/class/System.Security/winaot_System.Security.dll.exclude.sources create mode 100644 mcs/class/System.Security/winaot_System.Security.dll.sources delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateSelectionCallback.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback2.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CipherAlgorithmType.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/HashAlgorithmType.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/PrivateKeySelectionCallback.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SecurityCompressionType.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SecurityProtocolType.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslClientStream.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslServerStream.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslStreamBase.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/ValidationResult.xml delete mode 100644 mcs/class/System.ServiceModel/Documentation/en/ns-Mono.Security.Protocol.Tls.xml delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Cryptography/TlsHMAC.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/Alert.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuite.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientContext.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientSessionCache.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ContentType.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/Context.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/DebugHelper.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HandshakeState.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HashAlgorithmType.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HttpsClientStream.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RecordProtocol.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityCompressionType.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityParameters.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityProtocolType.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ServerContext.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslCipherSuite.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslClientStream.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslHandshakeHash.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslServerStream.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslStreamBase.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsCipherSuite.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsClientSettings.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsException.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsServerSettings.cs delete mode 100644 mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsStream.cs delete mode 100755 mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SpnegoSecurityTokenAuthenticator.cs delete mode 100755 mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SpnegoSecurityTokenProvider.cs delete mode 100644 mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SslSecurityTokenAuthenticator.cs delete mode 100644 mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SslSecurityTokenProvider.cs delete mode 100644 mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/TlsClientSession.cs delete mode 100644 mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/TlsServerSession.cs delete mode 100644 mcs/class/System.ServiceModel/Test/System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs delete mode 100644 mcs/class/System.ServiceModel/Test/System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs create mode 100644 mcs/class/System.ServiceModel/monodroid_System.ServiceModel_test.dll.exclude.sources create mode 100644 mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.exclude.sources create mode 100644 mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.sources create mode 100644 mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel_test.dll.exclude.sources create mode 100644 mcs/class/System.Threading.Tasks.Dataflow/System.Threading.Tasks.Dataflow_xtest.dll.sources create mode 100644 mcs/class/System.Web.Services/monodroid_System.Web.Services_test.dll.exclude.sources create mode 100644 mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.exclude.sources create mode 100644 mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.sources create mode 100644 mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services_test.dll.exclude.sources create mode 100644 mcs/class/System.XML/System.Xml_xtest.dll.sources create mode 100644 mcs/class/System.XML/common.sources create mode 100644 mcs/class/System.XML/corefx/SR.cs.REMOVED.git-id create mode 100644 mcs/class/System.Xml.Linq/System.Xml.Linq_xtest.dll.sources create mode 100644 mcs/class/System/Internal.Cryptography/OidLookup.Managed.cs delete mode 100644 mcs/class/System/Mono.AppleTls/Certificate.cs delete mode 100644 mcs/class/System/Mono.AppleTls/Items.cs create mode 100644 mcs/class/System/Mono.AppleTls/MonoCertificatePal.Mobile.cs rename mcs/class/System/Mono.AppleTls/{ImportExport.cs => MonoCertificatePal.OSX.cs} (61%) create mode 100644 mcs/class/System/Mono.AppleTls/MonoCertificatePal.cs create mode 100644 mcs/class/System/Mono.AppleTls/SafeHandles.Mono.cs rename mcs/class/{System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/VisualBasicCodeDomGenerator.cs => System/Mono.AppleTls/SafeHandles.cs} (50%) rename mcs/class/{corlib/System.Security.Cryptography.X509Certificates => System/Mono.AppleTls}/X509CertificateImplApple.cs (51%) rename mcs/class/{System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/CSharpCodeDomGenerator.cs => System/Mono.AppleTls/X509PalImpl.Apple.cs} (53%) create mode 100644 mcs/class/System/Mono.Btls/X509PalImpl.Btls.cs create mode 100644 mcs/class/System/Mono/SystemCertificateProvider.cs create mode 100644 mcs/class/System/Mono/SystemDependencyProvider.cs rename mcs/class/{corlib/System.Security.Cryptography.X509Certificates/INativeCertificateHelper.cs => System/Mono/X509Pal.cs} (75%) rename mcs/class/{System.Core/System.IO.Pipes/PipeAccessRights.cs => System/Mono/X509PalImpl.Mono.cs} (56%) create mode 100644 mcs/class/System/Mono/X509PalImpl.cs delete mode 100644 mcs/class/System/ReferenceSources/CAPI.cs delete mode 100644 mcs/class/System/ReferenceSources/SR.cs.REMOVED.git-id rename mcs/class/{System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs => System/System.Net.NetworkInformation/IPGlobalPropertiesFactory.cs} (58%) delete mode 100644 mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/LinuxIPInterfaceProperties.cs rename mcs/class/{System.Core/System.IO.Pipes/PipeAuditRule.cs => System/System.Net.NetworkInformation/LinuxIPv4InterfaceProperties.cs} (51%) rename mcs/class/System/System.Net.NetworkInformation/{IPv4InterfaceStatistics.cs => LinuxIPv4InterfaceStatistics.cs} (56%) create mode 100644 mcs/class/System/System.Net.NetworkInformation/LinuxNetworkInterface.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/LinuxUnicastIPAddressInformation.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/MacOsIPInterfaceProperties.cs rename mcs/class/{corlib/System/AssemblyLoadEventArgs.cs => System/System.Net.NetworkInformation/MacOsIPv4InterfaceProperties.cs} (64%) create mode 100644 mcs/class/System/System.Net.NetworkInformation/MacOsIPv4InterfaceStatistics.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterface.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/NetworkInterfaceFactory.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/UnixIPGlobalProperties.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/UnixIPGlobalStatistics.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/UnixIPInterfaceProperties.cs rename mcs/class/{System.Security/System.Security.Cryptography.Pkcs/CmsRecipientEnumerator.cs => System/System.Net.NetworkInformation/UnixIPv4InterfaceProperties.cs} (52%) create mode 100644 mcs/class/System/System.Net.NetworkInformation/UnixIcmpV4Statistics.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/UnixIcmpV6Statistics.cs create mode 100644 mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterface.cs rename mcs/class/{corlib/System/ResolveEventArgs.cs => System/System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs} (56%) create mode 100644 mcs/class/System/System.Net.NetworkInformation/UnixTcpStatistics.cs rename mcs/class/System/System.Net.NetworkInformation/{UdpStatistics.cs => UnixUdpStatistics.cs} (73%) rename mcs/class/System/System.Net.NetworkInformation/{IPAddressCollection.cs => Win32IPAddressCollection.cs} (97%) rename mcs/class/System/System.Net.NetworkInformation/{IPGlobalProperties.cs => Win32IPGlobalProperties.cs} (54%) rename mcs/class/System/System.Net.NetworkInformation/{IPGlobalStatistics.cs => Win32IPGlobalStatistics.cs} (63%) create mode 100644 mcs/class/System/System.Net.NetworkInformation/Win32IPInterfaceProperties.cs rename mcs/class/System/System.Net.NetworkInformation/{IPv4InterfaceProperties.cs => Win32IPv4InterfaceProperties.cs} (62%) create mode 100644 mcs/class/System/System.Net.NetworkInformation/Win32IPv4InterfaceStatistics.cs rename mcs/class/System/System.Net.NetworkInformation/{IPv6InterfaceProperties.cs => Win32IPv6InterfaceProperties.cs} (99%) rename mcs/class/System/System.Net.NetworkInformation/{IcmpV4Statistics.cs => Win32IcmpV4Statistics.cs} (61%) rename mcs/class/System/System.Net.NetworkInformation/{IcmpV6Statistics.cs => Win32IcmpV6Statistics.cs} (64%) create mode 100644 mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterface.cs rename mcs/class/{corlib/System.Reflection/PortableExecutableKinds.cs => System/System.Net.NetworkInformation/Win32NetworkInterfaceFactory.cs} (60%) rename mcs/class/System/System.Net.NetworkInformation/{TcpStatistics.cs => Win32TcpStatistics.cs} (66%) rename mcs/class/{System.Security/System.Security.Cryptography.Pkcs/SignerInfoEnumerator.cs => System/System.Net.NetworkInformation/Win32UdpStatistics.cs} (53%) rename mcs/class/System/System.Net.NetworkInformation/{UnicastIPAddressInformation.cs => Win32UnicastIPAddressInformation.cs} (71%) rename mcs/class/{corlib/System.Reflection/ImageFileMachine.cs => System/System.Net.NetworkInformation/Win32UnixFactoryPal.cs} (62%) delete mode 100644 mcs/class/System/System.Security.Cryptography/AsnEncodedDataCollection.cs delete mode 100644 mcs/class/System/System.Security.Cryptography/AsnEncodedDataEnumerator.cs create mode 100644 mcs/class/System/System_xtest.dll.sources create mode 100644 mcs/class/System/appletls.sources delete mode 100644 mcs/class/System/corefx/SR.cs delete mode 100644 mcs/class/System/corefx/SR.missing.cs create mode 100644 mcs/class/System/corefx/Unix/Interop.Read.cs create mode 100644 mcs/class/System/corefx/Unix/Interop.cs create mode 100644 mcs/class/System/linux_networkinfo.sources rename mcs/class/System/{darwin_net_4_x_System.dll.sources => macos_net_4_x_System.dll.sources} (86%) create mode 100644 mcs/class/System/macos_networkinfo.sources create mode 100644 mcs/class/System/monodroid_System_test.dll.exclude.sources create mode 100644 mcs/class/System/monodroid_System_test.dll.sources create mode 100644 mcs/class/System/monotouch_System_test.dll.exclude.sources create mode 100644 mcs/class/System/testing_aot_full_System_test.dll.exclude.sources create mode 100644 mcs/class/System/testing_aot_full_System_test.dll.sources create mode 100644 mcs/class/System/testing_aot_hybrid_System_test.dll.exclude.sources create mode 100644 mcs/class/System/unix_net_4_x_System.dll.sources create mode 100644 mcs/class/System/unix_networkinfo.sources create mode 100644 mcs/class/System/wasm_System_test.dll.exclude.sources create mode 100644 mcs/class/System/win32_net_4_x_System.dll.exclude.sources create mode 100644 mcs/class/System/win32_networkinfo.sources create mode 100644 mcs/class/System/winaot_System.dll.exclude.sources create mode 100755 mcs/class/System/winaot_System_test.dll.exclude.sources rename mcs/class/{System.Core/System.IO.Pipes/PipeOptions.cs => corlib/Mono/CertificateImportFlags.cs} (81%) create mode 100644 mcs/class/corlib/Mono/DependencyInjector.cs create mode 100644 mcs/class/corlib/Mono/ISystemCertificateProvider.cs create mode 100644 mcs/class/corlib/Mono/ISystemDependencyProvider.cs delete mode 100644 mcs/class/corlib/ReferenceSources/ParseNumbers.cs create mode 100644 mcs/class/corlib/ReferenceSources/SR.cs.REMOVED.git-id rename mcs/class/{System => corlib}/ReferenceSources/SR2.cs (100%) rename mcs/class/{System.Core/System.Security.Cryptography/ECPoint.cs => corlib/System.Diagnostics/Debug.cs} (53%) delete mode 100644 mcs/class/corlib/System.IO/FileAttributes.cs delete mode 100644 mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs delete mode 100644 mcs/class/corlib/System.Runtime.InteropServices/RegistrationConnectionType.cs delete mode 100644 mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate20.cs delete mode 100644 mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplMono.cs delete mode 100644 mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs delete mode 100644 mcs/class/corlib/System.Security.Policy/Publisher.cs delete mode 100644 mcs/class/corlib/System.Security.Policy/PublisherMembershipCondition.cs delete mode 100644 mcs/class/corlib/System/AssemblyLoadEventHandler.cs delete mode 100644 mcs/class/corlib/System/OperatingSystem.cs delete mode 100644 mcs/class/corlib/System/ResolveEventHandler.cs delete mode 100644 mcs/class/corlib/System/StringComparison.cs delete mode 100644 mcs/class/corlib/System/TypeCode.cs delete mode 100644 mcs/class/corlib/System/Void.cs delete mode 100644 mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs delete mode 100644 mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs create mode 100644 mcs/class/corlib/corefx/Interop.GetRandomBytes.Mono.cs create mode 100644 mcs/class/corlib/corefx/Mono.SafePasswordHandle.Unix.cs create mode 100644 mcs/class/corlib/corefx/Mono.SafePasswordHandle.Windows.cs create mode 100644 mcs/class/corlib/corefx/SR.missing.cs create mode 100644 mcs/class/corlib/corefx/TimeSpanParse.cs delete mode 100644 mcs/class/corlib/corert/Debug.cs create mode 100644 mcs/class/corlib/corert/Decimal.DecCalc.cs.REMOVED.git-id create mode 100644 mcs/class/corlib/corert/Decimal.cs.REMOVED.git-id create mode 100644 mcs/class/corlib/corert/RuntimeImports.cs delete mode 100644 mcs/class/corlib/corlib.dll.sources create mode 100644 mcs/class/corlib/corlib.dll.sources.REMOVED.git-id create mode 100644 mcs/class/corlib/corlib_xtest.dll.sources create mode 100644 mcs/class/corlib/linux_net_4_x_corlib.dll.exclude.sources create mode 100644 mcs/class/corlib/macos_net_4_x_corlib.dll.exclude.sources create mode 100644 mcs/class/corlib/macos_net_4_x_corlib.dll.sources create mode 100644 mcs/class/corlib/monodroid_corlib_test.dll.exclude.sources create mode 100644 mcs/class/corlib/monodroid_corlib_test.dll.sources create mode 100644 mcs/class/corlib/monotouch_corlib_test.dll.exclude.sources create mode 100644 mcs/class/corlib/orbis_corlib_test.dll.exclude.sources create mode 100644 mcs/class/corlib/orbis_corlib_test.dll.sources create mode 100644 mcs/class/corlib/testing_aot_full_corlib_test.dll.exclude.sources create mode 100644 mcs/class/corlib/testing_aot_full_corlib_test.dll.sources create mode 100644 mcs/class/corlib/testing_aot_hybrid_corlib_test.dll.exclude.sources create mode 100644 mcs/class/corlib/unix_net_4_x_corlib.dll.exclude.sources rename mcs/class/corlib/{darwin_net_4_x_corlib.dll.sources => unix_net_4_x_corlib.dll.sources} (100%) create mode 100644 mcs/class/corlib/wasm_corlib_test.dll.exclude.sources create mode 100644 mcs/class/corlib/wasm_corlib_test.dll.sources create mode 100644 mcs/class/corlib/winaot_corlib_test.dll.exclude.sources create mode 100755 mcs/class/corlib/winaot_corlib_test.dll.sources rename mcs/class/corlib/{darwin_xammac_net_4_5_corlib.dll.exclude.sources => xammac_net_4_5_corlib.dll.exclude.sources} (100%) delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/Mono.Cecil.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/Mono.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/System.Configuration.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/System.Core.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/System.Numerics.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/System.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/System.Xml.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/System.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/mcs.exe.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051600011/mscorlib.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/Mono.Cecil.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/Mono.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/System.Configuration.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/System.Core.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/System.Numerics.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/System.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/System.Xml.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/System.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/mcs.exe.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051600011/mscorlib.dll.REMOVED.git-id rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Collections.Concurrent.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Collections.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Diagnostics.Debug.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Diagnostics.FileVersionInfo.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Diagnostics.Tools.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Dynamic.Runtime.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Globalization.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.IO.FileSystem.Primitives.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.IO.FileSystem.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.IO.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Linq.Expressions.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Linq.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Reflection.Extensions.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Reflection.Primitives.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Reflection.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Resources.ResourceManager.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.Extensions.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.InteropServices.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.Numerics.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Security.Cryptography.Algorithms.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Security.Cryptography.Primitives.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Text.Encoding.CodePages.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Text.Encoding.Extensions.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Text.Encoding.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Threading.Tasks.Parallel.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Threading.Tasks.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Threading.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.ValueTuple.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Xml.ReaderWriter.dll (100%) rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Xml.XDocument.dll (100%) create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id rename mcs/class/lib/{monolite-win32/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/System.IO.Compression.dll (75%) create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Numerics.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Security.dll.REMOVED.git-id rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/System.Xml.Linq.dll.REMOVED.git-id (100%) create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mcs.exe.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mscorlib.dll.REMOVED.git-id rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Collections.Concurrent.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Collections.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Diagnostics.Debug.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Diagnostics.FileVersionInfo.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Diagnostics.Tools.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Dynamic.Runtime.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Globalization.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.IO.FileSystem.Primitives.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.IO.FileSystem.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.IO.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Linq.Expressions.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Linq.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Reflection.Extensions.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Reflection.Primitives.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Reflection.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Resources.ResourceManager.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.Extensions.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.InteropServices.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.Numerics.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Security.Cryptography.Algorithms.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Security.Cryptography.Primitives.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Text.Encoding.CodePages.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Text.Encoding.Extensions.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Text.Encoding.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Threading.Tasks.Parallel.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Threading.Tasks.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Threading.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.ValueTuple.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Xml.ReaderWriter.dll (100%) rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Xml.XDocument.dll (100%) create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id rename mcs/class/lib/{monolite-darwin/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/System.IO.Compression.dll (75%) create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Numerics.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Security.dll.REMOVED.git-id rename mcs/class/lib/{monolite-linux/1051600011 => monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/System.Xml.Linq.dll.REMOVED.git-id (100%) create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mcs.exe.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-macos/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mscorlib.dll.REMOVED.git-id rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Collections.Concurrent.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Collections.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Diagnostics.Debug.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Diagnostics.FileVersionInfo.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Diagnostics.Tools.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Dynamic.Runtime.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Globalization.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.IO.FileSystem.Primitives.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.IO.FileSystem.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.IO.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Linq.Expressions.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Linq.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Reflection.Extensions.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Reflection.Primitives.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Reflection.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Resources.ResourceManager.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.Extensions.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.InteropServices.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.Numerics.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Runtime.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Security.Cryptography.Algorithms.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Security.Cryptography.Primitives.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Text.Encoding.CodePages.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Text.Encoding.Extensions.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Text.Encoding.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Threading.Tasks.Parallel.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Threading.Tasks.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Threading.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.ValueTuple.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Xml.ReaderWriter.dll (100%) rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/Facades/System.Xml.XDocument.dll (100%) create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id rename mcs/class/lib/{monolite-linux/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/System.IO.Compression.dll (75%) create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Numerics.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Security.dll.REMOVED.git-id rename mcs/class/lib/{monolite-win32/1051600011 => monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0}/System.Xml.Linq.dll.REMOVED.git-id (100%) create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mcs.exe.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-unix/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mscorlib.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/Mono.Cecil.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/Mono.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/System.Configuration.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/System.Core.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/System.Numerics.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/System.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/System.Xml.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/System.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/mcs.exe.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051600011/mscorlib.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Collections.Concurrent.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Collections.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Debug.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.FileVersionInfo.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Tools.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Dynamic.Runtime.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Globalization.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.Primitives.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Linq.Expressions.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Linq.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Extensions.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Primitives.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Resources.ResourceManager.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.Extensions.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.InteropServices.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.Numerics.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Algorithms.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Primitives.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.CodePages.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.Extensions.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.Parallel.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.ValueTuple.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Xml.ReaderWriter.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Xml.XDocument.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.IO.Compression.dll create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Numerics.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Security.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.Linq.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mcs.exe.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mscorlib.dll.REMOVED.git-id create mode 100644 mcs/class/test-helpers/AdminHelper.cs create mode 100644 mcs/class/test-helpers/Configuration.Http.cs create mode 100644 mcs/class/test-helpers/NunitHelpers.cs create mode 100644 mcs/class/test-helpers/PlatformDetection.cs create mode 100644 mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs create mode 100644 mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs create mode 100644 mcs/errors/cs0280.cs create mode 100644 mcs/errors/cs1611-2.cs create mode 100644 mcs/errors/cs1644-63.cs create mode 100644 mcs/errors/cs1644-64.cs create mode 100644 mcs/errors/cs1644-65.cs create mode 100644 mcs/errors/cs1644-66.cs rename mcs/errors/{cs0428-2.cs => cs8385-2.cs} (50%) rename mcs/errors/{cs0213-2.cs => cs8385.cs} (54%) create mode 100644 mcs/tests/test-fixed-01.cs create mode 100644 mcs/tools/mono-api-diff/Makefile create mode 100644 mcs/tools/mono-api-diff/mono-api-diff.cs create mode 100644 mcs/tools/mono-api-diff/mono-api-diff.exe.sources delete mode 100644 mono/metadata/decimal-ms.c delete mode 100644 mono/metadata/decimal-ms.h create mode 100644 mono/metadata/environment-internal.h create mode 100644 mono/metadata/icalls.h delete mode 100644 mono/metadata/number-ms.c create mode 100644 mono/metadata/pal-icalls.c create mode 100644 mono/metadata/pal-icalls.h create mode 100644 mono/metadata/w32subset.h create mode 100644 mono/mini/debugger-state-machine.c create mode 100644 mono/mini/debugger-state-machine.h create mode 100644 mono/mini/mini-wasm-debugger.c create mode 100644 mono/tests/array-coop-1.cs create mode 100644 mono/tests/array-coop-2.cs create mode 100644 mono/tests/array-coop-bigvt.cs create mode 100755 mono/tests/array-coop-bigvt.sh create mode 100644 mono/tests/array-coop-int.cs create mode 100755 mono/tests/array-coop-int.sh create mode 100644 mono/tests/array-coop-smallvt.cs create mode 100755 mono/tests/array-coop-smallvt.sh create mode 100644 mono/tests/dynamic-method-churn.cs create mode 100644 mono/tests/generic-unmanaged-constraint.cs create mode 100644 mono/tests/split-tailcall-interface-conservestack.cpp create mode 100644 mono/tests/tailcall/fsharp-deeptail/Seq.filter-length1.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/Seq.filter-length2.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/Seq.filter-length3.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/StaticTailCallLoop_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/StaticTailCallLoop_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DatstringeTime_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DatstringeTime_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_byte_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_string_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoop_DateTime_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/TailCallLoop_int_.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/mutualTail1IsEven.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/mutualTail1IsOdd.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/simpleTail1.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/fsharp-deeptail/simpleTail2.il.REMOVED.git-id create mode 100644 mono/tests/tailcall/interface-conservestack/1.il create mode 100644 mono/tests/tailcall/interface-conservestack/10.il create mode 100644 mono/tests/tailcall/interface-conservestack/11.il create mode 100644 mono/tests/tailcall/interface-conservestack/12.il create mode 100644 mono/tests/tailcall/interface-conservestack/13.il create mode 100644 mono/tests/tailcall/interface-conservestack/14.il create mode 100644 mono/tests/tailcall/interface-conservestack/15.il create mode 100644 mono/tests/tailcall/interface-conservestack/16.il create mode 100644 mono/tests/tailcall/interface-conservestack/17.il create mode 100644 mono/tests/tailcall/interface-conservestack/18.il create mode 100644 mono/tests/tailcall/interface-conservestack/19.il create mode 100644 mono/tests/tailcall/interface-conservestack/2.il create mode 100644 mono/tests/tailcall/interface-conservestack/20.il create mode 100644 mono/tests/tailcall/interface-conservestack/21.il create mode 100644 mono/tests/tailcall/interface-conservestack/22.il create mode 100644 mono/tests/tailcall/interface-conservestack/23.il create mode 100644 mono/tests/tailcall/interface-conservestack/24.il create mode 100644 mono/tests/tailcall/interface-conservestack/25.il create mode 100644 mono/tests/tailcall/interface-conservestack/26.il create mode 100644 mono/tests/tailcall/interface-conservestack/27.il create mode 100644 mono/tests/tailcall/interface-conservestack/28.il create mode 100644 mono/tests/tailcall/interface-conservestack/29.il create mode 100644 mono/tests/tailcall/interface-conservestack/3.il create mode 100644 mono/tests/tailcall/interface-conservestack/30.il create mode 100644 mono/tests/tailcall/interface-conservestack/31.il create mode 100644 mono/tests/tailcall/interface-conservestack/32.il create mode 100644 mono/tests/tailcall/interface-conservestack/33.il create mode 100644 mono/tests/tailcall/interface-conservestack/34.il create mode 100644 mono/tests/tailcall/interface-conservestack/35.il create mode 100644 mono/tests/tailcall/interface-conservestack/36.il create mode 100644 mono/tests/tailcall/interface-conservestack/37.il create mode 100644 mono/tests/tailcall/interface-conservestack/38.il create mode 100644 mono/tests/tailcall/interface-conservestack/39.il create mode 100644 mono/tests/tailcall/interface-conservestack/4.il create mode 100644 mono/tests/tailcall/interface-conservestack/40.il create mode 100644 mono/tests/tailcall/interface-conservestack/41.il create mode 100644 mono/tests/tailcall/interface-conservestack/42.il create mode 100644 mono/tests/tailcall/interface-conservestack/43.il create mode 100644 mono/tests/tailcall/interface-conservestack/44.il create mode 100644 mono/tests/tailcall/interface-conservestack/45.il create mode 100644 mono/tests/tailcall/interface-conservestack/46.il create mode 100644 mono/tests/tailcall/interface-conservestack/47.il create mode 100644 mono/tests/tailcall/interface-conservestack/48.il create mode 100644 mono/tests/tailcall/interface-conservestack/49.il create mode 100644 mono/tests/tailcall/interface-conservestack/5.il create mode 100644 mono/tests/tailcall/interface-conservestack/50.il create mode 100644 mono/tests/tailcall/interface-conservestack/51.il create mode 100644 mono/tests/tailcall/interface-conservestack/52.il create mode 100644 mono/tests/tailcall/interface-conservestack/53.il create mode 100644 mono/tests/tailcall/interface-conservestack/6.il create mode 100644 mono/tests/tailcall/interface-conservestack/7.il create mode 100644 mono/tests/tailcall/interface-conservestack/8.il create mode 100644 mono/tests/tailcall/interface-conservestack/9.il create mode 100644 mono/tests/tailcall/split-fsharp.cpp create mode 100644 mono/tests/thread7.cs create mode 100644 mono/tests/verbose.cs create mode 100644 mono/utils/mono-flight-recorder.c create mode 100644 mono/utils/mono-flight-recorder.h create mode 100644 mono/utils/mono-log-flight-recorder.c delete mode 100644 mono/utils/mono-rand-windows-internals.h create mode 100644 mono/utils/mono-utility-thread.c create mode 100644 mono/utils/mono-utility-thread.h diff --git a/Makefile.am b/Makefile.am index ea975d1a06..9f89c00e92 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,9 +11,9 @@ else tools_dir = tools endif -SUBDIRS = mk po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm +SUBDIRS = mk po $(libgc_dir) llvm mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests # Keep in sync with SUBDIRS -DIST_SUBDIRS = m4 mk po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm +DIST_SUBDIRS = m4 mk po $(libgc_dir) llvm mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests all: update_submodules @@ -126,6 +126,7 @@ package-inputs: (echo " "; \ read boot; echo " $$boot"; \ read flags; echo " $$flags"; \ + read sources;echo " $$sources"; \ read output; echo " $$output"; \ read built; echo " `echo $$built | sed 's/\\\/\\\\/g'`"; \ read libou; echo " $$libou"; \ @@ -144,7 +145,7 @@ update-llvm-version: update-solution-files: - (pushd msvc/scripts; rm genproj.exe; $(MAKE) genproj.exe; popd) + cd msvc/scripts && $(MAKE) genproj.exe || exit $$?; $(MAKE) update-csproj $(MAKE) package-inputs (cd msvc/scripts; mono --debug genproj.exe $(GENPROJ_ARGS)) diff --git a/Makefile.in b/Makefile.in index c6edb2fed3..9decb75180 100644 --- a/Makefile.in +++ b/Makefile.in @@ -236,6 +236,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -251,6 +253,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -291,11 +294,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ @@ -438,9 +437,9 @@ MONOTOUCH_SUBDIRS = $(libgc_dir) mono # Some tools might not build when cross-compiling @CROSS_COMPILING_TRUE@tools_dir = -SUBDIRS = mk po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm +SUBDIRS = mk po $(libgc_dir) llvm mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests # Keep in sync with SUBDIRS -DIST_SUBDIRS = m4 mk po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm +DIST_SUBDIRS = m4 mk po $(libgc_dir) llvm mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests SUBMODULE_ERROR = 'Could not recursively update all git submodules. You may experience compilation problems if some submodules are out of date' EXTRA_DIST = \ README.md \ @@ -1030,6 +1029,7 @@ package-inputs: (echo " "; \ read boot; echo " $$boot"; \ read flags; echo " $$flags"; \ + read sources;echo " $$sources"; \ read output; echo " $$output"; \ read built; echo " `echo $$built | sed 's/\\\/\\\\/g'`"; \ read libou; echo " $$libou"; \ @@ -1047,7 +1047,7 @@ update-llvm-version: REV=`$(LLVM_DIR)/bin/llvm-config --version` && sed -e "s,expected_llvm_version=.*,expected_llvm_version=\"$$REV\"," < configure.ac > tmp && mv tmp configure.ac && echo "Version set to $$REV." update-solution-files: - (pushd msvc/scripts; rm genproj.exe; $(MAKE) genproj.exe; popd) + cd msvc/scripts && $(MAKE) genproj.exe || exit $$?; $(MAKE) update-csproj $(MAKE) package-inputs (cd msvc/scripts; mono --debug genproj.exe $(GENPROJ_ARGS)) diff --git a/README.md b/README.md index 959520b20e..6e3c09568b 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.or | Windows | i386 | [![windows-i386][17]][18] | | CentOS | s390x (cs) | [![centos-s390x][19]][20] | | Debian 9 | ppc64el (cs) | [![debian-9-ppc64el][21]][22]| +| AIX | ppc64 (cs) | [![aix-ppc64][23]][24] | _(cs) = community supported architecture_ @@ -55,6 +56,8 @@ _(cs) = community supported architecture_ [20]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x [21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el/badge/icon [22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el +[23]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64/badge/icon +[24]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64 Compilation and Installation ============================ diff --git a/acceptance-tests/Makefile.in.REMOVED.git-id b/acceptance-tests/Makefile.in.REMOVED.git-id index e21510ded0..fd60c4b6ae 100644 --- a/acceptance-tests/Makefile.in.REMOVED.git-id +++ b/acceptance-tests/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -547201804efe0b3764dea8e1818b1aa0728bd1dc \ No newline at end of file +185fb4f08d318b39e998de65aba693189afa76a0 \ No newline at end of file diff --git a/acceptance-tests/coreclr.mk.REMOVED.git-id b/acceptance-tests/coreclr.mk.REMOVED.git-id index 5d17985546..b0809b57c9 100644 --- a/acceptance-tests/coreclr.mk.REMOVED.git-id +++ b/acceptance-tests/coreclr.mk.REMOVED.git-id @@ -1 +1 @@ -df7c4e44217ae3f66ca522f7795d474bcb95050d \ No newline at end of file +51dbbe569e45412d294d6d996ba1a802f3f87374 \ No newline at end of file diff --git a/config.h.in b/config.h.in index cf3e3e7c37..c7e45e48cc 100644 --- a/config.h.in +++ b/config.h.in @@ -410,6 +410,9 @@ /* Define to 1 if you have the `futimes' function. */ #undef HAVE_FUTIMES +/* F_DUPFD_CLOEXEC */ +#undef HAVE_F_DUPFD_CLOEXEC + /* Have getaddrinfo */ #undef HAVE_GETADDRINFO @@ -590,9 +593,6 @@ /* kqueue */ #undef HAVE_KQUEUE -/* Have __thread keyword */ -#undef HAVE_KW_THREAD - /* Have large file support */ #undef HAVE_LARGE_FILE_SUPPORT @@ -701,6 +701,9 @@ /* No GC support. */ #undef HAVE_NULL_GC +/* O_CLOEXEC */ +#undef HAVE_O_CLOEXEC + /* Define to 1 if you have the header file. */ #undef HAVE_PATHCONF_H @@ -1323,6 +1326,12 @@ /* inotify_rm_watch with unsigned wd */ #undef INOTIFY_RM_WATCH_WD_UNSIGNED +/* LLVM used is being build during mono build */ +#undef INTERNAL_LLVM + +/* Build LLVM with assertions */ +#undef INTERNAL_LLVM_ASSERTS + /* struct ipv6_mreq with unsigned ipv6mr_interface */ #undef IPV6MR_INTERFACE_UNSIGNED @@ -1335,9 +1344,6 @@ /* Enable lazy gc thread creation by the embedding host. */ #undef LAZY_GC_THREAD_CREATION -/* Full version of LLVM libraries */ -#undef LLVM_VERSION - /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR @@ -1374,6 +1380,9 @@ /* Enable jemalloc usage for mono */ #undef MONO_JEMALLOC_ENABLED +/* Have __thread keyword */ +#undef MONO_KEYWORD_THREAD + /* The LLVM back end is dynamically loaded */ #undef MONO_LLVM_LOADED @@ -1434,7 +1443,7 @@ /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG -/* size of machine integer registers */ +/* size of target machine integer registers */ #undef SIZEOF_REGISTER /* The size of `size_t', as computed by sizeof. */ @@ -1491,6 +1500,9 @@ /* ... */ #undef TARGET_S390X +/* wordsize of target */ +#undef TARGET_SIZEOF_VOID_P + /* ... */ #undef TARGET_SPARC diff --git a/configure.REMOVED.git-id b/configure.REMOVED.git-id index 2368e356e4..e37d0a3524 100644 --- a/configure.REMOVED.git-id +++ b/configure.REMOVED.git-id @@ -1 +1 @@ -ffc6859b8573983062da73baeea2360c777c88e5 \ No newline at end of file +9b2fd835af009b5dd6dd4db4bed39050a935a5ea \ No newline at end of file diff --git a/configure.ac.REMOVED.git-id b/configure.ac.REMOVED.git-id index 91d811f8b9..1b1f395c7d 100644 --- a/configure.ac.REMOVED.git-id +++ b/configure.ac.REMOVED.git-id @@ -1 +1 @@ -1bf4fa1e23e690a37efb70df0e659d764a410d7d \ No newline at end of file +31d01c63c1999848cd2cd8c491268eca5b0f9084 \ No newline at end of file diff --git a/data/Makefile.in b/data/Makefile.in index 31f2a470b4..b475fb6a3e 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -259,6 +259,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -274,6 +276,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -314,11 +317,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/data/gdb/mono-gdb.py b/data/gdb/mono-gdb.py index 43c49cfc6a..14ec43ac73 100644 --- a/data/gdb/mono-gdb.py +++ b/data/gdb/mono-gdb.py @@ -48,7 +48,7 @@ def stringify_class_name(ns, name): if ns == "": return name else: - return "{}.{}".format (ns, name) + return "{0}.{1}".format (ns, name) class ArrayPrinter: "Print a C# array" @@ -61,7 +61,7 @@ class ArrayPrinter: def to_string(self): obj = self.val.cast (gdb.lookup_type ("MonoArray").pointer ()).dereference () length = obj ['max_length'] - return "{} [{}]".format (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length)) + return "{0} [{1}]".format (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length)) class ObjectPrinter: "Print a C# object" @@ -91,7 +91,7 @@ class ObjectPrinter: return (field.name, self.obj [field.name]) except: # Superclass - return (field.name, self.obj.cast (gdb.lookup_type ("{}".format (field.name)))) + return (field.name, self.obj.cast (gdb.lookup_type ("{0}".format (field.name)))) def children(self): # FIXME: It would be easier if gdb.Value would support iteration itself @@ -105,7 +105,7 @@ class ObjectPrinter: if class_name [-2:len(class_name)] == "[]": return {}.__iter__ () try: - gdb_type = gdb.lookup_type ("struct {}_{}".format (class_ns.replace (".", "_"), class_name)) + gdb_type = gdb.lookup_type ("struct {0}_{1}".format (class_ns.replace (".", "_"), class_name)) return self._iterator(obj.cast (gdb_type)) except: return {}.__iter__ () @@ -127,12 +127,12 @@ class ObjectPrinter: return ArrayPrinter (self.val,class_ns,class_name).to_string () if class_ns != "": try: - gdb_type = gdb.lookup_type ("struct {}.{}".format (class_ns, class_name)) + gdb_type = gdb.lookup_type ("struct {0}.{1}".format (class_ns, class_name)) except: # Maybe there is no debug info for that type - return "{}.{}".format (class_ns, class_name) + return "{0}.{1}".format (class_ns, class_name) #return obj.cast (gdb_type) - return "{}.{}".format (class_ns, class_name) + return "{0}.{1}".format (class_ns, class_name) return class_name except: print (sys.exc_info ()[0]) @@ -152,9 +152,9 @@ class MonoMethodPrinter: val = self.val.dereference () klass = val ["klass"].dereference () class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ()) - return "\"{}:{} ()\"".format (class_name, val ["name"].string ()) + return "\"{0}:{1} ()\"".format (class_name, val ["name"].string ()) # This returns more info but requires calling into the inferior - #return "\"{}\"".format (gdb.parse_and_eval ("mono_method_full_name ({}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ()) + #return "\"{0}\"".format (gdb.parse_and_eval ("mono_method_full_name ({0}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ()) class MonoClassPrinter: "Print a MonoClass structure" @@ -168,11 +168,11 @@ class MonoClassPrinter: klass = self.val.dereference () class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ()) if add_quotes: - return "\"{}\"".format (class_name) + return "\"{0}\"".format (class_name) else: return class_name # This returns more info but requires calling into the inferior - #return "\"{}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64"))))))) + #return "\"{0}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){0})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64"))))))) def to_string(self): try: @@ -220,7 +220,7 @@ class MonoGenericClassPrinter: method_inst_str = "" if int(method_inst.cast (gdb.lookup_type ("guint64"))) != 0: method_inst_str = str(method_inst) - return "{}, [{}], [{}]>".format (container_str, class_inst_str, method_inst_str) + return "{0}, [{1}], [{2}]>".format (container_str, class_inst_str, method_inst_str) def to_string(self): try: @@ -250,9 +250,9 @@ class MonoTypePrinter: info = str(t ["data"]["generic_class"]) if info != "": - return "{{{}, {}}}".format (kind, info) + return "{{{0}, {1}}}".format (kind, info) else: - return "{{{}}}".format (kind) + return "{{{0}}}".format (kind) except: #print (sys.exc_info ()[0]) #print (sys.exc_info ()[1]) @@ -281,7 +281,7 @@ class MonoMethodRgctxPrinter: if i > 0: inst_str = inst_str + ", " inst_str = inst_str + type_printer.to_string () - return "MRGCTX[{}, [{}]]".format (klass_printer.to_string(), inst_str) + return "MRGCTX[{0}, [{1}]]".format (klass_printer.to_string(), inst_str) class MonoVTablePrinter: "Print a MonoVTable structure" @@ -296,7 +296,7 @@ class MonoVTablePrinter: klass = vtable ["klass"] klass_printer = MonoClassPrinter (klass) - return "vtable({})".format (klass_printer.to_string ()) + return "vtable({0})".format (klass_printer.to_string ()) def lookup_pretty_printer(val): t = str (val.type) diff --git a/data/net_2_0/Browsers/Makefile.in b/data/net_2_0/Browsers/Makefile.in index 0c81dd9c1c..6bc41f7d5e 100644 --- a/data/net_2_0/Browsers/Makefile.in +++ b/data/net_2_0/Browsers/Makefile.in @@ -181,6 +181,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -196,6 +198,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -236,11 +239,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/data/net_2_0/Makefile.in b/data/net_2_0/Makefile.in index 38d1e5e006..6e30571f53 100644 --- a/data/net_2_0/Makefile.in +++ b/data/net_2_0/Makefile.in @@ -241,6 +241,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -256,6 +258,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -296,11 +299,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/data/net_4_0/Browsers/Makefile.in b/data/net_4_0/Browsers/Makefile.in index 4814279bc1..ddd68c37aa 100644 --- a/data/net_4_0/Browsers/Makefile.in +++ b/data/net_4_0/Browsers/Makefile.in @@ -181,6 +181,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -196,6 +198,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -236,11 +239,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/data/net_4_0/Makefile.in b/data/net_4_0/Makefile.in index 32fa985f6f..0b07774895 100644 --- a/data/net_4_0/Makefile.in +++ b/data/net_4_0/Makefile.in @@ -241,6 +241,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -256,6 +258,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -296,11 +299,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/data/net_4_5/Browsers/Makefile.in b/data/net_4_5/Browsers/Makefile.in index dc9c769341..c09d4c48d9 100644 --- a/data/net_4_5/Browsers/Makefile.in +++ b/data/net_4_5/Browsers/Makefile.in @@ -181,6 +181,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -196,6 +198,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -236,11 +239,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/data/net_4_5/Makefile.in b/data/net_4_5/Makefile.in index 8e8b1660aa..f58e712f70 100644 --- a/data/net_4_5/Makefile.in +++ b/data/net_4_5/Makefile.in @@ -241,6 +241,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -256,6 +258,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -296,11 +299,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/docs/Makefile.in b/docs/Makefile.in index 574409882e..a1491c33cd 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -181,6 +181,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -196,6 +198,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -236,11 +239,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/docs/deploy/mono-api-class.html b/docs/deploy/mono-api-class.html index 00e66aa16e..091e622bd7 100644 --- a/docs/deploy/mono-api-class.html +++ b/docs/deploy/mono-api-class.html @@ -1362,7 +1362,7 @@ mono_class_value_size (MonoClass *klass, guint32 *align)

Parameters
-
klass a class
Return value
+
klass a class
Return value
the size of a value of kind klass
Description
diff --git a/docs/deploy/mono-api-exc.html b/docs/deploy/mono-api-exc.html index 5390655f49..9ed0638f36 100644 --- a/docs/deploy/mono-api-exc.html +++ b/docs/deploy/mono-api-exc.html @@ -396,7 +396,7 @@ mono_exception_from_name_msg (MonoImage *image, const char *name_space,
Syntax
MonoException* mono_exception_from_name_two_strings (MonoImage *image, const char *name_space, - const char *name, MonoString *a1, MonoString *a2) + const char *name, MonoString *a1_raw, MonoString *a2_raw)

@@ -672,7 +672,7 @@ mono_get_exception_execution_engine (const char *msg)

Syntax
MonoException* -mono_get_exception_file_not_found2 (const char *msg, MonoString *fname) +mono_get_exception_file_not_found2 (const char *msg, MonoString *fname_raw)

@@ -694,7 +694,7 @@ mono_get_exception_file_not_found2 (const char *msg, MonoString *fname)

Syntax
MonoException* -mono_get_exception_file_not_found (MonoString *fname) +mono_get_exception_file_not_found (MonoString *fname_raw)

@@ -866,7 +866,7 @@ mono_get_exception_overflow (void)

Syntax
MonoException* -mono_get_exception_security () +mono_get_exception_security (void)

@@ -952,7 +952,7 @@ mono_get_exception_synchronization_lock (const char *msg)

Syntax
MonoException* -mono_get_exception_thread_abort () +mono_get_exception_thread_abort (void)

@@ -972,8 +972,7 @@ mono_get_exception_thread_abort ()

Syntax
-
MONO_RT_EXTERNAL_ONLY -MonoException * +
MonoException* mono_get_exception_thread_state (const char *msg)
@@ -996,7 +995,7 @@ mono_get_exception_thread_state (const char *msg)
Syntax
MonoException* -mono_get_exception_type_initialization (const gchar *type_name, MonoException *inner) +mono_get_exception_type_initialization (const gchar *type_name, MonoException* inner_raw)

@@ -1018,7 +1017,7 @@ mono_get_exception_type_initialization (const gchar *type_name, MonoException *i

Syntax
MonoException* -mono_get_exception_type_load (MonoString *class_name, char *assembly_name) +mono_get_exception_type_load (MonoString *class_name_raw, char *assembly_name)

@@ -1067,7 +1066,7 @@ mono_get_exception_missing_field (const char *class_name, const char *member_nam

Parameters
-
class_name the class where the lookup was performed
member_name the name of the missing method.
Return value
+
class_name the class where the lookup was performed
member_name the name of the missing field.
Return value
a new instance of the System.MissingFieldException
@@ -1128,8 +1127,7 @@ mono_get_exception_reflection_type_load (MonoArray *types_raw, MonoArray *except
Syntax
MonoException* -mono_exception_from_token_two_strings (MonoImage *image, guint32 token, - MonoString *a1, MonoString *a2) +mono_exception_from_token_two_strings (MonoImage *image, guint32 token, MonoString *arg1_raw, MonoString *arg2_raw)

@@ -1152,7 +1150,7 @@ mono_exception_from_token_two_strings (MonoImage *image, guint32 token,

Syntax
MonoException* -mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname) +mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname_raw)

@@ -1237,7 +1235,7 @@ mono_get_exception_out_of_memory (void)

Syntax
MonoException* -mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception) +mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception_raw)

diff --git a/docs/deploy/mono-api-internal.html b/docs/deploy/mono-api-internal.html index 7808614b55..49ffbbe089 100644 --- a/docs/deploy/mono-api-internal.html +++ b/docs/deploy/mono-api-internal.html @@ -340,8 +340,8 @@ mono_marshal_alloc (gsize size, MonoError *error)

Syntax
-
gpointer -mono_marshal_asany (MonoObject *o, MonoMarshalNative string_encoding, int param_attrs) +
static gpointer +mono_marshal_asany_handle (MonoObjectHandle o, MonoMarshalNative string_encoding, int param_attrs, MonoError *error)

diff --git a/docs/deploy/mono-api-string.html b/docs/deploy/mono-api-string.html index af0a3937e3..d22f40b8b7 100644 --- a/docs/deploy/mono-api-string.html +++ b/docs/deploy/mono-api-string.html @@ -380,7 +380,7 @@ mono_string_from_utf16 (gunichar2 *data)

Syntax
MonoString* -mono_string_from_utf32 (mono_unichar4 *data) +mono_string_from_utf32 (/*const*/ mono_unichar4 *data)

diff --git a/docs/deploy/mono-api-type.html b/docs/deploy/mono-api-type.html index 55b50fbcdc..710c6cb463 100644 --- a/docs/deploy/mono-api-type.html +++ b/docs/deploy/mono-api-type.html @@ -478,7 +478,7 @@ mono_type_get_underlying_type (MonoType *type)

Syntax
-
gboolean +
mono_bool mono_type_is_byref (MonoType *type)
diff --git a/external/api-snapshot/profiles/monodroid/Facades/netstandard.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/Facades/netstandard.cs.REMOVED.git-id index 839a060365..f52cf6bfdd 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/netstandard.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/Facades/netstandard.cs.REMOVED.git-id @@ -1 +1 @@ -8ffeb2ce2f964947f799e68f33977d6f1842b8c2 \ No newline at end of file +24ecdefc0004fa8d23a5cda73a8075eb8cae0520 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monodroid/System.Core.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/System.Core.cs.REMOVED.git-id index 8801d6e90b..3d6a9b26b7 100644 --- a/external/api-snapshot/profiles/monodroid/System.Core.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/System.Core.cs.REMOVED.git-id @@ -1 +1 @@ -f33b8a63fa46172d23817d0bcc706d25a6ddd781 \ No newline at end of file +2b595ee4c9228ee8ebdc1c8fa5b011b706e4cb23 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monodroid/System.Security.cs b/external/api-snapshot/profiles/monodroid/System.Security.cs index 47a957fdbc..49f3c0cda9 100644 --- a/external/api-snapshot/profiles/monodroid/System.Security.cs +++ b/external/api-snapshot/profiles/monodroid/System.Security.cs @@ -19,41 +19,7 @@ [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] [assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] namespace System.Security.Cryptography { public sealed partial class CryptographicAttributeObject @@ -141,14 +107,28 @@ namespace System.Security.Cryptography.Pkcs public bool MoveNext() { throw null; } public void Reset() { } } + public sealed partial class CmsSigner + { + public CmsSigner() { } + public CmsSigner(System.Security.Cryptography.CspParameters parameters) { } + public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType) { } + public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public CmsSigner(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get { throw null; } set { } } + public System.Security.Cryptography.X509Certificates.X509Certificate2Collection Certificates { get { throw null; } } + public System.Security.Cryptography.Oid DigestAlgorithm { get { throw null; } set { } } + public System.Security.Cryptography.X509Certificates.X509IncludeOption IncludeOption { get { throw null; } set { } } + public System.Security.Cryptography.AsymmetricAlgorithm PrivateKey { get { throw null; } set { } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection SignedAttributes { get { throw null; } } + public System.Security.Cryptography.Pkcs.SubjectIdentifierType SignerIdentifierType { get { throw null; } set { } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection UnsignedAttributes { get { throw null; } } + } public sealed partial class ContentInfo { public ContentInfo(byte[] content) { } public ContentInfo(System.Security.Cryptography.Oid contentType, byte[] content) { } public byte[] Content { get { throw null; } } public System.Security.Cryptography.Oid ContentType { get { throw null; } } - ~ContentInfo() { } - [System.MonoTODOAttribute("MS is stricter than us about the content structure")] public static System.Security.Cryptography.Oid GetContentType(byte[] encodedMessage) { throw null; } } public sealed partial class EnvelopedCms @@ -164,26 +144,16 @@ namespace System.Security.Cryptography.Pkcs public System.Security.Cryptography.Pkcs.RecipientInfoCollection RecipientInfos { get { throw null; } } public System.Security.Cryptography.CryptographicAttributeObjectCollection UnprotectedAttributes { get { throw null; } } public int Version { get { throw null; } } - [System.MonoTODOAttribute] public void Decode(byte[] encodedMessage) { } - [System.MonoTODOAttribute] public void Decrypt() { } - [System.MonoTODOAttribute] public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo) { } - [System.MonoTODOAttribute] public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo, System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { } - [System.MonoTODOAttribute] public void Decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { } - [System.MonoTODOAttribute] public byte[] Encode() { throw null; } - [System.MonoTODOAttribute] public void Encrypt() { } - [System.MonoTODOAttribute] public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { } - [System.MonoTODOAttribute] public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipientCollection recipients) { } } - [System.MonoTODOAttribute] public sealed partial class KeyAgreeRecipientInfo : System.Security.Cryptography.Pkcs.RecipientInfo { internal KeyAgreeRecipientInfo() { } @@ -289,6 +259,70 @@ namespace System.Security.Cryptography.Pkcs KeyTransport = 1, Unknown = 0, } + public sealed partial class SignedCms + { + public SignedCms() { } + public SignedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo) { } + public SignedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo, bool detached) { } + public SignedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType) { } + public SignedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo contentInfo) { } + public SignedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo contentInfo, bool detached) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2Collection Certificates { get { throw null; } } + public System.Security.Cryptography.Pkcs.ContentInfo ContentInfo { get { throw null; } } + public bool Detached { get { throw null; } } + public System.Security.Cryptography.Pkcs.SignerInfoCollection SignerInfos { get { throw null; } } + public int Version { get { throw null; } } + public void CheckHash() { } + public void CheckSignature(bool verifySignatureOnly) { } + public void CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore, bool verifySignatureOnly) { } + public void ComputeSignature() { } + public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer) { } + public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer, bool silent) { } + public void Decode(byte[] encodedMessage) { } + public byte[] Encode() { throw null; } + public void RemoveSignature(int index) { } + public void RemoveSignature(System.Security.Cryptography.Pkcs.SignerInfo signerInfo) { } + } + public sealed partial class SignerInfo + { + internal SignerInfo() { } + public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get { throw null; } } + public System.Security.Cryptography.Pkcs.SignerInfoCollection CounterSignerInfos { get { throw null; } } + public System.Security.Cryptography.Oid DigestAlgorithm { get { throw null; } } + public System.Security.Cryptography.Oid SignatureAlgorithm { get { throw null; } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection SignedAttributes { get { throw null; } } + public System.Security.Cryptography.Pkcs.SubjectIdentifier SignerIdentifier { get { throw null; } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection UnsignedAttributes { get { throw null; } } + public int Version { get { throw null; } } + public void CheckHash() { } + public void CheckSignature(bool verifySignatureOnly) { } + public void CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore, bool verifySignatureOnly) { } + public void ComputeCounterSignature() { } + public void ComputeCounterSignature(System.Security.Cryptography.Pkcs.CmsSigner signer) { } + public byte[] GetSignature() { throw null; } + public void RemoveCounterSignature(int index) { } + public void RemoveCounterSignature(System.Security.Cryptography.Pkcs.SignerInfo counterSignerInfo) { } + } + public sealed partial class SignerInfoCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal SignerInfoCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Security.Cryptography.Pkcs.SignerInfo this[int index] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Security.Cryptography.Pkcs.SignerInfo[] array, int index) { } + public System.Security.Cryptography.Pkcs.SignerInfoEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public sealed partial class SignerInfoEnumerator : System.Collections.IEnumerator + { + internal SignerInfoEnumerator() { } + public System.Security.Cryptography.Pkcs.SignerInfo Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public bool MoveNext() { throw null; } + public void Reset() { } + } public sealed partial class SubjectIdentifier { internal SubjectIdentifier() { } diff --git a/external/api-snapshot/profiles/monodroid/System.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/System.cs.REMOVED.git-id index f86f8b9be0..64729d4105 100644 --- a/external/api-snapshot/profiles/monodroid/System.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/System.cs.REMOVED.git-id @@ -1 +1 @@ -d343eb5458c68903df629e9b5279a611131d5dc2 \ No newline at end of file +0a306482eac9dc254a050e40a50147c9f8a8f319 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monodroid/mscorlib.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/mscorlib.cs.REMOVED.git-id index 26c62f9fa6..4be0ce6b94 100644 --- a/external/api-snapshot/profiles/monodroid/mscorlib.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/mscorlib.cs.REMOVED.git-id @@ -1 +1 @@ -3e5fbe0a8e9832a6c1fa10e9e6fcb9b7760767d7 \ No newline at end of file +2fb53cd439a3395a5d960922938e7d3b2ca800d5 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monotouch/System.Core.cs.REMOVED.git-id b/external/api-snapshot/profiles/monotouch/System.Core.cs.REMOVED.git-id index 3043039609..40316a6f31 100644 --- a/external/api-snapshot/profiles/monotouch/System.Core.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monotouch/System.Core.cs.REMOVED.git-id @@ -1 +1 @@ -bb9c7fdf6eb89a2c779160dc32d18fefd86adae4 \ No newline at end of file +1845aa28a014b1b3fb193a22b13489b5068511e9 \ No newline at end of file diff --git a/external/api-snapshot/profiles/monotouch/System.Security.cs b/external/api-snapshot/profiles/monotouch/System.Security.cs index 47a957fdbc..49f3c0cda9 100644 --- a/external/api-snapshot/profiles/monotouch/System.Security.cs +++ b/external/api-snapshot/profiles/monotouch/System.Security.cs @@ -19,41 +19,7 @@ [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] [assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] namespace System.Security.Cryptography { public sealed partial class CryptographicAttributeObject @@ -141,14 +107,28 @@ namespace System.Security.Cryptography.Pkcs public bool MoveNext() { throw null; } public void Reset() { } } + public sealed partial class CmsSigner + { + public CmsSigner() { } + public CmsSigner(System.Security.Cryptography.CspParameters parameters) { } + public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType) { } + public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public CmsSigner(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get { throw null; } set { } } + public System.Security.Cryptography.X509Certificates.X509Certificate2Collection Certificates { get { throw null; } } + public System.Security.Cryptography.Oid DigestAlgorithm { get { throw null; } set { } } + public System.Security.Cryptography.X509Certificates.X509IncludeOption IncludeOption { get { throw null; } set { } } + public System.Security.Cryptography.AsymmetricAlgorithm PrivateKey { get { throw null; } set { } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection SignedAttributes { get { throw null; } } + public System.Security.Cryptography.Pkcs.SubjectIdentifierType SignerIdentifierType { get { throw null; } set { } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection UnsignedAttributes { get { throw null; } } + } public sealed partial class ContentInfo { public ContentInfo(byte[] content) { } public ContentInfo(System.Security.Cryptography.Oid contentType, byte[] content) { } public byte[] Content { get { throw null; } } public System.Security.Cryptography.Oid ContentType { get { throw null; } } - ~ContentInfo() { } - [System.MonoTODOAttribute("MS is stricter than us about the content structure")] public static System.Security.Cryptography.Oid GetContentType(byte[] encodedMessage) { throw null; } } public sealed partial class EnvelopedCms @@ -164,26 +144,16 @@ namespace System.Security.Cryptography.Pkcs public System.Security.Cryptography.Pkcs.RecipientInfoCollection RecipientInfos { get { throw null; } } public System.Security.Cryptography.CryptographicAttributeObjectCollection UnprotectedAttributes { get { throw null; } } public int Version { get { throw null; } } - [System.MonoTODOAttribute] public void Decode(byte[] encodedMessage) { } - [System.MonoTODOAttribute] public void Decrypt() { } - [System.MonoTODOAttribute] public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo) { } - [System.MonoTODOAttribute] public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo, System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { } - [System.MonoTODOAttribute] public void Decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { } - [System.MonoTODOAttribute] public byte[] Encode() { throw null; } - [System.MonoTODOAttribute] public void Encrypt() { } - [System.MonoTODOAttribute] public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { } - [System.MonoTODOAttribute] public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipientCollection recipients) { } } - [System.MonoTODOAttribute] public sealed partial class KeyAgreeRecipientInfo : System.Security.Cryptography.Pkcs.RecipientInfo { internal KeyAgreeRecipientInfo() { } @@ -289,6 +259,70 @@ namespace System.Security.Cryptography.Pkcs KeyTransport = 1, Unknown = 0, } + public sealed partial class SignedCms + { + public SignedCms() { } + public SignedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo) { } + public SignedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo, bool detached) { } + public SignedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType) { } + public SignedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo contentInfo) { } + public SignedCms(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.Pkcs.ContentInfo contentInfo, bool detached) { } + public System.Security.Cryptography.X509Certificates.X509Certificate2Collection Certificates { get { throw null; } } + public System.Security.Cryptography.Pkcs.ContentInfo ContentInfo { get { throw null; } } + public bool Detached { get { throw null; } } + public System.Security.Cryptography.Pkcs.SignerInfoCollection SignerInfos { get { throw null; } } + public int Version { get { throw null; } } + public void CheckHash() { } + public void CheckSignature(bool verifySignatureOnly) { } + public void CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore, bool verifySignatureOnly) { } + public void ComputeSignature() { } + public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer) { } + public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer, bool silent) { } + public void Decode(byte[] encodedMessage) { } + public byte[] Encode() { throw null; } + public void RemoveSignature(int index) { } + public void RemoveSignature(System.Security.Cryptography.Pkcs.SignerInfo signerInfo) { } + } + public sealed partial class SignerInfo + { + internal SignerInfo() { } + public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get { throw null; } } + public System.Security.Cryptography.Pkcs.SignerInfoCollection CounterSignerInfos { get { throw null; } } + public System.Security.Cryptography.Oid DigestAlgorithm { get { throw null; } } + public System.Security.Cryptography.Oid SignatureAlgorithm { get { throw null; } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection SignedAttributes { get { throw null; } } + public System.Security.Cryptography.Pkcs.SubjectIdentifier SignerIdentifier { get { throw null; } } + public System.Security.Cryptography.CryptographicAttributeObjectCollection UnsignedAttributes { get { throw null; } } + public int Version { get { throw null; } } + public void CheckHash() { } + public void CheckSignature(bool verifySignatureOnly) { } + public void CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore, bool verifySignatureOnly) { } + public void ComputeCounterSignature() { } + public void ComputeCounterSignature(System.Security.Cryptography.Pkcs.CmsSigner signer) { } + public byte[] GetSignature() { throw null; } + public void RemoveCounterSignature(int index) { } + public void RemoveCounterSignature(System.Security.Cryptography.Pkcs.SignerInfo counterSignerInfo) { } + } + public sealed partial class SignerInfoCollection : System.Collections.ICollection, System.Collections.IEnumerable + { + internal SignerInfoCollection() { } + public int Count { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public System.Security.Cryptography.Pkcs.SignerInfo this[int index] { get { throw null; } } + public object SyncRoot { get { throw null; } } + public void CopyTo(System.Array array, int index) { } + public void CopyTo(System.Security.Cryptography.Pkcs.SignerInfo[] array, int index) { } + public System.Security.Cryptography.Pkcs.SignerInfoEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public sealed partial class SignerInfoEnumerator : System.Collections.IEnumerator + { + internal SignerInfoEnumerator() { } + public System.Security.Cryptography.Pkcs.SignerInfo Current { get { throw null; } } + object System.Collections.IEnumerator.Current { get { throw null; } } + public bool MoveNext() { throw null; } + public void Reset() { } + } public sealed partial class SubjectIdentifier { internal SubjectIdentifier() { } diff --git a/external/api-snapshot/profiles/monotouch/System.cs.REMOVED.git-id b/external/api-snapshot/profiles/monotouch/System.cs.REMOVED.git-id index 05bba2c7af..90ff443c45 100644 --- a/external/api-snapshot/profiles/monotouch/System.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monotouch/System.cs.REMOVED.git-id @@ -1 +1 @@ -6d22abfe2dc75d6f7256dacb8678da98e4396465 \ No newline at end of file +f1f7d7c12ac0ebb5ae0ba105d8a40604bbe64b2a \ No newline at end of file diff --git a/external/api-snapshot/profiles/monotouch/mscorlib.cs.REMOVED.git-id b/external/api-snapshot/profiles/monotouch/mscorlib.cs.REMOVED.git-id index 91f0aaa37f..2b483a41de 100644 --- a/external/api-snapshot/profiles/monotouch/mscorlib.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monotouch/mscorlib.cs.REMOVED.git-id @@ -1 +1 @@ -0e5ebabffda13f7e89b4933bf05bcaf7e5d7cdc3 \ No newline at end of file +19b8755ba7a2fe1982e1a0181d2ff453a1afc9af \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/Mono.Debugger.Soft.cs b/external/api-snapshot/profiles/net_4_x/Mono.Debugger.Soft.cs index 4b9d69698c..81ee6a4b57 100644 --- a/external/api-snapshot/profiles/net_4_x/Mono.Debugger.Soft.cs +++ b/external/api-snapshot/profiles/net_4_x/Mono.Debugger.Soft.cs @@ -65,14 +65,22 @@ namespace Mono.Debugger.Soft internal AssemblyMirror() { } public Mono.Debugger.Soft.AppDomainMirror Domain { get { throw null; } } public Mono.Debugger.Soft.MethodMirror EntryPoint { get { throw null; } } + public bool HasFetchedPdb { get { throw null; } } + public bool HasPdb { get { throw null; } } + public bool IsDynamic { get { throw null; } } public string Location { get { throw null; } } public Mono.Debugger.Soft.ModuleMirror ManifestModule { get { throw null; } } public Mono.Cecil.AssemblyDefinition Metadata { get { throw null; } set { } } public Mono.Debugger.Soft.ObjectMirror GetAssemblyObject() { throw null; } + public Mono.Cecil.AssemblyDefinition GetMetadata() { throw null; } + public byte[] GetMetadataBlob() { throw null; } + public Mono.Debugger.Soft.MethodMirror GetMethod(uint token) { throw null; } public virtual System.Reflection.AssemblyName GetName() { throw null; } + public byte[] GetPdbBlob() { throw null; } public Mono.Debugger.Soft.TypeMirror GetType(string name) { throw null; } public Mono.Debugger.Soft.TypeMirror GetType(string name, bool throwOnError) { throw null; } public Mono.Debugger.Soft.TypeMirror GetType(string name, bool throwOnError, bool ignoreCase) { throw null; } + public Mono.Debugger.Soft.TypeMirror GetType(uint token) { throw null; } } public partial class AssemblyUnloadEvent : Mono.Debugger.Soft.Event { diff --git a/external/api-snapshot/profiles/net_4_x/Novell.Directory.Ldap.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/Novell.Directory.Ldap.cs.REMOVED.git-id index 187fc29135..d87c104f04 100644 --- a/external/api-snapshot/profiles/net_4_x/Novell.Directory.Ldap.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/Novell.Directory.Ldap.cs.REMOVED.git-id @@ -1 +1 @@ -d906cc86778bcc853daa6f318fa3d840d52a5a10 \ No newline at end of file +b6bab354b18204adbea1f159846b9807413b1a3d \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/System.Core.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/System.Core.cs.REMOVED.git-id index 7a64292bbd..0d79b13d6d 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Core.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/System.Core.cs.REMOVED.git-id @@ -1 +1 @@ -bd9b258d4f490e816dcc032678ba657bef5084bb \ No newline at end of file +5bb99bc8c448a147d4fd5de3bd1798df7015810b \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/System.Security.cs b/external/api-snapshot/profiles/net_4_x/System.Security.cs index cedcb3ce9a..3a1b72ffbc 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Security.cs +++ b/external/api-snapshot/profiles/net_4_x/System.Security.cs @@ -19,41 +19,7 @@ [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] [assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] [assembly:System.Security.AllowPartiallyTrustedCallersAttribute] -namespace System -{ - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoDocumentationNoteAttribute : System.MonoTODOAttribute - { - public MonoDocumentationNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoExtensionAttribute : System.MonoTODOAttribute - { - public MonoExtensionAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoInternalNoteAttribute : System.MonoTODOAttribute - { - public MonoInternalNoteAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoLimitationAttribute : System.MonoTODOAttribute - { - public MonoLimitationAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoNotSupportedAttribute : System.MonoTODOAttribute - { - public MonoNotSupportedAttribute(string comment) { } - } - [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true)] - internal partial class MonoTODOAttribute : System.Attribute - { - public MonoTODOAttribute() { } - public MonoTODOAttribute(string comment) { } - public string Comment { get { throw null; } } - } -} +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] namespace System.Security.Cryptography { public sealed partial class CryptographicAttributeObject @@ -158,7 +124,6 @@ namespace System.Security.Cryptography.Pkcs public sealed partial class CmsSigner { public CmsSigner() { } - [System.MonoTODOAttribute] public CmsSigner(System.Security.Cryptography.CspParameters parameters) { } public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType) { } public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { } @@ -167,6 +132,7 @@ namespace System.Security.Cryptography.Pkcs public System.Security.Cryptography.X509Certificates.X509Certificate2Collection Certificates { get { throw null; } } public System.Security.Cryptography.Oid DigestAlgorithm { get { throw null; } set { } } public System.Security.Cryptography.X509Certificates.X509IncludeOption IncludeOption { get { throw null; } set { } } + public System.Security.Cryptography.AsymmetricAlgorithm PrivateKey { get { throw null; } set { } } public System.Security.Cryptography.CryptographicAttributeObjectCollection SignedAttributes { get { throw null; } } public System.Security.Cryptography.Pkcs.SubjectIdentifierType SignerIdentifierType { get { throw null; } set { } } public System.Security.Cryptography.CryptographicAttributeObjectCollection UnsignedAttributes { get { throw null; } } @@ -177,8 +143,6 @@ namespace System.Security.Cryptography.Pkcs public ContentInfo(System.Security.Cryptography.Oid contentType, byte[] content) { } public byte[] Content { get { throw null; } } public System.Security.Cryptography.Oid ContentType { get { throw null; } } - ~ContentInfo() { } - [System.MonoTODOAttribute("MS is stricter than us about the content structure")] public static System.Security.Cryptography.Oid GetContentType(byte[] encodedMessage) { throw null; } } public sealed partial class EnvelopedCms @@ -194,23 +158,14 @@ namespace System.Security.Cryptography.Pkcs public System.Security.Cryptography.Pkcs.RecipientInfoCollection RecipientInfos { get { throw null; } } public System.Security.Cryptography.CryptographicAttributeObjectCollection UnprotectedAttributes { get { throw null; } } public int Version { get { throw null; } } - [System.MonoTODOAttribute] public void Decode(byte[] encodedMessage) { } - [System.MonoTODOAttribute] public void Decrypt() { } - [System.MonoTODOAttribute] public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo) { } - [System.MonoTODOAttribute] public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo, System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { } - [System.MonoTODOAttribute] public void Decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { } - [System.MonoTODOAttribute] public byte[] Encode() { throw null; } - [System.MonoTODOAttribute] public void Encrypt() { } - [System.MonoTODOAttribute] public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { } - [System.MonoTODOAttribute] public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipientCollection recipients) { } } public enum KeyAgreeKeyChoice @@ -219,7 +174,6 @@ namespace System.Security.Cryptography.Pkcs StaticKey = 2, Unknown = 0, } - [System.MonoTODOAttribute] public sealed partial class KeyAgreeRecipientInfo : System.Security.Cryptography.Pkcs.RecipientInfo { internal KeyAgreeRecipientInfo() { } @@ -338,25 +292,15 @@ namespace System.Security.Cryptography.Pkcs public bool Detached { get { throw null; } } public System.Security.Cryptography.Pkcs.SignerInfoCollection SignerInfos { get { throw null; } } public int Version { get { throw null; } } - [System.MonoTODOAttribute] public void CheckHash() { } - [System.MonoTODOAttribute] public void CheckSignature(bool verifySignatureOnly) { } - [System.MonoTODOAttribute] public void CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore, bool verifySignatureOnly) { } - [System.MonoTODOAttribute] public void ComputeSignature() { } - [System.MonoTODOAttribute] public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer) { } - [System.MonoTODOAttribute] public void ComputeSignature(System.Security.Cryptography.Pkcs.CmsSigner signer, bool silent) { } - [System.MonoTODOAttribute("incomplete - missing attributes")] public void Decode(byte[] encodedMessage) { } - [System.MonoTODOAttribute] public byte[] Encode() { throw null; } - [System.MonoTODOAttribute] public void RemoveSignature(int index) { } - [System.MonoTODOAttribute] public void RemoveSignature(System.Security.Cryptography.Pkcs.SignerInfo signerInfo) { } } public sealed partial class SignerInfo @@ -365,23 +309,18 @@ namespace System.Security.Cryptography.Pkcs public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get { throw null; } } public System.Security.Cryptography.Pkcs.SignerInfoCollection CounterSignerInfos { get { throw null; } } public System.Security.Cryptography.Oid DigestAlgorithm { get { throw null; } } + public System.Security.Cryptography.Oid SignatureAlgorithm { get { throw null; } } public System.Security.Cryptography.CryptographicAttributeObjectCollection SignedAttributes { get { throw null; } } public System.Security.Cryptography.Pkcs.SubjectIdentifier SignerIdentifier { get { throw null; } } public System.Security.Cryptography.CryptographicAttributeObjectCollection UnsignedAttributes { get { throw null; } } public int Version { get { throw null; } } - [System.MonoTODOAttribute] public void CheckHash() { } - [System.MonoTODOAttribute] public void CheckSignature(bool verifySignatureOnly) { } - [System.MonoTODOAttribute] public void CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore, bool verifySignatureOnly) { } - [System.MonoTODOAttribute] public void ComputeCounterSignature() { } - [System.MonoTODOAttribute] public void ComputeCounterSignature(System.Security.Cryptography.Pkcs.CmsSigner signer) { } - [System.MonoTODOAttribute] + public byte[] GetSignature() { throw null; } public void RemoveCounterSignature(int index) { } - [System.MonoTODOAttribute] public void RemoveCounterSignature(System.Security.Cryptography.Pkcs.SignerInfo counterSignerInfo) { } } public sealed partial class SignerInfoCollection : System.Collections.ICollection, System.Collections.IEnumerable diff --git a/external/api-snapshot/profiles/net_4_x/System.ServiceModel.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/System.ServiceModel.cs.REMOVED.git-id index 8462e84d4d..d86e379f55 100644 --- a/external/api-snapshot/profiles/net_4_x/System.ServiceModel.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/System.ServiceModel.cs.REMOVED.git-id @@ -1 +1 @@ -8995d01e1ab9782fe94c11ccbcc28faec0f9899c \ No newline at end of file +a1df3f83332859870e1cf4a20ceeeed89728c785 \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/System.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/System.cs.REMOVED.git-id index d0eba433dc..573132a531 100644 --- a/external/api-snapshot/profiles/net_4_x/System.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/System.cs.REMOVED.git-id @@ -1 +1 @@ -0e31ba5d23e56d9bf294bc2cb75621d58d6ee1ab \ No newline at end of file +47154482003e653af7b9a47e14d653dd2a666e8d \ No newline at end of file diff --git a/external/api-snapshot/profiles/net_4_x/mscorlib.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/mscorlib.cs.REMOVED.git-id index 65712244f6..7124b81ea0 100644 --- a/external/api-snapshot/profiles/net_4_x/mscorlib.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/mscorlib.cs.REMOVED.git-id @@ -1 +1 @@ -9bca9460d6b9cd74dd3d146987c845648fdb7094 \ No newline at end of file +9ed54522b05ffd99addb3901008357209a338572 \ No newline at end of file diff --git a/external/binary-reference-assemblies/build/monodroid/Makefile b/external/binary-reference-assemblies/build/monodroid/Makefile index 0d90c10295..d23c2e1639 100644 --- a/external/binary-reference-assemblies/build/monodroid/Makefile +++ b/external/binary-reference-assemblies/build/monodroid/Makefile @@ -5,7 +5,7 @@ CSC ?= csc CSC_COMMON_ARGS := -nologo -noconfig -optimize -nostdlib -unsafe -deterministic -publicsign -debug- -target:library -nowarn:612,618,809 Q_CSC = $(if $(V),,@echo "CSC [$(PROFILE)] $(1)";) -ASSEMBLIES := mscorlib System System.Xml System.Numerics System.Core System.Net.Http +ASSEMBLIES := mscorlib System System.Xml System.Numerics System.Core System.Net.Http Mono.Android ASSEMBLIES += bare/System bare/System.Xml @@ -13,6 +13,7 @@ ASSEMBLIES += bare/System bare/System.Xml # for i in *.dll; do ikdasm --assemblyref $i | grep Name= | sed 's/.*Name=//g' | sed -e $'s/$/\\\n/g' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' -e "s/^/${i%.*}_REFS := /"; done System.Core_REFS := mscorlib System System.Net.Http_REFS := mscorlib System +Mono.Android_REFS := mscorlib System.Numerics_REFS := mscorlib System_REFS := mscorlib bare/System.Xml System.Xml_REFS := mscorlib System @@ -21,13 +22,16 @@ bare/System_REFS := mscorlib bare/System.Xml_REFS := mscorlib bare/System mscorlib_CSC_ARGS := -runtimemetadataversion:v4.0.30319 -System_CSC_ARGS := ../../src/Mono/System.extra.cs +System_CSC_ARGS := ../../src/mono/System.extra.cs ECMA_KEY := ../../../../../mono/mcs/class/ecma.pub # Public Key Token: b77a5c561934e089 ECMA_KEY_ASSEMBLIES := System.Core System.Net.Http System.Numerics System.Xml System mscorlib \ bare/System bare/System.Xml +# Mono.Android must be signed with a different key (copied from xamarin-android repository) +Mono.Android_KEYFILE := xa.pub + all: $(addsuffix .dll, $(ASSEMBLIES)) clean: diff --git a/external/binary-reference-assemblies/build/monodroid/Mono.Android.dll b/external/binary-reference-assemblies/build/monodroid/Mono.Android.dll new file mode 100644 index 0000000000000000000000000000000000000000..91ad478f502e0b3d467b2c1ea758d8b945b6dc33 GIT binary patch literal 5120 zcmeHLYit}>6+SbzH@4HJ4#nwpr!wbRyy6tCA#>%?{z@5XUyD`$50dOc)z zW|@cMbw%ZfHl?jV!7Zu;L8LEKB!o~~sTNYG6!B065q}_nKqLi;myjx2iAO1f@7&q( z&e~DL4}Mgl*SX(4k9*EN_uR+c$@nLZQxg$2qh7c`w1Sq)pu|hV64aY+{Pre#rR~ht z6=m$q*8H65X%*Kgxq4YMblY}(tspcvur<@xhWF>RvQrev%P()=R&$*lAsSPf=)|eh zPe-Gjr<=5mN{Z+*ND`s+*;~+RsDr3P9gZF?}oedt!Xj7Yjc47ux~Q$+_0z1}BR~bSUY1 zt^rQQHVA?zx(PK_1`&PI6_$gJoH9Cu%Dz5;8Y_cDLors84|85oI5w49D60__+lcV5 zp}f*fwA3KEI5U*nJEV{zl^n}_Uow^KP4({VXHg4Tz>|or>mkI7e9xhF<$Tw)OCI;| zvEDqzt^+w*0L@F+b@zeMVYHtG|0}i~vYY~VE?||beo~9~9i^AHKmhqws5}RzuSDfk zFukGHh7ks8*e2)-^{;Az{-GQL9;ffBSI~AumY`eIXCV2t!uY7fPfGkFu_Phs?@3&d z5}UR(C8$SXd_iHK8R_|X`WfgS(=_DE>g~V@g)uKBdx^*WoO%q?3FBl`s7>jh6?Im< zS8@u1eHq*XtGdZ1)~U6g*HN4sY~b1(I9>XT>^fI}9pzKB`hvs!F5HmAW_6*0h%mR%&wv$ZTMb|Nlbt{_Ue)(!e&;fg1 zxaO>>7c7y%U7GfBb_#(nXhHAtWm z)5oN2OvCWk_oxk@6>iz|E+0GF= z<5-SMNy7(5-c7w^J08~Ei$t~1lB2dST&I!~?!1X@w^kkISGeo+(LSYcTOxLxmb!fu zYO=oGUU+Px5uzUQ)U};emS5IhPaj`?_De^9@Xj05q><9BDT>+x*u0s^O$@D)A8&ni z@&2i6`p!SLbdt8=0$3t?3XT$dBY>aGrFZhJuo-OT@zXDSA?pWx( zCp9tf+ef_bpPfG4r%rGE*NclA|8VlB&F7{jdY*h~Wnp<{D0|me^5@?C>KBjw;&*R9 zo;qkwKY0E58?EM!+n(roy7!ky2a@X2!?lHoCLK>pG7{EPwYr0PwCHZ>(P~F(_igw| z-jz)CXc-)bz!kgg@apK%vO&QzjeVk;cMc1Ccj1mZ^j*fT+jsW&_KDP;{hdl)?Z_QA zEAWIn$dG46c`wJNCR&^Mnr@MAl2(P^3n9 zySPP=bfR{JT7-Qo9y)};!pGtb9A{qLa?sT)6OKKyUy@Ih^Js0@3A7E*0Got zR)746mYLRK$`~2FJ44Y-#&L%&Yg{+&@V8KiFtbo!_%M8|9VX`Kee!>o0qkx#yL#PI zKYY<+b1yZH6>dlVc9YMe64WTZv?joh0{4VpU39AX&3}h) ztH?5JKUQOL2iMMQT|W#`fmfYe_%ZQKA>h-dS#o5jZSp;rhgOHwgI*^e{Ty&%`BwA0 zxCj))$cpgnz;_XR z5i#(W559HrffCtPWPDX*LzjM7ANkN=BWNDgf|ttbI2y(hvOm#Y8Ap_XVaPo)jjESDWJr5SJFqlMacG-j0lza~S4jf6WiCE_;vi#2l|$J=d4Y z%N$+<3T5HT!HNWk#*fXi?n7JM54_7X%!>D32^Km~Koagy-jg1DxHVq^D2}C1=D%^A wwX0CiKd%MRozf-^e;$04u{$kfk8{TPF;b1{7hv6%mFR)5O_04 zFitw-g>%N%Si&>{SRwtWdJE{F)db&GPArqMxOkFZLQp=PRNwEPm4?~o^NKK6X;^z5 O;2&%R5HgD_mowWuAwoC+ literal 0 HcmV?d00001 diff --git a/external/binary-reference-assemblies/build/monotouch/Makefile b/external/binary-reference-assemblies/build/monotouch/Makefile index e1ae21744d..c9f7d1013b 100644 --- a/external/binary-reference-assemblies/build/monotouch/Makefile +++ b/external/binary-reference-assemblies/build/monotouch/Makefile @@ -21,7 +21,7 @@ bare/System_REFS := mscorlib bare/System.Xml_REFS := mscorlib bare/System mscorlib_CSC_ARGS := -runtimemetadataversion:v4.0.30319 -System_CSC_ARGS := ../../src/Mono/System.extra.cs +System_CSC_ARGS := ../../src/mono/System.extra.cs ECMA_KEY := ../../../../../mono/mcs/class/ecma.pub # Public Key Token: b77a5c561934e089 diff --git a/external/binary-reference-assemblies/build/monotouch/System.Core.dll.REMOVED.git-id b/external/binary-reference-assemblies/build/monotouch/System.Core.dll.REMOVED.git-id index c166785b55..0e03f0b68e 100644 --- a/external/binary-reference-assemblies/build/monotouch/System.Core.dll.REMOVED.git-id +++ b/external/binary-reference-assemblies/build/monotouch/System.Core.dll.REMOVED.git-id @@ -1 +1 @@ -017028776b0688971391ac5e1e75f5b90cbc3d6b \ No newline at end of file +704d3e02dbd43691d785ec24bee712fe05eaec9f \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/monodroid/Mono.Android.cs b/external/binary-reference-assemblies/src/monodroid/Mono.Android.cs new file mode 100644 index 0000000000..2eb16f4d57 --- /dev/null +++ b/external/binary-reference-assemblies/src/monodroid/Mono.Android.cs @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +[assembly:System.Runtime.CompilerServices.ReferenceAssemblyAttribute] +[assembly:System.Reflection.AssemblyVersionAttribute("0.0.0.0")] +[assembly:System.CLSCompliantAttribute(true)] +[assembly:System.Diagnostics.DebuggableAttribute((System.Diagnostics.DebuggableAttribute.DebuggingModes)(2))] +[assembly:System.Reflection.AssemblyCompanyAttribute("Mono development team")] +[assembly:System.Reflection.AssemblyCopyrightAttribute("(c) Various Mono authors")] +[assembly:System.Reflection.AssemblyDefaultAliasAttribute("Mono.Android.dll")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("Mono.Android.dll")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("0.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("0.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("Mono.Android.dll")] +[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")] +[assembly:System.Resources.SatelliteContractVersionAttribute("0.0.0.0")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.InteropServices.ComVisibleAttribute(false)] +[assembly:System.Security.SecurityCriticalAttribute] +[assembly:System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.RequestMinimum, SkipVerification=true)] +namespace System.Drawing +{ + public struct Color {} + public enum KnownColor {} + public struct Point {} + public struct PointF {} + public struct Rectangle {} + public struct RectangleF {} + public struct Size {} + public struct SizeF {} +} \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/monodroid/System.Core.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/monodroid/System.Core.cs.REMOVED.git-id index e3fba8c5e0..5ad872dbaf 100644 --- a/external/binary-reference-assemblies/src/monodroid/System.Core.cs.REMOVED.git-id +++ b/external/binary-reference-assemblies/src/monodroid/System.Core.cs.REMOVED.git-id @@ -1 +1 @@ -1677ef1e7504f41839769cf611c93149e1d4800f \ No newline at end of file +68a6c7b04a1ce236a21c3f5a02452eebd9f167b7 \ No newline at end of file diff --git a/external/binary-reference-assemblies/src/monotouch/System.Core.cs.REMOVED.git-id b/external/binary-reference-assemblies/src/monotouch/System.Core.cs.REMOVED.git-id index 9ef115c4eb..a989b2121f 100644 --- a/external/binary-reference-assemblies/src/monotouch/System.Core.cs.REMOVED.git-id +++ b/external/binary-reference-assemblies/src/monotouch/System.Core.cs.REMOVED.git-id @@ -1 +1 @@ -7beebcc3cdb0bf41205daab75b21a8a91b5f1c0d \ No newline at end of file +39ff3fef0094d063b39ccb13d163f80cf5532e89 \ No newline at end of file diff --git a/external/binary-reference-assemblies/v4.7.1/Makefile b/external/binary-reference-assemblies/v4.7.1/Makefile index 0bcf238661..badf35b782 100644 --- a/external/binary-reference-assemblies/v4.7.1/Makefile +++ b/external/binary-reference-assemblies/v4.7.1/Makefile @@ -258,7 +258,7 @@ Facades/System.Xml.XmlSerializer_REFS := mscorlib System.Xml Facades/netstandard_REFS := mscorlib System System.Core System.Data System.Diagnostics.Tracing System.Drawing System.IO.Compression System.IO.Compression.FileSystem System.ComponentModel.Composition System.Net.Http System.Numerics System.Runtime.Serialization System.Transactions System.Web System.Xml System.Xml.Linq mscorlib_CSC_ARGS := -runtimemetadataversion:v4.0.30319 -System_CSC_ARGS := -d:CONFIG_DEP -d:XML_DEP ../src/Mono/System.extra.cs +System_CSC_ARGS := -d:CONFIG_DEP -d:XML_DEP ../src/mono/System.extra.cs System.Configuration_CSC_ARGS := -d:CONFIG_DEP System.Xml_CSC_ARGS := -d:CONFIG_DEP System.ServiceModel.Activation_CSC_ARGS := -d:SERVICEMODEL_DEP -d:WEB_DEP diff --git a/external/bockbuild/bb b/external/bockbuild/bb index af913c8f98..a3b0cfec33 100755 --- a/external/bockbuild/bb +++ b/external/bockbuild/bb @@ -207,6 +207,9 @@ class Bockbuild: elif not os.path.exists(package.build_artifact): package.request_build('No artifact') + elif is_expired(package.build_artifact, config.artifact_lifespan_days): + package.request_build('Artifact expired (older than %d days)' % config.artifact_lifespan_days) + elif is_changed(package.buildstring, package.buildstring_file): package.request_build('Updated') diff --git a/external/bockbuild/bockbuild.py b/external/bockbuild/bockbuild.py index af913c8f98..a3b0cfec33 100755 --- a/external/bockbuild/bockbuild.py +++ b/external/bockbuild/bockbuild.py @@ -207,6 +207,9 @@ class Bockbuild: elif not os.path.exists(package.build_artifact): package.request_build('No artifact') + elif is_expired(package.build_artifact, config.artifact_lifespan_days): + package.request_build('Artifact expired (older than %d days)' % config.artifact_lifespan_days) + elif is_changed(package.buildstring, package.buildstring_file): package.request_build('Updated') diff --git a/external/bockbuild/bockbuild/darwinprofile.py b/external/bockbuild/bockbuild/darwinprofile.py index 1f6da4aebe..5987d7f371 100644 --- a/external/bockbuild/bockbuild/darwinprofile.py +++ b/external/bockbuild/bockbuild/darwinprofile.py @@ -122,11 +122,11 @@ class DarwinProfile (UnixProfile): self.gcc_flags.extend(['-O0', '-ggdb3']) if os.getenv('BOCKBUILD_USE_CCACHE') is None: - self.env.set('CC', 'xcrun gcc') - self.env.set('CXX', 'xcrun g++') + self.env.set('CC', 'xcrun clang') + self.env.set('CXX', 'xcrun clang++') else: - self.env.set('CC', 'ccache xcrun gcc') - self.env.set('CXX', 'ccache xcrun g++') + self.env.set('CC', 'ccache xcrun clang') + self.env.set('CXX', 'ccache xcrun clang++') if self.bockbuild.cmd_options.arch == 'default': self.bockbuild.cmd_options.arch = 'darwin-32' @@ -139,7 +139,7 @@ class DarwinProfile (UnixProfile): package.local_ld_flags = ['-arch i386', '-m32'] package.local_gcc_flags = ['-arch i386', '-m32'] package.local_configure_flags = [ - '--build=i386-apple-darwin11.2.0', '--disable-dependency-tracking'] + '--build=i386-apple-darwin13.0.0', '--disable-dependency-tracking'] elif arch == 'darwin-64': package.local_ld_flags = ['-arch x86_64 -m64'] package.local_gcc_flags = ['-arch x86_64 -m64'] diff --git a/external/bockbuild/bockbuild/util/util.py b/external/bockbuild/bockbuild/util/util.py index 15a8cef7a3..96233cc311 100644 --- a/external/bockbuild/bockbuild/util/util.py +++ b/external/bockbuild/bockbuild/util/util.py @@ -11,6 +11,7 @@ import shutil import tarfile import hashlib import stat +from datetime import datetime,timedelta import functools # from @@ -44,6 +45,7 @@ class config: absolute_root = None # there is no file resolution beneath this path. Displayed paths are shortened by omitting this segment. state_root = None exit_code = exit_codes.NOTSET + artifact_lifespan_days = 7 class CommandException (Exception): # shell command failure @@ -298,6 +300,9 @@ def is_changed(new, file, show_diff=True): else: return False +def is_expired (path, age_cutoff_days): + artifact_age_days = (datetime.utcnow() - datetime.utcfromtimestamp(os.path.getmtime(path))).days + return artifact_age_days > age_cutoff_days def get_filetype(path): # the env variables are to work around a issue with OS X and 'file': diff --git a/external/bockbuild/packages/autoconf.py b/external/bockbuild/packages/autoconf.py index 45f4c32fd9..7741a6e1a0 100644 --- a/external/bockbuild/packages/autoconf.py +++ b/external/bockbuild/packages/autoconf.py @@ -18,7 +18,7 @@ class Autoconf (GnuPackage): elif arch == 'darwin-32': self.local_ld_flags = ['-arch i386', '-m32'] self.local_gcc_flags = ['-arch i386', '-m32'] - self.local_configure_flags = ['--build=i386-apple-darwin11.2.0'] + self.local_configure_flags = ['--build=i386-apple-darwin13.0.0'] elif arch == 'darwin-64': self.local_ld_flags = ['-arch x86_64 -m64'] self.local_gcc_flags = ['-arch x86_64 -m64'] diff --git a/external/bockbuild/packages/automake.py b/external/bockbuild/packages/automake.py index c94665af26..c9cd305093 100644 --- a/external/bockbuild/packages/automake.py +++ b/external/bockbuild/packages/automake.py @@ -13,7 +13,7 @@ class Automake (GnuPackage): elif arch == 'darwin-32': self.local_ld_flags = ['-arch i386', '-m32'] self.local_gcc_flags = ['-arch i386', '-m32'] - self.local_configure_flags = ['--build=i386-apple-darwin11.2.0'] + self.local_configure_flags = ['--build=i386-apple-darwin13.0.0'] elif arch == 'darwin-64': self.local_ld_flags = ['-arch x86_64 -m64'] self.local_gcc_flags = ['-arch x86_64 -m64'] diff --git a/external/bockbuild/packages/patches/gtk/gtk-fix-find_nsview_at_pos-recursive.patch b/external/bockbuild/packages/patches/gtk/gtk-fix-find_nsview_at_pos-recursive.patch index ef090fac59..20c72fc5ed 100644 --- a/external/bockbuild/packages/patches/gtk/gtk-fix-find_nsview_at_pos-recursive.patch +++ b/external/bockbuild/packages/patches/gtk/gtk-fix-find_nsview_at_pos-recursive.patch @@ -1,13 +1,34 @@ diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c -index 195899b13b..844128e0b2 100644 +index 195899b13b..67e3f8ee17 100644 --- a/gdk/quartz/gdkevents-quartz.c +++ b/gdk/quartz/gdkevents-quartz.c -@@ -748,7 +748,7 @@ find_nsview_at_pos (GdkWindowImplQuartz *impl, gint x, gint y) +@@ -729,7 +729,7 @@ _gdk_quartz_events_send_map_event (GdkWindow *window) + } + + static NSView * +-find_nsview_at_pos (GdkWindowImplQuartz *impl, gint x, gint y) ++find_nsview_at_pos (GdkWindowImplQuartz *impl, gint x, gint y, bool dont_recurse) + { + NSView *view = impl->view; + guint n_subviews; +@@ -748,7 +748,10 @@ find_nsview_at_pos (GdkWindowImplQuartz *impl, gint x, gint y) if (r.origin.x <= x && r.origin.x + r.size.width >= x && r.origin.y <= y && r.origin.y + r.size.height >= y) { - NSView* child = find_nsview_at_pos (impl, x - r.origin.x, y - r.origin.y); -+ NSView* child = find_nsview_at_pos (sv, x - r.origin.x, y - r.origin.y); ++ if (dont_recurse) ++ return sv; ++ ++ NSView* child = find_nsview_at_pos (impl, x - r.origin.x, y - r.origin.y, TRUE); if (child != NULL) return child; else +@@ -932,7 +935,7 @@ find_window_for_ns_event (NSEvent *nsevent, + toplevel_private = (GdkWindowObject *)toplevel; + toplevel_impl = (GdkWindowImplQuartz *)toplevel_private->impl; + +- subview = find_nsview_at_pos (toplevel_impl, *x, *y); ++ subview = find_nsview_at_pos (toplevel_impl, *x, *y, FALSE); + if (subview != NULL && ![subview isKindOfClass:[GdkQuartzView class]]) { + g_signal_emit_by_name (toplevel, "native-child-event", + subview, nsevent); diff --git a/external/boringssl/CMakeLists.txt b/external/boringssl/CMakeLists.txt index 9bf6d1b488..5da9df3372 100644 --- a/external/boringssl/CMakeLists.txt +++ b/external/boringssl/CMakeLists.txt @@ -27,7 +27,12 @@ endif() #endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(C_CXX_FLAGS "-Wall -Wformat=2 -Wsign-compare -Wmissing-field-initializers -ggdb -fvisibility=hidden") + if(${CMAKE_SYSTEM_NAME} MATCHES "AIX" OR ${CMAKE_SYSTEM_NAME} MATCHES "OS400") + # XCOFF doesn't support -fvisibility=hidden, and we would prefer XCOFF debugging info. + set(C_CXX_FLAGS "-Wall -Wformat=2 -Wsign-compare -Wmissing-field-initializers -gxcoff") + else() + set(C_CXX_FLAGS "-Wall -Wformat=2 -Wsign-compare -Wmissing-field-initializers -ggdb -fvisibility=hidden") + endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_CXX_FLAGS}") if(ANDROID) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x ${C_CXX_FLAGS}") diff --git a/external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs b/external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs index dec3fcbeb3..4d75163d4b 100644 --- a/external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs +++ b/external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; internal partial class Interop diff --git a/external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs b/external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs index a2df9667e9..9d072a3b01 100644 --- a/external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs +++ b/external/corefx/src/Common/src/CoreLib/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; internal partial class Interop diff --git a/external/corefx/src/Common/src/CoreLib/System/ArraySegment.cs b/external/corefx/src/Common/src/CoreLib/System/ArraySegment.cs index 5680993a6f..8428176ede 100644 --- a/external/corefx/src/Common/src/CoreLib/System/ArraySegment.cs +++ b/external/corefx/src/Common/src/CoreLib/System/ArraySegment.cs @@ -16,7 +16,6 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; namespace System { diff --git a/external/corefx/src/Common/src/CoreLib/System/Buffers/Text/FormattingHelpers.CountDigits.cs b/external/corefx/src/Common/src/CoreLib/System/Buffers/Text/FormattingHelpers.CountDigits.cs index 794f78feb9..709ac4fba6 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Buffers/Text/FormattingHelpers.CountDigits.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Buffers/Text/FormattingHelpers.CountDigits.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; namespace System.Buffers.Text diff --git a/external/corefx/src/Common/src/CoreLib/System/Buffers/Utilities.cs b/external/corefx/src/Common/src/CoreLib/System/Buffers/Utilities.cs index 906fa8e02e..4f115fe9dd 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Buffers/Utilities.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Buffers/Utilities.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.CompilerServices; namespace System.Buffers diff --git a/external/corefx/src/Common/src/CoreLib/System/Char.cs b/external/corefx/src/Common/src/CoreLib/System/Char.cs index 01c0ae3f66..c403925f52 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Char.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Char.cs @@ -13,7 +13,6 @@ ===========================================================*/ using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs b/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs index b8fd8eb5e2..ca00ca282e 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs @@ -4,7 +4,6 @@ using System.Collections.ObjectModel; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Threading; diff --git a/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/ValueListBuilder.cs b/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/ValueListBuilder.cs index 5fbeeec9c3..72da4a9e19 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/ValueListBuilder.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/ValueListBuilder.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Buffers; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.CompilerServices; namespace System.Collections.Generic diff --git a/external/corefx/src/Common/src/CoreLib/System/Collections/HashHelpers.cs b/external/corefx/src/Common/src/CoreLib/System/Collections/HashHelpers.cs index 3524b56361..49cff85b58 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Collections/HashHelpers.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Collections/HashHelpers.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Threading; diff --git a/external/corefx/src/Common/src/CoreLib/System/Convert.Base64.cs b/external/corefx/src/Common/src/CoreLib/System/Convert.Base64.cs index ba9f52feaa..7e2aee31b2 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Convert.Base64.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Convert.Base64.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Internal.Runtime.CompilerServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Convert.cs b/external/corefx/src/Common/src/CoreLib/System/Convert.cs index 6f1b764a50..63342ad000 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Convert.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Convert.cs @@ -11,7 +11,6 @@ using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Diagnostics; -using System.Diagnostics.Private; namespace System { diff --git a/external/corefx/src/Common/src/CoreLib/System/Globalization/CharUnicodeInfo.cs b/external/corefx/src/Common/src/CoreLib/System/Globalization/CharUnicodeInfo.cs index 40b232b290..0cd8429bbc 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Globalization/CharUnicodeInfo.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Globalization/CharUnicodeInfo.cs @@ -13,7 +13,6 @@ //////////////////////////////////////////////////////////////////////////// using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Globalization { diff --git a/external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.Invariant.cs b/external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.Invariant.cs index 69f4b4e095..29e4f53212 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.Invariant.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.Invariant.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.InteropServices; namespace System.Globalization diff --git a/external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.cs b/external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.cs index 76b65b9895..e43abcee3a 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.cs @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////////////// using System.Reflection; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Buffers; diff --git a/external/corefx/src/Common/src/CoreLib/System/Globalization/DateTimeParse.cs.REMOVED.git-id b/external/corefx/src/Common/src/CoreLib/System/Globalization/DateTimeParse.cs.REMOVED.git-id index 66e593593d..ffc4070332 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Globalization/DateTimeParse.cs.REMOVED.git-id +++ b/external/corefx/src/Common/src/CoreLib/System/Globalization/DateTimeParse.cs.REMOVED.git-id @@ -1 +1 @@ -acebfa84959b21d0d61454b995ae04fdc33b3bcd \ No newline at end of file +970d1765bb32a4d94bf196a4494ce22b095e4f1c \ No newline at end of file diff --git a/external/corefx/src/Common/src/CoreLib/System/Globalization/TimeSpanFormat.cs b/external/corefx/src/Common/src/CoreLib/System/Globalization/TimeSpanFormat.cs index 075f1eae3a..31e8137a99 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Globalization/TimeSpanFormat.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Globalization/TimeSpanFormat.cs @@ -4,7 +4,6 @@ using System.Text; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; namespace System.Globalization diff --git a/external/corefx/src/Common/src/CoreLib/System/Globalization/TimeSpanParse.cs b/external/corefx/src/Common/src/CoreLib/System/Globalization/TimeSpanParse.cs index c6475e02d9..fd09023ccd 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Globalization/TimeSpanParse.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Globalization/TimeSpanParse.cs @@ -49,7 +49,6 @@ //////////////////////////////////////////////////////////////////////////// using System.Diagnostics; -using System.Diagnostics.Private; using System.Text; namespace System.Globalization diff --git a/external/corefx/src/Common/src/CoreLib/System/Guid.cs b/external/corefx/src/Common/src/CoreLib/System/Guid.cs index 3a39253376..dfb314e0a5 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Guid.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Guid.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Lazy.cs b/external/corefx/src/Common/src/CoreLib/System/Lazy.cs index b4d21ac74b..d74dd56400 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Lazy.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Lazy.cs @@ -13,7 +13,6 @@ #pragma warning disable 0420 using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using System.Threading; diff --git a/external/corefx/src/Common/src/CoreLib/System/Marvin.cs b/external/corefx/src/Common/src/CoreLib/System/Marvin.cs index 2a49db3b0e..70af700373 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Marvin.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Marvin.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Internal.Runtime.CompilerServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Memory.cs b/external/corefx/src/Common/src/CoreLib/System/Memory.cs index bcabfb857e..20134c2ebc 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Memory.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Memory.cs @@ -4,7 +4,6 @@ using System.Buffers; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; #if !MONO diff --git a/external/corefx/src/Common/src/CoreLib/System/MemoryExtensions.Fast.cs b/external/corefx/src/Common/src/CoreLib/System/MemoryExtensions.Fast.cs index c190d3b6b9..d256887a9f 100644 --- a/external/corefx/src/Common/src/CoreLib/System/MemoryExtensions.Fast.cs +++ b/external/corefx/src/Common/src/CoreLib/System/MemoryExtensions.Fast.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Number.Formatting.cs b/external/corefx/src/Common/src/CoreLib/System/Number.Formatting.cs index f3cacf4faf..e8875d2eda 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Number.Formatting.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Number.Formatting.cs @@ -4,7 +4,6 @@ using System.Buffers.Text; using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Number.Parsing.cs b/external/corefx/src/Common/src/CoreLib/System/Number.Parsing.cs index 8297b38f2a..85a661e385 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Number.Parsing.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Number.Parsing.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/ParseNumbers.cs b/external/corefx/src/Common/src/CoreLib/System/ParseNumbers.cs index e5dc7d6567..dab4cb2190 100644 --- a/external/corefx/src/Common/src/CoreLib/System/ParseNumbers.cs +++ b/external/corefx/src/Common/src/CoreLib/System/ParseNumbers.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; namespace System diff --git a/external/corefx/src/Common/src/CoreLib/System/Progress.cs b/external/corefx/src/Common/src/CoreLib/System/Progress.cs index 5cec8e773e..755e7719fe 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Progress.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Progress.cs @@ -5,7 +5,6 @@ using System; using System.Threading; using System.Diagnostics; -using System.Diagnostics.Private; namespace System { diff --git a/external/corefx/src/Common/src/CoreLib/System/ReadOnlyMemory.cs b/external/corefx/src/Common/src/CoreLib/System/ReadOnlyMemory.cs index 08e111ab2a..c9f9a720b8 100644 --- a/external/corefx/src/Common/src/CoreLib/System/ReadOnlyMemory.cs +++ b/external/corefx/src/Common/src/CoreLib/System/ReadOnlyMemory.cs @@ -4,7 +4,6 @@ using System.Buffers; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; #if !MONO diff --git a/external/corefx/src/Common/src/CoreLib/System/ReadOnlySpan.Fast.cs b/external/corefx/src/Common/src/CoreLib/System/ReadOnlySpan.Fast.cs index 6f3e98bd37..2ca869c29c 100644 --- a/external/corefx/src/Common/src/CoreLib/System/ReadOnlySpan.Fast.cs +++ b/external/corefx/src/Common/src/CoreLib/System/ReadOnlySpan.Fast.cs @@ -6,7 +6,6 @@ using System.ComponentModel; #endif using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Internal.Runtime.CompilerServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Reflection/CustomAttributeFormatException.cs b/external/corefx/src/Common/src/CoreLib/System/Reflection/CustomAttributeFormatException.cs index 1d7d4a7671..8210144e56 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Reflection/CustomAttributeFormatException.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Reflection/CustomAttributeFormatException.cs @@ -7,7 +7,9 @@ using System.Runtime.Serialization; namespace System.Reflection { [Serializable] +#if !MONO [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#endif public class CustomAttributeFormatException : FormatException { public CustomAttributeFormatException() diff --git a/external/corefx/src/Common/src/CoreLib/System/Reflection/MemberInfo.cs b/external/corefx/src/Common/src/CoreLib/System/Reflection/MemberInfo.cs index d8a7458632..be2c92cb90 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Reflection/MemberInfo.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Reflection/MemberInfo.cs @@ -6,6 +6,9 @@ using System.Collections.Generic; namespace System.Reflection { +#if MONO + [Serializable] +#endif public abstract partial class MemberInfo : ICustomAttributeProvider { protected MemberInfo() { } diff --git a/external/corefx/src/Common/src/CoreLib/System/Resources/RuntimeResourceSet.cs b/external/corefx/src/Common/src/CoreLib/System/Resources/RuntimeResourceSet.cs index 2cc8353eff..a63e68c19d 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Resources/RuntimeResourceSet.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Resources/RuntimeResourceSet.cs @@ -21,7 +21,6 @@ using System.Globalization; using System.Reflection; using System.Runtime.Versioning; using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Resources { diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs index 966676f5fe..8f7b0c809c 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Threading.Tasks.Sources; diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ValueTaskAwaiter.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ValueTaskAwaiter.cs index b8eabed182..02b5910b77 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ValueTaskAwaiter.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ValueTaskAwaiter.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Threading.Tasks; using System.Threading.Tasks.Sources; diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/InteropServices/MemoryMarshal.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/InteropServices/MemoryMarshal.cs index 18577d2032..8eec0fd07c 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/InteropServices/MemoryMarshal.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/InteropServices/MemoryMarshal.cs @@ -5,7 +5,7 @@ using System.Buffers; using System.Runtime.CompilerServices; using System.Collections.Generic; -using System.Diagnostics.Private; +using System.Diagnostics; #if !netstandard using Internal.Runtime.CompilerServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/Serialization/SerializationInfoEnumerator.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/Serialization/SerializationInfoEnumerator.cs index b9df1016ce..6399510736 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/Serialization/SerializationInfoEnumerator.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/Serialization/SerializationInfoEnumerator.cs @@ -4,7 +4,6 @@ using System.Collections; using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Runtime.Serialization { diff --git a/external/corefx/src/Common/src/CoreLib/System/Span.Fast.cs b/external/corefx/src/Common/src/CoreLib/System/Span.Fast.cs index 3b6cb01d89..daf48181ab 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Span.Fast.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Span.Fast.cs @@ -6,7 +6,6 @@ using System.ComponentModel; #endif using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Internal.Runtime.CompilerServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.Byte.cs b/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.Byte.cs index f6be744081..0d802fb3e7 100644 --- a/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.Byte.cs +++ b/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.Byte.cs @@ -4,7 +4,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.CompilerServices; #if !netstandard diff --git a/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.Char.cs b/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.Char.cs index 1986ab4254..51ace58a39 100644 --- a/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.Char.cs +++ b/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.Char.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.CompilerServices; #if !netstandard diff --git a/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.T.cs b/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.T.cs index 3e075d944b..40139b523e 100644 --- a/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.T.cs +++ b/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.T.cs @@ -13,10 +13,6 @@ using Internal.Runtime.CompilerServices; using System.Numerics; #endif -#if MONO -using System.Diagnostics.Private; -#endif - namespace System { internal static partial class SpanHelpers diff --git a/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.cs b/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.cs index b014566771..32b4445d4b 100644 --- a/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.cs +++ b/external/corefx/src/Common/src/CoreLib/System/SpanHelpers.cs @@ -9,7 +9,6 @@ using System.Runtime.InteropServices; #if MONO using System.Runtime.CompilerServices; -using System.Diagnostics.Private; #else using Internal.Runtime.CompilerServices; #endif diff --git a/external/corefx/src/Common/src/CoreLib/System/String.Comparison.cs b/external/corefx/src/Common/src/CoreLib/System/String.Comparison.cs index fdb4704a96..32951b4aa5 100644 --- a/external/corefx/src/Common/src/CoreLib/System/String.Comparison.cs +++ b/external/corefx/src/Common/src/CoreLib/System/String.Comparison.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/String.Manipulation.cs b/external/corefx/src/Common/src/CoreLib/System/String.Manipulation.cs index 80d0251f33..69609aacfb 100644 --- a/external/corefx/src/Common/src/CoreLib/System/String.Manipulation.cs +++ b/external/corefx/src/Common/src/CoreLib/System/String.Manipulation.cs @@ -4,7 +4,7 @@ using System.Buffers; using System.Collections.Generic; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/String.cs b/external/corefx/src/Common/src/CoreLib/System/String.cs index 2e305d3d89..4ea8ce81b6 100644 --- a/external/corefx/src/Common/src/CoreLib/System/String.cs +++ b/external/corefx/src/Common/src/CoreLib/System/String.cs @@ -6,7 +6,6 @@ using System.Buffers; using System.Collections; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/ASCIIEncoding.cs b/external/corefx/src/Common/src/CoreLib/System/Text/ASCIIEncoding.cs index 4196fbec0c..76cf2d1b17 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/ASCIIEncoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/ASCIIEncoding.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; namespace System.Text diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/Decoder.cs b/external/corefx/src/Common/src/CoreLib/System/Text/Decoder.cs index 3fbe780a81..5a2966da00 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/Decoder.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/Decoder.cs @@ -5,7 +5,6 @@ using System.Text; using System; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; namespace System.Text diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/DecoderBestFitFallback.cs b/external/corefx/src/Common/src/CoreLib/System/Text/DecoderBestFitFallback.cs index 00233f7aab..30c817c91a 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/DecoderBestFitFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/DecoderBestFitFallback.cs @@ -7,7 +7,6 @@ // using System.Diagnostics; -using System.Diagnostics.Private; using System.Threading; namespace System.Text diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/DecoderFallback.cs b/external/corefx/src/Common/src/CoreLib/System/Text/DecoderFallback.cs index 4b004ff1d6..35bf1b01cc 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/DecoderFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/DecoderFallback.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; using System.Threading; diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/DecoderReplacementFallback.cs b/external/corefx/src/Common/src/CoreLib/System/Text/DecoderReplacementFallback.cs index 0fed203999..1dc41d8d22 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/DecoderReplacementFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/DecoderReplacementFallback.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Text { diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/Encoder.cs b/external/corefx/src/Common/src/CoreLib/System/Text/Encoder.cs index e3a26c7ccc..b1be60791b 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/Encoder.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/Encoder.cs @@ -5,7 +5,6 @@ using System.Text; using System; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; namespace System.Text diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/EncoderBestFitFallback.cs b/external/corefx/src/Common/src/CoreLib/System/Text/EncoderBestFitFallback.cs index 7687f3a70b..7f3be2a7a6 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/EncoderBestFitFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/EncoderBestFitFallback.cs @@ -7,7 +7,6 @@ // using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; using System.Threading; diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/EncoderFallback.cs b/external/corefx/src/Common/src/CoreLib/System/Text/EncoderFallback.cs index e2c28d5aaf..2a641c6144 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/EncoderFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/EncoderFallback.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Threading; namespace System.Text diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/EncoderReplacementFallback.cs b/external/corefx/src/Common/src/CoreLib/System/Text/EncoderReplacementFallback.cs index 289b370aba..ff97fbaf41 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/EncoderReplacementFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/EncoderReplacementFallback.cs @@ -5,7 +5,6 @@ using System; using System.Runtime; using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Text { diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/Encoding.cs b/external/corefx/src/Common/src/CoreLib/System/Text/Encoding.cs index 9056b1511b..e191ce14fd 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/Encoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/Encoding.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; using System.Threading; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/Latin1Encoding.cs b/external/corefx/src/Common/src/CoreLib/System/Text/Latin1Encoding.cs index 04661a71f3..335eb76e3c 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/Latin1Encoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/Latin1Encoding.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Text { diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs b/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs index d429a84fed..c129ecbaa1 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs @@ -13,7 +13,6 @@ using System.Security; using System.Threading; using System.Globalization; using System.Diagnostics; -using System.Diagnostics.Private; using System.Collections.Generic; namespace System.Text diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/UTF32Encoding.cs b/external/corefx/src/Common/src/CoreLib/System/Text/UTF32Encoding.cs index c52f415cac..608b0efff0 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/UTF32Encoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/UTF32Encoding.cs @@ -8,7 +8,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/UTF7Encoding.cs b/external/corefx/src/Common/src/CoreLib/System/Text/UTF7Encoding.cs index afb6d8d5b0..e22c82a03d 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/UTF7Encoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/UTF7Encoding.cs @@ -8,7 +8,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; namespace System.Text diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/UTF8Encoding.cs.REMOVED.git-id b/external/corefx/src/Common/src/CoreLib/System/Text/UTF8Encoding.cs.REMOVED.git-id index c995d7cc5c..23933c4684 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/UTF8Encoding.cs.REMOVED.git-id +++ b/external/corefx/src/Common/src/CoreLib/System/Text/UTF8Encoding.cs.REMOVED.git-id @@ -1 +1 @@ -54460587219b7aa1b8c5a7416dfc25cfbbb308c9 \ No newline at end of file +0ab3e8a5dc113743f9fafc2818f25f4fe8a065f0 \ No newline at end of file diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/UnicodeEncoding.cs b/external/corefx/src/Common/src/CoreLib/System/Text/UnicodeEncoding.cs index 049e1decdc..64d87a3207 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/UnicodeEncoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/UnicodeEncoding.cs @@ -9,7 +9,6 @@ using System; using System.Globalization; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; namespace System.Text diff --git a/external/corefx/src/Common/src/CoreLib/System/Text/ValueStringBuilder.cs b/external/corefx/src/Common/src/CoreLib/System/Text/ValueStringBuilder.cs index 65b7432d09..d41bea0be9 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/ValueStringBuilder.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/ValueStringBuilder.cs @@ -4,7 +4,6 @@ using System.Buffers; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/external/corefx/src/Common/src/CoreLib/System/Threading/AsyncLocal.cs b/external/corefx/src/Common/src/CoreLib/System/Threading/AsyncLocal.cs index 053e8cc6c0..3531265bec 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Threading/AsyncLocal.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Threading/AsyncLocal.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Threading { diff --git a/external/corefx/src/Common/src/CoreLib/System/Threading/LazyInitializer.cs b/external/corefx/src/Common/src/CoreLib/System/Threading/LazyInitializer.cs index 6f3ea7b438..f422ab9172 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Threading/LazyInitializer.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Threading/LazyInitializer.cs @@ -9,7 +9,6 @@ // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Threading { diff --git a/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/TaskToApm.cs b/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/TaskToApm.cs index 192f7fff7f..add41f588e 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/TaskToApm.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/TaskToApm.cs @@ -16,7 +16,7 @@ // return TaskToApm.End(asyncResult); // } -using System.Diagnostics.Private; +using System.Diagnostics; namespace System.Threading.Tasks { diff --git a/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs b/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs index c46d993d9f..8ee1a2026e 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs @@ -8,10 +8,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading.Tasks.Sources; -#if MONO -using System.Diagnostics.Private; -#endif - #if !netstandard using Internal.Runtime.CompilerServices; #endif diff --git a/external/corefx/src/System.Security.Cryptography.Encoding/src/Internal/Cryptography/Helpers.cs b/external/corefx/src/Common/src/Internal/Cryptography/Helpers.cs similarity index 92% rename from external/corefx/src/System.Security.Cryptography.Encoding/src/Internal/Cryptography/Helpers.cs rename to external/corefx/src/Common/src/Internal/Cryptography/Helpers.cs index c23569cd28..b6cb93f220 100644 --- a/external/corefx/src/System.Security.Cryptography.Encoding/src/Internal/Cryptography/Helpers.cs +++ b/external/corefx/src/Common/src/Internal/Cryptography/Helpers.cs @@ -8,7 +8,7 @@ using System.Security.Cryptography; namespace Internal.Cryptography { - internal static class Helpers + internal static partial class Helpers { public static byte[] CloneByteArray(this byte[] src) { @@ -21,4 +21,3 @@ namespace Internal.Cryptography } } } - diff --git a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFDate.cs b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFDate.cs index f20f3c2c4d..c3c6784160 100644 --- a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFDate.cs +++ b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFDate.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; diff --git a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFError.cs b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFError.cs index a69a9616d9..af3b5cd4c3 100644 --- a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFError.cs +++ b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFError.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; diff --git a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFString.cs b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFString.cs index 89ce48d51b..aa7a15054c 100644 --- a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFString.cs +++ b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.CFString.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; using Microsoft.Win32.SafeHandles; diff --git a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.cs b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.cs index 4c7fd5c84a..ff36ebc91f 100644 --- a/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.cs +++ b/external/corefx/src/Common/src/Interop/OSX/Interop.CoreFoundation.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; diff --git a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Err.cs b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Err.cs index eeaac1cf06..b33c9f41bf 100644 --- a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Err.cs +++ b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Err.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Security.Cryptography; using Microsoft.Win32.SafeHandles; diff --git a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Random.cs b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Random.cs index e18157754a..1ecb203ad3 100644 --- a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Random.cs +++ b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Random.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; using System.Security.Cryptography; diff --git a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.X509Store.cs b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.X509Store.cs index 4dd78e34a1..c12a763fb2 100644 --- a/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.X509Store.cs +++ b/external/corefx/src/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.X509Store.cs @@ -21,7 +21,7 @@ internal static partial class Interop [DllImport(Libraries.AppleCryptoNative)] private static extern int AppleCryptoNative_X509StoreRemoveCertificate( - SafeSecCertificateHandle cert, + SafeKeychainItemHandle cert, SafeKeychainHandle keychain, out int pOSStatus); @@ -42,7 +42,7 @@ internal static partial class Interop } } - internal static void X509StoreRemoveCertificate(SafeSecCertificateHandle certHandle, SafeKeychainHandle keychain) + internal static void X509StoreRemoveCertificate(SafeKeychainItemHandle certHandle, SafeKeychainHandle keychain) { int osStatus; int ret = AppleCryptoNative_X509StoreRemoveCertificate(certHandle, keychain, out osStatus); diff --git a/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeHandleCache.cs b/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeHandleCache.cs index c4044ce5a5..be29cff12a 100644 --- a/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeHandleCache.cs +++ b/external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeHandleCache.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; using System.Threading; diff --git a/external/corefx/src/Common/src/System/Collections/Concurrent/ConcurrentQueue_Segment.cs b/external/corefx/src/Common/src/System/Collections/Concurrent/ConcurrentQueue_Segment.cs index 0442462ecc..a85817776c 100644 --- a/external/corefx/src/Common/src/System/Collections/Concurrent/ConcurrentQueue_Segment.cs +++ b/external/corefx/src/Common/src/System/Collections/Concurrent/ConcurrentQueue_Segment.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; using System.Threading; diff --git a/external/corefx/src/Common/src/System/Security/Cryptography/AsnWriter.cs b/external/corefx/src/Common/src/System/Security/Cryptography/AsnWriter.cs index d0d40751ce..0fe0d42155 100644 --- a/external/corefx/src/Common/src/System/Security/Cryptography/AsnWriter.cs +++ b/external/corefx/src/Common/src/System/Security/Cryptography/AsnWriter.cs @@ -1214,7 +1214,13 @@ namespace System.Security.Cryptography.Asn1 #endif decimal decimalTicks = floatingTicks; + +#if __MonoCS__ + /* bug in mcs is making it pick the wrong overload, only manifesting in BE? */ + decimalTicks = decimal.Divide(decimalTicks, new decimal(TimeSpan.TicksPerSecond)); +#else decimalTicks /= TimeSpan.TicksPerSecond; +#endif if (!Utf8Formatter.TryFormat(decimalTicks, fraction, out int bytesWritten, new StandardFormat('G'))) { diff --git a/external/corefx/src/Common/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs b/external/corefx/src/Common/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs index 962c0ec4f1..ee54cd4c6a 100644 --- a/external/corefx/src/Common/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs +++ b/external/corefx/src/Common/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; namespace System.Threading.Tasks { diff --git a/external/corefx/src/Common/src/System/Threading/Tasks/RendezvousAwaitable.cs b/external/corefx/src/Common/src/System/Threading/Tasks/RendezvousAwaitable.cs index ddab8c338c..84134884f6 100644 --- a/external/corefx/src/Common/src/System/Threading/Tasks/RendezvousAwaitable.cs +++ b/external/corefx/src/Common/src/System/Threading/Tasks/RendezvousAwaitable.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; diff --git a/external/corefx/src/Native/Unix/System.Native/.libs/libmono_system_native_la-pal_io.o.REMOVED.git-id b/external/corefx/src/Native/Unix/System.Native/.libs/libmono_system_native_la-pal_io.o.REMOVED.git-id index 462559a4fd..35b08c3b2d 100644 --- a/external/corefx/src/Native/Unix/System.Native/.libs/libmono_system_native_la-pal_io.o.REMOVED.git-id +++ b/external/corefx/src/Native/Unix/System.Native/.libs/libmono_system_native_la-pal_io.o.REMOVED.git-id @@ -1 +1 @@ -0b6395439048c64f028d1a6ce60f24832e49662f \ No newline at end of file +8cf70f4c9bf61d50ad28b1eb014c0c9c366af434 \ No newline at end of file diff --git a/external/corefx/src/Native/Unix/System.Native/.libs/libmono_system_native_la-pal_random.o b/external/corefx/src/Native/Unix/System.Native/.libs/libmono_system_native_la-pal_random.o index 951c084145b29c63686399109b0a801324786fe2..42f6ae3d4a269d4b5fb8d69868d6996574560bbe 100644 GIT binary patch delta 2016 zcmZuyeN0v2tsGEz53d$Ckt8pf{WOmtb#>4;v zVVJo=PPa^=VHp4QW2u>FG6hW3#Tfa6KR`{EMva^E4>p%YGb7&H_ipJLPx9_P=XZYR zch7zA-S?Kd&v#9Rgf-_>?dH;hK*-Pogjsyzw*B>Qrut;Z2Q-TQc*FX_Bz)P?^0R&P zovD+(t#cIJ^=6hEy%U}Pj1UvK#tKLNTA%p(*z(*uwKe<2EWxz_25a-hO(r$uZVWd+z?T(ud~^7gh*;7Au=Wn0on)4#nDCsBgoT33a{$a-7#QCq%Xqa;8vLHt` zRL@fUo_5|jsDT~~8eQ#031EEISGJH;GLB^e`sq}~eB=D5bUecdY#;^`i>v8HEa}t6Z^5sx zk#{@WWN;Evxs@ogXlpInu7OkpJIyXUWv=gR=MRrO&E2>L>ByhZJ;S4c4I+2n$U)uQ zO`+M+)G6i?z1-z8OtkBNM0>gDNUpYvyD2G))6JN?s zkrqnEC8{ovC)2mBRe%w@WEeQyfArY%7`H!WH$AKq6&=(ynxbOBK=#pFyV=rBSBs}>xscWT=giBKv`0RlVRK^wF_&-I8CRyF#aI5 zLjYy3V*V)mp&?`$6W*9`EsWFNcJruRRT44djlnp|vLd7%*_)P>L&BT`r)Bz@1 z{6FklO6@yL_$9i@;eZtVoe`+9&jRD!RVnLXc0;H!jP0G*?!gSLdMYowB`>>I!wc08 zVLT|wujFNm@~Q^$2+fY=WxaXX$@FYcF~DWa)cEO*g^(1j*WO!J!It`oUd*-^;QTf2 z!9++p*jJF{=k8De{Fj$PwV4zi0Z-Ow5q|<{c~IY2LjLQIx!5 zXl^XS5FBuy_;+UJjLKQK@eZDVN!+d64?p0z5{A*#MP(u6kMim~;ftL`LN&qg5tKLs@~_Ru`{L_Lb}yqgIWt6xJ#X{R0r{>8XDX{d=T25 zRMWH|v_TDHx{P^&LKzHDu$odyq4d$c4HgF>0nxcBUN!3x%a~8f9v03)lICh1d-;yww8gYI>MMYtP!DOBu#9O^*nn?7o6m2GA^d>68XR*3 zJ+8$^$S>iP`@s!(!BNr87Zg5DK$y4WVhcFwO!9!Q#6SgA%BiePz&YNn0kblWW+$PG z21A^2@?&z(@&tZkj!Yhx)5Wq=iHxry>Z;J!`0I7>Ggev+aoy%w=BiWYz_My~FNkZM zi&|Uc^JnX%n-Gwl{SNITGTJwnDBag*p?2wx;#udCR{t!~AzfL97j65Wq8+j*&T8AF zJBo>{vO!G{3ac3@5q^~zRo265%SU9mXtqY{a^c43AnC5YS1iLv<}zi|yf>`R4q}Zf zGnMD^Lf$mrcrxBhj}Yv`rP&LLB$LJHwJ|L%#4}A*j#9_&JHRj4M=GVV$XQcNs*sZRzgcUi~Da zvtegX;M7?fA)4CtSc@emdYx3f-9+P;S5{PE zme!ywbYn9OJyrOU)&QM2rNy1U8s`~f*U%S?DaWd?IoRMl=QS%iaX1)*OE?vbE2`hz zSUsX-`mtGWfC)_MacIRUJ?=bNU@D$PUqQ@S8!{tLDp4?^(9)(0KZLvJE7DZ{WOJyJ zUv&sCfai;DiH-U+R0u3}Ayf>}kIWK`f607P{^2J%*;E=HPQx$bbV$>Uqn%K$;@crr ze_>--gQeIT)}k9|Vs1Q#9~?4gOB!C9hIirHVNHKtu>6qYN~s#c^TfWK#^$B5M-YlN zIF{0j;||)e^%e6s>Efm53SR6@y112F@NZ0*HCgam0`Iio@|zjJQx)3QK?^HC@C~OLWKwC*LcwEV^>(y2F=D=CR=NaR)5; zDKni#E%?u(PQ8iaFA<;KVad5Iw42daso|rQImI^7Du2@AVc?8W!k PTe%CK!f2`XN>%Vb&G>-S diff --git a/external/corefx/src/Native/Unix/System.Native/libmono_system_native_la-pal_io.o.REMOVED.git-id b/external/corefx/src/Native/Unix/System.Native/libmono_system_native_la-pal_io.o.REMOVED.git-id index 4d2e62b974..0eae103bab 100644 --- a/external/corefx/src/Native/Unix/System.Native/libmono_system_native_la-pal_io.o.REMOVED.git-id +++ b/external/corefx/src/Native/Unix/System.Native/libmono_system_native_la-pal_io.o.REMOVED.git-id @@ -1 +1 @@ -b42726008d127699b52b925977d223d6e417b7cf \ No newline at end of file +b5f68f2a1003027fe6aa20f56c4c7f5b92efee04 \ No newline at end of file diff --git a/external/corefx/src/Native/Unix/System.Native/libmono_system_native_la-pal_random.o b/external/corefx/src/Native/Unix/System.Native/libmono_system_native_la-pal_random.o index ae5f08b7936559b8b3d4dfb965b57b0d14f5a971..a702cd72d0ffd7fe453b1a3db5a166036efc78eb 100644 GIT binary patch delta 2051 zcmZuyZERCj7(VCTw(ITI-t~jt-fnB}ShtmZwoA6|19utB;C_&7OGh?^DZ~+{3C=Ji zV(b_oaS>tT&88$K8woM~zz=MKXrgSvAjAaOejs2Xf+VuQkEz5+ROUIo=X9m|U(a|>cKz?&}Vyo)}C; zYgOzHvy8Z zzVmO|2pJe{;VzepB3CRyqXo6nL$ zCFe3x7f^TdfxQ$%L{==jcMk3vejeK7O|rGpBD-c<{aTxG@) zU+>62EVMg(hs1V=cEBW-B%9s+7$@MkCnn_wjFo!fx+jKb!MRGu-#{0!7h!_fCYUGo zIdFP)X)1M05IPBc-k9`)#w(9|W90bHdv)9fPDK}H!_cj?N>}m>LImdgZaAfcgrzVn zD6JTQ)2B=0sT&8O1?cm|um%%8-L_peO8yn#hOYrX3rTwj?J2*3+!f$ye}fb$GQyuIA$iJQC6IT%UidDahg*dTz6vLbZop`u zC^-|*F#ZJQf(kwl^8rP@Y!s5;9H9d8{6p_rGHye$rbJctt!b8CKRnx#fzzcqz5%*4 z1$V%xrl`+kaOefVIXmDq$quosjbu`HH<{_!4Y!EG-sD3~x8Ni+l?O*Owo7RRZDf-2 z$f(Z37YrD+WZ`@>_cEL==^zj1ZO!8I^Z1g1uP1kev9Qj1-k(*lk>N+PaQ?3|1JSUe zew2~TeB*PlEv$6>%CfXM`n8wX2E3nzcd)g7&%!q|T!uNamY@FMWNrZ?|_`oaD{U{C+dD zv+wQhJM+M+?IV>+eeURj;(0y5*v>l`m!*l{y?f4#cIv(()rjz z=-&3_Cph}&andYu;zvHbP01`Vop}G4k^*;Kn;kecHA`~EJ2{_+d3U#xm-xoWxzvog z@TB|Xzq7ONSvd=rj^Imh4A1#~&Koa5aZFe~GzD*VNi%w5vUD3$k+Nyt8y2{NnB&Y& z{^9UK-Vgl6lkjHNiG=N_yGrIu#=&UYn35K;+Er5bw}8_ZB<+BxWn=wp2P+ttD_M+_ zuBb8$c-9|y#$E5bB5KUdZ7{gbojs3lOfE@tU~f{6mUV#&E37j)<}QQEjqCdcdTSnH zbUkeEi}w#~Fzudg+xj+>Nn4$;-gq~j_uS`K2hUm5wH8nZYtDCMN7QikJ;^%n0@Z3% z!L`0x9PyQ!7s)bD&OW8t6MRZ-_Jns?)WyjUd}{%Qu_`xef3eW)XbZ-3qi_Z%a%1or z&XE2Bi}GU7f?cF{;zVA|e#AI#jLqPsyr?~=$jsb}Re>msVOJmqFW^KVraV`L7XwZ9 zYUASK2eK{SkBwTXa;gfuwI=Aq2`y&-MbK1Di^5-66pT4O_L?KCWBx4)EjV5< z2B&drfd-!&`YW!ncK&p+@!Ht>-p&0ztan>i--cW3*+Be}9@Z}$mUI`E0KATokOs%G zi}YDsTBx;rEvDt~hTon4@P7cwuW2~H8?Kq~Y?atdJf8O`zhhQC);iN~(PAm#*`kpk_CMg=9PPT<(HaLu<D+L}wsMPev4Ax~9V;vZ&)FRy( mtRUIr8TfV4!vXA~nuju2xtFGJv{Hjl@wLiFVG|ZrE&LA(ZFf@u diff --git a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.c b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.c index d73fde5640..9ea234e584 100644 --- a/external/corefx/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.c +++ b/external/corefx/src/Native/Unix/System.Security.Cryptography.Native.Apple/pal_keychain.c @@ -384,5 +384,6 @@ AppleCryptoNative_X509StoreRemoveCertificate(CFTypeRef certOrIdentity, SecKeycha } *pOSStatus = DeleteInKeychain(cert, keychain); + CFRelease(cert); return *pOSStatus == noErr; } diff --git a/external/corefx/src/System.Buffers/src/System/Buffers/Utilities.cs b/external/corefx/src/System.Buffers/src/System/Buffers/Utilities.cs index 5fe6af5281..63ae1a99c7 100644 --- a/external/corefx/src/System.Buffers/src/System/Buffers/Utilities.cs +++ b/external/corefx/src/System.Buffers/src/System/Buffers/Utilities.cs @@ -2,11 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if INSIDE_CORLIB -using System.Diagnostics.Private; -#else using System.Diagnostics; -#endif using System.Runtime.CompilerServices; namespace System.Buffers diff --git a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs index 054ea9935d..4e854f5bb5 100644 --- a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs +++ b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs @@ -15,7 +15,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; -using System.Diagnostics.Private; using System.Reflection; using System.Runtime.CompilerServices; using System.Threading; diff --git a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs index 3f78e24527..7303f0cb61 100644 --- a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs +++ b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; using System.Threading; diff --git a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs index 55987e4b18..0ab98300b3 100644 --- a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs +++ b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs @@ -12,7 +12,6 @@ using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; using System.Threading; namespace System.Collections.Concurrent diff --git a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs index acd8c4207a..a289a593c5 100644 --- a/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs +++ b/external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs @@ -11,7 +11,7 @@ // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Collections.Generic; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Threading; namespace System.Collections.Concurrent diff --git a/external/corefx/src/System.Collections.NonGeneric/src/System/Collections/SortedList.cs b/external/corefx/src/System.Collections.NonGeneric/src/System/Collections/SortedList.cs index a8203471ca..d44054713f 100644 --- a/external/corefx/src/System.Collections.NonGeneric/src/System/Collections/SortedList.cs +++ b/external/corefx/src/System.Collections.NonGeneric/src/System/Collections/SortedList.cs @@ -13,7 +13,6 @@ ===========================================================*/ using System.Diagnostics; -using System.Diagnostics.Private; using System.Diagnostics.CodeAnalysis; using System.Globalization; diff --git a/external/corefx/src/System.Collections/src/System/Collections/BitArray.cs b/external/corefx/src/System.Collections/src/System/Collections/BitArray.cs index 9e05b0291b..c33fff93bb 100644 --- a/external/corefx/src/System.Collections/src/System/Collections/BitArray.cs +++ b/external/corefx/src/System.Collections/src/System/Collections/BitArray.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Collections { diff --git a/external/corefx/src/System.Collections/tests/Generic/Comparers/EqualityComparer.Generic.Tests.cs b/external/corefx/src/System.Collections/tests/Generic/Comparers/EqualityComparer.Generic.Tests.cs index 7b0cca21cc..67b4a23a5f 100644 --- a/external/corefx/src/System.Collections/tests/Generic/Comparers/EqualityComparer.Generic.Tests.cs +++ b/external/corefx/src/System.Collections/tests/Generic/Comparers/EqualityComparer.Generic.Tests.cs @@ -31,11 +31,7 @@ namespace System.Collections.Generic.Tests Assert.False(comparer.Equals(EqualityComparer>.Default)); } -#if MOBILE - [Fact(Skip="Mono issue #10807")] -#else [Fact] -#endif public void EqualityComparer_EqualsShouldBeOverriddenAndWorkForDifferentInstances_cloned() { var comparer = EqualityComparer.Default; diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigurationHost.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigurationHost.cs index d5b7e0435b..6e9a4d02fd 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigurationHost.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigurationHost.cs @@ -46,9 +46,13 @@ namespace System.Configuration { if (s_machineConfigFilePath == null) { +#if !MONO string directory = AppDomain.CurrentDomain.BaseDirectory; s_machineConfigFilePath = Path.Combine(Path.Combine(directory, MachineConfigSubdirectory), MachineConfigFilename); +#else + s_machineConfigFilePath = DefaultConfig.MachineConfigPath; +#endif } return s_machineConfigFilePath; diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ImplicitMachineConfigHost.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ImplicitMachineConfigHost.cs index 6edbe4d248..6357371fca 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ImplicitMachineConfigHost.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/ImplicitMachineConfigHost.cs @@ -51,17 +51,30 @@ namespace System.Configuration public override Stream OpenStreamForRead(string streamName) { +#if MONO + // if machine.config is embedded, use it instead of whatever is being requested + if ((s_embeddedMachineConfig != null) && (streamName == _machineStreamName)) + { + return new MemoryStream(Encoding.UTF8.GetBytes(s_embeddedMachineConfig)); + } +#endif + Stream stream = base.OpenStreamForRead(streamName); if (stream == null && streamName == _machineStreamName) { +#if MONO + throw new ConfigurationException ("Cannot find " + streamName); +#else // We only want to inject if we aren't able to load stream = new MemoryStream(Encoding.UTF8.GetBytes(s_implicitMachineConfig)); +#endif } return stream; } +#if !MONO private static string s_implicitMachineConfig = @" @@ -83,5 +96,10 @@ namespace System.Configuration "; + +#else + private static string s_embeddedMachineConfig = DefaultConfig.BundledMachineConfig; +#endif + } } diff --git a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/TypeUtil.cs b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/TypeUtil.cs index 67f16d23b6..b54e3a5dad 100644 --- a/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/TypeUtil.cs +++ b/external/corefx/src/System.Configuration.ConfigurationManager/src/System/Configuration/TypeUtil.cs @@ -7,9 +7,15 @@ using System.Reflection; namespace System.Configuration { - internal static class TypeUtil + internal static partial class TypeUtil { + +#if MONO + // Ensures we can load types from the old place. + internal const string ConfigurationManagerAssemblyName = "System.Configuration"; +#else internal const string ConfigurationManagerAssemblyName = "System.Configuration.ConfigurationManager"; +#endif // Deliberately not being explicit about the versions to make // things simpler for consumers of System.Configuration. diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeServerStream.Windows.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeServerStream.Windows.cs index 79fd46a218..2977001fe0 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeServerStream.Windows.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeServerStream.Windows.cs @@ -5,6 +5,7 @@ using Microsoft.Win32.SafeHandles; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; using System.Security; namespace System.IO.Pipes @@ -16,6 +17,12 @@ namespace System.IO.Pipes { // Creates the anonymous pipe. private void Create(PipeDirection direction, HandleInheritability inheritability, int bufferSize) + { + Create(direction, inheritability, bufferSize, null); + } + + // Creates the anonymous pipe. This overload is used in Mono to implement public constructors. + private void Create(PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity) { Debug.Assert(direction != PipeDirection.InOut, "Anonymous pipe direction shouldn't be InOut"); Debug.Assert(bufferSize >= 0, "bufferSize is negative"); @@ -25,14 +32,26 @@ namespace System.IO.Pipes SafePipeHandle newServerHandle; // Create the two pipe handles that make up the anonymous pipe. - Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = PipeStream.GetSecAttrs(inheritability); - if (direction == PipeDirection.In) + var pinningHandle = new GCHandle(); + try { - bSuccess = Interop.Kernel32.CreatePipe(out serverHandle, out _clientHandle, ref secAttrs, bufferSize); + Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = PipeStream.GetSecAttrs(inheritability, pipeSecurity, ref pinningHandle); + + if (direction == PipeDirection.In) + { + bSuccess = Interop.Kernel32.CreatePipe(out serverHandle, out _clientHandle, ref secAttrs, bufferSize); + } + else + { + bSuccess = Interop.Kernel32.CreatePipe(out _clientHandle, out serverHandle, ref secAttrs, bufferSize); + } } - else + finally { - bSuccess = Interop.Kernel32.CreatePipe(out _clientHandle, out serverHandle, ref secAttrs, bufferSize); + if (pinningHandle.IsAllocated) + { + pinningHandle.Free(); + } } if (!bSuccess) diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs index 472d9a9ea7..423cc3b17c 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs @@ -34,7 +34,11 @@ namespace System.IO.Pipes _pipeFlags |= (((int)_impersonationLevel - 1) << 16); } +#if MONO + int access = _access; +#else int access = 0; +#endif if ((PipeDirection.In & _direction) != 0) { access |= Interop.Kernel32.GenericOperations.GENERIC_READ; diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs index c4d755a50c..f4e7270bbd 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs @@ -66,6 +66,11 @@ namespace System.IO.Pipes HandleAcceptedSocket(accepted); } +#if __MonoCS__ + async Task WaitForConnectionAsyncCore() + => HandleAcceptedSocket(await _instance.ListeningSocket.AcceptAsync().ConfigureAwait(false)); +#endif + public Task WaitForConnectionAsync(CancellationToken cancellationToken) { CheckConnectOperationsServer(); @@ -78,8 +83,10 @@ namespace System.IO.Pipes Task.FromCanceled(cancellationToken) : WaitForConnectionAsyncCore(); +#if !__MonoCS__ async Task WaitForConnectionAsyncCore() => HandleAcceptedSocket(await _instance.ListeningSocket.AcceptAsync().ConfigureAwait(false)); +#endif } private void HandleAcceptedSocket(Socket acceptedSocket) diff --git a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs index 4a418aca5e..042dce8882 100644 --- a/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs +++ b/external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs @@ -23,6 +23,15 @@ namespace System.IO.Pipes private void Create(string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, HandleInheritability inheritability) + { + Create(pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, + outBufferSize, null, inheritability, 0); + } + + // This overload is used in Mono to implement public constructors. + private void Create(string pipeName, PipeDirection direction, int maxNumberOfServerInstances, + PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, + PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights) { Debug.Assert(pipeName != null && pipeName.Length != 0, "fullPipeName is null or empty"); Debug.Assert(direction >= PipeDirection.In && direction <= PipeDirection.InOut, "invalid pipe direction"); @@ -39,10 +48,10 @@ namespace System.IO.Pipes throw new ArgumentOutOfRangeException(nameof(pipeName), SR.ArgumentOutOfRange_AnonymousReserved); } - PipeSecurity pipeSecurity = null; - if (IsCurrentUserOnly) { + Debug.Assert(pipeSecurity == null); + using (WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent()) { SecurityIdentifier identifier = currentIdentity.Owner; @@ -64,7 +73,8 @@ namespace System.IO.Pipes int openMode = ((int)direction) | (maxNumberOfServerInstances == 1 ? Interop.Kernel32.FileOperations.FILE_FLAG_FIRST_PIPE_INSTANCE : 0) | - (int)options; + (int)options | + (int)additionalAccessRights; // We automatically set the ReadMode to match the TransmissionMode. int pipeModes = (int)transmissionMode << 2 | (int)transmissionMode << 1; diff --git a/external/corefx/src/System.Memory/src/System/Buffers/ReadOnlySequence.cs b/external/corefx/src/System.Memory/src/System/Buffers/ReadOnlySequence.cs index eeb9394702..f8d4046557 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/ReadOnlySequence.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/ReadOnlySequence.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; #if !FEATURE_PORTABLE_SPAN diff --git a/external/corefx/src/System.Memory/src/System/Buffers/ReadOnlySequence_helpers.cs b/external/corefx/src/System.Memory/src/System/Buffers/ReadOnlySequence_helpers.cs index b63ad1d1f7..a8ea4a232b 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/ReadOnlySequence_helpers.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/ReadOnlySequence_helpers.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.CompilerServices; #if !netstandard diff --git a/external/corefx/src/System.Memory/src/System/Buffers/StandardFormat.cs b/external/corefx/src/System.Memory/src/System/Buffers/StandardFormat.cs index 3354f6d7f2..6975c204f1 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/StandardFormat.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/StandardFormat.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; namespace System.Buffers { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/FormattingHelpers.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/FormattingHelpers.cs index a12d8d4475..b886ca75c4 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/FormattingHelpers.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/FormattingHelpers.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; namespace System.Buffers.Text diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.E.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.E.cs index 3379c04c47..6cde07ff7f 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.E.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.E.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.F.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.F.cs index fbede07af9..e2409f909b 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.F.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.F.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.G.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.G.cs index 56aa88b355..b8aa6d75ef 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.G.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.G.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; namespace System.Buffers.Text diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.cs index 791d36d9cc..f96136467f 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Decimal.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Float.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Float.cs index ac5b96dbf4..94591134c6 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Float.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Float.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; namespace System.Buffers.Text diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Signed.Default.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Signed.Default.cs index 7142d3bf4f..961c75a685 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Signed.Default.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Signed.Default.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; namespace System.Buffers.Text diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.Default.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.Default.cs index 0e48837915..78105839c0 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.Default.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.Default.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; namespace System.Buffers.Text diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.TimeSpan.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.TimeSpan.cs index a887c3ef1f..3f40291e46 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.TimeSpan.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.TimeSpan.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.G.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.G.cs index 0550c6a25b..ed18c7ba31 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.G.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.G.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.Helpers.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.Helpers.cs index 62fea7bd51..b284ba5488 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.Helpers.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.Helpers.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.O.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.O.cs index 47ac3af2ef..8d2c681f68 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.O.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.O.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.cs index c0b306bf5d..f103492461 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Date.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Number.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Number.cs index 8658bd56a3..527150963b 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Number.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Number.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.TimeSpan.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.TimeSpan.cs index bc0ce2e372..0ce810b392 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.TimeSpan.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.TimeSpan.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.TimeSpanSplitter.cs b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.TimeSpanSplitter.cs index d8ea39fbd7..0c72d1f3a2 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.TimeSpanSplitter.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/Utf8Parser.TimeSpanSplitter.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Buffers.Text { diff --git a/external/corefx/src/System.Memory/src/System/MemoryExtensions.Portable.cs b/external/corefx/src/System.Memory/src/System/MemoryExtensions.Portable.cs index f0227f97fe..c33b508355 100644 --- a/external/corefx/src/System.Memory/src/System/MemoryExtensions.Portable.cs +++ b/external/corefx/src/System.Memory/src/System/MemoryExtensions.Portable.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Private; +using System.Diagnostics; using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/external/corefx/src/System.Memory/src/System/Number/Number.FormatAndParse.cs b/external/corefx/src/System.Memory/src/System/Number/Number.FormatAndParse.cs index bddc2610b3..daebe39257 100644 --- a/external/corefx/src/System.Memory/src/System/Number/Number.FormatAndParse.cs +++ b/external/corefx/src/System.Memory/src/System/Number/Number.FormatAndParse.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Buffers.Text; #if !netstandard && !MONO diff --git a/external/corefx/src/System.Memory/src/System/ReadOnlySpan.Portable.cs b/external/corefx/src/System.Memory/src/System/ReadOnlySpan.Portable.cs index fef0d583a1..47bdaa385e 100644 --- a/external/corefx/src/System.Memory/src/System/ReadOnlySpan.Portable.cs +++ b/external/corefx/src/System.Memory/src/System/ReadOnlySpan.Portable.cs @@ -2,9 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if MONO -using System.Diagnostics.Private; -#endif using System.Diagnostics; using System.Runtime.CompilerServices; #if !MONO diff --git a/external/corefx/src/System.Memory/src/System/Span.Portable.cs b/external/corefx/src/System.Memory/src/System/Span.Portable.cs index 4f3435c3d0..9200830e00 100644 --- a/external/corefx/src/System.Memory/src/System/Span.Portable.cs +++ b/external/corefx/src/System.Memory/src/System/Span.Portable.cs @@ -3,9 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -#if MONO -using System.Diagnostics.Private; -#endif using System.Runtime.CompilerServices; #if !MONO using EditorBrowsableState = System.ComponentModel.EditorBrowsableState; diff --git a/external/corefx/src/System.Memory/src/System/SpanHelpers.cs b/external/corefx/src/System.Memory/src/System/SpanHelpers.cs index e2d154d8da..325c53c30e 100644 --- a/external/corefx/src/System.Memory/src/System/SpanHelpers.cs +++ b/external/corefx/src/System.Memory/src/System/SpanHelpers.cs @@ -3,9 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Reflection; -#if MONO -using System.Diagnostics.Private; -#endif +using System.Diagnostics; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.Unix.cs b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.Unix.cs index 0fd3087b60..eaec8cd2a2 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.Unix.cs +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.Unix.cs @@ -8,7 +8,10 @@ using System.Text; namespace System.Net.Sockets { /// Represents a Unix Domain Socket endpoint as a path. - public sealed partial class UnixDomainSocketEndPoint : EndPoint +#if !MONO + public +#endif + sealed partial class UnixDomainSocketEndPoint : EndPoint { private static readonly int s_nativePathOffset; private static readonly int s_nativePathLength; diff --git a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.cs b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.cs index 534df754d3..8d6dbf65de 100644 --- a/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.cs +++ b/external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.cs @@ -8,7 +8,10 @@ using System.Text; namespace System.Net.Sockets { /// Represents a Unix Domain Socket endpoint as a path. - public sealed partial class UnixDomainSocketEndPoint : EndPoint +#if !MONO + public +#endif + sealed partial class UnixDomainSocketEndPoint : EndPoint { private const AddressFamily EndPointAddressFamily = AddressFamily.Unix; diff --git a/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs b/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs index 9097d09348..149ac1dd5a 100644 --- a/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs +++ b/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Collections.ObjectModel { diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs b/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs index e3b8ed8a5b..9e0a5dace7 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs @@ -13,7 +13,6 @@ ===========================================================*/ using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Threading; diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/OperatingSystem.cs b/external/corefx/src/System.Runtime.Extensions/src/System/OperatingSystem.cs index 941fd3f8d9..1af20cbbf2 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/OperatingSystem.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/OperatingSystem.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.Serialization; namespace System diff --git a/external/corefx/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SerializationEventsCache.cs b/external/corefx/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SerializationEventsCache.cs index ee10099257..896afe1ea3 100644 --- a/external/corefx/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SerializationEventsCache.cs +++ b/external/corefx/src/System.Runtime.Serialization.Formatters/src/System/Runtime/Serialization/SerializationEventsCache.cs @@ -5,7 +5,6 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; using System.Reflection; namespace System.Runtime.Serialization diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Helpers.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Helpers.cs index ff68800a75..de1b49aff4 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Helpers.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Helpers.cs @@ -8,18 +8,8 @@ using System.Security.Cryptography; namespace Internal.Cryptography { - internal static class Helpers + internal static partial class Helpers { - public static byte[] CloneByteArray(this byte[] src) - { - if (src == null) - { - return null; - } - - return (byte[])(src.Clone()); - } - public static KeySizes[] CloneKeySizesArray(this KeySizes[] src) { return (KeySizes[])(src.Clone()); diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs index f10e1aeeea..8bb16762fc 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.OSX.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Security.Cryptography { diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs index f3f9de3ba1..9c2fd37401 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/RandomNumberGeneratorImplementation.Windows.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Security.Cryptography { diff --git a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj index 97332e9203..502d48d676 100644 --- a/external/corefx/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj +++ b/external/corefx/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj @@ -95,6 +95,9 @@ Internal\Cryptography\BasicSymmetricCipher.cs + + Internal\Cryptography\Helpers.cs + Internal\Cryptography\HashProvider.cs diff --git a/external/corefx/src/System.Security.Cryptography.Cng/src/Internal/Cryptography/Helpers.cs b/external/corefx/src/System.Security.Cryptography.Cng/src/Internal/Cryptography/Helpers.cs index 55bd7c77a4..9a0aeabb88 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/src/Internal/Cryptography/Helpers.cs +++ b/external/corefx/src/System.Security.Cryptography.Cng/src/Internal/Cryptography/Helpers.cs @@ -14,18 +14,8 @@ using ErrorCode = Interop.NCrypt.ErrorCode; namespace Internal.Cryptography { - internal static class Helpers + internal static partial class Helpers { - public static byte[] CloneByteArray(this byte[] src) - { - if (src == null) - { - return null; - } - - return (byte[])(src.Clone()); - } - public static bool UsesIv(this CipherMode cipherMode) { return cipherMode != CipherMode.ECB; diff --git a/external/corefx/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj b/external/corefx/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj index b6f007a07a..bc3eb88773 100644 --- a/external/corefx/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj +++ b/external/corefx/src/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj @@ -229,6 +229,9 @@ Internal\Cryptography\HashProviderCng.cs + + Internal\Cryptography\Helpers.cs + Internal\Cryptography\BasicSymmetricCipher.cs diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/Internal/Cryptography/Helpers.cs b/external/corefx/src/System.Security.Cryptography.Csp/src/Internal/Cryptography/Helpers.cs index 9e0d2b42b4..463569a857 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/Internal/Cryptography/Helpers.cs +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/Internal/Cryptography/Helpers.cs @@ -7,18 +7,8 @@ using System.Security.Cryptography; namespace Internal.Cryptography { - internal static class Helpers + internal static partial class Helpers { - public static byte[] CloneByteArray(this byte[] src) - { - if (src == null) - { - return null; - } - - return (byte[])(src.Clone()); - } - public static KeySizes[] CloneKeySizesArray(this KeySizes[] src) { return (KeySizes[])(src.Clone()); diff --git a/external/corefx/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj b/external/corefx/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj index 8d1718024f..f0f7a4a488 100644 --- a/external/corefx/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj +++ b/external/corefx/src/System.Security.Cryptography.Csp/src/System.Security.Cryptography.Csp.csproj @@ -30,6 +30,9 @@ + + Internal\Cryptography\Helpers.cs + diff --git a/external/corefx/src/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj b/external/corefx/src/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj index 388d4f36a6..7360fa7796 100644 --- a/external/corefx/src/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj +++ b/external/corefx/src/System.Security.Cryptography.Encoding/src/System.Security.Cryptography.Encoding.csproj @@ -16,7 +16,6 @@ - @@ -26,6 +25,9 @@ + + Internal\Cryptography\Helpers.cs + diff --git a/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Helpers.cs b/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Helpers.cs index abdce600b6..31d9471a5b 100644 --- a/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Helpers.cs +++ b/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Helpers.cs @@ -17,13 +17,8 @@ using X509IssuerSerial = System.Security.Cryptography.Xml.X509IssuerSerial; namespace Internal.Cryptography { - internal static class Helpers + internal static partial class Helpers { - public static byte[] CloneByteArray(this byte[] a) - { - return (byte[])(a.Clone()); - } - #if !netcoreapp // Compatibility API. internal static void AppendData(this IncrementalHash hasher, ReadOnlySpan data) diff --git a/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/Windows/PkcsPalWindows.cs b/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/Windows/PkcsPalWindows.cs index 6b62a3ab46..3b1e17808a 100644 --- a/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/Windows/PkcsPalWindows.cs +++ b/external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/Windows/PkcsPalWindows.cs @@ -54,7 +54,16 @@ namespace Internal.Cryptography.Pal.Windows public sealed override byte[] EncodeUtcTime(DateTime utcTime) { - long ft = utcTime.ToFileTimeUtc(); + long ft; + try + { + ft = utcTime.ToFileTimeUtc(); + } + catch (ArgumentException ex) + { + throw new CryptographicException(ex.Message, ex); + } + unsafe { return Interop.Crypt32.CryptEncodeObjectToByteArray(CryptDecodeObjectStructType.PKCS_UTC_TIME, &ft); diff --git a/external/corefx/src/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj b/external/corefx/src/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj index c26a748287..18f0c8b834 100644 --- a/external/corefx/src/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj +++ b/external/corefx/src/System.Security.Cryptography.Pkcs/src/System.Security.Cryptography.Pkcs.csproj @@ -65,6 +65,9 @@ + + Internal\Cryptography\Helpers.cs + diff --git a/external/corefx/src/System.Security.Cryptography.Pkcs/tests/Pkcs9AttributeTests.cs b/external/corefx/src/System.Security.Cryptography.Pkcs/tests/Pkcs9AttributeTests.cs index c5fcc19858..acb3b6bb8a 100644 --- a/external/corefx/src/System.Security.Cryptography.Pkcs/tests/Pkcs9AttributeTests.cs +++ b/external/corefx/src/System.Security.Cryptography.Pkcs/tests/Pkcs9AttributeTests.cs @@ -27,6 +27,19 @@ namespace System.Security.Cryptography.Pkcs.Tests Assert.Throws(() => ign = new Pkcs9AttributeObject(a)); } + [Fact] + public static void InputDateTimeAsWindowsFileTimeBefore1601() + { + DateTime dt = new DateTime(1600, 12, 31, 11, 59, 59, DateTimeKind.Utc); + AssertExtensions.Throws(() => new Pkcs9SigningTime(dt)); + } + + [Fact] + public static void Pkcs9SigningTime_DateTimeMinValue() + { + AssertExtensions.Throws(() => new Pkcs9SigningTime(DateTime.MinValue)); + } + [Fact] public static void InputDateTimeAsX509TimeBefore1950_Utc() { diff --git a/external/corefx/src/System.Security.Cryptography.ProtectedData/tests/ProtectedDataTests.cs b/external/corefx/src/System.Security.Cryptography.ProtectedData/tests/ProtectedDataTests.cs index 467c8d64c0..a8a5694357 100644 --- a/external/corefx/src/System.Security.Cryptography.ProtectedData/tests/ProtectedDataTests.cs +++ b/external/corefx/src/System.Security.Cryptography.ProtectedData/tests/ProtectedDataTests.cs @@ -15,6 +15,7 @@ namespace System.Security.Cryptography.ProtectedDataTests public static class ProtectedDataTests { [Fact] + [PlatformSpecific(TestPlatforms.Windows)] public static void RoundTrip() { RoundTrip(null); @@ -38,6 +39,7 @@ namespace System.Security.Cryptography.ProtectedDataTests [InlineData(DataProtectionScope.CurrentUser, true)] [InlineData(DataProtectionScope.LocalMachine, false)] [InlineData(DataProtectionScope.LocalMachine, true)] + [PlatformSpecific(TestPlatforms.Windows)] public static void ProtectEmptyData(DataProtectionScope scope, bool useEntropy) { // Use new byte[0] instead of Array.Empty to prove the implementation @@ -52,6 +54,7 @@ namespace System.Security.Cryptography.ProtectedDataTests } [Fact] + [PlatformSpecific(TestPlatforms.Windows)] public static void NullEntropyEquivalence() { // Passing a zero-length array as entropy is equivalent to passing null as entropy. @@ -63,6 +66,7 @@ namespace System.Security.Cryptography.ProtectedDataTests } [Fact] + [PlatformSpecific(TestPlatforms.Windows)] public static void NullEntropyEquivalence2() { // Passing a zero-length array as entropy is equivalent to passing null as entropy. @@ -74,6 +78,7 @@ namespace System.Security.Cryptography.ProtectedDataTests } [Fact] + [PlatformSpecific(TestPlatforms.Windows)] public static void WrongEntropy() { // Passing a zero-length array as entropy is equivalent to passing null as entropy. diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Helpers.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Helpers.cs index 0f7ef8989e..892b3243d6 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Helpers.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Helpers.cs @@ -4,23 +4,13 @@ using System; using System.Collections.Generic; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Globalization; namespace Internal.Cryptography { - internal static class Helpers + internal static partial class Helpers { - public static byte[] CloneByteArray(this byte[] src) - { - if (src == null) - { - return null; - } - - return (byte[])(src.Clone()); - } - // Encode a byte array as an array of upper-case hex characters. public static char[] ToHexArrayUpper(this byte[] bytes) { diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/CertificateData.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/CertificateData.cs index e52e8aaa37..30a1a5f56e 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/CertificateData.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/CertificateData.cs @@ -471,6 +471,9 @@ namespace Internal.Cryptography.Pal case DerSequenceReader.DerTag.UTF8String: value = tavReader.ReadUtf8String(); break; + case DerSequenceReader.DerTag.T61String: + value = tavReader.ReadT61String(); + break; // Ignore anything we don't know how to read. } diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/CertificatePal.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/CertificatePal.cs index 6121f17a6a..2c95b7ef8a 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/CertificatePal.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/CertificatePal.cs @@ -238,9 +238,7 @@ namespace Internal.Cryptography.Pal get { EnsureCertData(); - byte[] serial = _certData.SerialNumber; - Array.Reverse(serial); - return serial; + return _certData.SerialNumber; } } diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/StorePal.AppleKeychainStore.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/StorePal.AppleKeychainStore.cs index 980ddb0488..e221998a63 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/StorePal.AppleKeychainStore.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.OSX/StorePal.AppleKeychainStore.cs @@ -73,7 +73,8 @@ namespace Internal.Cryptography.Pal AppleCertificatePal applePal = (AppleCertificatePal)cert; - Interop.AppleCrypto.X509StoreRemoveCertificate(applePal.CertificateHandle, _keychainHandle); + var handle = (SafeKeychainItemHandle)applePal.IdentityHandle ?? applePal.CertificateHandle; + Interop.AppleCrypto.X509StoreRemoveCertificate(handle, _keychainHandle); } public SafeHandle SafeHandle => _keychainHandle; diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509CertificateReader.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509CertificateReader.cs index 2042037ccd..9715231691 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509CertificateReader.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509CertificateReader.cs @@ -102,12 +102,7 @@ namespace Internal.Cryptography.Pal { using (SafeSharedAsn1IntegerHandle serialNumber = Interop.Crypto.X509GetSerialNumber(_cert)) { - byte[] serial = Interop.Crypto.GetAsn1IntegerBytes(serialNumber); - - // Windows returns this in BigInteger Little-Endian, - // OpenSSL returns this in BigInteger Big-Endian. - Array.Reverse(serial); - return serial; + return Interop.Crypto.GetAsn1IntegerBytes(serialNumber); } } } diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/CertificatePal.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/CertificatePal.cs index 2d76ca9b33..ec4dace370 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/CertificatePal.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Windows/CertificatePal.cs @@ -199,6 +199,7 @@ namespace Internal.Cryptography.Pal { CERT_CONTEXT* pCertContext = _certContext.CertContext; byte[] serialNumber = pCertContext->pCertInfo->SerialNumber.ToByteArray(); + Array.Reverse(serialNumber); GC.KeepAlive(this); return serialNumber; } diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj index 09ad30e45e..e17e000d2f 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj @@ -26,6 +26,9 @@ Common\System\Security\Cryptography\DerSequenceReader.cs + + Internal\Cryptography\Helpers.cs + diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs index 1cc9c1b75b..2736053bd5 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate.cs @@ -443,14 +443,16 @@ namespace System.Security.Cryptography.X509Certificates public virtual byte[] GetSerialNumber() { ThrowIfInvalid(); - - return GetRawSerialNumber().CloneByteArray(); + byte[] serialNumber = GetRawSerialNumber().CloneByteArray(); + // PAL always returns big-endian, GetSerialNumber returns little-endian + Array.Reverse(serialNumber); + return serialNumber; } public virtual string GetSerialNumberString() { ThrowIfInvalid(); - + // PAL always returns big-endian, GetSerialNumberString returns big-endian too return GetRawSerialNumber().ToHexStringUpper(); } @@ -599,6 +601,9 @@ namespace System.Security.Cryptography.X509Certificates if (!culture.DateTimeFormat.Calendar.IsValidDay(date.Year, date.Month, date.Day, 0)) { + +// This is unnecessary dependency we cannot easily remove by linker +#if !MOBILE // The most common case of culture failing to work is in the Um-AlQuara calendar. In this case, // we can fall back to the Hijri calendar, otherwise fall back to the invariant culture. if (culture.DateTimeFormat.Calendar is UmAlQuraCalendar) @@ -607,6 +612,7 @@ namespace System.Security.Cryptography.X509Certificates culture.DateTimeFormat.Calendar = new HijriCalendar(); } else +#endif { culture = CultureInfo.InvariantCulture; } diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs index 124392b4c4..c54d441eb6 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs @@ -289,9 +289,7 @@ namespace System.Security.Cryptography.X509Certificates { get { - byte[] serialNumber = GetSerialNumber(); - Array.Reverse(serialNumber); - return serialNumber.ToHexStringUpper(); + return GetSerialNumberString(); } } diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/CertTests.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/CertTests.cs index 7b9aa25067..cb04c0e3aa 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/CertTests.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/CertTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; +using Test.Cryptography; using Xunit; using Xunit.Abstractions; @@ -358,6 +359,26 @@ namespace System.Security.Cryptography.X509Certificates.Tests } } + [Fact] + public static void X509Certificate2WithT61String() + { + string certSubject = @"E=mabaul@microsoft.com, OU=Engineering, O=Xamarin, S=Massachusetts, C=US, CN=test-server.local"; + + using (var cert = new X509Certificate2(TestData.T61StringCertificate)) + { + Assert.Equal(certSubject, cert.Subject); + Assert.Equal(certSubject, cert.Issuer); + + Assert.Equal("9E7A5CCC9F951A8700", cert.GetSerialNumber().ByteArrayToHex()); + Assert.Equal("1.2.840.113549.1.1.1", cert.GetKeyAlgorithm()); + + Assert.Equal(74, cert.GetPublicKey().Length); + + Assert.Equal("test-server.local", cert.GetNameInfo(X509NameType.SimpleName, false)); + Assert.Equal("mabaul@microsoft.com", cert.GetNameInfo(X509NameType.EmailName, false)); + } + } + public static IEnumerable StorageFlags => CollectionImportTests.StorageFlags; } } diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/LoadFromFileTests.cs b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/LoadFromFileTests.cs index 55403a33ef..7fb49825d9 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/LoadFromFileTests.cs +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/LoadFromFileTests.cs @@ -37,11 +37,10 @@ namespace System.Security.Cryptography.X509Certificates.Tests } [Fact] - [ActiveIssue(30543, TargetFrameworkMonikers.NetFramework)] public static void TestSerial() { - string expectedSerialHex = "B00000000100DD9F3BD08B0AAF11B000000033"; - byte[] expectedSerial = expectedSerialHex.HexToByteArray(); + string expectedSerialHex = "33000000B011AF0A8BD03B9FDD0001000000B0"; + byte[] expectedSerial = "B00000000100DD9F3BD08B0AAF11B000000033".HexToByteArray(); using (X509Certificate2 c = LoadCertificateFromFile()) { @@ -49,6 +48,8 @@ namespace System.Security.Cryptography.X509Certificates.Tests Assert.Equal(expectedSerial, serial); string serialHex = c.GetSerialNumberString(); Assert.Equal(expectedSerialHex, serialHex); + serialHex = c.SerialNumber; + Assert.Equal(expectedSerialHex, serialHex); } } diff --git a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/TestData.cs.REMOVED.git-id b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/TestData.cs.REMOVED.git-id index 9d229459ce..1d0a65908d 100644 --- a/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/TestData.cs.REMOVED.git-id +++ b/external/corefx/src/System.Security.Cryptography.X509Certificates/tests/TestData.cs.REMOVED.git-id @@ -1 +1 @@ -ff8c1614be5a4956ca251667eacd7957b38eff3e \ No newline at end of file +f27924e0354b11871f2c524d60242f130819ac36 \ No newline at end of file diff --git a/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs b/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs index e73ce8118e..44b10b3dc8 100644 --- a/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs +++ b/external/corefx/src/System.Threading.Tasks.Dataflow/src/Internal/ProducerConsumerQueues.cs @@ -31,7 +31,6 @@ using System.Collections.Concurrent; #endif using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; namespace System.Threading.Tasks diff --git a/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs.REMOVED.git-id b/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs.REMOVED.git-id index 1ca0d5c141..c8cba02a3f 100644 --- a/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs.REMOVED.git-id +++ b/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/Parallel.cs.REMOVED.git-id @@ -1 +1 @@ -d38d3be91c131cc64ac5b985b3611c4307c4d453 \ No newline at end of file +671122ad9b0b9cf5402090153b5999e24d96ea14 \ No newline at end of file diff --git a/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/ParallelLoopState.cs b/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/ParallelLoopState.cs index 43447f7e87..d9d82953ad 100644 --- a/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/ParallelLoopState.cs +++ b/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/ParallelLoopState.cs @@ -10,7 +10,6 @@ // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Diagnostics; -using System.Diagnostics.Private; // Prevents compiler warnings/errors regarding the use of ref params in Interlocked methods diff --git a/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/ParallelRangeManager.cs b/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/ParallelRangeManager.cs index e83063f92f..196ad01f9b 100644 --- a/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/ParallelRangeManager.cs +++ b/external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/ParallelRangeManager.cs @@ -8,7 +8,7 @@ // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.InteropServices; #pragma warning disable 0420 diff --git a/external/corefx/src/System.Threading/src/System/Threading/CountdownEvent.cs b/external/corefx/src/System.Threading/src/System/Threading/CountdownEvent.cs index ce14e204ac..6259d05353 100644 --- a/external/corefx/src/System.Threading/src/System/Threading/CountdownEvent.cs +++ b/external/corefx/src/System.Threading/src/System/Threading/CountdownEvent.cs @@ -9,7 +9,6 @@ // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Diagnostics; -using System.Diagnostics.Private; namespace System.Threading { diff --git a/external/corefx/src/System.Threading/tests/ThreadLocalTests.cs b/external/corefx/src/System.Threading/tests/ThreadLocalTests.cs index b7ee3afae5..26fe5e2ed7 100644 --- a/external/corefx/src/System.Threading/tests/ThreadLocalTests.cs +++ b/external/corefx/src/System.Threading/tests/ThreadLocalTests.cs @@ -110,7 +110,6 @@ namespace System.Threading.Tests } [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "This test requires precise stack scanning")] public static void RunThreadLocalTest5_Dispose() { // test recycling the combination index; @@ -319,7 +318,6 @@ namespace System.Threading.Tests } [Fact] - [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "This test requires precise stack scanning")] public static void RunThreadLocalTest8_Values_NegativeCases() { // Test that Dispose works and that objects are released on dispose diff --git a/external/corert/src/System.Private.CoreLib/shared/System/IO/Win32Marshal.cs b/external/corert/src/System.Private.CoreLib/shared/System/IO/Win32Marshal.cs index f6dd5f3cd1..b8b3057769 100644 --- a/external/corert/src/System.Private.CoreLib/shared/System/IO/Win32Marshal.cs +++ b/external/corert/src/System.Private.CoreLib/shared/System/IO/Win32Marshal.cs @@ -4,9 +4,6 @@ using System; using System.Diagnostics; -#if MONO -using System.Diagnostics.Private; -#endif using System.Runtime.InteropServices; namespace System.IO diff --git a/external/corert/src/System.Private.CoreLib/shared/System/Threading/DeferredDisposableLifetime.cs b/external/corert/src/System.Private.CoreLib/shared/System/Threading/DeferredDisposableLifetime.cs index 828df23b80..43b8392bf1 100644 --- a/external/corert/src/System.Private.CoreLib/shared/System/Threading/DeferredDisposableLifetime.cs +++ b/external/corert/src/System.Private.CoreLib/shared/System/Threading/DeferredDisposableLifetime.cs @@ -3,9 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -#if MONO -using System.Diagnostics.Private; -#endif namespace System.Threading { diff --git a/external/corert/src/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs b/external/corert/src/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs index ec4bcd6b92..dcb7d01acd 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs @@ -3,9 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -#if MONO -using System.Diagnostics.Private; -#endif namespace System.Collections.Generic { diff --git a/external/corert/src/System.Private.CoreLib/src/System/Decimal.DecCalc.cs.REMOVED.git-id b/external/corert/src/System.Private.CoreLib/src/System/Decimal.DecCalc.cs.REMOVED.git-id index f3afc65a7c..5de76f9948 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Decimal.DecCalc.cs.REMOVED.git-id +++ b/external/corert/src/System.Private.CoreLib/src/System/Decimal.DecCalc.cs.REMOVED.git-id @@ -1 +1 @@ -c14603d45ef7ad7f0c541d64df6fd49fc47b9879 \ No newline at end of file +05afe6b7e296d261b03eff87b6fb61e1db537d32 \ No newline at end of file diff --git a/external/corert/src/System.Private.CoreLib/src/System/Decimal.cs b/external/corert/src/System.Private.CoreLib/src/System/Decimal.cs index 8bf8094f30..a6bd055529 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Decimal.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Decimal.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/external/corert/src/System.Private.CoreLib/src/System/Number.Unix.cs b/external/corert/src/System.Private.CoreLib/src/System/Number.Unix.cs index 72f53f2c07..19cb02135d 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Number.Unix.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Number.Unix.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime; using System.Globalization; @@ -19,10 +18,10 @@ namespace System Debug.Assert(precision > 0 && precision < 40); number.precision = precision; - if (DoubleHelper.Exponent(value) == 0x7ff) + if (!Double.IsFinite(value)) { - number.scale = DoubleHelper.Mantissa(value) != 0 ? ScaleNAN : ScaleINF; - number.sign = DoubleHelper.Sign(value); + number.scale = Double.IsNaN(value) ? ScaleNAN : ScaleINF; + number.sign = Double.IsNegative(value); number.digits[0] = '\0'; return; } @@ -162,4 +161,4 @@ namespace System } } } -} +} \ No newline at end of file diff --git a/external/corert/src/System.Private.CoreLib/src/System/Number.Windows.cs b/external/corert/src/System.Private.CoreLib/src/System/Number.Windows.cs index f5180e99ef..1d9e25a4eb 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Number.Windows.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Number.Windows.cs @@ -12,10 +12,10 @@ namespace System private static unsafe void DoubleToNumber(double value, int precision, ref NumberBuffer number) { number.precision = precision; - if (DoubleHelper.Exponent(value) == 0x7ff) + if (!Double.IsFinite(value)) { - number.scale = DoubleHelper.Mantissa(value) != 0 ? ScaleNAN : ScaleINF; - number.sign = DoubleHelper.Sign(value); + number.scale = Double.IsNaN(value) ? ScaleNAN : ScaleINF; + number.sign = Double.IsNegative(value); number.digits[0] = '\0'; } else @@ -40,4 +40,3 @@ namespace System } } - diff --git a/external/corert/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs b/external/corert/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs index 12bd0de71c..33b5b0b26b 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs @@ -39,7 +39,6 @@ // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Diagnostics; -using System.Diagnostics.Private; using System.Threading; using System.Threading.Tasks; diff --git a/external/corert/src/System.Private.CoreLib/src/System/String.cs b/external/corert/src/System.Private.CoreLib/src/System/String.cs index 9846b15f29..4e43f26c33 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/String.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/String.cs @@ -12,7 +12,7 @@ using System.Buffers; using System.Collections; using System.Collections.Generic; -using System.Diagnostics.Private; +using System.Diagnostics; using System.Globalization; using System.Runtime; using System.Runtime.CompilerServices; diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs index 7c155523e9..b30ff63db4 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; using System.Diagnostics.CodeAnalysis; namespace System.Threading.Tasks diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs index 249214c4c4..ed2c06d745 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs @@ -13,7 +13,6 @@ using System.Runtime.CompilerServices; using System.Diagnostics; -using System.Diagnostics.Private; // Disable the "reference to volatile field not treated as volatile" error. diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs.REMOVED.git-id b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs.REMOVED.git-id index c8c82ed1fb..2a6ed083c9 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs.REMOVED.git-id +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs.REMOVED.git-id @@ -1 +1 @@ -a536d51d1c315ded8a565fd23c7697bb35dc6f1c \ No newline at end of file +b27b1858fea5bbb83b6ef0a139929bdcebcba74d \ No newline at end of file diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs index 33bad7e920..915f7c41fa 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs @@ -26,7 +26,6 @@ using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.InteropServices; namespace System.Threading.Tasks diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs.REMOVED.git-id b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs.REMOVED.git-id index 6856f6ffee..6ee723707e 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs.REMOVED.git-id +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs.REMOVED.git-id @@ -1 +1 @@ -48443f12612316da12c20882839cea4e7be89e74 \ No newline at end of file +185449d187c8932c82d449d467170732f3d171d7 \ No newline at end of file diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs index 063fcda864..2ec382ad1f 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs @@ -11,7 +11,7 @@ // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -using System.Diagnostics.Private; +using System.Diagnostics; using System.Runtime.CompilerServices; using Internal.Runtime.Augments; diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskExceptionHolder.cs b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskExceptionHolder.cs index e915f35950..f06b0750cf 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskExceptionHolder.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskExceptionHolder.cs @@ -18,7 +18,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.ExceptionServices; namespace System.Threading.Tasks diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs.REMOVED.git-id b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs.REMOVED.git-id index 9cfd557a87..c9d581633a 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs.REMOVED.git-id +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs.REMOVED.git-id @@ -1 +1 @@ -c80953c82c13044ea68c339395b3895f2eabc64c \ No newline at end of file +627a760c70dad24b763acc3e566b6cf1c18ae6e7 \ No newline at end of file diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs index 245ba6116b..653345cef6 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs @@ -12,7 +12,6 @@ using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.Private; using System.Runtime.CompilerServices; namespace System.Threading.Tasks diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.OverlappedData.cs b/external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.OverlappedData.cs index 5e2cdbc666..e378c6ba57 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.OverlappedData.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.OverlappedData.cs @@ -3,9 +3,6 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; -#if MONO -using System.Diagnostics.Private; -#endif using System.Runtime.InteropServices; namespace System.Threading diff --git a/external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.cs b/external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.cs index 67476ce021..3249e50374 100644 --- a/external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.cs +++ b/external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.cs @@ -4,9 +4,6 @@ using System.Collections.Generic; using System.Diagnostics; -#if MONO -using System.Diagnostics.Private; -#endif using System.Runtime.InteropServices; namespace System.Threading diff --git a/external/linker/linker/Linker.Steps/OutputStep.cs b/external/linker/linker/Linker.Steps/OutputStep.cs index 61852b7c13..4969ef81ec 100644 --- a/external/linker/linker/Linker.Steps/OutputStep.cs +++ b/external/linker/linker/Linker.Steps/OutputStep.cs @@ -213,18 +213,27 @@ namespace Mono.Linker.Steps { if (source == target) return; - File.Copy (source, target, true); + CopyFileAndRemoveReadOnly (source, target); if (!Context.LinkSymbols) return; var mdb = source + ".mdb"; if (File.Exists (mdb)) - File.Copy (mdb, target + ".mdb", true); + CopyFileAndRemoveReadOnly (mdb, target + ".mdb"); var pdb = Path.ChangeExtension (source, "pdb"); if (File.Exists (pdb)) - File.Copy (pdb, Path.ChangeExtension (target, "pdb"), true); + CopyFileAndRemoveReadOnly (pdb, Path.ChangeExtension (target, "pdb")); + } + + static void CopyFileAndRemoveReadOnly (string src, string dest) { + File.Copy (src, dest, true); + + FileAttributes attrs = File.GetAttributes (dest); + + if ((attrs & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) + File.SetAttributes (dest, attrs & ~FileAttributes.ReadOnly); } protected virtual string GetAssemblyFileName (AssemblyDefinition assembly, string directory) diff --git a/external/linker/linker/Linker.Steps/ResolveFromXmlStep.cs b/external/linker/linker/Linker.Steps/ResolveFromXmlStep.cs index 3a0d89f96e..b1f8687991 100644 --- a/external/linker/linker/Linker.Steps/ResolveFromXmlStep.cs +++ b/external/linker/linker/Linker.Steps/ResolveFromXmlStep.cs @@ -110,6 +110,9 @@ namespace Mono.Linker.Steps { protected virtual void ProcessAssembly (AssemblyDefinition assembly, XPathNodeIterator iterator) { + if (IsExcluded (iterator.Current)) + return; + Tracer.Push (assembly); if (GetTypePreserve (iterator.Current) == TypePreserve.All) { foreach (var type in assembly.MainModule.Types) @@ -155,10 +158,6 @@ namespace Mono.Linker.Steps { while (iterator.MoveNext ()) { XPathNavigator nav = iterator.Current; - var feature = GetAttribute (nav, "feature"); - if (Context.IsFeatureExcluded (feature)) - continue; - string fullname = GetFullName (nav); if (IsTypePattern (fullname)) { @@ -243,6 +242,9 @@ namespace Mono.Linker.Steps { protected virtual void ProcessType (TypeDefinition type, XPathNavigator nav) { + if (IsExcluded (nav)) + return; + TypePreserve preserve = GetTypePreserve (nav); if (!IsRequired (nav)) { @@ -335,6 +337,9 @@ namespace Mono.Linker.Steps { protected virtual void ProcessField (TypeDefinition type, XPathNodeIterator iterator) { + if (IsExcluded (iterator.Current)) + return; + string value = GetSignature (iterator.Current); if (!String.IsNullOrEmpty (value)) ProcessFieldSignature (type, value); @@ -397,6 +402,9 @@ namespace Mono.Linker.Steps { protected virtual void ProcessMethod (TypeDefinition type, XPathNodeIterator iterator) { + if (IsExcluded (iterator.Current)) + return; + string value = GetSignature (iterator.Current); if (!String.IsNullOrEmpty (value)) ProcessMethodSignature (type, value); @@ -485,6 +493,9 @@ namespace Mono.Linker.Steps { protected virtual void ProcessEvent (TypeDefinition type, XPathNodeIterator iterator) { + if (IsExcluded (iterator.Current)) + return; + string value = GetSignature (iterator.Current); if (!String.IsNullOrEmpty (value)) ProcessEventSignature (type, value); @@ -550,6 +561,9 @@ namespace Mono.Linker.Steps { protected virtual void ProcessProperty (TypeDefinition type, XPathNodeIterator iterator) { + if (IsExcluded (iterator.Current)) + return; + string value = GetSignature (iterator.Current); if (!String.IsNullOrEmpty (value)) ProcessPropertySignature (type, value, GetAccessors (iterator.Current)); @@ -687,6 +701,16 @@ namespace Mono.Linker.Steps { { return nav.GetAttribute (attribute, _ns); } + + protected virtual bool IsExcluded (XPathNavigator nav) + { + var value = GetAttribute (nav, "feature"); + if (string.IsNullOrEmpty (value)) + return false; + + return Context.IsFeatureExcluded (value); + } + public override string ToString () { diff --git a/external/linker/linker/Linker/Annotations.cs b/external/linker/linker/Linker/Annotations.cs index 15f8822b76..9c7efae354 100644 --- a/external/linker/linker/Linker/Annotations.cs +++ b/external/linker/linker/Linker/Annotations.cs @@ -38,20 +38,20 @@ namespace Mono.Linker { protected readonly LinkContext context; - readonly Dictionary assembly_actions = new Dictionary (); - readonly Dictionary method_actions = new Dictionary (); - readonly HashSet marked = new HashSet (); - readonly HashSet processed = new HashSet (); - readonly Dictionary preserved_types = new Dictionary (); - readonly Dictionary> preserved_methods = new Dictionary> (); - readonly HashSet public_api = new HashSet (); - readonly Dictionary> override_methods = new Dictionary> (); - readonly Dictionary> base_methods = new Dictionary> (); - readonly Dictionary symbol_readers = new Dictionary (); + protected readonly Dictionary assembly_actions = new Dictionary (); + protected readonly Dictionary method_actions = new Dictionary (); + protected readonly HashSet marked = new HashSet (); + protected readonly HashSet processed = new HashSet (); + protected readonly Dictionary preserved_types = new Dictionary (); + protected readonly Dictionary> preserved_methods = new Dictionary> (); + protected readonly HashSet public_api = new HashSet (); + protected readonly Dictionary> override_methods = new Dictionary> (); + protected readonly Dictionary> base_methods = new Dictionary> (); + protected readonly Dictionary symbol_readers = new Dictionary (); - readonly Dictionary> custom_annotations = new Dictionary> (); - readonly Dictionary> resources_to_remove = new Dictionary> (); - readonly HashSet marked_attributes = new HashSet (); + protected readonly Dictionary> custom_annotations = new Dictionary> (); + protected readonly Dictionary> resources_to_remove = new Dictionary> (); + protected readonly HashSet marked_attributes = new HashSet (); public AnnotationStore (LinkContext context) => this.context = context; diff --git a/external/xunit-binaries/HTML.xslt b/external/xunit-binaries/HTML.xslt deleted file mode 100644 index 32c8eb8509..0000000000 --- a/external/xunit-binaries/HTML.xslt +++ /dev/null @@ -1,240 +0,0 @@ - - - - - - ]]> - - - xUnit.net Test Results - - - - -

- Assemblies Run -

- -

- Summary -

-
- Tests run: — - - Errors: , - - - Failures: , - - - Skipped: , - - Run time: s, - Finished: -
- -
-

- Errors -

- -
- -
-

- Failed tests -

- - - -
- -
-

- Collection failures -

- - - -
- -
-

- Skipped tests -

- - - -
-
-

- All tests -

-
Click test class name to expand/collapse test details
- - - -

- - s - - - ToggleClass('class') - ToggleClass('class') - - - - - - -   -   - ( tests) - - -
-

-
- - display: none; - - class - - - -
-
- - -
- - -
- -
-
- - -
- altrow - - - s - - - - Skipped - - - - - - - - -   -
- -
-
- -
-
- -
Output:
-
-
- -
Traits:
- - -
-
-
-
- - - - - - - - - -

- -
- altrow -
- -
-
- -
-
-
-
-
- - - -
- - altrow - - - Test Assembly Cleanup - Test Collection Cleanup - Test Class Cleanup - Test Method Cleanup - Test Case Cleanup - Test Cleanup - Fatal Error - - () - -
- -
-
- -
-
-
-
-
- -
\ No newline at end of file diff --git a/external/xunit-binaries/NUnitXml.xslt b/external/xunit-binaries/NUnitXml.xslt deleted file mode 100644 index 712bd4b05d..0000000000 --- a/external/xunit-binaries/NUnitXml.xslt +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - True - - - Failure - Success - - - - - - - - - - - - - - - - - - Failure - Success - - - False - True - - - - - - - - - - - - - - - - - Failure - Success - - - False - True - - - - - - - - - - - - - - - - - - - - - - - - - False - True - - - Failure - Success - Skipped - - - - False - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/external/xunit-binaries/README.md b/external/xunit-binaries/README.md index 5c160612a4..1ffd62a6b8 100644 --- a/external/xunit-binaries/README.md +++ b/external/xunit-binaries/README.md @@ -1,5 +1,5 @@ # xunit-binaries -Extracted Xunit nuget packages +Extracted xUnit nuget packages targetting netstandard 2.0 (or 1.1 when not available) -Xunit.NetCore.Extensions.dll extracted from https://dotnet.myget.org/feed/dotnet-buildtools/package/nuget/Microsoft.xunit.netcore.extensions/1.0.1-prerelease-02116-01 +Xunit.NetCore.Extensions.dll were extracted from https://dotnet.myget.org/feed/dotnet-buildtools/package/nuget/Microsoft.xunit.netcore.extensions/2.1.0-rc1-03006-01 diff --git a/external/xunit-binaries/xUnit1.xslt b/external/xunit-binaries/xUnit1.xslt deleted file mode 100644 index bb77bc2bba..0000000000 --- a/external/xunit-binaries/xUnit1.xslt +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/external/xunit-binaries/xunit.console.exe.config b/external/xunit-binaries/xunit.console.exe.config index d5d8e87fc6..99230ca04c 100644 --- a/external/xunit-binaries/xunit.console.exe.config +++ b/external/xunit-binaries/xunit.console.exe.config @@ -1,18 +1,7 @@ - -
- - - - - - - - - - - - - + + + + diff --git a/ikvm-native/Makefile.in b/ikvm-native/Makefile.in index cf1f25ec8d..dd28ff8327 100644 --- a/ikvm-native/Makefile.in +++ b/ikvm-native/Makefile.in @@ -228,6 +228,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -243,6 +245,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -283,11 +286,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/llvm/Makefile.am b/llvm/Makefile.am index cda2a5762f..a17422ff60 100644 --- a/llvm/Makefile.am +++ b/llvm/Makefile.am @@ -1,30 +1,50 @@ -# -# Conditional submodule for llvm -# -# make reset-llvm will checkout a version of llvm which is suitable for this version of mono -# into $top_srcdir/llvm/llvm. -# -LLVM_PATH=llvm +EXTRA_DIST=SUBMODULES.json build.mk build_llvm_config.sh -SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json -include $(top_srcdir)/scripts/submodules/versions.mk +if ENABLE_LLVM -$(eval $(call ValidateVersionTemplate,llvm,LLVM)) +if HOST_WIN32 +llvm_config=llvm-config.exe +else +llvm_config=llvm-config +endif -# Bump the given submodule to the revision given by the REV make variable -# If COMMIT is 1, commit the change -bump-llvm: __bump-version-llvm +if HAVE_ZLIB +llvm_extra_libs=-lz +else +llvm_extra_libs= +endif -# Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables -# If COMMIT is 1, commit the change -bump-branch-llvm: __bump-branch-llvm +if INTERNAL_LLVM -# Bump the given submodule to its current GIT version -# If COMMIT is 1, commit the change -bump-current-llvm: __bump-current-version-llvm +all-local: configure-llvm build-llvm install-llvm llvm_config.mk -clean-local: - $(RM) -r $(LLVM_PATH) +clean-local: clean-llvm clean-llvm-config -EXTRA_DIST=SUBMODULES.json +$(mono_build_root)/llvm/llvm_config.mk: install-llvm + $(top_srcdir)/llvm/build_llvm_config.sh "$(top_srcdir)/llvm/usr/bin/$(llvm_config)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@ + +else +all-local: llvm_config.mk + +clean-local: clean-llvm-config + +$(mono_build_root)/llvm/llvm_config.mk: $(top_srcdir)/llvm/Makefile.am + $(top_srcdir)/llvm/build_llvm_config.sh "$(EXTERNAL_LLVM_CONFIG)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@ +endif + +llvm_config.mk: $(mono_build_root)/llvm/llvm_config.mk + +clean-llvm-config: + - rm -rf llvm_config.mk + +else +all-local: + +clean-local: +endif + +# Override this so we don't try to re-copy llvm when we install mono +install: + +include build.mk diff --git a/llvm/Makefile.in b/llvm/Makefile.in index cad4522341..efa31547af 100644 --- a/llvm/Makefile.in +++ b/llvm/Makefile.in @@ -90,7 +90,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -DIST_COMMON = $(top_srcdir)/scripts/submodules/versions.mk \ +DIST_COMMON = $(srcdir)/build.mk \ + $(top_srcdir)/scripts/submodules/versions.mk \ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs subdir = llvm @@ -156,7 +157,7 @@ CCDEPMODE = @CCDEPMODE@ CC_FOR_BUILD = @CC_FOR_BUILD@ CFLAGS = @CFLAGS@ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ -CMAKE = @CMAKE@ +CMAKE := $(or $(CMAKE),$(shell which cmake)) CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSC = @CSC@ @@ -164,6 +165,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -179,6 +182,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -219,11 +223,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ @@ -359,14 +359,21 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -LLVM_PATH = llvm +EXTRA_DIST = SUBMODULES.json build.mk build_llvm_config.sh +@ENABLE_LLVM_TRUE@@HOST_WIN32_FALSE@llvm_config = llvm-config +@ENABLE_LLVM_TRUE@@HOST_WIN32_TRUE@llvm_config = llvm-config.exe +@ENABLE_LLVM_TRUE@@HAVE_ZLIB_FALSE@llvm_extra_libs = +@ENABLE_LLVM_TRUE@@HAVE_ZLIB_TRUE@llvm_extra_libs = -lz + +# FIXME: URL should be http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-$(NEEDED_LLVM_BRANCH)/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz +LLVM_DOWNLOAD_LOCATION = "http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-release60/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz" +NINJA := $(shell which ninja) SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json SCRIPT = $(top_srcdir)/scripts/submodules/versions.py -EXTRA_DIST = SUBMODULES.json all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/scripts/submodules/versions.mk $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/build.mk $(top_srcdir)/scripts/submodules/versions.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -387,7 +394,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; -$(top_srcdir)/scripts/submodules/versions.mk: +$(srcdir)/build.mk $(top_srcdir)/scripts/submodules/versions.mk: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh @@ -442,9 +449,8 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile +all-am: Makefile all-local installdirs: -install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -542,19 +548,52 @@ uninstall-am: .MAKE: install-am install-strip -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am +.PHONY: all all-am all-local check check-am clean clean-generic \ + clean-libtool clean-local cscopelist-am ctags-am distclean \ + distclean-generic distclean-libtool distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am +@ENABLE_LLVM_TRUE@@INTERNAL_LLVM_TRUE@all-local: configure-llvm build-llvm install-llvm llvm_config.mk + +@ENABLE_LLVM_TRUE@@INTERNAL_LLVM_TRUE@clean-local: clean-llvm clean-llvm-config + +@ENABLE_LLVM_TRUE@@INTERNAL_LLVM_TRUE@$(mono_build_root)/llvm/llvm_config.mk: install-llvm +@ENABLE_LLVM_TRUE@@INTERNAL_LLVM_TRUE@ $(top_srcdir)/llvm/build_llvm_config.sh "$(top_srcdir)/llvm/usr/bin/$(llvm_config)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@ + +@ENABLE_LLVM_TRUE@@INTERNAL_LLVM_FALSE@all-local: llvm_config.mk + +@ENABLE_LLVM_TRUE@@INTERNAL_LLVM_FALSE@clean-local: clean-llvm-config + +@ENABLE_LLVM_TRUE@@INTERNAL_LLVM_FALSE@$(mono_build_root)/llvm/llvm_config.mk: $(top_srcdir)/llvm/Makefile.am +@ENABLE_LLVM_TRUE@@INTERNAL_LLVM_FALSE@ $(top_srcdir)/llvm/build_llvm_config.sh "$(EXTERNAL_LLVM_CONFIG)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@ + +@ENABLE_LLVM_TRUE@llvm_config.mk: $(mono_build_root)/llvm/llvm_config.mk + +@ENABLE_LLVM_TRUE@clean-llvm-config: +@ENABLE_LLVM_TRUE@ - rm -rf llvm_config.mk + +@ENABLE_LLVM_FALSE@all-local: + +@ENABLE_LLVM_FALSE@clean-local: + +# Override this so we don't try to re-copy llvm when we install mono +install: + +top_srcdir ?= $(abspath $(CURDIR)/..) + +LLVM_PATH ?= $(abspath $(top_srcdir)/external/llvm) +LLVM_BUILD ?= $(abspath $(top_srcdir)/llvm/build) +LLVM_PREFIX ?= $(abspath $(top_srcdir)/llvm/usr) + # usage $(call ValidateVersionTemplate (name,MAKEFILE VAR,repo name)) # usage $(call ValidateVersionTemplate (mono,MONO,mono)) @@ -621,7 +660,7 @@ reset-$(1):: echo "*** git fetch `basename $$($(2)_PATH)`" && (cd $($(2)_PATH) && git fetch); \ fi; \ else \ - echo "*** git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2))" && (cd `dirname $($(2)_PATH)` && git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2)) || exit 1 ); \ + echo "*** git clone $(MODULE_$(2)) -b $(NEEDED_$(2)_BRANCH) --recursive $(DIRECTORY_$(2))" && (cd `dirname $($(2)_PATH)` && git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2)) || exit 1 ); \ fi @if test x$$(IGNORE_$(2)_VERSION) = "x"; then \ echo "*** [$(1)] git checkout -f" $(NEEDED_$(2)_BRANCH) && (cd $($(2)_PATH) ; git checkout -f $(NEEDED_$(2)_BRANCH) || git checkout -f -b $($(2)_BRANCH_AND_REMOTE)); \ @@ -685,8 +724,50 @@ bump-branch-llvm: __bump-branch-llvm # If COMMIT is 1, commit the change bump-current-llvm: __bump-current-version-llvm -clean-local: - $(RM) -r $(LLVM_PATH) +$(LLVM_BUILD) $(LLVM_PREFIX): + mkdir -p $@ + +$(LLVM_PATH): + $(MAKE) -f build.mk reset-llvm + +$(LLVM_PATH)/CMakeLists.txt: | $(LLVM_PATH) + +$(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile): $(LLVM_PATH)/CMakeLists.txt | $(LLVM_BUILD) + cd $(LLVM_BUILD) && $(CMAKE) \ + $(if $(NINJA),-G Ninja) \ + -DCMAKE_INSTALL_PREFIX="$(LLVM_PREFIX)" \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_BUILD_TESTS=Off \ + -DLLVM_INCLUDE_TESTS=Off \ + -DLLVM_BUILD_EXAMPLES=Off \ + -DLLVM_INCLUDE_EXAMPLES=Off \ + -DLLVM_TOOLS_TO_BUILD="opt;llc;llvm-config;llvm-dis" \ + -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \ + -DLLVM_ENABLE_ASSERTIONS=$(if $(INTERNAL_LLVM_ASSERTS),On,Off) \ + $(LLVM_CMAKE_ARGS) \ + $(dir $<) + +.PHONY: configure-llvm +configure-llvm: $(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile) + +# The DESTDIR fix is to prevent the build from trying to install this out-of-build-tree +# as the DESTDIR hasn't been created when we're building mono + +.PHONY: build-llvm +build-llvm: configure-llvm + DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD) + +.PHONY: install-llvm +install-llvm: build-llvm | $(LLVM_PREFIX) + DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD) install + +.PHONY: download-llvm +download-llvm: + (wget --no-verbose -O - $(LLVM_DOWNLOAD_LOCATION) || curl -L $(LLVM_DOWNLOAD_LOCATION)) | tar -xzf - -C $(dir $(LLVM_PREFIX)) + +.PHONY: clean-llvm +clean-llvm: + $(RM) -r $(LLVM_BUILD) $(LLVM_PREFIX) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/llvm/SUBMODULES.json b/llvm/SUBMODULES.json index e4fbbb02e8..4d31216460 100644 --- a/llvm/SUBMODULES.json +++ b/llvm/SUBMODULES.json @@ -2,9 +2,9 @@ { "name": "llvm", "url": "git://github.com/mono/llvm.git", - "rev": "9f79399f87282524fee099b328bd8cbf07929daf", - "remote-branch": "origin/master", - "branch": "master", + "rev": "fc854b8ec5873d294b80afa3e6cf6a88c5c48886", + "remote-branch": "origin/release_60", + "branch": "release_60", "directory": "llvm" } ] diff --git a/llvm/build.mk b/llvm/build.mk new file mode 100644 index 0000000000..6ef580a61d --- /dev/null +++ b/llvm/build.mk @@ -0,0 +1,80 @@ +# +# Conditional submodule for llvm +# +# make reset-llvm will checkout a version of llvm which is suitable for this version of mono +# into $top_srcdir/llvm/llvm. +# + +top_srcdir ?= $(abspath $(CURDIR)/..) + +LLVM_PATH ?= $(abspath $(top_srcdir)/external/llvm) +LLVM_BUILD ?= $(abspath $(top_srcdir)/llvm/build) +LLVM_PREFIX ?= $(abspath $(top_srcdir)/llvm/usr) + +# FIXME: URL should be http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-$(NEEDED_LLVM_BRANCH)/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz +LLVM_DOWNLOAD_LOCATION = "http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-release60/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz" + +CMAKE := $(or $(CMAKE),$(shell which cmake)) +NINJA := $(shell which ninja) + +SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json +include $(top_srcdir)/scripts/submodules/versions.mk + +$(eval $(call ValidateVersionTemplate,llvm,LLVM)) + +# Bump the given submodule to the revision given by the REV make variable +# If COMMIT is 1, commit the change +bump-llvm: __bump-version-llvm + +# Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables +# If COMMIT is 1, commit the change +bump-branch-llvm: __bump-branch-llvm + +# Bump the given submodule to its current GIT version +# If COMMIT is 1, commit the change +bump-current-llvm: __bump-current-version-llvm + +$(LLVM_BUILD) $(LLVM_PREFIX): + mkdir -p $@ + +$(LLVM_PATH): + $(MAKE) -f build.mk reset-llvm + +$(LLVM_PATH)/CMakeLists.txt: | $(LLVM_PATH) + +$(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile): $(LLVM_PATH)/CMakeLists.txt | $(LLVM_BUILD) + cd $(LLVM_BUILD) && $(CMAKE) \ + $(if $(NINJA),-G Ninja) \ + -DCMAKE_INSTALL_PREFIX="$(LLVM_PREFIX)" \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_BUILD_TESTS=Off \ + -DLLVM_INCLUDE_TESTS=Off \ + -DLLVM_BUILD_EXAMPLES=Off \ + -DLLVM_INCLUDE_EXAMPLES=Off \ + -DLLVM_TOOLS_TO_BUILD="opt;llc;llvm-config;llvm-dis" \ + -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \ + -DLLVM_ENABLE_ASSERTIONS=$(if $(INTERNAL_LLVM_ASSERTS),On,Off) \ + $(LLVM_CMAKE_ARGS) \ + $(dir $<) + +.PHONY: configure-llvm +configure-llvm: $(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile) + +# The DESTDIR fix is to prevent the build from trying to install this out-of-build-tree +# as the DESTDIR hasn't been created when we're building mono + +.PHONY: build-llvm +build-llvm: configure-llvm + DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD) + +.PHONY: install-llvm +install-llvm: build-llvm | $(LLVM_PREFIX) + DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD) install + +.PHONY: download-llvm +download-llvm: + (wget --no-verbose -O - $(LLVM_DOWNLOAD_LOCATION) || curl -L $(LLVM_DOWNLOAD_LOCATION)) | tar -xzf - -C $(dir $(LLVM_PREFIX)) + +.PHONY: clean-llvm +clean-llvm: + $(RM) -r $(LLVM_BUILD) $(LLVM_PREFIX) diff --git a/llvm/build_llvm_config.sh b/llvm/build_llvm_config.sh new file mode 100755 index 0000000000..d3c52f2cbd --- /dev/null +++ b/llvm/build_llvm_config.sh @@ -0,0 +1,172 @@ +#!/bin/bash + +llvm_config=$1 +llvm_codegen_libs="$2" +llvm_extra_libs="${@:3}" + +use_llvm_config=1 +llvm_host_win32=0 +llvm_host_win32_wsl=0 +llvm_host_win32_cygwin=0 + +function win32_format_path { + local formatted_path=$1 + if [[ $llvm_host_win32_wsl = 1 ]] && [[ $1 != "/mnt/"* ]]; then + # if path is not starting with /mnt under WSL it could be a windows path, convert using wslpath. + formatted_path="$(wslpath -a "$1")" + elif [[ $llvm_host_win32_cygwin = 1 ]] && [[ $1 != "/cygdrive/"* ]]; then + # if path is not starting with /cygdrive under CygWin it could be a windows path, convert using cygpath. + formatted_path="$(cygpath -a "$1")" + fi + echo "$formatted_path" +} + +if [[ $llvm_config = *".exe" ]]; then + llvm_host_win32=1 + # llvm-config is a windows binary. Check if we are running CygWin or WSL since then we might still be able to run llvm-config.exe + host_uname="$(uname -a)" + case "$host_uname" in + *Microsoft*) + use_llvm_config=1 + llvm_host_win32_wsl=1 + ;; + CYGWIN*) + use_llvm_config=1 + llvm_host_win32_cygwin=1 + ;; + *) + use_llvm_config=0 + esac +fi + +if [[ $llvm_host_win32 = 1 ]]; then + llvm_config=$(win32_format_path "$llvm_config") +fi + +if [[ $use_llvm_config = 1 ]]; then + llvm_api_version=`$llvm_config --mono-api-version` || "0" + with_llvm=`$llvm_config --prefix` + llvm_config_cflags=`$llvm_config --cflags` + llvm_system=`$llvm_config --system-libs` + llvm_core_components=`$llvm_config --libs analysis core bitwriter` + if [[ $llvm_api_version -lt 600 ]]; then + llvm_old_jit=`$llvm_config --libs mcjit jit 2>>/dev/null` + else + llvm_old_jit=`$llvm_config --libs mcjit 2>>/dev/null` + fi + llvm_new_jit=`$llvm_config --libs orcjit 2>>/dev/null` + + if [[ ! -z $llvm_codegen_libs ]]; then + llvm_extra=`$llvm_config --libs $llvm_codegen_libs` + fi + + # When building for Windows subsystem using WSL or CygWin the path returned from llvm-config.exe + # could be a Windows style path, make sure to format it into a path usable for WSL/CygWin. + if [[ $llvm_host_win32 = 1 ]]; then + with_llvm=$(win32_format_path "$with_llvm") + fi +fi + +# When cross compiling for Windows on system not capable of running Windows binaries, llvm-config.exe can't be used to query for +# LLVM parameters. In that scenario we will need to fallback to default values. +if [[ $llvm_host_win32 = 1 ]] && [[ $use_llvm_config = 0 ]]; then + # Assume we have llvm-config sitting in llvm-install-root/bin directory, get llvm-install-root directory. + with_llvm="$(dirname $llvm_config)" + with_llvm="$(dirname $with_llvm)" + llvm_config_path=$with_llvm/include/llvm/Config/llvm-config.h + + # llvm-config.exe --mono-api-version + llvm_api_version=`awk '/MONO_API_VERSION/ { print $3 }' $llvm_config_path` + + # llvm-config.exe --cflags, returned information currently not used. + llvm_config_cflags= + + # llvm-config.exe --system-libs + if [[ $llvm_api_version -lt 600 ]]; then + llvm_system="-limagehlp -lpsapi -lshell32" + else + llvm_system="-lpsapi -lshell32 -lole32 -luuid -ladvapi32" + fi + + # llvm-config.exe --libs analysis core bitwriter + if [[ $llvm_api_version -lt 600 ]]; then + llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport" + else + llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle" + fi + + # llvm-config.exe --libs mcjit jit + if [[ $llvm_api_version -lt 600 ]]; then + llvm_old_jit="-lLLVMJIT -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMExecutionEngine -lLLVMMC -lLLVMCore -lLLVMSupport" + else + # Current build of LLVM 60 for cross Windows builds doesn't support LLVM JIT. + llvm_old_jit= + fi + + # LLVM 36 doesn't support new JIT and LLVM 60 is build without LLVM JIT support for cross Windows builds. + llvm_new_jit= + + # Check codegen libs and add needed libraries. + case "$llvm_codegen_libs" in + *x86codegen*) + # llvm-config.exe --libs x86codegen + if [[ $llvm_api_version -lt 600 ]]; then + llvm_extra="-lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMObject -lLLVMBitReader -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport" + else + llvm_extra="-lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMX86Desc -lLLVMX86Info -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle" + fi + ;; + *armcodegen*) + # llvm-config.exe --libs armcodegen + if [[ $llvm_api_version -lt 600 ]]; then + llvm_extra="-lLLVMARMCodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMMC -lLLVMSupport" + else + llvm_extra="-lLLVMARMCodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMMC -lLLVMSupport -lLLVMDemangle" + fi + ;; + *aarch64codegen*) + # llvm-config.exe --libs aarch64codegen + if [[ $llvm_api_version -lt 600 ]]; then + llvm_extra="-lLLVMAArch64CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport" + else + llvm_extra="-lLLVMAArch64CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport -lLLVMDemangle" + fi + ;; + *) + llvm_extra=$llvm_codegen_libs + esac +fi + +if [[ $llvm_config_cflags = *"stdlib=libc++"* ]]; then + llvm_libc_c="-stdlib=libc++" + llvm_libc_link="-lc++" +else + llvm_libc_c="" + llvm_libc_link="-lstdc++" +fi + +if [[ $llvm_host_win32 = 1 ]]; then + host_cxxflag_additions="-std=gnu++11" + host_cflag_additions="-DNDEBUG" +else + host_cxxflag_additions="-std=c++11" + host_cflag_additions="" +fi + +if [[ ! -z $llvm_extra_libs ]]; then + llvm_extra="$llvm_extra $llvm_extra_libs" +fi + +# llvm-config --clfags adds warning and optimization flags we don't want +cflags_additions="-I$with_llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DLLVM_API_VERSION=$llvm_api_version $llvm_libc_c $host_cflag_additions" + +cxxflag_additions="-fno-rtti -fexceptions $host_cxxflag_additions" + +ldflags="-L$with_llvm/lib" + +llvm_lib_components="$llvm_core_components $llvm_old_jit $llvm_new_jit $llvm_extra" + +echo "LLVM_CFLAGS_INTERNAL=$cflags_additions" +echo "LLVM_CXXFLAGS_INTERNAL=$cflags_additions $cxxflag_additions" +echo "LLVM_LDFLAGS_INTERNAL=$ldflags" +echo "LLVM_LIBS_INTERNAL=$llvm_lib_components $ldflags $llvm_system $llvm_libc_link" diff --git a/m4/Makefile.in b/m4/Makefile.in index a460a53b83..c14fa8d96b 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/man/Makefile.in b/man/Makefile.in index 64adb3f79c..fae99b60dd 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -183,6 +183,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -198,6 +200,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -238,11 +241,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/man/mono.1 b/man/mono.1 index ec8c9c0762..7b9ae4eddf 100644 --- a/man/mono.1 +++ b/man/mono.1 @@ -1178,19 +1178,33 @@ If set, tells mono to attempt using native asynchronous I/O services. If not set, a default select/poll implementation is used. Currently epoll and kqueue are supported. .TP +\fBMONO_THREADS_SUSPEND\fR +Selects a mechanism that Mono will use to suspend threads. May be set to +"preemptive", "coop", or "hybrid". Threads may need to be suspended by the +debugger, or using some .NET threading APIs, and most commonly when the SGen +garbage collector needs to stop all threads during a critical phase of garbage +collection. Preemptive mode is the mode that Mono has used historically, going +back to the Boehm days, where the garbage collector would run at any point and +suspend execution of all threads as required to perform a garbage collection. +The cooperative mode on the other hand requires the cooperation of all threads +to stop at a safe point. This makes for an easier to debug garbage collector. +As of Mono 4.3.0 it is a work in progress, and while it works, it has not been +used extensively. This option enables the feature and allows us to find spots +that need to be tuned for this mode of operation. Hybrid mode is a combination +of the two that retains better compatability with scenarios where Mono is +embedded in another application: threads that are running managed code or code +that comprises the Mono runtime will be cooperatively suspended, while threads +running embedder code will be preemptively suspended. + +Alternatively, coop and hybrid mode can be enabled at compile time by using the +--enable-cooperative-suspend or --enable-hybrid-suspend flags, respectively, +when calling configure. The \fBMONO_THREADS_SUSPEND\fR environment variable +takes priority over the compiled default. +.TP \fBMONO_ENABLE_COOP_SUSPEND\fR -This makes the Mono runtime and the SGen garbage collector run in cooperative -mode as opposed to run on preemptive mode. Preemptive mode is the mode -that Mono has used historically, going back to the Boehm days, where the -garbage collector would run at any point and suspend execution of all -threads as required to perform a garbage collection. The cooperative mode -on the other hand requires the cooperation of all threads to stop at a -safe point. This makes for an easier to debug garbage collector. As -of Mono 4.3.0 it is a work in progress, and while it works, it has not -been used extensively. This option enabled the feature and allows us to -find spots that need to be tuned for this mode of operation. Alternatively, -this mode can be enabled at compile time by using the --enable-cooperative-suspend -flag when calling configure. +This environment variable is obsolete, but retained for backward compatibility. +Use \fBMONO_THREADS_SUSPEND\fR set to "coop" instead. Note that if configure flags +were provided to enable cooperative or hybrid suspend, this variable is ignored. .TP \fBMONO_ENV_OPTIONS\fR This environment variable allows you to pass command line arguments to @@ -1883,7 +1897,7 @@ for example, to see managed frame names on gdb backtraces. \fBMONO_VERBOSE_METHOD\fR Enables the maximum JIT verbosity for the specified method. This is very helpfull to diagnose a miscompilation problems of a specific -method. This can be a comma-separated list of method names to +method. This can be a semicolon-separated list of method names to match. If the name is simple, this applies to any method with that name, otherwise you can use a mono method description (see the section METHOD DESCRIPTIONS). diff --git a/mcs/build/Makefile b/mcs/build/Makefile index 1dfe0e7795..164308410f 100644 --- a/mcs/build/Makefile +++ b/mcs/build/Makefile @@ -15,7 +15,7 @@ common/Consts.cs: common/Consts.cs.in $(wildcard config.make) test -n '$(MONO_CORLIB_VERSION)' sed -e 's,@''MONO_VERSION@,$(MONO_VERSION),' -e 's,@''MONO_CORLIB_VERSION@,$(MONO_CORLIB_VERSION),' $< > $@ -PLATFORMS = darwin linux win32 +PLATFORMS = macos linux win32 unix PROFILES = \ basic \ build \ @@ -40,7 +40,6 @@ DISTFILES = \ corcompare.make \ corcompare-api.xsl \ executable.make \ - gensources.sh \ gensources.cs \ library.make \ rules.make \ diff --git a/mcs/build/common/Consts.cs b/mcs/build/common/Consts.cs index 91327c06b7..10fdcf4d1f 100644 --- a/mcs/build/common/Consts.cs +++ b/mcs/build/common/Consts.cs @@ -34,11 +34,11 @@ static class Consts // Use these assembly version constants to make code more maintainable. // - public const string MonoVersion = "5.16.0.187"; + public const string MonoVersion = "5.18.0.142"; public const string MonoCompany = "Mono development team"; public const string MonoProduct = "Mono Common Language Infrastructure"; public const string MonoCopyright = "(c) Various Mono authors"; - public const int MonoCorlibVersion = 1051600011; + public const string MonoCorlibVersion = "72078E96-4A71-4CCD-83BC-B7CC78873FC0"; #if MOBILE // Versions of .NET Framework for Silverlight 4.0 diff --git a/mcs/build/common/Consts.cs.in b/mcs/build/common/Consts.cs.in index 8bb64bc43a..fbdfec47f9 100644 --- a/mcs/build/common/Consts.cs.in +++ b/mcs/build/common/Consts.cs.in @@ -38,7 +38,7 @@ static class Consts public const string MonoCompany = "Mono development team"; public const string MonoProduct = "Mono Common Language Infrastructure"; public const string MonoCopyright = "(c) Various Mono authors"; - public const int MonoCorlibVersion = @MONO_CORLIB_VERSION@; + public const string MonoCorlibVersion = "@MONO_CORLIB_VERSION@"; #if MOBILE // Versions of .NET Framework for Silverlight 4.0 diff --git a/mcs/build/config-default.make b/mcs/build/config-default.make index f9d2f21212..0c05bd4c05 100644 --- a/mcs/build/config-default.make +++ b/mcs/build/config-default.make @@ -32,10 +32,10 @@ mono_libdir = $(exec_prefix)/lib sysconfdir = $(prefix)/etc #RUNTIME = mono RUNTIME = false -MONO_PATH_TOP = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/ +MONO_PATH_TOP = $(topdir)/class/lib/$(PROFILE_DIRECTORY) MONO_PATH_TESTS = $(MONO_PATH_TOP)/tests -TEST_MONO_PATH = $(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS) -TEST_RUNTIME = MONO_PATH="$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR).$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug +TEST_MONO_PATH = $(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS)$(PLATFORM_PATH_SEPARATOR). +TEST_RUNTIME = MONO_PATH="$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug # In case you want to add MCS_FLAGS, this lets you not have to # keep track of the default value diff --git a/mcs/build/corcompare.make b/mcs/build/corcompare.make index 4ad4cfc7db..6b080ee98e 100644 --- a/mcs/build/corcompare.make +++ b/mcs/build/corcompare.make @@ -1,5 +1,5 @@ API_INFO = $(MONO_PATH) $(RUNTIME) $(topdir)/class/lib/$(PROFILE)/mono-api-info.exe -API_DIFF = $(MONO_PATH) $(RUNTIME) $(topdir)/tools/corcompare/mono-api-diff.exe +API_DIFF = $(MONO_PATH) $(RUNTIME) $(topdir)/class/lib/$(PROFILE)/mono-api-diff.exe TRANSFORM = $(MONO_PATH) $(RUNTIME) $(topdir)/tools/corcompare/transform.exe OBJECTS = $(topdir)/build/corcompare/$(LIBRARY_NAME:.dll=.html) diff --git a/mcs/build/executable.make b/mcs/build/executable.make index 5a39dd9501..29abac599a 100644 --- a/mcs/build/executable.make +++ b/mcs/build/executable.make @@ -191,6 +191,7 @@ csproj-local: echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \ (echo $(is_boot); \ echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(patsubst %,-r:%,$(LIB_REFS)); \ + echo $(sourcefile); \ echo $(PROGRAM); \ echo $(BUILT_SOURCES_cmdline); \ echo $(build_lib); \ diff --git a/mcs/build/gensources.cs b/mcs/build/gensources.cs index 8a1d388bad..25386755c0 100644 --- a/mcs/build/gensources.cs +++ b/mcs/build/gensources.cs @@ -9,12 +9,20 @@ public static class Program { public static int Main (string[] _args) { var args = new List (_args); bool useStdout = false, showHelp = false, strictMode = false; + string baseDir = null; for (int i = 0; i < args.Count; i++) { var arg = args[i]; if (!arg.StartsWith ("-")) continue; + string argValue = null; + var offset = arg.IndexOf(':'); + if (offset >= 0) { + argValue = arg.Substring (offset + 1); + arg = arg.Substring (0, offset); + } + switch (arg) { case "-?": case "--help": @@ -22,17 +30,10 @@ public static class Program { showHelp = true; break; case "--trace": - case "--trace1": - SourcesParser.TraceLevel = 1; - break; - case "--trace2": - SourcesParser.TraceLevel = 2; - break; - case "--trace3": - SourcesParser.TraceLevel = 3; - break; - case "--trace4": - SourcesParser.TraceLevel = 4; + if (argValue != null) + SourcesParser.TraceLevel = int.Parse(argValue); + else + SourcesParser.TraceLevel = 1; break; case "--stdout": useStdout = true; @@ -40,30 +41,36 @@ public static class Program { case "--strict": strictMode = true; break; - default: - Console.Error.WriteLine ("Unrecognized switch " + arg); + case "--basedir": + baseDir = argValue; break; + default: + Console.Error.WriteLine ($"// Unrecognized switch {arg}. Aborting."); + return 1; } args.RemoveAt (i); i--; } - if (args.Count != 4) + if ((args.Count < 3) || (args.Count > 4)) showHelp = true; if (showHelp) { Console.Error.WriteLine ("Usage: mcs/build/gensources.exe [options] (outputFileName|--stdout) libraryDirectoryAndName platformName profileName"); + Console.Error.WriteLine ("or mcs/build/gensources.exe [options] (outputFileName|--stdout) (--baseDir:) sourcesFile exclusionsFile"); Console.Error.WriteLine ("You can specify * for platformName and profileName to read all sources files"); Console.Error.WriteLine ("Available options:"); Console.Error.WriteLine ("--help -h -?"); Console.Error.WriteLine (" Show command line info"); - Console.Error.WriteLine ("--trace1 --trace2 --trace3 --trace4"); - Console.Error.WriteLine (" Enable diagnostic output"); + Console.Error.WriteLine ("--trace:n"); + Console.Error.WriteLine (" Enable diagnostic output, at tracing level n (1-4)"); Console.Error.WriteLine ("--stdout"); Console.Error.WriteLine (" Writes results to standard output (omit outputFileName if you use this)"); Console.Error.WriteLine ("--strict"); Console.Error.WriteLine (" Produces an error exit code if files or directories are invalid/missing"); + Console.Error.WriteLine ("--basedir:"); + Console.Error.WriteLine (" Sets the base directory when reading a single sources/exclusions pair (default is the directory containing the sources file)"); return 1; } @@ -73,20 +80,75 @@ public static class Program { var executableDirectory = Path.GetDirectoryName (executablePath); var outFile = Path.GetFullPath (args[0]); - var libraryFullName = Path.GetFullPath (args[1]); - var platformName = args[2]; - var profileName = args[3]; + var platformsFolder = Path.Combine (executableDirectory, "platforms"); var profilesFolder = Path.Combine (executableDirectory, "profiles"); - - var libraryDirectory = Path.GetDirectoryName (libraryFullName); - var libraryName = Path.GetFileName (libraryFullName); + if (!Directory.Exists (platformsFolder) || !Directory.Exists (profilesFolder)) { + Console.Error.WriteLine ($"// Platforms and/or profiles folders are missing: '{platformsFolder}' '{profilesFolder}'. Aborting."); + return 1; + } var parser = new SourcesParser (platformsFolder, profilesFolder); - var result = parser.Parse (libraryDirectory, libraryName, platformName, profileName); - if (SourcesParser.TraceLevel > 0) - Console.Error.WriteLine ($"// Writing sources for platform {platformName} and profile {profileName}, relative to {libraryDirectory}, to {outFile}."); + ParseResult result; + + if (args.Count == 3) { + var sourcesFile = Path.GetFullPath (args[1]); + var excludesFile = Path.GetFullPath (args[2]); + var directory = Path.GetDirectoryName (sourcesFile); + if ((Path.GetDirectoryName (excludesFile) != directory) && (baseDir == null)) { + Console.Error.WriteLine ("// Sources and exclusions files are in different directories. Aborting."); + return 1; + } + + result = parser.Parse (baseDir ?? directory, sourcesFile, excludesFile); + + if (SourcesParser.TraceLevel > 0) + Console.Error.WriteLine ($"// Writing sources from {sourcesFile} minus {excludesFile}, to {outFile}."); + } else if (args.Count == 4) { + if (baseDir != null) + Console.Error.WriteLine ($"// WARNING: baseDir has no effect in this mode"); + + var libraryFullName = Path.GetFullPath (args[1]); + var platformName = args[2].Trim (); + var profileName = args[3].Trim (); + var libraryDirectory = Path.GetDirectoryName (libraryFullName); + var libraryName = Path.GetFileName (libraryFullName); + result = parser.Parse (libraryDirectory, libraryName, platformName, profileName); + + if (SourcesParser.TraceLevel > 0) + Console.Error.WriteLine ($"// Writing sources for platform {platformName} and profile {profileName}, relative to {libraryDirectory}, to {outFile}."); + } else { + throw new Exception (); + } + + var fileNames = result.GetMatches () + .OrderBy (e => e.RelativePath, StringComparer.Ordinal) + .Select (e => e.RelativePath) + .Distinct () + .ToList (); + + var unexpectedEmptyResult = (fileNames.Count == 0); + + // HACK: We have sources files that are literally empty, so as long as *some* sources files were + // parsed during this invocation and they are all empty, producing no matching file names is not + // an error. + if ((result.SourcesFiles.Count > 0) && result.SourcesFiles.Values.All(sf => sf.Sources.Count == 0)) + unexpectedEmptyResult = false; + + if ((result.ErrorCount > 0) || unexpectedEmptyResult) { + Console.Error.WriteLine ($"// gensources produced {result.ErrorCount} error(s) and a set of {fileNames.Count} filename(s)"); + Console.Error.WriteLine ($"// Invoked with '{Environment.CommandLine}'"); + Console.Error.WriteLine ($"// Working directory was '{Environment.CurrentDirectory}'"); + + if (strictMode) { + // HACK: Make ignores non-zero exit codes so we need to delete the sources file ??? + if (!useStdout && File.Exists (outFile)) + File.Delete (outFile); + + return result.ErrorCount + 1; + } + } TextWriter output; if (useStdout) @@ -95,128 +157,228 @@ public static class Program { output = new StreamWriter (outFile); using (output) { - foreach (var fileName in result.GetFileNames ().OrderBy (s => s, StringComparer.Ordinal)) + foreach (var fileName in fileNames) output.WriteLine (fileName); } - if (strictMode) - return result.ErrorCount; - else - return 0; + return 0; + } +} + +public class SourcesFile { + public readonly string FileName; + public readonly bool IsExclusion; + + public readonly List Sources = new List (); + public readonly List Exclusions = new List (); + public readonly List Includes = new List (); + + public SourcesFile (string fileName, bool isExclusion) { + FileName = fileName; + IsExclusion = isExclusion; } } public struct ParseEntry { - public string SourcesFileName; public string Directory; public string Pattern; - public string HostPlatform; - public string ProfileName; } -public struct Source { - public string FileName; +public struct MatchEntry { + public SourcesFile SourcesFile; + public string RelativePath; +} + +public class TargetParseResult { + public (string hostPlatform, string profile) Key; + public SourcesFile Sources, Exclusions; + public bool IsFallback; + + public override string ToString () { + var fallbackString = IsFallback ? " fallback" : ""; + return $"{Key}{fallbackString} -> [{Sources?.FileName}, {Exclusions?.FileName}]"; + } } public class ParseResult { - public readonly string LibraryDirectory, LibraryName; + public readonly string LibraryDirectory; - public readonly List Sources = new List (); - public readonly List Exclusions = new List (); + public readonly Dictionary<(string hostPlatform, string profile), TargetParseResult> TargetDictionary = new Dictionary<(string hostPlatform, string profile), TargetParseResult> (); + + public readonly Dictionary SourcesFiles = new Dictionary (); + public readonly Dictionary ExclusionFiles = new Dictionary (); // FIXME: This is a bad spot for this value but enumerators don't have outparam support public int ErrorCount = 0; - public ParseResult (string libraryDirectory, string libraryName) { - LibraryDirectory = libraryDirectory; - LibraryName = libraryName; + public ParseResult (string libraryDirectory) { + LibraryDirectory = Path.GetFullPath (libraryDirectory); } - private static string GetRelativePath (string fullPath, string relativeToDirectory) { - fullPath = fullPath.Replace (SourcesParser.DirectorySeparator, "/"); - relativeToDirectory = relativeToDirectory.Replace (SourcesParser.DirectorySeparator, "/"); + public IEnumerable Targets { + get { + return TargetDictionary.Values; + } + } - if (!relativeToDirectory.EndsWith (SourcesParser.DirectorySeparator)) - relativeToDirectory += SourcesParser.DirectorySeparator; - var dirUri = new Uri (relativeToDirectory); - var pathUri = new Uri (fullPath); + private string GetRelativePath (string fullPath, string relativeToDirectory) { + fullPath = fullPath.Replace ("\\", "/"); + relativeToDirectory = relativeToDirectory.Replace ("\\", "/"); - var relativeUri = Uri.UnescapeDataString ( - dirUri.MakeRelativeUri (pathUri).OriginalString - ).Replace ("/", SourcesParser.DirectorySeparator); + if (!relativeToDirectory.EndsWith ("/")) + relativeToDirectory += "/"; + try { + var dirUri = new Uri (relativeToDirectory); + var pathUri = new Uri (fullPath); + + var relativePath = Uri.UnescapeDataString ( + dirUri.MakeRelativeUri (pathUri).OriginalString + ).Replace ("/", SourcesParser.DirectorySeparator) + .Replace (SourcesParser.DirectorySeparator + SourcesParser.DirectorySeparator, SourcesParser.DirectorySeparator); + + return relativePath; + } catch (Exception) { + Console.Error.WriteLine ($"// Parse error when treating '{fullPath}' as a URI relative to directory '{relativeToDirectory}'"); + ErrorCount += 1; + return fullPath; + } + + /* if (SourcesParser.TraceLevel >= 4) - Console.Error.WriteLine ($"// {fullPath} -> {relativeUri}"); - - return relativeUri; + Console.Error.WriteLine ($"// {fullPath} -> {relativePath}"); + */ } - private IEnumerable EnumerateMatches ( + public IEnumerable EnumerateMatches ( + SourcesFile sourcesFile, IEnumerable entries, - string hostPlatformName, string profileName + bool forExclusionsList ) { - foreach (var entry in entries) { - if ( - (hostPlatformName != null) && - (entry.HostPlatform ?? hostPlatformName) != hostPlatformName - ) - continue; - if ( - (profileName != null) && - (entry.ProfileName ?? profileName) != profileName - ) - continue; + var patternChars = new [] { '*', '?' }; - var absolutePath = Path.Combine (entry.Directory, entry.Pattern); + var isFirstError = true; + + foreach (var entry in entries) { + var absolutePath = Path.GetFullPath (Path.Combine (entry.Directory, entry.Pattern)); var absoluteDirectory = Path.GetDirectoryName (absolutePath); var absolutePattern = Path.GetFileName (absolutePath); - if (SourcesParser.TraceLevel >= 3) { + if (SourcesParser.TraceLevel >= 4) { if ((absolutePattern != entry.Pattern) || (absoluteDirectory != entry.Directory)) Console.Error.WriteLine ($"// {entry.Directory} / {entry.Pattern} -> {absoluteDirectory} / {absolutePattern}"); } if (!Directory.Exists (absoluteDirectory)) { - Console.Error.WriteLine ($"Directory does not exist: {Path.GetFullPath (absoluteDirectory)}"); - ErrorCount += 1; + if (isFirstError) { + isFirstError = false; + Console.Error.WriteLine ($"// Error(s) in file {sourcesFile.FileName}:"); + } + + if (forExclusionsList) { + Console.Error.WriteLine ($"(ignored) Directory does not exist: '{Path.GetFullPath (absoluteDirectory)}'"); + } else { + Console.Error.WriteLine ($"Directory does not exist: '{Path.GetFullPath (absoluteDirectory)}'"); + ErrorCount += 1; + } continue; } - var matchingFiles = Directory.GetFiles (absoluteDirectory, absolutePattern); - foreach (var fileName in matchingFiles) { - var relativePath = GetRelativePath (fileName, LibraryDirectory); - yield return relativePath; + if (absolutePattern.IndexOfAny (patternChars) >= 0) { + var matchingFiles = Directory.GetFiles (absoluteDirectory, absolutePattern); + if (matchingFiles.Length == 0) { + if (SourcesParser.TraceLevel > 0) + Console.Error.WriteLine ($"// No matches for pattern '{absolutePattern}'"); + } + + foreach (var fileName in matchingFiles) { + var relativePath = GetRelativePath (fileName, LibraryDirectory); + yield return new MatchEntry { + SourcesFile = sourcesFile, + RelativePath = relativePath, + }; + } + } else { + if (!File.Exists (absolutePath)) { + if (isFirstError) { + isFirstError = false; + Console.Error.WriteLine ($"// Error(s) in file {sourcesFile.FileName}:"); + } + + if (forExclusionsList) { + Console.Error.WriteLine ($"(ignored) File does not exist: '{absolutePath}'"); + } else { + Console.Error.WriteLine ($"File does not exist: '{absolutePath}'"); + ErrorCount += 1; + } + } else { + var relativePath = GetRelativePath (absolutePath, LibraryDirectory); + yield return new MatchEntry { + SourcesFile = sourcesFile, + RelativePath = relativePath, + }; + } } } } - // If you loaded sources files for multiple profiles, you can use the arguments here - // to filter the results - public IEnumerable GetFileNames ( - string hostPlatformName = null, string profileName = null + private IEnumerable GetMatchesFromFile ( + SourcesFile sourcesFile, HashSet excludedFiles = null ) { - var encounteredFileNames = new HashSet (StringComparer.Ordinal); + if (sourcesFile == null) + yield break; - var excludedFiles = new HashSet ( - EnumerateMatches (Exclusions, hostPlatformName, profileName), - StringComparer.Ordinal - ); + if (excludedFiles == null) + excludedFiles = new HashSet (StringComparer.Ordinal); - foreach (var fileName in EnumerateMatches (Sources, hostPlatformName, profileName)) { - if (excludedFiles.Contains (fileName)) { + foreach (var m in EnumerateMatches (sourcesFile, sourcesFile.Exclusions, true)) + excludedFiles.Add (m.RelativePath); + + foreach (var include in sourcesFile.Includes) { + foreach (var m in GetMatchesFromFile (include, excludedFiles)) + yield return m; + } + + // FIXME: This is order-sensitive + foreach (var entry in EnumerateMatches (sourcesFile, sourcesFile.Sources, false)) { + if (excludedFiles.Contains (entry.RelativePath)) { if (SourcesParser.TraceLevel >= 3) - Console.Error.WriteLine ($"// Excluding {fileName}"); + Console.Error.WriteLine ($"// Excluding {entry.RelativePath}"); continue; } - // Skip duplicates - if (encounteredFileNames.Contains (fileName)) - continue; - - encounteredFileNames.Add (fileName); - yield return fileName; + yield return entry; } } + + public IEnumerable GetMatches (TargetParseResult target = null) { + var excludedFiles = new HashSet (StringComparer.Ordinal); + + if (target == null) { + if (TargetDictionary.Count == 0) + yield break; + + target = Targets.First (); + } + + if (target == null) + throw new ArgumentNullException ("target"); + + if (SourcesParser.TraceLevel >= 3) + Console.Error.WriteLine ($"// Scanning sources file tree for {target.Key}"); + + int count = 0; + foreach (var m in GetMatchesFromFile (target.Exclusions, excludedFiles)) + excludedFiles.Add (m.RelativePath); + + foreach (var m in GetMatchesFromFile (target.Sources, excludedFiles)) { + count++; + yield return m; + } + + if (SourcesParser.TraceLevel >= 3) + Console.Error.WriteLine ($"// Scan complete. Generated {count} successful matches."); + } } public class SourcesParser { @@ -229,18 +391,6 @@ public class SourcesParser { public string ProfileName; public int SourcesFilesParsed, ExclusionsFilesParsed; - - public List ParsedSources { - get { - return Result.Sources; - } - } - - public List ParsedExclusions { - get { - return Result.Exclusions; - } - } } public readonly string[] AllHostPlatformNames; @@ -259,111 +409,235 @@ public class SourcesParser { .ToArray (); } + public ParseResult Parse (string libraryDirectory, string sourcesFileName, string exclusionsFileName) { + var state = new State { + Result = new ParseResult (libraryDirectory) + }; + + var tpr = new TargetParseResult { + Key = (hostPlatform: null, profile: null) + }; + + var parsedTarget = ParseIntoTarget (state, tpr, sourcesFileName, exclusionsFileName, null, overrideDirectory: libraryDirectory); + + PrintSummary (state, sourcesFileName); + return state.Result; + } + public ParseResult Parse (string libraryDirectory, string libraryName, string hostPlatform, string profile) { var state = new State { - Result = new ParseResult (libraryDirectory, libraryName), + Result = new ParseResult (libraryDirectory), ProfileName = profile, HostPlatform = hostPlatform }; var testPath = Path.Combine (libraryDirectory, $"{hostPlatform}_{profile}_{libraryName}"); - var ok = TryParseSingleFile (state, testPath + ".sources", false); - TryParseSingleFile (state, testPath + ".exclude.sources", true); + var ok = TryParseTargetInto (state, testPath); if (ok) { - PrintSummary (state); + PrintSummary (state, testPath); return state.Result; } state.HostPlatform = null; testPath = Path.Combine (libraryDirectory, $"{profile}_{libraryName}"); - ok = TryParseSingleFile (state, testPath + ".sources", false); - TryParseSingleFile (state, testPath + ".exclude.sources", true); + ok = TryParseTargetInto (state, testPath); if (ok) { - PrintSummary (state); + PrintSummary (state, testPath); return state.Result; } testPath = Path.Combine (libraryDirectory, $"{hostPlatform}_{libraryName}"); - ok = TryParseSingleFile (state, testPath + ".sources", false); - TryParseSingleFile (state, testPath + ".exclude.sources", true); + ok = TryParseTargetInto (state, testPath); if (ok) { - PrintSummary (state); + PrintSummary (state, testPath); return state.Result; } state.ProfileName = null; testPath = Path.Combine (libraryDirectory, libraryName); - TryParseSingleFile (state, testPath + ".sources", false); - TryParseSingleFile (state, testPath + ".exclude.sources", true); + ok = TryParseTargetInto (state, testPath); - PrintSummary (state); + PrintSummary (state, testPath); return state.Result; } + private void StripFallbackTargetsOrDefaultTarget ( + State state, TargetParseResult defaultTarget, List fallbackTargets, int maximumCount + ) { + if (fallbackTargets.Count == maximumCount) { + // If we didn't find any platform specific targets, remove them and just leave one single + // platform-specific target entry + foreach (var target in fallbackTargets) + state.Result.TargetDictionary.Remove (target.Key); + } else if (defaultTarget != null) { + // Otherwise, strip the non-platform-specific target + state.Result.TargetDictionary.Remove (defaultTarget.Key); + } + } + public ParseResult Parse (string libraryDirectory, string libraryName) { var state = new State { - Result = new ParseResult (libraryDirectory, libraryName) + Result = new ParseResult (libraryDirectory) }; - string testPath = Path.Combine (libraryDirectory, libraryName); - TryParseSingleFile (state, testPath + ".sources", false); - TryParseSingleFile (state, testPath + ".exclude.sources", true); + string originalTestPath = Path.Combine (libraryDirectory, libraryName); + var defaultTarget = ParseTarget (state, originalTestPath, null); + var profileFallbackTargets = new List (); foreach (var profile in AllProfileNames) { state.ProfileName = profile; + state.HostPlatform = null; + + var testPath = Path.Combine (libraryDirectory, $"{profile}_{libraryName}"); + var profileTarget = ParseTarget (state, testPath, defaultTarget); + if ((profileTarget != null) && profileTarget.IsFallback) + profileFallbackTargets.Add (profileTarget); + + var fallbackTargets = new List (); foreach (var hostPlatform in AllHostPlatformNames) { state.HostPlatform = hostPlatform; testPath = Path.Combine (libraryDirectory, $"{hostPlatform}_{profile}_{libraryName}"); - TryParseSingleFile (state, testPath + ".sources", false); - TryParseSingleFile (state, testPath + ".exclude.sources", true); + var target = ParseTarget (state, testPath, profileTarget ?? defaultTarget); + if ((target != null) && target.IsFallback) + fallbackTargets.Add (target); } - state.HostPlatform = null; - - testPath = Path.Combine (libraryDirectory, $"{profile}_{libraryName}"); - TryParseSingleFile (state, testPath + ".sources", false); - TryParseSingleFile (state, testPath + ".exclude.sources", true); + StripFallbackTargetsOrDefaultTarget (state, profileTarget, fallbackTargets, AllHostPlatformNames.Length); } - PrintSummary (state); + StripFallbackTargetsOrDefaultTarget (state, defaultTarget, profileFallbackTargets, AllProfileNames.Length); + + var platformFallbackTargets = new List (); + + foreach (var hostPlatform in AllHostPlatformNames) { + state.ProfileName = null; + state.HostPlatform = hostPlatform; + + var testPath = Path.Combine (libraryDirectory, $"{hostPlatform}_{libraryName}"); + var target = ParseTarget (state, testPath, defaultTarget); + if ((target != null) && target.IsFallback) + platformFallbackTargets.Add (target); + } + + StripFallbackTargetsOrDefaultTarget (state, defaultTarget, platformFallbackTargets, AllHostPlatformNames.Length); + + PrintSummary (state, originalTestPath); return state.Result; } - private void PrintSummary (State state) { + private void PrintSummary (State state, string testPath) { if (TraceLevel > 0) - Console.Error.WriteLine ($"// Parsed {state.SourcesFilesParsed} sources file(s) and {state.ExclusionsFilesParsed} exclusions file(s)."); + Console.Error.WriteLine ($"// Parsed {state.SourcesFilesParsed} sources file(s) and {state.ExclusionsFilesParsed} exclusions file(s) from path '{testPath}'."); } - private void HandleMetaDirective (State state, string directory, bool asExclusionsList, string directive) { + private void HandleMetaDirective ( + State state, SourcesFile file, + string pathDirectory, string includeDirectory, + bool asExclusionsList, string directive + ) { var include = "#include "; - if (directive.StartsWith (include)) - ParseSingleFile (state, Path.Combine (directory, directive.Substring (include.Length)), asExclusionsList); + if (directive.StartsWith (include)) { + var includeName = directive.Substring (include.Length).Trim (); + var fileName = Path.Combine (includeDirectory, includeName); + if (!File.Exists (fileName)) { + Console.Error.WriteLine ($"// Include does not exist: {fileName}"); + state.Result.ErrorCount++; + return; + } + + var newFile = ParseSingleFile (state, fileName, asExclusionsList, overrideDirectory: pathDirectory); + if (newFile == null) { + Console.Error.WriteLine ($"// Failed to parse included file: {fileName}"); + state.Result.ErrorCount++; + return; + } + + file.Includes.Add (newFile); + } } - private bool TryParseSingleFile (State state, string fileName, bool asExclusionsList) { - if (!File.Exists (fileName)) - return false; - - ParseSingleFile (state, fileName, asExclusionsList); - return true; + private bool TryParseTargetInto (State state, string prefix) { + var result = ParseTarget (state, prefix, null); + return (result != null); } - private void ParseSingleFile (State state, string fileName, bool asExclusionsList) { + private TargetParseResult ParseTarget (State state, string prefix, TargetParseResult fallbackTarget) { + // FIXME: We determine the prefix for the pair of sources and exclusions, + // which may not match intended behavior: + // if linux_net_4_x_foo.sources is present, but linux_net_4_x_foo.exclude.sources is not present, + // should net_4_x_foo.exclude.sources be used as a fallback? Maybe it should. + // This won't do that though. + + var tpr = new TargetParseResult { + Key = (hostPlatform: state.HostPlatform, profile: state.ProfileName) + }; + + var sourcesFileName = prefix + ".sources"; + var exclusionsFileName = prefix + ".exclude.sources"; + + return ParseIntoTarget (state, tpr, sourcesFileName, exclusionsFileName, fallbackTarget); + } + + private TargetParseResult ParseIntoTarget ( + State state, TargetParseResult tpr, + string sourcesFileName, string exclusionsFileName, + TargetParseResult fallbackTarget, string overrideDirectory = null + ) { + if (!File.Exists (sourcesFileName)) { + if (fallbackTarget != null) { + if (TraceLevel >= 2) + Console.Error.WriteLine($"// Not found: {sourcesFileName}, falling back to {fallbackTarget}"); + tpr.Sources = fallbackTarget.Sources; + tpr.Exclusions = fallbackTarget.Exclusions; + tpr.IsFallback = true; + state.Result.TargetDictionary.Add (tpr.Key, tpr); + return tpr; + } else { + if (TraceLevel >= 1) + Console.Error.WriteLine($"// Not found: {sourcesFileName}"); + return null; + } + } + + tpr.Sources = ParseSingleFile (state, sourcesFileName, false, overrideDirectory: overrideDirectory); + + if (File.Exists (exclusionsFileName)) + tpr.Exclusions = ParseSingleFile (state, exclusionsFileName, true, overrideDirectory: overrideDirectory); + + state.Result.TargetDictionary.Add (tpr.Key, tpr); + return tpr; + } + + private SourcesFile ParseSingleFile (State state, string fileName, bool asExclusionsList, string overrideDirectory = null) { + var fileTable = asExclusionsList ? state.Result.ExclusionFiles : state.Result.SourcesFiles; + var nullStr = ""; - if (TraceLevel >= 1) - Console.Error.WriteLine ($"// {new String (' ', ParseDepth * 2)}{fileName} [{state.HostPlatform ?? nullStr}] [{state.ProfileName ?? nullStr}]"); + + if (fileTable.ContainsKey (fileName)) { + if (TraceLevel >= 2) + Console.Error.WriteLine ($"// {new String (' ', ParseDepth * 2)}{fileName} (already parsed)"); + + return fileTable[fileName]; + } else { + if (TraceLevel >= 2) + Console.Error.WriteLine ($"// {new String (' ', ParseDepth * 2)}{fileName} [{state.HostPlatform ?? nullStr}] [{state.ProfileName ?? nullStr}]"); + } + ParseDepth += 1; - var directory = Path.GetDirectoryName (fileName); + var includeDirectory = Path.GetDirectoryName (fileName); + var pathDirectory = overrideDirectory ?? includeDirectory; + var result = new SourcesFile (fileName, asExclusionsList); + fileTable.Add (fileName, result); using (var sr = new StreamReader (fileName)) { if (asExclusionsList) @@ -373,14 +647,16 @@ public class SourcesParser { string line; while ((line = sr.ReadLine ()) != null) { - if (String.IsNullOrWhiteSpace (line)) - continue; - if (line.StartsWith ("#")) { - HandleMetaDirective (state, directory, asExclusionsList, line); + HandleMetaDirective (state, result, pathDirectory, includeDirectory, asExclusionsList, line); continue; } + line = line.Trim (); + + if (String.IsNullOrWhiteSpace (line)) + continue; + var parts = line.Split (':'); if (parts.Length > 1) { @@ -394,27 +670,22 @@ public class SourcesParser { var mainPatternDirectory = Path.GetDirectoryName (parts[0]); foreach (var pattern in explicitExclusions) { - state.ParsedExclusions.Add (new ParseEntry { - SourcesFileName = fileName, - Directory = directory, - Pattern = Path.Combine (mainPatternDirectory, pattern), - HostPlatform = state.HostPlatform, - ProfileName = state.ProfileName + result.Exclusions.Add (new ParseEntry { + Directory = pathDirectory, + Pattern = Path.Combine (mainPatternDirectory, pattern) }); } } - (asExclusionsList ? state.ParsedExclusions : state.ParsedSources) + (asExclusionsList ? result.Exclusions : result.Sources) .Add (new ParseEntry { - SourcesFileName = fileName, - Directory = directory, - Pattern = parts[0], - HostPlatform = state.HostPlatform, - ProfileName = state.ProfileName + Directory = pathDirectory, + Pattern = parts[0] }); } } ParseDepth -= 1; + return result; } } \ No newline at end of file diff --git a/mcs/build/gensources.sh b/mcs/build/gensources.sh deleted file mode 100755 index 0163ec146e..0000000000 --- a/mcs/build/gensources.sh +++ /dev/null @@ -1,113 +0,0 @@ -#! /bin/sh - -outfile=$1 -incfile=$2 -excfile=$3 -extfile=$4 -extexcfile=$5 - -process_includes_1() { - sed -e '/^[ \t]*$/d' -e '/^[ \t]*#/d' -e '/*/d' $1 > $2 - if cmp -s $1 $2; then - false - else - sed -n 's,^[ \t]*#include ,,p' $1 | - while read inc; do - cat $inc >> $2 - echo $outfile: $inc >> $outfile.makefrag - echo $inc: >> $outfile.makefrag - done - - # expand wildcards - sed -n '/*/p' $1 | grep -v '#' | - while read wildc; do - # quick syntax to exclude files: - # ../../../MyDir/*.cs:FileToExclude1.cs,FileToExclude2.cs - wc=`echo $wildc | cut -d \: -f 1` # ../../../MyDir/*.cs - qexc=`echo $wildc | cut -d \: -f 2` # FileToExclude1.cs,FileToExclude2.cs - - if test "$wc" = "$qexc"; then - # no quick excludes - just expand the wildcard - ls $wildc >> $2 - else - wcdir=`echo $wildc | cut -d \* -f 1` # ../../../MyDir/ - # Enumerate files from 'FileToExclude1.cs,FileToExclude2.cs' - # and save to $outfile.exc - oldIFS=$IFS - IFS=, - for i in $qexc; do - echo "$wcdir$i" >> $outfile.exc - done - IFS=$oldIFS - ls $wc >> $2 - fi - done - fi -} - -process_includes() { - i=$1; o=$2; t=${2}.tmp - while process_includes_1 $i $o; do - mv $o $t - i=$t - done - rm -f $t -} - -check_newline_eof() { - file=$1 - if ! test -f "$file"; then return; fi - if ! test -z "$(tail -c 1 "$file")"; then echo "$file: missing newline at end of file."; exit 1; fi -} - -check_newline_eof $incfile -check_newline_eof $excfile -check_newline_eof $extfile -check_newline_eof $extexcfile - -rm -f $outfile.makefrag - -process_includes $incfile $outfile.inc - -if test x$extfile != x -a -f "$extfile"; then - process_includes $extfile $outfile.ext.inc - cat $outfile.ext.inc >> $outfile.inc - rm -f $outfile.ext.inc -fi - -sort -u $outfile.inc > $outfile.inc_s -rm -f $outfile.inc - - -if test -n "$excfile" -a -f "$excfile"; then - process_includes $excfile $outfile.exc -fi - -if test -n "$extexcfile"; then - process_includes $extexcfile $outfile.ext_exc - cat $outfile.ext_exc >> $outfile.exc - rm -f $outfile.ext_exc -fi - -if test -f $outfile.exc; then - # So what we're doing below with uniq -u is that we take - # lines that have not been duplicated. This computes the - # symmetric difference between the files. This is not - # what we want. If a file is in the excludes but not in - # the sources, we want that file not to show up. By duplicating the - # excludes, we ensure that we won't end up in this failure state. - sort -u $outfile.exc > $outfile.exc_s - - # Duplicate excludes - cat $outfile.exc_s >> $outfile.exc_s_dup - cat $outfile.exc_s >> $outfile.exc_s_dup - - rm -f $outfile.exc $outfile.exc_s - - cat $outfile.inc_s $outfile.exc_s_dup | sort | uniq -u > $outfile - rm -f $outfile.inc_s $outfile.exc_s_dup -else - mv $outfile.inc_s $outfile -fi - - diff --git a/mcs/build/library.make b/mcs/build/library.make index 120b09b771..d7cabd9c68 100644 --- a/mcs/build/library.make +++ b/mcs/build/library.make @@ -136,6 +136,7 @@ csproj-library: echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \ (echo $(is_boot); \ echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(KEYFILE_MCS_FLAGS); \ + echo $(LIBRARY); \ echo $(LIBRARY_NAME); \ echo $(BUILT_SOURCES_cmdline); \ echo $(build_lib); \ @@ -236,11 +237,12 @@ ifdef RESOURCE_DEFS $(foreach pair,$(RESOURCE_DEFS), $(eval $(call RESOURCE_template,$(word 1, $(subst $(ccomma), ,$(pair))), $(word 2, $(subst $(ccomma), ,$(pair)))))) endif -DISTFILES = $(wildcard *$(LIBRARY)*.sources) $(EXTRA_DISTFILES) $(DIST_LISTED_RESOURCES) +DISTFILES = $(wildcard *.sources) $(EXTRA_DISTFILES) $(DIST_LISTED_RESOURCES) ASSEMBLY = $(LIBRARY) ASSEMBLY_EXT = .dll the_assembly = $(the_lib) + include $(topdir)/build/tests.make ifdef HAVE_CS_TESTS @@ -251,6 +253,7 @@ csproj-test: echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \ (echo false; \ echo $(USE_MCS_FLAGS) -r:$(the_assembly) $(TEST_MCS_FLAGS); \ + echo $(LIBRARY); \ echo $(test_lib); \ echo $(BUILT_SOURCES_cmdline); \ echo $(test_lib); \ @@ -295,22 +298,18 @@ endif # The library # If the directory contains the per profile include file, generate list file. -PROFILE_sources := $(firstword $(if $(PROFILE_PLATFORM),$(wildcard $(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY).sources)) $(wildcard $(PROFILE)_$(LIBRARY).sources) $(wildcard $(LIBRARY).sources)) -PROFILE_excludes = $(firstword $(if $(PROFILE_PLATFORM),$(wildcard $(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY).exclude.sources)) $(wildcard $(PROFILE)_$(LIBRARY).exclude.sources)) +# TODO: depend on all *.sources for now and figure out how to list only needed files later +PROFILE_sources = $(wildcard *.sources) -gensources = $(topdir)/build/gensources.exe -$(gensources): $(topdir)/build/gensources.cs - $(BOOTSTRAP_MCS) -noconfig -debug:portable -r:mscorlib.dll -r:System.dll -r:System.Core.dll -out:$(gensources) $(topdir)/build/gensources.cs - -ifdef PROFILE_RUNTIME -GENSOURCES_RUNTIME = $(PROFILE_RUNTIME) +ifneq "x" "x$(PROFILE_RUNTIME)" +GENSOURCES_RUNTIME=$(PROFILE_RUNTIME) else -GENSOURCES_RUNTIME = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) +GENSOURCES_RUNTIME=MONO_PATH="$(GENSOURCES_LIBDIR)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) endif sourcefile = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).sources -$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(depsdir)/.stamp $(gensources) - $(GENSOURCES_RUNTIME) --debug $(gensources) "$@" "$(LIBRARY)" "$(PROFILE_PLATFORM)" "$(PROFILE)" +$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(depsdir)/.stamp $(GENSOURCES_CS) + $(GENSOURCES_RUNTIME) --debug $(GENSOURCES_EXE) --strict "$@" "$(LIBRARY)" "$(PROFILE_PLATFORM)" "$(PROFILE)" library_CLEAN_FILES += $(sourcefile) diff --git a/mcs/build/platforms/darwin.make b/mcs/build/platforms/macos.make similarity index 97% rename from mcs/build/platforms/darwin.make rename to mcs/build/platforms/macos.make index ef7e6ca58f..a8fe926dd9 100644 --- a/mcs/build/platforms/darwin.make +++ b/mcs/build/platforms/macos.make @@ -34,3 +34,5 @@ platform-check: # echo "*** You need to build MCS with GNU make. Try \`gmake'" ; \ # exit 1 ; \ # fi + +PLATFORM_MACOS=1 diff --git a/mcs/build/platforms/unix.make b/mcs/build/platforms/unix.make new file mode 100644 index 0000000000..f73d80f0ee --- /dev/null +++ b/mcs/build/platforms/unix.make @@ -0,0 +1,36 @@ +# -*- makefile -*- +# +# Platform-specific makefile rules. This one's for any unix (FreeBSD, OpenBSD, etc.) +# + +PLATFORM_MCS_FLAGS = +PLATFORM_RUNTIME = $(RUNTIME) +PLATFORM_CORLIB = mscorlib.dll +PLATFORM_TEST_HARNESS_EXCLUDES = + +EXTERNAL_MCS = mcs +EXTERNAL_MBAS = mbas +EXTERNAL_RUNTIME = mono +#ILDISASM = monodis +ILDISASM = false + +PLATFORM_PATH_SEPARATOR = : + +# Define this if this ever will work on Unix +# PLATFORM_MAKE_CORLIB_CMP = yes + +# This is for changing / to \ on windows +PLATFORM_CHANGE_SEPARATOR_CMD = cat + +hidden_prefix = . +hidden_suffix = + +platform-check: + @: +# I tried this but apparently Make's version strings aren't that +# ... consistent between releases. Whatever. +# +# @if ! $(MAKE) --version |grep '^GNU Make version 3' 1>/dev/null 2>&1 ; then \ +# echo "*** You need to build MCS with GNU make. Try \`gmake'" ; \ +# exit 1 ; \ +# fi diff --git a/mcs/build/profiles/basic.make b/mcs/build/profiles/basic.make index a1b9bf35bb..eb2264efd4 100644 --- a/mcs/build/profiles/basic.make +++ b/mcs/build/profiles/basic.make @@ -29,6 +29,9 @@ endif ILASM = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/ilasm.exe STRING_REPLACER = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/tmp/cil-stringreplacer.exe MCS = $(BOOTSTRAP_MCS) +GENSOURCES_CS = $(topdir)/build/gensources.cs +GENSOURCES_DIR = $(topdir)/build +GENSOURCES_EXE = $(GENSOURCES_DIR)/gensources.exe DEFAULT_REFERENCES = mscorlib @@ -113,9 +116,14 @@ do-profile-check-monolite: $(depsdir)/.stamp endif -$(PROFILE_EXE): $(topdir)/build/common/basic-profile-check.cs +$(PROFILE_EXE): $(topdir)/build/common/basic-profile-check.cs $(GENSOURCES_CS) $(MAKE) $(MAKE_Q) -C $(topdir)/packages - $(BOOTSTRAP_MCS) /warn:0 /noconfig /langversion:latest /r:System.dll /r:mscorlib.dll /out:$@ $< + $(BOOTSTRAP_MCS) /warn:0 /noconfig /langversion:latest /r:System.dll /r:mscorlib.dll /out:$@.tmp $< + $(BOOTSTRAP_MCS) /noconfig /langversion:latest /r:mscorlib.dll /r:System.dll /r:System.Core.dll /out:$(GENSOURCES_EXE).tmp $(GENSOURCES_CS) + - rm $(GENSOURCES_EXE) + mv $(GENSOURCES_EXE).tmp $(GENSOURCES_EXE) + - rm $@ + mv $@.tmp $@ $(PROFILE_OUT): $(PROFILE_EXE) $(PROFILE_RUNTIME) $< > $@ 2>&1 diff --git a/mcs/build/profiles/build.make b/mcs/build/profiles/build.make index b152a3086d..4a4a9594c1 100644 --- a/mcs/build/profiles/build.make +++ b/mcs/build/profiles/build.make @@ -6,7 +6,7 @@ BUILD_TOOLS_PROFILE = basic BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC) MCS = $(BOOTSTRAP_MCS) -PLATFORMS = darwin linux win32 +PLATFORMS = macos linux win32 unix # nuttzing! @@ -22,5 +22,4 @@ NO_TEST = yes NO_INSTALL = yes FRAMEWORK_VERSION = 4.5 -MONO_FEATURE_APPLETLS=1 diff --git a/mcs/build/profiles/net_4_x.make b/mcs/build/profiles/net_4_x.make index 0045b72a7e..6c63573645 100644 --- a/mcs/build/profiles/net_4_x.make +++ b/mcs/build/profiles/net_4_x.make @@ -5,7 +5,7 @@ BOOTSTRAP_PROFILE = build BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC) MCS = $(BOOTSTRAP_MCS) -PLATFORMS = darwin linux win32 +PLATFORMS = macos linux win32 unix # nuttzing! @@ -18,6 +18,9 @@ API_BIN_PROFILE = v4.7.1 FRAMEWORK_VERSION = 4.5 XBUILD_VERSION = 4.0 -MONO_FEATURE_APPLETLS=1 ENFORCE_LIBRARY_WARN_AS_ERROR = yes + +ifdef PLATFORM_MACOS +MONO_FEATURE_APPLETLS=1 +endif diff --git a/mcs/build/rules.make b/mcs/build/rules.make index 3f1d684bbe..831f149a61 100644 --- a/mcs/build/rules.make +++ b/mcs/build/rules.make @@ -56,7 +56,9 @@ INTERNAL_CSC = CSC_SDK_PATH_DISABLED= $(RUNTIME) $(RUNTIME_FLAGS) $(CSC_RUNTIME_ RESGEN = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resgen.exe STRING_REPLACER = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/cil-stringreplacer.exe ILASM = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/ilasm.exe - +GENSOURCES_LIBDIR = $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE) +GENSOURCES_CS = $(topdir)/build/gensources.cs +GENSOURCES_EXE = $(topdir)/build/gensources.exe depsdir = $(topdir)/build/deps @@ -72,6 +74,9 @@ export MKINSTALLDIRS export BOOTSTRAP_MCS export DESTDIR export RESGEN +export GENSOURCES_LIBDIR +export GENSOURCES_CS +export GENSOURCES_EXE # Get this so the platform.make platform-check rule doesn't become the # default target diff --git a/mcs/build/tests.make b/mcs/build/tests.make index ada45b1a6c..7c40e1771c 100644 --- a/mcs/build/tests.make +++ b/mcs/build/tests.make @@ -19,13 +19,22 @@ TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin ## Unit test support ifndef NO_TEST +test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests + test_nunit_lib = nunitlite.dll -xunit_core := xunit.core xunit.execution.desktop xunit.abstractions xunit.assert Xunit.NetCore.Extensions -xunit_deps := System.Runtime +xunit_core := xunit.core xunit.execution.dotnet xunit.abstractions xunit.assert Xunit.NetCore.Extensions +xunit_deps := netstandard System.Runtime xunit_src := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs) $(topdir)/../mcs/class/test-helpers/PlatformDetection.cs ifeq ($(USE_XTEST_REMOTE_EXECUTOR), YES) -XTEST_REMOTE_EXECUTOR = $(topdir)/class/lib/$(PROFILE)/RemoteExecutorConsoleApp.exe +XTEST_REMOTE_EXECUTOR = $(test_lib_dir)/RemoteExecutorConsoleApp.exe + +ifeq ($(BUILD_PLATFORM), win32) +XTEST_REMOTE_EXECUTOR_ABSPATH = $(shell cygpath -w $(abspath $(XTEST_REMOTE_EXECUTOR))) +else +XTEST_REMOTE_EXECUTOR_ABSPATH = $(abspath $(XTEST_REMOTE_EXECUTOR)) +endif + xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs \ $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs \ $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs \ @@ -62,6 +71,7 @@ test_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll.sources) endif test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll) +test_lib_output = $(test_lib_dir)/$(test_lib) test_sourcefile_excludes = $(test_lib).exclude.sources @@ -73,12 +83,13 @@ ifndef NO_BUILD test_flags += -r:$(the_assembly) test_assembly_dep = $(the_assembly) endif -tests_CLEAN_FILES += $(ASSEMBLY:$(ASSEMBLY_EXT)=_test*.dll) $(ASSEMBLY:$(ASSEMBLY_EXT)=_test*.pdb) $(test_response) $(test_makefrag) +tests_CLEAN_FILES += $(test_lib_output) $(test_lib_output:$(ASSEMBLY_EXT)=.pdb) $(test_response) $(test_makefrag) xtest_sourcefile = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources) xtest_sourcefile_excludes = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.exclude.sources) xunit_test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xunit-test.dll) +xtest_lib_output = $(test_lib_dir)/$(xunit_test_lib) xtest_response = $(depsdir)/$(xunit_test_lib).response xtest_makefrag = $(depsdir)/$(xunit_test_lib).makefrag @@ -86,7 +97,7 @@ xtest_flags = -r:$(the_assembly) $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LI ifeq ($(wildcard $(xtest_sourcefile)),) xtest_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources) -tests_CLEAN_FILES += $(xunit_test_lib) $(xtest_response) $(xtest_makefrag) +tests_CLEAN_FILES += $(xtest_lib_output) $(xtest_response) $(xtest_makefrag) endif ifndef HAVE_CS_TESTS @@ -113,10 +124,6 @@ endif test_assemblies := -test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests - -test_lib_output = $(topdir)/class/lib/$(PROFILE)/tests/$(test_lib) - ifdef HAVE_CS_TESTS test_assemblies += $(test_lib_output) @@ -247,10 +254,20 @@ $(test_lib_output): $(test_assembly_dep) $(test_response) $(test_nunit_dep) $(te test_response_preprocessed = $(test_response)_preprocessed +ifneq "x" "x$(PROFILE_RUNTIME)" +GENSOURCES_RUNTIME=$(PROFILE_RUNTIME) +else +ifneq "x" "x$(TEST_RUNTIME)" +GENSOURCES_RUNTIME=$(TEST_RUNTIME) +else +GENSOURCES_RUNTIME=MONO_PATH="$(GENSOURCES_LIBDIR)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) +endif +endif + # This handles .excludes/.sources pairs, as well as resolving the # includes that occur in .sources files -$(test_response_preprocessed): $(test_sourcefile) $(wildcard $(test_sourcefile_excludes)) - $(SHELL) $(topdir)/build/gensources.sh $@ '$(test_sourcefile)' '$(test_sourcefile_excludes)' +$(test_response_preprocessed): $(test_sourcefile) $(wildcard $(test_sourcefile_excludes)) $(GENSOURCES_CS) + $(GENSOURCES_RUNTIME) --debug $(GENSOURCES_EXE) --basedir:./Test --strict "$@" "$(test_sourcefile)" "$(test_sourcefile_excludes)" $(test_response): $(test_response_preprocessed) # @echo Creating $@ ... @@ -272,7 +289,8 @@ ifdef HAVE_CS_XTESTS XTEST_HARNESS_PATH := $(topdir)/../external/xunit-binaries XTEST_HARNESS = $(XTEST_HARNESS_PATH)/xunit.console.exe -XTEST_HARNESS_FLAGS := -noappdomain -noshadow -parallel none -nunit TestResult-$(PROFILE)-xunit.xml +XTEST_RESULT_FILE := TestResult-$(PROFILE)-xunit.xml +XTEST_HARNESS_FLAGS := -noappdomain -noshadow -parallel none -nunit $(XTEST_RESULT_FILE) XTEST_TRAIT := -notrait category=failing -notrait category=nonmonotests -notrait Benchmark=true -notrait category=outerloop # The logic is double inverted so this actually excludes tests not intented for current platform # best to search for `property name="category"` in the xml output to see what's going on @@ -294,34 +312,35 @@ XTEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(P endif check: run-xunit-test-local -xunit-test-local: $(xunit_test_lib) +xunit-test-local: $(xtest_lib_output) run-xunit-test-local: run-xunit-test-lib -# cp -rf is a HACK for xunit runner to require xunit.execution.desktop.dll file in local folder on .net only -run-xunit-test-lib: xunit-test-local $(XTEST_REMOTE_EXECUTOR) - @cp -rf $(XTEST_HARNESS_PATH)/xunit.execution.desktop.dll xunit.execution.desktop.dll +# cp -rf is a HACK for xunit runner to require xunit.execution.dOTNET.dll file in local folder on .net only +run-xunit-test-lib: xunit-test-local + @cp -rf $(XTEST_HARNESS_PATH)/xunit.execution.dotnet.dll $(test_lib_dir)/xunit.execution.dotnet.dll ok=:; \ - PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" REMOTE_EXECUTOR=$(XTEST_REMOTE_EXECUTOR) $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xunit_test_lib) $(XTEST_HARNESS_FLAGS) $(XTEST_TRAIT) $(XTEST_TRAIT_PLATFORM) || ok=false; \ + PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" REMOTE_EXECUTOR="$(XTEST_REMOTE_EXECUTOR_ABSPATH)" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xtest_lib_output) $(XTEST_HARNESS_FLAGS) $(XTEST_TRAIT) $(XTEST_TRAIT_PLATFORM) || ok=false; \ + if [ -n "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE" ]; then echo "$(abspath $(XTEST_RESULT_FILE))" >> "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE"; fi; \ $$ok - @rm -f xunit.execution.desktop.dll + @rm -f $(test_lib_dir)/xunit.execution.dotnet.dll # Some xunit tests want to be executed in a separate process (see RemoteExecutorTestBase) $(XTEST_REMOTE_EXECUTOR): $(topdir)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs $(TEST_COMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll $< -out:$@ -$(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src) +$(xtest_lib_output): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src) $(test_lib_dir) $(XTEST_REMOTE_EXECUTOR) $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src) xtest_response_preprocessed = $(xtest_response)_preprocessed # This handles .excludes/.sources pairs, as well as resolving the # includes that occur in .sources files -$(xtest_response): $(xtest_sourcefile) $(wildcard $(xtest_sourcefile_excludes)) - $(SHELL) $(topdir)/build/gensources.sh $@ '$(xtest_sourcefile)' '$(xtest_sourcefile_excludes)' +$(xtest_response): $(xtest_sourcefile) $(wildcard $(xtest_sourcefile_excludes)) $(GENSOURCES_CS) + $(GENSOURCES_RUNTIME) --debug $(GENSOURCES_EXE) --strict "$@" "$(xtest_sourcefile)" "$(xtest_sourcefile_excludes)" $(xtest_makefrag): $(xtest_response) @echo Creating $@ ... - @sed 's,^,$(xunit_test_lib): ,' $< >$@ + @sed 's,^,$(xtest_lib_output): ,' $< >$@ -include $(xtest_makefrag) diff --git a/mcs/class/Facades/System.Drawing.Primitives/Makefile b/mcs/class/Facades/System.Drawing.Primitives/Makefile index 036ec852fa..328b53b1b4 100644 --- a/mcs/class/Facades/System.Drawing.Primitives/Makefile +++ b/mcs/class/Facades/System.Drawing.Primitives/Makefile @@ -20,6 +20,11 @@ LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS) # TODO: find a better solution. EMBEDDED_DRAWING_DEP := $(filter xammac_net_4_5 testing_aot_full testing_aot_hybrid, $(PROFILE)) +ifeq ($(PROFILE),monodroid) +# XA implements System.Drawing API inside Mono.Android +API_BIN_REFS := Mono.Android +else + ifndef EMBEDDED_DRAWING_DEP # profiles which build a System.Drawing.dll in the repo @@ -29,12 +34,12 @@ ifdef REPO_DRAWING_DEP LIB_REFS += System.Drawing else # When System.Drawing.dll is not built in the Mono repo but in -# the product repo like in the XI/XA case we need to pass in a reference +# the product repo like in the XI case we need to pass in a reference # to the assembly containing drawing types like Rectangle etc. from there. # This needs to be passed in via EXTERNAL_FACADE_DRAWING_REFERENCE. LIB_MCS_FLAGS += /r:$(EXTERNAL_FACADE_DRAWING_REFERENCE) endif - +endif endif PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/netstandard/Makefile b/mcs/class/Facades/netstandard/Makefile index b9974695d6..c1e93987f1 100644 --- a/mcs/class/Facades/netstandard/Makefile +++ b/mcs/class/Facades/netstandard/Makefile @@ -28,6 +28,11 @@ else LIB_REFS += System.Web endif +ifeq ($(PROFILE),monodroid) +# XA implements System.Drawing API inside Mono.Android +API_BIN_REFS := Mono.Android +else + # profiles which build a System.Drawing.dll in the repo REPO_DRAWING_DEP := $(filter net_4_x orbis winaot unreal wasm, $(PROFILE)) @@ -51,7 +56,7 @@ else # This needs to be passed in via EXTERNAL_FACADE_DRAWING_REFERENCE. LIB_MCS_FLAGS += /r:$(EXTERNAL_FACADE_DRAWING_REFERENCE) endif - +endif endif PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/subdirs.make b/mcs/class/Facades/subdirs.make index 09243bdb1c..b941efca3f 100644 --- a/mcs/class/Facades/subdirs.make +++ b/mcs/class/Facades/subdirs.make @@ -40,6 +40,9 @@ netstandard_drawing_SUBDIRS = System.Drawing.Primitives netstandard monotouch_SUBDIRS = $(common_DEPS_SUBDIRS) $(mobile_only_DEPS_SUBDIRS) monotouch_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS) +monodroid_SUBDIRS = $(monotouch_SUBDIRS) $(netstandard_drawing_SUBDIRS) +monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) + # We don't build netstandard/System.Drawing.Primitives on monotouch etc. profiles by default, # except when EXTERNAL_FACADE_DRAWING_REFERENCE is defined which allows us to build it in Mono CI # (since the dependent drawing types are normally built in the product repos). @@ -63,9 +66,6 @@ System.Text.Encoding.CodePages build_PARALLEL_SUBDIRS = $(basic_PARALLEL_SUBDIRS) System.Text.RegularExpressions System.Diagnostics.Contracts -monodroid_SUBDIRS = $(monotouch_SUBDIRS) -monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) - xammac_SUBDIRS = $(monotouch_SUBDIRS) xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) diff --git a/mcs/class/I18N/EncodingTestBase.cs b/mcs/class/I18N/EncodingTestBase.cs new file mode 100644 index 0000000000..f1c75615d6 --- /dev/null +++ b/mcs/class/I18N/EncodingTestBase.cs @@ -0,0 +1,569 @@ +// +// EncodingTestBase.cs +// +// Author: +// Alexander Köplinger (alexander.koeplinger@xamarin.com) +// +// Copyright (C) 2017 Xamarin, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Text; + +using NUnit.Framework; +using NUnit.Framework.Constraints; + +namespace MonoTests.I18N +{ + public class CodePageTestInfo + { + public int CodePage; + public bool IsBrowserDisplay; + public bool IsBrowserSave; + public bool IsMailNewsDisplay; + public bool IsMailNewsSave; + public byte SuperscriptFiveReplacementChar; + public byte InfinityReplacementChar; + public byte FFReplacementChar; + public char A0Char; + public char? OneChar; + public char A8Char; + public int? CharsWritten; + public byte? SupplementChar; + public bool SkipGetBytes7Test; + public bool SkipEncoderFallbackTest; + public bool SkipEncoderFallback2Test; + public override string ToString () => "Codepage " + Convert.ToString (CodePage); + } + + // + // NOTE: when adding/updating tests here consider updating + // the following files as well since they have similar tests: + // + // - mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs + // - mcs/class/corlib/Test/System.Text/Latin1EncodingTest.cs + // + public abstract class EncodingTestBase + { + private char[] testchars; + private byte[] testbytes; + + [SetUp] + public void SetUp () + { + testchars = new char[4]; + testchars[0] = 'T'; + testchars[1] = 'e'; + testchars[2] = 's'; + testchars[3] = 't'; + testbytes = new byte[4]; + testbytes[0] = (byte) 'T'; + testbytes[1] = (byte) 'e'; + testbytes[2] = (byte) 's'; + testbytes[3] = (byte) 't'; + } + + [Test] + [TestCaseSource ("codepageTestInfos")] + public void IsBrowserDisplay (CodePageTestInfo cpInfo) + { + Assert.AreEqual (cpInfo.IsBrowserDisplay, Encoding.GetEncoding (cpInfo.CodePage).IsBrowserDisplay); + } + + [Test] + [TestCaseSource ("codepageTestInfos")] + public void IsBrowserSave (CodePageTestInfo cpInfo) + { + Assert.AreEqual (cpInfo.IsBrowserSave, Encoding.GetEncoding (cpInfo.CodePage).IsBrowserSave); + } + + [Test] + [TestCaseSource ("codepageTestInfos")] + public void IsMailNewsDisplay (CodePageTestInfo cpInfo) + { + Assert.AreEqual (cpInfo.IsMailNewsDisplay, Encoding.GetEncoding (cpInfo.CodePage).IsMailNewsDisplay); + } + + [Test] + [TestCaseSource ("codepageTestInfos")] + public void IsMailNewsSave (CodePageTestInfo cpInfo) + { + Assert.AreEqual (cpInfo.IsMailNewsSave, Encoding.GetEncoding (cpInfo.CodePage).IsMailNewsSave); + } + + [Test] // Test GetBytes(char[]) + [TestCaseSource ("codepageTestInfos")] + public void TestGetBytes1 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + byte[] bytes = test_encoding.GetBytes(testchars); + for (int i = 0; i < testchars.Length; i++) + Assert.AreEqual (testchars[i], (char) bytes[i]); + } + + [Test] // Test GetBytes(char[], int, int) + [TestCaseSource ("codepageTestInfos")] + public void TestGetBytes2 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + byte[] bytes = test_encoding.GetBytes(testchars, 1, 1); + Assert.AreEqual (1, bytes.Length, "#1"); + Assert.AreEqual (testchars [1], (char) bytes [0], "#2"); + } + + [Test] // Test non-Latin1 char in char[] + [TestCaseSource ("codepageTestInfos")] + public void TestGetBytes3 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + testchars[2] = (char) 0x100; + byte[] bytes = test_encoding.GetBytes(testchars); + Assert.AreEqual ('T', (char) bytes [0], "#1"); + Assert.AreEqual ('e', (char) bytes [1], "#2"); + Assert.AreEqual (cpInfo.FFReplacementChar, (char) bytes [2], "#3"); + Assert.AreEqual ('t', (char) bytes [3], "#4"); + } + + [Test] // Test GetBytes(char[], int, int, byte[], int) + [TestCaseSource ("codepageTestInfos")] + public void TestGetBytes4 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + byte[] bytes = new Byte[1]; + int cnt = test_encoding.GetBytes(testchars, 1, 1, bytes, 0); + Assert.AreEqual (1, cnt, "#1"); + Assert.AreEqual (testchars [1], (char) bytes [0], "#2"); + } + + [Test] // Test GetBytes(string, int, int, byte[], int) + [TestCaseSource ("codepageTestInfos")] + public void TestGetBytes5 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + byte[] bytes = new Byte[1]; + int cnt = test_encoding.GetBytes("Test", 1, 1, bytes, 0); + Assert.AreEqual ('e', (char) bytes [0], "#1"); + } + + [Test] // Test GetBytes(string) + [TestCaseSource ("codepageTestInfos")] + public void TestGetBytes6 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + byte[] bytes = test_encoding.GetBytes("Test"); + for (int i = 0; i < testchars.Length; i++) + Assert.AreEqual (testchars [i], (char) bytes [i]); + } + + [Test] // Test GetBytes(string) + [TestCaseSource ("codepageTestInfos")] + public void TestGetBytes7 (CodePageTestInfo cpInfo) + { + if (cpInfo.SkipGetBytes7Test) + Assert.Ignore ("Codepage indicates this test should be skipped."); + + var test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + + var expected = new byte [] { 0x3F, 0x20, cpInfo.SuperscriptFiveReplacementChar, 0x20, cpInfo.InfinityReplacementChar }; + if (cpInfo.SupplementChar.HasValue) { + var expectedNew = new byte [expected.Length + 1]; + expected.CopyTo (expectedNew, 0); + expectedNew [expected.Length] = cpInfo.SupplementChar.Value; + expected = expectedNew; + } + var actual = test_encoding.GetBytes("\u24c8 \u2075 \u221e"); // normal replacement + Assert.AreEqual (expected, actual, "#1"); + + expected = new byte [] { 0x3F, 0x3F }; + actual = test_encoding.GetBytes("\ud83d\ude0a"); // surrogate pair replacement + Assert.AreEqual (expected, actual, "#2"); + + expected = new byte [] { 0x3F, 0x3F, 0x20 }; + actual = test_encoding.GetBytes("\ud83d\ude0a "); // surrogate pair replacement + Assert.AreEqual (expected, actual, "#3"); + + expected = new byte [] { 0x20, 0x20, 0x3F, 0x3F, 0x20, 0x20 }; + actual = test_encoding.GetBytes(" \ud83d\ude0a "); // surrogate pair replacement + Assert.AreEqual (expected, actual, "#4"); + + expected = new byte [] { 0x20, 0x20, 0x3F, 0x3F, 0x20, 0x20 }; + actual = test_encoding.GetBytes(" \ud834\udd1e "); // surrogate pair replacement + Assert.AreEqual (expected, actual, "#5"); + + expected = new byte [] { 0x41, 0x42, 0x43, 0x00, 0x41, 0x42, 0x43 }; + actual = test_encoding.GetBytes("ABC\0ABC"); // embedded zero byte not replaced + Assert.AreEqual (expected, actual, "#6"); + + expected = new byte [] { 0x20, 0x20, 0x3F, 0x20, 0x20 }; + actual = test_encoding.GetBytes(" \ud834 "); // invalid surrogate pair replacement + Assert.AreEqual (expected, actual, "#7"); + } + + [Test] // Test GetChars(byte[]) + [TestCaseSource ("codepageTestInfos")] + public void TestGetChars1 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + char[] chars = test_encoding.GetChars(testbytes); + for (int i = 0; i < testbytes.Length; i++) + Assert.AreEqual (testbytes[i], (byte) chars[i]); + } + + [Test] // Test GetChars(byte[], int, int) + [TestCaseSource ("codepageTestInfos")] + public void TestGetChars2 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + char[] chars = test_encoding.GetChars(testbytes, 1, 1); + Assert.AreEqual (1, chars.Length, "#1"); + Assert.AreEqual (testbytes [1], (byte) chars [0], "#2"); + } + + [Test] // Test GetChars(byte[], int, int, char[], int) + [TestCaseSource ("codepageTestInfos")] + public void TestGetChars4 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + char[] chars = new char[1]; + int cnt = test_encoding.GetChars(testbytes, 1, 1, chars, 0); + Assert.AreEqual (1, cnt, "#1"); + Assert.AreEqual (testbytes [1], (byte) chars [0], "#2"); + } + + [Test] // Test GetString(char[]) + [TestCaseSource ("codepageTestInfos")] + public void TestGetString1 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + string str = test_encoding.GetString(testbytes); + Assert.AreEqual ("Test", str); + } + + [Test] // Test GetString(char[], int, int) + [TestCaseSource ("codepageTestInfos")] + public void TestGetString2 (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + string str = test_encoding.GetString(testbytes, 1, 2); + Assert.AreEqual ("es", str); + } + + [Test] // Test Decoder + [TestCaseSource ("codepageTestInfos")] + public void TestDecoder (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + char[] chars = new char[1]; + int cnt = test_encoding.GetDecoder().GetChars(testbytes, 1, 1, chars, 0); + Assert.AreEqual (1, cnt, "#1"); + Assert.AreEqual (testbytes [1], (byte) chars [0], "#2"); + } + + [Test] // Test Decoder + [TestCaseSource ("codepageTestInfos")] + public void TestEncoder (CodePageTestInfo cpInfo) + { + Encoding test_encoding = Encoding.GetEncoding (cpInfo.CodePage); + byte[] bytes = new Byte[1]; + int cnt = test_encoding.GetEncoder().GetBytes(testchars, 1, 1, bytes, 0, false); + Assert.AreEqual (1, cnt, "#1"); + Assert.AreEqual (testchars [1], (char) bytes [0], "#2"); + } + + [Test] + [TestCaseSource ("codepageTestInfos")] + public void TestZero (CodePageTestInfo cpInfo) + { + Encoding encoding = Encoding.GetEncoding (cpInfo.CodePage); + Assert.AreEqual (string.Empty, encoding.GetString (new byte [0]), "#1"); + Assert.AreEqual (string.Empty, encoding.GetString (new byte [0], 0, 0), "#2"); + } + + [Test] + [ExpectedException (typeof (EncoderFallbackException))] + [TestCaseSource ("codepageTestInfos")] + public void EncoderFallback (CodePageTestInfo cpInfo) + { + if (cpInfo.SkipEncoderFallbackTest) + Assert.Ignore ("Codepage indicates this test should be skipped."); + + Encoding e = Encoding.GetEncoding (cpInfo.CodePage).Clone () as Encoding; + e.EncoderFallback = new EncoderExceptionFallback (); + e.GetBytes ("\u24c8"); + } + + [Test] + [TestCaseSource ("codepageTestInfos")] + public void EncoderFallback2 (CodePageTestInfo cpInfo) + { + if (cpInfo.SkipEncoderFallback2Test) + Assert.Ignore ("Codepage indicates this test should be skipped."); + + Encoding e = Encoding.GetEncoding (cpInfo.CodePage).Clone () as Encoding; + e.EncoderFallback = new BackslashEncoderReplaceFallback (); + + byte[] bytes = e.GetBytes ("a\xac\u1234\u20ac\u8000"); + var expected = new byte[] { 0x61, 0xAC, 0x5C, 0x75, 0x31, 0x32, 0x33, 0x34, 0x5C, 0x75, 0x32, 0x30, 0x61, 0x63, 0x5C, 0x75, 0x38, 0x30, 0x30, 0x30 }; + // FIXME: some codepages do have U+00AC (logical not sign) or U+20AC (euro sign), we need to adapt the tests + // Assert.AreEqual (expected, bytes); + + bytes = e.GetBytes ("1\u04d92"); + expected = new byte[] { 0x31, 0x5C, 0x75, 0x30, 0x34, 0x64, 0x39, 0x32 }; + Assert.AreEqual (expected, bytes); + + e.EncoderFallback = new EncoderExceptionOnWrongIndexFallback ('\u04d9', 1); + bytes = e.GetBytes ("1\u04d92"); + expected = new byte[] { 0x31, 0x21, 0x32 }; + Assert.AreEqual (expected, bytes); + + e.EncoderFallback = new EncoderExceptionOnWrongIndexFallback ('\u04d9', 0); + bytes = e.GetBytes ("\u04d921"); + expected = new byte[] { 0x21, 0x32, 0x31 }; + Assert.AreEqual (expected, bytes); + } + + [Test] + // [ExpectedException (typeof (ArgumentException))] + [TestCaseSource ("codepageTestInfos")] + public void DecoderFallback2 (CodePageTestInfo cpInfo) + { + var bytes = new byte[] { + 0x30, 0xa0, 0x31, 0xa8 + }; + var enc = (Encoding)Encoding.GetEncoding (cpInfo.CodePage).Clone (); + enc.DecoderFallback = new TestFallbackDecoder (); + + var chars = new char [7]; + var ret = enc.GetChars (bytes, 0, bytes.Length, chars, 0); + } + + [Test] + [TestCaseSource ("codepageTestInfos")] + public void DecoderFallback3 (CodePageTestInfo cpInfo) + { + var bytes = new byte[] { + 0x30, 0xa0, 0x31, 0xa8 + }; + var enc = (Encoding)Encoding.GetEncoding (cpInfo.CodePage).Clone (); + enc.DecoderFallback = new TestFallbackDecoder (); + + var chars = new char[] { '9', '8', '7', '6', '5' }; + var ret = enc.GetChars (bytes, 0, bytes.Length, chars, 0); + + Assert.That (ret, Is.EqualTo (cpInfo.CharsWritten ?? 4), "ret"); + Assert.That (chars [0], Is.EqualTo ('0'), "chars[0]"); + Assert.That (chars [1], Is.EqualTo (cpInfo.A0Char), "chars[1]"); + Assert.That (chars [2], Is.EqualTo ((cpInfo).OneChar ?? '1'), "chars[2]"); + Assert.That (chars [3], Is.EqualTo ((char)cpInfo.A8Char), "chars[3]"); + Assert.That (chars [4], Is.EqualTo ('5'), "chars[4]"); + } + + class TestFallbackDecoder : DecoderFallback { + const int count = 2; + + public override int MaxCharCount { + get { return count; } + } + + public override DecoderFallbackBuffer CreateFallbackBuffer () + { + return new Buffer (); + } + + class Buffer : DecoderFallbackBuffer { + char[] queue; + int index; + + public override int Remaining { + get { + return queue.Length - index; + } + } + + public override char GetNextChar () + { + return index < queue.Length ? queue [index++] : '\0'; + } + + public override bool Fallback (byte[] bytes, int unused) + { + queue = new char[bytes.Length * count]; + index = 0; + for (int i = 0; i < bytes.Length; i++) { + for (int j = 0; j < count; j++) + queue [index++] = (char)(bytes [i]+j); + } + return true; + } + + public override bool MovePrevious () + { + throw new NotImplementedException (); + } + + public override void Reset () + { + base.Reset (); + } + } + } + + class BackslashEncoderReplaceFallback : EncoderFallback + { + class BackslashReplaceFallbackBuffer : EncoderFallbackBuffer + { + List _buffer = new List (); + int _index; + + public override bool Fallback (char charUnknownHigh, char charUnknownLow, int index) + { + throw new NotImplementedException (); + return false; + } + + public override bool Fallback (char charUnknown, int index) + { + _buffer.Add('\\'); + int val = (int)charUnknown; + if (val > 0xFF) { + _buffer.Add ('u'); + AddCharacter (val >> 8); + AddCharacter (val & 0xFF); + } else { + _buffer.Add ('x'); + AddCharacter (charUnknown); + } + return true; + } + + private void AddCharacter (int val) + { + AddOneDigit (((val) & 0xF0) >> 4); + AddOneDigit (val & 0x0F); + } + + private void AddOneDigit (int val) + { + if (val > 9) { + _buffer.Add ((char)('a' + val - 0x0A)); + } else { + _buffer.Add ((char)('0' + val)); + } + } + + public override char GetNextChar () + { + if (_index == _buffer.Count) + return Char.MinValue; + + return _buffer[_index++]; + } + + public override bool MovePrevious () + { + if (_index > 0){ + _index--; + return true; + } + return false; + } + + public override int Remaining + { + get { return _buffer.Count - _index; } + } + } + + public override EncoderFallbackBuffer CreateFallbackBuffer () + { + return new BackslashReplaceFallbackBuffer (); + } + + public override int MaxCharCount + { + get { throw new NotImplementedException (); } + } + } + + class EncoderExceptionOnWrongIndexFallback : EncoderFallback + { + char _expectedCharUnknown; + int _expectedIndex; + + public EncoderExceptionOnWrongIndexFallback (char expectedCharUnknown, int expectedIndex) + { + _expectedCharUnknown = expectedCharUnknown; + _expectedIndex = expectedIndex; + } + + public override EncoderFallbackBuffer CreateFallbackBuffer () + { + return new EncoderExceptionOnWrongIndexFallbackBuffer (_expectedCharUnknown, _expectedIndex); + } + + public override int MaxCharCount => 1; + + class EncoderExceptionOnWrongIndexFallbackBuffer : EncoderFallbackBuffer + { + char _expectedCharUnknown; + int _expectedIndex; + bool read; + + public EncoderExceptionOnWrongIndexFallbackBuffer (char expectedCharUnknown, int expectedIndex) + { + _expectedCharUnknown = expectedCharUnknown; + _expectedIndex = expectedIndex; + } + + public override int Remaining => read ? 0 : 1; + + public override bool Fallback (char charUnknown, int index) + { + Assert.AreEqual (_expectedCharUnknown, charUnknown); + Assert.AreEqual (_expectedIndex, index); + return true; + } + + public override bool Fallback (char charUnknownHigh, char charUnknownLow, int index) + { + throw new NotImplementedException (); + return true; + } + + public override char GetNextChar () + { + if (!read) { + read = true; + return '!'; + } + return '\0'; + } + + public override bool MovePrevious () + { + return false; + } + } + } + } +} \ No newline at end of file diff --git a/mcs/class/I18N/Makefile b/mcs/class/I18N/Makefile index f27d56c2c5..fd84fe53dd 100644 --- a/mcs/class/I18N/Makefile +++ b/mcs/class/I18N/Makefile @@ -4,6 +4,7 @@ include ../../build/rules.make DISTFILES = \ Assembly/AssemblyInfo.cs \ + EncodingTestBase.cs \ README \ README.mono \ mklist.sh \ diff --git a/mcs/class/Makefile b/mcs/class/Makefile index 6fc8002ce3..680bd0e05e 100644 --- a/mcs/class/Makefile +++ b/mcs/class/Makefile @@ -10,6 +10,9 @@ endif # The minimal set of csc dependencies basic_SUBDIRS := \ + Mono.Cecil \ + $(MCS_MODE_dirs) \ + ../tools/cil-stringreplacer \ corlib \ Mono.Security \ System \ @@ -19,15 +22,15 @@ basic_SUBDIRS := \ System.ComponentModel.Composition.4.5 \ System.Numerics \ System.Xml.Linq \ - Mono.Cecil \ - $(MCS_MODE_dirs) \ Mono.CompilerServices.SymbolWriter \ PEAPI \ - ../tools/cil-stringreplacer \ ../ilasm \ corlib/il build_SUBDIRS := \ + Mono.Cecil \ + $(MCS_MODE_dirs) \ + ../tools/cil-stringreplacer \ corlib \ Mono.Security \ System \ @@ -41,11 +44,8 @@ build_SUBDIRS := \ System.Xml.Linq \ System.IO.Compression \ System.Drawing \ - Mono.Cecil \ - $(MCS_MODE_dirs) \ Mono.CompilerServices.SymbolWriter \ - PEAPI \ - ../tools/cil-stringreplacer + PEAPI ifdef MCS_MODE basic_PARALLEL_SUBDIRS := ../mcs $(pcl_facade_dirs) @@ -410,9 +410,15 @@ DISTFILES = \ doc/TemplateTest.cs \ notes/BitVecto32.txt \ MicrosoftAjaxLibrary/License.htm \ - test-helpers/NetworkHelpers.cs \ - test-helpers/SocketResponder.cs \ - $(foreach HOST_PLATFORM,darwin linux win32,lib/$(monolite_dir)/mcs.exe $(monolite_files)) + test-helpers/AdminHelper.cs \ + test-helpers/Configuration.Http.cs \ + test-helpers/NetworkHelpers.cs \ + test-helpers/NunitHelpers.cs \ + test-helpers/PlatformDetection.cs \ + test-helpers/RemoteExecutorTestBase.Mobile.cs \ + test-helpers/RemoteExecutorTestBase.Mono.cs \ + test-helpers/SocketResponder.cs \ + $(foreach HOST_PLATFORM,macos linux win32 unix,lib/$(monolite_dir)/mcs.exe $(monolite_files)) .PHONY: all-local $(STD_TARGETS:=-local) all-local $(STD_TARGETS:=-local): @@ -457,9 +463,10 @@ $(build_files:%=lib/build-$(HOST_PLATFORM)/%): dist-monolite: $(monolite_files) lib/$(monolite_dir)/mcs.exe dist-monolite-all-platforms: - $(MAKE) dist-monolite HOST_PLATFORM=darwin + $(MAKE) dist-monolite HOST_PLATFORM=macos $(MAKE) dist-monolite HOST_PLATFORM=linux $(MAKE) dist-monolite HOST_PLATFORM=win32 + $(MAKE) dist-monolite HOST_PLATFORM=unix package-monolite-latest: MONOLITE=monolite-$(HOST_PLATFORM)-$(MONO_CORLIB_VERSION)-latest; \ @@ -467,9 +474,10 @@ package-monolite-latest: tar zcvpf $$MONOLITE.tar.gz --directory=lib $$MONOLITE/ package-monolite-latest-all-platforms: - $(MAKE) package-monolite-latest HOST_PLATFORM=darwin + $(MAKE) package-monolite-latest HOST_PLATFORM=macos $(MAKE) package-monolite-latest HOST_PLATFORM=linux $(MAKE) package-monolite-latest HOST_PLATFORM=win32 + $(MAKE) package-monolite-latest HOST_PLATFORM=unix monolite_url = https://download.mono-project.com/monolite/monolite-$(BUILD_PLATFORM)-$(MONO_CORLIB_VERSION)-latest.tar.gz diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.dll.sources b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.dll.sources index c29e417d6c..a71d8b5f42 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.dll.sources +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.dll.sources @@ -40,7 +40,6 @@ corefx/SR.cs ../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderInternalCompilerException.cs ../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/*.cs ../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/*.cs -../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/*.cs ../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/*.cs ../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/*.cs ../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/*.cs diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp_xtest.dll.sources b/mcs/class/Microsoft.CSharp/Microsoft.CSharp_xtest.dll.sources new file mode 100644 index 0000000000..f9ef10951b --- /dev/null +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp_xtest.dll.sources @@ -0,0 +1,4 @@ +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs + +../../../external/corefx/src/Microsoft.CSharp/tests/*.cs + diff --git a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509.cs b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509.cs index abcdafbf00..8560e4b77a 100644 --- a/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509.cs +++ b/mcs/class/Mono.Btls.Interface/Mono.Btls.Interface/BtlsX509.cs @@ -87,7 +87,10 @@ namespace Mono.Btls.Interface public byte[] GetSerialNumber (bool mono_style) { - return Instance.GetSerialNumber (mono_style); + var serial = Instance.GetSerialNumber (mono_style); + if (mono_style) + Array.Reverse (serial); + return serial; } public int GetVersion () diff --git a/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.exclude.sources b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.exclude.sources new file mode 100644 index 0000000000..c433add399 --- /dev/null +++ b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.exclude.sources @@ -0,0 +1,6 @@ +Evaluator/BuildinCommands.cs +Evaluator/CompletionTest.cs +Evaluator/EvaluatorFixture.cs +Evaluator/EvaluatorTest.cs +Evaluator/ExpressionsTest.cs +Evaluator/TypesTest.cs diff --git a/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.sources b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.sources new file mode 100644 index 0000000000..64b774be65 --- /dev/null +++ b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.sources @@ -0,0 +1 @@ +#include Mono.CSharp_test.dll.sources diff --git a/mcs/class/Mono.Cecil.Mdb/Makefile b/mcs/class/Mono.Cecil.Mdb/Makefile index 50357a7903..2da359a1d3 100644 --- a/mcs/class/Mono.Cecil.Mdb/Makefile +++ b/mcs/class/Mono.Cecil.Mdb/Makefile @@ -2,11 +2,21 @@ thisdir = class/Mono.Cecil.Mdb include ../../build/rules.make LIBRARY = Mono.Cecil.Mdb.dll -LIBRARY_SNK = ../mono.snk +KEYFILE = ../mono.snk LIBRARY_PACKAGE = none -LIB_REFS = System Mono.Cecil -LIB_MCS_FLAGS = /d:CECIL -keyfile:$(LIBRARY_SNK) -publicsign +API_BUILD := $(filter basic build, $(PROFILE)) + +ifdef API_BUILD +DEFAULT_REFERENCES = +API_BIN_REFS = System mscorlib +else +LIB_REFS = System +endif + +LIB_REFS += Mono.Cecil + +LIB_MCS_FLAGS = -d:CECIL NO_TEST = yes NO_INSTALL = yes diff --git a/mcs/class/Mono.Cecil/Makefile b/mcs/class/Mono.Cecil/Makefile index 16bba0c898..8d123642ea 100644 --- a/mcs/class/Mono.Cecil/Makefile +++ b/mcs/class/Mono.Cecil/Makefile @@ -2,11 +2,19 @@ thisdir = class/Mono.Cecil include ../../build/rules.make LIBRARY = Mono.Cecil.dll -LIBRARY_SNK = ../mono.snk +KEYFILE = ../mono.snk LIBRARY_PACKAGE = none +API_BUILD := $(filter basic build, $(PROFILE)) + +ifdef API_BUILD +DEFAULT_REFERENCES = +API_BIN_REFS = System.Core System mscorlib +else LIB_REFS = System.Core System -LIB_MCS_FLAGS = -keyfile:$(LIBRARY_SNK) -d:NET_4_0 /publicsign +endif + +LIB_MCS_FLAGS = -d:NET_4_0 NO_TEST = yes diff --git a/mcs/class/Mono.Data.Sqlite/monodroid_Mono.Data.Sqlite_test.dll.sources b/mcs/class/Mono.Data.Sqlite/monodroid_Mono.Data.Sqlite_test.dll.sources new file mode 100644 index 0000000000..80f57882c5 --- /dev/null +++ b/mcs/class/Mono.Data.Sqlite/monodroid_Mono.Data.Sqlite_test.dll.sources @@ -0,0 +1 @@ +#include Mono.Data.Sqlite_test.dll.sources diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/AssemblyMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/AssemblyMirror.cs index a83daab43c..b39c398e0b 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/AssemblyMirror.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/AssemblyMirror.cs @@ -3,6 +3,7 @@ using System.Reflection; using Mono.Debugger; using Mono.Cecil; using System.Collections.Generic; +using System.IO; namespace Mono.Debugger.Soft { @@ -15,8 +16,13 @@ namespace Mono.Debugger.Soft AssemblyName aname; AssemblyDefinition meta; AppDomainMirror domain; + byte[] metadata_blob; + bool? isDynamic; + byte[] pdb_blob; Dictionary typeCacheIgnoreCase = new Dictionary (StringComparer.InvariantCultureIgnoreCase); Dictionary typeCache = new Dictionary (); + Dictionary tokenTypeCache = new Dictionary (); + Dictionary tokenMethodCache = new Dictionary (); internal AssemblyMirror (VirtualMachine vm, long id) : base (vm, id) { } @@ -118,7 +124,9 @@ namespace Mono.Debugger.Soft */ public AssemblyDefinition Metadata { get { - return meta; + if (meta != null) + return meta; + return null; } set { if (value.MainModule.Name != ManifestModule.Name) @@ -128,5 +136,83 @@ namespace Mono.Debugger.Soft meta = value; } } + + // Read assembly metadata from the debuggee + // Since protocol version 2.47 + public AssemblyDefinition GetMetadata () { + if (IsDynamic) + throw new NotSupportedException (); + + using (var ms = new MemoryStream (GetMetadataBlob ())) + return meta = AssemblyDefinition.ReadAssembly (ms); + } + + public byte[] GetMetadataBlob () { + if (metadata_blob != null) + return metadata_blob; + + vm.CheckProtocolVersion (2, 47); + + return metadata_blob = vm.conn.Assembly_GetMetadataBlob (id); + } + + public bool IsDynamic { + get { + if (isDynamic.HasValue) + return isDynamic.Value; + + vm.CheckProtocolVersion (2, 47); + + isDynamic = vm.conn.Assembly_IsDynamic (id); + return isDynamic.Value; + } + } + + public bool HasPdb { + get { + return pdb_blob != null; + } + } + + public bool HasFetchedPdb { get; private set; } + + public byte[] GetPdbBlob () { + if (HasFetchedPdb) + return pdb_blob; + + vm.CheckProtocolVersion (2, 47); + var blob = vm.conn.Assembly_GetPdbBlob (id); + if (blob != null && blob.Length > 0) { + pdb_blob = blob; + } + HasFetchedPdb = true; + return pdb_blob; + } + + public TypeMirror GetType (uint token) { + vm.CheckProtocolVersion (2, 47); + if (IsDynamic) + throw new NotSupportedException (); + + long typeId; + if (!tokenTypeCache.TryGetValue (token, out typeId)) { + typeId = vm.conn.Assembly_GetType (id, token); + tokenTypeCache.Add (token, typeId); + } + return vm.GetType (typeId); + } + + public MethodMirror GetMethod (uint token) { + vm.CheckProtocolVersion (2, 47); + if (IsDynamic) + throw new NotSupportedException (); + + long methodId; + if (!tokenMethodCache.TryGetValue (token, out methodId)) { + methodId = vm.conn.Assembly_GetMethod (id, token); + tokenMethodCache.Add (token, methodId); + } + return vm.GetMethod (methodId); + } } } diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs index e480555252..ebdfc519e9 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs @@ -420,7 +420,7 @@ namespace Mono.Debugger.Soft * with newer runtimes, and vice versa. */ internal const int MAJOR_VERSION = 2; - internal const int MINOR_VERSION = 46; + internal const int MINOR_VERSION = 47; enum WPSuspendPolicy { NONE = 0, @@ -534,7 +534,12 @@ namespace Mono.Debugger.Soft GET_OBJECT = 4, GET_TYPE = 5, GET_NAME = 6, - GET_DOMAIN = 7 + GET_DOMAIN = 7, + GET_METADATA_BLOB = 8, + GET_IS_DYNAMIC = 9, + GET_PDB_BLOB = 10, + GET_TYPE_FROM_TOKEN = 11, + GET_METHOD_FROM_TOKEN = 12 } enum CmdModule { @@ -648,6 +653,17 @@ namespace Mono.Debugger.Soft return packet [offset++]; } + static byte[] decode_bytes (byte[] packet, ref int offset, int length) + { + if (length + offset > packet.Length) + throw new ArgumentOutOfRangeException (); + + var bytes = new byte[length]; + Array.Copy (packet, offset, bytes, 0, length); + offset += length; + return bytes; + } + static int decode_short (byte[] packet, ref int offset) { int res = ((int)packet [offset] << 8) | (int)packet [offset + 1]; offset += 2; @@ -895,6 +911,15 @@ namespace Mono.Debugger.Soft res [i] = ReadId (); return res; } + + public byte[] ReadByteArray () { + var length = ReadInt (); + return decode_bytes (packet, ref offset, length); + } + + public bool ReadBool () { + return ReadByte () != 0; + } } class PacketWriter { @@ -2135,6 +2160,26 @@ namespace Mono.Debugger.Soft internal long Assembly_GetIdDomain (long id) { return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_DOMAIN, new PacketWriter ().WriteId (id)).ReadId (); } + + internal byte[] Assembly_GetMetadataBlob (long id) { + return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_METADATA_BLOB, new PacketWriter ().WriteId (id)).ReadByteArray (); + } + + internal bool Assembly_IsDynamic (long id) { + return SendReceive (CommandSet.ASSEMBLY, (int) CmdAssembly.GET_IS_DYNAMIC, new PacketWriter ().WriteId (id)).ReadBool (); + } + + internal byte[] Assembly_GetPdbBlob (long id) { + return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_PDB_BLOB, new PacketWriter ().WriteId (id)).ReadByteArray (); + } + + internal long Assembly_GetType (long id, uint token) { + return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_TYPE_FROM_TOKEN, new PacketWriter ().WriteId (id).WriteInt ((int)token)).ReadId (); + } + + internal long Assembly_GetMethod (long id, uint token) { + return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_METHOD_FROM_TOKEN, new PacketWriter ().WriteId (id).WriteInt ((int)token)).ReadId (); + } /* * TYPE diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs index 9d60855a31..c72c17a443 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs @@ -522,43 +522,65 @@ namespace Mono.Debugger.Soft Dictionary objects; object objects_lock = new object (); - internal T GetObject (long id, long domain_id, long type_id) where T : ObjectMirror { + // Return a mirror if it exists + // Does not call into the debuggee + internal T TryGetObject (long id) where T : ObjectMirror { lock (objects_lock) { if (objects == null) objects = new Dictionary (); ObjectMirror obj; - if (!objects.TryGetValue (id, out obj)) { - /* - * Obtain the domain/type of the object to determine the type of - * object we need to create. - */ - if (domain_id == 0 || type_id == 0) { - if (conn.Version.AtLeast (2, 5)) { - var info = conn.Object_GetInfo (id); - domain_id = info.domain_id; - type_id = info.type_id; - } else { - if (domain_id == 0) - domain_id = conn.Object_GetDomain (id); - if (type_id == 0) - type_id = conn.Object_GetType (id); - } - } - AppDomainMirror d = GetDomain (domain_id); - TypeMirror t = GetType (type_id); - - if (t.Assembly == d.Corlib && t.Namespace == "System.Threading" && t.Name == "Thread") - obj = new ThreadMirror (this, id, t, d); - else if (t.Assembly == d.Corlib && t.Namespace == "System" && t.Name == "String") - obj = new StringMirror (this, id, t, d); - else if (typeof (T) == typeof (ArrayMirror)) - obj = new ArrayMirror (this, id, t, d); - else - obj = new ObjectMirror (this, id, t, d); - objects [id] = obj; - } + objects.TryGetValue (id, out obj); return (T)obj; } + } + + internal T GetObject (long id, long domain_id, long type_id) where T : ObjectMirror { + ObjectMirror obj = null; + lock (objects_lock) { + if (objects == null) + objects = new Dictionary (); + objects.TryGetValue (id, out obj); + } + + if (obj == null) { + /* + * Obtain the domain/type of the object to determine the type of + * object we need to create. Do this outside the lock. + */ + if (domain_id == 0 || type_id == 0) { + if (conn.Version.AtLeast (2, 5)) { + var info = conn.Object_GetInfo (id); + domain_id = info.domain_id; + type_id = info.type_id; + } else { + if (domain_id == 0) + domain_id = conn.Object_GetDomain (id); + if (type_id == 0) + type_id = conn.Object_GetType (id); + } + } + AppDomainMirror d = GetDomain (domain_id); + TypeMirror t = GetType (type_id); + + if (t.Assembly == d.Corlib && t.Namespace == "System.Threading" && t.Name == "Thread") + obj = new ThreadMirror (this, id, t, d); + else if (t.Assembly == d.Corlib && t.Namespace == "System" && t.Name == "String") + obj = new StringMirror (this, id, t, d); + else if (typeof (T) == typeof (ArrayMirror)) + obj = new ArrayMirror (this, id, t, d); + else + obj = new ObjectMirror (this, id, t, d); + + // Publish + lock (objects_lock) { + ObjectMirror prev_obj; + if (objects.TryGetValue (id, out prev_obj)) + obj = prev_obj; + else + objects [id] = obj; + } + } + return (T)obj; } internal T GetObject (long id) where T : ObjectMirror { @@ -573,6 +595,10 @@ namespace Mono.Debugger.Soft return GetObject (id); } + internal ThreadMirror TryGetThread (long id) { + return TryGetObject (id); + } + Dictionary fields; object fields_lock = new object (); @@ -736,7 +762,11 @@ namespace Mono.Debugger.Soft l.Add (new ThreadStartEvent (vm, req_id, id)); break; case EventType.ThreadDeath: - vm.GetThread (id).InvalidateFrames (); + // Avoid calling GetThread () since it might call into the debuggee + // and we can't do that in the event handler + var thread = vm.TryGetThread (id); + if (thread != null) + thread.InvalidateFrames (); vm.InvalidateThreadCache (); l.Add (new ThreadDeathEvent (vm, req_id, id)); break; diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs.REMOVED.git-id b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs.REMOVED.git-id index e72a5b9208..f76093fe51 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs.REMOVED.git-id +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs.REMOVED.git-id @@ -1 +1 @@ -de430ae354a18c8538fb43b6356a1a9c91226072 \ No newline at end of file +7de7a22a0ef9acbae4274e23f83698cd8a31f7da \ No newline at end of file diff --git a/mcs/class/Mono.Posix/monodroid_Mono.Posix_test.dll.sources b/mcs/class/Mono.Posix/monodroid_Mono.Posix_test.dll.sources new file mode 100644 index 0000000000..3af39dbfb0 --- /dev/null +++ b/mcs/class/Mono.Posix/monodroid_Mono.Posix_test.dll.sources @@ -0,0 +1 @@ +#include Mono.Posix_test.dll.sources diff --git a/mcs/class/Mono.Profiler.Log/Makefile b/mcs/class/Mono.Profiler.Log/Makefile index 15aefd3f21..3791df0d6a 100644 --- a/mcs/class/Mono.Profiler.Log/Makefile +++ b/mcs/class/Mono.Profiler.Log/Makefile @@ -11,17 +11,18 @@ LIB_MCS_FLAGS = /unsafe /publicsign /nowarn:0618 XTEST_LIB_REFS = System System.Core Facades/System.Threading.Tasks -xunit-test-local: log-profiler-test.exe +xunit-test-local: $(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.exe -log-profiler-test.exe: Test/log-profiler-test.cs +$(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.exe: Test/log-profiler-test.cs + mkdir -p $(dir $@) $(CSCOMPILE) $(PLATFORM_DEBUG_FLAGS) /unsafe $(if $(MCS_MODE),,/warnaserror) /r:$(build_libdir)/mscorlib.dll /r:$(build_lib) /out:$@ $< EXTRA_DISTFILES = \ Test/log-profiler-test.cs CLEAN_FILES = \ - log-profiler-test.exe \ - log-profiler-test.exe.mdb \ - log-profiler-test.pdb + $(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.exe \ + $(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.exe.mdb \ + $(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.pdb include ../../build/library.make diff --git a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log_xtest.dll.sources b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log_xtest.dll.sources new file mode 100644 index 0000000000..b1747d61d6 --- /dev/null +++ b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log_xtest.dll.sources @@ -0,0 +1,3 @@ +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs +Test/ProfilerTestRun.cs +Test/ProfilerTests.cs diff --git a/mcs/class/Mono.Security.Win32/Mono.Security.Win32_test.dll.sources b/mcs/class/Mono.Security.Win32/Mono.Security.Win32_test.dll.sources new file mode 100644 index 0000000000..ed26892748 --- /dev/null +++ b/mcs/class/Mono.Security.Win32/Mono.Security.Win32_test.dll.sources @@ -0,0 +1,9 @@ +Mono.Security.Cryptography/MD2CryptoServiceProviderTest.cs +Mono.Security.Cryptography/MD2Test.cs +Mono.Security.Cryptography/MD4CryptoServiceProviderTest.cs +Mono.Security.Cryptography/MD4Test.cs +Mono.Security.Cryptography/MD5CryptoServiceProviderTest.cs +Mono.Security.Cryptography/MD5Test.cs +Mono.Security.Cryptography/RandomNumberGeneratorTest.cs +Mono.Security.Cryptography/SHA1CryptoServiceProviderTest.cs +Mono.Security.Cryptography/SHA1Test.cs diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CertificateSelectionCallback.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CertificateSelectionCallback.xml deleted file mode 100644 index 93d14980fb..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CertificateSelectionCallback.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - System.Delegate - - - To be added. - To be added. - To be added. - To be added. - To be added - To be added. - To be added - - - - System.Security.Cryptography.X509Certificates.X509Certificate - - - - - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback.xml deleted file mode 100644 index 0b20e348e4..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - System.Delegate - - - To be added. - To be added. - To be added - To be added. - To be added - - - - System.Boolean - - - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CipherAlgorithmType.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CipherAlgorithmType.xml deleted file mode 100644 index 8c1bd46f18..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/CipherAlgorithmType.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - System.Enum - - - SSL/TLS data encryption choices. - To be added - - - - - Field - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - - - - encryption as defined in NIST FIPS 46-3. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - - - No encryption. Not currently supported by Mono. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - - - - (r) encryption as defined in IETF RFC2268. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - - - - (r) stream encryption. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - - - - , a.k.a. AES, encryption as defined by NIST FIPS 197. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - - - Skipjack encryption as defined in NIST FIPS 185. Not currently supported in Mono. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - - - - encryption as defined by NIST FIPS 46-3. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.xml deleted file mode 100644 index 476a93b559..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - System.Enum - - - SSL/TLS key exchange/agreement choices. - To be added - - - - - Field - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - - - Diffie-Hellman key exchange isn't currently supported in Mono. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - - - Fortezza key exchange (KEA) isn't supported in Mono. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - - - No key exchange. Not supported by Mono. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - - - RSA key exchange. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - - - RSA key signature - required for "export" algorithms. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/HashAlgorithmType.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/HashAlgorithmType.xml deleted file mode 100644 index a6167680df..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/HashAlgorithmType.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - System.Enum - - - SSL/TLS data integrity choices. - To be added - - - - - Field - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - - - Integrity based on . - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - - - No integrity. Not supported in Mono. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - - - Integrity based on . - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/PrivateKeySelectionCallback.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/PrivateKeySelectionCallback.xml deleted file mode 100644 index 5d1444413a..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/PrivateKeySelectionCallback.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - System.Delegate - - - To be added. - To be added. - Type of the method that can find the private key associated with a specific X.509 certificate and a host name. - To be added. - - First we assign a method to select a private key. - - - // ... initialize the NetworkStream, get the X.509 certificate ... - using (SslServerStream s = new SslServerStream (ns, certificate, false, false)) { - s.PrivateKeyCertSelectionDelegate += new PrivateKeySelectionCallback (GetPrivateKey); - } - - - The method has the certificate and the name of the target host to find the appropriate private key. - - - private static AsymmetricAlgorithm GetPrivateKey (X509Certificate certificate, string targetHost) - { - PrivateKey key = PrivateKey.CreateFromFile (targetHost + ".pvk"); - return key.RSA; - } - - - - - - - System.Security.Cryptography.AsymmetricAlgorithm - - - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SecurityCompressionType.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SecurityCompressionType.xml deleted file mode 100644 index fc5d12acf9..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SecurityCompressionType.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - System.Enum - - - Optional compression before encryption of the data packets. - To be added - - - - - Field - - Mono.Security.Protocol.Tls.SecurityCompressionType - - - - - No compression before encryption (default). - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.SecurityCompressionType - - - - - ZLib compression as defined in RFC1950. Not currently implemented in Mono. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SecurityProtocolType.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SecurityProtocolType.xml deleted file mode 100644 index 979b6c4817..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SecurityProtocolType.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - System.Enum - - - - System.Flags - - - - SSL/TLS protocol version used in communication. - To be added - - - - - Field - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - - - Accept either Ssl3 or Tls protocols. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - - - SSL (Secure Socket Layer) v2. This older version of SSL isn't supported by Mono. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - - - SSL (Secure Socket Layer) v3. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Field - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - - - TLS (Transport Layer Security) v1.0 as defined in RFC2246. - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslClientStream.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslClientStream.xml deleted file mode 100644 index 416d764f29..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslClientStream.xml +++ /dev/null @@ -1,490 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - Mono.Security.Protocol.Tls.SslStreamBase - - - - - Client side SSL/TLS stream. - To be added - - - - - Constructor - - - - - - - - a - a - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Constructor - - - - - - - - a - a - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Constructor - - - - - - - - a - a - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Constructor - - - - - - - - - a - a - a - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Constructor - - - - - - - - - - a - a - a - a - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int32 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Security.Cryptography.X509Certificates.X509CertificateCollection - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.CertificateSelectionCallback - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - - - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int32 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int32 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int64 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int64 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.PrivateKeySelectionCallback - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Security.Cryptography.X509Certificates.X509Certificate - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Security.Cryptography.X509Certificates.X509Certificate - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.CertificateValidationCallback - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslServerStream.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslServerStream.xml deleted file mode 100644 index df42d48c58..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslServerStream.xml +++ /dev/null @@ -1,511 +0,0 @@ - - - - Mono.Security - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 D2 D0 3A 8E 6B EA 7A 2E 74 E8 D1 AF CC 93 E8 85 19 74 95 2B B4 80 A1 2C 91 34 47 4D 04 06 24 47 C3 7E 0E 68 C0 80 53 6F CF 3C 3F BE 2F F9 C9 79 CE 99 84 75 E5 06 E8 CE 82 DD 5B 0F 35 0D C1 0E 93 BF 2E EE CF 87 4B 24 77 0C 50 81 DB EA 74 47 FD DA FA 27 7B 22 DE 47 D6 FF EA 44 96 74 A4 F9 FC CF 84 D1 50 69 08 93 80 28 4D BD D3 5F 46 CD FF 12 A1 BD 78 E4 EF 00 65 D0 16 DF] - 1.0.5000.0 - 2.0.0.0 - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - Mono.Security.Protocol.Tls.SslStreamBase - - - - - Server-side SSL/TLS stream. - - - -using System; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Text; - -using Mono.Security.Authenticode; -using Mono.Security.Protocol.Tls; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; - -namespace SslHttpServer -{ - class SslHttpServer - { - private static X509Certificate _certificate; - private static string certfile; - private static string keyfile; - - static void Main (string [] args) - { - certfile = (args.Length > 0) ? args [0] : "ssl.cer"; - keyfile = (args.Length > 0) ? args [0] : "ssl.pvk"; - - Socket listenSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - IPEndPoint localEndPoint = new IPEndPoint (IPAddress.Any, 1888); - Socket requestSocket; - - listenSocket.Bind (localEndPoint); - listenSocket.Listen (10); - - while (true) { - try { - requestSocket = listenSocket.Accept (); - using (NetworkStream ns = new NetworkStream (requestSocket, FileAccess.ReadWrite, true)) { - using (SslServerStream s = new SslServerStream (ns, Certificate, false, false)) { - s.PrivateKeyCertSelectionDelegate += new PrivateKeySelectionCallback (GetPrivateKey); - StreamReader reader = new StreamReader (s); - StreamWriter writer = new StreamWriter (s, Encoding.ASCII); - - string line; - string answer = - "HTTP/1.0 200\r\n" + - "Connection: close\r\n" + - "Content-Type: text/html\r\n" + - "Content-Encoding: " + Encoding.ASCII.WebName + "\r\n" + - "\r\n" + - "<html><body><h1>Hello World!</h1></body></html>\r\n"; - - // Read request header - do { - line = reader.ReadLine (); - if (line != null) - Console.WriteLine (line); - } - while (line != null && line.Length > 0); - - // Send response - writer.Write (answer); - - writer.Flush (); - s.Flush (); - ns.Flush (); - } - } - } - catch (Exception ex) { - Console.WriteLine ("---------------------------------------------------------"); - Console.WriteLine (ex.ToString ()); - } - } - } - - private static X509Certificate Certificate { - get { - if (_certificate == null) - _certificate = X509Certificate.CreateFromCertFile (certfile); - return _certificate; - } - } - - // note: makecert creates the private key in the PVK format - private static AsymmetricAlgorithm GetPrivateKey (X509Certificate certificate, string targetHost) - { - PrivateKey key = PrivateKey.CreateFromFile (keyfile); - return key.RSA; - } - } -} - - - -You can create a X.509 test certificate and it's private key with the following command: -makecert -n "CN=localhost" -r -sv ssl.pvk ssl.cer - - Note: Thanks to Jörg Rosenkranz for the original code sample. - - - - - - Constructor - - - - - - - a - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Constructor - - - - - - - - - a - a - a - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Constructor - - - - - - - - - - a - a - a - a - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int32 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Security.Cryptography.X509Certificates.X509Certificate - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.CertificateValidationCallback - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - - - a - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - To be added - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int32 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int32 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int64 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int64 - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.PrivateKeySelectionCallback - - - - Set the method that can find the private key associated with a specific X.509 certificate and a host name. - a - See for an example on how to use this delegate. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Security.Cryptography.X509Certificates.X509Certificate - - - - To be added - a - To be added - - - 1.0.5000.0 - 2.0.0.0 - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslStreamBase.xml b/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslStreamBase.xml deleted file mode 100644 index 64b694cc34..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/Mono.Security.Protocol.Tls/SslStreamBase.xml +++ /dev/null @@ -1,564 +0,0 @@ - - - - Mono.Security - 1.0.5000.0 - 2.0.0.0 - - - System.IO.Stream - - - - To be added. - To be added. - - - - - Constructor - - - - - - To be added. - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.IAsyncResult - - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.IAsyncResult - - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Boolean - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int32 - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - To be added. - To be added. - - - 1.0.5000.0 - - - - - Method - - System.Void - - - - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Int32 - - - - - - To be added. - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int32 - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int32 - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int64 - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Int64 - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Int32 - - - - - - To be added. - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Int32 - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Int64 - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Property - - System.Security.Cryptography.X509Certificates.X509Certificate - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - - - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - - Method - - System.Void - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - - - 1.0.5000.0 - 2.0.0.0 - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/index.xml b/mcs/class/Mono.Security/Documentation/en/index.xml index 68da7f86cd..8b623deac1 100644 --- a/mcs/class/Mono.Security/Documentation/en/index.xml +++ b/mcs/class/Mono.Security/Documentation/en/index.xml @@ -104,19 +104,6 @@ - - - - - - - - - - - - - diff --git a/mcs/class/Mono.Security/Documentation/en/ns-Mono.Security.Protocol.Tls.xml b/mcs/class/Mono.Security/Documentation/en/ns-Mono.Security.Protocol.Tls.xml deleted file mode 100644 index 95b0197559..0000000000 --- a/mcs/class/Mono.Security/Documentation/en/ns-Mono.Security.Protocol.Tls.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - To be added. - To be added. - - diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs index 14f8c73a8a..ea1160b3bb 100644 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs +++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs @@ -275,19 +275,19 @@ namespace Mono.Security.Cryptography { #if INSIDE_CORLIB [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _CanSecure (string root); + unsafe internal static extern bool _CanSecure (char* root); [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _ProtectUser (string path); + unsafe internal static extern bool _ProtectUser (char* path); [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _ProtectMachine (string path); + unsafe internal static extern bool _ProtectMachine (char* path); [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _IsUserProtected (string path); + unsafe internal static extern bool _IsUserProtected (char* path); [MethodImplAttribute (MethodImplOptions.InternalCall)] - internal static extern bool _IsMachineProtected (string path); + unsafe internal static extern bool _IsMachineProtected (char* path); #else // Mono.Security.dll assembly can't use the internal // call (and still run with other runtimes) @@ -295,34 +295,34 @@ namespace Mono.Security.Cryptography { // Note: Class is only available in Mono.Security.dll as // a management helper (e.g. build a GUI app) - internal static bool _CanSecure (string root) + unsafe internal static bool _CanSecure (char* root) { return true; } - internal static bool _ProtectUser (string path) + unsafe internal static bool _ProtectUser (char* path) { return true; } - internal static bool _ProtectMachine (string path) + unsafe internal static bool _ProtectMachine (char* path) { return true; } - internal static bool _IsUserProtected (string path) + unsafe internal static bool _IsUserProtected (char* path) { return true; } - internal static bool _IsMachineProtected (string path) + unsafe internal static bool _IsMachineProtected (char* path) { return true; } #endif // private stuff - private static bool CanSecure (string path) + unsafe private static bool CanSecure (string path) { // we assume POSIX filesystems can always be secured @@ -333,44 +333,54 @@ namespace Mono.Security.Cryptography { return true; // while we ask the runtime for Windows OS - return _CanSecure (Path.GetPathRoot (path)); + fixed (char* fpath = path) { + return _CanSecure (fpath); + } } - private static bool ProtectUser (string path) + unsafe private static bool ProtectUser (string path) { // we cannot protect on some filsystem (like FAT) if (CanSecure (path)) { - return _ProtectUser (path); + fixed (char* fpath = path) { + return _ProtectUser (fpath); + } } // but Mono still needs to run on them :( return true; } - private static bool ProtectMachine (string path) + unsafe private static bool ProtectMachine (string path) { // we cannot protect on some filsystem (like FAT) if (CanSecure (path)) { - return _ProtectMachine (path); + fixed (char* fpath = path) { + return _ProtectMachine (fpath); + } } // but Mono still needs to run on them :( return true; } - private static bool IsUserProtected (string path) + unsafe private static bool IsUserProtected (string path) { // we cannot protect on some filsystem (like FAT) if (CanSecure (path)) { - return _IsUserProtected (path); + fixed (char* fpath = path) { + return _IsUserProtected (fpath); + } } // but Mono still needs to run on them :( return true; } - private static bool IsMachineProtected (string path) + unsafe private static bool IsMachineProtected (string path) { // we cannot protect on some filsystem (like FAT) if (CanSecure (path)) { - return _IsMachineProtected (path); + fixed (char* fpath = path) { + return _IsMachineProtected (fpath); + } } // but Mono still needs to run on them :( return true; diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs deleted file mode 100644 index f22400a180..0000000000 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs +++ /dev/null @@ -1,148 +0,0 @@ - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/* Transport Security Layer (TLS) - * Copyright (c) 2003-2004 Carlos Guzman Alvarez - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -using System; -using System.Security.Cryptography; - -using Mono.Security.Protocol.Tls; - -namespace Mono.Security.Cryptography -{ - internal class MD5SHA1 : HashAlgorithm - { - #region Fields - - private HashAlgorithm md5; - private HashAlgorithm sha; - private bool hashing; - - #endregion - - #region Constructors - - public MD5SHA1() : base() - { - this.md5 = MD5.Create(); - this.sha = SHA1.Create(); - - // Set HashSizeValue - this.HashSizeValue = this.md5.HashSize + this.sha.HashSize; - } - - #endregion - - #region Methods - - public override void Initialize() - { - this.md5.Initialize(); - this.sha.Initialize(); - this.hashing = false; - } - - protected override byte[] HashFinal() - { - if (!hashing) - { - this.hashing = true; - } - // Finalize the original hash - this.md5.TransformFinalBlock(new byte[0], 0, 0); - this.sha.TransformFinalBlock(new byte[0], 0, 0); - - byte[] hash = new byte[36]; - - Buffer.BlockCopy(this.md5.Hash, 0, hash, 0, 16); - Buffer.BlockCopy(this.sha.Hash, 0, hash, 16, 20); - - return hash; - } - - protected override void HashCore( - byte[] array, - int ibStart, - int cbSize) - { - if (!hashing) - { - hashing = true; - } - this.md5.TransformBlock(array, ibStart, cbSize, array, ibStart); - this.sha.TransformBlock(array, ibStart, cbSize, array, ibStart); - } - - public byte[] CreateSignature(RSA rsa) - { - if (rsa == null) - { - throw new CryptographicUnexpectedOperationException ("missing key"); - } - - RSASslSignatureFormatter f = new RSASslSignatureFormatter(rsa); - f.SetHashAlgorithm("MD5SHA1"); - - return f.CreateSignature(this.Hash); - } - - public bool VerifySignature(RSA rsa, byte[] rgbSignature) - { - if (rsa == null) - { - throw new CryptographicUnexpectedOperationException ("missing key"); - } - if (rgbSignature == null) - { - throw new ArgumentNullException ("rgbSignature"); - } - - RSASslSignatureDeformatter d = new RSASslSignatureDeformatter(rsa); - d.SetHashAlgorithm("MD5SHA1"); - - return d.VerifySignature(this.Hash, rgbSignature); - } - - #endregion - } -} diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs b/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs index 957c657f23..9b55f6cc91 100644 --- a/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs +++ b/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs @@ -30,7 +30,6 @@ using System.Net; using System.Net.Security; using System.Threading; using System.Security.Cryptography.X509Certificates; -using Mono.Security.Protocol.Tls; using MX = Mono.Security.X509; using Mono.Net.Security; diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs b/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs index 5a03262e22..2f040e0f61 100644 --- a/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs +++ b/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs @@ -30,7 +30,6 @@ using System.Net; using System.Net.Security; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; -using Mono.Security.Protocol.Tls; namespace Mono.Security.Interface { diff --git a/mcs/class/System.ServiceModel/Mono.Security.Cryptography/MD5SHA1.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/MD5SHA1.cs similarity index 98% rename from mcs/class/System.ServiceModel/Mono.Security.Cryptography/MD5SHA1.cs rename to mcs/class/Mono.Security/Mono.Security.Protocol.Tls/MD5SHA1.cs index f22400a180..01680df44e 100644 --- a/mcs/class/System.ServiceModel/Mono.Security.Cryptography/MD5SHA1.cs +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/MD5SHA1.cs @@ -46,9 +46,7 @@ using System; using System.Security.Cryptography; -using Mono.Security.Protocol.Tls; - -namespace Mono.Security.Cryptography +namespace Mono.Security.Protocol.Tls { internal class MD5SHA1 : HashAlgorithm { diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs index b79728dcc2..8131197887 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs @@ -83,7 +83,7 @@ namespace Mono.Security.Protocol.Tls switch (strName) { case "MD5SHA1": - this.hash = new Mono.Security.Cryptography.MD5SHA1(); + this.hash = new MD5SHA1(); break; default: diff --git a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs index 5d0e75ae4e..b313f005a9 100644 --- a/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs +++ b/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs @@ -80,7 +80,7 @@ namespace Mono.Security.Protocol.Tls switch (strName) { case "MD5SHA1": - this.hash = new Mono.Security.Cryptography.MD5SHA1(); + this.hash = new MD5SHA1(); break; default: diff --git a/mcs/class/Mono.Security/Mono.Security.X509/PKCS12.cs b/mcs/class/Mono.Security/Mono.Security.X509/PKCS12.cs index d5b5c80963..c37e52c2dd 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509/PKCS12.cs +++ b/mcs/class/Mono.Security/Mono.Security.X509/PKCS12.cs @@ -741,22 +741,26 @@ namespace Mono.Security.X509 { private void AddPrivateKey (PKCS8.PrivateKeyInfo pki) { byte[] privateKey = pki.PrivateKey; - switch (privateKey [0]) { - case 0x02: + try { + switch (pki.Algorithm) { + case X509Certificate.OID_RSA: + _keyBags.Add (PKCS8.PrivateKeyInfo.DecodeRSA (privateKey)); + break; + case X509Certificate.OID_DSA: bool found; DSAParameters p = GetExistingParameters (out found); if (found) { _keyBags.Add (PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p)); } break; - case 0x30: - _keyBags.Add (PKCS8.PrivateKeyInfo.DecodeRSA (privateKey)); - break; + case X509Certificate.OID_ECC: // TODO default: - Array.Clear (privateKey, 0, privateKey.Length); throw new CryptographicException ("Unknown private key format"); + } + } + finally { + Array.Clear (privateKey, 0, privateKey.Length); } - Array.Clear (privateKey, 0, privateKey.Length); } private void ReadSafeBag (ASN1 safeBag) diff --git a/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs b/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs index 8343e5fb55..8c9dad7da2 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs +++ b/mcs/class/Mono.Security/Mono.Security.X509/X501Name.cs @@ -63,7 +63,7 @@ namespace Mono.Security.X509 { static byte[] localityName = { 0x55, 0x04, 0x07 }; static byte[] stateOrProvinceName = { 0x55, 0x04, 0x08 }; static byte[] streetAddress = { 0x55, 0x04, 0x09 }; - //static byte[] serialNumber = { 0x55, 0x04, 0x05 }; + static byte[] serialNumber = { 0x55, 0x04, 0x05 }; static byte[] domainComponent = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x19 }; static byte[] userid = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01 }; static byte[] email = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01 }; @@ -160,6 +160,8 @@ namespace Mono.Security.X509 { sb.Append ("G="); else if (poid.CompareValue (initial)) sb.Append ("I="); + else if (poid.CompareValue (serialNumber)) + sb.Append ("SERIALNUMBER="); else { // unknown OID sb.Append ("OID."); // NOTE: Not present as RFC2253 @@ -180,14 +182,17 @@ namespace Mono.Security.X509 { sValue = Encoding.UTF7.GetString (s.Value); else sValue = Encoding.UTF8.GetString (s.Value); - // in some cases we must quote (") the value - // Note: this doesn't seems to conform to RFC2253 - char[] specials = { ',', '+', '"', '\\', '<', '>', ';' }; - if (quotes) { - if ((sValue.IndexOfAny (specials, 0, sValue.Length) > 0) || - sValue.StartsWith (" ") || (sValue.EndsWith (" "))) - sValue = "\"" + sValue + "\""; - } + } + + // in some cases we must quote (") the value + // Note: this doesn't seems to conform to RFC2253 + // Set of characters that need quoting is taken from s_quoteNeedingChars + // in corefx/src/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/X500NameEncoder.cs + char[] specials = { ',', '+', '"', '=', '<', '>', ';', '#', '\n' }; + if (quotes) { + if ((sValue.IndexOfAny (specials, 0, sValue.Length) > 0) || + sValue.StartsWith (" ") || (sValue.EndsWith (" "))) + sValue = "\"" + sValue.Replace ("\"", "") + "\""; } sb.Append (sValue); @@ -231,6 +236,8 @@ namespace Mono.Security.X509 { return new X520.GivenName (); case "I": return new X520.Initial (); + case "SERIALNUMBER": + return new X520.SerialNumber (); default: if (s.StartsWith ("OID.")) { // MUST support it but it OID may be without it diff --git a/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs b/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs index 2851c1716c..99791bb4b3 100644 --- a/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs +++ b/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs @@ -70,9 +70,10 @@ namespace Mono.Security.X509 { private DSA _dsa; // from http://msdn.microsoft.com/en-gb/library/ff635835.aspx - private const string OID_DSA = "1.2.840.10040.4.1"; - private const string OID_RSA = "1.2.840.113549.1.1.1"; - + internal const string OID_DSA = "1.2.840.10040.4.1"; + internal const string OID_RSA = "1.2.840.113549.1.1.1"; + internal const string OID_ECC = "1.2.840.10045.2.1"; + // from http://www.ietf.org/rfc/rfc2459.txt // //Certificate ::= SEQUENCE { diff --git a/mcs/class/Mono.Security/Mono.Security.dll.sources b/mcs/class/Mono.Security/Mono.Security.dll.sources index 76f5e4a442..c6b8882cad 100644 --- a/mcs/class/Mono.Security/Mono.Security.dll.sources +++ b/mcs/class/Mono.Security/Mono.Security.dll.sources @@ -65,7 +65,6 @@ ./Mono.Security.X509.Extensions/SubjectAltNameExtension.cs ./Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs ./Mono.Security.Cryptography/TlsHMAC.cs -./Mono.Security.Cryptography/MD5SHA1.cs ./Mono.Security.Protocol.Ntlm/ChallengeResponse.cs ./Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs ./Mono.Security.Protocol.Ntlm/MessageBase.cs @@ -89,6 +88,7 @@ ./Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs ./Mono.Security.Protocol.Tls/HandshakeState.cs ./Mono.Security.Protocol.Tls/HashAlgorithmType.cs +./Mono.Security.Protocol.Tls/MD5SHA1.cs ./Mono.Security.Protocol.Tls/HttpsClientStream.cs ./Mono.Security.Protocol.Tls/RecordProtocol.cs ./Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs diff --git a/mcs/class/Mono.Security/Test/Mono.Security.X509/X501NameTest.cs b/mcs/class/Mono.Security/Test/Mono.Security.X509/X501NameTest.cs index dea653fa1f..4899923edb 100644 --- a/mcs/class/Mono.Security/Test/Mono.Security.X509/X501NameTest.cs +++ b/mcs/class/Mono.Security/Test/Mono.Security.X509/X501NameTest.cs @@ -213,8 +213,19 @@ namespace MonoTests.Mono.Security.X509 { 0x13, 0x1D, 0x43, 0x56, 0x52, 0x3A, 0x31, 0x33, 0x34, 0x37, 0x31, 0x39, 0x36, 0x37, 0x2D, 0x55, 0x49, 0x44, 0x3A, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32 }; ASN1 asn = new ASN1 (sn); - Assert.AreEqual ("C=DK, O=Hedeby's Møbelhandel // CVR:13471967, CN=Hedeby's Møbelhandel - Salgsafdelingen, E=vhm@use.test.dk, OID.2.5.4.5=CVR:13471967-UID:121212121212", X501.ToString (asn), "ToString-1"); - Assert.AreEqual ("OID.2.5.4.5=CVR:13471967-UID:121212121212, E=vhm@use.test.dk, CN=Hedeby's Møbelhandel - Salgsafdelingen, O=Hedeby's Møbelhandel // CVR:13471967, C=DK", X501.ToString (asn, true, ", ", false), "ToString-2"); + Assert.AreEqual ("C=DK, O=Hedeby's Møbelhandel // CVR:13471967, CN=Hedeby's Møbelhandel - Salgsafdelingen, E=vhm@use.test.dk, SERIALNUMBER=CVR:13471967-UID:121212121212", X501.ToString (asn), "ToString-1"); + Assert.AreEqual ("SERIALNUMBER=CVR:13471967-UID:121212121212, E=vhm@use.test.dk, CN=Hedeby's Møbelhandel - Salgsafdelingen, O=Hedeby's Møbelhandel // CVR:13471967, C=DK", X501.ToString (asn, true, ", ", false), "ToString-2"); + } + + [Test] + public void ToString_BMPQuoting () + { + byte[] sn = { 0x30, 0x4F, 0x31, 0x4d, 0x30, 0x4B, 0x06, 0x03, 0x55, 0x04, 0x03, 0x1E, 0x44, 0x00, 0x4D, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x61, + 0x00, 0x67, 0x00, 0x65, 0x00, 0x64, 0x00, 0x20, 0x00, 0x50, 0x00, 0x4B, 0x00, 0x43, 0x00, 0x53, 0x00, 0x23, 0x00, 0x37, 0x00, 0x20, + 0x00, 0x54, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x20, 0x00, 0x52, 0x00, 0x6F, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x20, 0x00, 0x41, + 0x00, 0x75, 0x00, 0x74, 0x00, 0x68, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x74, 0x00, 0x79 }; + ASN1 asn = new ASN1 (sn); + Assert.AreEqual ("CN=\"Managed PKCS#7 Test Root Authority\"", X501.ToString (asn), "ToString-1"); } } } diff --git a/mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.build-failure-exclude.sources b/mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.build-failure-exclude.sources new file mode 100644 index 0000000000..38e0f0a6bd --- /dev/null +++ b/mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.build-failure-exclude.sources @@ -0,0 +1,20 @@ +# These fail because of reliance on full NUnit framework +Mono.Math/ArithmeticBigTest.cs +Mono.Math/BigIntegerSetTest.cs +Mono.Math/BitwiseTest.cs +Mono.Math/GcdBigTest.cs +Mono.Math/ModInverseBigTest.cs +Mono.Math/ModRingTest.cs +Mono.Math/PrimeGenerationTest.cs +Mono.Math/PrimeTestingTest.cs +Mono.Math/SearchGeneratorTest.cs +Mono.Security.Authenticode/PrivateKeyTest.cs +Mono.Security.Cryptography/CryptoConvertTest.cs +Mono.Security.Cryptography/DiffieHellmanManagedTest.cs +Mono.Security.Cryptography/PKCS8Test.cs +Mono.Security.Protocol.Ntlm/ChallengeResponseTest.cs +Mono.Security.Protocol.Ntlm/MessageBaseTest.cs +Mono.Security.Protocol.Ntlm/Type1MessageTest.cs +Mono.Security.Protocol.Ntlm/Type2MessageTest.cs +Mono.Security.Protocol.Ntlm/Type3MessageTest.cs +Mono.Security/StrongNameTest.cs diff --git a/mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.exclude.sources b/mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.exclude.sources new file mode 100644 index 0000000000..f5cfc9349d --- /dev/null +++ b/mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.exclude.sources @@ -0,0 +1,2 @@ +#include monodroid_Mono.Security_test.dll.build-failure-exclude.sources + diff --git a/mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.sources b/mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.sources new file mode 100644 index 0000000000..37fa889534 --- /dev/null +++ b/mcs/class/Mono.Security/monodroid_Mono.Security_test.dll.sources @@ -0,0 +1 @@ +#include Mono.Security_test.dll.sources diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs index f2ef8e9959..32e365a819 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/Connection.cs @@ -34,12 +34,12 @@ using System.Threading; using Novell.Directory.Ldap.Asn1; using Novell.Directory.Ldap.Rfc2251; using Novell.Directory.Ldap.Utilclass; -using Mono.Security.Protocol.Tls; using Mono.Security.X509.Extensions; using Syscert = System.Security.Cryptography.X509Certificates; using System.Security.Cryptography; using System.Net; using System.Net.Sockets; +using System.Net.Security; using System.Collections; using System.IO; using System.Text; @@ -52,7 +52,7 @@ namespace Novell.Directory.Ldap { public delegate bool CertificateValidationCallback( Syscert.X509Certificate certificate, - int[] certificateErrors); + SslPolicyErrors certificateErrors); /// The class that creates a connection to the Ldap server. After the /// connection is made, a thread is created that reads data from the @@ -643,51 +643,33 @@ namespace Novell.Directory.Ldap /****************************************************************************/ - public bool ServerCertificateValidation( + public bool ServerCertificateValidation( Syscert.X509Certificate certificate, - int[] certificateErrors) + Syscert.X509Chain chain, + SslPolicyErrors errors) { if (null != OnCertificateValidation) { - return OnCertificateValidation(certificate, certificateErrors); + return OnCertificateValidation(certificate, errors); } - return DefaultCertificateValidationHandler(certificate, certificateErrors); + return DefaultCertificateValidationHandler(certificate, chain, errors); } public bool DefaultCertificateValidationHandler( Syscert.X509Certificate certificate, - int[] certificateErrors) + Syscert.X509Chain chain, + SslPolicyErrors errors) { - bool retFlag=false; - - if (certificateErrors != null && - certificateErrors.Length > 0) - { - if( certificateErrors.Length==1 && certificateErrors[0] == -2146762481) - { - retFlag = true; - } - else - { - Console.WriteLine("Detected errors in the Server Certificate:"); - - for (int i = 0; i < certificateErrors.Length; i++) - { - handshakeProblemsEncountered.Add((CertificateProblem)((uint)certificateErrors[i])); - Console.WriteLine(certificateErrors[i]); - } - retFlag = false; - } - } - else - { - retFlag = true; + switch (errors) { + case SslPolicyErrors.RemoteCertificateNameMismatch: + // The erorr code -2146762481 means SslPolicyErrors.RemoteCertificateNameMismatch. + return true; + case SslPolicyErrors.None: + return true; + default: + return false; } - - - // Skip the server cert errors. - return retFlag; } @@ -750,45 +732,15 @@ namespace Novell.Directory.Ldap { throw new LdapException(ExceptionMessages.SSL_PROVIDER_MISSING, LdapException.SSL_PROVIDER_NOT_FOUND, null); } - Type tSslClientStream = a.GetType("Mono.Security.Protocol.Tls.SslClientStream"); - BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public | - BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); - - object[] consArgs = new object[4]; - consArgs[0] = nstream; - consArgs[1] = host; - consArgs[2] = false; - Type tSecurityProtocolType = a.GetType("Mono.Security.Protocol.Tls.SecurityProtocolType"); - Enum objSPType = (Enum)(Activator.CreateInstance(tSecurityProtocolType)); - int nSsl3Val = (int) Enum.Parse(tSecurityProtocolType, "Ssl3"); - int nTlsVal = (int) Enum.Parse(tSecurityProtocolType, "Tls"); - consArgs[3] = Enum.ToObject(tSecurityProtocolType, nSsl3Val | nTlsVal); - - object objSslClientStream = - Activator.CreateInstance(tSslClientStream, consArgs); - - // Register ServerCertValidationDelegate handler - PropertyInfo pi = tSslClientStream.GetProperty("ServerCertValidationDelegate"); - pi.SetValue(objSslClientStream, - Delegate.CreateDelegate(pi.PropertyType, this, "ServerCertificateValidation"), - null); - + + // FIXME: Pass the custom validation callback. + // The erorr code -2146762481 means SslPolicyErrors.RemoteCertificateNameMismatch. + var stream = new SslStream (nstream, false); + stream.AuthenticateAsClient (host); + // Get the in and out streams - in_Renamed = (System.IO.Stream) objSslClientStream; - out_Renamed = (System.IO.Stream) objSslClientStream; - /* - SslClientStream sslstream = new SslClientStream( - nstream, - host, - false, - Mono.Security.Protocol.Tls.SecurityProtocolType.Ssl3|Mono.Security.Protocol.Tls.SecurityProtocolType.Tls); - sslstream.ServerCertValidationDelegate += new CertificateValidationCallback(ServerCertificateValidation);*/ - // byte[] buffer = new byte[0]; - // sslstream.Read(buffer, 0, buffer.Length); - // sslstream.doHandshake(); - /* - in_Renamed = (System.IO.Stream) sslstream; - out_Renamed = (System.IO.Stream) sslstream;*/ + in_Renamed = stream; + out_Renamed = stream; } else{ socket = new System.Net.Sockets.TcpClient(host, port); @@ -1263,53 +1215,14 @@ namespace Novell.Directory.Ldap IPEndPoint ephost = new IPEndPoint(hostadd,port); sock.Connect(ephost); */ -// NetworkStream nstream = new NetworkStream(this.socket,true); - // Load Mono.Security.dll - Assembly a = null; - try - { - a = Assembly.LoadFrom("Mono.Security.dll"); - } - catch(System.IO.FileNotFoundException) - { - throw new LdapException(ExceptionMessages.SSL_PROVIDER_MISSING, LdapException.SSL_PROVIDER_NOT_FOUND, null); - } - Type tSslClientStream = a.GetType("Mono.Security.Protocol.Tls.SslClientStream"); - BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public | - BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly); + // FIXME: Pass the custom validation callback. + // The erorr code -2146762481 means SslPolicyErrors.RemoteCertificateNameMismatch. + var stream = new SslStream (socket.GetStream (), false); + stream.AuthenticateAsClient (host); - object[] consArgs = new object[4]; - consArgs[0] = socket.GetStream(); - consArgs[1] = host; - consArgs[2] = false; - Type tSecurityProtocolType = a.GetType("Mono.Security.Protocol.Tls.SecurityProtocolType"); - Enum objSPType = (Enum)(Activator.CreateInstance(tSecurityProtocolType)); - int nSsl3Val = (int) Enum.Parse(tSecurityProtocolType, "Ssl3"); - int nTlsVal = (int) Enum.Parse(tSecurityProtocolType, "Tls"); - consArgs[3] = Enum.ToObject(tSecurityProtocolType, nSsl3Val | nTlsVal); - - object objSslClientStream = - Activator.CreateInstance(tSslClientStream, consArgs); - - // Register ServerCertValidationDelegate handler - EventInfo ei = tSslClientStream.GetEvent("ServerCertValidationDelegate"); - ei.AddEventHandler(objSslClientStream, - Delegate.CreateDelegate(ei.EventHandlerType, this, "ServerCertificateValidation")); - // Get the in and out streams - in_Renamed = (System.IO.Stream) objSslClientStream; - out_Renamed = (System.IO.Stream) objSslClientStream; - - /* - SslClientStream sslstream = new SslClientStream( - socket.GetStream(), - nstream, - host, - false, - Mono.Security.Protocol.Tls.SecurityProtocolType.Ssl3| Mono.Security.Protocol.Tls.SecurityProtocolType.Tls); - sslstream.ServerCertValidationDelegate = new CertificateValidationCallback(ServerCertificateValidation); - this.in_Renamed = (System.IO.Stream) sslstream; - this.out_Renamed = (System.IO.Stream) sslstream;*/ + in_Renamed = stream; + out_Renamed = stream; } catch (System.IO.IOException ioe) { diff --git a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapConnection.cs.REMOVED.git-id b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapConnection.cs.REMOVED.git-id index 42dec22c0d..59ef5927a2 100644 --- a/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapConnection.cs.REMOVED.git-id +++ b/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap/LdapConnection.cs.REMOVED.git-id @@ -1 +1 @@ -35ee09ca1511efe2fa2328e3243d485753151325 \ No newline at end of file +2817bfa27e4f40fb46f53f867dc2b9edba46aa96 \ No newline at end of file diff --git a/mcs/class/System.ComponentModel.Composition.4.5/System.ComponentModel.Composition_xtest.dll.sources b/mcs/class/System.ComponentModel.Composition.4.5/System.ComponentModel.Composition_xtest.dll.sources new file mode 100644 index 0000000000..97e615399c --- /dev/null +++ b/mcs/class/System.ComponentModel.Composition.4.5/System.ComponentModel.Composition_xtest.dll.sources @@ -0,0 +1,18 @@ +corefx/SR.cs +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs + +../../../external/corefx/src/System.ComponentModel.Composition/tests/Microsoft/Internal/LazyServices.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/*.cs:StringsTests.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System.ComponentModel.Composition.Noop.Assembly/*.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/*.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/UnitTesting/*.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/Integration/*.cs:DiscoveryTests.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/Globalization/*.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/*.cs:CompositionServicesTests.cs,MetadataViewProviderTests.cs,GenericsTests.cs,ExportFactoryTests.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/AttributedModel/*.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Diagnostics/*.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Extensibility/*.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Factories/*.cs:ContainerFactory.NoOverridesCompositionContainer.cs +#../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/*.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Primitives/*.cs +../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/*.cs:ReflectionModelServicesTests.cs diff --git a/mcs/class/System.Core/Makefile b/mcs/class/System.Core/Makefile index 09990975ed..bed9ead36d 100644 --- a/mcs/class/System.Core/Makefile +++ b/mcs/class/System.Core/Makefile @@ -11,12 +11,19 @@ endif REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE LIB_REFS = System LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) -d:INSIDE_SYSCORE -d:LIBC -unsafe -nowarn:436 -TXT_RESOURCE_STRINGS = ../referencesource/System.Core/System.Core.txt +TXT_RESOURCE_STRINGS = RESX_RESOURCE_STRING = \ ../../../external/corefx/src/System.Linq.Expressions/src/Resources/Strings.resx \ ../../../external/corefx/src/System.Linq/src/Resources/Strings.resx \ ../../../external/corefx/src/System.Linq.Parallel/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.Linq.Queryable/src/Resources/Strings.resx + ../../../external/corefx/src/System.Linq.Queryable/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.IO.Pipes/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Net.Sockets/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Security.Cryptography.Cng/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Threading/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Collections/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.IO.MemoryMappedFiles/src/Resources/Strings.resx LIBRARY_WARN_AS_ERROR = yes @@ -35,12 +42,6 @@ ifeq (monotouch_runtime, $(PROFILE)) LIB_MCS_FLAGS += -d:FULL_AOT_RUNTIME endif -ifneq (basic, $(PROFILE)) -ifneq (2.1, $(FRAMEWORK_VERSION)) -LIB_REFS += Mono.Posix -endif -endif - CC_PROFILE := $(filter monotouch% xammac, $(PROFILE)) ifdef CC_PROFILE BUILT_SOURCES = \ diff --git a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafePipeHandle.cs b/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafePipeHandle.cs deleted file mode 100644 index 0c5768009b..0000000000 --- a/mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafePipeHandle.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// SafePipeHandle.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.IO; -using System.Runtime.InteropServices; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; - -namespace Microsoft.Win32.SafeHandles -{ - [HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)] - [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)] - public sealed class SafePipeHandle : SafeHandleZeroOrMinusOneIsInvalid - { - public SafePipeHandle (IntPtr preexistingHandle, bool ownsHandle) - : base (ownsHandle) - { - handle = preexistingHandle; - } - - protected override bool ReleaseHandle () - { - MonoIOError error; - return MonoIO.Close (handle, out error); - } - } -} - diff --git a/mcs/class/System.Core/ReferenceSources/SR.cs b/mcs/class/System.Core/ReferenceSources/SR.cs deleted file mode 100644 index 1fbc0324af..0000000000 --- a/mcs/class/System.Core/ReferenceSources/SR.cs +++ /dev/null @@ -1,253 +0,0 @@ -// -// This file was generated by txt2sr tool -// - -partial class SR -{ - public const string ArgumentOutOfRange_NeedNonNegNum = "Non negative number is required."; - public const string Argument_WrongAsyncResult = "IAsyncResult object did not come from the corresponding async method on this type."; - public const string Argument_InvalidOffLen = "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."; - public const string Argument_NeedNonemptyPipeName = "pipeName cannot be an empty string."; - public const string Argument_EmptyServerName = "serverName cannot be an empty string. Use \".\" for current machine."; - public const string Argument_NonContainerInvalidAnyFlag = "This flag may not be set on a pipe."; - public const string Argument_InvalidHandle = "Invalid handle."; - public const string ArgumentNull_Buffer = "Buffer cannot be null."; - public const string ArgumentNull_ServerName = "serverName cannot be null. Use \".\" for current machine."; - public const string ArgumentOutOfRange_AdditionalAccessLimited = "additionalAccessRights is limited to the PipeAccessRights.ChangePermissions, PipeAccessRights.TakeOwnership, and PipeAccessRights.AccessSystemSecurity flags when creating NamedPipeServerStreams."; - public const string ArgumentOutOfRange_AnonymousReserved = "The pipeName \"anonymous\" is reserved."; - public const string ArgumentOutOfRange_TransmissionModeByteOrMsg = "For named pipes, transmission mode can be TransmissionMode.Byte or PipeTransmissionMode.Message. For anonymous pipes, transmission mode can be TransmissionMode.Byte."; - public const string ArgumentOutOfRange_DirectionModeInOrOut = "PipeDirection.In or PipeDirection.Out required."; - public const string ArgumentOutOfRange_DirectionModeInOutOrInOut = "For named pipes, the pipe direction can be PipeDirection.In, PipeDirection.Out or PipeDirection.InOut. For anonymous pipes, the pipe direction can be PipeDirection.In or PipeDirection.Out."; - public const string ArgumentOutOfRange_ImpersonationInvalid = "TokenImpersonationLevel.None, TokenImpersonationLevel.Anonymous, TokenImpersonationLevel.Identification, TokenImpersonationLevel.Impersonation or TokenImpersonationLevel.Delegation required."; - public const string ArgumentOutOfRange_ImpersonationOptionsInvalid = "impersonationOptions contains an invalid flag."; - public const string ArgumentOutOfRange_OptionsInvalid = "options contains an invalid flag."; - public const string ArgumentOutOfRange_HandleInheritabilityNoneOrInheritable = "HandleInheritability.None or HandleInheritability.Inheritable required."; - public const string ArgumentOutOfRange_InvalidPipeAccessRights = "Invalid PipeAccessRights flag."; - public const string ArgumentOutOfRange_InvalidTimeout = "Timeout must be non-negative or equal to -1 (Timeout.Infinite)"; - public const string ArgumentOutOfRange_MaxNumServerInstances = "maxNumberOfServerInstances must either be a value between 1 and 254, or NamedPipeServerStream.MaxAllowedServerInstances (to obtain the maximum number allowed by system resources)."; - public const string ArgumentOutOfRange_NeedValidPipeAccessRights = "Need valid PipeAccessRights value."; - public const string IndexOutOfRange_IORaceCondition = "Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default unless stated otherwise. In multithreaded applications, access streams in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader."; - public const string InvalidOperation_EndReadCalledMultiple = "EndRead can only be called once for each asynchronous operation."; - public const string InvalidOperation_EndWriteCalledMultiple = "EndWrite can only be called once for each asynchronous operation."; - public const string InvalidOperation_EndWaitForConnectionCalledMultiple = "EndWaitForConnection can only be called once for each asynchronous operation."; - public const string InvalidOperation_PipeNotYetConnected = "Pipe hasn't been connected yet."; - public const string InvalidOperation_PipeDisconnected = "Pipe is in a disconnected state."; - public const string InvalidOperation_PipeHandleNotSet = "Pipe handle has not been set. Did your PipeStream implementation call InitializeHandle?"; - public const string InvalidOperation_PipeNotAsync = "Pipe is not opened in asynchronous mode."; - public const string InvalidOperation_PipeReadModeNotMessage = "ReadMode is not of PipeTransmissionMode.Message."; - public const string InvalidOperation_PipeMessageTypeNotSupported = "This pipe does not support message type transmission."; - public const string InvalidOperation_PipeAlreadyConnected = "Already in a connected state."; - public const string InvalidOperation_PipeAlreadyDisconnected = "Already in a disconnected state."; - public const string InvalidOperation_PipeClosed = "Pipe is closed."; - public const string IO_FileTooLongOrHandleNotSync = "IO operation will not work. Most likely the file will become too long or the handle was not opened to support synchronous IO operations."; - public const string IO_EOF_ReadBeyondEOF = "Unable to read beyond the end of the stream."; - public const string IO_FileNotFound = "Unable to find the specified file."; - public const string IO_FileNotFound_FileName = "Could not find file '{0}'."; - public const string IO_IO_AlreadyExists_Name = "Cannot create \"{0}\" because a file or directory with the same name already exists."; - public const string IO_IO_BindHandleFailed = "BindHandle for ThreadPool failed on this handle."; - public const string IO_IO_FileExists_Name = "The file '{0}' already exists."; - public const string IO_IO_NoPermissionToDirectoryName = ""; - public const string IO_IO_SharingViolation_File = "The process cannot access the file '{0}' because it is being used by another process."; - public const string IO_IO_SharingViolation_NoFileName = "The process cannot access the file because it is being used by another process."; - public const string IO_IO_PipeBroken = "Pipe is broken."; - public const string IO_IO_InvalidPipeHandle = "Invalid pipe handle."; - public const string IO_OperationAborted = "IO operation was aborted unexpectedly."; - public const string IO_DriveNotFound_Drive = "Could not find the drive '{0}'. The drive might not be ready or might not be mapped."; - public const string IO_PathNotFound_Path = "Could not find a part of the path '{0}'."; - public const string IO_PathNotFound_NoPathName = "Could not find a part of the path."; - public const string IO_PathTooLong = "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."; - public const string NotSupported_MemStreamNotExpandable = "Memory stream is not expandable."; - public const string NotSupported_UnreadableStream = "Stream does not support reading."; - public const string NotSupported_UnseekableStream = "Stream does not support seeking."; - public const string NotSupported_UnwritableStream = "Stream does not support writing."; - public const string NotSupported_AnonymousPipeUnidirectional = "Anonymous pipes can only be in one direction."; - public const string NotSupported_AnonymousPipeMessagesNotSupported = "Anonymous pipes do not support PipeTransmissionMode.Message ReadMode."; - public const string ObjectDisposed_FileClosed = "Cannot access a closed file."; - public const string ObjectDisposed_PipeClosed = "Cannot access a closed pipe."; - public const string ObjectDisposed_ReaderClosed = "Cannot read from a closed TextReader."; - public const string ObjectDisposed_StreamClosed = "Cannot access a closed Stream."; - public const string ObjectDisposed_WriterClosed = "Cannot write to a closed TextWriter."; - public const string PlatformNotSupported_NamedPipeServers = "Named Pipe Servers are not supported on Windows 95/98/ME."; - public const string UnauthorizedAccess_IODenied_Path = "Access to the path '{0}' is denied."; - public const string UnauthorizedAccess_IODenied_NoPathName = "Access to the path is denied."; - public const string TraceAsTraceSource = "Trace"; - public const string ArgumentOutOfRange_NeedValidLogRetention = "Need valid log retention option."; - public const string ArgumentOutOfRange_NeedMaxFileSizeGEBufferSize = "Maximum file size value should be greater than or equal to bufferSize."; - public const string ArgumentOutOfRange_NeedValidMaxNumFiles = "Maximum number of files value should be greater than or equal to '{0}' for this retention"; - public const string ArgumentOutOfRange_NeedValidId = "The ID parameter must be in the range {0} through {1}."; - public const string ArgumentOutOfRange_MaxArgExceeded = "The total number of parameters must not exceed {0}."; - public const string ArgumentOutOfRange_MaxStringsExceeded = "The number of String parameters must not exceed {0}."; - public const string NotSupported_DownLevelVista = "This functionality is only supported in Windows Vista and above."; - public const string Argument_NeedNonemptyDelimiter = "Delimiter cannot be an empty string."; - public const string NotSupported_SetTextWriter = "Setting TextWriter is unsupported on this listener."; - public const string Perflib_PlatformNotSupported = "Classes in System.Diagnostics.PerformanceData is only supported in Windows Vista and above."; - public const string Perflib_Argument_CounterSetAlreadyRegister = "CounterSet '{0}' already registered."; - public const string Perflib_Argument_InvalidCounterType = "CounterType '{0}' is not a valid CounterType."; - public const string Perflib_Argument_InvalidCounterSetInstanceType = "CounterSetInstanceType '{0}' is not a valid CounterSetInstanceType."; - public const string Perflib_Argument_InstanceAlreadyExists = "Instance '{0}' already exists in CounterSet '{1}'."; - public const string Perflib_Argument_CounterAlreadyExists = "CounterId '{0}' already added to CounterSet '{1}'."; - public const string Perflib_Argument_CounterNameAlreadyExists = "CounterName '{0}' already added to CounterSet '{1}'."; - public const string Perflib_Argument_ProviderNotFound = "CounterSet provider '{0}' not found."; - public const string Perflib_Argument_InvalidInstance = "Single instance type CounterSet '{0}' can only have 1 CounterSetInstance."; - public const string Perflib_Argument_EmptyInstanceName = "Non-empty instanceName required."; - public const string Perflib_Argument_EmptyCounterName = "Non-empty counterName required."; - public const string Perflib_InsufficientMemory_InstanceCounterBlock = "Cannot allocate raw counter data for CounterSet '{0}' Instance '{1}'."; - public const string Perflib_InsufficientMemory_CounterSetTemplate = "Cannot allocate memory for CounterSet '{0}' template with size '{1}'."; - public const string Perflib_InvalidOperation_CounterRefValue = "Cannot locate raw counter data location for CounterSet '{0}', Counter '{1}, in Instance '{2}'."; - public const string Perflib_InvalidOperation_CounterSetNotInstalled = "CounterSet '{0}' not installed yet."; - public const string Perflib_InvalidOperation_InstanceNotFound = "Cannot find Instance '{0}' in CounterSet '{1}'."; - public const string Perflib_InvalidOperation_AddCounterAfterInstance = "Cannot AddCounter to CounterSet '{0}' after CreateCounterSetInstance."; - public const string Perflib_InvalidOperation_NoActiveProvider = "CounterSet provider '{0}' not active."; - public const string Perflib_InvalidOperation_CounterSetContainsNoCounter = "CounterSet '{0}' does not include any counters."; - public const string Arg_ArrayPlusOffTooSmall = "Destination array is not long enough to copy all the items in the collection. Check array index and length."; - public const string Arg_HSCapacityOverflow = "HashSet capacity is too big."; - public const string InvalidOperation_EnumFailedVersion = "Collection was modified; enumeration operation may not execute."; - public const string InvalidOperation_EnumOpCantHappen = "Enumeration has either not started or has already finished."; - public const string Serialization_MissingKeys = "The Keys for this dictionary are missing."; - public const string LockRecursionException_RecursiveReadNotAllowed = "Recursive read lock acquisitions not allowed in this mode."; - public const string LockRecursionException_RecursiveWriteNotAllowed = "Recursive write lock acquisitions not allowed in this mode."; - public const string LockRecursionException_RecursiveUpgradeNotAllowed = "Recursive upgradeable lock acquisitions not allowed in this mode."; - public const string LockRecursionException_ReadAfterWriteNotAllowed = "A read lock may not be acquired with the write lock held in this mode."; - public const string LockRecursionException_WriteAfterReadNotAllowed = "Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock."; - public const string LockRecursionException_UpgradeAfterReadNotAllowed = "Upgradeable lock may not be acquired with read lock held."; - public const string LockRecursionException_UpgradeAfterWriteNotAllowed = "Upgradeable lock may not be acquired with write lock held in this mode. Acquiring Upgradeable lock gives the ability to read along with an option to upgrade to a writer."; - public const string SynchronizationLockException_MisMatchedRead = "The read lock is being released without being held."; - public const string SynchronizationLockException_MisMatchedWrite = "The write lock is being released without being held."; - public const string SynchronizationLockException_MisMatchedUpgrade = "The upgradeable lock is being released without being held."; - public const string SynchronizationLockException_IncorrectDispose = "The lock is being disposed while still being used. It either is being held by a thread and/or has active waiters waiting to acquire the lock."; - public const string Cryptography_ArgECDHKeySizeMismatch = "The keys from both parties must be the same size to generate a secret agreement."; - public const string Cryptography_ArgECDHRequiresECDHKey = "Keys used with the ECDiffieHellmanCng algorithm must have an algorithm group of ECDiffieHellman."; - public const string Cryptography_ArgECDsaRequiresECDsaKey = "Keys used with the ECDsaCng algorithm must have an algorithm group of ECDsa."; - public const string Cryptography_ArgExpectedECDiffieHellmanCngPublicKey = "DeriveKeyMaterial requires an ECDiffieHellmanCngPublicKey."; - public const string Cryptography_ArgMustBeCngAlgorithm = "Object must be of type CngAlgorithm."; - public const string Cryptography_ArgMustBeCngAlgorithmGroup = "Object must be of type CngAlgorithmGroup."; - public const string Cryptography_ArgMustBeCngKeyBlobFormat = "Object must be of type CngKeyBlobFormat."; - public const string Cryptography_ArgMustBeCngProvider = "Object must be of type CngProvider."; - public const string Cryptography_DecryptWithNoKey = "Decrypting a value requires that a key be set on the algorithm object."; - public const string Cryptography_ECXmlSerializationFormatRequired = "XML serialization of an elliptic curve key requires using an overload which specifies the XML format to be used."; - public const string Cryptography_InvalidAlgorithmGroup = "The algorithm group '{0}' is invalid."; - public const string Cryptography_InvalidAlgorithmName = "The algorithm name '{0}' is invalid."; - public const string Cryptography_InvalidCipherMode = "The specified cipher mode is not valid for this algorithm."; - public const string Cryptography_InvalidIVSize = "The specified initialization vector (IV) does not match the block size for this algorithm."; - public const string Cryptography_InvalidKeyBlobFormat = "The key blob format '{0}' is invalid."; - public const string Cryptography_InvalidKeySize = "The specified key is not a valid size for this algorithm."; - public const string Cryptography_InvalidPadding = "Padding is invalid and cannot be removed."; - public const string Cryptography_InvalidProviderName = "The provider name '{0}' is invalid."; - public const string Cryptography_MissingDomainParameters = "Could not read the domain parameters from the XML string."; - public const string Cryptography_MissingPublicKey = "Could not read the public key from the XML string."; - public const string Cryptography_MissingIV = "The cipher mode specified requires that an initialization vector (IV) be used."; - public const string Cryptography_MustTransformWholeBlock = "TransformBlock may only process bytes in block sized increments."; - public const string Cryptography_NonCompliantFIPSAlgorithm = "This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms."; - public const string Cryptography_OpenInvalidHandle = "Cannot open an invalid handle."; - public const string Cryptography_OpenEphemeralKeyHandleWithoutEphemeralFlag = "The CNG key handle being opened was detected to be ephemeral, but the EphemeralKey open option was not specified."; - public const string Cryptography_PartialBlock = "The input data is not a complete block."; - public const string Cryptography_PlatformNotSupported = "The specified cryptographic algorithm is not supported on this platform."; - public const string Cryptography_TlsRequiresLabelAndSeed = "The TLS key derivation function requires both the label and seed properties to be set."; - public const string Cryptography_TransformBeyondEndOfBuffer = "Attempt to transform beyond end of buffer."; - public const string Cryptography_UnknownEllipticCurve = "Unknown elliptic curve."; - public const string Cryptography_UnknownEllipticCurveAlgorithm = "Unknown elliptic curve algorithm."; - public const string Cryptography_UnknownPaddingMode = "Unknown padding mode used."; - public const string Cryptography_UnexpectedXmlNamespace = "The XML namespace '{0}' was unexpected, expected '{1}'."; - public const string ArgumentException_RangeMinRangeMaxRangeType = "Cannot accept MinRange {0} because it is not the same type as MaxRange {1}. Verify that the MaxRange and MinRange values are of the same type and try again."; - public const string ArgumentException_RangeNotIComparable = "Cannot accept MaxRange and MinRange because they are not IComparable."; - public const string ArgumentException_RangeMaxRangeSmallerThanMinRange = "Cannot accept MaxRange because it is less than MinRange. Specify a MaxRange value that is greater than or equal to the MinRange value and try again."; - public const string ArgumentException_CountMaxLengthSmallerThanMinLength = "MaxLength should be greater than MinLength."; - public const string ArgumentException_LengthMaxLengthSmallerThanMinLength = "Cannot accept MaxLength value. Specify MaxLength value greater than the value of MinLength and try again."; - public const string ArgumentException_UnregisteredParameterName = "Parameter {0} has not been added to this parser."; - public const string ArgumentException_InvalidParameterName = "{0} is an invalid parameter name."; - public const string ArgumentException_DuplicateName = "The name {0} is already in use."; - public const string ArgumentException_DuplicatePosition = "The position {0} is already in use."; - public const string ArgumentException_NoParametersFound = "The object has no parameters associated with it."; - public const string ArgumentException_HelpMessageBaseNameNullOrEmpty = "Help message base name may not be null or empty."; - public const string ArgumentException_HelpMessageResourceIdNullOrEmpty = "Help message resource id may not be null or empty."; - public const string ArgumentException_HelpMessageNullOrEmpty = "Help message may not be null or empty."; - public const string ArgumentException_RegexPatternNullOrEmpty = "The regular expression pattern may not be null or empty."; - public const string ArgumentException_RequiredPositionalAfterOptionalPositional = "Optional positional parameter {0} cannot precede required positional parameter {1}."; - public const string ArgumentException_DuplicateParameterAttribute = "Duplicate parameter attributes with the same parameter set on parameter {0}."; - public const string ArgumentException_MissingBaseNameOrResourceId = "On parameter {0}, either both HelpMessageBaseName and HelpMessageResourceId must be set or neither can be set."; - public const string ArgumentException_DuplicateRemainingArgumets = "Can not set {0} as the remaining arguments parameter for parameter set {1} because that parameter set already has a parameter set as the remaining arguments parameter."; - public const string ArgumentException_TypeMismatchForRemainingArguments = "Parameter {0} must be an array of strings if it can have its value from the remaining arguments."; - public const string ArgumentException_ValidationParameterTypeMismatch = "Validator {0} may not be applied to a parameter of type {1}."; - public const string ArgumentException_ParserBuiltWithValueType = "The parameter toBind may not be an instance of a value type."; - public const string InvalidOperationException_GetParameterTypeMismatch = "Parameter {0} may not retrieved with type {1} since it is of type {2}."; - public const string InvalidOperationException_GetParameterValueBeforeParse = "Parse must be called before retrieving parameter values."; - public const string InvalidOperationException_SetRemainingArgumentsParameterAfterParse = "AllowRemainingArguments may not be set after Parse has been called."; - public const string InvalidOperationException_AddParameterAfterParse = "Parameters may not be added after Parse has been called."; - public const string InvalidOperationException_BindAfterBind = "Parse may only be called once."; - public const string InvalidOperationException_GetRemainingArgumentsNotAllowed = "GetRemainingArguments may not be called unless AllowRemainingArguments is set to true."; - public const string InvalidOperationException_ParameterSetBeforeParse = "The SpecifiedParameterSet property may only be accessed after Parse has been called successfully."; - public const string CommandLineParser_Aliases = "Aliases"; - public const string CommandLineParser_ErrorMessagePrefix = "Error"; - public const string CommandLineParser_HelpMessagePrefix = "Usage"; - public const string ParameterBindingException_AmbiguousParameterName = "Prefix {0} resolves to multiple parameters: {1}. Use a more specific prefix for this parameter."; - public const string ParameterBindingException_ParameterValueAlreadySpecified = "Parameter {0} already given value of {1}."; - public const string ParameterBindingException_UnknownParameteName = "Unknown parameter {0}."; - public const string ParameterBindingException_RequiredParameterMissingCommandLineValue = "Parameter {0} must be followed by a value."; - public const string ParameterBindingException_UnboundCommandLineArguments = "Unbound parameters left on command line: {0}."; - public const string ParameterBindingException_UnboundMandatoryParameter = "Values for required parameters missing: {0}."; - public const string ParameterBindingException_ResponseFileException = "Could not open response file {0}: {1}"; - public const string ParameterBindingException_ValididationError = "Could not validate parameter {0}: {1}"; - public const string ParameterBindingException_TransformationError = "Could not convert {0} to type {1}."; - public const string ParameterBindingException_AmbiguousParameterSet = "Named parameters specify an ambiguous parameter set. Specify more parameters by name."; - public const string ParameterBindingException_UnknownParameterSet = "No valid parameter set for named parameters. Make sure all named parameters belong to the same parameter set."; - public const string ParameterBindingException_NestedResponseFiles = "A response file may not contain references to other response files."; - public const string ValidateMetadataException_RangeGreaterThanMaxRangeFailure = "The value {0} was greater than the maximum value {1}. Specify a value less than or equal to the maximum value and try again."; - public const string ValidateMetadataException_RangeSmallerThanMinRangeFailure = "The value {0} was smaller than the minimum value {1}. Specify a value greater than or equal to the minimum value and try again."; - public const string ValidateMetadataException_PatternFailure = "The value {0} does not match the pattern {1}."; - public const string ValidateMetadataException_CountMinLengthFailure = "The number of values should be greater than or equal to {0} instead of {1}."; - public const string ValidateMetadataException_CountMaxLengthFailure = "The number of values should be less than or equal to {0} instead of {1}."; - public const string ValidateMetadataException_LengthMinLengthFailure = "The length should be greater than or equal to {0} instead of {1}."; - public const string ValidateMetadataException_LengthMaxLengthFailure = "The length should be less than or equal to {0} instead of {1}."; - public const string Argument_MapNameEmptyString = "Map name cannot be an empty string."; - public const string Argument_EmptyFile = "A positive capacity must be specified for a Memory Mapped File backed by an empty file."; - public const string Argument_NewMMFWriteAccessNotAllowed = "MemoryMappedFileAccess.Write is not permitted when creating new memory mapped files. Use MemoryMappedFileAccess.ReadWrite instead."; - public const string Argument_ReadAccessWithLargeCapacity = "When specifying MemoryMappedFileAccess.Read access, the capacity must not be larger than the file size."; - public const string Argument_NewMMFAppendModeNotAllowed = "FileMode.Append is not permitted when creating new memory mapped files. Instead, use MemoryMappedFileView to ensure write-only access within a specified region."; - public const string ArgumentNull_MapName = "Map name cannot be null."; - public const string ArgumentNull_FileStream = "fileStream cannot be null."; - public const string ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed = "The capacity cannot be greater than the size of the system's logical address space."; - public const string ArgumentOutOfRange_NeedPositiveNumber = "A positive number is required."; - public const string ArgumentOutOfRange_PositiveOrDefaultCapacityRequired = "The capacity must be greater than or equal to 0. 0 represents the the size of the file being mapped."; - public const string ArgumentOutOfRange_PositiveOrDefaultSizeRequired = "The size must be greater than or equal to 0. If 0 is specified, the view extends from the specified offset to the end of the file mapping."; - public const string ArgumentOutOfRange_PositionLessThanCapacityRequired = "The position may not be greater or equal to the capacity of the accessor."; - public const string ArgumentOutOfRange_CapacityGEFileSizeRequired = "The capacity may not be smaller than the file size."; - public const string IO_NotEnoughMemory = "Not enough memory to map view."; - public const string InvalidOperation_CalledTwice = "Cannot call this operation twice."; - public const string InvalidOperation_CantCreateFileMapping = "Cannot create file mapping."; - public const string InvalidOperation_ViewIsNull = "The underlying MemoryMappedView object is null."; - public const string NotSupported_DelayAllocateFileBackedNotAllowed = "The MemoryMappedFileOptions.DelayAllocatePages option is not supported with memory mapped files mapping files on disk."; - public const string NotSupported_MMViewStreamsFixedLength = "MemoryMappedViewStreams are fixed length."; - public const string ObjectDisposed_ViewAccessorClosed = "Cannot access a closed accessor."; - public const string ObjectDisposed_StreamIsClosed = "Cannot access a closed Stream."; - public const string NotSupported_Method = "Method not supported."; - public const string NotSupported_SubclassOverride = "Method not supported. Derived class must override."; - public const string Cryptography_ArgDSARequiresDSAKey = "Keys used with the DSACng algorithm must have an algorithm group of DSA."; - public const string Cryptography_ArgRSAaRequiresRSAKey = "Keys used with the RSACng algorithm must have an algorithm group of RSA."; - public const string Cryptography_CngKeyWrongAlgorithm = "This key is for algorithm '{0}'. Expected '{1}'."; - public const string Cryptography_DSA_HashTooShort = "The supplied hash cannot be shorter in length than the DSA key's Q value."; - public const string Cryptography_HashAlgorithmNameNullOrEmpty = "The hash algorithm name cannot be null or empty."; - public const string Cryptography_InvalidDsaParameters_MissingFields = "The specified DSA parameters are not valid; P, Q, G and Y are all required."; - public const string Cryptography_InvalidDsaParameters_MismatchedPGY = "The specified DSA parameters are not valid; P, G and Y must be the same length (the key size)."; - public const string Cryptography_InvalidDsaParameters_MismatchedQX = "The specified DSA parameters are not valid; Q and X (if present) must be the same length."; - public const string Cryptography_InvalidDsaParameters_MismatchedPJ = "The specified DSA parameters are not valid; J (if present) must be shorter than P."; - public const string Cryptography_InvalidDsaParameters_SeedRestriction_ShortKey = "The specified DSA parameters are not valid; Seed, if present, must be 20 bytes long for keys shorter than 1024 bits."; - public const string Cryptography_InvalidDsaParameters_QRestriction_ShortKey = "The specified DSA parameters are not valid; Q must be 20 bytes long for keys shorter than 1024 bits."; - public const string Cryptography_InvalidDsaParameters_QRestriction_LargeKey = "The specified DSA parameters are not valid; Q's length must be one of 20, 32 or 64 bytes."; - public const string Cryptography_InvalidRsaParameters = "The specified RSA parameters are not valid; both Exponent and Modulus are required fields."; - public const string Cryptography_InvalidSignatureAlgorithm = "The hash algorithm is not supported for signatures. Only MD5, SHA1, SHA256,SHA384, and SHA512 are supported at this time."; - public const string Cryptography_KeyBlobParsingError = "Key Blob not in expected format."; - public const string Cryptography_NotSupportedKeyAlgorithm = "Key Algorithm is not supported."; - public const string Cryptography_NotValidPublicOrPrivateKey = "Key is not a valid public or private key."; - public const string Cryptography_NotValidPrivateKey = "Key is not a valid private key."; - public const string Cryptography_UnexpectedTransformTruncation = "CNG provider unexpectedly terminated encryption or decryption prematurely."; - public const string Cryptography_UnsupportedPaddingMode = "The specified PaddingMode is not supported."; - public const string Cryptography_WeakKey = "Specified key is a known weak key for this algorithm and cannot be used."; - public const string Cryptography_CurveNotSupported = "The specified curve '{0}' or its parameters are not valid for this platform."; - public const string Cryptography_InvalidCurve = "The specified curve '{0}' is not valid for this platform."; - public const string Cryptography_InvalidCurveOid = "The specified Oid is not valid. The Oid.FriendlyName or Oid.Value property must be set."; - public const string Cryptography_InvalidCurveKeyParameters = "The specified key parameters are not valid. Q.X and Q.Y are required fields. Q.X, Q.Y must be the same length. If D is specified it must be the same length as Q.X and Q.Y for named curves or the same length as Order for explicit curves."; - public const string Cryptography_InvalidECCharacteristic2Curve = "The specified Characteristic2 curve parameters are not valid. Polynomial, A, B, G.X, G.Y, and Order are required. A, B, G.X, G.Y must be the same length, and the same length as Q.X, Q.Y and D if those are specified. Seed, Cofactor and Hash are optional. Other parameters are not allowed."; - public const string Cryptography_InvalidECPrimeCurve = "The specified prime curve parameters are not valid. Prime, A, B, G.X, G.Y and Order are required and must be the same length, and the same length as Q.X, Q.Y and D if those are specified. Seed, Cofactor and Hash are optional. Other parameters are not allowed."; - public const string Cryptography_InvalidECNamedCurve = "The specified named curve parameters are not valid. Only the Oid parameter must be set."; - public const string Cryptography_UnknownHashAlgorithm = "'{0}' is not a known hash algorithm."; -} diff --git a/mcs/class/System.Core/System.Core_xtest.dll.sources b/mcs/class/System.Core/System.Core_xtest.dll.sources new file mode 100644 index 0000000000..683f778f44 --- /dev/null +++ b/mcs/class/System.Core/System.Core_xtest.dll.sources @@ -0,0 +1,90 @@ +../../build/common/SR.cs + +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs + +# System.Linq.Queryable +../../../external/corefx/src/System.Linq.Queryable/tests/*.cs +../../../external/corefx/src/Common/tests/System/Linq/SkipTakeData.cs + +# System.Linq.Expressions +../../../external/corefx/src/System.Linq.Expressions/tests/Array/*.cs:NewArrayBoundsTests.cs,ArrayAccessTests.cs,ArrayIndexTests.cs +../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Block/*.cs:NoParameterBlockTests.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Call/*.cs:CallTests.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Cast/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Conditional/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Constant/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Convert/*.cs:ConvertCheckedTests.cs +../../../external/corefx/src/System.Linq.Expressions/tests/DebuggerTypeProxy/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/DebugInfo/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Default/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/DelegateType/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Dynamic/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/DynamicExpression/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/ExceptionHandling/*.cs:ExceptionHandlingExpressions.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Goto/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/ILReader/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/IndexExpression/*.cs:IndexExpressionTests.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Invoke/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Label/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Lambda/*.cs:LambdaTests.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Lifted/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/ListInit/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Loop/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Member/*.cs:MemberAccessTests.cs +../../../external/corefx/src/System.Linq.Expressions/tests/MemberInit/*.cs:BindTests.cs +../../../external/corefx/src/System.Linq.Expressions/tests/New/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/SequenceTests/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Switch/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Ternary/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/TestExtensions/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/TypeBinary/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Unary/*.cs:UnaryConvertTests.cs,UnaryQuoteTests.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Variables/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Visitor/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Arithmetic/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Assignment/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Bitwise/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Coalesce/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Comparison/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/Logical/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/BinaryOperators/ReferenceComparison/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/Unary/IncDecAssign/*.cs +../../../external/corefx/src/System.Linq.Expressions/tests/*.cs:StackSpillerTests.cs,ReadOnlyCollectionBuilderTests.cs + +# System.Linq.Expressions +../../../external/corefx/src/System.Linq.Parallel/tests/Combinatorial/*.cs +../../../external/corefx/src/System.Linq.Parallel/tests/Helpers/*.cs +#../../../external/corefx/src/System.Linq.Parallel/tests/QueryOperators/*.cs +../../../external/corefx/src/System.Linq.Parallel/tests/*.cs:WithCancellationTests.cs,PlinqModesTests.cs,ExchangeTests.cs,EtwTests.cs,ParallelEnumerableTests.cs +../../../external/corefx/src/Common/tests/System/Threading/ThreadPoolHelpers.cs +../../../external/corefx/src/Common/tests/System/Diagnostics/Tracing/TestEventListener.cs +../../../external/corefx/src/Common/tests/System/ShouldNotBeInvokedException.cs + +# tests need System.Collections.Immutable.dll +../../../external/corefx/src/Common/src/System/Runtime/Versioning/NonVersionableAttribute.cs +../../../external/corefx/src/System.Collections.Immutable/src/System/Collections/Generic/*.cs +../../../external/corefx/src/System.Collections.Immutable/src/System/Collections/Immutable/*.cs +../../../external/corefx/src/System.Collections.Immutable/src/Validation/*.cs +corefx/SR.tests.cs + +# System.IO.Pipes +#../../../external/corefx/src/System.IO.Pipes/tests/Interop.Unix.cs +../../../external/corefx/src/System.IO.Pipes/tests/PipeTest.cs +../../../external/corefx/src/System.IO.Pipes/tests/PipeTest.Read.cs +../../../external/corefx/src/System.IO.Pipes/tests/PipeTest.Write.cs +../../../external/corefx/src/System.IO.Pipes/tests/PipeTestBase.cs +../../../external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CreateClient.cs +../../../external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.CreateServer.cs +../../../external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Read.cs +../../../external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs +../../../external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Write.cs +../../../external/corefx/src/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTestBase.cs +#../../../external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.CreateClient.cs +#../../../external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Read.cs +#../../../external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs +#../../../external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Write.cs +#../../../external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Simple.cs +#../../../external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.UnixDomainSockets.cs +../../../external/corefx/src/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTestBase.cs + diff --git a/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeClientStream.cs b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeClientStream.cs deleted file mode 100644 index a4818f7604..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeClientStream.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -// AnonymousPipeClientStream.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if !BOOTSTRAP_BASIC - -using System; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; -using Microsoft.Win32.SafeHandles; - -namespace System.IO.Pipes -{ - [MonoTODO ("Anonymous pipes are not working even on win32, due to some access authorization issue")] - [HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)] - public sealed class AnonymousPipeClientStream : PipeStream - { - static SafePipeHandle ToSafePipeHandle (string pipeHandleAsString) - { - if (pipeHandleAsString == null) - throw new ArgumentNullException ("pipeHandleAsString"); - // We use int64 for safety - return new SafePipeHandle (new IntPtr (long.Parse (pipeHandleAsString, NumberFormatInfo.InvariantInfo)), false); - } - - //IAnonymousPipeClient impl; - - public AnonymousPipeClientStream (string pipeHandleAsString) - : this (PipeDirection.In, pipeHandleAsString) - { - } - - public AnonymousPipeClientStream (PipeDirection direction, string pipeHandleAsString) - : this (direction, ToSafePipeHandle (pipeHandleAsString)) - { - } - - public AnonymousPipeClientStream (PipeDirection direction, SafePipeHandle safePipeHandle) - : base (direction, DefaultBufferSize) - { - /* - if (IsWindows) - impl = new Win32AnonymousPipeClient (this, safePipeHandle); - else - impl = new UnixAnonymousPipeClient (this, safePipeHandle); - */ - -#if MOBILE - throw new NotImplementedException (); -#else - InitializeHandle (safePipeHandle, false, false); - IsConnected = true; -#endif - } - - ~AnonymousPipeClientStream () - { - // To be compatible with .net - } - - public override PipeTransmissionMode ReadMode { - set { - if (value == PipeTransmissionMode.Message) - throw new NotSupportedException (); - } - } - - public override PipeTransmissionMode TransmissionMode { - get { return PipeTransmissionMode.Byte; } - } - } -} - -#endif diff --git a/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.NotSupported.cs b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.NotSupported.cs new file mode 100644 index 0000000000..3d2362f1b0 --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.NotSupported.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Win32.SafeHandles; +using System.Diagnostics; +using System.Security; + +namespace System.IO.Pipes +{ + /// + /// Anonymous pipe server stream + /// + public sealed partial class AnonymousPipeServerStream : PipeStream + { + public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity) + : base (PipeDirection.In, 0) + { + throw new PlatformNotSupportedException(); + } + + // Creates the anonymous pipe. + private unsafe void Create (PipeDirection direction, HandleInheritability inheritability, int bufferSize) + { + throw new PlatformNotSupportedException(); + } + } +} \ No newline at end of file diff --git a/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.Unix.cs b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.Unix.cs new file mode 100644 index 0000000000..6f752cc5ec --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.Unix.cs @@ -0,0 +1,13 @@ +namespace System.IO.Pipes +{ + public sealed partial class AnonymousPipeServerStream + { + public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity) + : this (direction, inheritability, bufferSize) + { + if (pipeSecurity != null) { + throw new PlatformNotSupportedException (); + } + } + } +} diff --git a/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.Windows.cs b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.Windows.cs new file mode 100644 index 0000000000..f4629716bd --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.Windows.cs @@ -0,0 +1,22 @@ +using Microsoft.Win32.SafeHandles; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace System.IO.Pipes +{ + public sealed partial class AnonymousPipeServerStream + { + public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity) + : base (direction, bufferSize) + { + if (direction == PipeDirection.InOut) { + throw new NotSupportedException(SR.NotSupported_AnonymousPipeUnidirectional); + } + if (inheritability < HandleInheritability.None || inheritability > HandleInheritability.Inheritable) { + throw new ArgumentOutOfRangeException(nameof(inheritability), SR.ArgumentOutOfRange_HandleInheritabilityNoneOrInheritable); + } + + Create(direction, inheritability, bufferSize, pipeSecurity); + } + } +} diff --git a/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.cs b/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.cs deleted file mode 100644 index 18c82aeac3..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/AnonymousPipeServerStream.cs +++ /dev/null @@ -1,154 +0,0 @@ -// -// AnonymousPipeServerStream.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if !BOOTSTRAP_BASIC - -using System; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; -using Microsoft.Win32.SafeHandles; - -namespace System.IO.Pipes -{ - [MonoTODO ("Anonymous pipes are not working even on win32, due to some access authorization issue")] - [HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)] - public sealed class AnonymousPipeServerStream : PipeStream - { - public AnonymousPipeServerStream () - : this (PipeDirection.Out) - { - } - - public AnonymousPipeServerStream (PipeDirection direction) - : this (direction, HandleInheritability.None) - { - } - - public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability) - : this (direction, inheritability, DefaultBufferSize) - { - } - - public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize) -#if MOBILE - : base (direction, bufferSize) - { - throw new NotImplementedException (); - } -#else - : this (direction, inheritability, bufferSize, null) - { - } -#endif - - public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity) - : base (direction, bufferSize) - { - if (direction == PipeDirection.InOut) - throw new NotSupportedException ("Anonymous pipe direction can only be either in or out."); - -#if MOBILE - throw new NotImplementedException (); -#else - if (IsWindows) - impl = new Win32AnonymousPipeServer (this, direction, inheritability, bufferSize, pipeSecurity); - else - impl = new UnixAnonymousPipeServer (this, direction, inheritability, bufferSize); - - InitializeHandle (impl.Handle, false, false); - IsConnected = true; -#endif - } - - [MonoTODO] - public AnonymousPipeServerStream (PipeDirection direction, SafePipeHandle serverSafePipeHandle, SafePipeHandle clientSafePipeHandle) - : base (direction, DefaultBufferSize) - { - if (serverSafePipeHandle == null) - throw new ArgumentNullException ("serverSafePipeHandle"); - if (clientSafePipeHandle == null) - throw new ArgumentNullException ("clientSafePipeHandle"); - - if (direction == PipeDirection.InOut) - throw new NotSupportedException ("Anonymous pipe direction can only be either in or out."); - -#if MOBILE - throw new NotImplementedException (); -#else - if (IsWindows) - impl = new Win32AnonymousPipeServer (this, serverSafePipeHandle, clientSafePipeHandle); - else - impl = new UnixAnonymousPipeServer (this, serverSafePipeHandle, clientSafePipeHandle); - - InitializeHandle (serverSafePipeHandle, true, false); - IsConnected = true; - - ClientSafePipeHandle = clientSafePipeHandle; -#endif - } - - ~AnonymousPipeServerStream () - { - // To be compatible with .net - } - - IAnonymousPipeServer impl; - - [MonoTODO] - public SafePipeHandle ClientSafePipeHandle { get; private set; } - - public override PipeTransmissionMode ReadMode { - set { - if (value == PipeTransmissionMode.Message) - throw new NotSupportedException (); - } - } - - public override PipeTransmissionMode TransmissionMode { - get { return PipeTransmissionMode.Byte; } - } - - [MonoTODO] - public void DisposeLocalCopyOfClientHandle () - { - impl.DisposeLocalCopyOfClientHandle (); - } - - public string GetClientHandleAsString () - { - // We use int64 for safety. - return impl.Handle.DangerousGetHandle ().ToInt64 ().ToString (NumberFormatInfo.InvariantInfo); - } - } -} - -#endif diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.NotSupported.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.NotSupported.cs new file mode 100644 index 0000000000..154d8a4cc5 --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.NotSupported.cs @@ -0,0 +1,41 @@ +using Microsoft.Win32.SafeHandles; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; +using System.Net.Sockets; +using System.Security; +using System.Threading; +using System.Security.Principal; + +namespace System.IO.Pipes +{ + /// + /// Named pipe client. Use this to open the client end of a named pipes created with + /// NamedPipeServerStream. + /// + public sealed partial class NamedPipeClientStream : PipeStream + { + public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability) + : base (PipeDirection.In, 0) + { + throw new PlatformNotSupportedException (); + } + + private bool TryConnect (int timeout, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException (); + } + + public int NumberOfServerInstances + { + get { + throw new PlatformNotSupportedException (); + } + } + + private void ValidateRemotePipeUser (SafePipeHandle handle) + { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.Unix.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.Unix.cs new file mode 100644 index 0000000000..0a08682175 --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.Unix.cs @@ -0,0 +1,18 @@ +using System.Security.Principal; + +namespace System.IO.Pipes +{ + public sealed partial class NamedPipeClientStream + { + public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability) + : this (serverName, pipeName, (PipeDirection)(desiredAccessRights & (PipeAccessRights.ReadData | PipeAccessRights.WriteData)), options, impersonationLevel, inheritability) + { + if ((desiredAccessRights & ~(PipeAccessRights.FullControl | PipeAccessRights.AccessSystemSecurity)) != 0) { + throw new ArgumentOutOfRangeException(nameof(desiredAccessRights), SR.ArgumentOutOfRange_InvalidPipeAccessRights); + } + if ((desiredAccessRights & ~(PipeAccessRights.ReadData | PipeAccessRights.WriteData)) != 0) { + throw new PlatformNotSupportedException(); + } + } + } +} diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.Windows.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.Windows.cs new file mode 100644 index 0000000000..5efe5962ef --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.Windows.cs @@ -0,0 +1,20 @@ +using System.Security.Principal; + +namespace System.IO.Pipes +{ + public sealed partial class NamedPipeClientStream + { + int _access; + + public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability) + : this (serverName, pipeName, (PipeDirection)(desiredAccessRights & (PipeAccessRights.ReadData | PipeAccessRights.WriteData)), options, impersonationLevel, inheritability) + { + if ((desiredAccessRights & ~(PipeAccessRights.FullControl | PipeAccessRights.AccessSystemSecurity)) != 0) { + throw new ArgumentOutOfRangeException(nameof(desiredAccessRights), SR.ArgumentOutOfRange_InvalidPipeAccessRights); + } + + // Referenced from CoreFX code + _access = (int)desiredAccessRights; + } + } +} diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs deleted file mode 100644 index a27c4dc0b4..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/NamedPipeClientStream.cs +++ /dev/null @@ -1,187 +0,0 @@ -// -// NamedPipeClientStream.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if !BOOTSTRAP_BASIC - -using System; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Win32; -using Microsoft.Win32.SafeHandles; - -namespace System.IO.Pipes -{ - [MonoTODO ("working only on win32 right now")] - [HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)] - public sealed class NamedPipeClientStream : PipeStream - { - public NamedPipeClientStream (string pipeName) - : this (".", pipeName) - { - } - - public NamedPipeClientStream (string serverName, string pipeName) - : this (serverName, pipeName, PipeDirection.InOut) - { - } - - public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction) - : this (serverName, pipeName, direction, PipeOptions.None) - { - } - - public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options) - : this (serverName, pipeName, direction, options, TokenImpersonationLevel.None) - { - } - - public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options, TokenImpersonationLevel impersonationLevel) - : this (serverName, pipeName, direction, options, impersonationLevel, HandleInheritability.None) - { - } - - public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability) -#if MOBILE - : base (direction, DefaultBufferSize) - { - throw new NotImplementedException (); - } -#else - : this (serverName, pipeName, ToAccessRights (direction), options, impersonationLevel, inheritability) - { - } -#endif - - public NamedPipeClientStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle) - : base (direction, DefaultBufferSize) - { -#if MOBILE - throw new NotImplementedException (); -#else - if (IsWindows) - impl = new Win32NamedPipeClient (this, safePipeHandle); - else - impl = new UnixNamedPipeClient (this, safePipeHandle); - IsConnected = isConnected; - InitializeHandle (safePipeHandle, true, isAsync); -#endif - } - - public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability) - : base (ToDirection (desiredAccessRights), DefaultBufferSize) - { - if (impersonationLevel != TokenImpersonationLevel.None || - inheritability != HandleInheritability.None) - throw ThrowACLException (); -#if MOBILE - throw new NotImplementedException (); -#else - if (IsWindows) - impl = new Win32NamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability); - else - impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability); -#endif - - } - - ~NamedPipeClientStream () { - Dispose (false); - } - -#if !MOBILE - INamedPipeClient impl; -#endif - - public void Connect () - { -#if MOBILE - throw new NotImplementedException (); -#else - impl.Connect (); - InitializeHandle (impl.Handle, false, impl.IsAsync); - IsConnected = true; -#endif - } - - public void Connect (int timeout) - { -#if MOBILE - throw new NotImplementedException (); -#else - impl.Connect (timeout); - InitializeHandle (impl.Handle, false, impl.IsAsync); - IsConnected = true; -#endif - } - - public Task ConnectAsync () - { - return ConnectAsync (Timeout.Infinite, CancellationToken.None); - } - - public Task ConnectAsync (int timeout) - { - return ConnectAsync (timeout, CancellationToken.None); - } - - public Task ConnectAsync (CancellationToken cancellationToken) - { - return ConnectAsync (Timeout.Infinite, cancellationToken); - } - - public Task ConnectAsync (int timeout, CancellationToken cancellationToken) - { - throw new NotImplementedException (); - } - - protected override internal void CheckPipePropertyOperations () { - base.CheckPipePropertyOperations(); - } - - public int NumberOfServerInstances { - get { - CheckPipePropertyOperations (); -#if MOBILE - throw new NotImplementedException (); -#else - return impl.NumberOfServerInstances; -#endif - } - } - } -} - -#endif diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.NotSupported.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.NotSupported.cs new file mode 100644 index 0000000000..7203546e8a --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.NotSupported.cs @@ -0,0 +1,71 @@ +using Microsoft.Win32.SafeHandles; +using System.Collections.Generic; +using System.Diagnostics; +using System.Net.Sockets; +using System.Runtime.InteropServices; +using System.Security; +using System.Threading; +using System.Threading.Tasks; +using System.Security.Permissions; + +namespace System.IO.Pipes +{ + public sealed partial class NamedPipeServerStream : PipeStream + { + public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity) + : base (PipeDirection.In, 0) + { + throw new PlatformNotSupportedException (); + } + + public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability) + : base (PipeDirection.In, 0) + { + throw new PlatformNotSupportedException (); + } + + public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights) + : base (PipeDirection.In, 0) + { + throw new PlatformNotSupportedException (); + } + + [SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)] + public void RunAsClient (PipeStreamImpersonationWorker impersonationWorker) + { + throw new PlatformNotSupportedException (); + } + + private void Create (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, + PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, + HandleInheritability inheritability) + { + throw new PlatformNotSupportedException (); + } + + public void WaitForConnection () + { + throw new PlatformNotSupportedException (); + } + + public Task WaitForConnectionAsync (CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException (); + } + + private void HandleAcceptedSocket (Socket acceptedSocket) + { + throw new PlatformNotSupportedException (); + } + + public void Disconnect () + { + throw new PlatformNotSupportedException (); + } + + public string GetImpersonationUserName () + { + throw new PlatformNotSupportedException (); + } + } +} diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.Unix.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.Unix.cs new file mode 100644 index 0000000000..2fcab9e054 --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.Unix.cs @@ -0,0 +1,27 @@ +using System.Runtime.InteropServices; +using System.Security.Permissions; + + +namespace System.IO.Pipes +{ + public sealed partial class NamedPipeServerStream + { + public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity) + : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, HandleInheritability.None, 0) + { + } + + public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability) + : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, inheritability, 0) + { + } + + public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights) + : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, inheritability) + { + if (additionalAccessRights != 0 || pipeSecurity != null) { + throw new PlatformNotSupportedException (); + } + } + } +} diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.Windows.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.Windows.cs new file mode 100644 index 0000000000..270f16a58f --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.Windows.cs @@ -0,0 +1,50 @@ +using Microsoft.Win32.SafeHandles; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Security.AccessControl; +using System.Security.Permissions; +using System.Security.Principal; + +namespace System.IO.Pipes +{ + public sealed partial class NamedPipeServerStream + { + public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity) + : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, HandleInheritability.None) + { + } + + public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability) + : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, inheritability) + { + } + + public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights) + : base (direction, transmissionMode, outBufferSize) + { + if (pipeName == null) { + throw new ArgumentNullException (nameof(pipeName)); + } + if (pipeName.Length == 0){ + throw new ArgumentException (SR.Argument_NeedNonemptyPipeName); + } + if ((options & ~(PipeOptions.WriteThrough | PipeOptions.Asynchronous)) != 0) { + throw new ArgumentOutOfRangeException (nameof(options), SR.ArgumentOutOfRange_OptionsInvalid); + } + if (inBufferSize < 0) { + throw new ArgumentOutOfRangeException (nameof(inBufferSize), SR.ArgumentOutOfRange_NeedNonNegNum); + } + if ((maxNumberOfServerInstances < 1 || maxNumberOfServerInstances > 254) && (maxNumberOfServerInstances != MaxAllowedServerInstances)) { + throw new ArgumentOutOfRangeException (nameof(maxNumberOfServerInstances), SR.ArgumentOutOfRange_MaxNumServerInstances); + } + if (inheritability < HandleInheritability.None || inheritability > HandleInheritability.Inheritable) { + throw new ArgumentOutOfRangeException (nameof(inheritability), SR.ArgumentOutOfRange_HandleInheritabilityNoneOrInheritable); + } + if ((additionalAccessRights & ~(PipeAccessRights.ChangePermissions | PipeAccessRights.TakeOwnership | PipeAccessRights.AccessSystemSecurity)) != 0) { + throw new ArgumentOutOfRangeException (nameof(additionalAccessRights), SR.ArgumentOutOfRange_AdditionalAccessLimited); + } + + Create (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, inheritability, additionalAccessRights); + } + } +} diff --git a/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.cs b/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.cs deleted file mode 100644 index d4d02ade20..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/NamedPipeServerStream.cs +++ /dev/null @@ -1,195 +0,0 @@ -// -// NamedPipeServerStream.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if !BOOTSTRAP_BASIC - -using Microsoft.Win32.SafeHandles; -using System; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; - -namespace System.IO.Pipes -{ - [MonoTODO ("working only on win32 right now")] - [HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)] - public sealed class NamedPipeServerStream : PipeStream - { - public const int MaxAllowedServerInstances = -1; - - public NamedPipeServerStream (string pipeName) - : this (pipeName, PipeDirection.InOut) - { - } - - public NamedPipeServerStream (string pipeName, PipeDirection direction) - : this (pipeName, direction, 1) - { - } - - public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances) - : this (pipeName, direction, maxNumberOfServerInstances, PipeTransmissionMode.Byte) - { - } - - public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode) - : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, PipeOptions.None) - { - } - - public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options) - : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, DefaultBufferSize, DefaultBufferSize) - { - } - - public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize) -#if MOBILE - : base (direction, inBufferSize) - { - throw new NotImplementedException (); - } -#else - : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, null) - { - } -#endif - - public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity) - : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, HandleInheritability.None) - { - } - - public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability) - : this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, inheritability, PipeAccessRights.ReadData | PipeAccessRights.WriteData) - { - } - - [MonoTODO] - public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity, HandleInheritability inheritability, PipeAccessRights additionalAccessRights) - : base (direction, transmissionMode, outBufferSize) - { -#if MOBILE - throw new NotImplementedException (); -#else - var rights = ToAccessRights (direction) | additionalAccessRights; - // FIXME: reject some rights declarations (for ACL). - - if (IsWindows) - impl = new Win32NamedPipeServer (this, pipeName, maxNumberOfServerInstances, transmissionMode, - rights, options, inBufferSize, outBufferSize, - pipeSecurity, inheritability); - else - impl = new UnixNamedPipeServer (this, pipeName, maxNumberOfServerInstances, transmissionMode, - rights, options, inBufferSize, outBufferSize, inheritability); - - InitializeHandle (impl.Handle, false, (options & PipeOptions.Asynchronous) != PipeOptions.None); -#endif - } - - public NamedPipeServerStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle) - : base (direction, DefaultBufferSize) - { -#if MOBILE - throw new NotImplementedException (); -#else - if (IsWindows) - impl = new Win32NamedPipeServer (this, safePipeHandle); - else - impl = new UnixNamedPipeServer (this, safePipeHandle); - IsConnected = isConnected; - InitializeHandle (safePipeHandle, true, isAsync); -#endif - } - - ~NamedPipeServerStream () - { - // To be compatible with .net - } - - INamedPipeServer impl; - - public void Disconnect () - { - impl.Disconnect (); - } - - [MonoTODO] - [SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)] - public void RunAsClient (PipeStreamImpersonationWorker impersonationWorker) - { - throw new NotImplementedException (); - } - - public void WaitForConnection () - { - impl.WaitForConnection (); - IsConnected = true; - } - - public Task WaitForConnectionAsync () - { - return WaitForConnectionAsync (CancellationToken.None); - } - - [MonoTODO] - public Task WaitForConnectionAsync (CancellationToken cancellationToken) - { - throw new NotImplementedException (); - } - - [MonoTODO] - [SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)] - public string GetImpersonationUserName () - { - throw new NotImplementedException (); - } - - // async operations - - Action wait_connect_delegate; - - [HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)] - public IAsyncResult BeginWaitForConnection (AsyncCallback callback, object state) - { - if (wait_connect_delegate == null) - wait_connect_delegate = new Action (WaitForConnection); - return wait_connect_delegate.BeginInvoke (callback, state); - } - - public void EndWaitForConnection (IAsyncResult asyncResult) - { - wait_connect_delegate.EndInvoke (asyncResult); - } - } -} - -#endif diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeAccessRule.cs b/mcs/class/System.Core/System.IO.Pipes/PipeAccessRule.cs deleted file mode 100644 index b63105da29..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/PipeAccessRule.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// PipeAccessRule.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.IO; -using System.Linq; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; - -namespace System.IO.Pipes -{ - [HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)] - public sealed class PipeAccessRule : AccessRule - { - public PipeAccessRule (IdentityReference identity, PipeAccessRights rights, AccessControlType type) - : base (identity, (int)rights, false, InheritanceFlags.None, PropagationFlags.None, type) - { - } - - public PipeAccessRule (string identity, PipeAccessRights rights, AccessControlType type) - : this (new NTAccount (identity), rights, type) - { - } - - public PipeAccessRights PipeAccessRights { - get { return (PipeAccessRights)AccessMask; } - } - } -} - diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeDirection.cs b/mcs/class/System.Core/System.IO.Pipes/PipeDirection.cs deleted file mode 100644 index 1e5ab78649..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/PipeDirection.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace System.IO.Pipes -{ - [Serializable] - public enum PipeDirection - { - In = 1, - Out = 2, - InOut = 3 - } -} diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeInterfaces.cs b/mcs/class/System.Core/System.IO.Pipes/PipeInterfaces.cs deleted file mode 100644 index 9ab74045a7..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/PipeInterfaces.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.Win32.SafeHandles; - -namespace System.IO.Pipes -{ - // Common interfaces - - interface IPipe - { - SafePipeHandle Handle { get; } - void WaitForPipeDrain (); - } - - interface IAnonymousPipeClient : IPipe - { - } - - interface IAnonymousPipeServer : IPipe - { - SafePipeHandle ClientHandle { get; } - void DisposeLocalCopyOfClientHandle (); - } - - interface INamedPipeClient : IPipe - { - void Connect (); - void Connect (int timeout); - int NumberOfServerInstances { get; } - bool IsAsync { get; } - } - - interface INamedPipeServer : IPipe - { - void Disconnect (); - void WaitForConnection (); - } -} diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeSecurity.cs b/mcs/class/System.Core/System.IO.Pipes/PipeSecurity.cs deleted file mode 100644 index ab215da423..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/PipeSecurity.cs +++ /dev/null @@ -1,153 +0,0 @@ -// -// PipeSecurity.cs -// -// Author: -// Atsushi Enomoto -// James Bellinger -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// Copyright (C) 2012 James Bellinger -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; - -namespace System.IO.Pipes -{ - [HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)] - public class PipeSecurity : NativeObjectSecurity - { - public PipeSecurity () - : base (false, ResourceType.FileObject) - { - } - - internal PipeSecurity (SafeHandle handle, AccessControlSections includeSections) - : base (false, ResourceType.FileObject, handle, includeSections) - { - } - - public override Type AccessRightType { - get { return typeof (PipeAccessRights); } - } - - public override Type AccessRuleType { - get { return typeof (PipeAccessRule); } - } - - public override Type AuditRuleType { - get { return typeof (PipeAuditRule); } - } - - public override AccessRule AccessRuleFactory (IdentityReference identityReference, - int accessMask, bool isInherited, - InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, - AccessControlType type) - { - return new PipeAccessRule (identityReference, (PipeAccessRights)accessMask, type); - } - - public void AddAccessRule (PipeAccessRule rule) - { - AddAccessRule ((AccessRule)rule); - } - - public void AddAuditRule (PipeAuditRule rule) - { - AddAuditRule ((AuditRule) rule); - } - - public override sealed AuditRule AuditRuleFactory (IdentityReference identityReference, - int accessMask, bool isInherited, - InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, - AuditFlags flags) - { - return new PipeAuditRule (identityReference, (PipeAccessRights)accessMask, flags); - } - - [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)] - protected internal void Persist (SafeHandle handle) - { - WriteLock(); - try { - Persist (handle, AccessControlSectionsModified, null); - } finally { - WriteUnlock (); - } - } - - [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)] - protected internal void Persist (string name) - { - WriteLock(); - try { - Persist (name, AccessControlSectionsModified, null); - } finally { - WriteUnlock (); - } - } - - public bool RemoveAccessRule (PipeAccessRule rule) - { - return RemoveAccessRule ((AccessRule)rule); - } - - public void RemoveAccessRuleSpecific (PipeAccessRule rule) - { - RemoveAccessRuleSpecific ((AccessRule)rule); - } - - public bool RemoveAuditRule (PipeAuditRule rule) - { - return RemoveAuditRule ((AuditRule)rule); - } - - public void RemoveAuditRuleAll (PipeAuditRule rule) - { - RemoveAuditRuleAll ((AuditRule)rule); - } - - public void RemoveAuditRuleSpecific (PipeAuditRule rule) - { - RemoveAuditRuleSpecific ((AuditRule)rule); - } - - public void ResetAccessRule (PipeAccessRule rule) - { - ResetAccessRule ((AccessRule)rule); - } - - public void SetAccessRule (PipeAccessRule rule) - { - SetAccessRule ((AccessRule)rule); - } - - public void SetAuditRule (PipeAuditRule rule) - { - SetAuditRule ((AuditRule)rule); - } - } -} diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeStream.NotSupported.cs b/mcs/class/System.Core/System.IO.Pipes/PipeStream.NotSupported.cs new file mode 100644 index 0000000000..2621cd0986 --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/PipeStream.NotSupported.cs @@ -0,0 +1,90 @@ +using Microsoft.Win32.SafeHandles; +using System.Threading; +using System.Threading.Tasks; + +namespace System.IO.Pipes +{ + public abstract partial class PipeStream : Stream + { + internal const bool CheckOperationsRequiresSetHandle = false; + + // Blocks until the other end of the pipe has read in all written buffer. + public void WaitForPipeDrain() + { + throw new PlatformNotSupportedException(); + } + + // Gets the transmission mode for the pipe. This is virtual so that subclassing types can + // override this in cases where only one mode is legal (such as anonymous pipes) + public virtual PipeTransmissionMode TransmissionMode + { + get { throw new PlatformNotSupportedException(); } + } + + // Gets the buffer size in the inbound direction for the pipe. This checks if pipe has read + // access. If that passes, call to GetNamedPipeInfo will succeed. + public virtual int InBufferSize + { + get { throw new PlatformNotSupportedException(); } + } + + // Gets the buffer size in the outbound direction for the pipe. This uses cached version + // if it's an outbound only pipe because GetNamedPipeInfo requires read access to the pipe. + // However, returning cached is good fallback, especially if user specified a value in + // the ctor. + public virtual int OutBufferSize + { + get { throw new PlatformNotSupportedException(); } + } + + public virtual PipeTransmissionMode ReadMode + { + get { throw new PlatformNotSupportedException(); } + set { throw new PlatformNotSupportedException(); } + } + + /// Initializes the handle to be used asynchronously. + /// The handle. + private void InitializeAsyncHandle(SafePipeHandle handle) + { + throw new PlatformNotSupportedException(); + } + + internal virtual void DisposeCore(bool disposing) + { + throw new PlatformNotSupportedException(); + } + + private unsafe int ReadCore(Span buffer) + { + throw new PlatformNotSupportedException(); + } + + private unsafe void WriteCore(ReadOnlySpan buffer) + { + throw new PlatformNotSupportedException(); + } + + private Task ReadAsyncCore(Memory destination, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException(); + } + + private Task WriteAsyncCore(ReadOnlyMemory source, CancellationToken cancellationToken) + { + throw new PlatformNotSupportedException(); + } + + /// Throws an exception if the supplied handle does not represent a valid pipe. + /// The handle to validate. + internal void ValidateHandleIsPipe(SafePipeHandle safePipeHandle) + { + throw new PlatformNotSupportedException(); + } + + internal static string GetPipePath(string serverName, string pipeName) + { + throw new PlatformNotSupportedException(); + } + } +} \ No newline at end of file diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs b/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs index 738342c76e..df3bbe7bcb 100644 --- a/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs +++ b/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs @@ -1,346 +1,30 @@ -// -// PipeStream.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if !BOOTSTRAP_BASIC - -using Microsoft.Win32.SafeHandles; -using System; -using System.IO; -using System.Linq; using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; -using System.Runtime.InteropServices; namespace System.IO.Pipes { - [PermissionSet (SecurityAction.InheritanceDemand, Name = "FullTrust")] - [HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)] - public abstract class PipeStream : Stream + public partial class PipeStream { - // FIXME: not precise. - internal const int DefaultBufferSize = 0x400; - -#if !MOBILE - internal static bool IsWindows { - get { return Win32Marshal.IsWindows; } - } -#endif - - internal Exception ThrowACLException () - { - return new NotImplementedException ("ACL is not supported in Mono"); - } - - internal static PipeAccessRights ToAccessRights (PipeDirection direction) - { - switch (direction) { - case PipeDirection.In: - return PipeAccessRights.ReadData; - case PipeDirection.Out: - return PipeAccessRights.WriteData; - case PipeDirection.InOut: - return PipeAccessRights.ReadData | PipeAccessRights.WriteData; - default: - throw new ArgumentOutOfRangeException (); - } - } - - internal static PipeDirection ToDirection (PipeAccessRights rights) - { - bool r = (rights & PipeAccessRights.ReadData) != 0; - bool w = (rights & PipeAccessRights.WriteData) != 0; - if (r) { - if (w) - return PipeDirection.InOut; - else - return PipeDirection.In; - } else { - if (w) - return PipeDirection.Out; - else - throw new ArgumentOutOfRangeException (); - } - } - - protected PipeStream (PipeDirection direction, int bufferSize) - : this (direction, PipeTransmissionMode.Byte, bufferSize) - { - } - - protected PipeStream (PipeDirection direction, PipeTransmissionMode transmissionMode, int outBufferSize) - { - this.direction = direction; - this.transmission_mode = transmissionMode; - read_trans_mode = transmissionMode; - if (outBufferSize <= 0) - throw new ArgumentOutOfRangeException ("bufferSize must be greater than 0"); - buffer_size = outBufferSize; - } - - PipeDirection direction; - PipeTransmissionMode transmission_mode, read_trans_mode; - int buffer_size; - SafePipeHandle handle; - Stream stream; - - public override bool CanRead { - get { return (direction & PipeDirection.In) != 0; } - } - - public override bool CanSeek { - get { return false; } - } - - public override bool CanWrite { - get { return (direction & PipeDirection.Out) != 0; } - } - - public virtual int InBufferSize { - get { return buffer_size; } - } - - public bool IsAsync { get; private set; } - - public bool IsConnected { get; protected set; } - - internal Stream Stream { - get { - if (!IsConnected) - throw new InvalidOperationException ("Pipe is not connected"); - if (stream == null) { -#pragma warning disable 618 - stream = new FileStream (handle.DangerousGetHandle (), - CanRead ? (CanWrite ? FileAccess.ReadWrite : FileAccess.Read) - : FileAccess.Write, false, buffer_size, IsAsync); -#pragma warning restore 618 - } - return stream; - } - set { stream = value; } - } - - protected bool IsHandleExposed { get; private set; } - - [MonoTODO] - public bool IsMessageComplete { get; private set; } - - [MonoTODO] - public virtual int OutBufferSize { - get { return buffer_size; } - } - - public virtual PipeTransmissionMode ReadMode { - get { - CheckPipePropertyOperations (); - return read_trans_mode; - } - set { - CheckPipePropertyOperations (); - read_trans_mode = value; - } - } - - public SafePipeHandle SafePipeHandle { - get { - CheckPipePropertyOperations (); - return handle; - } - } - - public virtual PipeTransmissionMode TransmissionMode { - get { - CheckPipePropertyOperations (); - return transmission_mode; - } - } - - // initialize/dispose/state check - - [MonoTODO] - protected internal virtual void CheckPipePropertyOperations () - { - } - - [MonoTODO] - protected internal void CheckReadOperations () - { - if (!IsConnected) - throw new InvalidOperationException ("Pipe is not connected"); - if (!CanRead) - throw new NotSupportedException ("The pipe stream does not support read operations"); - } - - [MonoTODO] - protected internal void CheckWriteOperations () - { - if (!IsConnected) - throw new InvalidOperationException ("Pipe is not connected"); - if (!CanWrite) - throw new NotSupportedException ("The pipe stream does not support write operations"); - } - - protected void InitializeHandle (SafePipeHandle handle, bool isExposed, bool isAsync) - { - this.handle = handle; - this.IsHandleExposed = isExposed; - this.IsAsync = isAsync; - } - - protected override void Dispose (bool disposing) - { - if (handle != null && disposing) - handle.Dispose (); - } - - // not supported - - public override long Length { - get { throw new NotSupportedException (); } - } - - public override long Position { - get { return 0; } - set { throw new NotSupportedException (); } - } - - public override void SetLength (long value) - { - throw new NotSupportedException (); - } - - public override long Seek (long offset, SeekOrigin origin) - { - throw new NotSupportedException (); - } - public PipeSecurity GetAccessControl () { -#if MOBILE - throw new PlatformNotSupportedException (); -#else - return new PipeSecurity (SafePipeHandle, - AccessControlSections.Owner | - AccessControlSections.Group | - AccessControlSections.Access); -#endif + if (State == PipeState.Closed) { + throw Error.GetPipeNotOpen (); + } + + // PipeState must be Disconnected, Connected, or Broken + return new PipeSecurity (SafePipeHandle, AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group); } public void SetAccessControl (PipeSecurity pipeSecurity) { -#if MOBILE - throw new PlatformNotSupportedException (); -#else - if (pipeSecurity == null) - throw new ArgumentNullException ("pipeSecurity"); - + if (pipeSecurity == null) { + throw new ArgumentNullException (nameof(pipeSecurity)); + } + + // Checks that State != WaitingToConnect and State != Closed + CheckPipePropertyOperations (); + + // PipeState must be either Disconected or Connected pipeSecurity.Persist (SafePipeHandle); -#endif - } - - // pipe I/O - - public void WaitForPipeDrain () - { - } - - [MonoTODO] - public override int Read ([In] byte [] buffer, int offset, int count) - { - CheckReadOperations (); - - return Stream.Read (buffer, offset, count); - } - - [MonoTODO] - public override int ReadByte () - { - CheckReadOperations (); - - return Stream.ReadByte (); - } - - [MonoTODO] - public override void Write (byte [] buffer, int offset, int count) - { - CheckWriteOperations (); - - Stream.Write (buffer, offset, count); - } - - [MonoTODO] - public override void WriteByte (byte value) - { - CheckWriteOperations (); - - Stream.WriteByte (value); - } - - [MonoTODO] - public override void Flush () - { - CheckWriteOperations (); - - Stream.Flush (); - } - - // async - - Func read_delegate; - - [HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)] - public override IAsyncResult BeginRead (byte [] buffer, int offset, int count, AsyncCallback callback, object state) - { - if (read_delegate == null) - read_delegate = new Func (Read); - return read_delegate.BeginInvoke (buffer, offset, count, callback, state); - } - - Action write_delegate; - - [HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)] - public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, object state) - { - if (write_delegate == null) - write_delegate = new Action (Write); - return write_delegate.BeginInvoke (buffer, offset, count, callback, state); - } - - public override int EndRead (IAsyncResult asyncResult) - { - return read_delegate.EndInvoke (asyncResult); - } - - public override void EndWrite (IAsyncResult asyncResult) - { - write_delegate.EndInvoke (asyncResult); } } } - -#endif diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeStreamImpersonationWorker.cs b/mcs/class/System.Core/System.IO.Pipes/PipeStreamImpersonationWorker.cs deleted file mode 100644 index c1b93c71d7..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/PipeStreamImpersonationWorker.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace System.IO.Pipes -{ - public delegate void PipeStreamImpersonationWorker (); -} diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeTransmissionMode.cs b/mcs/class/System.Core/System.IO.Pipes/PipeTransmissionMode.cs deleted file mode 100644 index 2e6c6e3548..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/PipeTransmissionMode.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace System.IO.Pipes -{ - [Serializable] - public enum PipeTransmissionMode - { - Byte, - Message - } -} diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeUnix.cs b/mcs/class/System.Core/System.IO.Pipes/PipeUnix.cs deleted file mode 100644 index a1c7e22d8c..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/PipeUnix.cs +++ /dev/null @@ -1,299 +0,0 @@ -// -// PipeUnix.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if !BOOTSTRAP_BASIC - -using System; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Net; -using System.Runtime.InteropServices; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; -using System.Text; -using System.Threading; -using Microsoft.Win32; -using Microsoft.Win32.SafeHandles; -using Mono.Unix.Native; - -namespace System.IO.Pipes -{ - abstract class UnixAnonymousPipe : IPipe - { - protected UnixAnonymousPipe () - { - } - - public abstract SafePipeHandle Handle { get; } - - public void WaitForPipeDrain () - { - throw new NotImplementedException (); - } - } - - class UnixAnonymousPipeClient : UnixAnonymousPipe, IAnonymousPipeClient - { - // AnonymousPipeClientStream owner; - - public UnixAnonymousPipeClient (AnonymousPipeClientStream owner, SafePipeHandle handle) - { - // this.owner = owner; - - this.handle = handle; - } - - SafePipeHandle handle; - - public override SafePipeHandle Handle { - get { return handle; } - } - } - - class UnixAnonymousPipeServer : UnixAnonymousPipe, IAnonymousPipeServer - { - // AnonymousPipeServerStream owner; - - public UnixAnonymousPipeServer (AnonymousPipeServerStream owner, PipeDirection direction, HandleInheritability inheritability, int bufferSize) - { - // this.owner = owner; - - throw new NotImplementedException (); - } - - public UnixAnonymousPipeServer (AnonymousPipeServerStream owner, SafePipeHandle serverHandle, SafePipeHandle clientHandle) - { - // this.owner = owner; - - this.server_handle = serverHandle; - this.client_handle = clientHandle; - - throw new NotImplementedException (); - } - - SafePipeHandle server_handle, client_handle; - - public override SafePipeHandle Handle { - get { return server_handle; } - } - - public SafePipeHandle ClientHandle { - get { return client_handle; } - } - - public void DisposeLocalCopyOfClientHandle () - { - throw new NotImplementedException (); - } - } - - abstract class UnixNamedPipe : IPipe - { - public abstract SafePipeHandle Handle { get; } - - public void WaitForPipeDrain () - { - throw new NotImplementedException (); - } - - public void EnsureTargetFile (string name) - { - if (!File.Exists (name)) { - var error = Syscall.mknod (name, FilePermissions.S_IFIFO | FilePermissions.ALLPERMS, 0); - if (error != 0) - throw new IOException (String.Format ("Error on creating named pipe: error code {0}", error)); - } - } - - protected void ValidateOptions (PipeOptions options, PipeTransmissionMode mode) - { - if ((options & PipeOptions.WriteThrough) != 0) - throw new NotImplementedException ("WriteThrough is not supported"); - - if ((mode & PipeTransmissionMode.Message) != 0) - throw new NotImplementedException ("Message transmission mode is not supported"); - if ((options & PipeOptions.Asynchronous) != 0) // FIXME: use O_NONBLOCK? - throw new NotImplementedException ("Asynchronous pipe mode is not supported"); - } - - protected string RightsToAccess (PipeAccessRights rights) - { - string access = null; - if ((rights & PipeAccessRights.ReadData) != 0) { - if ((rights & PipeAccessRights.WriteData) != 0) - access = "r+"; - else - access = "r"; - } - else if ((rights & PipeAccessRights.WriteData) != 0) - access = "w"; - else - throw new InvalidOperationException ("The pipe must be opened to either read or write"); - - return access; - } - - protected FileAccess RightsToFileAccess (PipeAccessRights rights) - { - if ((rights & PipeAccessRights.ReadData) != 0) { - if ((rights & PipeAccessRights.WriteData) != 0) - return FileAccess.ReadWrite; - else - return FileAccess.Read; - } - else if ((rights & PipeAccessRights.WriteData) != 0) - return FileAccess.Write; - else - throw new InvalidOperationException ("The pipe must be opened to either read or write"); - } - } - - class UnixNamedPipeClient : UnixNamedPipe, INamedPipeClient - { - // .ctor with existing handle - public UnixNamedPipeClient (NamedPipeClientStream owner, SafePipeHandle safePipeHandle) - { - this.owner = owner; - this.handle = safePipeHandle; - // FIXME: dunno how is_async could be filled. - } - - // .ctor without handle - create new - public UnixNamedPipeClient (NamedPipeClientStream owner, string serverName, string pipeName, - PipeAccessRights desiredAccessRights, PipeOptions options, HandleInheritability inheritability) - { - this.owner = owner; - - if (serverName != "." && !Dns.GetHostEntry (serverName).AddressList.Contains (IPAddress.Loopback)) - throw new NotImplementedException ("Unix fifo does not support remote server connection"); - var name = Path.Combine ("/var/tmp/", pipeName); - EnsureTargetFile (name); - - RightsToAccess (desiredAccessRights); - - ValidateOptions (options, owner.TransmissionMode); - - // FIXME: handle inheritability - - opener = delegate { - var fs = new FileStream (name, FileMode.Open, RightsToFileAccess (desiredAccessRights), FileShare.ReadWrite); - owner.Stream = fs; - handle = new SafePipeHandle (fs.SafeFileHandle.DangerousGetHandle (), false); - }; - } - - NamedPipeClientStream owner; - SafePipeHandle handle; - Action opener; - - public override SafePipeHandle Handle { - get { return handle; } - } - - public void Connect () - { - if (owner.IsConnected) - throw new InvalidOperationException ("The named pipe is already connected"); - - opener (); - } - - public void Connect (int timeout) - { - AutoResetEvent waitHandle = new AutoResetEvent (false); - opener.BeginInvoke (delegate (IAsyncResult result) { - opener.EndInvoke (result); - waitHandle.Set (); - }, null); - if (!waitHandle.WaitOne (TimeSpan.FromMilliseconds (timeout))) - throw new TimeoutException (); - } - - public bool IsAsync { - get { return false; } - } - - public int NumberOfServerInstances { - get { throw new NotImplementedException (); } - } - } - - class UnixNamedPipeServer : UnixNamedPipe, INamedPipeServer - { - //NamedPipeServerStream owner; - - // .ctor with existing handle - public UnixNamedPipeServer (NamedPipeServerStream owner, SafePipeHandle safePipeHandle) - { - this.handle = safePipeHandle; - //this.owner = owner; - } - - // .ctor without handle - create new - public UnixNamedPipeServer (NamedPipeServerStream owner, string pipeName, int maxNumberOfServerInstances, - PipeTransmissionMode transmissionMode, PipeAccessRights rights, PipeOptions options, - int inBufferSize, int outBufferSize, HandleInheritability inheritability) - { - string name = Path.Combine ("/var/tmp/", pipeName); - EnsureTargetFile (name); - - RightsToAccess (rights); - - ValidateOptions (options, owner.TransmissionMode); - - // FIXME: maxNumberOfServerInstances, modes, sizes, handle inheritability - - var fs = new FileStream (name, FileMode.Open, RightsToFileAccess (rights), FileShare.ReadWrite); - handle = new SafePipeHandle (fs.SafeFileHandle.DangerousGetHandle (), false); - owner.Stream = fs; - should_close_handle = true; - } - - SafePipeHandle handle; - bool should_close_handle; - - public override SafePipeHandle Handle { - get { return handle; } - } - - public void Disconnect () - { - if (should_close_handle) - Syscall.fclose (handle.DangerousGetHandle ()); - } - - public void WaitForConnection () - { - // FIXME: what can I do here? - } - } -} - -#endif diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeWin32.cs b/mcs/class/System.Core/System.IO.Pipes/PipeWin32.cs deleted file mode 100644 index 4dc809f000..0000000000 --- a/mcs/class/System.Core/System.IO.Pipes/PipeWin32.cs +++ /dev/null @@ -1,386 +0,0 @@ -// -// PipeWin32.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2009 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if !BOOTSTRAP_BASIC - -using System; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; -using System.Text; -using Microsoft.Win32; -using Microsoft.Win32.SafeHandles; - -namespace System.IO.Pipes -{ - static class Win32PipeError - { - public static Exception GetException () - { - return GetException (Marshal.GetLastWin32Error ()); - } - - public static Exception GetException (int errorCode) - { - switch (errorCode) { - case 5: return new UnauthorizedAccessException (); - default: return new Win32Exception (errorCode); - } - } - } - - abstract class Win32AnonymousPipe : IPipe - { - protected Win32AnonymousPipe () - { - } - - public abstract SafePipeHandle Handle { get; } - - public void WaitForPipeDrain () - { - throw new NotImplementedException (); - } - } - - class Win32AnonymousPipeClient : Win32AnonymousPipe, IAnonymousPipeClient - { - // AnonymousPipeClientStream owner; - - public Win32AnonymousPipeClient (AnonymousPipeClientStream owner, SafePipeHandle handle) - { - // this.owner = owner; - - this.handle = handle; - } - - SafePipeHandle handle; - - public override SafePipeHandle Handle { - get { return handle; } - } - } - - class Win32AnonymousPipeServer : Win32AnonymousPipe, IAnonymousPipeServer - { - // AnonymousPipeServerStream owner; - - public unsafe Win32AnonymousPipeServer (AnonymousPipeServerStream owner, PipeDirection direction, - HandleInheritability inheritability, int bufferSize, - PipeSecurity pipeSecurity) - { - IntPtr r, w; - - byte[] securityDescriptor = null; - if (pipeSecurity != null) - securityDescriptor = pipeSecurity.GetSecurityDescriptorBinaryForm (); - - fixed (byte* securityDescriptorPtr = securityDescriptor) { - SecurityAttributes att = new SecurityAttributes (inheritability, (IntPtr)securityDescriptorPtr); - if (!Win32Marshal.CreatePipe (out r, out w, ref att, bufferSize)) - throw Win32PipeError.GetException (); - } - - var rh = new SafePipeHandle (r, true); - var wh = new SafePipeHandle (w, true); - - if (direction == PipeDirection.Out) { - server_handle = wh; - client_handle = rh; - } else { - server_handle = rh; - client_handle = wh; - } - } - - public Win32AnonymousPipeServer (AnonymousPipeServerStream owner, SafePipeHandle serverHandle, SafePipeHandle clientHandle) - { - // this.owner = owner; - this.server_handle = serverHandle; - this.client_handle = clientHandle; - } - - SafePipeHandle server_handle, client_handle; - - public override SafePipeHandle Handle { - get { return server_handle; } - } - - public SafePipeHandle ClientHandle { - get { return client_handle; } - } - - public void DisposeLocalCopyOfClientHandle () - { - throw new NotImplementedException (); - } - } - - abstract class Win32NamedPipe : IPipe - { - string name_cache; - - public string Name { - get { - if (name_cache != null) - return name_cache; - - int s, c, m, t; - byte [] un = new byte [200]; - while (true) { - if (!Win32Marshal.GetNamedPipeHandleState (Handle, out s, out c, out m, out t, un, un.Length)) - throw Win32PipeError.GetException (); - - if (un [un.Length - 1] == 0) - break; - un = new byte [un.Length * 10]; - } - name_cache = Encoding.Default.GetString (un); - return name_cache; - } - } - - public abstract SafePipeHandle Handle { get; } - - public void WaitForPipeDrain () - { - throw new NotImplementedException (); - } - } - - class Win32NamedPipeClient : Win32NamedPipe, INamedPipeClient - { - NamedPipeClientStream owner; - - // .ctor with existing handle - public Win32NamedPipeClient (NamedPipeClientStream owner, SafePipeHandle safePipeHandle) - { - this.handle = safePipeHandle; - this.owner = owner; - - // FIXME: retrieve is_async from state? - } - - // .ctor without handle - create new - public Win32NamedPipeClient (NamedPipeClientStream owner, string serverName, string pipeName, - PipeAccessRights desiredAccessRights, PipeOptions options, - HandleInheritability inheritability) - { - name = String.Format ("\\\\{0}\\pipe\\{1}", serverName, pipeName); - var att = new SecurityAttributes (inheritability, IntPtr.Zero); - is_async = (options & PipeOptions.Asynchronous) != PipeOptions.None; - - opener = delegate { - var ret = Win32Marshal.CreateFile (name, desiredAccessRights, 0, ref att, 3, 0, IntPtr.Zero); - if (ret == new IntPtr (-1L)) - throw Win32PipeError.GetException (); - - return new SafePipeHandle (ret, true); - }; - this.owner = owner; - } - - Func opener; - bool is_async; - string name; - SafePipeHandle handle; - - public override SafePipeHandle Handle { - get { return handle; } - } - - public bool IsAsync { - get { return is_async; } - } - - public void Connect () - { - if (owner.IsConnected) - throw new InvalidOperationException ("The named pipe is already connected"); - - handle = opener (); - } - - public void Connect (int timeout) - { - if (owner.IsConnected) - throw new InvalidOperationException ("The named pipe is already connected"); - - if (!Win32Marshal.WaitNamedPipe (name, timeout)) - throw Win32PipeError.GetException (); - Connect (); - } - - public int NumberOfServerInstances { - get { - int s, c, m, t; - byte [] un = null; - if (!Win32Marshal.GetNamedPipeHandleState (Handle, out s, out c, out m, out t, un, 0)) - throw Win32PipeError.GetException (); - return c; - } - } - } - - class Win32NamedPipeServer : Win32NamedPipe, INamedPipeServer - { - //NamedPipeServerStream owner; - - // .ctor with existing handle - public Win32NamedPipeServer (NamedPipeServerStream owner, SafePipeHandle safePipeHandle) - { - handle = safePipeHandle; - //this.owner = owner; - } - - // .ctor without handle - create new - public unsafe Win32NamedPipeServer (NamedPipeServerStream owner, string pipeName, int maxNumberOfServerInstances, - PipeTransmissionMode transmissionMode, PipeAccessRights rights, - PipeOptions options, int inBufferSize, int outBufferSize, - PipeSecurity pipeSecurity, HandleInheritability inheritability) - { - string name = String.Format ("\\\\.\\pipe\\{0}", pipeName); - - uint openMode; - openMode = (uint)rights | (uint)options; // Enum values match Win32 flags exactly. - - int pipeMode = 0; - if ((owner.TransmissionMode & PipeTransmissionMode.Message) != 0) - pipeMode |= 4; - //if ((readTransmissionMode & PipeTransmissionMode.Message) != 0) - // pipeMode |= 2; - if ((options & PipeOptions.Asynchronous) != 0) - pipeMode |= 1; - - byte[] securityDescriptor = null; - if (pipeSecurity != null) - securityDescriptor = pipeSecurity.GetSecurityDescriptorBinaryForm (); - - fixed (byte* securityDescriptorPtr = securityDescriptor) { - // FIXME: is nDefaultTimeout = 0 ok? - var att = new SecurityAttributes (inheritability, (IntPtr)securityDescriptorPtr); - var ret = Win32Marshal.CreateNamedPipe (name, openMode, pipeMode, maxNumberOfServerInstances, - outBufferSize, inBufferSize, 0, ref att, IntPtr.Zero); - if (ret == new IntPtr (-1L)) - throw Win32PipeError.GetException (); - handle = new SafePipeHandle (ret, true); - } - } - - SafePipeHandle handle; - - public override SafePipeHandle Handle { - get { return handle; } - } - - public void Disconnect () - { - Win32Marshal.DisconnectNamedPipe (Handle); - } - - public void WaitForConnection () - { - if (!Win32Marshal.ConnectNamedPipe (Handle, IntPtr.Zero)) - throw Win32PipeError.GetException (); - } - } - - [StructLayout (LayoutKind.Sequential)] - struct SecurityAttributes - { - public readonly int Length; - public readonly IntPtr SecurityDescriptor; - public readonly bool Inheritable; - - public SecurityAttributes (HandleInheritability inheritability, IntPtr securityDescriptor) - { - Length = Marshal.SizeOf (typeof (SecurityAttributes)); - SecurityDescriptor = securityDescriptor; - Inheritable = inheritability == HandleInheritability.Inheritable; - } - } - - static class Win32Marshal - { - internal static bool IsWindows { - get { - switch (Environment.OSVersion.Platform) { - case PlatformID.Win32S: - case PlatformID.Win32Windows: - case PlatformID.Win32NT: - case PlatformID.WinCE: - return true; - default: - return false; - } - } - } - - // http://msdn.microsoft.com/en-us/library/aa365152%28VS.85%29.aspx - [DllImport ("kernel32", SetLastError=true)] - internal static extern bool CreatePipe (out IntPtr readHandle, out IntPtr writeHandle, - ref SecurityAttributes pipeAtts, int size); - - // http://msdn.microsoft.com/en-us/library/aa365150%28VS.85%29.aspx - [DllImport ("kernel32", SetLastError=true)] - internal static extern IntPtr CreateNamedPipe (string name, uint openMode, int pipeMode, int maxInstances, - int outBufferSize, int inBufferSize, int defaultTimeout, - ref SecurityAttributes securityAttributes, IntPtr atts); - - // http://msdn.microsoft.com/en-us/library/aa365146%28VS.85%29.aspx - [DllImport ("kernel32", SetLastError=true)] - internal static extern bool ConnectNamedPipe (SafePipeHandle handle, IntPtr overlapped); - - // http://msdn.microsoft.com/en-us/library/aa365166%28VS.85%29.aspx - [DllImport ("kernel32", SetLastError=true)] - internal static extern bool DisconnectNamedPipe (SafePipeHandle handle); - - // http://msdn.microsoft.com/en-us/library/aa365443%28VS.85%29.aspx - [DllImport ("kernel32", SetLastError=true)] - internal static extern bool GetNamedPipeHandleState (SafePipeHandle handle, - out int state, out int curInstances, - out int maxCollectionCount, out int collectDateTimeout, - byte [] userName, int maxUserNameSize); - - // http://msdn.microsoft.com/en-us/library/aa365800%28VS.85%29.aspx - [DllImport ("kernel32", SetLastError=true)] - internal static extern bool WaitNamedPipe (string name, int timeout); - - // http://msdn.microsoft.com/en-us/library/aa363858%28VS.85%29.aspx - [DllImport ("kernel32", SetLastError=true)] - internal static extern IntPtr CreateFile (string name, PipeAccessRights desiredAccess, FileShare fileShare, - ref SecurityAttributes atts, int creationDisposition, int flags, IntPtr templateHandle); - - } -} - -#endif diff --git a/mcs/class/System.Core/System.IO.Pipes/SafePipeHandle.NotSupported.cs b/mcs/class/System.Core/System.IO.Pipes/SafePipeHandle.NotSupported.cs new file mode 100644 index 0000000000..ad26f57fe4 --- /dev/null +++ b/mcs/class/System.Core/System.IO.Pipes/SafePipeHandle.NotSupported.cs @@ -0,0 +1,16 @@ +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace Microsoft.Win32.SafeHandles +{ + public sealed partial class SafePipeHandle : SafeHandleZeroOrMinusOneIsInvalid + { + private const int DefaultInvalidHandle = -1; + + protected override bool ReleaseHandle() + { + throw new PlatformNotSupportedException(); + } + } +} diff --git a/mcs/class/System.Core/System.Security.Cryptography.X509Certificates/DSACertificateExtensions.cs b/mcs/class/System.Core/System.Security.Cryptography.X509Certificates/DSACertificateExtensions.cs new file mode 100644 index 0000000000..004eabe6ed --- /dev/null +++ b/mcs/class/System.Core/System.Security.Cryptography.X509Certificates/DSACertificateExtensions.cs @@ -0,0 +1,64 @@ +// +// DSACertificateExtensions.cs +// +// Authors: +// Filip Navara +// +// Copyright (C) 2018 .NET Foundation and Contributors +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace System.Security.Cryptography.X509Certificates +{ + public static class DSACertificateExtensions + { + /// + /// Gets the public key from the certificate or null if the certificate does not have a DSA public key. + /// + public static DSA GetDSAPublicKey(this X509Certificate2 certificate) + { + if (certificate == null) + throw new ArgumentNullException("certificate"); + return certificate.PrivateKey as DSA; + } + + /// + /// Gets the private key from the certificate or null if the certificate does not have a DSA private key. + /// + public static DSA GetDSAPrivateKey(this X509Certificate2 certificate) + { + if (certificate == null) + throw new ArgumentNullException("certificate"); + return certificate.PublicKey.Key as DSA; + } + + [MonoTODO] + public static X509Certificate2 CopyWithPrivateKey(this X509Certificate2 certificate, DSA privateKey) + { + if (certificate == null) + throw new ArgumentNullException(nameof(certificate)); + if (privateKey == null) + throw new ArgumentNullException(nameof(privateKey)); + + throw new NotImplementedException (); + } + } +} diff --git a/mcs/class/System.Core/System.Security.Cryptography/ECCurve.cs b/mcs/class/System.Core/System.Security.Cryptography/ECCurve.cs deleted file mode 100644 index b7b97e8fe8..0000000000 --- a/mcs/class/System.Core/System.Security.Cryptography/ECCurve.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// ECCurve.cs -// -// Authors: -// Marek Safar -// -// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -namespace System.Security.Cryptography -{ - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public struct ECCurve - { - public byte[] A; - public byte[] B; - public byte[] Cofactor; - public ECCurveType CurveType; - public ECPoint G; - public HashAlgorithmName? Hash; - public byte[] Order; - public byte[] Polynomial; - public byte[] Prime; - public byte[] Seed; - public bool IsCharacteristic2 { get { throw new NotImplementedException (); } } - public bool IsExplicit { get { throw new NotImplementedException (); } } - public bool IsNamed { get { throw new NotImplementedException (); } } - public bool IsPrime { get { throw new NotImplementedException (); } } - public Oid Oid { get { throw new NotImplementedException (); } } - public static ECCurve CreateFromFriendlyName (string oidFriendlyName) { throw new NotImplementedException (); } - public static ECCurve CreateFromOid (Oid curveOid) { throw new NotImplementedException (); } - public static ECCurve CreateFromValue (string oidValue) { throw new NotImplementedException (); } - public void Validate () { throw new NotImplementedException (); } - - public enum ECCurveType - { - Implicit = 0, - PrimeShortWeierstrass = 1, - PrimeTwistedEdwards = 2, - PrimeMontgomery = 3, - Characteristic2 = 4, - Named = 5, - } - - public static class NamedCurves - { - public static ECCurve brainpoolP160r1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP160t1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP192r1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP192t1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP224r1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP224t1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP256r1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP256t1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP320r1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP320t1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP384r1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP384t1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP512r1 { get { throw new NotImplementedException (); } } - public static ECCurve brainpoolP512t1 { get { throw new NotImplementedException (); } } - public static ECCurve nistP256 { get { throw new NotImplementedException (); } } - public static ECCurve nistP384 { get { throw new NotImplementedException (); } } - public static ECCurve nistP521 { get { throw new NotImplementedException (); } } - } - } -} diff --git a/mcs/class/System.Core/System.Security.Cryptography/ECParameters.cs b/mcs/class/System.Core/System.Security.Cryptography/ECParameters.cs deleted file mode 100644 index 5230121be6..0000000000 --- a/mcs/class/System.Core/System.Security.Cryptography/ECParameters.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// ECPArameters.cs -// -// Authors: -// Marek Safar -// -// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -namespace System.Security.Cryptography -{ - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct ECParameters - { - public ECCurve Curve; - public byte[] D; - public ECPoint Q; - public void Validate () { throw new NotImplementedException (); } - } -} diff --git a/mcs/class/System.Core/basic_System.Core.dll.sources b/mcs/class/System.Core/basic_System.Core.dll.sources index e5681ff8ff..382ee59c9d 100644 --- a/mcs/class/System.Core/basic_System.Core.dll.sources +++ b/mcs/class/System.Core/basic_System.Core.dll.sources @@ -1 +1,2 @@ #include net_4_x_System.Core.dll.sources +#include pipes_pns.sources diff --git a/mcs/class/System.Core/build_System.Core.dll.sources b/mcs/class/System.Core/build_System.Core.dll.sources index e5681ff8ff..382ee59c9d 100644 --- a/mcs/class/System.Core/build_System.Core.dll.sources +++ b/mcs/class/System.Core/build_System.Core.dll.sources @@ -1 +1,2 @@ #include net_4_x_System.Core.dll.sources +#include pipes_pns.sources diff --git a/mcs/class/System.Core/common_System.Core.dll.sources b/mcs/class/System.Core/common_System.Core.dll.sources index 6d2f6aaf34..c1b7dc1634 100644 --- a/mcs/class/System.Core/common_System.Core.dll.sources +++ b/mcs/class/System.Core/common_System.Core.dll.sources @@ -1,3 +1,4 @@ +../../build/common/Consts.cs ../../build/common/SR.cs ../../build/common/MonoTODOAttribute.cs @@ -10,29 +11,29 @@ Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs System.Security.Cryptography/AesCng.cs System.Security.Cryptography/TripleDESCng.cs System.Security.Cryptography.X509Certificates/ECDsaCertificateExtensions.cs +System.Security.Cryptography.X509Certificates/DSACertificateExtensions.cs System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs Microsoft.Win32.SafeHandles/SafeNCryptKeyHandle.cs Microsoft.Win32.SafeHandles/SafeNCryptProviderHandle.cs Microsoft.Win32.SafeHandles/SafeNCryptSecretHandle.cs -Microsoft.Win32.SafeHandles/SafePipeHandle.cs -System.IO.Pipes/AnonymousPipeClientStream.cs -System.IO.Pipes/AnonymousPipeServerStream.cs -System.IO.Pipes/NamedPipeClientStream.cs -System.IO.Pipes/NamedPipeServerStream.cs -System.IO.Pipes/PipeAccessRights.cs -System.IO.Pipes/PipeAccessRule.cs -System.IO.Pipes/PipeAuditRule.cs -System.IO.Pipes/PipeDirection.cs -System.IO.Pipes/PipeInterfaces.cs -System.IO.Pipes/PipeOptions.cs -System.IO.Pipes/PipeSecurity.cs System.IO.Pipes/PipeStream.cs -System.IO.Pipes/PipeStreamImpersonationWorker.cs -System.IO.Pipes/PipeTransmissionMode.cs - -ReferenceSources/SR.cs +../../../external/corefx/src/System.IO.Pipes/src/Microsoft/Win32/SafeHandles/SafePipeHandle.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Error.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeClientStream.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeServerStream.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeDirection.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeOptions.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeTransmissionMode.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeState.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeAccessRights.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeAccessRule.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeAuditRule.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeSecurity.cs corefx/LambdaExpression.cs corefx/SR.cs @@ -81,9 +82,11 @@ corefx/SR.missing.cs System.Runtime.InteropServices/ComAwareEventInfo.cs -System.Security.Cryptography/ECCurve.cs -System.Security.Cryptography/ECPoint.cs -System.Security.Cryptography/ECParameters.cs +../../../external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.cs +../../../external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.ECCurveType.cs +../../../external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECCurve.NamedCurves.cs +../../../external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECPoint.cs +../../../external/corefx/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECParameters.cs System.Security.Cryptography/SHA256CryptoServiceProvider.cs System.Security.Cryptography/SHA384CryptoServiceProvider.cs System.Security.Cryptography/SHA512CryptoServiceProvider.cs diff --git a/mcs/class/System.Core/corefx/SR.cs b/mcs/class/System.Core/corefx/SR.cs index 7554ca1a25..ad0b70db48 100644 --- a/mcs/class/System.Core/corefx/SR.cs +++ b/mcs/class/System.Core/corefx/SR.cs @@ -205,4 +205,290 @@ partial class SR public const string NoMethodOnType = "There is no method '{0}' on type '{1}'"; public const string NoMethodOnTypeMatchingArguments = "There is no method '{0}' on type '{1}' that matches the specified arguments"; public const string EnumeratingNullEnumerableExpression = "Cannot enumerate a query created from a null IEnumerable<>"; + public const string ArgumentOutOfRange_NeedNonNegNum = "Non negative number is required."; + public const string ArgumentOutOfRange_NeedValidPipeAccessRights = "Invalid PipeAccessRights value."; + public const string Argument_InvalidOffLen = "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."; + public const string Argument_NeedNonemptyPipeName = "pipeName cannot be an empty string."; + public const string Argument_NonContainerInvalidAnyFlag = "This flag may not be set on a pipe."; + public const string Argument_EmptyServerName = "serverName cannot be an empty string. Use \\\\\\\".\\\\\\\" for current machine."; + public const string Argument_InvalidHandle = "Invalid handle."; + public const string ArgumentNull_Buffer = "Buffer cannot be null."; + public const string ArgumentNull_ServerName = "serverName cannot be null. Use \\\".\\\" for current machine."; + public const string ArgumentOutOfRange_AnonymousReserved = "The pipeName \\\"anonymous\\\" is reserved."; + public const string ArgumentOutOfRange_TransmissionModeByteOrMsg = "For named pipes, transmission mode can be TransmissionMode.Byte or PipeTransmissionMode.Message. For anonymous pipes, transmission mode can be TransmissionMode.Byte."; + public const string ArgumentOutOfRange_DirectionModeInOutOrInOut = "For named pipes, the pipe direction can be PipeDirection.In, PipeDirection.Out or PipeDirection.InOut. For anonymous pipes, the pipe direction can be PipeDirection.In or PipeDirection.Out."; + public const string ArgumentOutOfRange_ImpersonationInvalid = "TokenImpersonationLevel.None, TokenImpersonationLevel.Anonymous, TokenImpersonationLevel.Identification, TokenImpersonationLevel.Impersonation or TokenImpersonationLevel.Delegation required."; + public const string ArgumentOutOfRange_OptionsInvalid = "options contains an invalid flag."; + public const string ArgumentOutOfRange_HandleInheritabilityNoneOrInheritable = "HandleInheritability.None or HandleInheritability.Inheritable required."; + public const string ArgumentOutOfRange_InvalidTimeout = "Timeout must be non-negative or equal to -1 (Timeout.Infinite)"; + public const string ArgumentOutOfRange_MaxNumServerInstances = "maxNumberOfServerInstances must either be a value between 1 and 254, or NamedPipeServerStream.MaxAllowedServerInstances (to obtain the maximum number allowed by system resources)."; + public const string ArgumentOutOfRange_NeedPosNum = "Positive number required."; + public const string InvalidOperation_PipeNotYetConnected = "Pipe hasn't been connected yet."; + public const string InvalidOperation_PipeDisconnected = "Pipe is in a disconnected state."; + public const string InvalidOperation_PipeHandleNotSet = "Pipe handle has not been set. Did your PipeStream implementation call InitializeHandle?"; + public const string InvalidOperation_PipeNotAsync = "Pipe is not opened in asynchronous mode."; + public const string InvalidOperation_PipeReadModeNotMessage = "ReadMode is not of PipeTransmissionMode.Message."; + public const string InvalidOperation_PipeAlreadyConnected = "Already in a connected state."; + public const string InvalidOperation_PipeAlreadyDisconnected = "Already in a disconnected state."; + public const string IO_EOF_ReadBeyondEOF = "Unable to read beyond the end of the stream."; + public const string IO_FileNotFound = "Unable to find the specified file."; + public const string IO_FileNotFound_FileName = "Could not find file '{0}'."; + public const string IO_AlreadyExists_Name = "Cannot create \\\"{0}\\\" because a file or directory with the same name already exists."; + public const string IO_FileExists_Name = "The file '{0}' already exists."; + public const string IO_IO_PipeBroken = "Pipe is broken."; + public const string IO_OperationAborted = "IO operation was aborted unexpectedly."; + public const string IO_SharingViolation_File = "The process cannot access the file '{0}' because it is being used by another process."; + public const string IO_SharingViolation_NoFileName = "The process cannot access the file because it is being used by another process."; + public const string IO_PipeBroken = "Pipe is broken."; + public const string IO_InvalidPipeHandle = "Invalid pipe handle."; + public const string IO_PathNotFound_Path = "Could not find a part of the path '{0}'."; + public const string IO_PathNotFound_NoPathName = "Could not find a part of the path."; + public const string IO_PathTooLong = "The specified file name or path is too long, or a component of the specified path is too long."; + public const string NotSupported_UnreadableStream = "Stream does not support reading."; + public const string NotSupported_UnseekableStream = "Stream does not support seeking."; + public const string NotSupported_UnwritableStream = "Stream does not support writing."; + public const string NotSupported_AnonymousPipeUnidirectional = "Anonymous pipes can only be in one direction."; + public const string NotSupported_AnonymousPipeMessagesNotSupported = "Anonymous pipes do not support PipeTransmissionMode.Message ReadMode."; + public const string ObjectDisposed_PipeClosed = "Cannot access a closed pipe."; + public const string UnauthorizedAccess_IODenied_Path = "Access to the path '{0}' is denied."; + public const string UnauthorizedAccess_IODenied_NoPathName = "Access to the path is denied."; + public const string ArgumentOutOfRange_FileLengthTooBig = "Specified file length was too large for the file system."; + public const string PlatformNotSupported_MessageTransmissionMode = "Message transmission mode is not supported on this platform."; + public const string PlatformNotSupported_RemotePipes = "Access to remote named pipes is not supported on this platform."; + public const string PlatformNotSupported_InvalidPipeNameChars = "The name of a pipe on this platform must be a valid file name or a valid absolute path to a file name."; + public const string ObjectDisposed_StreamClosed = "Cannot access a closed Stream."; + public const string PlatformNotSupported_OperatingSystemError = "The operating system returned error '{0}' indicating that the operation is not supported."; + public const string IO_AllPipeInstancesAreBusy = "All pipe instances are busy."; + public const string IO_PathTooLong_Path = "The path '{0}' is too long, or a component of the specified path is too long."; + public const string UnauthorizedAccess_NotOwnedByCurrentUser = "Could not connect to the pipe because it was not owned by the current user."; + public const string UnauthorizedAccess_ClientIsNotCurrentUser = "Client connection (user id {0}) was refused because it was not owned by the current user (id {1})."; + public const string net_invalidversion = "This protocol version is not supported."; + public const string net_noseek = "This stream does not support seek operations."; + public const string net_invasync = "Cannot block a call on this socket while an earlier asynchronous call is in progress."; + public const string net_io_timeout_use_gt_zero = "Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value > 0."; + public const string net_notconnected = "The operation is not allowed on non-connected sockets."; + public const string net_notstream = "The operation is not allowed on non-stream oriented sockets."; + public const string net_stopped = "Not listening. You must call the Start() method before calling this method."; + public const string net_udpconnected = "Cannot send packets to an arbitrary host while connected."; + public const string net_readonlystream = "The stream does not support writing."; + public const string net_writeonlystream = "The stream does not support reading."; + public const string net_InvalidAddressFamily = "The AddressFamily {0} is not valid for the {1} end point, use {2} instead."; + public const string net_InvalidEndPointAddressFamily = "The supplied EndPoint of AddressFamily {0} is not valid for this Socket, use {1} instead."; + public const string net_InvalidSocketAddressSize = "The supplied {0} is an invalid size for the {1} end point."; + public const string net_invalidAddressList = "None of the discovered or specified addresses match the socket address family."; + public const string net_completed_result = "This operation cannot be performed on a completed asynchronous result object."; + public const string net_protocol_invalid_family = "'{0}' Client can only accept InterNetwork or InterNetworkV6 addresses."; + public const string net_protocol_invalid_multicast_family = "Multicast family is not the same as the family of the '{0}' Client."; + public const string net_sockets_zerolist = "The parameter {0} must contain one or more elements."; + public const string net_sockets_blocking = "The operation is not allowed on a non-blocking Socket."; + public const string net_sockets_useblocking = "Use the Blocking property to change the status of the Socket."; + public const string net_sockets_select = "The operation is not allowed on objects of type {0}. Use only objects of type {1}."; + public const string net_sockets_toolarge_select = "The {0} list contains too many items; a maximum of {1} is allowed."; + public const string net_sockets_empty_select = "All lists are either null or empty."; + public const string net_sockets_mustbind = "You must call the Bind method before performing this operation."; + public const string net_sockets_mustlisten = "You must call the Listen method before performing this operation."; + public const string net_sockets_mustnotlisten = "You may not perform this operation after calling the Listen method."; + public const string net_sockets_mustnotbebound = "The socket must not be bound or connected."; + public const string net_sockets_namedmustnotbebound = "{0}: The socket must not be bound or connected."; + public const string net_sockets_invalid_ipaddress_length = "The number of specified IP addresses has to be greater than 0."; + public const string net_sockets_invalid_optionValue = "The specified value is not a valid '{0}'."; + public const string net_sockets_invalid_optionValue_all = "The specified value is not valid."; + public const string net_sockets_invalid_dnsendpoint = "The parameter {0} must not be of type DnsEndPoint."; + public const string net_sockets_disconnectedConnect = "Once the socket has been disconnected, you can only reconnect again asynchronously, and only to a different EndPoint. BeginConnect must be called on a thread that won't exit until the operation has been completed."; + public const string net_sockets_disconnectedAccept = "Once the socket has been disconnected, you can only accept again asynchronously. BeginAccept must be called on a thread that won't exit until the operation has been completed."; + public const string net_tcplistener_mustbestopped = "The TcpListener must not be listening before performing this operation."; + public const string net_socketopinprogress = "An asynchronous socket operation is already in progress using this SocketAsyncEventArgs instance."; + public const string net_buffercounttoosmall = "The Buffer space specified by the Count property is insufficient for the AcceptAsync method."; + public const string net_multibuffernotsupported = "Multiple buffers cannot be used with this method."; + public const string net_ambiguousbuffers = "Buffer and BufferList properties cannot both be non-null."; + public const string net_io_writefailure = "Unable to write data to the transport connection: {0}."; + public const string net_io_readfailure = "Unable to read data from the transport connection: {0}."; + public const string net_io_invalidasyncresult = "The IAsyncResult object was not returned from the corresponding asynchronous method on this class."; + public const string net_io_invalidendcall = "{0} can only be called once for each asynchronous operation."; + public const string net_value_cannot_be_negative = "The specified value cannot be negative."; + public const string ArgumentOutOfRange_Bounds_Lower_Upper = "Argument must be between {0} and {1}."; + public const string net_sockets_connect_multiconnect_notsupported = "Sockets on this platform are invalid for use after a failed connection attempt."; + public const string net_sockets_dualmode_receivefrom_notsupported = "This platform does not support packet information for dual-mode sockets. If packet information is not required, use Socket.Receive. If packet information is required set Socket.DualMode to false."; + public const string net_sockets_accept_receive_notsupported = "This platform does not support receiving data with Socket.AcceptAsync. Instead, make a separate call to Socket.ReceiveAsync."; + public const string net_sockets_duplicateandclose_notsupported = "This platform does not support Socket.DuplicateAndClose. Instead, create a new socket."; + public const string net_sockets_transmitfileoptions_notsupported = "This platform does not support TransmitFileOptions other than TransmitFileOptions.UseDefaultWorkerThread."; + public const string ArgumentOutOfRange_PathLengthInvalid = "The path '{0}' is of an invalid length for use with domain sockets on this platform. The length must be between 1 and {1} characters, inclusive."; + public const string net_io_readwritefailure = "Unable to transfer data on the transport connection: {0}."; + public const string PlatformNotSupported_AcceptSocket = "Accepting into an existing Socket is not supported on this platform."; + public const string PlatformNotSupported_IOControl = "Socket.IOControl handles Windows-specific control codes and is not supported on this platform."; + public const string PlatformNotSupported_IPProtectionLevel = "IP protection level cannot be controlled on this platform."; + public const string InvalidOperation_BufferNotExplicitArray = "This operation may only be performed when the buffer was set using the SetBuffer overload that accepts an array."; + public const string InvalidOperation_IncorrectToken = "The result of the operation was already consumed and may not be used again."; + public const string InvalidOperation_MultipleContinuations = "Another continuation was already registered."; + public const string Argument_InvalidOidValue = "The OID value was invalid."; + public const string Argument_InvalidValue = "Value was invalid."; + public const string Arg_CryptographyException = "Error occurred during a cryptographic operation."; + public const string Cryptography_ArgECDHKeySizeMismatch = "The keys from both parties must be the same size to generate a secret agreement."; + public const string Cryptography_ArgECDHRequiresECDHKey = "Keys used with the ECDiffieHellmanCng algorithm must have an algorithm group of ECDiffieHellman."; + public const string Cryptography_TlsRequiresLabelAndSeed = "The TLS key derivation function requires both the label and seed properties to be set."; + public const string Cryptography_TlsRequires64ByteSeed = "The TLS key derivation function requires a seed value of exactly 64 bytes."; + public const string Cryptography_BadHashSize_ForAlgorithm = "The provided value of {0} bytes does not match the expected size of {1} bytes for the algorithm ({2})."; + public const string Cryptography_Config_EncodedOIDError = "Encoded OID length is too large (greater than 0x7f bytes)."; + public const string Cryptography_CSP_NoPrivateKey = "Object contains only the public half of a key pair. A private key must also be provided."; + public const string Cryptography_Der_Invalid_Encoding = "ASN1 corrupted data."; + public const string Cryptography_DSA_KeyGenNotSupported = "DSA keys can be imported, but new key generation is not supported on this platform."; + public const string Cryptography_Encryption_MessageTooLong = "The message exceeds the maximum allowable length for the chosen options ({0})."; + public const string Cryptography_ECXmlSerializationFormatRequired = "XML serialization of an elliptic curve key requires using an overload which specifies the XML format to be used."; + public const string Cryptography_ECC_NamedCurvesOnly = "Only named curves are supported on this platform."; + public const string Cryptography_HashAlgorithmNameNullOrEmpty = "The hash algorithm name cannot be null or empty."; + public const string Cryptography_InvalidOID = "Object identifier (OID) is unknown."; + public const string Cryptography_CurveNotSupported = "The specified curve '{0}' or its parameters are not valid for this platform."; + public const string Cryptography_InvalidCurveOid = "The specified Oid is not valid. The Oid.FriendlyName or Oid.Value property must be set."; + public const string Cryptography_InvalidCurveKeyParameters = "The specified key parameters are not valid. Q.X and Q.Y are required fields. Q.X, Q.Y must be the same length. If D is specified it must be the same length as Q.X and Q.Y for named curves or the same length as Order for explicit curves."; + public const string Cryptography_InvalidDsaParameters_MissingFields = "The specified DSA parameters are not valid; P, Q, G and Y are all required."; + public const string Cryptography_InvalidDsaParameters_MismatchedPGY = "The specified DSA parameters are not valid; P, G and Y must be the same length (the key size)."; + public const string Cryptography_InvalidDsaParameters_MismatchedQX = "The specified DSA parameters are not valid; Q and X (if present) must be the same length."; + public const string Cryptography_InvalidDsaParameters_MismatchedPJ = "The specified DSA parameters are not valid; J (if present) must be shorter than P."; + public const string Cryptography_InvalidDsaParameters_SeedRestriction_ShortKey = "The specified DSA parameters are not valid; Seed, if present, must be 20 bytes long for keys shorter than 1024 bits."; + public const string Cryptography_InvalidDsaParameters_QRestriction_ShortKey = "The specified DSA parameters are not valid; Q must be 20 bytes long for keys shorter than 1024 bits."; + public const string Cryptography_InvalidDsaParameters_QRestriction_LargeKey = "The specified DSA parameters are not valid; Q's length must be one of 20, 32 or 64 bytes."; + public const string Cryptography_InvalidECCharacteristic2Curve = "The specified Characteristic2 curve parameters are not valid. Polynomial, A, B, G.X, G.Y, and Order are required. A, B, G.X, G.Y must be the same length, and the same length as Q.X, Q.Y and D if those are specified. Seed, Cofactor and Hash are optional. Other parameters are not allowed."; + public const string Cryptography_InvalidECPrimeCurve = "The specified prime curve parameters are not valid. Prime, A, B, G.X, G.Y and Order are required and must be the same length, and the same length as Q.X, Q.Y and D if those are specified. Seed, Cofactor and Hash are optional. Other parameters are not allowed."; + public const string Cryptography_InvalidECNamedCurve = "The specified named curve parameters are not valid. Only the Oid parameter must be set."; + public const string Cryptography_InvalidKeySize = "Specified key is not a valid size for this algorithm."; + public const string Cryptography_InvalidKey_SemiWeak = "Specified key is a known semi-weak key for '{0}' and cannot be used."; + public const string Cryptography_InvalidKey_Weak = "Specified key is a known weak key for '{0}' and cannot be used."; + public const string Cryptography_InvalidIVSize = "Specified initialization vector (IV) does not match the block size for this algorithm."; + public const string Cryptography_InvalidOperation = "This operation is not supported for this class."; + public const string Cryptography_InvalidPadding = "Padding is invalid and cannot be removed."; + public const string Cryptography_InvalidRsaParameters = "The specified RSA parameters are not valid; both Exponent and Modulus are required fields."; + public const string Cryptography_InvalidPaddingMode = "Specified padding mode is not valid for this algorithm."; + public const string Cryptography_Invalid_IA5String = "The string contains a character not in the 7 bit ASCII character set."; + public const string Cryptography_KeyTooSmall = "The key is too small for the requested operation."; + public const string Cryptography_MissingIV = "The cipher mode specified requires that an initialization vector (IV) be used."; + public const string Cryptography_MissingKey = "No asymmetric key object has been associated with this formatter object."; + public const string Cryptography_MissingOID = "Required object identifier (OID) cannot be found."; + public const string Cryptography_MustTransformWholeBlock = "TransformBlock may only process bytes in block sized increments."; + public const string Cryptography_NotValidPrivateKey = "Key is not a valid private key."; + public const string Cryptography_NotValidPublicOrPrivateKey = "Key is not a valid public or private key."; + public const string Cryptography_OAEP_Decryption_Failed = "Error occurred while decoding OAEP padding."; + public const string Cryptography_OpenInvalidHandle = "Cannot open an invalid handle."; + public const string Cryptography_PartialBlock = "The input data is not a complete block."; + public const string Cryptography_PasswordDerivedBytes_FewBytesSalt = "Salt is not at least eight bytes."; + public const string Cryptography_RC2_EKS40 = "EffectiveKeySize value must be at least 40 bits."; + public const string Cryptography_RC2_EKSKS = "KeySize value must be at least as large as the EffectiveKeySize value."; + public const string Cryptography_RC2_EKSKS2 = "EffectiveKeySize must be the same as KeySize in this implementation."; + public const string Cryptography_Rijndael_BlockSize = "BlockSize must be 128 in this implementation."; + public const string Cryptography_RSA_DecryptWrongSize = "The length of the data to decrypt is not valid for the size of this key."; + public const string Cryptography_SignHash_WrongSize = "The provided hash value is not the expected size for the specified hash algorithm."; + public const string Cryptography_TransformBeyondEndOfBuffer = "Attempt to transform beyond end of buffer."; + public const string Cryptography_CipherModeNotSupported = "The specified CipherMode '{0}' is not supported."; + public const string Cryptography_UnknownHashAlgorithm = "'{0}' is not a known hash algorithm."; + public const string Cryptography_UnknownPaddingMode = "Unknown padding mode used."; + public const string Cryptography_UnexpectedTransformTruncation = "CNG provider unexpectedly terminated encryption or decryption prematurely."; + public const string Cryptography_Unmapped_System_Typed_Error = "The system cryptographic library returned error '{0}' of type '{1}'"; + public const string Cryptography_UnsupportedPaddingMode = "The specified PaddingMode is not supported."; + public const string NotSupported_Method = "Method not supported."; + public const string NotSupported_SubclassOverride = "Method not supported. Derived class must override."; + public const string Cryptography_AlgorithmTypesMustBeVisible = "Algorithms added to CryptoConfig must be accessable from outside their assembly."; + public const string Cryptography_AddNullOrEmptyName = "CryptoConfig cannot add a mapping for a null or empty name."; + public const string Argument_Invalid_SafeHandleInvalidOrClosed = "The method cannot be called with an invalid or closed SafeHandle."; + public const string Cryptography_ArgExpectedECDiffieHellmanCngPublicKey = "DeriveKeyMaterial requires an ECDiffieHellmanCngPublicKey."; + public const string Cryptography_ArgDSARequiresDSAKey = "Keys used with the DSACng algorithm must have an algorithm group of DSA."; + public const string Cryptography_ArgECDsaRequiresECDsaKey = "Keys used with the ECDsaCng algorithm must have an algorithm group of ECDsa."; + public const string Cryptography_ArgRSARequiresRSAKey = "Keys used with the RSACng algorithm must have an algorithm group of RSA."; + public const string Cryptography_CngKeyWrongAlgorithm = "This key is for algorithm '{0}'. Expected '{1}'."; + public const string Cryptography_InvalidAlgorithmGroup = "The algorithm group '{0}' is invalid."; + public const string Cryptography_InvalidAlgorithmName = "The algorithm name '{0}' is invalid."; + public const string Cryptography_InvalidCipherMode = "Specified cipher mode is not valid for this algorithm."; + public const string Cryptography_InvalidKeyBlobFormat = "The key blob format '{0}' is invalid."; + public const string Cryptography_InvalidProviderName = "The provider name '{0}' is invalid."; + public const string Cryptography_KeyBlobParsingError = "Key Blob not in expected format."; + public const string Cryptography_OpenEphemeralKeyHandleWithoutEphemeralFlag = "The CNG key handle being opened was detected to be ephemeral, but the EphemeralKey open option was not specified."; + public const string Cryptography_WeakKey = "Specified key is a known weak key for this algorithm and cannot be used."; + public const string PlatformNotSupported_CryptographyCng = "Windows Cryptography Next Generation (CNG) is not supported on this platform."; + public const string CountdownEvent_Increment_AlreadyZero = "The event is already signaled and cannot be incremented."; + public const string CountdownEvent_Increment_AlreadyMax = "The increment operation would cause the CurrentCount to overflow."; + public const string CountdownEvent_Decrement_BelowZero = "Invalid attempt made to decrement the event's count below zero."; + public const string Common_OperationCanceled = "The operation was canceled."; + public const string Barrier_Dispose = "The barrier has been disposed."; + public const string Barrier_SignalAndWait_InvalidOperation_ZeroTotal = "The barrier has no registered participants."; + public const string Barrier_SignalAndWait_ArgumentOutOfRange = "The specified timeout must represent a value between -1 and Int32.MaxValue, inclusive."; + public const string Barrier_RemoveParticipants_InvalidOperation = "The participantCount argument is greater than the number of participants that haven't yet arrived at the barrier in this phase."; + public const string Barrier_RemoveParticipants_ArgumentOutOfRange = "The participantCount argument must be less than or equal the number of participants."; + public const string Barrier_RemoveParticipants_NonPositive_ArgumentOutOfRange = "The participantCount argument must be a positive value."; + public const string Barrier_InvalidOperation_CalledFromPHA = "This method may not be called from within the postPhaseAction."; + public const string Barrier_AddParticipants_NonPositive_ArgumentOutOfRange = "The participantCount argument must be a positive value."; + public const string Barrier_SignalAndWait_InvalidOperation_ThreadsExceeded = "The number of threads using the barrier exceeded the total number of registered participants."; + public const string BarrierPostPhaseException = "The postPhaseAction failed with an exception."; + public const string Barrier_ctor_ArgumentOutOfRange = "The participantCount argument must be non-negative and less than or equal to 32767."; + public const string Barrier_AddParticipants_Overflow_ArgumentOutOfRange = "Adding participantCount participants would result in the number of participants exceeding the maximum number allowed."; + public const string SynchronizationLockException_IncorrectDispose = "The lock is being disposed while still being used. It either is being held by a thread and/or has active waiters waiting to acquire the lock."; + public const string SynchronizationLockException_MisMatchedWrite = "The write lock is being released without being held."; + public const string LockRecursionException_UpgradeAfterReadNotAllowed = "Upgradeable lock may not be acquired with read lock held."; + public const string LockRecursionException_UpgradeAfterWriteNotAllowed = "Upgradeable lock may not be acquired with write lock held in this mode. Acquiring Upgradeable lock gives the ability to read along with an option to upgrade to a writer."; + public const string SynchronizationLockException_MisMatchedUpgrade = "The upgradeable lock is being released without being held."; + public const string SynchronizationLockException_MisMatchedRead = "The read lock is being released without being held."; + public const string LockRecursionException_WriteAfterReadNotAllowed = "Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock."; + public const string LockRecursionException_RecursiveWriteNotAllowed = "Recursive write lock acquisitions not allowed in this mode."; + public const string LockRecursionException_ReadAfterWriteNotAllowed = "A read lock may not be acquired with the write lock held in this mode."; + public const string LockRecursionException_RecursiveUpgradeNotAllowed = "Recursive upgradeable lock acquisitions not allowed in this mode."; + public const string LockRecursionException_RecursiveReadNotAllowed = "Recursive read lock acquisitions not allowed in this mode."; + public const string Overflow_UInt16 = "Value was either too large or too small for a UInt16."; + public const string ReaderWriterLock_Timeout = "The operation has timed out. {0}"; + public const string ArgumentOutOfRange_TimeoutMilliseconds = "Timeout value in milliseconds must be nonnegative and less than or equal to Int32.MaxValue, or -1 for an infinite timeout."; + public const string ReaderWriterLock_NotOwner = "Attempt to release a lock that is not owned by the calling thread. {0}"; + public const string ExceptionFromHResult = "(Exception from HRESULT: 0x{0:X})"; + public const string ReaderWriterLock_InvalidLockCookie = "The specified lock cookie is invalid for this operation. {0}"; + public const string ReaderWriterLock_RestoreLockWithOwnedLocks = "ReaderWriterLock.RestoreLock was called without releasing all locks acquired since the call to ReleaseLock."; + public const string HostExecutionContextManager_InvalidOperation_NotNewCaptureContext = "Cannot apply a context that has been marshaled across AppDomains, that was not acquired through a Capture operation or that has already been the argument to a Set call."; + public const string HostExecutionContextManager_InvalidOperation_CannotOverrideSetWithoutRevert = "Must override both HostExecutionContextManager.SetHostExecutionContext and HostExecutionContextManager.Revert."; + public const string HostExecutionContextManager_InvalidOperation_CannotUseSwitcherOtherThread = "Undo operation must be performed on the thread where the corresponding context was Set."; + public const string Arg_NonZeroLowerBound = "The lower bound of target array must be zero."; + public const string Arg_WrongType = "The value '{0}' is not of type '{1}' and cannot be used in this generic collection."; + public const string Arg_ArrayPlusOffTooSmall = "Destination array is not long enough to copy all the items in the collection. Check array index and length."; + public const string ArgumentOutOfRange_SmallCapacity = "capacity was less than the current size."; + public const string Argument_AddingDuplicate = "An item with the same key has already been added. Key: {0}"; + public const string InvalidOperation_ConcurrentOperationsNotSupported = "Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct."; + public const string InvalidOperation_EmptyQueue = "Queue empty."; + public const string InvalidOperation_EnumOpCantHappen = "Enumeration has either not started or has already finished."; + public const string InvalidOperation_EnumFailedVersion = "Collection was modified; enumeration operation may not execute."; + public const string InvalidOperation_EmptyStack = "Stack empty."; + public const string InvalidOperation_EnumNotStarted = "Enumeration has not started. Call MoveNext."; + public const string InvalidOperation_EnumEnded = "Enumeration already finished."; + public const string NotSupported_KeyCollectionSet = "Mutating a key collection derived from a dictionary is not allowed."; + public const string NotSupported_ValueCollectionSet = "Mutating a value collection derived from a dictionary is not allowed."; + public const string Arg_ArrayLengthsDiffer = "Array lengths must be the same."; + public const string Arg_BitArrayTypeUnsupported = "Only supported array types for CopyTo on BitArrays are Boolean[], Int32[] and Byte[]."; + public const string Arg_HSCapacityOverflow = "HashSet capacity is too big."; + public const string Arg_HTCapacityOverflow = "Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table."; + public const string Arg_InsufficientSpace = "Insufficient space in the target location to copy the information."; + public const string Arg_RankMultiDimNotSupported = "Only single dimensional arrays are supported for the requested action."; + public const string Argument_ArrayTooLarge = "The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue."; + public const string Argument_InvalidArrayType = "Target array type is not compatible with the type of items in the collection."; + public const string ArgumentOutOfRange_BiggerThanCollection = "Must be less than or equal to the size of the collection."; + public const string ArgumentOutOfRange_Index = "Index was out of range. Must be non-negative and less than the size of the collection."; + public const string ExternalLinkedListNode = "The LinkedList node does not belong to current LinkedList."; + public const string LinkedListEmpty = "The LinkedList is empty."; + public const string LinkedListNodeIsAttached = "The LinkedList node already belongs to a LinkedList."; + public const string NotSupported_SortedListNestedWrite = "This operation is not supported on SortedList nested types because they require modifying the original SortedList."; + public const string SortedSet_LowerValueGreaterThanUpperValue = "Must be less than or equal to upperValue."; + public const string Serialization_InvalidOnDeser = "OnDeserialization method was called while the object was not being deserialized."; + public const string Serialization_MismatchedCount = "The serialized Count information doesn't match the number of items."; + public const string Serialization_MissingKeys = "The keys for this dictionary are missing."; + public const string Serialization_MissingValues = "The values for this dictionary are missing."; + public const string Argument_MapNameEmptyString = "Map name cannot be an empty string."; + public const string Argument_EmptyFile = "A positive capacity must be specified for a Memory Mapped File backed by an empty file."; + public const string Argument_NewMMFWriteAccessNotAllowed = "MemoryMappedFileAccess.Write is not permitted when creating new memory mapped files. Use MemoryMappedFileAccess.ReadWrite instead."; + public const string Argument_ReadAccessWithLargeCapacity = "When specifying MemoryMappedFileAccess.Read access, the capacity must not be larger than the file size."; + public const string Argument_NewMMFAppendModeNotAllowed = "FileMode.Append is not permitted when creating new memory mapped files. Instead, use MemoryMappedFileView to ensure write-only access within a specified region."; + public const string Argument_NewMMFTruncateModeNotAllowed = "FileMode.Truncate is not permitted when creating new memory mapped files."; + public const string ArgumentNull_MapName = "Map name cannot be null."; + public const string ArgumentNull_FileStream = "fileStream cannot be null."; + public const string ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed = "The capacity cannot be greater than the size of the system's logical address space."; + public const string ArgumentOutOfRange_NeedPositiveNumber = "A positive number is required."; + public const string ArgumentOutOfRange_PositiveOrDefaultCapacityRequired = "The capacity must be greater than or equal to 0. 0 represents the size of the file being mapped."; + public const string ArgumentOutOfRange_PositiveOrDefaultSizeRequired = "The size must be greater than or equal to 0. If 0 is specified, the view extends from the specified offset to the end of the file mapping."; + public const string ArgumentOutOfRange_CapacityGEFileSizeRequired = "The capacity may not be smaller than the file size."; + public const string IO_NotEnoughMemory = "Not enough memory to map view."; + public const string InvalidOperation_CantCreateFileMapping = "Cannot create file mapping."; + public const string NotSupported_MMViewStreamsFixedLength = "MemoryMappedViewStreams are fixed length."; + public const string ObjectDisposed_ViewAccessorClosed = "Cannot access a closed accessor."; + public const string ObjectDisposed_StreamIsClosed = "Cannot access a closed Stream."; + public const string PlatformNotSupported_NamedMaps = "Named maps are not supported."; } diff --git a/mcs/class/System.Core/corefx/SR.missing.cs b/mcs/class/System.Core/corefx/SR.missing.cs index 24480c6eca..4f17492f5e 100644 --- a/mcs/class/System.Core/corefx/SR.missing.cs +++ b/mcs/class/System.Core/corefx/SR.missing.cs @@ -1,5 +1,8 @@ partial class SR { public const string MethodBuilderDoesNotHaveTypeBuilder = "MethodBuilder does not have a valid TypeBuilder"; - public const string InvalidOperation_ConcurrentOperationsNotSupported = "Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct."; + public const string Cryptography_NonCompliantFIPSAlgorithm = "This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms."; + public const string InvalidOperation_ViewIsNull = "The underlying MemoryMappedView object is null."; + public const string ArgumentOutOfRange_InvalidPipeAccessRights = "Invalid PipeAccessRights flag."; + public const string ArgumentOutOfRange_AdditionalAccessLimited = "additionalAccessRights is limited to the PipeAccessRights.ChangePermissions, PipeAccessRights.TakeOwnership, and PipeAccessRights.AccessSystemSecurity flags when creating NamedPipeServerStreams."; } \ No newline at end of file diff --git a/mcs/class/System.Core/linux_net_4_x_System.Core.dll.sources b/mcs/class/System.Core/linux_net_4_x_System.Core.dll.sources new file mode 100644 index 0000000000..d6c36728e8 --- /dev/null +++ b/mcs/class/System.Core/linux_net_4_x_System.Core.dll.sources @@ -0,0 +1 @@ +#include unix_net_4_x_System.Core.dll.sources diff --git a/mcs/class/System.Core/macos_net_4_x_System.Core.dll.sources b/mcs/class/System.Core/macos_net_4_x_System.Core.dll.sources new file mode 100644 index 0000000000..d6c36728e8 --- /dev/null +++ b/mcs/class/System.Core/macos_net_4_x_System.Core.dll.sources @@ -0,0 +1 @@ +#include unix_net_4_x_System.Core.dll.sources diff --git a/mcs/class/System.Core/monodroid_System.Core.dll.sources b/mcs/class/System.Core/monodroid_System.Core.dll.sources index a6923677d2..ab0bb1c137 100644 --- a/mcs/class/System.Core/monodroid_System.Core.dll.sources +++ b/mcs/class/System.Core/monodroid_System.Core.dll.sources @@ -1,5 +1,6 @@ #include common_System.Core.dll.sources #include dynamic_System.Core.dll.sources +#include pipes_pns.sources System.Security.Cryptography/AesCryptoServiceProvider.cs System.Security.Cryptography/AesTransform.cs diff --git a/mcs/class/System.Core/monodroid_System.Core_test.dll.exclude.sources b/mcs/class/System.Core/monodroid_System.Core_test.dll.exclude.sources new file mode 100644 index 0000000000..56e35a121e --- /dev/null +++ b/mcs/class/System.Core/monodroid_System.Core_test.dll.exclude.sources @@ -0,0 +1 @@ +#include testing_aot_full_System.Core_test.dll.exclude.sources diff --git a/mcs/class/System.Core/monodroid_System.Core_test.dll.sources b/mcs/class/System.Core/monodroid_System.Core_test.dll.sources new file mode 100644 index 0000000000..33e2a10584 --- /dev/null +++ b/mcs/class/System.Core/monodroid_System.Core_test.dll.sources @@ -0,0 +1 @@ +#include System.Core_test.dll.sources diff --git a/mcs/class/System.Core/monotouch_System.Core.dll.sources b/mcs/class/System.Core/monotouch_System.Core.dll.sources index 7d32d44a88..5150652ed7 100644 --- a/mcs/class/System.Core/monotouch_System.Core.dll.sources +++ b/mcs/class/System.Core/monotouch_System.Core.dll.sources @@ -1,2 +1,3 @@ #include common_System.Core.dll.sources #include interpreter_System.Core.dll.sources +#include pipes_pns.sources diff --git a/mcs/class/System.Core/net_4_x_System.Core.dll.sources b/mcs/class/System.Core/net_4_x_System.Core.dll.sources index 5cc42d8a3c..f5ab93d5a9 100644 --- a/mcs/class/System.Core/net_4_x_System.Core.dll.sources +++ b/mcs/class/System.Core/net_4_x_System.Core.dll.sources @@ -1,9 +1,6 @@ #include common_System.Core.dll.sources #include dynamic_System.Core.dll.sources -System.IO.Pipes/PipeUnix.cs -System.IO.Pipes/PipeWin32.cs - System.Security.Cryptography/AesCryptoServiceProvider.cs System.Security.Cryptography/AesTransform.cs System.Security.Cryptography/MD5Cng.cs diff --git a/mcs/class/System.Core/pipes_pns.sources b/mcs/class/System.Core/pipes_pns.sources new file mode 100644 index 0000000000..005d413ebd --- /dev/null +++ b/mcs/class/System.Core/pipes_pns.sources @@ -0,0 +1,5 @@ +System.IO.Pipes/AnonymousPipeServerStream.NotSupported.cs +System.IO.Pipes/NamedPipeClientStream.NotSupported.cs +System.IO.Pipes/NamedPipeServerStream.NotSupported.cs +System.IO.Pipes/PipeStream.NotSupported.cs +System.IO.Pipes/SafePipeHandle.NotSupported.cs diff --git a/mcs/class/System.Core/testing_aot_full_System.Core.dll.sources b/mcs/class/System.Core/testing_aot_full_System.Core.dll.sources index 70fa76793f..7a7610c1c2 100644 --- a/mcs/class/System.Core/testing_aot_full_System.Core.dll.sources +++ b/mcs/class/System.Core/testing_aot_full_System.Core.dll.sources @@ -1,5 +1,6 @@ #include common_System.Core.dll.sources #include interpreter_System.Core.dll.sources +#include pipes_pns.sources System.Security.Cryptography/AesCryptoServiceProvider.cs System.Security.Cryptography/AesTransform.cs diff --git a/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.exclude.sources b/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.exclude.sources new file mode 100644 index 0000000000..f98bf051be --- /dev/null +++ b/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.exclude.sources @@ -0,0 +1 @@ +System.IO.Pipes/PipeSecurityTest.cs diff --git a/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.sources b/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.sources new file mode 100644 index 0000000000..33e2a10584 --- /dev/null +++ b/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.sources @@ -0,0 +1 @@ +#include System.Core_test.dll.sources diff --git a/mcs/class/System.Core/testing_aot_hybrid_System.Core.dll.sources b/mcs/class/System.Core/testing_aot_hybrid_System.Core.dll.sources index c1ff833178..dcdce325f7 100644 --- a/mcs/class/System.Core/testing_aot_hybrid_System.Core.dll.sources +++ b/mcs/class/System.Core/testing_aot_hybrid_System.Core.dll.sources @@ -1,5 +1,6 @@ #include common_System.Core.dll.sources #include dynamic_System.Core.dll.sources +#include pipes_pns.sources System.Security.Cryptography/AesCryptoServiceProvider.cs System.Security.Cryptography/AesTransform.cs diff --git a/mcs/class/System.Core/unix_net_4_x_System.Core.dll.sources b/mcs/class/System.Core/unix_net_4_x_System.Core.dll.sources new file mode 100644 index 0000000000..0d1cdcde9b --- /dev/null +++ b/mcs/class/System.Core/unix_net_4_x_System.Core.dll.sources @@ -0,0 +1,39 @@ +#include net_4_x_System.Core.dll.sources + +System.IO.Pipes/NamedPipeClientStream.Unix.cs +System.IO.Pipes/NamedPipeServerStream.Unix.cs +System.IO.Pipes/AnonymousPipeServerStream.Unix.cs +../../../external/corefx/src/System.IO.Pipes/src/Microsoft/Win32/SafeHandles/SafePipeHandle.Unix.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeServerStream.Unix.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Unix.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Unix.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Unix.cs + +../../../external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.cs +../../../external/corefx/src/System.Net.Sockets/src/System/Net/Sockets/UnixDomainSocketEndPoint.Unix.cs + +../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeFileHandleHelper.Unix.cs +../../../external/corefx/src/Common/src/Interop/Unix/Interop.Libraries.cs +../../../external/corefx/src/Common/src/Interop/Unix/Interop.Errors.cs +../../../external/corefx/src/Common/src/Interop/Unix/Interop.IOErrors.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Close.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Fcntl.Pipe.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Fcntl.SetCloseOnExec.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.FLock.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.GetDomainSocketSizes.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.GetHostName.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.GetPeerUserName.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.MkDir.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Open.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.OpenFlags.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Permissions.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Pipe.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Poll.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Read.Pipe.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Unlink.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Write.Pipe.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Stat.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Stat.Pipe.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.GetPeerID.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.GetEUid.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.SetEUid.cs diff --git a/mcs/class/System.Core/unreal_System.Core.dll.sources b/mcs/class/System.Core/unreal_System.Core.dll.sources index c1ff833178..dcdce325f7 100644 --- a/mcs/class/System.Core/unreal_System.Core.dll.sources +++ b/mcs/class/System.Core/unreal_System.Core.dll.sources @@ -1,5 +1,6 @@ #include common_System.Core.dll.sources #include dynamic_System.Core.dll.sources +#include pipes_pns.sources System.Security.Cryptography/AesCryptoServiceProvider.cs System.Security.Cryptography/AesTransform.cs diff --git a/mcs/class/System.Core/win32_net_4_x_System.Core.dll.sources b/mcs/class/System.Core/win32_net_4_x_System.Core.dll.sources new file mode 100644 index 0000000000..f9ca119639 --- /dev/null +++ b/mcs/class/System.Core/win32_net_4_x_System.Core.dll.sources @@ -0,0 +1,47 @@ +#include net_4_x_System.Core.dll.sources + +System.IO.Pipes/NamedPipeClientStream.Windows.cs +System.IO.Pipes/NamedPipeServerStream.Windows.cs +System.IO.Pipes/AnonymousPipeServerStream.Windows.cs +../../../external/corefx/src/Common/src/Interop/Windows/Interop.Libraries.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CloseHandle.cs +../../../external/corefx/src/Common/src/Interop/Windows/Interop.Errors.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FormatMessage.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.SecurityOptions.cs +../../../external/corefx/src/Common/src/Interop/Windows/Interop.BOOL.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GenericOperations.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.HandleOptions.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.PipeOptions.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FileOperations.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FileTypes.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetCurrentProcess_IntPtr.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.DuplicateHandle_IntPtr.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreatePipe_SafePipeHandle.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ConnectNamedPipe.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WaitNamedPipe.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetNamedPipeHandleState.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.GetNamedPipeInfo.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateNamedPipeClient.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.SetNamedPipeHandleState.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CancelIoEx.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.DisconnectNamedPipe.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateNamedPipe.cs +../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.MaxLengths.cs +../../../external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.RevertToSelf.cs +../../../external/corefx/src/Common/src/Interop/Windows/advapi32/Interop.ImpersonateNamedPipeClient.cs + +../../../external/corefx/src/System.IO.Pipes/src/Microsoft/Win32/SafeHandles/SafePipeHandle.Windows.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeServerStream.Windows.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ConnectionCompletionSource.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeClientStream.Windows.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/NamedPipeServerStream.Windows.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeCompletionSource.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/PipeStream.Windows.cs +../../../external/corefx/src/System.IO.Pipes/src/System/IO/Pipes/ReadWriteCompletionSource.cs diff --git a/mcs/class/System.Core/xammac_System.Core.dll.sources b/mcs/class/System.Core/xammac_System.Core.dll.sources index ffee84a901..3d0b322871 100644 --- a/mcs/class/System.Core/xammac_System.Core.dll.sources +++ b/mcs/class/System.Core/xammac_System.Core.dll.sources @@ -1,3 +1,3 @@ #include common_System.Core.dll.sources - #include dynamic_System.Core.dll.sources +#include pipes_pns.sources diff --git a/mcs/class/System.Core/xammac_net_4_5_System.Core.dll.sources b/mcs/class/System.Core/xammac_net_4_5_System.Core.dll.sources index e5681ff8ff..d6c36728e8 100644 --- a/mcs/class/System.Core/xammac_net_4_5_System.Core.dll.sources +++ b/mcs/class/System.Core/xammac_net_4_5_System.Core.dll.sources @@ -1 +1 @@ -#include net_4_x_System.Core.dll.sources +#include unix_net_4_x_System.Core.dll.sources diff --git a/mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/Expressions/GroupByExpression.cs b/mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/Expressions/GroupByExpression.cs deleted file mode 100644 index a03ce5cdaa..0000000000 --- a/mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/Expressions/GroupByExpression.cs +++ /dev/null @@ -1,160 +0,0 @@ -#region MIT license -// -// Copyright (c) 2007-2008 Jiri Moudry -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -#endregion - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; - -namespace DbLinq.Linq.Data.Sugar.Expressions -{ - /// - /// Represents a GROUP BY - /// - [DebuggerDisplay("GroupByExpression {Name} (as {Alias})")] - public class GroupByExpression : TableExpression - { - public new const ExpressionType ExpressionType = (ExpressionType)CustomExpressionType.GroupBy; - - public ColumnExpression SimpleGroup { get; private set; } - public IDictionary MultipleGroup { get; private set; } - public Expression KeyExpression { get; private set; } - public TableExpression Table { get; set; } - - protected bool HasKey { get; private set; } - - public GroupByExpression(ColumnExpression simpleGroup, Expression keyExpression) - : base(ExpressionType, simpleGroup.Table) - { - SimpleGroup = simpleGroup; - HasKey = false; - KeyExpression = keyExpression; - Table = SimpleGroup.Table; - } - - public GroupByExpression(IDictionary multipleGroup, Expression keyExpression) - : base(ExpressionType, multipleGroup.Values.First().Table) - { - MultipleGroup = new Dictionary(multipleGroup); - HasKey = true; - KeyExpression = keyExpression; - Table = MultipleGroup.Values.First().Table; - } - - private GroupByExpression(TableExpression tableExpression) - : base(ExpressionType, tableExpression) - { - Table = tableExpression; - } - - /// - /// Returns the request member. - /// For a MultipleGroup case, we return a modified copy of the current expression - /// this copy we be called again with the final MemberInfo - /// - /// - /// - public Expression GetMember(MemberInfo memberInfo) - { - // simple groupe case here, we accept only one request: the "Key" - if (SimpleGroup != null) - { - if (IsKeyRequest(memberInfo)) - { - return SimpleGroup; - } - throw Error.BadArgument("S0077: Unknown member '{0}' for simple GroupByExpression", memberInfo.Name); - } - // multiple group, we accept only Key at first time, then try any request - if (HasKey) - { - if (IsKeyRequest(memberInfo)) - { - return GetKey(); - } - throw Error.BadArgument("S0087: Only 'Key' member can be requested here", memberInfo.Name); - } - ColumnExpression member; - if (!MultipleGroup.TryGetValue(memberInfo, out member)) - throw Error.BadArgument("S0091: Unknown member '{0}' for multiple GroupByExpression", memberInfo.Name); - return member; - } - - /// - /// The only member a IGrouping has is the "Key", and we're accepting only this one at the beginning - /// - /// - /// - protected virtual bool IsKeyRequest(MemberInfo memberInfo) - { - return memberInfo.Name == "Key"; - } - - public GroupByExpression GetKey() - { - var newGroupBy = new GroupByExpression(Table) - { - SimpleGroup = SimpleGroup, - MultipleGroup = MultipleGroup, - HasKey = false, - Table = Table, - KeyExpression = KeyExpression, - }; - return newGroupBy; - } - - public IEnumerable Columns - { - get - { - if (SimpleGroup != null) - yield return SimpleGroup; - else - { - foreach (var column in MultipleGroup.Values) - yield return column; - } - } - } - - #region Expression mutation - - public override Expression Mutate(IList newOperands) - { - return this; - } - - public override IEnumerable Operands - { - get - { - yield break; - } - } - - #endregion - } -} diff --git a/mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/Expressions/ScopeExpression.cs b/mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/Expressions/ScopeExpression.cs deleted file mode 100644 index 574eb75bb2..0000000000 --- a/mcs/class/System.Data.Linq/src/DbLinq/Data/Linq/Sugar/Expressions/ScopeExpression.cs +++ /dev/null @@ -1,107 +0,0 @@ -#region MIT license -// -// Copyright (c) 2007-2008 Jiri Moudry -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -#endregion - -using System; -using System.Collections.Generic; -using System.Linq.Expressions; - -namespace DbLinq.Linq.Data.Sugar.Expressions -{ - /// - /// ScopeExpression describes a selection. - /// It can be present at top-level or as subexpressions - /// - public class ScopeExpression : OperandsMutableExpression - { - public const ExpressionType ExpressionType = (ExpressionType)CustomExpressionType.Scope; - - // Involved entities - public IList Tables { get; private set; } - public IList Columns { get; private set; } - - // Clauses - public string ExecuteMethodName { get; set; } // for Execute<> calls, this member is filled with the method name - public LambdaExpression SelectExpression { get; set; } // Func --> creates an object from data record - public IList Where { get; private set; } - public IList OrderBy { get; private set; } - public IList Group { get; private set; } - - public Expression Offset { get; set; } - public Expression Limit { get; set; } - public Expression OffsetAndLimit { get; set; } - - // Parent scope: we will climb up to find if we don't find the request table in the current scope - public ScopeExpression Parent { get; private set; } - - public ScopeExpression() - : base(ExpressionType, null, null) - { - Tables = new List(); - Columns = new List(); - // Local clauses - Where = new List(); - OrderBy = new List(); - Group = new List(); - } - - public ScopeExpression(ScopeExpression parentScopePiece) - : base(ExpressionType, null, null) - { - Parent = parentScopePiece; - // Tables and columns are empty, since the table/column lookup recurses to parentScopePiece - Tables = new List(); - Columns = new List(); - // Local clauses - Where = new List(); - OrderBy = new List(); - Group = new List(); - } - - private ScopeExpression(Type type, IList operands) - : base(ExpressionType, type, operands) - { - } - - protected override Expression Mutate2(IList newOperands) - { - Type type; - if (newOperands.Count > 0) - type = newOperands[0].Type; - else - type = Type; - var scopeExpression = new ScopeExpression(type, newOperands); - scopeExpression.Tables = Tables; - scopeExpression.Columns = Columns; - scopeExpression.Where = Where; - scopeExpression.OrderBy = OrderBy; - scopeExpression.Group = Group; - scopeExpression.Parent = Parent; - scopeExpression.ExecuteMethodName = ExecuteMethodName; - scopeExpression.Limit = Limit; - scopeExpression.Offset = Offset; - scopeExpression.OffsetAndLimit = OffsetAndLimit; - return scopeExpression; - } - } -} diff --git a/mcs/class/System.Data.Linq/src/DbLinq/System.Data.Linq/EntitySet.cs b/mcs/class/System.Data.Linq/src/DbLinq/System.Data.Linq/EntitySet.cs deleted file mode 100644 index c4f9cd95c2..0000000000 --- a/mcs/class/System.Data.Linq/src/DbLinq/System.Data.Linq/EntitySet.cs +++ /dev/null @@ -1,242 +0,0 @@ -// -// EntitySet.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2008 Novell, Inc. -// - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Linq.Expressions; - -namespace System.Data.Linq -{ - public sealed class EntitySet : IList, ICollection, IList, ICollection, IEnumerable, IEnumerable, IListSource where TEntity : class - { - public EntitySet () - { - } - - [MonoTODO] - public EntitySet (Action onAdd, Action onRemove) - { - throw new NotImplementedException (); - } - - public event ListChangedEventHandler ListChanged; - - [MonoTODO] - public void Add (TEntity entity) - { - throw new NotImplementedException (); - } - - [MonoTODO] - int IList.Add (object value) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void AddRange (IEnumerable collection) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void Assign (IEnumerable entitySource) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void Clear () - { - throw new NotImplementedException (); - } - - [MonoTODO] - public bool Contains (TEntity entity) - { - throw new NotImplementedException (); - } - - [MonoTODO] - bool IList.Contains (object value) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void CopyTo (TEntity [] array, int arrayIndex) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void ICollection.CopyTo (Array array, int index) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public IEnumerator GetEnumerator () - { - throw new NotImplementedException (); - } - - [MonoTODO] - IEnumerator IEnumerable.GetEnumerator () - { - throw new NotImplementedException (); - } - - [MonoTODO] - IList IListSource.GetList () - { - throw new NotImplementedException (); - } - - [MonoTODO] - public IBindingList GetNewBindingList () - { - throw new NotImplementedException (); - } - - [MonoTODO] - public int IndexOf (TEntity entity) - { - throw new NotImplementedException (); - } - - [MonoTODO] - int IList.IndexOf (object value) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void Insert (int index, TEntity entity) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IList.Insert (int index, object value) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void Load () - { - throw new NotImplementedException (); - } - - [MonoTODO] - public bool Remove (TEntity entity) - { - throw new NotImplementedException (); - } - - [MonoTODO] - void IList.Remove (object value) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void RemoveAt (int index) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void SetSource (IEnumerable entitySource) - { - throw new NotImplementedException (); - } - - [MonoTODO] - bool IListSource.ContainsListCollection { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - public int Count { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - public bool HasLoadedOrAssignedValues { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - public bool IsDeferred { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - bool IList.IsFixedSize { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - bool ICollection.IsReadOnly { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - bool IList.IsReadOnly { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - bool ICollection.IsSynchronized { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - public TEntity this [int index] { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - [MonoTODO] - object IList.this [int index] { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - [MonoTODO] - object ICollection.SyncRoot { - get { throw new NotImplementedException (); } - } - } -} diff --git a/mcs/class/System.Data.Linq/src/DbLinq/Util/CacheChecker.cs b/mcs/class/System.Data.Linq/src/DbLinq/Util/CacheChecker.cs deleted file mode 100644 index 16a58863a5..0000000000 --- a/mcs/class/System.Data.Linq/src/DbLinq/Util/CacheChecker.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Reflection; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Data.Linq.Mapping; -using System.Text; - -#if MONO_STRICT -using System.Data.Linq; -using System.Data.Linq.Identity; -#else -using DbLinq.Data.Linq; -using DbLinq.Data.Linq.Identity; -#endif - -using DbLinq.Linq; -using DbLinq.Util; - -namespace DbLinq.Util -{ - internal class CacheChecker - { - /// - /// Quote from MSDN: - /// If the object requested by the query is easily identifiable as one - /// already retrieved, no query is executed. The identity table acts as a cache - /// of all previously retrieved objects - - /// From Matt Warren: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=345635&SiteID=1 - /// The cache is checked when the query is a simple table.Where(pred) or table.First(pred) where the - /// predicate refers only to the primary key. Otherwise the query is always sent and the cache only checked - /// after the results are retrieved. - /// The DLINQ cache is not distributed or shared, it is local and contained within the context. It is only a - /// referential identity cache used to guarantee that two reads of the same entity return the same instance. - /// You are not expected to hold the cache for an extended duration (except possibly for a client scenario), - /// or share it across threads, processes, or machines in a cluster. - /// - public static bool TryRetrieveFromCache(SessionVarsParsed vars, Expression scalarExpr, out S cachedRow) - { - cachedRow = default(S); - int count1 = vars.ExpressionChain.Count; - MethodCallExpression scalarMethodCall = scalarExpr.XMethodCall(); - - bool isSingleWhere = false; - LambdaExpression whereLambda = null; - - if (count1 == 1 && scalarMethodCall.Arguments.Count == 1) - { - MethodCallExpression call0 = vars.ExpressionChain[0]; - if (call0.Method.Name == "Where" && call0.Arguments.Count == 2) - { - //db.Customers.Where(id==1).Single() - isSingleWhere = true; - whereLambda = call0.Arguments[1].XLambda(); - } - } - else if (count1 == 0 && scalarMethodCall.Arguments.Count == 2) - { - //db.Customers.Single(id==1) - isSingleWhere = true; - whereLambda = scalarMethodCall.Arguments[1].XLambda(); - } - - if ((!isSingleWhere) || whereLambda == null) - return false; - if (whereLambda.Parameters.Count != 1 || whereLambda.Parameters[0].NodeType != ExpressionType.Parameter) - return false; - if (whereLambda.Body.NodeType != ExpressionType.Equal) - return false; - BinaryExpression equals = (BinaryExpression)whereLambda.Body; - Expression left = equals.Left; - Expression right = equals.Right; - - MemberExpression member; - ConstantExpression consta; - if (left.NodeType == ExpressionType.MemberAccess && right.NodeType == ExpressionType.Constant) - { - member = left.XMember(); - consta = right.XConstant(); - } - else if (left.NodeType == ExpressionType.Constant && right.NodeType == ExpressionType.Parameter) - { - member = right.XMember(); - consta = left.XConstant(); - } - else - { - return false; - } - - if (member.Expression.NodeType != ExpressionType.Parameter) - return false; - - //check that it's a primary key field - ColumnAttribute colAttrib = AttribHelper.GetColumnAttribute(member.Member); - if (colAttrib == null) - return false; - if (!colAttrib.IsPrimaryKey) - return false; - - IdentityKey key = new IdentityKey(typeof(S), consta.Value); - DataContext context = vars.Context; - object cachedEntity = context.GetRegisteredEntityByKey(key); - if (cachedEntity == null) - return false; - cachedRow = (S)cachedEntity; - return true; - } - } -} diff --git a/mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/AbstractCodeDomGenerator.cs b/mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/AbstractCodeDomGenerator.cs deleted file mode 100644 index 08a2d79b96..0000000000 --- a/mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/AbstractCodeDomGenerator.cs +++ /dev/null @@ -1,270 +0,0 @@ -#region MIT license -// -// MIT license -// -// Copyright (c) 2007-2008 Jiri Moudry, Pascal Craponne -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -#endregion -using System; -using System.CodeDom; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; - -using Microsoft.CSharp; -using Microsoft.VisualBasic; - -using DbLinq.Schema.Dbml; - -namespace DbMetal.Generator.Implementation.CodeDomGenerator -{ -#if !MONO_STRICT - public -#endif - abstract class AbstractCodeDomGenerator : ICodeGenerator - { - public abstract string LanguageCode { get; } - public abstract string Extension { get; } - public abstract void Write(TextWriter textWriter, Database dbSchema, GenerationContext context); - - /// - /// Generates a C# source code wrapper for the database schema objects. - /// - /// - /// - public void GenerateCSharp(Database database, string filename) - { - using (Stream stream = File.Open(filename, FileMode.Create)) - { - using (StreamWriter writer = new StreamWriter(stream)) - { - new CSharpCodeProvider().CreateGenerator(writer).GenerateCodeFromNamespace(GenerateCodeDomModel(database), writer, new CodeGeneratorOptions() { BracingStyle = "C" }); - } - } - } - - /// - /// Generates a Visual Basic source code wrapper for the database schema objects. - /// - /// - /// - public void GenerateVisualBasic(Database database, string filename) - { - using (Stream stream = File.Open(filename, FileMode.Create)) - { - using (StreamWriter writer = new StreamWriter(stream)) - { - new VBCodeProvider().CreateGenerator(writer).GenerateCodeFromNamespace(GenerateCodeDomModel(database), writer, new CodeGeneratorOptions() { BracingStyle = "C" }); - } - } - } - - CodeThisReferenceExpression thisReference = new CodeThisReferenceExpression(); - - protected virtual CodeNamespace GenerateCodeDomModel(Database database) - { - CodeNamespace _namespace = new CodeNamespace(database.ContextNamespace); - - _namespace.Imports.Add(new CodeNamespaceImport("System")); - _namespace.Imports.Add(new CodeNamespaceImport("System.ComponentModel")); - _namespace.Imports.Add(new CodeNamespaceImport("System.Data")); - _namespace.Imports.Add(new CodeNamespaceImport("System.Data.Linq.Mapping")); - _namespace.Imports.Add(new CodeNamespaceImport("System.Diagnostics")); - _namespace.Imports.Add(new CodeNamespaceImport("DbLinq.Linq")); - _namespace.Imports.Add(new CodeNamespaceImport("DbLinq.Linq.Mapping")); - - _namespace.Comments.Add(new CodeCommentStatement(GenerateCommentBanner(database))); - - _namespace.Types.Add(GenerateContextClass(database)); - - foreach (Table table in database.Tables) - _namespace.Types.Add(GenerateTableClass(table)); - return _namespace; - } - - protected virtual string GenerateCommentBanner(Database database) - { - var result = new StringBuilder(); - - // http://www.network-science.de/ascii/ - // http://www.network-science.de/ascii/ascii.php?TEXT=MetalSequel&x=14&y=14&FONT=_all+fonts+with+your+text_&RICH=no&FORM=left&STRE=no&WIDT=80 - result.Append( - @" - ____ _ __ __ _ _ - | _ \| |__ | \/ | ___| |_ __ _| | - | | | | '_ \| |\/| |/ _ \ __/ _` | | - | |_| | |_) | | | | __/ || (_| | | - |____/|_.__/|_| |_|\___|\__\__,_|_| - -"); - result.AppendLine(String.Format(" Auto-generated from {0} on {1}.", database.Name, DateTime.Now)); - result.AppendLine(" Please visit http://linq.to/db for more information."); - - return result.ToString(); - } - - protected virtual CodeTypeDeclaration GenerateContextClass(Database database) - { - var _class = new CodeTypeDeclaration() { IsClass = true, IsPartial = true, Name = database.Class, TypeAttributes = TypeAttributes.Public }; - - if (database.BaseType != null) - _class.BaseTypes.Add(database.BaseType); - else // TODO: something with less risk - _class.BaseTypes.Add(String.Format("DbLinq.{0}.{0}DataContext", database.Provider)); - - // CodeDom does not currently support partial methods. This will be a problem for VB. Will probably be fixed in .net 4 - _class.Members.Add(new CodeSnippetTypeMember("\tpartial void OnCreated();")); - - // Implement Constructor - var constructor = new CodeConstructor() { Attributes = MemberAttributes.Public, Parameters = { new CodeParameterDeclarationExpression("IDbConnection", "connection") } }; - constructor.BaseConstructorArgs.Add(new CodeArgumentReferenceExpression("connection")); - constructor.Statements.Add(new CodeExpressionStatement(new CodeMethodInvokeExpression(thisReference, "OnCreated"))); - _class.Members.Add(constructor); - - // todo: override other constructors - - foreach (Table table in database.Tables) - { - var tableType = new CodeTypeReference(table.Member); - var property = new CodeMemberProperty() { Type = new CodeTypeReference("Table", tableType), Name = table.Member, Attributes = MemberAttributes.Public | MemberAttributes.Final }; - property.GetStatements.Add - ( - new CodeMethodReturnStatement - ( - new CodeMethodInvokeExpression - ( - new CodeMethodReferenceExpression(thisReference, "GetTable", tableType) - ) - ) - ); - _class.Members.Add(property); - } - - return _class; - } - - protected virtual CodeTypeDeclaration GenerateTableClass(Table table) - { - var _class = new CodeTypeDeclaration() { IsClass = true, IsPartial = true, Name = table.Member, TypeAttributes = TypeAttributes.Public }; - - _class.CustomAttributes.Add(new CodeAttributeDeclaration("Table", new CodeAttributeArgument("Name", new CodePrimitiveExpression(table.Name)))); - - // Implement Constructor - var constructor = new CodeConstructor() { Attributes = MemberAttributes.Public }; - constructor.Statements.Add(new CodeExpressionStatement(new CodeMethodInvokeExpression(thisReference, "OnCreated"))); - _class.Members.Add(constructor); - - // todo: implement INotifyPropertyChanging - - // Implement INotifyPropertyChanged - _class.BaseTypes.Add(typeof(INotifyPropertyChanged)); - - var propertyChangedEvent = new CodeMemberEvent() { Type = new CodeTypeReference(typeof(PropertyChangedEventHandler)), Name = "PropertyChanged", Attributes = MemberAttributes.Public }; - _class.Members.Add(propertyChangedEvent); - - var sendPropertyChangedMethod = new CodeMemberMethod() { Attributes = MemberAttributes.Family, Name = "SendPropertyChanged", Parameters = { new CodeParameterDeclarationExpression(typeof(System.String), "propertyName") } }; - sendPropertyChangedMethod.Statements.Add - ( - new CodeConditionStatement - ( - new CodeSnippetExpression(propertyChangedEvent.Name + " != null"), // todo: covert this to CodeBinaryOperatorExpression - new CodeExpressionStatement - ( - new CodeMethodInvokeExpression - ( - new CodeMethodReferenceExpression(thisReference, propertyChangedEvent.Name), - thisReference, - new CodeObjectCreateExpression(typeof(PropertyChangedEventArgs), new CodeArgumentReferenceExpression("propertyName")) - ) - ) - ) - ); - _class.Members.Add(sendPropertyChangedMethod); - - // CodeDom does not currently support partial methods. This will be a problem for VB. Will probably be fixed in .net 4 - _class.Members.Add(new CodeSnippetTypeMember("\tpartial void OnCreated();")); - - // todo: add these when the actually get called - //partial void OnLoaded(); - //partial void OnValidate(System.Data.Linq.ChangeAction action); - - // columns - foreach (Column column in table.Type.Columns) - { - var type = new CodeTypeReference(column.Type); - var columnMember = column.Member ?? column.Name; - - var field = new CodeMemberField(type, "_" + columnMember); - _class.Members.Add(field); - var fieldReference = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), field.Name); - - // CodeDom does not currently support partial methods. This will be a problem for VB. Will probably be fixed in .net 4 - string onChangingPartialMethodName = String.Format("On{0}Changing", columnMember); - _class.Members.Add(new CodeSnippetTypeMember(String.Format("\tpartial void {0}({1} instance);", onChangingPartialMethodName, column.Type))); - string onChangedPartialMethodName = String.Format("On{0}Changed", columnMember); - _class.Members.Add(new CodeSnippetTypeMember(String.Format("\tpartial void {0}();", onChangedPartialMethodName))); - - var property = new CodeMemberProperty(); - property.Type = type; - property.Name = columnMember; - property.Attributes = MemberAttributes.Public | MemberAttributes.Final; - property.CustomAttributes.Add - ( - new CodeAttributeDeclaration - ( - "Column", - new CodeAttributeArgument("Storage", new CodePrimitiveExpression(column.Storage)), - new CodeAttributeArgument("Name", new CodePrimitiveExpression(column.Name)), - new CodeAttributeArgument("DbType", new CodePrimitiveExpression(column.DbType)), - new CodeAttributeArgument("CanBeNull", new CodePrimitiveExpression(column.CanBeNull)), - new CodeAttributeArgument("IsPrimaryKey", new CodePrimitiveExpression(column.IsPrimaryKey)) - ) - ); - property.CustomAttributes.Add(new CodeAttributeDeclaration("DebuggerNonUserCode")); - property.GetStatements.Add(new CodeMethodReturnStatement(fieldReference)); - property.SetStatements.Add - ( - new CodeConditionStatement - ( - new CodeSnippetExpression(field.Name + " != value"), // todo: covert this to CodeBinaryOperatorExpression - new CodeExpressionStatement(new CodeMethodInvokeExpression(thisReference, onChangingPartialMethodName, new CodePropertySetValueReferenceExpression())), - new CodeAssignStatement(fieldReference, new CodePropertySetValueReferenceExpression()), - new CodeExpressionStatement(new CodeMethodInvokeExpression(thisReference, sendPropertyChangedMethod.Name, new CodePrimitiveExpression(property.Name))), - new CodeExpressionStatement(new CodeMethodInvokeExpression(thisReference, onChangedPartialMethodName)) - ) - ); - _class.Members.Add(property); - } - - // TODO: implement associations - - // TODO: implement functions / procedures - - // TODO: Override Equals and GetHashCode - - return _class; - } - } -} diff --git a/mcs/class/System.Data.Linq/src/DbMetal/Schema/SchemaPostprocess.cs b/mcs/class/System.Data.Linq/src/DbMetal/Schema/SchemaPostprocess.cs deleted file mode 100644 index dd5827a72e..0000000000 --- a/mcs/class/System.Data.Linq/src/DbMetal/Schema/SchemaPostprocess.cs +++ /dev/null @@ -1,131 +0,0 @@ -#region MIT license -// -// MIT license -// -// Copyright (c) 2007-2008 Jiri Moudry, Pascal Craponne -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -#endregion -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using DbLinq.Schema; -using DbLinq.Util; - -namespace DbMetal.Schema -{ - /// - /// this class contains functionality common to all vendors - - /// a) rename field Alltypes.Alltypes to Alltypes.Contents - /// b) rename field Employees.Employees to Employees.RefersToEmployees - /// c) rename field Alltypes.int to Alltypes.int_ - /// - public class SchemaPostprocess - { - public static void PostProcess_DB(DbLinq.Schema.Dbml.Database schema) - { - if (schema == null) - return; - - //sort tables, parent tables first - // picrap: how useful was this? - //TableSorter sorter = new TableSorter(schema.Tables); - //schema.Tables.Sort(sorter); - - foreach (var tbl in schema.Tables) - { - PostProcess_Table(tbl); - } - } - - public static void PostProcess_Table(DbLinq.Schema.Dbml.Table table) - { - // picrap: this is processed earlier - //table.Member = Util.FormatTableName(table.Type.Name, util.PluralEnum.Pluralize); - //table.Type.Name = Util.FormatTableName(table.Type.Name, util.PluralEnum.Singularize); - - //if (mmConfig.renamesFile != null) - //{ - // table.Member = Util.Rename(table.Member); - //} - - foreach (DbLinq.Schema.Dbml.Column col in table.Type.Columns) - { - if (col.Member == table.Type.Name) - col.Member = "Contents"; //rename field Alltypes.Alltypes to Alltypes.Contents - - // picrap processed earlier - //col.Storage = "_" + col.Name; - - // picrap moved to CSCodeWriter - //if (CSharp.IsCsharpKeyword(col.Storage)) - // col.Storage += "_"; //rename column 'int' -> 'int_' - - //if (CSharp.IsCsharpKeyword(col.Member)) - // col.Member += "_"; //rename column 'int' -> 'int_' - } - - Dictionary knownAssocs = new Dictionary(); - foreach (DbLinq.Schema.Dbml.Association assoc in table.Type.Associations) - { - // picrap: processed earlier - //assoc.Type = Util.FormatTableName(assoc.Type, util.PluralEnum.Singularize); - - //util.PluralEnum pluralEnum = assoc.IsForeignKey - // ? util.PluralEnum.Singularize - // : util.PluralEnum.Pluralize; - - //referring to parent: "public Employee Employee" - //referring to child: "public EntityMSet Products" - //assoc.Member = Util.FormatTableName(assoc.Member, pluralEnum); - - if (assoc.Member == table.Type.Name) - { - string thisKey = assoc.ThisKey ?? "_TODO_L35"; - //self-join: rename field Employees.Employees to Employees.RefersToEmployees - assoc.Member = thisKey + assoc.Member; - } - - if (knownAssocs.ContainsKey(assoc.Member)) - { - //this is the Andrus test case in Pgsql: - // create table t1 ( private int primary key); - // create table t2 ( f1 int references t1, f2 int references t1 ); - - assoc.Member += "_" + assoc.Name; - - } - - // picrap: handled previously - //if (mmConfig.renamesFile != null) - //{ - // assoc.Member = Util.Rename(assoc.Member); - //} - - //if (assoc.Member == "employeeterritories" || assoc.Member == "Employeeterritories") - // assoc.Member = "EmployeeTerritories"; //hack to help with Northwind - - knownAssocs[assoc.Member] = true; - } - - } - } -} \ No newline at end of file diff --git a/mcs/class/System.Data.Linq/src/DbMetal/Util/TableSorter.cs b/mcs/class/System.Data.Linq/src/DbMetal/Util/TableSorter.cs deleted file mode 100644 index 311dc01663..0000000000 --- a/mcs/class/System.Data.Linq/src/DbMetal/Util/TableSorter.cs +++ /dev/null @@ -1,126 +0,0 @@ -#region MIT license -//////////////////////////////////////////////////////////////////// -// MIT license: -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// -// Authors: -// Jiri George Moudry -// Andrey Shchekin -//////////////////////////////////////////////////////////////////// -#endregion - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using DbLinq.Schema; - -namespace DbMetal.Util -{ - /// - /// sort tables - parent tables first, child tables next. - /// - public class TableSorter : IComparer - { - Dictionary _typeNameToTableMap; // = tables.ToDictionary(t => t.Name); - //Dictionary _originalOrder = new Dictionary(); - - public TableSorter(IEnumerable tables) - { - _typeNameToTableMap = tables.ToDictionary(t => t.Type.Name); - - //int indx = 0; - foreach (DbLinq.Schema.Dbml.Table t in tables) - { - //_originalOrder[t] = indx++; - foreach (DbLinq.Schema.Dbml.Table child in EnumChildTables(t)) - { - child._isChild = true; - } - } - } - - #region IComparer Members - - public int Compare(DbLinq.Schema.Dbml.Table x, DbLinq.Schema.Dbml.Table y) - { - if (x == y) - return 0; //crappy sort implementation in .NET framework?! - - foreach (DbLinq.Schema.Dbml.Table child_of_x in EnumChildTables(x)) - { - if (y == child_of_x) - return -1; - } - foreach (DbLinq.Schema.Dbml.Table child_of_y in EnumChildTables(y)) - { - if (x == child_of_y) - return +1; - } - - //if we get here, x/y are not above or below each other. - return x._isChild.CompareTo(y._isChild); - //return 0; - } - #endregion - - #region recursive walk through child table hierarchy - private IEnumerable EnumChildTables(DbLinq.Schema.Dbml.Table parent) - { - Dictionary visitedMap = new Dictionary(); - return EnumChildTables_(parent, visitedMap); - } - - /// - /// recursively list all child tables. - /// We use visitedMap to prevent duplicates. - /// - private IEnumerable EnumChildTables_(DbLinq.Schema.Dbml.Table parent, Dictionary visitedMap) - { - //In Northwind DB, Employee.ReportsTo points back to itself, - //mark as visited to prevent recursion - visitedMap[parent] = true; - - var q1 = parent.Type.Associations.Where(a => !a.IsForeignKey - && a.OtherKey != null - && _typeNameToTableMap.ContainsKey(a.Type)); - var q = q1.ToList(); //for debugging - - //loop through direct child tables ... - foreach (var assoc in q) - { - DbLinq.Schema.Dbml.Table child = _typeNameToTableMap[assoc.Type]; - if (visitedMap.ContainsKey(child)) - continue; - - visitedMap[child] = true; - yield return child; - - //... and recurse into children of children: - foreach (DbLinq.Schema.Dbml.Table child2 in EnumChildTables_(child, visitedMap)) - { - yield return child2; - } - - } - } - - #endregion - } -} \ No newline at end of file diff --git a/mcs/class/System.Data/Makefile b/mcs/class/System.Data/Makefile index 0b04288a42..f863c7b413 100644 --- a/mcs/class/System.Data/Makefile +++ b/mcs/class/System.Data/Makefile @@ -54,8 +54,6 @@ EXTRA_DISTFILES = \ Test/test-config-file \ Test/System.Data/binserialize/*.bin \ Test/ProviderTests/sql/*.sql \ - SqliteTest.db \ - corefx.common.sources \ - corefx.unix.sources + SqliteTest.db include ../../build/library.make diff --git a/mcs/class/System.Data/System.Data_xtest.dll.sources b/mcs/class/System.Data/System.Data_xtest.dll.sources new file mode 100644 index 0000000000..d1f724d853 --- /dev/null +++ b/mcs/class/System.Data/System.Data_xtest.dll.sources @@ -0,0 +1,145 @@ +../../../external/corefx/src/System.Data.Common/tests/System/Data/ConstraintCollectionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/ConstraintCollectionTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/ConstraintExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/ConstraintTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataColumnCollectionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataColumnCollectionTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataColumnTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataColumnTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRelationCollectionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRelationCollectionTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRelationTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRelationTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRowCollectionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRowCollectionTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRowTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRowTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRowViewTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataRowViewTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataSet1.Designer.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataSetAssertion.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataSetInferXmlSchemaTest.cs +#../../../external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlSchemaTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataSetReadXmlTest.cs +#../../../external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest.cs +#../../../external/corefx/src/System.Data.Common/tests/System/Data/DataSetTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataSetTypedDataSetTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableCollectionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableCollectionTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableLoadRowTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableReaderTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableReadWriteXmlTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableReadXmlSchemaTest.cs +#../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableTest3.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableTest4.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataTableTest5.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataViewManagerTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataViewTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataViewTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataViewTest_IBindingList.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DataViewTest_IBindingListView.cs +#../../../external/corefx/src/System.Data.Common/tests/System/Data/DBConcurrencyExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DeletedRowInaccessibleExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/DuplicateNameExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/EvaluateExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/ForeignKeyConstraintTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/ForeignKeyConstraintTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/InRowChangingEventExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/InvalidConstraintExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/MissingPrimaryKeyExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/MonkeyDataSet.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/NoNullAllowedExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/ReadOnlyExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/RowNotInTableExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/SyntaxErrorExceptionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/TrailingSpaceTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/UniqueConstraintTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/UniqueConstraintTest2.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/VersionNotFoundException.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/XmlDataLoaderTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/XmlDataReaderTest.cs + +#../../../external/corefx/src/System.Data.Common/tests/System/Data/SqlTypes/*.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DataAdapterTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DataColumnMappingCollectionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DataTableMappingCollectionTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DbCommandBuilderTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DbConnectionStringBuilderTest.cs + +# WaitForPendingFinalizers issue?: +#../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DbConnectionTests.cs +#../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DbCommandTests.cs + +../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DbDataAdapterTest.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DbDataReaderMock.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DbExceptionTests.cs +../../../external/corefx/src/System.Data.Common/tests/System/Data/Common/DbTransactionTest.cs +../../../external/corefx/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs +../../../external/corefx/src/Common/tests/System/Diagnostics/Tracing/TestEventListener.cs +../../../external/corefx/src/System.Data.Common/tests/DataProvider.cs +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs + +# TDS: +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/AllHeaders/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/ColInfo/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/ColMetadata/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Done/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/EnvChange/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Error/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FeatureExtAck/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthInfo/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/FedAuthMessage/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Info/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Login7/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/LoginAck/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Order/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/PreLogin/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/ReturnStatus/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/Row/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/SessionState/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/SQLBatch/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/SSPI/*.cs + +# TDS.EndPoint: +../../../external/corefx/src/Common/src/Interop/Windows/Interop.Libraries.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/FederatedAuthentication/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecBuffer.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecBufferDesc.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecBufferDescType.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecBufferType.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecConstants.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecContextRequirements.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecDataRepresentation.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecPgkCredentials.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecPkgInfo.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecResult.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecurityHandle.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecurityInteger.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SecurityWrapper.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SSPIContext.Unix.cs +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.EndPoint/SSPI/SSPIResponse.cs + +# TDS.Servers: +../../../external/corefx/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/*.cs + + +# System.Data.SqlClient.FunctionalTests +../../../external/corefx/src/System.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs +../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/BaseProviderAsyncTest/*.cs +../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/CloneTests.cs +# TODO: fix these tests (wrong type of exception is thrown on windows): +#../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/ExceptionTest.cs +../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlBulkCopyColumnMappingCollectionTest.cs +../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlClientFactoryTest.cs +../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionTest.RetrieveStatistics.cs +../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlDataRecordTest.cs +# TODO: fix CopyTo: +#../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlErrorCollectionTest.cs +# TODO: fix ParameterPrecisionOnInterfaceType +#../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/SqlParameterTest.cs +../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/TcpDefaultForAzureTest.cs +../../../external/corefx/src/System.Data.SqlClient/tests/FunctionalTests/TestTdsServer.cs diff --git a/mcs/class/System.Data/linux_net_4_x_System.Data.dll.sources b/mcs/class/System.Data/linux_net_4_x_System.Data.dll.sources index 0f50583418..29b319492b 100644 --- a/mcs/class/System.Data/linux_net_4_x_System.Data.dll.sources +++ b/mcs/class/System.Data/linux_net_4_x_System.Data.dll.sources @@ -1,4 +1 @@ -#include corefx.unix.sources -#include net_4_x_System.Data.dll.sources - -../../../external/corefx/src/Common/src/Interop/Linux/Interop.Libraries.cs +#include unix_net_4_x_System.Data.dll.sources diff --git a/mcs/class/System.Data/darwin_net_4_x_System.Data.dll.sources b/mcs/class/System.Data/macos_net_4_x_System.Data.dll.sources similarity index 100% rename from mcs/class/System.Data/darwin_net_4_x_System.Data.dll.sources rename to mcs/class/System.Data/macos_net_4_x_System.Data.dll.sources diff --git a/mcs/class/System.Data/unix_net_4_x_System.Data.dll.sources b/mcs/class/System.Data/unix_net_4_x_System.Data.dll.sources new file mode 100644 index 0000000000..0f50583418 --- /dev/null +++ b/mcs/class/System.Data/unix_net_4_x_System.Data.dll.sources @@ -0,0 +1,4 @@ +#include corefx.unix.sources +#include net_4_x_System.Data.dll.sources + +../../../external/corefx/src/Common/src/Interop/Linux/Interop.Libraries.cs diff --git a/mcs/class/System.Data/xammac_net_4_5_System.Data.dll.sources b/mcs/class/System.Data/xammac_net_4_5_System.Data.dll.sources index 80f9840d55..ac4e4d50cd 100644 --- a/mcs/class/System.Data/xammac_net_4_5_System.Data.dll.sources +++ b/mcs/class/System.Data/xammac_net_4_5_System.Data.dll.sources @@ -1 +1 @@ -#include darwin_net_4_x_System.Data.dll.sources +#include macos_net_4_x_System.Data.dll.sources diff --git a/mcs/class/System.Drawing/System.Drawing/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/Graphics.cs index 15df9cd343..eb2a883615 100644 --- a/mcs/class/System.Drawing/System.Drawing/Graphics.cs +++ b/mcs/class/System.Drawing/System.Drawing/Graphics.cs @@ -1710,6 +1710,10 @@ namespace System.Drawing IntPtr graphics; if (GDIPlus.UseCocoaDrawable) { + if (hwnd == IntPtr.Zero) { + throw new NotSupportedException ("Opening display graphics is not supported"); + } + CocoaContext context = MacSupport.GetCGContextForNSView (hwnd); GDIPlus.GdipCreateFromContext_macosx (context.ctx, context.width, context.height, out graphics); diff --git a/mcs/class/System.Drawing/System.Drawing/macFunctions.cs b/mcs/class/System.Drawing/System.Drawing/macFunctions.cs index 623bc06a30..fa990f3b51 100644 --- a/mcs/class/System.Drawing/System.Drawing/macFunctions.cs +++ b/mcs/class/System.Drawing/System.Drawing/macFunctions.cs @@ -61,21 +61,46 @@ namespace System.Drawing { } internal static CocoaContext GetCGContextForNSView (IntPtr handle) { - IntPtr graphicsContext = objc_msgSend (objc_getClass ("NSGraphicsContext"), sel_registerName ("currentContext")); + if (handle == IntPtr.Zero) { + return null; + } + + IntPtr focusView = objc_msgSend (objc_getClass ("NSView"), sel_registerName ("focusView")); + IntPtr focusHandle = IntPtr.Zero; + if (focusView != handle) { + if (!bool_objc_msgSend (handle, sel_registerName ("lockFocusIfCanDraw"))) + return null; + + focusHandle = handle; + } + + IntPtr windowHandle = objc_msgSend (handle, sel_registerName ("window")); + IntPtr graphicsContext = objc_msgSend (windowHandle, sel_registerName ("graphicsContext")); IntPtr ctx = objc_msgSend (graphicsContext, sel_registerName ("graphicsPort")); - Rect bounds = new Rect (); + bool isFlipped = bool_objc_msgSend (handle, sel_registerName ("isFlipped")); + Size size; CGContextSaveGState (ctx); - objc_msgSend_stret (ref bounds, handle, sel_registerName ("bounds")); - - var isFlipped = bool_objc_msgSend (handle, sel_registerName ("isFlipped")); - if (isFlipped) { - CGContextTranslateCTM (ctx, bounds.origin.x, bounds.size.height); - CGContextScaleCTM (ctx,1.0f,-1.0f); + if (IntPtr.Size == 4) { + CGRect32 bounds = new CGRect32 (); + objc_msgSend_stret (ref bounds, handle, sel_registerName ("bounds")); + if (isFlipped) { + CGContextTranslateCTM32 (ctx, bounds.origin.x, bounds.size.height); + CGContextScaleCTM32 (ctx, 1.0f, -1.0f); + } + size = new Size ((int) bounds.size.width, (int) bounds.size.height); + } else { + CGRect64 bounds = new CGRect64 (); + objc_msgSend_stret (ref bounds, handle, sel_registerName ("bounds")); + if (isFlipped) { + CGContextTranslateCTM64 (ctx, bounds.origin.x, bounds.size.height); + CGContextScaleCTM64 (ctx, 1.0f, -1.0f); + } + size = new Size ((int) bounds.size.width, (int) bounds.size.height); } - return new CocoaContext (ctx, (int) bounds.size.width, (int) bounds.size.height); + return new CocoaContext (focusHandle, ctx, size.Width, size.Height); } internal static CarbonContext GetCGContextForView (IntPtr handle) { @@ -83,6 +108,9 @@ namespace System.Drawing { IntPtr port = IntPtr.Zero; IntPtr window = IntPtr.Zero; + if (IntPtr.Size == 8) + throw new NotSupportedException (); + window = GetControlOwner (handle); if (handle == IntPtr.Zero || window == IntPtr.Zero) { @@ -90,13 +118,13 @@ namespace System.Drawing { port = GetQDGlobalsThePort (); CreateCGContextForPort (port, ref context); - Rect desktop_bounds = CGDisplayBounds (CGMainDisplayID ()); + CGRect32 desktop_bounds = CGDisplayBounds32 (CGMainDisplayID ()); return new CarbonContext (port, context, (int)desktop_bounds.size.width, (int)desktop_bounds.size.height); } QDRect window_bounds = new QDRect (); - Rect view_bounds = new Rect (); + CGRect32 view_bounds = new CGRect32 (); port = GetWindowPort (window); @@ -111,10 +139,10 @@ namespace System.Drawing { if (view_bounds.size.height < 0) view_bounds.size.height = 0; if (view_bounds.size.width < 0) view_bounds.size.width = 0; - CGContextTranslateCTM (context, view_bounds.origin.x, (window_bounds.bottom - window_bounds.top) - (view_bounds.origin.y + view_bounds.size.height)); + CGContextTranslateCTM32 (context, view_bounds.origin.x, (window_bounds.bottom - window_bounds.top) - (view_bounds.origin.y + view_bounds.size.height)); // Create the original rect path and clip to it - Rect rc_clip = new Rect (0, 0, view_bounds.size.width, view_bounds.size.height); + CGRect32 rc_clip = new CGRect32 (0, 0, view_bounds.size.width, view_bounds.size.height); CGContextSaveGState (context); @@ -123,10 +151,10 @@ namespace System.Drawing { int length = clip_rectangles.Length; CGContextBeginPath (context); - CGContextAddRect (context, rc_clip); + CGContextAddRect32 (context, rc_clip); for (int i = 0; i < length; i++) { - CGContextAddRect (context, new Rect (clip_rectangles [i].X, view_bounds.size.height - clip_rectangles [i].Y - clip_rectangles [i].Height, clip_rectangles [i].Width, clip_rectangles [i].Height)); + CGContextAddRect32 (context, new CGRect32 (clip_rectangles [i].X, view_bounds.size.height - clip_rectangles [i].Y - clip_rectangles [i].Height, clip_rectangles [i].Width, clip_rectangles [i].Height)); } CGContextClosePath (context); CGContextEOClip (context); @@ -143,7 +171,7 @@ namespace System.Drawing { #endif } else { CGContextBeginPath (context); - CGContextAddRect (context, rc_clip); + CGContextAddRect32 (context, rc_clip); CGContextClosePath (context); CGContextClip (context); } @@ -195,22 +223,26 @@ namespace System.Drawing { [DllImport("libobjc.dylib")] public static extern IntPtr objc_msgSend(IntPtr basePtr, IntPtr selector); [DllImport("libobjc.dylib")] - public static extern void objc_msgSend_stret(ref Rect arect, IntPtr basePtr, IntPtr selector); + public static extern void objc_msgSend_stret(ref CGRect32 arect, IntPtr basePtr, IntPtr selector); + [DllImport("libobjc.dylib")] + public static extern void objc_msgSend_stret(ref CGRect64 arect, IntPtr basePtr, IntPtr selector); [DllImport ("libobjc.dylib", EntryPoint = "objc_msgSend")] public static extern bool bool_objc_msgSend (IntPtr handle, IntPtr selector); + [DllImport ("libobjc.dylib", EntryPoint = "objc_msgSend")] + public static extern bool bool_objc_msgSend_IntPtr (IntPtr handle, IntPtr selector, IntPtr argument); [DllImport("libobjc.dylib")] public static extern IntPtr sel_registerName(string selectorName); #endregion [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal static extern IntPtr CGMainDisplayID (); - [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern Rect CGDisplayBounds (IntPtr display); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon", EntryPoint = "CGDisplayBounds")] + internal static extern CGRect32 CGDisplayBounds32 (IntPtr display); [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern int HIViewGetBounds (IntPtr vHnd, ref Rect r); + internal static extern int HIViewGetBounds (IntPtr vHnd, ref CGRect32 r); [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern int HIViewConvertRect (ref Rect r, IntPtr a, IntPtr b); + internal static extern int HIViewConvertRect (ref CGRect32 r, IntPtr a, IntPtr b); [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal static extern IntPtr GetControlOwner (IntPtr aView); @@ -229,28 +261,22 @@ namespace System.Drawing { internal static extern void QDBeginCGContext (IntPtr port, ref IntPtr context); [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal static extern void QDEndCGContext (IntPtr port, ref IntPtr context); - [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern int CGContextClipToRect (IntPtr context, Rect clip); - [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern int CGContextClipToRects (IntPtr context, Rect [] clip_rects, int count); - [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern void CGContextTranslateCTM (IntPtr context, float tx, float ty); - [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern void CGContextScaleCTM (IntPtr context, float x, float y); + [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon", EntryPoint = "CGContextTranslateCTM")] + internal static extern void CGContextTranslateCTM32 (IntPtr context, float tx, float ty); + [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon", EntryPoint = "CGContextScaleCTM")] + internal static extern void CGContextScaleCTM32 (IntPtr context, float x, float y); + [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon", EntryPoint = "CGContextTranslateCTM")] + internal static extern void CGContextTranslateCTM64 (IntPtr context, double tx, double ty); + [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon", EntryPoint = "CGContextScaleCTM")] + internal static extern void CGContextScaleCTM64 (IntPtr context, double x, double y); [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal static extern void CGContextFlush (IntPtr context); [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal static extern void CGContextSynchronize (IntPtr context); [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal static extern IntPtr CGPathCreateMutable (); - [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern void CGPathAddRects (IntPtr path, IntPtr _void, Rect [] rects, int count); - [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern void CGPathAddRect (IntPtr path, IntPtr _void, Rect rect); - [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern void CGContextAddRects (IntPtr context, Rect [] rects, int count); - [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern void CGContextAddRect (IntPtr context, Rect rect); + [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon", EntryPoint = "CGContextAddRect")] + internal static extern void CGContextAddRect32 (IntPtr context, CGRect32 rect); [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal static extern void CGContextBeginPath (IntPtr context); [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] @@ -272,30 +298,52 @@ namespace System.Drawing { [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal static extern void CGContextSetRGBFillColor (IntPtr context, float red, float green, float blue, float alpha); [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] - internal static extern void CGContextFillRect (IntPtr context, Rect rect); + internal static extern void CGContextFillRect (IntPtr context, CGRect32 rect); #endif } - internal struct CGSize { + internal struct CGSize32 { public float width; public float height; } - internal struct CGPoint { + internal struct CGPoint32 { public float x; public float y; } - internal struct Rect { - public Rect (float x, float y, float width, float height) { + internal struct CGRect32 { + public CGRect32 (float x, float y, float width, float height) { this.origin.x = x; this.origin.y = y; this.size.width = width; this.size.height = height; } - public CGPoint origin; - public CGSize size; + public CGPoint32 origin; + public CGSize32 size; + } + + internal struct CGSize64 { + public double width; + public double height; + } + + internal struct CGPoint64 { + public double x; + public double y; + } + + internal struct CGRect64 { + public CGRect64 (double x, double y, double width, double height) { + this.origin.x = x; + this.origin.y = y; + this.size.width = width; + this.size.height = height; + } + + public CGPoint64 origin; + public CGSize64 size; } internal struct QDRect @@ -332,14 +380,16 @@ namespace System.Drawing { } } - internal struct CocoaContext : IMacContext + internal class CocoaContext : IMacContext { + public IntPtr focusHandle; public IntPtr ctx; public int width; public int height; - public CocoaContext (IntPtr ctx, int width, int height) + public CocoaContext (IntPtr focusHandle, IntPtr ctx, int width, int height) { + this.focusHandle = focusHandle; this.ctx = ctx; this.width = width; this.height = height; @@ -352,7 +402,13 @@ namespace System.Drawing { public void Release () { - MacSupport.CGContextRestoreGState(ctx); + if (IntPtr.Zero != focusHandle) + MacSupport.CGContextFlush (ctx); + + MacSupport.CGContextRestoreGState (ctx); + + if (IntPtr.Zero != focusHandle) + MacSupport.objc_msgSend (focusHandle, MacSupport.sel_registerName ("unlockFocus")); } } diff --git a/mcs/class/System.Drawing/System.Drawing_xtest.dll.sources b/mcs/class/System.Drawing/System.Drawing_xtest.dll.sources new file mode 100644 index 0000000000..7c371c5caa --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing_xtest.dll.sources @@ -0,0 +1,8 @@ +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs + +../../../external/corefx/src/System.Drawing.Common/tests/Helpers.cs +../../../external/corefx/src/System.Drawing.Common/tests/RegionTests.cs +../../../external/corefx/src/System.Drawing.Common/tests/StringFormatTests.cs +../../../external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathTests.cs +../../../external/corefx/src/System.Drawing.Common/tests/Drawing2D/GraphicsPathIteratorTests.cs + diff --git a/mcs/class/System.Drawing/netstandard.sources b/mcs/class/System.Drawing/netstandard.sources new file mode 100644 index 0000000000..809285b485 --- /dev/null +++ b/mcs/class/System.Drawing/netstandard.sources @@ -0,0 +1,10 @@ +System.Drawing/Color.cs +System.Drawing/KnownColor.cs +System.Drawing/KnownColors.cs +System.Drawing/Point.cs +System.Drawing/PointF.cs +System.Drawing/Rectangle.cs +System.Drawing/RectangleF.cs +System.Drawing/Size.cs +System.Drawing/SizeF.cs + diff --git a/mcs/class/System.IdentityModel/monodroid_System.IdentityModel_test.dll.exclude.sources b/mcs/class/System.IdentityModel/monodroid_System.IdentityModel_test.dll.exclude.sources new file mode 100644 index 0000000000..2fcb687a3a --- /dev/null +++ b/mcs/class/System.IdentityModel/monodroid_System.IdentityModel_test.dll.exclude.sources @@ -0,0 +1,37 @@ +System.IdentityModel.Claims/ClaimSetTest.cs +System.IdentityModel.Claims/ClaimTest.cs +System.IdentityModel.Claims/ClaimTypesTest.cs +System.IdentityModel.Claims/X509CertificateClaimSetTest.cs +System.IdentityModel.Common/MySecurityTokenSerializer.cs +System.IdentityModel.Policy/AuthorizationContextTest.cs +System.IdentityModel.Selectors/CustomUserNameSecurityTokenAuthenticatorTest.cs +System.IdentityModel.Selectors/RsaSecurityTokenAuthenticatorTest.cs +System.IdentityModel.Selectors/SamlSecurityTokenAuthenticatorTest.cs +System.IdentityModel.Selectors/SecurityTokenRequirementTest.cs +System.IdentityModel.Selectors/SecurityTokenResolverTest.cs +System.IdentityModel.Selectors/TestEvaluationContext.cs +System.IdentityModel.Selectors/X509SecurityTokenAuthenticatorTest.cs +System.IdentityModel.Selectors/X509SecurityTokenProviderTest.cs +System.IdentityModel.Tokens/BootstrapContextTest.cs +System.IdentityModel.Tokens/EncryptedKeyIdentifierClauseTest.cs +System.IdentityModel.Tokens/InMemorySymmetricSecurityKeyTest.cs +System.IdentityModel.Tokens/LocalIdKeyIdentifierClauseTest.cs +System.IdentityModel.Tokens/SamlActionTest.cs +System.IdentityModel.Tokens/SamlAssertionTest.cs +System.IdentityModel.Tokens/SamlAttributeStatementTest.cs +System.IdentityModel.Tokens/SamlAudienceRestrictionConditionTest.cs +System.IdentityModel.Tokens/SamlAuthenticationStatementTest.cs +System.IdentityModel.Tokens/SamlAuthorityBindingTest.cs +System.IdentityModel.Tokens/SamlAuthorizationDecisionStatementTest.cs +System.IdentityModel.Tokens/SamlConditionsTest.cs +System.IdentityModel.Tokens/SamlConstantsTest.cs +System.IdentityModel.Tokens/SamlEvidenceTest.cs +System.IdentityModel.Tokens/SamlSubjectTest.cs +System.IdentityModel.Tokens/SecurityAlgorithmsTest.cs +System.IdentityModel.Tokens/SecurityKeyIdentifierTest.cs +System.IdentityModel.Tokens/SecurityTokenTypesTest.cs +System.IdentityModel.Tokens/UserNameSecurityTokenTest.cs +System.IdentityModel.Tokens/X509AsymmetricSecurityKeyTest.cs +System.IdentityModel.Tokens/X509IssuerSerialKeyIdentifierClauseTest.cs +System.IdentityModel.Tokens/X509SecurityTokenTest.cs +System.IdentityModel.Tokens/X509ThumbprintKeyIdentifierClauseTest.cs diff --git a/mcs/class/System.Json/System.Json_xtest.dll.sources b/mcs/class/System.Json/System.Json_xtest.dll.sources new file mode 100644 index 0000000000..90d91df642 --- /dev/null +++ b/mcs/class/System.Json/System.Json_xtest.dll.sources @@ -0,0 +1,2 @@ +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs +../../../external/corefx/src/System.Json/tests/*.cs diff --git a/mcs/class/System.Net.Http/System.Net.Http.Headers/ProductHeaderValue.cs b/mcs/class/System.Net.Http/System.Net.Http.Headers/ProductHeaderValue.cs index 9614df1293..5aa19b7fff 100644 --- a/mcs/class/System.Net.Http/System.Net.Http.Headers/ProductHeaderValue.cs +++ b/mcs/class/System.Net.Http/System.Net.Http.Headers/ProductHeaderValue.cs @@ -41,7 +41,7 @@ namespace System.Net.Http.Headers public ProductHeaderValue (string name, string version) : this (name) { - if (version != null) + if (!string.IsNullOrEmpty (version)) Parser.Token.Check (version); Version = version; diff --git a/mcs/class/System.Net.Http/Test/System.Net.Http.Headers/ProductHeaderValueTest.cs b/mcs/class/System.Net.Http/Test/System.Net.Http.Headers/ProductHeaderValueTest.cs index 9ae06c1094..6d75b2fca2 100644 --- a/mcs/class/System.Net.Http/Test/System.Net.Http.Headers/ProductHeaderValueTest.cs +++ b/mcs/class/System.Net.Http/Test/System.Net.Http.Headers/ProductHeaderValueTest.cs @@ -63,6 +63,7 @@ namespace MonoTests.System.Net.Http.Headers public void Ctor () { new ProductHeaderValue ("aa", null); + new ProductHeaderValue ("aa", ""); } [Test] diff --git a/mcs/class/System.Numerics/System.Numerics_xtest.dll.sources b/mcs/class/System.Numerics/System.Numerics_xtest.dll.sources new file mode 100644 index 0000000000..96be08ccca --- /dev/null +++ b/mcs/class/System.Numerics/System.Numerics_xtest.dll.sources @@ -0,0 +1,8 @@ +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs + +# ../../../external/corefx/src/System.Runtime.Numerics/tests/*.cs +#../../../external/corefx/src/System.Runtime.Numerics/tests/BigInteger/*.cs + +../../../external/corefx/src/Common/src/CoreLib/System/Numerics/ConstantHelper.cs + +../../../external/corefx/src/System.Numerics.Vectors/tests/*.cs:GenericVectorTests.netcoreapp.cs diff --git a/mcs/class/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe_xtest.dll.sources b/mcs/class/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe_xtest.dll.sources new file mode 100644 index 0000000000..180257f53e --- /dev/null +++ b/mcs/class/System.Runtime.CompilerServices.Unsafe/System.Runtime.CompilerServices.Unsafe_xtest.dll.sources @@ -0,0 +1 @@ +../../../external/corefx/src/System.Runtime.CompilerServices.Unsafe/tests/*.cs diff --git a/mcs/class/System.Runtime.Serialization/Makefile b/mcs/class/System.Runtime.Serialization/Makefile index 2846091bf4..63f64e33ef 100644 --- a/mcs/class/System.Runtime.Serialization/Makefile +++ b/mcs/class/System.Runtime.Serialization/Makefile @@ -13,6 +13,8 @@ LIB_MCS_FLAGS = \ $(RESOURCE_FILES:%=/resource:%) TXT_RESOURCE_STRINGS = ../referencesource/System.Runtime.Serialization/System.Runtime.Serialization.txt +XTEST_LIB_REFS = System System.Core System.Xml System.Xml.Linq System.Drawing Facades/System.Threading.Tasks + ifneq (2.1, $(FRAMEWORK_VERSION)) LIB_REFS += System.Data System.Configuration SMDiagnostics LIB_MCS_FLAGS += /d:NET_3_0 @@ -34,8 +36,6 @@ TEST_LIB_REFS = System.ServiceModel System.Web.Services EXTRA_DISTFILES = $(RESOURCE_FILES) $(TEST_RESOURCE_FILES) \ Test/Resources/FrameworkTypes/* \ Test/Resources/Schemas/*.xsd \ - Test/System.Runtime.Serialization/one.xml \ - ReferenceSource.common.sources \ - ReferenceSource.desktop.sources + Test/System.Runtime.Serialization/one.xml include ../../build/library.make diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/JsonFormatReaderGenerator_static.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/JsonFormatReaderGenerator_static.cs index 53ad58d58e..dec51db3f6 100644 --- a/mcs/class/System.Runtime.Serialization/ReferenceSources/JsonFormatReaderGenerator_static.cs +++ b/mcs/class/System.Runtime.Serialization/ReferenceSources/JsonFormatReaderGenerator_static.cs @@ -508,7 +508,9 @@ namespace System.Runtime.Serialization.Json var jsonMemberName = XmlObjectSerializerReadContextComplexJson.GetJsonMemberName (xmlReader); object key = null; - if (keyParseMode == KeyParseMode.UsingParseEnum) + if (keyParseMode == KeyParseMode.AsString) + key = jsonMemberName; + else if (keyParseMode == KeyParseMode.UsingParseEnum) key = Enum.Parse (keyType, jsonMemberName); else if (keyParseMode == KeyParseMode.UsingCustomParse) key = keyDataContract.ParseMethod.Invoke (null, new object [] {jsonMemberName}); diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_xtest.dll.sources b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_xtest.dll.sources new file mode 100644 index 0000000000..506dbb4db1 --- /dev/null +++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_xtest.dll.sources @@ -0,0 +1,5 @@ +#../../../external/corefx/src/System.Runtime.Serialization.Json/tests/DataContractJsonSerializer.cs +../../../external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs +../../../external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs +../../../external/corefx/src/Common/tests/System/Runtime/Serialization/Utils.cs +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs diff --git a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization.Json/JsonReaderTest.cs b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization.Json/JsonReaderTest.cs index c95c3b6235..d4a4b8aa68 100644 --- a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization.Json/JsonReaderTest.cs +++ b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization.Json/JsonReaderTest.cs @@ -879,5 +879,30 @@ namespace MonoTests.System.Runtime.Serialization.Json Assert.AreEqual (typeof (string []), result.GetType ()); } } + + [Test] //https://github.com/mono/mono/issues/9332 + public void SimpleStringDictionaryTest () + { + string json = "{\"key\": \"value\"}"; + + // Dictionary: + using (var stream = new MemoryStream (Encoding.UTF8.GetBytes (json))) { + var serializer = new DataContractJsonSerializer (typeof (Dictionary), + new DataContractJsonSerializerSettings { UseSimpleDictionaryFormat = true }); + + var obj = serializer.ReadObject (stream) as Dictionary; + Assert.AreEqual ("value", obj ["key"]); + } + + // Dictionary: + json = "{\"42\": \"value\"}"; + using (var stream = new MemoryStream (Encoding.UTF8.GetBytes (json))) { + var serializer = new DataContractJsonSerializer (typeof (Dictionary), + new DataContractJsonSerializerSettings { UseSimpleDictionaryFormat = true }); + + var obj = serializer.ReadObject (stream) as Dictionary; + Assert.AreEqual ("value", obj [42]); + } + } } } diff --git a/mcs/class/System.Security/Makefile b/mcs/class/System.Security/Makefile index 1c7b9260c4..e349d9ae94 100644 --- a/mcs/class/System.Security/Makefile +++ b/mcs/class/System.Security/Makefile @@ -10,7 +10,7 @@ LIBRARY = System.Security.dll API_BIN_REFS := System.Numerics System.Core LIB_REFS = $(MONO_SECURITY) System System.Xml KEYFILE = ../msfinal.pub -LIB_MCS_FLAGS = -nowarn:414,618 -d:SECURITY_DEP +LIB_MCS_FLAGS = -unsafe -nowarn:414,618 -d:SECURITY_DEP LOCAL_MCS_FLAGS = @@ -26,8 +26,4 @@ EXTRA_DISTFILES = \ Test/System.Security.Cryptography.Pkcs/detached.data \ Test/System.Security.Cryptography.Pkcs/detached.p7 -RESX_RESOURCE_STRING = \ - ../../../external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Resources/Strings.resx - include ../../build/library.make diff --git a/mcs/class/System.Security/Mono.Security.Cryptography/NativeDapiProtection.cs b/mcs/class/System.Security/Mono.Security.Cryptography/NativeDapiProtection.cs deleted file mode 100644 index f16f75a466..0000000000 --- a/mcs/class/System.Security/Mono.Security.Cryptography/NativeDapiProtection.cs +++ /dev/null @@ -1,225 +0,0 @@ -// -// NativeDapiProtection.cs - -// Protect (encrypt) data without (user involved) key management -// -// Author: -// Sebastien Pouliot -// -// Copyright (C) 2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; -using System.IO; -using System.Runtime.InteropServices; -using System.Security; -using System.Security.Cryptography; -using System.Security.Permissions; - -namespace Mono.Security.Cryptography { - - // DAPI is only available in Windows 2000 and later operating systems - // see ManagedProtection for other platforms - - // notes: - // * no need to assert KeyContainerPermission here as unmanaged code can - // do what it wants; - // * which is why we also need the [SuppressUnmanagedCodeSecurity] - // attribute on each native function (so we don't require UnmanagedCode) - - internal class NativeDapiProtection { - - private const uint CRYPTPROTECT_UI_FORBIDDEN = 0x1; - private const uint CRYPTPROTECT_LOCAL_MACHINE = 0x4; - - [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Auto)] - private struct DATA_BLOB { - - private int cbData; - private IntPtr pbData; - - public void Alloc (int size) - { - if (size > 0) { - pbData = Marshal.AllocHGlobal (size); - cbData = size; - } - } - - public void Alloc (byte[] managedMemory) - { - if (managedMemory != null) { - int size = managedMemory.Length; - pbData = Marshal.AllocHGlobal (size); - cbData = size; - Marshal.Copy (managedMemory, 0, pbData, cbData); - } - } - - public void Free () - { - if (pbData != IntPtr.Zero) { - // clear copied memory! - ZeroMemory (pbData, cbData); - Marshal.FreeHGlobal (pbData); - pbData = IntPtr.Zero; - cbData = 0; - } - } - - public byte[] ToBytes () - { - if (cbData <= 0) - return new byte [0]; - - byte[] managedMemory = new byte[cbData]; - Marshal.Copy (pbData, managedMemory, 0, cbData); - return managedMemory; - } - } - - [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Auto)] - private struct CRYPTPROTECT_PROMPTSTRUCT { - - private int cbSize; - private uint dwPromptFlags; - private IntPtr hwndApp; - private string szPrompt; - - public CRYPTPROTECT_PROMPTSTRUCT (uint flags) - { - cbSize = Marshal.SizeOf (typeof (CRYPTPROTECT_PROMPTSTRUCT)); - dwPromptFlags = flags; - hwndApp = IntPtr.Zero; - szPrompt = null; - } - } - - // http://msdn.microsoft.com/library/en-us/seccrypto/security/cryptprotectdata.asp - [SuppressUnmanagedCodeSecurity] - [DllImport ("crypt32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)] - private static extern bool CryptProtectData (ref DATA_BLOB pDataIn, string szDataDescr, ref DATA_BLOB pOptionalEntropy, - IntPtr pvReserved, ref CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, uint dwFlags, ref DATA_BLOB pDataOut); - - // http://msdn.microsoft.com/library/en-us/seccrypto/security/cryptunprotectdata.asp - [SuppressUnmanagedCodeSecurity] - [DllImport ("crypt32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)] - private static extern bool CryptUnprotectData (ref DATA_BLOB pDataIn, string szDataDescr, ref DATA_BLOB pOptionalEntropy, - IntPtr pvReserved, ref CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, uint dwFlags, ref DATA_BLOB pDataOut); - - // http://msdn.microsoft.com/library/en-us/memory/base/zeromemory.asp - // note: SecureZeroMemory is an inline function (and can't be used here) - // anyway I don't think the CLR will optimize this call away (like a C/C++ compiler could do) - [SuppressUnmanagedCodeSecurity] - [DllImport ("kernel32.dll", EntryPoint = "RtlZeroMemory", SetLastError = false, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)] - private static extern void ZeroMemory (IntPtr dest, int size); - - - // managed helpers - - public static byte[] Protect (byte[] userData, byte[] optionalEntropy, DataProtectionScope scope) - { - byte[] encdata = null; - int hr = 0; - - DATA_BLOB data = new DATA_BLOB (); - DATA_BLOB entropy = new DATA_BLOB (); - DATA_BLOB cipher = new DATA_BLOB (); - try { - CRYPTPROTECT_PROMPTSTRUCT prompt = new CRYPTPROTECT_PROMPTSTRUCT (0); - data.Alloc (userData); - entropy.Alloc (optionalEntropy); - - // note: the scope/flags has already been check by the public caller - uint flags = CRYPTPROTECT_UI_FORBIDDEN; - if (scope == DataProtectionScope.LocalMachine) - flags |= CRYPTPROTECT_LOCAL_MACHINE; - - // note: on Windows 2000 the string parameter *cannot* be null - if (CryptProtectData (ref data, String.Empty, ref entropy, IntPtr.Zero, - ref prompt, flags, ref cipher)) { - // copy encrypted data back to managed codde - encdata = cipher.ToBytes (); - } else { - hr = Marshal.GetLastWin32Error (); - } - } - catch (Exception ex) { - string msg = Locale.GetText ("Error protecting data."); - throw new CryptographicException (msg, ex); - } - finally { - cipher.Free (); - data.Free (); - entropy.Free (); - } - - if ((encdata == null) || (hr != 0)) { - throw new CryptographicException (hr); - } - return encdata; - } - - public static byte[] Unprotect (byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope) - { - byte[] decdata = null; - int hr = 0; - - DATA_BLOB cipher = new DATA_BLOB (); - DATA_BLOB entropy = new DATA_BLOB (); - DATA_BLOB data = new DATA_BLOB (); - try { - CRYPTPROTECT_PROMPTSTRUCT prompt = new CRYPTPROTECT_PROMPTSTRUCT (0); - cipher.Alloc (encryptedData); - entropy.Alloc (optionalEntropy); - - // note: the scope/flags has already been check by the public caller - uint flags = CRYPTPROTECT_UI_FORBIDDEN; - if (scope == DataProtectionScope.LocalMachine) - flags |= CRYPTPROTECT_LOCAL_MACHINE; - - if (CryptUnprotectData (ref cipher, null, ref entropy, IntPtr.Zero, - ref prompt, flags, ref data)) { - // copy decrypted data back to managed codde - decdata = data.ToBytes (); - } else { - hr = Marshal.GetLastWin32Error (); - } - } - catch (Exception ex) { - string msg = Locale.GetText ("Error protecting data."); - throw new CryptographicException (msg, ex); - } - finally { - cipher.Free (); - data.Free (); - entropy.Free (); - } - - if ((decdata == null) || (hr != 0)) { - throw new CryptographicException (hr); - } - return decdata; - } - } -} - diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/AlgorithmIdentifier.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/AlgorithmIdentifier.cs deleted file mode 100644 index 27c57d1092..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/AlgorithmIdentifier.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// AlgorithmIdentifier.cs - System.Security.Cryptography.Pkcs.AlgorithmIdentifier -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -namespace System.Security.Cryptography.Pkcs { - - public sealed class AlgorithmIdentifier { - - private Oid _oid; - private int _length; - private byte[] _params; - - // constructors - - public AlgorithmIdentifier () - { - _oid = new Oid ("1.2.840.113549.3.7", "3des"); - _params = new byte [0]; - } - - public AlgorithmIdentifier (Oid oid) - { - _oid = oid; - _params = new byte [0]; - } - - public AlgorithmIdentifier (Oid oid, int keyLength) - { - _oid = oid; - _length = keyLength; - _params = new byte [0]; - } - - // properties - - public int KeyLength { - get { return _length; } - set { _length = value; } - } - - public Oid Oid { - get { return _oid; } - set { _oid = value; } - } - - public byte[] Parameters { - get { return _params; } - set { _params = value; } - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipient.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipient.cs deleted file mode 100644 index c6cf6f213b..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipient.cs +++ /dev/null @@ -1,74 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.CmsRecipient class -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System.Collections; -using System.Security.Cryptography.X509Certificates; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class CmsRecipient { - - private SubjectIdentifierType _recipient; - private X509Certificate2 _certificate; - - // constructor - - public CmsRecipient (X509Certificate2 certificate) - { - if (certificate == null) - throw new ArgumentNullException ("certificate"); - _recipient = SubjectIdentifierType.IssuerAndSerialNumber; - _certificate = certificate; - } - - public CmsRecipient (SubjectIdentifierType recipientIdentifierType, X509Certificate2 certificate) - { - if (certificate == null) - throw new ArgumentNullException ("certificate"); - - if (recipientIdentifierType == SubjectIdentifierType.Unknown) - _recipient = SubjectIdentifierType.IssuerAndSerialNumber; - else - _recipient = recipientIdentifierType; - _certificate = certificate; - } - - // properties - - public X509Certificate2 Certificate { - get { return _certificate; } - } - - public SubjectIdentifierType RecipientIdentifierType { - get { return _recipient; } - } - } -} - diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipientCollection.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipientCollection.cs deleted file mode 100644 index 352b6a3b17..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipientCollection.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.CmsRecipientCollection class -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005, 2008 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Collections; -using System.Security.Cryptography.X509Certificates; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class CmsRecipientCollection : ICollection, IEnumerable { - - private ArrayList _list; - - // constructors - - public CmsRecipientCollection () - { - _list = new ArrayList (); - } - - public CmsRecipientCollection (CmsRecipient recipient) - { - _list.Add (recipient); - } - - public CmsRecipientCollection (SubjectIdentifierType recipientIdentifierType, X509Certificate2Collection certificates) - { - // no null check, MS throws a NullReferenceException here - foreach (X509Certificate2 x509 in certificates) { - CmsRecipient p7r = new CmsRecipient (recipientIdentifierType, x509); - _list.Add (p7r); - } - } - - // properties - - public int Count { - get { return _list.Count; } - } - - public bool IsSynchronized { - get { return _list.IsSynchronized; } - } - - public CmsRecipient this [int index] { - get { return (CmsRecipient) _list [index]; } - } - - public object SyncRoot { - get { return _list.SyncRoot; } - } - - // methods - - public int Add (CmsRecipient recipient) - { - return _list.Add (recipient); - } - - public void CopyTo (Array array, int index) - { - _list.CopyTo (array, index); - } - - public void CopyTo (CmsRecipient[] array, int index) - { - _list.CopyTo (array, index); - } - - public CmsRecipientEnumerator GetEnumerator () - { - return new CmsRecipientEnumerator (_list); - } - - IEnumerator IEnumerable.GetEnumerator () - { - return new CmsRecipientEnumerator (_list); - } - - public void Remove (CmsRecipient recipient) - { - _list.Remove (recipient); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsSigner.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsSigner.cs deleted file mode 100644 index 120c607c1f..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsSigner.cs +++ /dev/null @@ -1,123 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.CmsSigner class -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Security.Cryptography.X509Certificates; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class CmsSigner { - - private SubjectIdentifierType _signer; - private X509Certificate2 _certificate; - private X509Certificate2Collection _coll; - private Oid _digest; - private X509IncludeOption _options; - private CryptographicAttributeObjectCollection _signed; - private CryptographicAttributeObjectCollection _unsigned; - - // constructors - - public CmsSigner () - { - _signer = SubjectIdentifierType.IssuerAndSerialNumber; - _digest = new Oid ("1.3.14.3.2.26"); - _options = X509IncludeOption.ExcludeRoot; - _signed = new CryptographicAttributeObjectCollection (); - _unsigned = new CryptographicAttributeObjectCollection (); - _coll = new X509Certificate2Collection (); - } - - public CmsSigner (SubjectIdentifierType signerIdentifierType) : this () - { - if (signerIdentifierType == SubjectIdentifierType.Unknown) - _signer = SubjectIdentifierType.IssuerAndSerialNumber; - else - _signer = signerIdentifierType; - } - - public CmsSigner (SubjectIdentifierType signerIdentifierType, X509Certificate2 certificate) - : this (signerIdentifierType) - { - _certificate = certificate; - } - - public CmsSigner (X509Certificate2 certificate) : this () - { - _certificate = certificate; - } - - [MonoTODO] - public CmsSigner (CspParameters parameters) : this () - { - } - - // properties - - public CryptographicAttributeObjectCollection SignedAttributes { - get { return _signed; } - } - - public X509Certificate2 Certificate { - get { return _certificate; } - set { _certificate = value; } - } - - public X509Certificate2Collection Certificates { - get { return _coll; } - } - - public Oid DigestAlgorithm { - get { return _digest; } - set { _digest = value; } - } - - public X509IncludeOption IncludeOption { - get { return _options; } - set { _options = value; } - } - - public SubjectIdentifierType SignerIdentifierType { - get { return _signer; } - set { - if (value == SubjectIdentifierType.Unknown) - throw new ArgumentException ("value"); - - _signer = value; - } - } - - public CryptographicAttributeObjectCollection UnsignedAttributes { - get { return _unsigned; } - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/ContentInfo.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/ContentInfo.cs deleted file mode 100644 index 3bf9efb989..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/ContentInfo.cs +++ /dev/null @@ -1,112 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.ContentInfo -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using Mono.Security; - -namespace System.Security.Cryptography.Pkcs { - - /* - * ContentInfo ::= SEQUENCE { - * contentType ContentType, - * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL - * } - * ContentType ::= OBJECT IDENTIFIER - */ - - public sealed class ContentInfo { - - private Oid _oid; - private byte[] _content; - - // constructors - - public ContentInfo (byte[] content) - : this (new Oid ("1.2.840.113549.1.7.1"), content) - { - } - - public ContentInfo (Oid contentType, byte[] content) - { - if (contentType == null) - throw new ArgumentNullException ("contentType"); - if (content == null) - throw new ArgumentNullException ("content"); - - _oid = contentType; - _content = content; - } - - ~ContentInfo () - { - } - - // properties - - public byte[] Content { - get { return (byte[]) _content.Clone (); } - } - - public Oid ContentType { - get { return _oid; } - } - - // static methods - - [MonoTODO ("MS is stricter than us about the content structure")] - public static Oid GetContentType (byte[] encodedMessage) - { - if (encodedMessage == null) - throw new ArgumentNullException ("algorithm"); - - try { - PKCS7.ContentInfo ci = new PKCS7.ContentInfo (encodedMessage); - switch (ci.ContentType) { - case PKCS7.Oid.data: - case PKCS7.Oid.signedData: // see SignedCms class - case PKCS7.Oid.envelopedData: // see EnvelopedCms class - case PKCS7.Oid.digestedData: - case PKCS7.Oid.encryptedData: - return new Oid (ci.ContentType); - default: - // Note: the constructor will accept any "valid" OID (but that - // doesn't mean it's a valid ContentType structure - ASN.1 wise). - string msg = Locale.GetText ("Bad ASN1 - invalid OID '{0}'"); - throw new CryptographicException (String.Format (msg, ci.ContentType)); - } - } - catch (Exception e) { - throw new CryptographicException (Locale.GetText ("Bad ASN1 - invalid structure"), e); - } - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedCms.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedCms.cs index 3942e5bba1..e7ca6e948c 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedCms.cs +++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedCms.cs @@ -27,221 +27,25 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if SECURITY_DEP - -using System.Collections; -using System.Security.Cryptography.X509Certificates; -using System.Security.Cryptography.Xml; -using System.Text; - -using Mono.Security; - namespace System.Security.Cryptography.Pkcs { - - // References - // a. PKCS #7: Cryptographic Message Syntax, Version 1.5, Section 10 - // http://www.faqs.org/rfcs/rfc2315.html - - public sealed class EnvelopedCms { - - private ContentInfo _content; - private AlgorithmIdentifier _identifier; - private X509Certificate2Collection _certs; - private RecipientInfoCollection _recipients; - private CryptographicAttributeObjectCollection _uattribs; - private SubjectIdentifierType _idType; - private int _version; - - // constructors - - public EnvelopedCms () - { - _certs = new X509Certificate2Collection (); - _recipients = new RecipientInfoCollection (); - _uattribs = new CryptographicAttributeObjectCollection (); - } - - public EnvelopedCms (ContentInfo contentInfo) : this () - { - if (contentInfo == null) - throw new ArgumentNullException ("contentInfo"); - - _content = contentInfo; - } - - public EnvelopedCms (ContentInfo contentInfo, AlgorithmIdentifier encryptionAlgorithm) - : this (contentInfo) - { - if (encryptionAlgorithm == null) - throw new ArgumentNullException ("encryptionAlgorithm"); - - _identifier = encryptionAlgorithm; - } - + public sealed partial class EnvelopedCms { public EnvelopedCms (SubjectIdentifierType recipientIdentifierType, ContentInfo contentInfo) : this (contentInfo) { - _idType = recipientIdentifierType; - if (_idType == SubjectIdentifierType.SubjectKeyIdentifier) - _version = 2; + if (recipientIdentifierType == SubjectIdentifierType.SubjectKeyIdentifier) + Version = 2; } public EnvelopedCms (SubjectIdentifierType recipientIdentifierType, ContentInfo contentInfo, AlgorithmIdentifier encryptionAlgorithm) : this (contentInfo, encryptionAlgorithm) { - _idType = recipientIdentifierType; - if (_idType == SubjectIdentifierType.SubjectKeyIdentifier) - _version = 2; + if (recipientIdentifierType == SubjectIdentifierType.SubjectKeyIdentifier) + Version = 2; } - // properties - - public X509Certificate2Collection Certificates { - get { return _certs; } - } - - public AlgorithmIdentifier ContentEncryptionAlgorithm { - get { - if (_identifier == null) - _identifier = new AlgorithmIdentifier (); - return _identifier; - } - } - - public ContentInfo ContentInfo { - get { - if (_content == null) { - Oid oid = new Oid (PKCS7.Oid.data); - _content = new ContentInfo (oid, new byte [0]); - } - return _content; - } - } - - public RecipientInfoCollection RecipientInfos { - get { return _recipients; } - } - - public CryptographicAttributeObjectCollection UnprotectedAttributes { - get { return _uattribs; } - } - - public int Version { - get { return _version; } - } - - // methods - - private X509IssuerSerial GetIssuerSerial (string issuer, byte[] serial) - { - X509IssuerSerial xis = new X509IssuerSerial (); - xis.IssuerName = issuer; - StringBuilder sb = new StringBuilder (); - foreach (byte b in serial) - sb.Append (b.ToString ("X2")); - xis.SerialNumber = sb.ToString (); - return xis; - } - - [MonoTODO] - public void Decode (byte[] encodedMessage) - { - if (encodedMessage == null) - throw new ArgumentNullException ("encodedMessage"); - - PKCS7.ContentInfo ci = new PKCS7.ContentInfo (encodedMessage); - if (ci.ContentType != PKCS7.Oid.envelopedData) - throw new Exception (""); - - PKCS7.EnvelopedData ed = new PKCS7.EnvelopedData (ci.Content); - - Oid oid = new Oid (ed.ContentInfo.ContentType); - _content = new ContentInfo (oid, new byte [0]); //ed.ContentInfo.Content.Value); - - foreach (PKCS7.RecipientInfo ri in ed.RecipientInfos) { - Oid o = new Oid (ri.Oid); - AlgorithmIdentifier ai = new AlgorithmIdentifier (o); - SubjectIdentifier si = null; - if (ri.SubjectKeyIdentifier != null) { - si = new SubjectIdentifier (SubjectIdentifierType.SubjectKeyIdentifier, ri.SubjectKeyIdentifier); - } - else if ((ri.Issuer != null) && (ri.Serial != null)) { - X509IssuerSerial xis = GetIssuerSerial (ri.Issuer, ri.Serial); - si = new SubjectIdentifier (SubjectIdentifierType.IssuerAndSerialNumber, (object)xis); - } - - KeyTransRecipientInfo _keyTrans = new KeyTransRecipientInfo (ri.Key, ai, si, ri.Version); - _recipients.Add (_keyTrans); - } - - // TODO - Certificates - // TODO - UnprotectedAttributes - - _version = ed.Version; - } - - [MonoTODO] - public void Decrypt () - { - throw new InvalidOperationException ("not encrypted"); - } - - [MonoTODO] - public void Decrypt (RecipientInfo recipientInfo) - { - if (recipientInfo == null) - throw new ArgumentNullException ("recipientInfo"); - Decrypt (); - } - - [MonoTODO] - public void Decrypt (RecipientInfo recipientInfo, X509Certificate2Collection extraStore) - { - if (recipientInfo == null) - throw new ArgumentNullException ("recipientInfo"); - if (extraStore == null) - throw new ArgumentNullException ("extraStore"); - Decrypt (); - } - - [MonoTODO] - public void Decrypt (X509Certificate2Collection extraStore) - { - if (extraStore == null) - throw new ArgumentNullException ("extraStore"); - Decrypt (); - } - - [MonoTODO] - public byte[] Encode () - { - throw new InvalidOperationException ("not encrypted"); - } - - [MonoTODO] public void Encrypt () { - if ((_content == null) || (_content.Content == null) || (_content.Content.Length == 0)) - throw new CryptographicException ("no content to encrypt"); - } - - [MonoTODO] - public void Encrypt (CmsRecipient recipient) - { - if (recipient == null) - throw new ArgumentNullException ("recipient"); - // TODO - Encrypt (); - } - - [MonoTODO] - public void Encrypt (CmsRecipientCollection recipients) - { - if (recipients == null) - throw new ArgumentNullException ("recipients"); - // ? foreach on Encrypt CmsRecipient ? + Encrypt (new CmsRecipientCollection ()); } } } - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyAgreeRecipientInfo.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyAgreeRecipientInfo.cs deleted file mode 100644 index 00e785beea..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyAgreeRecipientInfo.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.KeyAgreeRecipientInfo class -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -namespace System.Security.Cryptography.Pkcs { - - [MonoTODO] - public sealed class KeyAgreeRecipientInfo : RecipientInfo { - - // only accessible from EnvelopedCms.RecipientInfos - internal KeyAgreeRecipientInfo () - : base (RecipientInfoType.KeyAgreement) - { - } - - public DateTime Date { - get { return DateTime.MinValue; } - } - - public override byte[] EncryptedKey { - get { return null; } - } - - public override AlgorithmIdentifier KeyEncryptionAlgorithm { - get { return null; } - } - - public SubjectIdentifierOrKey OriginatorIdentifierOrKey { - get { return null; } - } - - public CryptographicAttributeObject OtherKeyAttribute { - get { return null; } - } - - public override SubjectIdentifier RecipientIdentifier { - get { return null; } - } - - public override int Version { - get { return 0; } - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyTransRecipientInfo.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyTransRecipientInfo.cs deleted file mode 100644 index c22e9ebf20..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyTransRecipientInfo.cs +++ /dev/null @@ -1,71 +0,0 @@ -// -// KeyTransRecipientInfo.cs - System.Security.Cryptography.Pkcs.KeyTransRecipientInfo -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Collections; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class KeyTransRecipientInfo : RecipientInfo { - - private byte[] _encryptedKey; - private AlgorithmIdentifier _keyEncryptionAlgorithm; - private SubjectIdentifier _recipientIdentifier; - private int _version; - - // only accessible from EnvelopedCms.RecipientInfos - internal KeyTransRecipientInfo (byte[] encryptedKey, AlgorithmIdentifier keyEncryptionAlgorithm, SubjectIdentifier recipientIdentifier, int version) - : base (RecipientInfoType.KeyTransport) - { - _encryptedKey = encryptedKey; - _keyEncryptionAlgorithm = keyEncryptionAlgorithm; - _recipientIdentifier = recipientIdentifier; - _version = version; - } - - public override byte[] EncryptedKey { - get { return _encryptedKey; } - } - - public override AlgorithmIdentifier KeyEncryptionAlgorithm { - get { return _keyEncryptionAlgorithm; } - } - - public override SubjectIdentifier RecipientIdentifier { - get { return _recipientIdentifier; } - } - - public override int Version { - get { return _version; } - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9Attribute.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9Attribute.cs deleted file mode 100644 index d41c06c8d6..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9Attribute.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.Pkcs9AttributeObject class -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Collections; - -namespace System.Security.Cryptography.Pkcs { - - public class Pkcs9AttributeObject : AsnEncodedData { - - // constructors - - public Pkcs9AttributeObject () - : base () - { - } - - public Pkcs9AttributeObject (AsnEncodedData asnEncodedData) - : base (asnEncodedData) - { - } - - public Pkcs9AttributeObject (Oid oid, byte[] encodedData) - { - if (oid == null) - throw new ArgumentNullException ("oid"); - base.Oid = oid; - RawData = encodedData; - } - - public Pkcs9AttributeObject (string oid, byte[] encodedData) - : base (oid, encodedData) - { - } - - // this (sadly) removes the "set" accessor - public new Oid Oid { - get { return base.Oid; } - internal set { base.Oid = value; } - } - - public override void CopyFrom (AsnEncodedData asnEncodedData) - { - if (asnEncodedData == null) - throw new ArgumentNullException ("asnEncodedData"); - - throw new ArgumentException ("Cannot convert the PKCS#9 attribute."); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9ContentType.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9ContentType.cs deleted file mode 100644 index d21e84ca31..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9ContentType.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -// Pkcs9ContentType.cs - System.Security.Cryptography.Pkcs.Pkcs9ContentType -// -// Authors: -// Tim Coleman (tim@timcoleman.com) -// Sebastien Pouliot -// -// Copyright (C) Tim Coleman, 2004 -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using Mono.Security; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class Pkcs9ContentType : Pkcs9AttributeObject { - - internal const string oid = "1.2.840.113549.1.9.3"; - internal const string friendlyName = "Content Type"; - - private Oid _contentType; - private byte[] _encoded; - - // constructors - - public Pkcs9ContentType () - { - // Pkcs9Attribute remove the "set" accessor on Oid :-( - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - _encoded = null; - } - - internal Pkcs9ContentType (string contentType) - { - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - _contentType = new Oid (contentType); - RawData = Encode (); - _encoded = null; - } - - internal Pkcs9ContentType (byte[] encodedContentType) - { - if (encodedContentType == null) - throw new ArgumentNullException ("encodedContentType"); - - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - RawData = encodedContentType; - Decode (encodedContentType); - } - - // properties - - public Oid ContentType { - get { - if (_encoded != null) - Decode (_encoded); - return _contentType; - } - } - - // methods - - public override void CopyFrom (AsnEncodedData asnEncodedData) - { - base.CopyFrom (asnEncodedData); - _encoded = asnEncodedData.RawData; - } - - // internal stuff - - internal void Decode (byte[] attribute) - { - if ((attribute == null) || (attribute [0] != 0x06)) - throw new CryptographicException (Locale.GetText ("Expected an OID.")); - - ASN1 oid = new ASN1 (attribute); - _contentType = new Oid (ASN1Convert.ToOid (oid)); - _encoded = null; - } - - internal byte[] Encode () - { - if (_contentType == null) - return null; - return ASN1Convert.FromOid (_contentType.Value).GetBytes (); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescription.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescription.cs deleted file mode 100644 index 21b8a46eb9..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescription.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.Pkcs9DocumentDescription class -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Text; - -using Mono.Security; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class Pkcs9DocumentDescription : Pkcs9AttributeObject { - - internal const string oid = "1.3.6.1.4.1.311.88.2.2"; - internal const string friendlyName = null; - - private string _desc; - - public Pkcs9DocumentDescription () - { - // Pkcs9Attribute remove the "set" accessor on Oid :-( - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - } - - public Pkcs9DocumentDescription (string documentDescription) - { - if (documentDescription == null) - throw new ArgumentNullException ("documentName"); - - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - _desc = documentDescription; - RawData = Encode (); - } - - public Pkcs9DocumentDescription (byte[] encodedDocumentDescription) - { - if (encodedDocumentDescription == null) - throw new ArgumentNullException ("encodedDocumentDescription"); - - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - RawData = encodedDocumentDescription; - Decode (encodedDocumentDescription); - } - - public string DocumentDescription { - get { return _desc; } - } - - public override void CopyFrom (AsnEncodedData asnEncodedData) - { - base.CopyFrom (asnEncodedData); - Decode (this.RawData); - } - - // internal stuff - - internal void Decode (byte[] attribute) - { - if (attribute [0] != 0x04) - return; // throw ? - - ASN1 attr = new ASN1 (attribute); - byte[] str = attr.Value; - int length = str.Length; - if (str [length - 2] == 0x00) - length -= 2; // zero-terminated (normal) - _desc = Encoding.Unicode.GetString (str, 0, length); - } - - internal byte[] Encode () - { - // OCTETSTRING (0x04) Of the zero-terminated unicode string - ASN1 attr = new ASN1 (0x04, Encoding.Unicode.GetBytes (_desc + (char)0)); - return attr.GetBytes (); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentName.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentName.cs deleted file mode 100644 index 66d2153bd6..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentName.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -// Pkcs9DocumentName.cs - System.Security.Cryptography.Pkcs.Pkcs9DocumentName -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Text; - -using Mono.Security; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class Pkcs9DocumentName : Pkcs9AttributeObject { - - internal const string oid = "1.3.6.1.4.1.311.88.2.1"; - internal const string friendlyName = null; - - private string _name; - - public Pkcs9DocumentName () - { - // Pkcs9Attribute remove the "set" accessor on Oid :-( - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - } - - public Pkcs9DocumentName (string documentName) - { - if (documentName == null) - throw new ArgumentNullException ("documentName"); - - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - _name = documentName; - RawData = Encode (); - } - - public Pkcs9DocumentName (byte[] encodedDocumentName) - { - if (encodedDocumentName == null) - throw new ArgumentNullException ("encodedDocumentName"); - - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - RawData = encodedDocumentName; - Decode (encodedDocumentName); - } - - public string DocumentName { - get { return _name; } - } - - public override void CopyFrom (AsnEncodedData asnEncodedData) - { - base.CopyFrom (asnEncodedData); - Decode (this.RawData); - } - - // internal stuff - - internal void Decode (byte[] attribute) - { - if (attribute [0] != 0x04) - return; // throw ? - - ASN1 attr = new ASN1 (attribute); - byte[] str = attr.Value; - int length = str.Length; - if (str [length - 2] == 0x00) - length -= 2; // zero-terminated (normal) - _name = Encoding.Unicode.GetString (str, 0, length); - } - - internal byte[] Encode () - { - // OCTETSTRING (0x04) Of the zero-terminated unicode string - ASN1 attr = new ASN1 (0x04, Encoding.Unicode.GetBytes (_name + (char)0)); - return attr.GetBytes (); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9MessageDigest.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9MessageDigest.cs deleted file mode 100644 index 0fb59b4582..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9MessageDigest.cs +++ /dev/null @@ -1,109 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.Pkcs9MessageDigest class -// -// Authors: -// Tim Coleman (tim@timcoleman.com) -// Sebastien Pouliot -// -// Copyright (C) Tim Coleman, 2004 -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using Mono.Security; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class Pkcs9MessageDigest : Pkcs9AttributeObject { - - internal const string oid = "1.2.840.113549.1.9.4"; - internal const string friendlyName = "Message Digest"; - - private byte[] _messageDigest; - private byte[] _encoded; - - // constructors - - public Pkcs9MessageDigest () - { - // Pkcs9Attribute remove the "set" accessor on Oid :-( - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - _encoded = null; - } - - internal Pkcs9MessageDigest (byte[] messageDigest, bool encoded) - { - if (messageDigest == null) - throw new ArgumentNullException ("messageDigest"); - - if (encoded) { - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - RawData = messageDigest; - Decode (messageDigest); - } else { - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - _messageDigest = (byte[]) _messageDigest.Clone (); - RawData = Encode (); - } - } - - // properties - - public byte[] MessageDigest { - get { - if (_encoded != null) - Decode (_encoded); - // FIXME: beta2 returns a reference - return _messageDigest; - } - } - - // methods - - public override void CopyFrom (AsnEncodedData asnEncodedData) - { - base.CopyFrom (asnEncodedData); - _encoded = asnEncodedData.RawData; - } - - // internal stuff - - internal void Decode (byte[] attribute) - { - if ((attribute == null) || (attribute [0] != 0x04)) - throw new CryptographicException (Locale.GetText ("Expected an OCTETSTRING.")); - - ASN1 md = new ASN1 (attribute); - _messageDigest = md.Value; - _encoded = null; - } - - internal byte[] Encode () - { - ASN1 md = new ASN1 (0x04, _messageDigest); - return md.GetBytes (); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9SigningTime.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9SigningTime.cs deleted file mode 100644 index e1e7920bc8..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9SigningTime.cs +++ /dev/null @@ -1,114 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.Pkcs9SigningTime class -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Globalization; -using System.Text; - -using Mono.Security; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class Pkcs9SigningTime : Pkcs9AttributeObject { - - internal const string oid = "1.2.840.113549.1.9.5"; - internal const string friendlyName = "Signing Time"; - - private DateTime _signingTime; - - public Pkcs9SigningTime () - { - // Pkcs9Attribute remove the "set" accessor on Oid :-( - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - _signingTime = DateTime.Now; - RawData = Encode (); - } - - public Pkcs9SigningTime (DateTime signingTime) - { - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - _signingTime = signingTime; - RawData = Encode (); - } - - public Pkcs9SigningTime (byte[] encodedSigningTime) - { - if (encodedSigningTime == null) - throw new ArgumentNullException ("encodedSigningTime"); - - (this as AsnEncodedData).Oid = new Oid (oid, friendlyName); - RawData = encodedSigningTime; - Decode (encodedSigningTime); - } - - public DateTime SigningTime { - get { return _signingTime; } - } - - public override void CopyFrom (AsnEncodedData asnEncodedData) - { - if (asnEncodedData == null) - throw new ArgumentNullException ("asnEncodedData"); - - Decode (asnEncodedData.RawData); - Oid = asnEncodedData.Oid; - RawData = asnEncodedData.RawData; - } - - // internal stuff - - internal void Decode (byte[] attribute) - { - // Only UTCTIME is supported by FX 2.0 - if (attribute [0] != 0x17) - throw new CryptographicException (Locale.GetText ("Only UTCTIME is supported.")); - - ASN1 attr = new ASN1 (attribute); - byte[] value = attr.Value; - string date = Encoding.ASCII.GetString (value, 0, value.Length - 1); - _signingTime = DateTime.ParseExact (date, "yyMMddHHmmss", null); - } - - internal byte[] Encode () - { - if (_signingTime.Year <= 1600) - throw new ArgumentOutOfRangeException ("<= 1600"); - // Only UTCTIME is supported by FX 2.0 - if ((_signingTime.Year < 1950) || (_signingTime.Year >= 2050)) - throw new CryptographicException ("[1950,2049]"); - - string date = _signingTime.ToString ("yyMMddHHmmss", CultureInfo.InvariantCulture) + "Z"; - ASN1 attr = new ASN1 (0x17, Encoding.ASCII.GetBytes (date)); - return attr.GetBytes (); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/PublicKeyInfo.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/PublicKeyInfo.cs deleted file mode 100644 index 3f9d554e2d..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/PublicKeyInfo.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// PublicKeyInfo.cs - System.Security.Cryptography.Pkcs.PublicKeyInfo -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class PublicKeyInfo { - - private AlgorithmIdentifier _algorithm; - private byte[] _key; - - // constructors - - // only used in KeyAgreeRecipientInfo.OriginatorIdentifierOrKey.Value - // when SubjectIdentifierOrKeyType == PublicKeyInfo - internal PublicKeyInfo (AlgorithmIdentifier algorithm, byte[] key) - { - _algorithm = algorithm; - _key = key; - } - - // properties - - public AlgorithmIdentifier Algorithm { - get { return _algorithm; } - } - - public byte[] KeyValue { - get { return _key; } - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfo.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfo.cs deleted file mode 100644 index eecbcc5ffc..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// RecipientInfo.cs - System.Security.Cryptography.Pkcs.RecipientInfo -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System; - -namespace System.Security.Cryptography.Pkcs { - - public abstract class RecipientInfo { - - private RecipientInfoType _type; - - // constructors - - // documented as protected at http://longhorn.msdn.microsoft.com - // but not present in the 1.2 beta SDK - internal RecipientInfo (RecipientInfoType recipInfoType) - { - _type = recipInfoType; - } - - // properties - - public abstract byte[] EncryptedKey { get; } - - public abstract AlgorithmIdentifier KeyEncryptionAlgorithm { get; } - - public abstract SubjectIdentifier RecipientIdentifier { get; } - - public RecipientInfoType Type { - get { return _type; } - } - - public abstract int Version { get; } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoCollection.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoCollection.cs deleted file mode 100644 index 631e38653f..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoCollection.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -// RecipientInfoCollection.cs - System.Security.Cryptography.Pkcs.RecipientInfoCollection -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System; -using System.Collections; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class RecipientInfoCollection : ICollection { - - private ArrayList _list; - - // only accessible from EnvelopedPkcs7.RecipientInfos - internal RecipientInfoCollection () - { - _list = new ArrayList (); - } - - // properties - - public int Count { - get { return _list.Count; } - } - - public bool IsSynchronized { - get { return _list.IsSynchronized; } - } - - public RecipientInfo this [int index] { - get { return (RecipientInfo) _list [index]; } - } - - public object SyncRoot { - get { return _list.SyncRoot; } - } - - // methods - - internal int Add (RecipientInfo ri) - { - return _list.Add (ri); - } - - public void CopyTo (Array array, int index) - { - _list.CopyTo (array, index); - } - - public void CopyTo (RecipientInfo[] array, int index) - { - _list.CopyTo (array, index); - } - - public RecipientInfoEnumerator GetEnumerator () - { - return new RecipientInfoEnumerator (_list); - } - - IEnumerator IEnumerable.GetEnumerator () - { - return new RecipientInfoEnumerator (_list); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoEnumerator.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoEnumerator.cs deleted file mode 100644 index 2735c3172d..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoEnumerator.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// RecipientInfoEnumerator.cs - System.Security.Cryptography.Pkcs.RecipientInfoEnumerator -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System; -using System.Collections; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class RecipientInfoEnumerator : IEnumerator { - - private IEnumerator enumerator; - - // constructors - - internal RecipientInfoEnumerator (IEnumerable enumerable) - { - enumerator = enumerable.GetEnumerator (); - } - - // properties - - public RecipientInfo Current { - get { return (RecipientInfo) enumerator.Current; } - } - - object IEnumerator.Current { - get { return enumerator.Current; } - } - - // methods - - public bool MoveNext () - { - return enumerator.MoveNext (); - } - - public void Reset () - { - enumerator.Reset (); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoType.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoType.cs deleted file mode 100644 index e9d5f2f215..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoType.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -// RecipientInfoType.cs - System.Security.Cryptography.Pkcs.RecipientInfoType -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; - -namespace System.Security.Cryptography.Pkcs { - - public enum RecipientInfoType { - Unknown, - KeyTransport, - KeyAgreement - } -} - diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedCms.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedCms.cs deleted file mode 100644 index 0dbbbdabad..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedCms.cs +++ /dev/null @@ -1,305 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.SignedCms class -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Security.Cryptography.X509Certificates; -using System.Security.Cryptography.Xml; -using System.Text; - -using Mono.Security; -using Mono.Security.X509; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class SignedCms { - - private ContentInfo _content; - private bool _detached; - private SignerInfoCollection _info; - private X509Certificate2Collection _certs; - private SubjectIdentifierType _type; - private int _version; - - // constructors - - public SignedCms () - { - _certs = new X509Certificate2Collection (); - _info = new SignerInfoCollection (); - } - - public SignedCms (ContentInfo contentInfo) - : this (contentInfo, false) - { - } - - public SignedCms (ContentInfo contentInfo, bool detached) - : this () - { - if (contentInfo == null) - throw new ArgumentNullException ("contentInfo"); - - _content = contentInfo; - _detached = detached; - } - - public SignedCms (SubjectIdentifierType signerIdentifierType) : this () - { - _type = signerIdentifierType; - } - - public SignedCms (SubjectIdentifierType signerIdentifierType, ContentInfo contentInfo) - : this (contentInfo, false) - { - _type = signerIdentifierType; - } - - public SignedCms (SubjectIdentifierType signerIdentifierType, ContentInfo contentInfo, bool detached) - : this (contentInfo, detached) - { - _type = signerIdentifierType; - } - - // properties - - public X509Certificate2Collection Certificates { - get { return _certs; } - } - - public ContentInfo ContentInfo { - get { - if (_content == null) { - Oid oid = new Oid (PKCS7.Oid.data); - _content = new ContentInfo (oid, new byte [0]); - } - return _content; - } - } - - public bool Detached { - get { return _detached; } - } - - public SignerInfoCollection SignerInfos { - get { return _info; } - } - - public int Version { - get { return _version; } - } - - // methods - - [MonoTODO] - public void CheckSignature (bool verifySignatureOnly) - { - foreach (SignerInfo si in _info) { - si.CheckSignature (verifySignatureOnly); - } - } - - [MonoTODO] - public void CheckSignature (X509Certificate2Collection extraStore, bool verifySignatureOnly) - { - foreach (SignerInfo si in _info) { - si.CheckSignature (extraStore, verifySignatureOnly); - } - } - - [MonoTODO] - public void CheckHash () - { - throw new InvalidOperationException (""); - } - - [MonoTODO] - public void ComputeSignature () - { - throw new CryptographicException (""); - } - - [MonoTODO] - public void ComputeSignature (CmsSigner signer) - { - ComputeSignature (); - } - - [MonoTODO] - public void ComputeSignature (CmsSigner signer, bool silent) - { - ComputeSignature (); - } - - private string ToString (byte[] array, bool reverse) - { - StringBuilder sb = new StringBuilder (); - if (reverse) { - for (int i=array.Length - 1; i >= 0; i--) - sb.Append (array [i].ToString ("X2")); - } else { - for (int i=0; i < array.Length; i++) - sb.Append (array [i].ToString ("X2")); - } - return sb.ToString (); - } - - private byte[] GetKeyIdentifier (Mono.Security.X509.X509Certificate x509) - { - // if present in certificate return value of the SubjectKeyIdentifier - Mono.Security.X509.X509Extension extn = x509.Extensions ["2.5.29.14"]; - if (extn != null) { - ASN1 bs = new ASN1 (extn.Value.Value); - return bs.Value; - } - // strangely DEPRECATED keyAttributes isn't used here (like KeyUsage) - - // if not then we must calculate the SubjectKeyIdentifier ourselve - // Note: MS does that hash on the complete subjectPublicKeyInfo (unlike PKIX) - // http://groups.google.ca/groups?selm=e7RqM%24plCHA.1488%40tkmsftngp02&oe=UTF-8&output=gplain - ASN1 subjectPublicKeyInfo = new ASN1 (0x30); - ASN1 algo = subjectPublicKeyInfo.Add (new ASN1 (0x30)); - algo.Add (new ASN1 (CryptoConfig.EncodeOID (x509.KeyAlgorithm))); - // FIXME: does it work for DSA certs (without an 2.5.29.14 extension ?) - algo.Add (new ASN1 (x509.KeyAlgorithmParameters)); - byte[] pubkey = x509.PublicKey; - byte[] bsvalue = new byte [pubkey.Length + 1]; // add unused bits (0) before the public key - Array.Copy (pubkey, 0, bsvalue, 1, pubkey.Length); - subjectPublicKeyInfo.Add (new ASN1 (0x03, bsvalue)); - SHA1 sha = SHA1.Create (); - return sha.ComputeHash (subjectPublicKeyInfo.GetBytes ()); - } - - [MonoTODO("incomplete - missing attributes")] - public void Decode (byte[] encodedMessage) - { - PKCS7.ContentInfo ci = new PKCS7.ContentInfo (encodedMessage); - if (ci.ContentType != PKCS7.Oid.signedData) - throw new Exception (""); - - PKCS7.SignedData sd = new PKCS7.SignedData (ci.Content); - SubjectIdentifierType type = SubjectIdentifierType.Unknown; - object o = null; - - X509Certificate2 x509 = null; - if (sd.SignerInfo.Certificate != null) { - x509 = new X509Certificate2 (sd.SignerInfo.Certificate.RawData); - } - else if ((sd.SignerInfo.IssuerName != null) && (sd.SignerInfo.SerialNumber != null)) { - byte[] serial = sd.SignerInfo.SerialNumber; - Array.Reverse (serial); // ??? - type = SubjectIdentifierType.IssuerAndSerialNumber; - X509IssuerSerial xis = new X509IssuerSerial (); - xis.IssuerName = sd.SignerInfo.IssuerName; - xis.SerialNumber = ToString (serial, true); - o = xis; - // TODO: move to a FindCertificate (issuer, serial, collection) - foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) { - if (x.IssuerName == sd.SignerInfo.IssuerName) { - if (ToString (x.SerialNumber, true) == xis.SerialNumber) { - x509 = new X509Certificate2 (x.RawData); - break; - } - } - } - } - else if (sd.SignerInfo.SubjectKeyIdentifier != null) { - string ski = ToString (sd.SignerInfo.SubjectKeyIdentifier, false); - type = SubjectIdentifierType.SubjectKeyIdentifier; - o = (object) ski; - // TODO: move to a FindCertificate (ski, collection) - foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) { - if (ToString (GetKeyIdentifier (x), false) == ski) { - x509 = new X509Certificate2 (x.RawData); - break; - } - } - } - - SignerInfo si = new SignerInfo (sd.SignerInfo.HashName, x509, type, o, sd.SignerInfo.Version); - // si.AuthenticatedAttributes - // si.UnauthenticatedAttributes - _info.Add (si); - - ASN1 content = sd.ContentInfo.Content; - Oid oid = new Oid (sd.ContentInfo.ContentType); - - if (!_detached || _content == null) { - if (content[0] == null) - throw new ArgumentException ("ContentInfo has no content. Detached signature ?"); - - _content = new ContentInfo (oid, content[0].Value); - } - - foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) { - _certs.Add (new X509Certificate2 (x.RawData)); - } - - _version = sd.Version; - } - - [MonoTODO] - public byte[] Encode () - { -/* Mono.Security.X509.X509Certificate x509 = null; - Cms.SignerInfo si = new Cms.SignerInfo (); - switch (_type) { - case SubjectIdentifierType.SubjectKeyIdentifier: - si.SubjectKeyIdentifier = GetKeyIdentifier (x509); - break; - default: - // SubjectIdentifierType.IssuerAndSerialNumber - si.IssuerName = x509.IssuerName; - si.SerialNumber = x509.SerialNumber; - break; - } - - Cms.SignedData sd = new Cms.SignedData (); - sd.Version = _version; - sd.SignerInfo = si; - - Cms.ContentInfo ci = new Cms.ContentInfo (Cms.signedData); - ci.Content = sd.ASN1; - return ci.GetBytes ();*/ - return null; - } - - [MonoTODO] - public void RemoveSignature (SignerInfo signerInfo) - { - } - - [MonoTODO] - public void RemoveSignature (int index) - { - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfo.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfo.cs deleted file mode 100644 index 2cf71a1de9..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfo.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.SignerInfo class -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Security.Cryptography.X509Certificates; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class SignerInfo { - - private SubjectIdentifier _signer; - private X509Certificate2 _certificate; - private Oid _digest; - private SignerInfoCollection _counter; - private CryptographicAttributeObjectCollection _signed; - private CryptographicAttributeObjectCollection _unsigned; - private int _version; - - // only accessible from SignedPkcs7.SignerInfos - internal SignerInfo (string hashName, X509Certificate2 certificate, SubjectIdentifierType type, object o, int version) - { - _digest = new Oid (CryptoConfig.MapNameToOID (hashName) ?? hashName); - _certificate = certificate; - _counter = new SignerInfoCollection (); - _signed = new CryptographicAttributeObjectCollection (); - _unsigned = new CryptographicAttributeObjectCollection (); - _signer = new SubjectIdentifier (type, o); - _version = version; - } - - // properties - - public CryptographicAttributeObjectCollection SignedAttributes { - get { return _signed; } - } - - public X509Certificate2 Certificate { - get { return _certificate; } - } - - public SignerInfoCollection CounterSignerInfos { - get { return _counter; } - } - - public Oid DigestAlgorithm { - get { return _digest; } - } - - public SubjectIdentifier SignerIdentifier { - get { return _signer; } - } - - public CryptographicAttributeObjectCollection UnsignedAttributes { - get { return _unsigned; } - } - - public int Version { - get { return _version; } - } - - // methods - - [MonoTODO] - public void CheckHash () - { - } - - [MonoTODO] - public void CheckSignature (bool verifySignatureOnly) - { - } - - [MonoTODO] - public void CheckSignature (X509Certificate2Collection extraStore, bool verifySignatureOnly) - { - } - - [MonoTODO] - public void ComputeCounterSignature () - { - } - - [MonoTODO] - public void ComputeCounterSignature (CmsSigner signer) - { - } - - [MonoTODO] - public void RemoveCounterSignature (SignerInfo counterSignerInfo) - { - } - - [MonoTODO] - public void RemoveCounterSignature (int index) - { - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoCollection.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoCollection.cs deleted file mode 100644 index 2f53b3f0db..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoCollection.cs +++ /dev/null @@ -1,103 +0,0 @@ -// -// SignerInfoCollection.cs - System.Security.Cryptography.Pkcs.SignerInfoCollection -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Collections; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class SignerInfoCollection : ICollection { - - private ArrayList _list; - - // only accessible from SignedPkcs7.SignerInfos or SignerInfo.CounterSignerInfos - internal SignerInfoCollection () - { - _list = new ArrayList (); - } - - // properties - - public int Count { - get { return _list.Count; } - } - - public bool IsSynchronized { - get { return false; } // as documented - } - - public SignerInfo this [int index] { - get { return (SignerInfo) _list [index]; } - } - - public object SyncRoot { - get { return _list.SyncRoot; } - } - - // methods - - internal void Add (SignerInfo signer) - { - _list.Add (signer); - } - - public void CopyTo (Array array, int index) - { - if (array == null) - throw new ArgumentNullException ("array"); - if ((index < 0) || (index >= array.Length)) - throw new ArgumentOutOfRangeException ("index"); - - _list.CopyTo (array, index); - } - - public void CopyTo (SignerInfo[] array, int index) - { - if (array == null) - throw new ArgumentNullException ("array"); - if ((index < 0) || (index >= array.Length)) - throw new ArgumentOutOfRangeException ("index"); - - _list.CopyTo (array, index); - } - - public SignerInfoEnumerator GetEnumerator () - { - return new SignerInfoEnumerator (_list); - } - - IEnumerator IEnumerable.GetEnumerator () - { - return new SignerInfoEnumerator (_list); - } - } -} - -#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifier.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifier.cs deleted file mode 100644 index fff45915be..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifier.cs +++ /dev/null @@ -1,57 +0,0 @@ -// -// SubjectIdentifier.cs - System.Security.Cryptography.Pkcs.SubjectIdentifier -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class SubjectIdentifier { - - private SubjectIdentifierType _type; - private object _value; - - internal SubjectIdentifier (SubjectIdentifierType type, object value) - { - _type = type; - _value = value; - } - - // properties - - public SubjectIdentifierType Type { - get { return _type; } - } - - public object Value { - get { return _value; } - } - } -} - diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs deleted file mode 100644 index 1cfc1868ef..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// SubjectIdentifierOrKeyType.cs - System.Security.Cryptography.Pkcs.SubjectIdentifierOrKeyType -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; - -namespace System.Security.Cryptography.Pkcs { - - public enum SubjectIdentifierOrKeyType { - Unknown, - IssuerAndSerialNumber, - SubjectKeyIdentifier, - PublicKeyInfo - } -} - diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs deleted file mode 100644 index 758e3e11e4..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// System.Security.Cryptography.Pkcs.SubjectIdentifierType -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -namespace System.Security.Cryptography.Pkcs { - - public enum SubjectIdentifierType { - Unknown, - IssuerAndSerialNumber, - SubjectKeyIdentifier, - NoSignature - } -} - diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs deleted file mode 100644 index 495c0afee0..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs +++ /dev/null @@ -1,1049 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security.Cryptography.X509Certificates; -using System.Xml; - -namespace System.Security.Cryptography.Xml { - public class SignedXml { - /// - protected Signature m_signature; - /// - protected string m_strSigningKeyName; - - private AsymmetricAlgorithm _signingKey; - private XmlDocument _containingDocument; - private IEnumerator _keyInfoEnum; - private X509Certificate2Collection _x509Collection; - private IEnumerator _x509Enum; - - private bool[] _refProcessed; - private int[] _refLevelCache; - - internal XmlResolver _xmlResolver; - internal XmlElement _context; - private bool _bResolverSet; - - private Func _signatureFormatValidator = DefaultSignatureFormatValidator; - private Collection _safeCanonicalizationMethods; - - // Built in canonicalization algorithm URIs - private static IList s_knownCanonicalizationMethods; - // Built in transform algorithm URIs (excluding canonicalization URIs) - private static IList s_defaultSafeTransformMethods; - - // additional HMAC Url identifiers - private const string XmlDsigMoreHMACMD5Url = "http://www.w3.org/2001/04/xmldsig-more#hmac-md5"; - private const string XmlDsigMoreHMACSHA256Url = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256"; - private const string XmlDsigMoreHMACSHA384Url = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384"; - private const string XmlDsigMoreHMACSHA512Url = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512"; - private const string XmlDsigMoreHMACRIPEMD160Url = "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160"; - - // defines the XML encryption processing rules - private EncryptedXml _exml; - - // - // public constant Url identifiers most frequently used within the XML Signature classes - // - - public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#"; - public const string XmlDsigMinimalCanonicalizationUrl = "http://www.w3.org/2000/09/xmldsig#minimal"; - public const string XmlDsigCanonicalizationUrl = XmlDsigC14NTransformUrl; - public const string XmlDsigCanonicalizationWithCommentsUrl = XmlDsigC14NWithCommentsTransformUrl; - - public const string XmlDsigSHA1Url = "http://www.w3.org/2000/09/xmldsig#sha1"; - public const string XmlDsigDSAUrl = "http://www.w3.org/2000/09/xmldsig#dsa-sha1"; - public const string XmlDsigRSASHA1Url = "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; - public const string XmlDsigHMACSHA1Url = "http://www.w3.org/2000/09/xmldsig#hmac-sha1"; - - public const string XmlDsigSHA256Url = "http://www.w3.org/2001/04/xmlenc#sha256"; - public const string XmlDsigRSASHA256Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"; - - // Yes, SHA384 is in the xmldsig-more namespace even though all the other SHA variants are in xmlenc. That's the standard. - public const string XmlDsigSHA384Url = "http://www.w3.org/2001/04/xmldsig-more#sha384"; - public const string XmlDsigRSASHA384Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384"; - - public const string XmlDsigSHA512Url = "http://www.w3.org/2001/04/xmlenc#sha512"; - public const string XmlDsigRSASHA512Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"; - - internal static readonly string XmlDsigDigestDefault = XmlDsigSHA256Url; - internal static readonly string XmlDsigRSADefault = XmlDsigRSASHA256Url; - - public const string XmlDsigC14NTransformUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; - public const string XmlDsigC14NWithCommentsTransformUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"; - public const string XmlDsigExcC14NTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#"; - public const string XmlDsigExcC14NWithCommentsTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments"; - public const string XmlDsigBase64TransformUrl = "http://www.w3.org/2000/09/xmldsig#base64"; - public const string XmlDsigXPathTransformUrl = "http://www.w3.org/TR/1999/REC-xpath-19991116"; - public const string XmlDsigXsltTransformUrl = "http://www.w3.org/TR/1999/REC-xslt-19991116"; - public const string XmlDsigEnvelopedSignatureTransformUrl = "http://www.w3.org/2000/09/xmldsig#enveloped-signature"; - public const string XmlDecryptionTransformUrl = "http://www.w3.org/2002/07/decrypt#XML"; - public const string XmlLicenseTransformUrl = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform"; - - // - // public constructors - // - - public SignedXml () - { - Initialize (null); - } - - public SignedXml (XmlDocument document) - { - if (document == null) - throw new ArgumentNullException (nameof (document)); - - Initialize (document.DocumentElement); - } - - public SignedXml (XmlElement elem) - { - if (elem == null) - throw new ArgumentNullException (nameof (elem)); - - Initialize (elem); - } - - private void Initialize (XmlElement element) - { - _containingDocument = (element == null ? null : element.OwnerDocument); - _context = element; - m_signature = new Signature (); - m_signature.SignedXml = this; - m_signature.SignedInfo = new SignedInfo (); - _signingKey = null; - - _safeCanonicalizationMethods = new Collection (KnownCanonicalizationMethods); - } - - // - // public properties - // - - /// - public string SigningKeyName - { - get { return m_strSigningKeyName; } - set { m_strSigningKeyName = value; } - } - - public XmlResolver Resolver - { - // This property only has a setter. The rationale for this is that we don't have a good value - // to return when it has not been explicitely set, as we are using XmlSecureResolver by default - set - { - _xmlResolver = value; - _bResolverSet = true; - } - } - - internal bool ResolverSet - { - get { return _bResolverSet; } - } - - public Func SignatureFormatValidator - { - get { return _signatureFormatValidator; } - set { _signatureFormatValidator = value; } - } - - public Collection SafeCanonicalizationMethods - { - get { return _safeCanonicalizationMethods; } - } - - public AsymmetricAlgorithm SigningKey - { - get { return _signingKey; } - set { _signingKey = value; } - } - - public EncryptedXml EncryptedXml - { - get - { - if (_exml == null) - _exml = new EncryptedXml (_containingDocument); // default processing rules - - return _exml; - } - - set { _exml = value; } - } - - public Signature Signature - { - get { return m_signature; } - } - - public SignedInfo SignedInfo - { - get { return m_signature.SignedInfo; } - } - - public string SignatureMethod - { - get { return m_signature.SignedInfo.SignatureMethod; } - } - - public string SignatureLength - { - get { return m_signature.SignedInfo.SignatureLength; } - } - - public byte[] SignatureValue - { - get { return m_signature.SignatureValue; } - } - - public KeyInfo KeyInfo - { - get { return m_signature.KeyInfo; } - set { m_signature.KeyInfo = value; } - } - - public XmlElement GetXml () - { - // If we have a document context, then return a signature element in this context - if (_containingDocument != null) - return m_signature.GetXml (_containingDocument); - else - return m_signature.GetXml (); - } - - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException (nameof (value)); - - m_signature.LoadXml (value); - - if (_context == null) - _context = value; - - _bCacheValid = false; - } - - // - // public methods - // - - public void AddReference (Reference reference) - { - m_signature.SignedInfo.AddReference (reference); - } - - public void AddObject (DataObject dataObject) - { - m_signature.AddObject (dataObject); - } - - public bool CheckSignature () - { - AsymmetricAlgorithm signingKey; - return CheckSignatureReturningKey (out signingKey); - } - - public bool CheckSignatureReturningKey (out AsymmetricAlgorithm signingKey) - { - SignedXmlDebugLog.LogBeginSignatureVerification (this, _context); - - signingKey = null; - bool bRet = false; - AsymmetricAlgorithm key = null; - - if (!CheckSignatureFormat ()) - return false; - - do { - key = GetPublicKey (); - if (key != null) { - bRet = CheckSignature (key); - SignedXmlDebugLog.LogVerificationResult (this, key, bRet); - } - } while (key != null && bRet == false); - - signingKey = key; - return bRet; - } - - public bool CheckSignature (AsymmetricAlgorithm key) - { - if (!CheckSignatureFormat ()) - return false; - - if (!CheckSignedInfo (key)) { - SignedXmlDebugLog.LogVerificationFailure (this, SR.Log_VerificationFailed_SignedInfo); - return false; - } - - // Now is the time to go through all the references and see if their DigestValues are good - if (!CheckDigestedReferences ()) { - SignedXmlDebugLog.LogVerificationFailure (this, SR.Log_VerificationFailed_References); - return false; - } - - SignedXmlDebugLog.LogVerificationResult (this, key, true); - return true; - } - - public bool CheckSignature (KeyedHashAlgorithm macAlg) - { - if (!CheckSignatureFormat ()) - return false; - - if (!CheckSignedInfo (macAlg)) { - SignedXmlDebugLog.LogVerificationFailure (this, SR.Log_VerificationFailed_SignedInfo); - return false; - } - - if (!CheckDigestedReferences ()) { - SignedXmlDebugLog.LogVerificationFailure (this, SR.Log_VerificationFailed_References); - return false; - } - - SignedXmlDebugLog.LogVerificationResult (this, macAlg, true); - return true; - } - - public bool CheckSignature (X509Certificate2 certificate, bool verifySignatureOnly) - { - if (!verifySignatureOnly) { - // Check key usages to make sure it is good for signing. - foreach (X509Extension extension in certificate.Extensions) { - if (string.Compare (extension.Oid.Value, "2.5.29.15" /* szOID_KEY_USAGE */, StringComparison.OrdinalIgnoreCase) == 0) { - X509KeyUsageExtension keyUsage = new X509KeyUsageExtension (); - keyUsage.CopyFrom (extension); - SignedXmlDebugLog.LogVerifyKeyUsage (this, certificate, keyUsage); - - bool validKeyUsage = (keyUsage.KeyUsages & X509KeyUsageFlags.DigitalSignature) != 0 || - (keyUsage.KeyUsages & X509KeyUsageFlags.NonRepudiation) != 0; - - if (!validKeyUsage) { - SignedXmlDebugLog.LogVerificationFailure (this, SR.Log_VerificationFailed_X509KeyUsage); - return false; - } - break; - } - } - - // Do the chain verification to make sure the certificate is valid. - X509Chain chain = new X509Chain (); - chain.ChainPolicy.ExtraStore.AddRange (BuildBagOfCerts()); - bool chainVerified = chain.Build (certificate); - SignedXmlDebugLog.LogVerifyX509Chain (this, chain, certificate); - - if (!chainVerified) { - SignedXmlDebugLog.LogVerificationFailure (this, SR.Log_VerificationFailed_X509Chain); - return false; - } - } - - using (AsymmetricAlgorithm publicKey = Utils.GetAnyPublicKey (certificate)) { - if (!CheckSignature (publicKey)) - return false; - } - - SignedXmlDebugLog.LogVerificationResult (this, certificate, true); - return true; - } - - public void ComputeSignature () - { - SignedXmlDebugLog.LogBeginSignatureComputation (this, _context); - - BuildDigestedReferences (); - - // Load the key - AsymmetricAlgorithm key = SigningKey; - - if (key == null) - throw new CryptographicException (SR.Cryptography_Xml_LoadKeyFailed); - - // Check the signature algorithm associated with the key so that we can accordingly set the signature method - if (SignedInfo.SignatureMethod == null) { - if (key is DSA) { - SignedInfo.SignatureMethod = XmlDsigDSAUrl; - } else if (key is RSA) { - if (SignedInfo.SignatureMethod == null) - SignedInfo.SignatureMethod = XmlDsigRSADefault; - } else { - throw new CryptographicException (SR.Cryptography_Xml_CreatedKeyFailed); - } - } - - // See if there is a signature description class defined in the Config file - SignatureDescription signatureDescription = CryptoHelpers.CreateFromName (SignedInfo.SignatureMethod); - if (signatureDescription == null) - throw new CryptographicException (SR.Cryptography_Xml_SignatureDescriptionNotCreated); - HashAlgorithm hashAlg = signatureDescription.CreateDigest (); - if (hashAlg == null) - throw new CryptographicException (SR.Cryptography_Xml_CreateHashAlgorithmFailed); - byte[] hashvalue = GetC14NDigest (hashAlg); - AsymmetricSignatureFormatter asymmetricSignatureFormatter = signatureDescription.CreateFormatter (key); - - SignedXmlDebugLog.LogSigning (this, key, signatureDescription, hashAlg, asymmetricSignatureFormatter); - m_signature.SignatureValue = asymmetricSignatureFormatter.CreateSignature (hashAlg); - } - - public void ComputeSignature (KeyedHashAlgorithm macAlg) - { - if (macAlg == null) - throw new ArgumentNullException (nameof (macAlg)); - - HMAC hash = macAlg as HMAC; - if (hash == null) - throw new CryptographicException (SR.Cryptography_Xml_SignatureMethodKeyMismatch); - - int signatureLength; - if (m_signature.SignedInfo.SignatureLength == null) - signatureLength = hash.HashSize; - else - signatureLength = Convert.ToInt32 (m_signature.SignedInfo.SignatureLength, null); - // signatureLength should be less than hash size - if (signatureLength < 0 || signatureLength > hash.HashSize) - throw new CryptographicException (SR.Cryptography_Xml_InvalidSignatureLength); - if (signatureLength % 8 != 0) - throw new CryptographicException (SR.Cryptography_Xml_InvalidSignatureLength2); - - BuildDigestedReferences (); - switch (hash.HashName) { - case "SHA1": - SignedInfo.SignatureMethod = SignedXml.XmlDsigHMACSHA1Url; - break; - case "SHA256": - SignedInfo.SignatureMethod = SignedXml.XmlDsigMoreHMACSHA256Url; - break; - case "SHA384": - SignedInfo.SignatureMethod = SignedXml.XmlDsigMoreHMACSHA384Url; - break; - case "SHA512": - SignedInfo.SignatureMethod = SignedXml.XmlDsigMoreHMACSHA512Url; - break; - case "MD5": - SignedInfo.SignatureMethod = SignedXml.XmlDsigMoreHMACMD5Url; - break; - case "RIPEMD160": - SignedInfo.SignatureMethod = SignedXml.XmlDsigMoreHMACRIPEMD160Url; - break; - default: - throw new CryptographicException (SR.Cryptography_Xml_SignatureMethodKeyMismatch); - } - - byte[] hashValue = GetC14NDigest (hash); - - SignedXmlDebugLog.LogSigning (this, hash); - m_signature.SignatureValue = new byte [signatureLength / 8]; - Buffer.BlockCopy (hashValue, 0, m_signature.SignatureValue, 0, signatureLength / 8); - } - - // - // virtual methods - // - - protected virtual AsymmetricAlgorithm GetPublicKey () - { - if (KeyInfo == null) - throw new CryptographicException (SR.Cryptography_Xml_KeyInfoRequired); - - if (_x509Enum != null) { - AsymmetricAlgorithm key = GetNextCertificatePublicKey (); - if (key != null) - return key; - } - - if (_keyInfoEnum == null) - _keyInfoEnum = KeyInfo.GetEnumerator (); - - // In our implementation, we move to the next KeyInfo clause which is an RSAKeyValue, DSAKeyValue or KeyInfoX509Data - while (_keyInfoEnum.MoveNext()) { - RSAKeyValue rsaKeyValue = _keyInfoEnum.Current as RSAKeyValue; - if (rsaKeyValue != null) - return rsaKeyValue.Key; - - DSAKeyValue dsaKeyValue = _keyInfoEnum.Current as DSAKeyValue; - if (dsaKeyValue != null) - return dsaKeyValue.Key; - - KeyInfoX509Data x509Data = _keyInfoEnum.Current as KeyInfoX509Data; - if (x509Data != null) { - _x509Collection = Utils.BuildBagOfCerts (x509Data, CertUsageType.Verification); - if (_x509Collection.Count > 0) { - _x509Enum = _x509Collection.GetEnumerator (); - AsymmetricAlgorithm key = GetNextCertificatePublicKey (); - if (key != null) - return key; - } - } - } - - return null; - } - - private X509Certificate2Collection BuildBagOfCerts () - { - X509Certificate2Collection collection = new X509Certificate2Collection (); - if (KeyInfo != null) { - foreach (KeyInfoClause clause in KeyInfo) { - KeyInfoX509Data x509Data = clause as KeyInfoX509Data; - if (x509Data != null) - collection.AddRange (Utils.BuildBagOfCerts (x509Data, CertUsageType.Verification)); - } - } - - return collection; - } - - private AsymmetricAlgorithm GetNextCertificatePublicKey () - { - while (_x509Enum.MoveNext ()) { - X509Certificate2 certificate = (X509Certificate2)_x509Enum.Current; - if (certificate != null) - return Utils.GetAnyPublicKey (certificate); - } - - return null; - } - - public virtual XmlElement GetIdElement (XmlDocument document, string idValue) - { - return DefaultGetIdElement (document, idValue); - } - - internal static XmlElement DefaultGetIdElement (XmlDocument document, string idValue) - { - if (document == null) - return null; - - try { - XmlConvert.VerifyNCName (idValue); - } catch (XmlException) { - // Identifiers are required to be an NCName - // (xml:id version 1.0, part 4, paragraph 2, bullet 1) - // - // If it isn't an NCName, it isn't allowed to match. - return null; - } - - // Get the element with idValue - XmlElement elem = document.GetElementById (idValue); - - if (elem != null) { - // Have to check for duplicate ID values from the DTD. - - XmlDocument docClone = (XmlDocument)document.CloneNode (true); - XmlElement cloneElem = docClone.GetElementById (idValue); - - // If it's null here we want to know about it, because it means that - // GetElementById failed to work across the cloning, and our uniqueness - // test is invalid. - System.Diagnostics.Debug.Assert (cloneElem != null); - - // Guard against null anyways - if (cloneElem != null) { - cloneElem.Attributes.RemoveAll (); - - XmlElement cloneElem2 = docClone.GetElementById (idValue); - - if (cloneElem2 != null) - throw new CryptographicException (SR.Cryptography_Xml_InvalidReference); - } - - return elem; - } - - elem = GetSingleReferenceTarget (document, "Id", idValue); - if (elem != null) - return elem; - elem = GetSingleReferenceTarget (document, "id", idValue); - if (elem != null) - return elem; - elem = GetSingleReferenceTarget (document, "ID", idValue); - - return elem; - } - - // - // private methods - // - - private bool _bCacheValid; - private byte[] _digestedSignedInfo; - - private static bool DefaultSignatureFormatValidator (SignedXml signedXml) - { - // Reject the signature if it uses a truncated HMAC - if (signedXml.DoesSignatureUseTruncatedHmac ()) - return false; - - // Reject the signature if it uses a canonicalization algorithm other than - // one of the ones explicitly allowed - if (!signedXml.DoesSignatureUseSafeCanonicalizationMethod ()) - return false; - - // Otherwise accept it - return true; - } - - // Validation function to see if the current signature is signed with a truncated HMAC - one which - // has a signature length of fewer bits than the whole HMAC output. - private bool DoesSignatureUseTruncatedHmac () - { - // If we're not using the SignatureLength property, then we're not truncating the signature length - if (SignedInfo.SignatureLength == null) - return false; - - // See if we're signed witn an HMAC algorithm - HMAC hmac = CryptoHelpers.CreateFromName (SignatureMethod); - if (hmac == null) - return false; // We aren't signed with an HMAC algorithm, so we cannot have a truncated HMAC - - // Figure out how many bits the signature is using - int actualSignatureSize = 0; - if (!int.TryParse (SignedInfo.SignatureLength, out actualSignatureSize)) - return true; // If the value wasn't a valid integer, then we'll conservatively reject it all together - - // Make sure the full HMAC signature size is the same size that was specified in the XML - // signature. If the actual signature size is not exactly the same as the full HMAC size, then - // reject the signature. - return actualSignatureSize != hmac.HashSize; - } - - // Validation function to see if the signature uses a canonicalization algorithm from our list - // of approved algorithm URIs. - private bool DoesSignatureUseSafeCanonicalizationMethod () - { - foreach (string safeAlgorithm in SafeCanonicalizationMethods) { - if (string.Equals (safeAlgorithm, SignedInfo.CanonicalizationMethod, StringComparison.OrdinalIgnoreCase)) - return true; - } - - SignedXmlDebugLog.LogUnsafeCanonicalizationMethod (this, SignedInfo.CanonicalizationMethod, SafeCanonicalizationMethods); - return false; - } - - private bool ReferenceUsesSafeTransformMethods (Reference reference) - { - TransformChain transformChain = reference.TransformChain; - int transformCount = transformChain.Count; - - for (int i = 0; i < transformCount; i++) { - Transform transform = transformChain [i]; - - if (!IsSafeTransform (transform.Algorithm)) - return false; - } - - return true; - } - - private bool IsSafeTransform (string transformAlgorithm) - { - // All canonicalization algorithms are valid transform algorithms. - foreach (string safeAlgorithm in SafeCanonicalizationMethods) { - if (string.Equals (safeAlgorithm, transformAlgorithm, StringComparison.OrdinalIgnoreCase)) - return true; - } - - foreach (string safeAlgorithm in DefaultSafeTransformMethods) { - if (string.Equals (safeAlgorithm, transformAlgorithm, StringComparison.OrdinalIgnoreCase)) - return true; - } - - SignedXmlDebugLog.LogUnsafeTransformMethod ( - this, - transformAlgorithm, - SafeCanonicalizationMethods, - DefaultSafeTransformMethods); - - return false; - } - - // Get a list of the built in canonicalization algorithms, as well as any that the machine admin has - // added to the valid set. - private static IList KnownCanonicalizationMethods { - get { - if (s_knownCanonicalizationMethods == null) { - // Start with the list that the machine admin added, if any - List safeAlgorithms = new List (); - - // Built in algorithms - safeAlgorithms.Add (XmlDsigC14NTransformUrl); - safeAlgorithms.Add (XmlDsigC14NWithCommentsTransformUrl); - safeAlgorithms.Add (XmlDsigExcC14NTransformUrl); - safeAlgorithms.Add (XmlDsigExcC14NWithCommentsTransformUrl); - - s_knownCanonicalizationMethods = safeAlgorithms; - } - - return s_knownCanonicalizationMethods; - } - } - - private static IList DefaultSafeTransformMethods { - get { - if (s_defaultSafeTransformMethods == null) { - List safeAlgorithms = new List (); - - // Built in algorithms - - // KnownCanonicalizationMethods don't need to be added here, because - // the validator will automatically accept those. - // - // xmldsig 6.6.1: - // Any canonicalization algorithm that can be used for - // CanonicalizationMethod can be used as a Transform. - safeAlgorithms.Add (XmlDsigEnvelopedSignatureTransformUrl); - safeAlgorithms.Add (XmlDsigBase64TransformUrl); - safeAlgorithms.Add (XmlLicenseTransformUrl); - safeAlgorithms.Add (XmlDecryptionTransformUrl); - - s_defaultSafeTransformMethods = safeAlgorithms; - } - - return s_defaultSafeTransformMethods; - } - } - - private byte[] GetC14NDigest (HashAlgorithm hash) - { - bool isKeyedHashAlgorithm = hash is KeyedHashAlgorithm; - if (isKeyedHashAlgorithm || !_bCacheValid || !SignedInfo.CacheValid) { - string baseUri = (_containingDocument == null ? null : _containingDocument.BaseURI); - XmlResolver resolver = (_bResolverSet ? _xmlResolver : new XmlSecureResolver (new XmlUrlResolver (), baseUri)); - XmlDocument doc = Utils.PreProcessElementInput (SignedInfo.GetXml (), resolver, baseUri); - - // Add non default namespaces in scope - CanonicalXmlNodeList namespaces = (_context == null ? null : Utils.GetPropagatedAttributes (_context)); - SignedXmlDebugLog.LogNamespacePropagation (this, namespaces); - Utils.AddNamespaces (doc.DocumentElement, namespaces); - - Transform c14nMethodTransform = SignedInfo.CanonicalizationMethodObject; - c14nMethodTransform.Resolver = resolver; - c14nMethodTransform.BaseURI = baseUri; - - SignedXmlDebugLog.LogBeginCanonicalization (this, c14nMethodTransform); - c14nMethodTransform.LoadInput (doc); - SignedXmlDebugLog.LogCanonicalizedOutput (this, c14nMethodTransform); - _digestedSignedInfo = c14nMethodTransform.GetDigestedOutput (hash); - - _bCacheValid = !isKeyedHashAlgorithm; - } - return _digestedSignedInfo; - } - - private int GetReferenceLevel (int index, ArrayList references) - { - if (_refProcessed [index]) return _refLevelCache [index]; - _refProcessed [index] = true; - Reference reference = (Reference)references [index]; - if (reference.Uri == null || reference.Uri.Length == 0 || (reference.Uri.Length > 0 && reference.Uri [0] != '#')) { - _refLevelCache [index] = 0; - return 0; - } - if (reference.Uri.Length > 0 && reference.Uri [0] == '#') - { - string idref = Utils.ExtractIdFromLocalUri (reference.Uri); - if (idref == "xpointer(/)") { - _refLevelCache [index] = 0; - return 0; - } - // If this is pointing to another reference - for (int j = 0; j < references.Count; ++j) { - if (((Reference)references [j]).Id == idref) { - _refLevelCache [index] = GetReferenceLevel (j, references) + 1; - return (_refLevelCache [index]); - } - } - // Then the reference points to an object tag - _refLevelCache [index] = 0; - return 0; - } - // Malformed reference - throw new CryptographicException (SR.Cryptography_Xml_InvalidReference); - } - - private class ReferenceLevelSortOrder : IComparer - { - private ArrayList _references; - - public ReferenceLevelSortOrder () - { - } - - public ArrayList References - { - get { return _references; } - set { _references = value; } - } - - public int Compare (object a, object b) - { - Reference referenceA = a as Reference; - Reference referenceB = b as Reference; - - // Get the indexes - int iIndexA = 0; - int iIndexB = 0; - int i = 0; - foreach (Reference reference in References) { - if (reference == referenceA) iIndexA = i; - if (reference == referenceB) iIndexB = i; - i++; - } - - int iLevelA = referenceA.SignedXml.GetReferenceLevel (iIndexA, References); - int iLevelB = referenceB.SignedXml.GetReferenceLevel (iIndexB, References); - return iLevelA.CompareTo (iLevelB); - } - } - - private void BuildDigestedReferences () - { - // Default the DigestMethod and Canonicalization - ArrayList references = SignedInfo.References; - // Reset the cache - _refProcessed = new bool [references.Count]; - _refLevelCache = new int [references.Count]; - - ReferenceLevelSortOrder sortOrder = new ReferenceLevelSortOrder (); - sortOrder.References = references; - // Don't alter the order of the references array list - ArrayList sortedReferences = new ArrayList (); - - foreach (Reference reference in references) - sortedReferences.Add (reference); - - sortedReferences.Sort (sortOrder); - - CanonicalXmlNodeList nodeList = new CanonicalXmlNodeList (); - - foreach (DataObject obj in m_signature.ObjectList) - nodeList.Add (obj.GetXml ()); - - foreach (Reference reference in sortedReferences) { - if (reference.DigestMethod == null) - reference.DigestMethod = XmlDsigDigestDefault; - - SignedXmlDebugLog.LogSigningReference (this, reference); - - reference.UpdateHashValue (_containingDocument, nodeList); - // If this reference has an Id attribute, add it - if (reference.Id != null) - nodeList.Add (reference.GetXml ()); - } - } - - private bool CheckDigestedReferences () - { - ArrayList references = m_signature.SignedInfo.References; - for (int i = 0; i < references.Count; ++i) { - Reference digestedReference = (Reference)references [i]; - - if (!ReferenceUsesSafeTransformMethods (digestedReference)) - return false; - - SignedXmlDebugLog.LogVerifyReference (this, digestedReference); - byte[] calculatedHash = null; - try { - calculatedHash = digestedReference.CalculateHashValue (_containingDocument, m_signature.ReferencedItems); - } catch (CryptoSignedXmlRecursionException) { - SignedXmlDebugLog.LogSignedXmlRecursionLimit (this, digestedReference); - return false; - } - // Compare both hashes - SignedXmlDebugLog.LogVerifyReferenceHash (this, digestedReference, calculatedHash, digestedReference.DigestValue); - - if (!CryptographicEquals (calculatedHash, digestedReference.DigestValue)) - return false; - } - - return true; - } - - // Methods _must_ be marked both No Inlining and No Optimization to be fully opted out of optimization. - // This is because if a candidate method is inlined, its method level attributes, including the NoOptimization - // attribute, are lost. - // This method makes no attempt to disguise the length of either of its inputs. It is assumed the attacker has - // knowledge of the algorithms used, and thus the output length. Length is difficult to properly blind in modern CPUs. - [MethodImpl (MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] - private static bool CryptographicEquals (byte[] a, byte[] b) - { - System.Diagnostics.Debug.Assert (a != null); - System.Diagnostics.Debug.Assert (b != null); - - int result = 0; - - // Short cut if the lengths are not identical - if (a.Length != b.Length) - return false; - - unchecked - { - // Normally this caching doesn't matter, but with the optimizer off, this nets a non-trivial speedup. - int aLength = a.Length; - - for (int i = 0; i < aLength; i++) { - // We use subtraction here instead of XOR because the XOR algorithm gets ever so - // slightly faster as more and more differences pile up. - // This cannot overflow more than once (and back to 0) because bytes are 1 byte - // in length, and result is 4 bytes. The OR propagates all set bytes, so the differences - // can't add up and overflow a second time. - result = result | (a [i] - b [i]); - } - } - - return (0 == result); - } - - // If we have a signature format validation callback, check to see if this signature's format (not - // the signature itself) is valid according to the validator. A return value of true indicates that - // the signature format is acceptable, false means that the format is not valid. - private bool CheckSignatureFormat () - { - if (_signatureFormatValidator == null) { - // No format validator means that we default to accepting the signature. (This is - // effectively compatibility mode with v3.5). - return true; - } - - SignedXmlDebugLog.LogBeginCheckSignatureFormat (this, _signatureFormatValidator); - - bool formatValid = _signatureFormatValidator (this); - SignedXmlDebugLog.LogFormatValidationResult (this, formatValid); - return formatValid; - } - - private bool CheckSignedInfo (AsymmetricAlgorithm key) - { - if (key == null) - throw new ArgumentNullException (nameof (key)); - - SignedXmlDebugLog.LogBeginCheckSignedInfo (this, m_signature.SignedInfo); - - SignatureDescription signatureDescription = CryptoHelpers.CreateFromName (SignatureMethod); - if (signatureDescription == null) - throw new CryptographicException (SR.Cryptography_Xml_SignatureDescriptionNotCreated); - - // Let's see if the key corresponds with the SignatureMethod - Type ta = Type.GetType (signatureDescription.KeyAlgorithm); - if (!IsKeyTheCorrectAlgorithm (key, ta)) - return false; - - HashAlgorithm hashAlgorithm = signatureDescription.CreateDigest (); - if (hashAlgorithm == null) - throw new CryptographicException (SR.Cryptography_Xml_CreateHashAlgorithmFailed); - byte[] hashval = GetC14NDigest (hashAlgorithm); - - AsymmetricSignatureDeformatter asymmetricSignatureDeformatter = signatureDescription.CreateDeformatter (key); - SignedXmlDebugLog.LogVerifySignedInfo (this, - key, - signatureDescription, - hashAlgorithm, - asymmetricSignatureDeformatter, - hashval, - m_signature.SignatureValue); - return asymmetricSignatureDeformatter.VerifySignature (hashval, m_signature.SignatureValue); - } - - private bool CheckSignedInfo (KeyedHashAlgorithm macAlg) - { - if (macAlg == null) - throw new ArgumentNullException (nameof (macAlg)); - - SignedXmlDebugLog.LogBeginCheckSignedInfo (this, m_signature.SignedInfo); - - int signatureLength; - if (m_signature.SignedInfo.SignatureLength == null) - signatureLength = macAlg.HashSize; - else - signatureLength = Convert.ToInt32 (m_signature.SignedInfo.SignatureLength, null); - - // signatureLength should be less than hash size - if (signatureLength < 0 || signatureLength > macAlg.HashSize) - throw new CryptographicException (SR.Cryptography_Xml_InvalidSignatureLength); - if (signatureLength % 8 != 0) - throw new CryptographicException (SR.Cryptography_Xml_InvalidSignatureLength2); - if (m_signature.SignatureValue == null) - throw new CryptographicException (SR.Cryptography_Xml_SignatureValueRequired); - if (m_signature.SignatureValue.Length != signatureLength / 8) - throw new CryptographicException (SR.Cryptography_Xml_InvalidSignatureLength); - - // Calculate the hash - byte[] hashValue = GetC14NDigest (macAlg); - SignedXmlDebugLog.LogVerifySignedInfo (this, macAlg, hashValue, m_signature.SignatureValue); - - for (int i = 0; i < m_signature.SignatureValue.Length; i++) - if (m_signature.SignatureValue [i] != hashValue [i]) return false; - - return true; - } - - private static XmlElement GetSingleReferenceTarget (XmlDocument document, string idAttributeName, string idValue) - { - // idValue has already been tested as an NCName (unless overridden for compatibility), so there's no - // escaping that needs to be done here. - string xPath = "//*[@" + idAttributeName + "=\"" + idValue + "\"]"; - - // http://www.w3.org/TR/xmldsig-core/#sec-ReferenceProcessingModel says that for the form URI="#chapter1": - // - // Identifies a node-set containing the element with ID attribute value 'chapter1' ... - // - // Note that it uses the singular. Therefore, if the match is ambiguous, we should consider the document invalid. - // - // In this case, we'll treat it the same as having found nothing across all fallbacks (but shortcut so that we don't - // fall into a trap of finding a secondary element which wasn't the originally signed one). - - XmlNodeList nodeList = document.SelectNodes (xPath); - - if (nodeList == null || nodeList.Count == 0) - return null; - - if (nodeList.Count == 1) - return nodeList [0] as XmlElement; - - throw new CryptographicException (SR.Cryptography_Xml_InvalidReference); - } - - private static bool IsKeyTheCorrectAlgorithm (AsymmetricAlgorithm key, Type expectedType) - { - Type actualType = key.GetType (); - - if (actualType == expectedType) - return true; - - // This check exists solely for compatibility with 4.6. Normally, we would expect "expectedType" to be the superclass type and - // the actualType to be the subclass. - if (expectedType.IsSubclassOf (actualType)) - return true; - - // - // "expectedType" comes from the KeyAlgorithm property of a SignatureDescription. The BCL SignatureDescription classes have historically - // denoted provider-specific implementations ("RSACryptoServiceProvider") rather than the base class for the algorithm ("RSA"). We could - // change those (at the risk of creating other compat problems) but we have no control over third party SignatureDescriptions. - // - // So, in the absence of a better approach, walk up the parent hierarchy until we find the ancestor that's a direct subclass of - // AsymmetricAlgorithm and treat that as the algorithm identifier. - // - while (expectedType != null && expectedType.BaseType != typeof (AsymmetricAlgorithm)) - expectedType = expectedType.BaseType; - - if (expectedType == null) - return false; // SignatureDescription specified something that isn't even a subclass of AsymmetricAlgorithm. For compatibility with 4.6, return false rather throw. - - if (actualType.IsSubclassOf (expectedType)) - return true; - - return false; - } - } -} \ No newline at end of file diff --git a/mcs/class/System.Security/System.Security.Cryptography/DataProtectionScope.cs b/mcs/class/System.Security/System.Security.Cryptography/DataProtectionScope.cs deleted file mode 100644 index ed9a20e373..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography/DataProtectionScope.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// DataProtectionScope.cs: Scope for ProtectData -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using System; - -namespace System.Security.Cryptography { - - public enum DataProtectionScope { - CurrentUser, - LocalMachine - } -} - diff --git a/mcs/class/System.Security/System.Security.Cryptography/ProtectedData.cs b/mcs/class/System.Security/System.Security.Cryptography/ProtectedData.cs index d2cd4b21f4..f237e56558 100644 --- a/mcs/class/System.Security/System.Security.Cryptography/ProtectedData.cs +++ b/mcs/class/System.Security/System.Security.Cryptography/ProtectedData.cs @@ -51,7 +51,7 @@ namespace System.Security.Cryptography { if (userData == null) throw new ArgumentNullException ("userData"); - // on Windows this is supported only under 2000 and later OS + // on Windows this is supported by CoreFX implementation Check (scope); switch (impl) { @@ -64,14 +64,6 @@ namespace System.Security.Cryptography { string msg = Locale.GetText ("Data protection failed."); throw new CryptographicException (msg, e); } - case DataProtectionImplementation.Win32CryptoProtect: - try { - return NativeDapiProtection.Protect (userData, optionalEntropy, scope); - } - catch (Exception e) { - string msg = Locale.GetText ("Data protection failed."); - throw new CryptographicException (msg, e); - } #endif default: throw new PlatformNotSupportedException (); @@ -84,7 +76,7 @@ namespace System.Security.Cryptography { if (encryptedData == null) throw new ArgumentNullException ("encryptedData"); - // on Windows this is supported only under 2000 and later OS + // on Windows this is supported by CoreFX implementation Check (scope); switch (impl) { @@ -97,14 +89,6 @@ namespace System.Security.Cryptography { string msg = Locale.GetText ("Data unprotection failed."); throw new CryptographicException (msg, e); } - case DataProtectionImplementation.Win32CryptoProtect: - try { - return NativeDapiProtection.Unprotect (encryptedData, optionalEntropy, scope); - } - catch (Exception e) { - string msg = Locale.GetText ("Data unprotection failed."); - throw new CryptographicException (msg, e); - } #endif default: throw new PlatformNotSupportedException (); @@ -126,18 +110,10 @@ namespace System.Security.Cryptography { { OperatingSystem os = Environment.OSVersion; switch (os.Platform) { - case PlatformID.Win32NT: - Version v = os.Version; - if (v.Major < 5) { - impl = DataProtectionImplementation.Unsupported; - } else { - // Windows 2000 (5.0) and later - impl = DataProtectionImplementation.Win32CryptoProtect; - } - break; case PlatformID.Unix: impl = DataProtectionImplementation.ManagedProtection; break; + case PlatformID.Win32NT: default: impl = DataProtectionImplementation.Unsupported; break; @@ -146,12 +122,6 @@ namespace System.Security.Cryptography { private static void Check (DataProtectionScope scope) { - if ((scope < DataProtectionScope.CurrentUser) || (scope > DataProtectionScope.LocalMachine)) { - string msg = Locale.GetText ("Invalid enum value '{0}' for '{1}'.", - scope, "DataProtectionScope"); - throw new ArgumentException (msg, "scope"); - } - switch (impl) { case DataProtectionImplementation.Unknown: Detect (); diff --git a/mcs/class/System.Security/System.Security.dll.sources b/mcs/class/System.Security/System.Security.dll.sources index 906d3c35ca..720adf0684 100644 --- a/mcs/class/System.Security/System.Security.dll.sources +++ b/mcs/class/System.Security/System.Security.dll.sources @@ -1,15 +1,9 @@ #include common_System.Security.dll.sources Mono.Security.Cryptography/ManagedProtection.cs -Mono.Security.Cryptography/NativeDapiProtection.cs System.Security.Cryptography/MemoryProtectionScope.cs System.Security.Cryptography/ProtectedMemory.cs System.Security.Cryptography.Pkcs/KeyAgreeKeyChoice.cs -System.Security.Cryptography.Pkcs/CmsSigner.cs -System.Security.Cryptography.Pkcs/SignedCms.cs -System.Security.Cryptography.Pkcs/SignerInfo.cs -System.Security.Cryptography.Pkcs/SignerInfoCollection.cs -System.Security.Cryptography.Pkcs/SignerInfoEnumerator.cs System.Security.Cryptography.X509Certificates/X509Certificate2UI.cs System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs @@ -74,7 +68,7 @@ System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SignatureDescription.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Signature.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedInfo.cs -System.Security.Cryptography.Xml/SignedXml.cs +../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXml.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXmlDebugLog.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SymmetricKeyWrap.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Transform.cs diff --git a/mcs/class/System.Security/System.Security_test.dll.sources b/mcs/class/System.Security/System.Security_test.dll.sources index b8059fe7a1..31b9d8a3db 100644 --- a/mcs/class/System.Security/System.Security_test.dll.sources +++ b/mcs/class/System.Security/System.Security_test.dll.sources @@ -1,10 +1,9 @@ -../corefx/SR.cs +../../corlib/corefx/SR.cs System.Security.Cryptography/CryptographicAttributeObjectCollectionTest.cs System.Security.Cryptography/CryptographicAttributeObjectEnumeratorTest.cs System.Security.Cryptography/CryptographicAttributeTest.cs System.Security.Cryptography/ProtectedDataTest.cs System.Security.Cryptography/ProtectedMemoryTest.cs -System.Security.Cryptography.Pkcs/AlgorithmIdentifierTest.cs System.Security.Cryptography.Pkcs/CmsRecipientCollectionTest.cs System.Security.Cryptography.Pkcs/CmsRecipientTest.cs System.Security.Cryptography.Pkcs/CmsSignerTest.cs diff --git a/mcs/class/System.Security/System.Security_xtest.dll.sources b/mcs/class/System.Security/System.Security_xtest.dll.sources new file mode 100644 index 0000000000..28c66a2ff2 --- /dev/null +++ b/mcs/class/System.Security/System.Security_xtest.dll.sources @@ -0,0 +1,29 @@ +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/AlgorithmIdentifierTest.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/CryptographicAttributeObjectCollectionTests.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/CmsRecipientCollectionTests.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/CertificateTests.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/ContentEncryptionAlgorithmTests.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/DecryptTests.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/DecryptTests.KeyPersistence.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/EdgeCasesTests.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/GeneralTests.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/KeyAgreeRecipientInfoTests.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/KeyTransRecipientInfoTests.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/StateTests.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/UnprotectedAttributeTests.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/CmsSignerTests.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/CounterSigningDerOrder.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsWholeDocumentTests.cs +# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/Pkcs9AttributeTests.cs +../../../external/corefx/src/System.Security.Cryptography.ProtectedData/tests/ProtectedDataTests.cs + +# Dependencies +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs +../../../external/corefx/src/Common/tests/System/Security/Cryptography/ByteUtils.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/Oids.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/CertLoader.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/CertLoader.Settings.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/Certificates.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedDocuments.cs diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/AlgorithmIdentifierTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/AlgorithmIdentifierTest.cs deleted file mode 100644 index d7c55ee7ea..0000000000 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/AlgorithmIdentifierTest.cs +++ /dev/null @@ -1,140 +0,0 @@ -// -// AlgorithmIdentifierTest.cs - NUnit tests for AlgorithmIdentifier -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - - -using NUnit.Framework; - -using System; -using System.Security.Cryptography; -using System.Security.Cryptography.Pkcs; - -namespace MonoTests.System.Security.Cryptography.Pkcs { - - [TestFixture] - public class AlgorithmIdentifierTest { - - static string defaultOid = "1.2.840.113549.3.7"; - static string defaultName = "3des"; - static string validOid = "1.2.840.113549.1.1.1"; - - [Test] - public void ConstructorEmpty () - { - AlgorithmIdentifier ai = new AlgorithmIdentifier (); - Assert.AreEqual (0, ai.KeyLength, "KeyLength"); - Assert.AreEqual (defaultName, ai.Oid.FriendlyName, "Oid.FriendlyName"); - Assert.AreEqual (defaultOid, ai.Oid.Value, "Oid.Value"); - Assert.AreEqual (0, ai.Parameters.Length, "Parameters"); - } - - [Test] - public void ConstructorOid () - { - Oid o = new Oid (validOid); - AlgorithmIdentifier ai = new AlgorithmIdentifier (o); - Assert.AreEqual (0, ai.KeyLength, "KeyLength"); - Assert.AreEqual (validOid, ai.Oid.Value, "Oid"); - Assert.AreEqual (0, ai.Parameters.Length, "Parameters"); - } - - [Test] - //BUG [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorOidNull () - { - AlgorithmIdentifier ai = new AlgorithmIdentifier (null); - Assert.IsNull (ai.Oid, "Oid"); - Assert.AreEqual (0, ai.KeyLength, "KeyLength"); - Assert.AreEqual (0, ai.Parameters.Length, "Parameters"); - } - - [Test] - public void ConstructorOidKeyLength () - { - Oid o = new Oid (validOid); - AlgorithmIdentifier ai = new AlgorithmIdentifier (o, 128); - Assert.AreEqual (128, ai.KeyLength, "KeyLength"); - Assert.AreEqual (validOid, ai.Oid.Value, "Oid"); - Assert.AreEqual (0, ai.Parameters.Length, "Parameters"); - } - - [Test] - //BUG [ExpectedException (typeof (ArgumentNullException))] - public void ConstructorOidNullKeyLength () - { - AlgorithmIdentifier ai = new AlgorithmIdentifier (null, 128); - Assert.IsNull (ai.Oid, "Oid"); - Assert.AreEqual (128, ai.KeyLength, "KeyLength"); - Assert.AreEqual (0, ai.Parameters.Length, "Parameters"); - } - - [Test] - //BUG [ExpectedException (typeof (ArgumentOutOfRangeException))] - public void ConstructorOidKeyLengthNegative () - { - Oid o = new Oid (validOid); - AlgorithmIdentifier ai = new AlgorithmIdentifier (o, -1); - Assert.AreEqual (-1, ai.KeyLength, "KeyLength"); - Assert.AreEqual (validOid, ai.Oid.Value, "Oid"); - Assert.AreEqual (0, ai.Parameters.Length, "Parameters"); - } - - [Test] - public void KeyLength () - { - AlgorithmIdentifier ai = new AlgorithmIdentifier (); - ai.KeyLength = Int32.MaxValue; - Assert.AreEqual (Int32.MaxValue, ai.KeyLength, "KeyLength-Max"); - ai.KeyLength = 0; - Assert.AreEqual (0, ai.KeyLength, "KeyLength-Zero"); - ai.KeyLength = Int32.MinValue; - Assert.AreEqual (Int32.MinValue, ai.KeyLength, "KeyLength-Min"); - } - - [Test] - public void Oid () - { - AlgorithmIdentifier ai = new AlgorithmIdentifier (); - ai.Oid = new Oid (validOid); - Assert.AreEqual (validOid, ai.Oid.Value, "Oid"); - ai.Oid = null; - Assert.IsNull (ai.Oid, "Oid-Null"); - } - - [Test] - public void Parameters () - { - AlgorithmIdentifier ai = new AlgorithmIdentifier (); - ai.Parameters = new byte[2] { 0x05, 0x00 }; // ASN.1 NULL - Assert.AreEqual ("05-00", BitConverter.ToString (ai.Parameters), "Parameters"); - ai.Parameters = null; - Assert.IsNull (ai.Parameters, "Parameters-Null"); - } - } -} - diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs index d6296476ed..e4c6e1cf8d 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs @@ -149,10 +149,9 @@ namespace MonoTests.System.Security.Cryptography.Pkcs { } [Test] - [ExpectedException (typeof (CryptographicException))] public void GetContentType_signedAndEnvelopedData () { - // Note: signedAndEnvelopedData isn't defined in RFC2630 + // Note: signedAndEnvelopedData isn't defined in RFC2630, but it is supported by the CMS classes byte[] signedAndEnvelopedData = { 0x30, 0x82, 0x01, 0x1C, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x04, 0xA0, 0x82, 0x01, 0x0D, 0x30, 0x82, 0x01, 0x09, 0x02, 0x01, 0x00, 0x31, 0x81, 0xD6, 0x30, 0x81, 0xD3, 0x02, 0x01, 0x00, 0x30, 0x3C, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x02, 0x10, 0x91, 0xC4, 0x4B, 0x0D, 0xB7, 0xD8, 0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00, 0x97, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x81, 0x80, 0xCA, 0x4B, 0x97, 0x9C, 0xAB, 0x79, 0xC6, 0xDF, 0x6A, 0x27, 0xC7, 0x24, 0xC4, 0x5E, 0x3B, 0x31, 0xAD, 0xBC, 0x25, 0xE6, 0x38, 0x5E, 0x79, 0x26, 0x0E, 0x68, 0x46, 0x1D, 0x21, 0x81, 0x38, 0x92, 0xEC, 0xCB, 0x7C, 0x91, 0xD6, 0x09, 0x38, 0x91, 0xCE, 0x50, 0x5B, 0x70, 0x31, 0xB0, 0x9F, 0xFC, 0xE2, 0xEE, 0x45, 0xBC, 0x4B, 0xF8, 0x9A, 0xD9, 0xEE, 0xE7, 0x4A, 0x3D, 0xCD, 0x8D, 0xFF, 0x10, 0xAB, 0xC8, 0x19, 0x05, 0x54, 0x5E, 0x40, 0x7A, 0xBE, 0x2B, 0xD7, 0x22, 0x97, 0xF3, 0x23, 0xAF, 0x50, 0xF5, 0xEB, 0x43, 0x06, 0xC3, 0xFB, 0x17, 0xCA, 0xBD, 0xAD, 0x28, 0xD8, 0x10, 0x0F, 0x61, 0xCE, 0xF8, 0x25, 0x70, 0xF6, 0xC8, 0x1E, 0x7F, 0x82, 0xE5, 0x94, 0xEB, 0x11, 0xBF, 0xB8, 0x6F, 0xEE, 0x79, 0xCD, 0x63, 0xDD, 0x59, 0x8D, 0x25, 0x0E, 0x78, 0x55, 0xCE, 0x21, 0xBA, 0x13, 0x6B, 0x30, 0x2B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0x30, 0x14, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x03, 0x07, 0x04, 0x08, 0x8C, 0x5D, 0xC9, 0x87, 0x88, 0x9C, 0x05, 0x72, 0x80, 0x08, 0x2C, 0xAF, 0x82, 0x91, 0xEC, 0xAD, 0xC5, 0xB5 }; Oid o = ContentInfo.GetContentType (signedAndEnvelopedData); Assert.AreEqual ("1.2.840.113549.1.7.4", o.Value, "GetContentType"); diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9SigningTimeTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9SigningTimeTest.cs index 9558b88afe..acccbd28cd 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9SigningTimeTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/Pkcs9SigningTimeTest.cs @@ -75,14 +75,14 @@ namespace MonoTests.System.Security.Cryptography.Pkcs { } [Test] - [ExpectedException (typeof (ArgumentOutOfRangeException))] + [ExpectedException (typeof (CryptographicException))] public void Constructor_DateTime_MinValue () { Pkcs9SigningTime st = new Pkcs9SigningTime (DateTime.MinValue); } [Test] - [ExpectedException (typeof (ArgumentOutOfRangeException))] + [ExpectedException (typeof (CryptographicException))] public void Constructor_DateTime_1600 () { DateTime dt = new DateTime (1600, 12, 31, 11, 59, 59); @@ -104,54 +104,6 @@ namespace MonoTests.System.Security.Cryptography.Pkcs { Pkcs9SigningTime st = new Pkcs9SigningTime (DateTime.MaxValue); } - [Test] - [ExpectedException (typeof (CryptographicException))] - public void Constructor_DateTime_Before1950 () - { - DateTime dt = new DateTime (1949, 12, 31, 11, 59, 59); - // UTCTIME (0x17), i.e. 2 digits years, limited to 1950-2050 - Pkcs9SigningTime st = new Pkcs9SigningTime (dt); - } - - [Test] - public void Constructor_DateTime_After1950 () - { - DateTime dt = new DateTime (1950, 01, 01, 00, 00, 00); - // UTCTIME (0x17), i.e. 2 digits years, limited to 1950-2050 - Pkcs9SigningTime st = new Pkcs9SigningTime (dt); - Assert.AreEqual (signingTimeName, st.Oid.FriendlyName, "Oid.FriendlyName"); - Assert.AreEqual (signingTimeOid, st.Oid.Value, "Oid.Value"); - Assert.AreEqual (15, st.RawData.Length, "RawData.Length"); - Assert.AreEqual ("17-0D-35-30-30-31-30-31-30-30-30-30-30-30-5A", BitConverter.ToString (st.RawData)); - Assert.AreEqual (dt, st.SigningTime, "st.SigningTime"); - Assert.AreEqual ("17 0d 35 30 30 31 30 31 30 30 30 30 30 30 5a", st.Format (true), "Format(true)"); - Assert.AreEqual ("17 0d 35 30 30 31 30 31 30 30 30 30 30 30 5a", st.Format (false), "Format(false)"); - } - - [Test] - public void Constructor_DateTime_Before2050 () - { - DateTime dt = new DateTime (2049, 12, 31, 11, 59, 59); - // up to 2050 encoding should stay with UTCTIME (0x17), i.e. 2 digits years - Pkcs9SigningTime st = new Pkcs9SigningTime (dt); - Assert.AreEqual (signingTimeName, st.Oid.FriendlyName, "Oid.FriendlyName"); - Assert.AreEqual (signingTimeOid, st.Oid.Value, "Oid.Value"); - Assert.AreEqual (15, st.RawData.Length, "RawData.Length"); - Assert.AreEqual ("17-0D-34-39-31-32-33-31-31-31-35-39-35-39-5A", BitConverter.ToString (st.RawData)); - Assert.AreEqual (dt, st.SigningTime, "st.SigningTime"); - Assert.AreEqual ("17 0d 34 39 31 32 33 31 31 31 35 39 35 39 5a", st.Format (true), "Format(true)"); - Assert.AreEqual ("17 0d 34 39 31 32 33 31 31 31 35 39 35 39 5a", st.Format (false), "Format(false)"); - } - - [Test] - [ExpectedException (typeof (CryptographicException))] - public void Constructor_DateTime_After2050 () - { - DateTime dt = new DateTime (2050, 01, 01, 00, 00, 00); - // in 2050 encoding should switch to GENERALIZEDTIME (0x18), i.e. 4 digits years - Pkcs9SigningTime st = new Pkcs9SigningTime (dt); - } - [Test] public void Constructor_DateTime () { diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs index c479201040..0a8c85e685 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs @@ -374,7 +374,7 @@ namespace MonoTests.System.Security.Cryptography.Pkcs { } [Test] - [ExpectedException (typeof (CryptographicException))] + [ExpectedException (typeof (PlatformNotSupportedException))] public void ComputeEmptySignature () { SignedCms sp = new SignedCms (); diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs index 22d04c4433..f78ad18a8f 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs @@ -110,14 +110,14 @@ namespace MonoTests.System.Security.Cryptography.Pkcs { SignerInfo si = GetSignerInfo (data); // default properties - Assert.AreEqual (0, si.SignedAttributes.Count, "SignedAttributes"); + Assert.AreEqual (5, si.SignedAttributes.Count, "SignedAttributes"); Assert.IsNotNull (si.Certificate, "Certificate"); Assert.AreEqual (0, si.CounterSignerInfos.Count, "CounterSignerInfos"); Assert.AreEqual ("sha256", si.DigestAlgorithm.FriendlyName, "DigestAlgorithm.FriendlyName"); Assert.AreEqual ("2.16.840.1.101.3.4.2.1", si.DigestAlgorithm.Value, "DigestAlgorithm.Value"); Assert.AreEqual (SubjectIdentifierType.SubjectKeyIdentifier, si.SignerIdentifier.Type, "SignerIdentifier.Type"); Assert.AreEqual ("F1CC7184EBDA537140C1A57416017810DF133020", (string)si.SignerIdentifier.Value, "SignerIdentifier.Value"); - Assert.AreEqual (0, si.UnsignedAttributes.Count, "UnsignedAttributes"); + Assert.AreEqual (1, si.UnsignedAttributes.Count, "UnsignedAttributes"); Assert.AreEqual (3, si.Version, "Version"); } } diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedDataTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedDataTest.cs index b97c23ef69..61f57bdd88 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedDataTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedDataTest.cs @@ -116,22 +116,6 @@ namespace MonoTests.System.Security.Cryptography { } } - [Test] - [ExpectedException (typeof (ArgumentException))] - [Category ("NotDotNet")] - public void Protect_InvalidDataProtectionScope () - { - try { - byte[] data = new byte[16]; - ProtectedData.Protect (data, notMuchEntropy, (DataProtectionScope) Int32.MinValue); - // MS doesn't throw an ArgumentException but returning from - // this method will throw an UnhandledException in NUnit - } - catch (PlatformNotSupportedException) { - Assert.Ignore ("Only supported under Windows 2000 and later"); - } - } - [Test] [ExpectedException (typeof (ArgumentNullException))] public void ProtectNull () @@ -148,7 +132,6 @@ namespace MonoTests.System.Security.Cryptography { } [Test] - [ExpectedException (typeof (CryptographicException))] public void UnprotectNotProtectedData () { try { @@ -158,23 +141,9 @@ namespace MonoTests.System.Security.Cryptography { catch (PlatformNotSupportedException) { Assert.Ignore ("Only supported under Windows 2000 and later"); } - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - [Category ("NotDotNet")] - public void Unprotect_InvalidDataProtectionScope () - { - try { - byte[] data = new byte[16]; - byte[] encdata = ProtectedData.Protect (data, notMuchEntropy, DataProtectionScope.CurrentUser); - ProtectedData.Unprotect (encdata, notMuchEntropy, (DataProtectionScope) Int32.MinValue); - // MS doesn't throw an ArgumentException but returning from - // this method will throw an UnhandledException in NUnit - } - catch (PlatformNotSupportedException) { - Assert.Ignore ("Only supported under Windows 2000 and later"); - } + catch (CryptographicException) { + Assert.Pass (); + } } [Test] @@ -184,5 +153,4 @@ namespace MonoTests.System.Security.Cryptography { ProtectedData.Unprotect (null, notMuchEntropy, DataProtectionScope.CurrentUser); } } -} - +} \ No newline at end of file diff --git a/mcs/class/System.Security/common_System.Security.dll.sources b/mcs/class/System.Security/common_System.Security.dll.sources index 2a82e14e88..0f2d025187 100644 --- a/mcs/class/System.Security/common_System.Security.dll.sources +++ b/mcs/class/System.Security/common_System.Security.dll.sources @@ -1,43 +1,102 @@ -../../build/common/SR.cs Assembly/AssemblyInfo.cs -corefx/SR.cs - -../../build/common/Consts.cs -../../build/common/Locale.cs -../../build/common/MonoTODOAttribute.cs # System.Security.Cryptography ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/CryptographicAttributeObject.cs ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/CryptographicAttributeObjectCollection.cs ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/CryptographicAttributeObjectEnumerator.cs ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Oids.cs -System.Security.Cryptography/DataProtectionScope.cs +../../../external/corefx/src/System.Security.Cryptography.ProtectedData/src/System/Security/Cryptography/DataProtectionScope.cs System.Security.Cryptography/ProtectedData.cs # System.Security.Cryptography.Pkcs -System.Security.Cryptography.Pkcs/AlgorithmIdentifier.cs -System.Security.Cryptography.Pkcs/CmsRecipient.cs -System.Security.Cryptography.Pkcs/CmsRecipientCollection.cs -System.Security.Cryptography.Pkcs/CmsRecipientEnumerator.cs -System.Security.Cryptography.Pkcs/ContentInfo.cs +../../../external/corefx/src/Common/src/System/Security/Cryptography/Asn1V2.cs +../../../external/corefx/src/Common/src/System/Security/Cryptography/Asn1V2.Serializer.cs +../../../external/corefx/src/Common/src/System/Security/Cryptography/AsnReader.cs +../../../external/corefx/src/Common/src/System/Security/Cryptography/AsnWriter.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/AlgorithmIdentifierAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/AttributeAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/ContentInfoAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/EncapsulatedContentInfoAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/GeneralName.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/IssuerAndSerialNumberAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/MessageImprint.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/PssParamsAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rfc3161Accuracy.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rfc3161TimeStampReq.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rfc3161TimeStampResp.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rfc3161TstInfo.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/SignedDataAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/SignerIdentifierAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/SignerInfoAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/SigningCertificateAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/X509ExtensionAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/AlgorithmIdentifier.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsRecipient.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsRecipientCollection.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsRecipientEnumerator.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/ContentInfo.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/EnvelopedCms.cs System.Security.Cryptography.Pkcs/EnvelopedCms.cs -System.Security.Cryptography.Pkcs/KeyAgreeRecipientInfo.cs -System.Security.Cryptography.Pkcs/KeyTransRecipientInfo.cs -System.Security.Cryptography.Pkcs/Pkcs9Attribute.cs -System.Security.Cryptography.Pkcs/Pkcs9ContentType.cs -System.Security.Cryptography.Pkcs/Pkcs9DocumentDescription.cs -System.Security.Cryptography.Pkcs/Pkcs9DocumentName.cs -System.Security.Cryptography.Pkcs/Pkcs9MessageDigest.cs -System.Security.Cryptography.Pkcs/Pkcs9SigningTime.cs -System.Security.Cryptography.Pkcs/PublicKeyInfo.cs -System.Security.Cryptography.Pkcs/RecipientInfo.cs -System.Security.Cryptography.Pkcs/RecipientInfoCollection.cs -System.Security.Cryptography.Pkcs/RecipientInfoEnumerator.cs -System.Security.Cryptography.Pkcs/RecipientInfoType.cs -System.Security.Cryptography.Pkcs/SubjectIdentifier.cs -System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs -System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs -System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/KeyAgreeRecipientInfo.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/KeyTransRecipientInfo.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9AttributeObject.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9ContentType.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9DocumentDescription.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9DocumentName.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9MessageDigest.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9SigningTime.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/PublicKeyInfo.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/RecipientInfo.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/RecipientInfoCollection.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/RecipientInfoEnumerator.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/RecipientInfoType.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SubjectIdentifier.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SubjectIdentifierOrKey.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SubjectIdentifierOrKeyType.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SubjectIdentifierType.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/DecryptorPal.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/KeyAgreeRecipientInfoPal.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/KeyLengths.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/KeyTransRecipientInfoPal.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Oids.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Helpers.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/PkcsPal.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/RecipientInfoPal.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/AsnHelpers.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Asn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Decode.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Decrypt.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Encrypt.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Exceptions.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.KeyAgree.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.KeyTrans.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/PkcsPal.AnyOS.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/EncryptedContentInfoAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/EnvelopedDataAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/KeyAgreeRecipientIdentifierAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/KeyAgreeRecipientInfoAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/KeyTransRecipientInfoAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OriginatorIdentifierOrKeyAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OriginatorInfoAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OriginatorPublicKeyAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OtherKeyAttributeAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rc2CbcParameters.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/RecipientEncryptedKeyAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/RecipientIdentifierAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/RecipientInfoAsn.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/RecipientKeyIdentifier.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.RSA.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.DSA.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.ECDsa.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSigner.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignedCms.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignedCms.CtorOverloads.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfo.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfoCollection.cs +../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfoEnumerator.cs # System.Security.Cryptography.Xml ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Xml/X509IssuerSerial.cs diff --git a/mcs/class/System.Security/corefx/SR.cs b/mcs/class/System.Security/corefx/SR.cs deleted file mode 100644 index 40bfbf5828..0000000000 --- a/mcs/class/System.Security/corefx/SR.cs +++ /dev/null @@ -1,168 +0,0 @@ -// -// This file was generated by resx2sr tool -// - -partial class SR -{ - public const string ArgumentOutOfRange_Index = "Index was out of range. Must be non-negative and less than the size of the collection."; - public const string Arg_EmptyOrNullString = "String cannot be empty or null."; - public const string Cryptography_Partial_Chain = "A certificate chain could not be built to a trusted root authority."; - public const string Cryptography_Xml_BadWrappedKeySize = "Bad wrapped key size."; - public const string Cryptography_Xml_CipherValueElementRequired = "A Cipher Data element should have either a CipherValue or a CipherReference element."; - public const string Cryptography_Xml_CreateHashAlgorithmFailed = "Could not create hash algorithm object."; - public const string Cryptography_Xml_CreateTransformFailed = "Could not create the XML transformation identified by the URI {0}."; - public const string Cryptography_Xml_CreatedKeyFailed = "Failed to create signing key."; - public const string Cryptography_Xml_DigestMethodRequired = "A DigestMethod must be specified on a Reference prior to generating XML."; - public const string Cryptography_Xml_DigestValueRequired = "A Reference must contain a DigestValue."; - public const string Cryptography_Xml_EnvelopedSignatureRequiresContext = "An XmlDocument context is required for enveloped transforms."; - public const string Cryptography_Xml_InvalidElement = "Malformed element {0}."; - public const string Cryptography_Xml_InvalidEncryptionProperty = "Malformed encryption property element."; - public const string Cryptography_Xml_InvalidKeySize = "The key size should be a non negative integer."; - public const string Cryptography_Xml_InvalidReference = "Malformed reference element."; - public const string Cryptography_Xml_InvalidSignatureLength = "The length of the signature with a MAC should be less than the hash output length."; - public const string Cryptography_Xml_InvalidSignatureLength2 = "The length in bits of the signature with a MAC should be a multiple of 8."; - public const string Cryptography_Xml_InvalidX509IssuerSerialNumber = "X509 issuer serial number is invalid."; - public const string Cryptography_Xml_KeyInfoRequired = "A KeyInfo element is required to check the signature."; - public const string Cryptography_Xml_KW_BadKeySize = "The length of the encrypted data in Key Wrap is either 32, 40 or 48 bytes."; - public const string Cryptography_Xml_LoadKeyFailed = "Signing key is not loaded."; - public const string Cryptography_Xml_MissingAlgorithm = "Symmetric algorithm is not specified."; - public const string Cryptography_Xml_MissingCipherData = "Cipher data is not specified."; - public const string Cryptography_Xml_MissingDecryptionKey = "Unable to retrieve the decryption key."; - public const string Cryptography_Xml_MissingEncryptionKey = "Unable to retrieve the encryption key."; - public const string Cryptography_Xml_NotSupportedCryptographicTransform = "The specified cryptographic transform is not supported."; - public const string Cryptography_Xml_ReferenceElementRequired = "At least one Reference element is required."; - public const string Cryptography_Xml_ReferenceTypeRequired = "The Reference type must be set in an EncryptedReference object."; - public const string Cryptography_Xml_SelfReferenceRequiresContext = "An XmlDocument context is required to resolve the Reference Uri {0}."; - public const string Cryptography_Xml_SignatureDescriptionNotCreated = "SignatureDescription could not be created for the signature algorithm supplied."; - public const string Cryptography_Xml_SignatureMethodKeyMismatch = "The key does not fit the SignatureMethod."; - public const string Cryptography_Xml_SignatureMethodRequired = "A signature method is required."; - public const string Cryptography_Xml_SignatureValueRequired = "Signature requires a SignatureValue."; - public const string Cryptography_Xml_SignedInfoRequired = "Signature requires a SignedInfo."; - public const string Cryptography_Xml_TransformIncorrectInputType = "The input type was invalid for this transform."; - public const string Cryptography_Xml_IncorrectObjectType = "Type of input object is invalid."; - public const string Cryptography_Xml_UnknownTransform = "Unknown transform has been encountered."; - public const string Cryptography_Xml_UriNotResolved = "Unable to resolve Uri {0}."; - public const string Cryptography_Xml_UriNotSupported = " The specified Uri is not supported."; - public const string Cryptography_Xml_UriRequired = "A Uri attribute is required for a CipherReference element."; - public const string Cryptography_Xml_XrmlMissingContext = "Null Context property encountered."; - public const string Cryptography_Xml_XrmlMissingIRelDecryptor = "IRelDecryptor is required."; - public const string Cryptography_Xml_XrmlMissingIssuer = "Issuer node is required."; - public const string Cryptography_Xml_XrmlMissingLicence = "License node is required."; - public const string Cryptography_Xml_XrmlUnableToDecryptGrant = "Unable to decrypt grant content."; - public const string NotSupported_KeyAlgorithm = "The certificate key algorithm is not supported."; - public const string Log_ActualHashValue = "Actual hash value: {0}"; - public const string Log_BeginCanonicalization = "Beginning canonicalization using \"{0}\" ({1})."; - public const string Log_BeginSignatureComputation = "Beginning signature computation."; - public const string Log_BeginSignatureVerification = "Beginning signature verification."; - public const string Log_BuildX509Chain = "Building and verifying the X509 chain for certificate {0}."; - public const string Log_CanonicalizationSettings = "Canonicalization transform is using resolver {0} and base URI \"{1}\"."; - public const string Log_CanonicalizedOutput = "Output of canonicalization transform: {0}"; - public const string Log_CertificateChain = "Certificate chain:"; - public const string Log_CheckSignatureFormat = "Checking signature format using format validator \"[{0}] {1}.{2}\"."; - public const string Log_CheckSignedInfo = "Checking signature on SignedInfo with id \"{0}\"."; - public const string Log_FormatValidationSuccessful = "Signature format validation was successful."; - public const string Log_FormatValidationNotSuccessful = "Signature format validation failed."; - public const string Log_KeyUsages = "Found key usages \"{0}\" in extension {1} on certificate {2}."; - public const string Log_NoNamespacesPropagated = "No namespaces are being propagated."; - public const string Log_PropagatingNamespace = "Propagating namespace {0}=\"{1}\"."; - public const string Log_RawSignatureValue = "Raw signature: {0}"; - public const string Log_ReferenceHash = "Reference {0} hashed with \"{1}\" ({2}) has hash value {3}, expected hash value {4}."; - public const string Log_RevocationMode = "Revocation mode for chain building: {0}."; - public const string Log_RevocationFlag = "Revocation flag for chain building: {0}."; - public const string Log_SigningAsymmetric = "Calculating signature with key {0} using signature description {1}, hash algorithm {2}, and asymmetric signature formatter {3}."; - public const string Log_SigningHmac = "Calculating signature using keyed hash algorithm {0}."; - public const string Log_SigningReference = "Hashing reference {0}, Uri \"{1}\", Id \"{2}\", Type \"{3}\" with hash algorithm \"{4}\" ({5})."; - public const string Log_TransformedReferenceContents = "Transformed reference contents: {0}"; - public const string Log_UnsafeCanonicalizationMethod = "Canonicalization method \"{0}\" is not on the safe list. Safe canonicalization methods are: {1}."; - public const string Log_UrlTimeout = "URL retrieval timeout for chain building: {0}."; - public const string Log_VerificationFailed = "Verification failed checking {0}."; - public const string Log_VerificationFailed_References = "references"; - public const string Log_VerificationFailed_SignedInfo = "SignedInfo"; - public const string Log_VerificationFailed_X509Chain = "X509 chain verification"; - public const string Log_VerificationFailed_X509KeyUsage = "X509 key usage verification"; - public const string Log_VerificationFlag = "Verification flags for chain building: {0}."; - public const string Log_VerificationTime = "Verification time for chain building: {0}."; - public const string Log_VerificationWithKeySuccessful = "Verification with key {0} was successful."; - public const string Log_VerificationWithKeyNotSuccessful = "Verification with key {0} was not successful."; - public const string Log_VerifyReference = "Processing reference {0}, Uri \"{1}\", Id \"{2}\", Type \"{3}\"."; - public const string Log_VerifySignedInfoAsymmetric = "Verifying SignedInfo using key {0}, signature description {1}, hash algorithm {2}, and asymmetric signature deformatter {3}."; - public const string Log_VerifySignedInfoHmac = "Verifying SignedInfo using keyed hash algorithm {0}."; - public const string Log_X509ChainError = "Error building X509 chain: {0}: {1}."; - public const string Log_XmlContext = "Using context: {0}"; - public const string Log_SignedXmlRecursionLimit = "Signed xml recursion limit hit while trying to decrypt the key. Reference {0} hashed with \"{1}\" and ({2})."; - public const string Log_UnsafeTransformMethod = "Transform method \"{0}\" is not on the safe list. Safe transform methods are: {1}."; - public const string Arg_RankMultiDimNotSupported = "Only single dimensional arrays are supported for the requested action."; - public const string Argument_InvalidOffLen = "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."; - public const string Argument_InvalidOidValue = "The OID value was invalid."; - public const string Cryptography_Asn_EnumeratedValueRequiresNonFlagsEnum = "ASN.1 Enumerated values only apply to enum types without the [Flags] attribute."; - public const string Cryptography_Asn_NamedBitListRequiresFlagsEnum = "Named bit list operations require an enum with the [Flags] attribute."; - public const string Cryptography_Asn_NamedBitListValueTooBig = "The encoded named bit list value is larger than the value size of the '{0}' enum."; - public const string Cryptography_Asn_UniversalValueIsFixed = "Tags with TagClass Universal must have the appropriate TagValue value for the data type being read or written."; - public const string Cryptography_Asn_UnusedBitCountRange = "Unused bit count must be between 0 and 7, inclusive."; - public const string Cryptography_AsnSerializer_AmbiguousFieldType = "Field '{0}' of type '{1}' has ambiguous type '{2}', an attribute derived from AsnTypeAttribute is required."; - public const string Cryptography_AsnSerializer_Choice_AllowNullNonNullable = "[Choice].AllowNull=true is not valid because type '{0}' cannot have a null value."; - public const string Cryptography_AsnSerializer_Choice_ConflictingTagMapping = "The tag ({0} {1}) for field '{2}' on type '{3}' already is associated in this context with field '{4}' on type '{5}'."; - public const string Cryptography_AsnSerializer_Choice_DefaultValueDisallowed = "Field '{0}' on [Choice] type '{1}' has a default value, which is not permitted."; - public const string Cryptography_AsnSerializer_Choice_NoChoiceWasMade = "An instance of [Choice] type '{0}' has no non-null fields."; - public const string Cryptography_AsnSerializer_Choice_NonNullableField = "Field '{0}' on [Choice] type '{1}' can not be assigned a null value."; - public const string Cryptography_AsnSerializer_Choice_TooManyValues = "Fields '{0}' and '{1}' on type '{2}' are both non-null when only one value is permitted."; - public const string Cryptography_AsnSerializer_Choice_TypeCycle = "Field '{0}' on [Choice] type '{1}' has introduced a type chain cycle."; - public const string Cryptography_AsnSerializer_MultipleAsnTypeAttributes = "Field '{0}' on type '{1}' has multiple attributes deriving from '{2}' when at most one is permitted."; - public const string Cryptography_AsnSerializer_NoJaggedArrays = "Type '{0}' cannot be serialized or deserialized because it is an array of arrays."; - public const string Cryptography_AsnSerializer_NoMultiDimensionalArrays = "Type '{0}' cannot be serialized or deserialized because it is a multi-dimensional array."; - public const string Cryptography_AsnSerializer_NoOpenTypes = "Type '{0}' cannot be serialized or deserialized because it is not sealed or has unbound generic parameters."; - public const string Cryptography_AsnSerializer_Optional_NonNullableField = "Field '{0}' on type '{1}' is declared [OptionalValue], but it can not be assigned a null value."; - public const string Cryptography_AsnSerializer_PopulateFriendlyNameOnString = "Field '{0}' on type '{1}' has [ObjectIdentifier].PopulateFriendlyName set to true, which is not applicable to a string. Change the field to '{2}' or set PopulateFriendlyName to false."; - public const string Cryptography_AsnSerializer_SetValueException = "Unable to set field {0} on type {1}."; - public const string Cryptography_AsnSerializer_SpecificTagChoice = "Field '{0}' on type '{1}' has specified an implicit tag value via [ExpectedTag] for [Choice] type '{2}'. ExplicitTag must be true, or the [ExpectedTag] attribute removed."; - public const string Cryptography_AsnSerializer_UnexpectedTypeForAttribute = "Field '{0}' of type '{1}' has an effective type of '{2}' when one of ({3}) was expected."; - public const string Cryptography_AsnSerializer_UtcTimeTwoDigitYearMaxTooSmall = "Field '{0}' on type '{1}' has a [UtcTime] TwoDigitYearMax value ({2}) smaller than the minimum (99)."; - public const string Cryptography_AsnSerializer_UnhandledType = "Could not determine how to serialize or deserialize type '{0}'."; - public const string Cryptography_AsnWriter_EncodeUnbalancedStack = "Encode cannot be called while a Sequence or SetOf is still open."; - public const string Cryptography_AsnWriter_PopWrongTag = "Cannot pop the requested tag as it is not currently in progress."; - public const string Cryptography_BadHashValue = "The hash value is not correct."; - public const string Cryptography_BadSignature = "Invalid signature."; - public const string Cryptography_Cms_CannotDetermineSignatureAlgorithm = "Could not determine signature algorithm for the signer certificate."; - public const string Cryptography_Cms_IncompleteCertChain = "The certificate chain is incomplete, the self-signed root authority could not be determined."; - public const string Cryptography_Cms_Invalid_Originator_Identifier_Choice = "Invalid originator identifier choice {0} found in decoded CMS."; - public const string Cryptography_Cms_Invalid_Subject_Identifier_Type = "The subject identifier type {0} is not valid."; - public const string Cryptography_Cms_InvalidMessageType = "Invalid cryptographic message type."; - public const string Cryptography_Cms_InvalidSignerHashForSignatureAlg = "SignerInfo digest algorithm '{0}' is not valid for signature algorithm '{1}'."; - public const string Cryptography_Cms_Key_Agree_Date_Not_Available = "The Date property is not available for none KID key agree recipient."; - public const string Cryptography_Cms_MessageNotEncrypted = "The CMS message is not encrypted."; - public const string Cryptography_Cms_MessageNotSigned = "The CMS message is not signed."; - public const string Cryptography_Cms_MissingAuthenticatedAttribute = "The cryptographic message does not contain an expected authenticated attribute."; - public const string Cryptography_Cms_NoCounterCounterSigner = "Only one level of counter-signatures are supported on this platform."; - public const string Cryptography_Cms_NoRecipients = "The recipients collection is empty. You must specify at least one recipient. This platform does not implement the certificate picker UI."; - public const string Cryptography_Cms_NoSignerCert = "No signer certificate was provided. This platform does not implement the certificate picker UI."; - public const string Cryptography_Cms_NoSignerAtIndex = "The signed cryptographic message does not have a signer for the specified signer index."; - public const string Cryptography_Cms_RecipientNotFound = "The enveloped-data message does not contain the specified recipient."; - public const string Cryptography_Cms_RecipientType_NotSupported = "The recipient type '{0}' is not supported for encryption or decryption on this platform."; - public const string Cryptography_Cms_Sign_Empty_Content = "Cannot create CMS signature for empty content."; - public const string Cryptography_Cms_SignerNotFound = "Cannot find the original signer."; - public const string Cryptography_Cms_Signing_RequiresPrivateKey = "A certificate with a private key is required."; - public const string Cryptography_Cms_TrustFailure = "Certificate trust could not be established. The first reported error is: {0}"; - public const string Cryptography_Cms_UnknownAlgorithm = "Unknown algorithm '{0}'."; - public const string Cryptography_Cms_UnknownKeySpec = "Unable to determine the type of key handle from this keyspec {0}."; - public const string Cryptography_Cms_WrongKeyUsage = "The certificate is not valid for the requested usage."; - public const string Cryptography_Pkcs_InvalidSignatureParameters = "Invalid signature paramters."; - public const string Cryptography_Pkcs9_AttributeMismatch = "The parameter should be a PKCS 9 attribute."; - public const string Cryptography_Pkcs9_MultipleSigningTimeNotAllowed = "Cannot add multiple PKCS 9 signing time attributes."; - public const string Cryptography_Pkcs_PssParametersMissing = "PSS parameters were not present."; - public const string Cryptography_Pkcs_PssParametersHashMismatch = "This platform requires that the PSS hash algorithm ({0}) match the data digest algorithm ({1})."; - public const string Cryptography_Pkcs_PssParametersMgfHashMismatch = "This platform does not support the MGF hash algorithm ({0}) being different from the signature hash algorithm ({1})."; - public const string Cryptography_Pkcs_PssParametersMgfNotSupported = "Mask generation function '{0}' is not supported by this platform."; - public const string Cryptography_Pkcs_PssParametersSaltMismatch = "PSS salt size {0} is not supported by this platform with hash algorithm {1}."; - public const string Cryptography_TimestampReq_BadNonce = "The response from the timestamping server did not match the request nonce."; - public const string Cryptography_TimestampReq_BadResponse = "The response from the timestamping server was not understood."; - public const string Cryptography_TimestampReq_Failure = "The timestamping server did not grant the request. The request status is '{0}' with failure info '{1}'."; - public const string Cryptography_TimestampReq_NoCertFound = "The timestamping request required the TSA certificate in the response, but it was not found."; - public const string Cryptography_TimestampReq_UnexpectedCertFound = "The timestamping request required the TSA certificate not be included in the response, but certificates were present."; - public const string InvalidOperation_DuplicateItemNotAllowed = "Duplicate items are not allowed in the collection."; - public const string InvalidOperation_WrongOidInAsnCollection = "AsnEncodedData element in the collection has wrong Oid value: expected = '{0}', actual = '{1}'."; - public const string PlatformNotSupported_CryptographyPkcs = "System.Security.Cryptography.Pkcs is only supported on Windows platforms."; - public const string Cryptography_Der_Invalid_Encoding = "ASN1 corrupted data."; - public const string Cryptography_Invalid_IA5String = "The string contains a character not in the 7 bit ASCII character set."; - public const string Cryptography_UnknownHashAlgorithm = "'{0}' is not a known hash algorithm."; - public const string Cryptography_WriteEncodedValue_OneValueAtATime = "The input to WriteEncodedValue must represent a single encoded value with no trailing data."; -} diff --git a/mcs/class/System.Security/monodroid_System.Security_test.dll.exclude.sources b/mcs/class/System.Security/monodroid_System.Security_test.dll.exclude.sources new file mode 100644 index 0000000000..e2b06dcf13 --- /dev/null +++ b/mcs/class/System.Security/monodroid_System.Security_test.dll.exclude.sources @@ -0,0 +1 @@ +System.Security.Permissions/DataProtectionPermissionAttributeTest.cs diff --git a/mcs/class/System.Security/monotouch_System.Security_test.dll.exclude.sources b/mcs/class/System.Security/monotouch_System.Security_test.dll.exclude.sources new file mode 100644 index 0000000000..e2b06dcf13 --- /dev/null +++ b/mcs/class/System.Security/monotouch_System.Security_test.dll.exclude.sources @@ -0,0 +1 @@ +System.Security.Permissions/DataProtectionPermissionAttributeTest.cs diff --git a/mcs/class/System.Security/win32_System.Security.dll.exclude.sources b/mcs/class/System.Security/win32_System.Security.dll.exclude.sources new file mode 100644 index 0000000000..60679f5160 --- /dev/null +++ b/mcs/class/System.Security/win32_System.Security.dll.exclude.sources @@ -0,0 +1,2 @@ +System.Security.Cryptography/ProtectedData.cs +Mono.Security.Cryptography/ManagedProtection.cs diff --git a/mcs/class/System.Security/win32_System.Security.dll.sources b/mcs/class/System.Security/win32_System.Security.dll.sources new file mode 100644 index 0000000000..f47ef6de71 --- /dev/null +++ b/mcs/class/System.Security/win32_System.Security.dll.sources @@ -0,0 +1,11 @@ +#include System.Security.dll.sources + +../../../external/corefx/src/System.Security.Cryptography.ProtectedData/src/System/Security/Cryptography/ProtectedData.cs +../../../external/corefx/src/Common/src/Interop/Windows/Crypt32/Interop.DATA_BLOB.cs +../../../external/corefx/src/Common/src/Interop/Windows/Crypt32/Interop.CryptProtectDataFlags.cs +../../../external/corefx/src/Common/src/Interop/Windows/Crypt32/Interop.CryptProtectData.cs +../../../external/corefx/src/Common/src/Interop/Windows/Crypt32/Interop.CryptUnprotectData.cs +../../../external/corefx/src/Common/src/Interop/Windows/Interop.Libraries.cs +../../../external/corefx/src/Common/src/Internal/Cryptography/Windows/CryptoThrowHelper.cs +../../../external/corefx/src/Common/src/Interop/Windows/Interop.Errors.cs +../../../external/corefx/src/Common/src/CoreLib/Interop/Windows/Kernel32/Interop.FormatMessage.cs \ No newline at end of file diff --git a/mcs/class/System.Security/winaot_System.Security.dll.exclude.sources b/mcs/class/System.Security/winaot_System.Security.dll.exclude.sources new file mode 100644 index 0000000000..750d4469a2 --- /dev/null +++ b/mcs/class/System.Security/winaot_System.Security.dll.exclude.sources @@ -0,0 +1 @@ +#include win32_System.Security.dll.exclude.sources \ No newline at end of file diff --git a/mcs/class/System.Security/winaot_System.Security.dll.sources b/mcs/class/System.Security/winaot_System.Security.dll.sources new file mode 100644 index 0000000000..dd7ad283a8 --- /dev/null +++ b/mcs/class/System.Security/winaot_System.Security.dll.sources @@ -0,0 +1 @@ +#include win32_System.Security.dll.sources diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateSelectionCallback.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateSelectionCallback.xml deleted file mode 100644 index fd28442c81..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateSelectionCallback.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Delegate - - - - - - - - - System.Security.Cryptography.X509Certificates.X509Certificate - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback.xml deleted file mode 100644 index bbb7a65980..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Delegate - - - - - - - System.Boolean - - - To be added. - To be added. - To be added. - To be added. - To be added. - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback2.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback2.xml deleted file mode 100644 index f79e6ebd2b..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CertificateValidationCallback2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Delegate - - - - - - Mono.Security.Protocol.Tls.ValidationResult - - - To be added. - To be added. - To be added. - To be added. - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CipherAlgorithmType.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CipherAlgorithmType.xml deleted file mode 100644 index d2e4d620c7..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/CipherAlgorithmType.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Enum - - - To be added. - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - To be added. - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.xml deleted file mode 100644 index 535f5c6c93..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Enum - - - To be added. - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - To be added. - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/HashAlgorithmType.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/HashAlgorithmType.xml deleted file mode 100644 index 0b27c6ea62..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/HashAlgorithmType.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Enum - - - To be added. - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - To be added. - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/PrivateKeySelectionCallback.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/PrivateKeySelectionCallback.xml deleted file mode 100644 index 4428f82f59..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/PrivateKeySelectionCallback.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Delegate - - - - - - - System.Security.Cryptography.AsymmetricAlgorithm - - - To be added. - To be added. - To be added. - To be added. - To be added. - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SecurityCompressionType.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SecurityCompressionType.xml deleted file mode 100644 index 8a35107931..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SecurityCompressionType.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Enum - - - To be added. - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.SecurityCompressionType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.SecurityCompressionType - - - To be added. - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SecurityProtocolType.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SecurityProtocolType.xml deleted file mode 100644 index 9274432a71..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SecurityProtocolType.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Enum - - - - System.Flags - - - - To be added. - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - To be added. - - - - - - Field - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - To be added. - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslClientStream.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslClientStream.xml deleted file mode 100644 index ffafc8c39f..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslClientStream.xml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - Mono.Security.Protocol.Tls.SslStreamBase - - - - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Security.Cryptography.X509Certificates.X509CertificateCollection - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CertificateSelectionCallback - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.PrivateKeySelectionCallback - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Security.Cryptography.X509Certificates.X509Certificate - - - To be added. - To be added. - To be added. - - - - - - Event - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CertificateValidationCallback2 - - - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CertificateValidationCallback - - - To be added. - To be added. - To be added. - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslServerStream.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslServerStream.xml deleted file mode 100644 index 44947fac62..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslServerStream.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - Mono.Security.Protocol.Tls.SslStreamBase - - - - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Security.Cryptography.X509Certificates.X509Certificate - - - To be added. - To be added. - To be added. - - - - - - Event - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CertificateValidationCallback2 - - - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CertificateValidationCallback - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.PrivateKeySelectionCallback - - - To be added. - To be added. - To be added. - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslStreamBase.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslStreamBase.xml deleted file mode 100644 index 34a4605a86..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/SslStreamBase.xml +++ /dev/null @@ -1,549 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.IO.Stream - - - - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.IAsyncResult - - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.IAsyncResult - - - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Boolean - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Boolean - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Boolean - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Boolean - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.CipherAlgorithmType - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Int32 - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Int32 - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.HashAlgorithmType - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Int32 - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.ExchangeAlgorithmType - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Int32 - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Int64 - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Int64 - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Int32 - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Int32 - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - Mono.Security.Protocol.Tls.SecurityProtocolType - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Int64 - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Security.Cryptography.X509Certificates.X509Certificate - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - - - To be added. - To be added. - To be added. - - - - - - Method - - 4.0.0.0 - - - System.Void - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/ValidationResult.xml b/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/ValidationResult.xml deleted file mode 100644 index c59e708cf1..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/Mono.Security.Protocol.Tls/ValidationResult.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - System.ServiceModel - 4.0.0.0 - - - System.Object - - - - To be added. - To be added. - - - - - - Constructor - - 4.0.0.0 - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Int32 - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Boolean - - - To be added. - To be added. - To be added. - - - - - - Property - - 4.0.0.0 - - - System.Boolean - - - To be added. - To be added. - To be added. - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/index.xml b/mcs/class/System.ServiceModel/Documentation/en/index.xml index 79fe780e24..c61a780b4c 100644 --- a/mcs/class/System.ServiceModel/Documentation/en/index.xml +++ b/mcs/class/System.ServiceModel/Documentation/en/index.xml @@ -141,21 +141,6 @@ - - - - - - - - - - - - - - - diff --git a/mcs/class/System.ServiceModel/Documentation/en/ns-Mono.Security.Protocol.Tls.xml b/mcs/class/System.ServiceModel/Documentation/en/ns-Mono.Security.Protocol.Tls.xml deleted file mode 100644 index 95b0197559..0000000000 --- a/mcs/class/System.ServiceModel/Documentation/en/ns-Mono.Security.Protocol.Tls.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - To be added. - To be added. - - diff --git a/mcs/class/System.ServiceModel/Mono.Security.Cryptography/TlsHMAC.cs b/mcs/class/System.ServiceModel/Mono.Security.Cryptography/TlsHMAC.cs deleted file mode 100644 index 722d2e53b4..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Cryptography/TlsHMAC.cs +++ /dev/null @@ -1,212 +0,0 @@ - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/* Transport Security Layer (TLS) - * Copyright (c) 2003-2004 Carlos Guzman Alvarez - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -using System; -using System.Security.Cryptography; - -namespace Mono.Security.Cryptography -{ - /* - * References: - * RFC 2104 (http://www.ietf.org/rfc/rfc2104.txt) - * RFC 2202 (http://www.ietf.org/rfc/rfc2202.txt) - * MSDN: - * - * Extending the KeyedHashAlgorithm Class (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconextendingkeyedhashalgorithmclass.asp) - */ - internal class HMAC : System.Security.Cryptography.KeyedHashAlgorithm - { - #region Fields - - private HashAlgorithm hash; - private bool hashing; - - private byte[] innerPad; - private byte[] outerPad; - - #endregion - - #region Properties - - public override byte[] Key - { - get { return (byte[])KeyValue.Clone(); } - set - { - if (hashing) - { - throw new Exception("Cannot change key during hash operation."); - } - - /* if key is longer than 64 bytes reset it to rgbKey = Hash(rgbKey) */ - if (value.Length > 64) - { - KeyValue = hash.ComputeHash(value); - } - else - { - KeyValue = (byte[])value.Clone(); - } - - initializePad(); - } - } - - #endregion - - #region Constructors - - public HMAC() - { - // Create the hash - hash = MD5.Create(); - // Set HashSizeValue - HashSizeValue = hash.HashSize; - - // Generate a radom key - byte[] rgbKey = new byte[64]; - RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); - rng.GetNonZeroBytes(rgbKey); - - KeyValue = (byte[])rgbKey.Clone(); - - this.Initialize(); - } - - public HMAC(string hashName, byte[] rgbKey) - { - // Create the hash - if (hashName == null || hashName.Length == 0) - { - hashName = "MD5"; - } - hash = HashAlgorithm.Create(hashName); - // Set HashSizeValue - HashSizeValue = hash.HashSize; - - /* if key is longer than 64 bytes reset it to rgbKey = Hash(rgbKey) */ - if (rgbKey.Length > 64) - { - KeyValue = hash.ComputeHash(rgbKey); - } - else - { - KeyValue = (byte[])rgbKey.Clone(); - } - - this.Initialize(); - } - - #endregion - - #region Methods - - public override void Initialize() - { - hash.Initialize(); - initializePad(); - hashing = false; - } - - protected override byte[] HashFinal() - { - if (!hashing) - { - hash.TransformBlock(innerPad, 0, innerPad.Length, innerPad, 0); - hashing = true; - } - // Finalize the original hash - hash.TransformFinalBlock(new byte[0], 0, 0); - - byte[] firstResult = hash.Hash; - - hash.Initialize(); - hash.TransformBlock(outerPad, 0, outerPad.Length, outerPad, 0); - hash.TransformFinalBlock(firstResult, 0, firstResult.Length); - - Initialize(); - - return hash.Hash; - } - - protected override void HashCore( - byte[] array, - int ibStart, - int cbSize) - { - if (!hashing) - { - hash.TransformBlock(innerPad, 0, innerPad.Length, innerPad, 0); - hashing = true; - } - hash.TransformBlock(array, ibStart, cbSize, array, ibStart); - } - - #endregion - - #region Private Methods - - private void initializePad() - { - // Fill pad arrays - innerPad = new byte[64]; - outerPad = new byte[64]; - - /* Pad the key for inner and outer digest */ - for (int i = 0 ; i < KeyValue.Length; ++i) - { - innerPad[i] = (byte)(KeyValue[i] ^ 0x36); - outerPad[i] = (byte)(KeyValue[i] ^ 0x5C); - } - for (int i = KeyValue.Length; i < 64; ++i) - { - innerPad[i] = 0x36; - outerPad[i] = 0x5C; - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs deleted file mode 100644 index d59769b0a7..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography.X509Certificates; - -using Mono.Security.Protocol.Tls; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsClientCertificate : HandshakeMessage - { - private bool clientCertSelected; - private X509Certificate clientCert; - - #region Constructors - - public TlsClientCertificate(Context context) - : base(context, HandshakeType.Certificate) - { - } - - #endregion - - #region Properties - - public X509Certificate ClientCertificate { - get { - if (!clientCertSelected) - { - GetClientCertificate (); - clientCertSelected = true; - } - return clientCert; - } - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - this.Reset(); - } - - #endregion - - #region Protected Methods - - private void GetClientCertificate () - { -#warning "Client certificate selection is unfinished" - ClientContext context = (ClientContext)this.Context; - - // note: the server may ask for mutual authentication - // but may not require it (i.e. it can be optional). - if (context.ClientSettings.Certificates != null && - context.ClientSettings.Certificates.Count > 0) - { - clientCert = context.SslStream.RaiseClientCertificateSelection( - this.Context.ClientSettings.Certificates, - new X509Certificate(this.Context.ServerSettings.Certificates[0].RawData), - this.Context.ClientSettings.TargetHost, - null); - // Note: the application code can raise it's - // own exception to stop the connection too. - } - - // Update the selected client certificate - context.ClientSettings.ClientCertificate = clientCert; - } - - private void SendCertificates () - { - TlsStream chain = new TlsStream (); - - X509Certificate currentCert = this.ClientCertificate; - while (currentCert != null) { - byte[] rawCert = currentCert.GetRawCertData (); - chain.WriteInt24 (rawCert.Length); - chain.Write(rawCert); - currentCert = FindParentCertificate (currentCert); - } - this.WriteInt24 ((int)chain.Length); - this.Write (chain.ToArray ()); - } - - protected override void ProcessAsSsl3() - { - if (this.ClientCertificate != null) { - SendCertificates (); - } else { - // an Alert warning for NoCertificate (41) - // should be sent from here - but that would - // break the current message handling - } - } - - protected override void ProcessAsTls1() - { - if (this.ClientCertificate != null) { - SendCertificates (); - } else { - // return message with empty certificate (see 7.4.6 in RFC2246) - this.WriteInt24 (0); - } - } - - private X509Certificate FindParentCertificate (X509Certificate cert) - { - // This certificate is the root certificate - if (cert.GetName () == cert.GetIssuerName ()) - return null; - - foreach (X509Certificate certificate in this.Context.ClientSettings.Certificates) { - if (cert.GetName () == cert.GetIssuerName ()) - return certificate; - } - return null; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs deleted file mode 100644 index bfa689d2ea..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs +++ /dev/null @@ -1,220 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography.X509Certificates; - -using System.Security.Cryptography; -using Mono.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsClientCertificateVerify : HandshakeMessage - { - #region Constructors - - public TlsClientCertificateVerify(Context context) - : base(context, HandshakeType.CertificateVerify) - { - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - this.Reset(); - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - AsymmetricAlgorithm privKey = null; - ClientContext context = (ClientContext)this.Context; - - privKey = context.SslStream.RaisePrivateKeySelection( - context.ClientSettings.ClientCertificate, - context.ClientSettings.TargetHost); - - if (privKey == null) - { - throw new TlsException(AlertDescription.UserCancelled, "Client certificate Private Key unavailable."); - } - else - { - SslHandshakeHash hash = new SslHandshakeHash(context.MasterSecret); - hash.TransformFinalBlock( - context.HandshakeMessages.ToArray(), - 0, - (int)context.HandshakeMessages.Length); - - // CreateSignature uses ((RSA)privKey).DecryptValue which is not implemented - // in RSACryptoServiceProvider. Other implementations likely implement DecryptValue - // so we will try the CreateSignature method. - byte[] signature = null; - if (!(privKey is RSACryptoServiceProvider)) - { - try - { - signature = hash.CreateSignature((RSA)privKey); - } - catch (NotImplementedException) - { } - } - // If DecryptValue is not implemented, then try to export the private - // key and let the RSAManaged class do the DecryptValue - if (signature == null) - { - // RSAManaged of the selected ClientCertificate - // (at this moment the first one) - RSA rsa = this.getClientCertRSA((RSA)privKey); - - // Write message - signature = hash.CreateSignature(rsa); - } - this.Write((short)signature.Length); - this.Write(signature, 0, signature.Length); - } - } - - protected override void ProcessAsTls1() - { - AsymmetricAlgorithm privKey = null; - ClientContext context = (ClientContext)this.Context; - - privKey = context.SslStream.RaisePrivateKeySelection( - context.ClientSettings.ClientCertificate, - context.ClientSettings.TargetHost); - - if (privKey == null) - { - throw new TlsException(AlertDescription.UserCancelled, "Client certificate Private Key unavailable."); - } - else - { - // Compute handshake messages hash - MD5SHA1 hash = new MD5SHA1(); - hash.ComputeHash( - context.HandshakeMessages.ToArray(), - 0, - (int)context.HandshakeMessages.Length); - - // CreateSignature uses ((RSA)privKey).DecryptValue which is not implemented - // in RSACryptoServiceProvider. Other implementations likely implement DecryptValue - // so we will try the CreateSignature method. - byte[] signature = null; - if (!(privKey is RSACryptoServiceProvider)) - { - try - { - signature = hash.CreateSignature((RSA)privKey); - } - catch (NotImplementedException) - { } - } - // If DecryptValue is not implemented, then try to export the private - // key and let the RSAManaged class do the DecryptValue - if (signature == null) - { - // RSAManaged of the selected ClientCertificate - // (at this moment the first one) - RSA rsa = this.getClientCertRSA((RSA)privKey); - - // Write message - signature = hash.CreateSignature(rsa); - } - this.Write((short)signature.Length); - this.Write(signature, 0, signature.Length); - } - } - - #endregion - - #region Private methods - - private RSA getClientCertRSA(RSA privKey) - { - RSAParameters rsaParams = new RSAParameters(); - RSAParameters privateParams = privKey.ExportParameters(true); - - // for RSA m_publickey contains 2 ASN.1 integers - // the modulus and the public exponent - ASN1 pubkey = new ASN1 (this.Context.ClientSettings.Certificates[0].GetPublicKey()); - ASN1 modulus = pubkey [0]; - if ((modulus == null) || (modulus.Tag != 0x02)) - { - return null; - } - ASN1 exponent = pubkey [1]; - if (exponent.Tag != 0x02) - { - return null; - } - - rsaParams.Modulus = this.getUnsignedBigInteger(modulus.Value); - rsaParams.Exponent = exponent.Value; - - // Set private key parameters - rsaParams.D = privateParams.D; - rsaParams.DP = privateParams.DP; - rsaParams.DQ = privateParams.DQ; - rsaParams.InverseQ = privateParams.InverseQ; - rsaParams.P = privateParams.P; - rsaParams.Q = privateParams.Q; - - // BUG: MS BCL 1.0 can't import a key which - // isn't the same size as the one present in - // the container. - int keySize = (rsaParams.Modulus.Length << 3); - RSAManaged rsa = new RSAManaged(keySize); - rsa.ImportParameters (rsaParams); - - return (RSA)rsa; - } - - private byte[] getUnsignedBigInteger(byte[] integer) - { - if (integer [0] == 0x00) - { - // this first byte is added so we're sure it's an unsigned integer - // however we can't feed it into RSAParameters or DSAParameters - int length = integer.Length - 1; - byte[] uinteger = new byte [length]; - Buffer.BlockCopy (integer, 1, uinteger, 0, length); - return uinteger; - } - else - { - return integer; - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs deleted file mode 100644 index 9f2e1ae2fb..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -using Mono.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsClientFinished : HandshakeMessage - { - #region Constructors - - public TlsClientFinished(Context context) - : base(context, HandshakeType.Finished) - { - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - this.Reset(); - } - - #endregion - - #region Protected Methods - - static private byte[] Ssl3Marker = new byte [4] { 0x43, 0x4c, 0x4e, 0x54 }; - - protected override void ProcessAsSsl3() - { - // Compute handshake messages hashes - HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret); - - byte[] data = this.Context.HandshakeMessages.ToArray (); - hash.TransformBlock (data, 0, data.Length, data, 0); - hash.TransformBlock (Ssl3Marker, 0, Ssl3Marker.Length, Ssl3Marker, 0); - // hack to avoid memory allocation - hash.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0); - - this.Write (hash.Hash); - } - - protected override void ProcessAsTls1() - { - // Compute handshake messages hash - HashAlgorithm hash = new MD5SHA1(); - - // note: we could call HashAlgorithm.ComputeHash(Stream) but that would allocate (on Mono) - // a 4096 bytes buffer to process the hash - which is bigger than HandshakeMessages - byte[] data = this.Context.HandshakeMessages.ToArray (); - byte[] digest = hash.ComputeHash (data, 0, data.Length); - - // Write message - Write(this.Context.Write.Cipher.PRF(this.Context.MasterSecret, "client finished", digest, 12)); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs deleted file mode 100644 index 9800ce04c0..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsClientHello : HandshakeMessage - { - #region Fields - - private byte[] random; - - #endregion - - #region Constructors - - public TlsClientHello(Context context) - : base(context, HandshakeType.ClientHello) - { - } - - #endregion - - #region Methods - - public override void Update() - { - ClientContext context = (ClientContext)this.Context; - - base.Update(); - - context.ClientRandom = random; - context.ClientHelloProtocol = this.Context.Protocol; - - random = null; - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - // Client Version - this.Write(this.Context.Protocol); - - // Random bytes - Unix time + Radom bytes [28] - TlsStream clientRandom = new TlsStream(); - clientRandom.Write(this.Context.GetUnixTime()); - clientRandom.Write(this.Context.GetSecureRandomBytes(28)); - this.random = clientRandom.ToArray(); - clientRandom.Reset(); - - this.Write(this.random); - - // Session id - // Check if we have a cache session we could reuse - this.Context.SessionId = ClientSessionCache.FromHost (this.Context.ClientSettings.TargetHost); - if (this.Context.SessionId != null) - { - this.Write((byte)this.Context.SessionId.Length); - if (this.Context.SessionId.Length > 0) - { - this.Write(this.Context.SessionId); - } - } - else - { - this.Write((byte)0); - } - - // Write length of Cipher suites - this.Write((short)(this.Context.SupportedCiphers.Count*2)); - - // Write Supported Cipher suites - for (int i = 0; i < this.Context.SupportedCiphers.Count; i++) - { - this.Write((short)this.Context.SupportedCiphers[i].Code); - } - - // Compression methods length - this.Write((byte)1); - - // Compression methods ( 0 = none ) - this.Write((byte)this.Context.CompressionMethod); - } - - #endregion - } -} \ No newline at end of file diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs deleted file mode 100644 index 3534d83317..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -using Mono.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsClientKeyExchange : HandshakeMessage - { - #region Constructors - - public TlsClientKeyExchange (Context context) : - base(context, HandshakeType.ClientKeyExchange) - { - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - // a large chunk of code is common to both SSL3 and TLS1 - // SSL3 doesn't send the length of the buffer - ProcessCommon (false); - } - - protected override void ProcessAsTls1() - { - // a large chunk of code is common to both SSL3 and TLS1 - // TLS1 does send the length of the buffer - ProcessCommon (true); - } - - public void ProcessCommon (bool sendLength) - { - // Compute pre master secret - byte[] preMasterSecret = this.Context.Negotiating.Cipher.CreatePremasterSecret (); - - // Create a new RSA key - RSA rsa = null; - if (this.Context.ServerSettings.ServerKeyExchange) - { - // this is the case for "exportable" ciphers - rsa = new RSAManaged (); - rsa.ImportParameters (this.Context.ServerSettings.RsaParameters); - } - else - { - rsa = this.Context.ServerSettings.CertificateRSA; - } - - // Encrypt premaster_sercret - RSAPKCS1KeyExchangeFormatter formatter = new RSAPKCS1KeyExchangeFormatter (rsa); - - // Write the preMasterSecret encrypted - byte[] buffer = formatter.CreateKeyExchange (preMasterSecret); - if (sendLength) - this.Write ((short) buffer.Length); - this.Write (buffer); - - // Create master secret - this.Context.Negotiating.Cipher.ComputeMasterSecret (preMasterSecret); - - // Create keys - this.Context.Negotiating.Cipher.ComputeKeys (); - - // Clear resources - rsa.Clear (); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs deleted file mode 100644 index eb4f82d069..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs +++ /dev/null @@ -1,438 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2004, 2006-2010 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Net; -using System.Collections; -using System.Globalization; -using System.Text.RegularExpressions; -using System.Security.Cryptography; -using X509Cert = System.Security.Cryptography.X509Certificates; - -using Mono.Security.X509; -using Mono.Security.X509.Extensions; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsServerCertificate : HandshakeMessage - { - #region Fields - - private X509CertificateCollection certificates; - - #endregion - - #region Constructors - - public TlsServerCertificate(Context context, byte[] buffer) - : base(context, HandshakeType.Certificate, buffer) - { - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - this.Context.ServerSettings.Certificates = this.certificates; - this.Context.ServerSettings.UpdateCertificateRSA(); - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - this.certificates = new X509CertificateCollection(); - - int readed = 0; - int length = this.ReadInt24(); - - while (readed < length) - { - // Read certificate length - int certLength = ReadInt24(); - - // Increment readed - readed += 3; - - if (certLength > 0) - { - // Read certificate data - byte[] buffer = this.ReadBytes(certLength); - - // Create a new X509 Certificate - X509Certificate certificate = new X509Certificate(buffer); - certificates.Add(certificate); - - readed += certLength; - - DebugHelper.WriteLine( - String.Format("Server Certificate {0}", certificates.Count), - buffer); - } - } - - this.validateCertificates(certificates); - } - - #endregion - - #region Private Methods - - // Note: this method only works for RSA certificates - // DH certificates requires some changes - does anyone use one ? - private bool checkCertificateUsage (X509Certificate cert) - { - ClientContext context = (ClientContext)this.Context; - - // certificate extensions are required for this - // we "must" accept older certificates without proofs - if (cert.Version < 3) - return true; - - KeyUsages ku = KeyUsages.none; - switch (context.Negotiating.Cipher.ExchangeAlgorithmType) - { - case ExchangeAlgorithmType.RsaSign: - ku = KeyUsages.digitalSignature; - break; - case ExchangeAlgorithmType.RsaKeyX: - ku = KeyUsages.keyEncipherment; - break; - case ExchangeAlgorithmType.DiffieHellman: - ku = KeyUsages.keyAgreement; - break; - case ExchangeAlgorithmType.Fortezza: - return false; // unsupported certificate type - } - - KeyUsageExtension kux = null; - ExtendedKeyUsageExtension eku = null; - - X509Extension xtn = cert.Extensions ["2.5.29.15"]; - if (xtn != null) - kux = new KeyUsageExtension (xtn); - - xtn = cert.Extensions ["2.5.29.37"]; - if (xtn != null) - eku = new ExtendedKeyUsageExtension (xtn); - - if ((kux != null) && (eku != null)) - { - // RFC3280 states that when both KeyUsageExtension and - // ExtendedKeyUsageExtension are present then BOTH should - // be valid - if (!kux.Support (ku)) - return false; - return (eku.KeyPurpose.Contains ("1.3.6.1.5.5.7.3.1") || - eku.KeyPurpose.Contains ("2.16.840.1.113730.4.1")); - } - else if (kux != null) - { - return kux.Support (ku); - } - else if (eku != null) - { - // Server Authentication (1.3.6.1.5.5.7.3.1) or - // Netscape Server Gated Crypto (2.16.840.1.113730.4) - return (eku.KeyPurpose.Contains ("1.3.6.1.5.5.7.3.1") || - eku.KeyPurpose.Contains ("2.16.840.1.113730.4.1")); - } - - // last chance - try with older (deprecated) Netscape extensions - xtn = cert.Extensions ["2.16.840.1.113730.1.1"]; - if (xtn != null) - { - NetscapeCertTypeExtension ct = new NetscapeCertTypeExtension (xtn); - return ct.Support (NetscapeCertTypeExtension.CertTypes.SslServer); - } - - // if the CN=host (checked later) then we assume this is meant for SSL/TLS - // e.g. the new smtp.gmail.com certificate - return true; - } - - - static private void VerifyOSX (X509CertificateCollection certificates) - { - - } - - private void validateCertificates(X509CertificateCollection certificates) - { - ClientContext context = (ClientContext)this.Context; - AlertDescription description = AlertDescription.BadCertificate; - - if (context.SslStream.HaveRemoteValidation2Callback) { - ValidationResult res = context.SslStream.RaiseServerCertificateValidation2 (certificates); - if (res.Trusted) - return; - - long error = res.ErrorCode; - switch (error) { - case 0x800B0101: - description = AlertDescription.CertificateExpired; - break; - case 0x800B010A: - description = AlertDescription.UnknownCA; - break; - case 0x800B0109: - description = AlertDescription.UnknownCA; - break; - default: - description = AlertDescription.CertificateUnknown; - break; - } - string err = String.Format ("0x{0:x}", error); - throw new TlsException (description, "Invalid certificate received from server. Error code: " + err); - } - // the leaf is the web server certificate - X509Certificate leaf = certificates [0]; - X509Cert.X509Certificate cert = new X509Cert.X509Certificate (leaf.RawData); - - ArrayList errors = new ArrayList(); - - // SSL specific check - not all certificates can be - // used to server-side SSL some rules applies after - // all ;-) - if (!checkCertificateUsage (leaf)) - { - // WinError.h CERT_E_PURPOSE 0x800B0106 - errors.Add ((int)-2146762490); - } - - // SSL specific check - does the certificate match - // the host ? - if (!checkServerIdentity (leaf)) - { - // WinError.h CERT_E_CN_NO_MATCH 0x800B010F - errors.Add ((int)-2146762481); - } - - // Note: building and verifying a chain can take much time - // so we do it last (letting simple things fails first) - - // Note: In TLS the certificates MUST be in order (and - // optionally include the root certificate) so we're not - // building the chain using LoadCertificate (it's faster) - - // Note: IIS doesn't seem to send the whole certificate chain - // but only the server certificate :-( it's assuming that you - // already have this chain installed on your computer. duh! - // http://groups.google.ca/groups?q=IIS+server+certificate+chain&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=85058s%24avd%241%40nnrp1.deja.com&rnum=3 - - // we must remove the leaf certificate from the chain - X509CertificateCollection chain = new X509CertificateCollection (certificates); - chain.Remove (leaf); - X509Chain verify = new X509Chain (chain); - - bool result = false; - - try - { - result = verify.Build (leaf); - } - catch (Exception) - { - result = false; - } - - if (!result) - { - switch (verify.Status) - { - case X509ChainStatusFlags.InvalidBasicConstraints: - // WinError.h TRUST_E_BASIC_CONSTRAINTS 0x80096019 - errors.Add ((int)-2146869223); - break; - - case X509ChainStatusFlags.NotSignatureValid: - // WinError.h TRUST_E_BAD_DIGEST 0x80096010 - errors.Add ((int)-2146869232); - break; - - case X509ChainStatusFlags.NotTimeNested: - // WinError.h CERT_E_VALIDITYPERIODNESTING 0x800B0102 - errors.Add ((int)-2146762494); - break; - - case X509ChainStatusFlags.NotTimeValid: - // WinError.h CERT_E_EXPIRED 0x800B0101 - description = AlertDescription.CertificateExpired; - errors.Add ((int)-2146762495); - break; - - case X509ChainStatusFlags.PartialChain: - // WinError.h CERT_E_CHAINING 0x800B010A - description = AlertDescription.UnknownCA; - errors.Add ((int)-2146762486); - break; - - case X509ChainStatusFlags.UntrustedRoot: - // WinError.h CERT_E_UNTRUSTEDROOT 0x800B0109 - description = AlertDescription.UnknownCA; - errors.Add ((int)-2146762487); - break; - - default: - // unknown error - description = AlertDescription.CertificateUnknown; - errors.Add ((int)verify.Status); - break; - } - } - - int[] certificateErrors = (int[])errors.ToArray(typeof(int)); - - if (!context.SslStream.RaiseServerCertificateValidation( - cert, - certificateErrors)) - { - throw new TlsException( - description, - "Invalid certificate received from server."); - } - } - - // RFC2818 - HTTP Over TLS, Section 3.1 - // http://www.ietf.org/rfc/rfc2818.txt - // - // 1. if present MUST use subjectAltName dNSName as identity - // 1.1. if multiples entries a match of any one is acceptable - // 1.2. wildcard * is acceptable - // 2. URI may be an IP address -> subjectAltName.iPAddress - // 2.1. exact match is required - // 3. Use of the most specific Common Name (CN=) in the Subject - // 3.1 Existing practice but DEPRECATED - private bool checkServerIdentity (X509Certificate cert) - { - ClientContext context = (ClientContext)this.Context; - - string targetHost = context.ClientSettings.TargetHost; - - X509Extension ext = cert.Extensions ["2.5.29.17"]; - // 1. subjectAltName - if (ext != null) - { - SubjectAltNameExtension subjectAltName = new SubjectAltNameExtension (ext); - // 1.1 - multiple dNSName - foreach (string dns in subjectAltName.DNSNames) - { - // 1.2 TODO - wildcard support - if (Match (targetHost, dns)) - return true; - } - // 2. ipAddress - foreach (string ip in subjectAltName.IPAddresses) - { - // 2.1. Exact match required - if (ip == targetHost) - return true; - } - } - // 3. Common Name (CN=) - return checkDomainName (cert.SubjectName); - } - - private bool checkDomainName(string subjectName) - { - ClientContext context = (ClientContext)this.Context; - - string domainName = String.Empty; - Regex search = new Regex(@"CN\s*=\s*([^,]*)"); - - MatchCollection elements = search.Matches(subjectName); - - if (elements.Count == 1) - { - if (elements[0].Success) - { - domainName = elements[0].Groups[1].Value.ToString(); - } - } - - return Match (context.ClientSettings.TargetHost, domainName); - } - - // ensure the pattern is valid wrt to RFC2595 and RFC2818 - // http://www.ietf.org/rfc/rfc2595.txt - // http://www.ietf.org/rfc/rfc2818.txt - static bool Match (string hostname, string pattern) - { - // check if this is a pattern - int index = pattern.IndexOf ('*'); - if (index == -1) { - // not a pattern, do a direct case-insensitive comparison - return (String.Compare (hostname, pattern, true, CultureInfo.InvariantCulture) == 0); - } - - // check pattern validity - // A "*" wildcard character MAY be used as the left-most name component in the certificate. - - // unless this is the last char (valid) - if (index != pattern.Length - 1) { - // then the next char must be a dot .'. - if (pattern [index + 1] != '.') - return false; - } - - // only one (A) wildcard is supported - int i2 = pattern.IndexOf ('*', index + 1); - if (i2 != -1) - return false; - - // match the end of the pattern - string end = pattern.Substring (index + 1); - int length = hostname.Length - end.Length; - // no point to check a pattern that is longer than the hostname - if (length <= 0) - return false; - - if (String.Compare (hostname, length, end, 0, end.Length, true, CultureInfo.InvariantCulture) != 0) - return false; - - // special case, we start with the wildcard - if (index == 0) { - // ensure we hostname non-matched part (start) doesn't contain a dot - int i3 = hostname.IndexOf ('.'); - return ((i3 == -1) || (i3 >= (hostname.Length - end.Length))); - } - - // match the start of the pattern - string start = pattern.Substring (0, index); - return (String.Compare (hostname, 0, start, 0, start.Length, true, CultureInfo.InvariantCulture) == 0); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs deleted file mode 100644 index cedb565c92..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Text; -using Mono.Security; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsServerCertificateRequest : HandshakeMessage - { - #region Fields - - private ClientCertificateType[] certificateTypes; - private string[] distinguisedNames; - - #endregion - - #region Constructors - - public TlsServerCertificateRequest(Context context, byte[] buffer) - : base(context, HandshakeType.CertificateRequest, buffer) - { - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - - this.Context.ServerSettings.CertificateTypes = this.certificateTypes; - this.Context.ServerSettings.DistinguisedNames = this.distinguisedNames; - this.Context.ServerSettings.CertificateRequest = true; - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - // Read requested certificate types - int typesCount = this.ReadByte(); - - this.certificateTypes = new ClientCertificateType[typesCount]; - - for (int i = 0; i < typesCount; i++) - { - this.certificateTypes[i] = (ClientCertificateType)this.ReadByte(); - } - - /* - * Read requested certificate authorities (Distinguised Names) - * - * Name ::= SEQUENCE OF RelativeDistinguishedName - * - * RelativeDistinguishedName ::= SET OF AttributeValueAssertion - * - * AttributeValueAssertion ::= SEQUENCE { - * attributeType OBJECT IDENTIFIER - * attributeValue ANY } - */ - if (this.ReadInt16() != 0) - { - ASN1 rdn = new ASN1(this.ReadBytes(this.ReadInt16())); - - distinguisedNames = new string[rdn.Count]; - - for (int i = 0; i < rdn.Count; i++) - { - // element[0] = attributeType - // element[1] = attributeValue - ASN1 element = new ASN1(rdn[i].Value); - - distinguisedNames[i] = Encoding.UTF8.GetString(element[1].Value); - } - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs deleted file mode 100644 index b3831248d4..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -using Mono.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsServerFinished : HandshakeMessage - { - #region Constructors - - public TlsServerFinished(Context context, byte[] buffer) - : base(context, HandshakeType.Finished, buffer) - { - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - - // Hahdshake is finished - this.Context.HandshakeState = HandshakeState.Finished; - } - - #endregion - - #region Protected Methods - - static private byte[] Ssl3Marker = new byte [4] { 0x53, 0x52, 0x56, 0x52 }; - - protected override void ProcessAsSsl3() - { - // Compute handshake messages hashes - HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret); - - byte[] data = this.Context.HandshakeMessages.ToArray (); - hash.TransformBlock (data, 0, data.Length, data, 0); - hash.TransformBlock (Ssl3Marker, 0, Ssl3Marker.Length, Ssl3Marker, 0); - // hack to avoid memory allocation - hash.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0); - - byte[] serverHash = this.ReadBytes((int)Length); - byte[] clientHash = hash.Hash; - - // Check server prf against client prf - if (!Compare (clientHash, serverHash)) - { -#warning Review that selected alert is correct - throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid ServerFinished message received."); - } - } - - protected override void ProcessAsTls1() - { - byte[] serverPRF = this.ReadBytes((int)Length); - HashAlgorithm hash = new MD5SHA1(); - - // note: we could call HashAlgorithm.ComputeHash(Stream) but that would allocate (on Mono) - // a 4096 bytes buffer to process the hash - which is bigger than HandshakeMessages - byte[] data = this.Context.HandshakeMessages.ToArray (); - byte[] digest = hash.ComputeHash (data, 0, data.Length); - - byte[] clientPRF = this.Context.Current.Cipher.PRF(this.Context.MasterSecret, "server finished", digest, 12); - - // Check server prf against client prf - if (!Compare (clientPRF, serverPRF)) - { - throw new TlsException("Invalid ServerFinished message received."); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs deleted file mode 100644 index bb662a02d0..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsServerHello : HandshakeMessage - { - #region Fields - - private SecurityCompressionType compressionMethod; - private byte[] random; - private byte[] sessionId; - private CipherSuite cipherSuite; - - #endregion - - #region Constructors - - public TlsServerHello(Context context, byte[] buffer) - : base(context, HandshakeType.ServerHello, buffer) - { - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - - this.Context.SessionId = this.sessionId; - this.Context.ServerRandom = this.random; - this.Context.Negotiating.Cipher = this.cipherSuite; - this.Context.CompressionMethod = this.compressionMethod; - this.Context.ProtocolNegotiated = true; - - DebugHelper.WriteLine("Selected Cipher Suite {0}", this.cipherSuite.Name); - DebugHelper.WriteLine("Client random", this.Context.ClientRandom); - DebugHelper.WriteLine("Server random", this.Context.ServerRandom); - - // Compute ClientRandom + ServerRandom - int clen = this.Context.ClientRandom.Length; - int slen = this.Context.ServerRandom.Length; - int rlen = clen + slen; - byte[] cs = new byte[rlen]; - Buffer.BlockCopy (this.Context.ClientRandom, 0, cs, 0, clen); - Buffer.BlockCopy (this.Context.ServerRandom, 0, cs, clen, slen); - this.Context.RandomCS = cs; - - // Server Random + Client Random - byte[] sc = new byte[rlen]; - Buffer.BlockCopy (this.Context.ServerRandom, 0, sc, 0, slen); - Buffer.BlockCopy (this.Context.ClientRandom, 0, sc, slen, clen); - this.Context.RandomSC = sc; - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - // Read protocol version - this.processProtocol(this.ReadInt16()); - - // Read random - Unix time + Random bytes - this.random = this.ReadBytes(32); - - // Read Session id - int length = (int) ReadByte (); - if (length > 0) - { - this.sessionId = this.ReadBytes(length); - ClientSessionCache.Add (this.Context.ClientSettings.TargetHost, this.sessionId); - this.Context.AbbreviatedHandshake = Compare (this.sessionId, this.Context.SessionId); - } - else - { - this.Context.AbbreviatedHandshake = false; - } - - // Read cipher suite - short cipherCode = this.ReadInt16(); - if (this.Context.SupportedCiphers.IndexOf(cipherCode) == -1) - { - // The server has sent an invalid ciphersuite - throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid cipher suite received from server"); - } - this.cipherSuite = this.Context.SupportedCiphers[cipherCode]; - - // Read compression methods ( always 0 ) - this.compressionMethod = (SecurityCompressionType)this.ReadByte(); - } - - #endregion - - #region Private Methods - - private void processProtocol(short protocol) - { - SecurityProtocolType serverProtocol = this.Context.DecodeProtocolCode(protocol); - - if ((serverProtocol & this.Context.SecurityProtocolFlags) == serverProtocol || - (this.Context.SecurityProtocolFlags & SecurityProtocolType.Default) == SecurityProtocolType.Default) - { - this.Context.SecurityProtocol = serverProtocol; - this.Context.SupportedCiphers.Clear(); - this.Context.SupportedCiphers = null; - this.Context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(serverProtocol); - - DebugHelper.WriteLine("Selected protocol {0}", serverProtocol); - } - else - { - throw new TlsException( - AlertDescription.ProtocolVersion, - "Incorrect protocol version received from server"); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs deleted file mode 100644 index 7a0e61fb5d..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsServerHelloDone : HandshakeMessage - { - #region Constructors - - public TlsServerHelloDone(Context context, byte[] buffer) - : base(context, HandshakeType.ServerHelloDone, buffer) - { - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - } - - protected override void ProcessAsTls1() - { - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs deleted file mode 100644 index d6c8e51302..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -using Mono.Security.Cryptography; -using Mono.Security.X509; - -namespace Mono.Security.Protocol.Tls.Handshake.Client -{ - internal class TlsServerKeyExchange : HandshakeMessage - { - #region Fields - - private RSAParameters rsaParams; - private byte[] signedParams; - - #endregion - - #region Constructors - - public TlsServerKeyExchange(Context context, byte[] buffer) - : base(context, HandshakeType.ServerKeyExchange, buffer) - { - this.verifySignature(); - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - - this.Context.ServerSettings.ServerKeyExchange = true; - this.Context.ServerSettings.RsaParameters = this.rsaParams; - this.Context.ServerSettings.SignedParams = this.signedParams; - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - this.rsaParams = new RSAParameters(); - - // Read modulus - this.rsaParams.Modulus = this.ReadBytes(this.ReadInt16()); - - // Read exponent - this.rsaParams.Exponent = this.ReadBytes(this.ReadInt16()); - - // Read signed params - this.signedParams = this.ReadBytes(this.ReadInt16()); - } - - #endregion - - #region Private Methods - - private void verifySignature() - { - MD5SHA1 hash = new MD5SHA1(); - - // Calculate size of server params - int size = rsaParams.Modulus.Length + rsaParams.Exponent.Length + 4; - - // Create server params array - TlsStream stream = new TlsStream(); - - stream.Write(this.Context.RandomCS); - stream.Write(this.ToArray(), 0, size); - - hash.ComputeHash(stream.ToArray()); - - stream.Reset(); - - bool isValidSignature = hash.VerifySignature( - this.Context.ServerSettings.CertificateRSA, - this.signedParams); - - if (!isValidSignature) - { - throw new TlsException( - AlertDescription.DecodeError, - "Data was not signed with the server certificate."); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs deleted file mode 100644 index 15d8dd6554..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs +++ /dev/null @@ -1,272 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using SSCX = System.Security.Cryptography.X509Certificates; -using Mono.Security.X509; -using Mono.Security.X509.Extensions; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsClientCertificate : HandshakeMessage - { - #region Fields - - private X509CertificateCollection clientCertificates; - - #endregion - - #region Constructors - - public TlsClientCertificate(Context context, byte[] buffer) - : base(context, HandshakeType.Certificate, buffer) - { - } - - #endregion - - #region Methods - - public override void Update() - { - foreach (X509Certificate certificate in clientCertificates) { - this.Context.ClientSettings.Certificates.Add (new SSCX.X509Certificate (certificate.RawData)); - } - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - int bytesRead = 0; - int length = this.ReadInt24 (); - this.clientCertificates = new X509CertificateCollection (); - while (length > bytesRead) { - int certLength = this.ReadInt24 (); - bytesRead += certLength + 3; - byte[] cert = this.ReadBytes (certLength); - this.clientCertificates.Add (new X509Certificate (cert)); - } - - if (this.clientCertificates.Count > 0) - { - this.validateCertificates (this.clientCertificates); - } - else if ((this.Context as ServerContext).ClientCertificateRequired) - { - throw new TlsException (AlertDescription.NoCertificate); - } - } - - #endregion - - #region Private Methods - - private bool checkCertificateUsage (X509Certificate cert) - { - ServerContext context = (ServerContext)this.Context; - - // certificate extensions are required for this - // we "must" accept older certificates without proofs - if (cert.Version < 3) - return true; - - KeyUsages ku = KeyUsages.none; - switch (context.Negotiating.Cipher.ExchangeAlgorithmType) - { - case ExchangeAlgorithmType.RsaSign: - case ExchangeAlgorithmType.RsaKeyX: - ku = KeyUsages.digitalSignature; - break; - case ExchangeAlgorithmType.DiffieHellman: - ku = KeyUsages.keyAgreement; - break; - case ExchangeAlgorithmType.Fortezza: - return false; // unsupported certificate type - } - - KeyUsageExtension kux = null; - ExtendedKeyUsageExtension eku = null; - - X509Extension xtn = cert.Extensions["2.5.29.15"]; - if (xtn != null) - kux = new KeyUsageExtension (xtn); - - xtn = cert.Extensions["2.5.29.37"]; - if (xtn != null) - eku = new ExtendedKeyUsageExtension (xtn); - - if ((kux != null) && (eku != null)) - { - // RFC3280 states that when both KeyUsageExtension and - // ExtendedKeyUsageExtension are present then BOTH should - // be valid - return (kux.Support (ku) && - eku.KeyPurpose.Contains ("1.3.6.1.5.5.7.3.2")); - } - else if (kux != null) - { - return kux.Support (ku); - } - else if (eku != null) - { - // Client Authentication (1.3.6.1.5.5.7.3.2) - return eku.KeyPurpose.Contains ("1.3.6.1.5.5.7.3.2"); - } - - // last chance - try with older (deprecated) Netscape extensions - xtn = cert.Extensions["2.16.840.1.113730.1.1"]; - if (xtn != null) - { - NetscapeCertTypeExtension ct = new NetscapeCertTypeExtension (xtn); - return ct.Support (NetscapeCertTypeExtension.CertTypes.SslClient); - } - - // certificate isn't valid for SSL server usage - return false; - } - - private void validateCertificates (X509CertificateCollection certificates) - { - ServerContext context = (ServerContext)this.Context; - AlertDescription description = AlertDescription.BadCertificate; - SSCX.X509Certificate client = null; - int[] certificateErrors = null; - - // note: certificate may be null is no certificate is sent - // (e.g. optional mutual authentication) - if (certificates.Count > 0) { - X509Certificate leaf = certificates[0]; - - ArrayList errors = new ArrayList (); - - // SSL specific check - not all certificates can be - // used to server-side SSL some rules applies after - // all ;-) - if (!checkCertificateUsage (leaf)) - { - // WinError.h CERT_E_PURPOSE 0x800B0106 - errors.Add ((int)-2146762490); - } - - X509Chain verify; - // was a chain supplied ? if so use it, if not - if (certificates.Count > 1) { - // if so use it (and don't build our own) - X509CertificateCollection chain = new X509CertificateCollection (certificates); - chain.Remove (leaf); - verify = new X509Chain (chain); - } else { - // if not, then let's build our own (based on what's available in the stores) - verify = new X509Chain (); - } - - bool result = false; - - try - { - result = verify.Build (leaf); - } - catch (Exception) - { - result = false; - } - - if (!result) - { - switch (verify.Status) - { - case X509ChainStatusFlags.InvalidBasicConstraints: - // WinError.h TRUST_E_BASIC_CONSTRAINTS 0x80096019 - errors.Add ((int)-2146869223); - break; - - case X509ChainStatusFlags.NotSignatureValid: - // WinError.h TRUST_E_BAD_DIGEST 0x80096010 - errors.Add ((int)-2146869232); - break; - - case X509ChainStatusFlags.NotTimeNested: - // WinError.h CERT_E_VALIDITYPERIODNESTING 0x800B0102 - errors.Add ((int)-2146762494); - break; - - case X509ChainStatusFlags.NotTimeValid: - // WinError.h CERT_E_EXPIRED 0x800B0101 - description = AlertDescription.CertificateExpired; - errors.Add ((int)-2146762495); - break; - - case X509ChainStatusFlags.PartialChain: - // WinError.h CERT_E_CHAINING 0x800B010A - description = AlertDescription.UnknownCA; - errors.Add ((int)-2146762486); - break; - - case X509ChainStatusFlags.UntrustedRoot: - // WinError.h CERT_E_UNTRUSTEDROOT 0x800B0109 - description = AlertDescription.UnknownCA; - errors.Add ((int)-2146762487); - break; - - default: - // unknown error - description = AlertDescription.CertificateUnknown; - errors.Add ((int)verify.Status); - break; - } - } - client = new SSCX.X509Certificate (leaf.RawData); - certificateErrors = (int[])errors.ToArray (typeof (int)); - } - else - { - certificateErrors = new int[0]; - } - - SSCX.X509CertificateCollection certCollection = new SSCX.X509CertificateCollection (); - foreach (X509Certificate certificate in certificates) { - certCollection.Add (new SSCX.X509Certificate (certificate.RawData)); - } - if (!context.SslStream.RaiseClientCertificateValidation(client, certificateErrors)) - { - throw new TlsException ( - description, - "Invalid certificate received from client."); - } - - this.Context.ClientSettings.ClientCertificate = client; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs deleted file mode 100644 index 20a69edbbd..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography.X509Certificates; - -using System.Security.Cryptography; -using Mono.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsClientCertificateVerify : HandshakeMessage - { - #region Constructors - - public TlsClientCertificateVerify(Context context, byte[] buffer) - : base(context, HandshakeType.CertificateVerify, buffer) - { - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - ServerContext context = (ServerContext)this.Context; - int length = this.ReadInt16 (); - byte[] signature = this.ReadBytes (length); - - // Verify signature - SslHandshakeHash hash = new SslHandshakeHash(context.MasterSecret); - hash.TransformFinalBlock( - context.HandshakeMessages.ToArray(), - 0, - (int)context.HandshakeMessages.Length); - - if (!hash.VerifySignature(context.ClientSettings.CertificateRSA, signature)) - { - throw new TlsException(AlertDescription.HandshakeFailiure, "Handshake Failure."); - } - } - - protected override void ProcessAsTls1() - { - ServerContext context = (ServerContext)this.Context; - int length = this.ReadInt16 (); - byte[] signature = this.ReadBytes (length); - - // Verify signature - MD5SHA1 hash = new MD5SHA1(); - hash.ComputeHash( - context.HandshakeMessages.ToArray(), - 0, - (int)context.HandshakeMessages.Length); - - if (!hash.VerifySignature(context.ClientSettings.CertificateRSA, signature)) - { - throw new TlsException (AlertDescription.HandshakeFailiure, "Handshake Failure."); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs deleted file mode 100644 index 26eaad9a31..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -using Mono.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsClientFinished : HandshakeMessage - { - #region Constructors - - public TlsClientFinished(Context context, byte[] buffer) - : base(context, HandshakeType.Finished, buffer) - { - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - // Compute handshake messages hashes - HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret); - - TlsStream data = new TlsStream(); - data.Write(this.Context.HandshakeMessages.ToArray()); - data.Write((int)0x434C4E54); - - hash.TransformFinalBlock(data.ToArray(), 0, (int)data.Length); - - data.Reset(); - - byte[] clientHash = this.ReadBytes((int)Length); - byte[] serverHash = hash.Hash; - - // Check client prf against server prf - if (!Compare (clientHash, serverHash)) - { - throw new TlsException(AlertDescription.DecryptError, "Decrypt error."); - } - } - - protected override void ProcessAsTls1() - { - byte[] clientPRF = this.ReadBytes((int)this.Length); - HashAlgorithm hash = new MD5SHA1(); - - byte[] data = this.Context.HandshakeMessages.ToArray (); - byte[] digest = hash.ComputeHash (data, 0, data.Length); - - byte[] serverPRF = this.Context.Current.Cipher.PRF( - this.Context.MasterSecret, "client finished", digest, 12); - - // Check client prf against server prf - if (!Compare (clientPRF, serverPRF)) - { - throw new TlsException(AlertDescription.DecryptError, "Decrypt error."); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs deleted file mode 100644 index e328e2acae..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsClientHello : HandshakeMessage - { - #region Private Fields - - private byte[] random; - private byte[] sessionId; - private short[] cipherSuites; - private byte[] compressionMethods; - - #endregion - - #region Constructors - - public TlsClientHello(Context context, byte[] buffer) - : base(context, HandshakeType.ClientHello, buffer) - { - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - - this.selectCipherSuite(); - this.selectCompressionMethod(); - - this.Context.SessionId = this.sessionId; - this.Context.ClientRandom = this.random; - this.Context.ProtocolNegotiated = true; - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - // Client Version - this.processProtocol(this.ReadInt16()); - - // Random bytes - Unix time + Radom bytes [28] - this.random = this.ReadBytes(32); - - // Session id - // Send the session ID empty - this.sessionId = this.ReadBytes(this.ReadByte()); - - // Read Supported Cipher Suites count - this.cipherSuites = new short[this.ReadInt16()/2]; - - // Read Cipher Suites - for (int i = 0; i < this.cipherSuites.Length; i++) - { - this.cipherSuites[i] = this.ReadInt16(); - } - - // Compression methods length - this.compressionMethods = new byte[this.ReadByte()]; - - for (int i = 0; i < this.compressionMethods.Length; i++) - { - this.compressionMethods[i] = this.ReadByte(); - } - } - - #endregion - - #region Private Methods - - private void processProtocol(short protocol) - { - SecurityProtocolType clientProtocol = this.Context.DecodeProtocolCode(protocol); - - if ((clientProtocol & this.Context.SecurityProtocolFlags) == clientProtocol || - (this.Context.SecurityProtocolFlags & SecurityProtocolType.Default) == SecurityProtocolType.Default) - { - this.Context.SecurityProtocol = clientProtocol; - this.Context.SupportedCiphers.Clear(); - this.Context.SupportedCiphers = null; - this.Context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(clientProtocol); - } - else - { - throw new TlsException(AlertDescription.ProtocolVersion, "Incorrect protocol version received from server"); - } - } - - private void selectCipherSuite() - { - int index = 0; - - for (int i = 0; i < this.cipherSuites.Length; i++) - { - if ((index = this.Context.SupportedCiphers.IndexOf(this.cipherSuites[i])) != -1) - { - this.Context.Negotiating.Cipher = this.Context.SupportedCiphers[index]; - break; - } - } - - if (this.Context.Negotiating.Cipher == null) - { - throw new TlsException(AlertDescription.InsuficientSecurity, "Insuficient Security"); - } - } - - private void selectCompressionMethod() - { - this.Context.CompressionMethod = SecurityCompressionType.None; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs deleted file mode 100644 index ceeb39ad46..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsClientKeyExchange : HandshakeMessage - { - #region Constructors - - public TlsClientKeyExchange(Context context, byte[] buffer) : - base(context, - HandshakeType.ClientKeyExchange, - buffer) - { - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - AsymmetricAlgorithm privKey = null; - ServerContext context = (ServerContext)this.Context; - - // Select the private key information - privKey = context.SslStream.RaisePrivateKeySelection( - new X509Certificate(context.ServerSettings.Certificates[0].RawData), - null); - - if (privKey == null) - { - throw new TlsException(AlertDescription.UserCancelled, "Server certificate Private Key unavailable."); - } - - // Read client premaster secret - byte[] clientSecret = this.ReadBytes((int)this.Length); - - // Decrypt premaster secret - RSAPKCS1KeyExchangeDeformatter deformatter = new RSAPKCS1KeyExchangeDeformatter(privKey); - - byte[] preMasterSecret = deformatter.DecryptKeyExchange(clientSecret); - - // Create master secret - this.Context.Negotiating.Cipher.ComputeMasterSecret(preMasterSecret); - - // Create keys - this.Context.Negotiating.Cipher.ComputeKeys (); - - // Initialize Cipher Suite - this.Context.Negotiating.Cipher.InitializeCipher (); - } - - protected override void ProcessAsTls1() - { - AsymmetricAlgorithm privKey = null; - ServerContext context = (ServerContext)this.Context; - - // Select the private key information - // Select the private key information - privKey = context.SslStream.RaisePrivateKeySelection( - new X509Certificate(context.ServerSettings.Certificates[0].RawData), - null); - - if (privKey == null) - { - throw new TlsException(AlertDescription.UserCancelled, "Server certificate Private Key unavailable."); - } - - // Read client premaster secret - byte[] clientSecret = this.ReadBytes(this.ReadInt16()); - - // Decrypt premaster secret - RSAPKCS1KeyExchangeDeformatter deformatter = new RSAPKCS1KeyExchangeDeformatter(privKey); - - byte[] preMasterSecret = deformatter.DecryptKeyExchange(clientSecret); - - // Create master secret - this.Context.Negotiating.Cipher.ComputeMasterSecret(preMasterSecret); - - // Create keys - this.Context.Negotiating.Cipher.ComputeKeys(); - - // Initialize Cipher Suite - this.Context.Negotiating.Cipher.InitializeCipher(); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs deleted file mode 100644 index 7475d2d1e6..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Text.RegularExpressions; -using System.Security.Cryptography; -using X509Cert = System.Security.Cryptography.X509Certificates; - -using Mono.Security.X509; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsServerCertificate : HandshakeMessage - { - #region Constructors - - public TlsServerCertificate(Context context) - : base(context, HandshakeType.Certificate) - { - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - TlsStream certs = new TlsStream(); - - foreach (X509Certificate certificate in this.Context.ServerSettings.Certificates) - { - // Write certificate length - certs.WriteInt24(certificate.RawData.Length); - - // Write certificate data - certs.Write(certificate.RawData); - } - - this.WriteInt24(Convert.ToInt32(certs.Length)); - this.Write(certs.ToArray()); - - certs.Close(); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs deleted file mode 100644 index a86e421723..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Text; -using Mono.Security; -using Mono.Security.X509; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsServerCertificateRequest : HandshakeMessage - { - #region Constructors - - public TlsServerCertificateRequest(Context context) - : base(context, HandshakeType.CertificateRequest) - { - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - ServerContext context = (ServerContext)this.Context; - - int count = context.ServerSettings.CertificateTypes.Length; - - this.WriteByte(Convert.ToByte(count)); - - // Write requested certificate types - for (int i = 0; i < count; i++) - { - this.WriteByte((byte)context.ServerSettings.CertificateTypes[i]); - } - - /* - * Write requested certificate authorities (Distinguised Names) - * - * Name ::= SEQUENCE OF RelativeDistinguishedName - * - * RelativeDistinguishedName ::= SET OF AttributeValueAssertion - * - * AttributeValueAssertion ::= SEQUENCE { - * attributeType OBJECT IDENTIFIER - * attributeValue ANY } - */ - - if (context.ServerSettings.DistinguisedNames.Length > 0) - { - TlsStream list = new TlsStream (); - // this is the worst formating ever :-| - foreach (string dn in context.ServerSettings.DistinguisedNames) - { - byte[] name = X501.FromString (dn).GetBytes (); - list.Write ((short)name.Length); - list.Write (name); - } - this.Write ((short)list.Length); - this.Write (list.ToArray ()); - } - else - { - this.Write ((short)0); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs deleted file mode 100644 index 91311506cf..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -using Mono.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsServerFinished : HandshakeMessage - { - #region Constructors - - public TlsServerFinished(Context context) - : base(context, HandshakeType.Finished) - { - } - - #endregion - - #region Protected Methods - - static private byte[] Ssl3Marker = new byte [4] { 0x53, 0x52, 0x56, 0x52 }; - - protected override void ProcessAsSsl3() - { - // Compute handshake messages hashes - HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret); - - byte[] data = this.Context.HandshakeMessages.ToArray (); - hash.TransformBlock (data, 0, data.Length, data, 0); - hash.TransformBlock (Ssl3Marker, 0, Ssl3Marker.Length, Ssl3Marker, 0); - // hack to avoid memory allocation - hash.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0); - - this.Write(hash.Hash); - } - - protected override void ProcessAsTls1() - { - // Compute handshake messages hash - HashAlgorithm hash = new MD5SHA1(); - byte[] data = this.Context.HandshakeMessages.ToArray (); - byte[] digest = hash.ComputeHash (data, 0, data.Length); - - // Write message - this.Write(this.Context.Current.Cipher.PRF( - this.Context.MasterSecret, "server finished", digest, 12)); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs deleted file mode 100644 index c02c24c57a..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsServerHello : HandshakeMessage - { - #region Private Fields - - private int unixTime; - private byte[] random; - - #endregion - - #region Constructors - - public TlsServerHello(Context context) - : base(context, HandshakeType.ServerHello) - { - } - - #endregion - - #region Methods - - public override void Update() - { - base.Update(); - - TlsStream random = new TlsStream(); - - // Compute Server Random - random.Write(this.unixTime); - random.Write(this.random); - - this.Context.ServerRandom = random.ToArray(); - - // Compute ClientRandom + ServerRandom - random.Reset(); - random.Write(this.Context.ClientRandom); - random.Write(this.Context.ServerRandom); - - this.Context.RandomCS = random.ToArray(); - - // Server Random + Client Random - random.Reset(); - random.Write(this.Context.ServerRandom); - random.Write(this.Context.ClientRandom); - - this.Context.RandomSC = random.ToArray(); - - random.Reset(); - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - // Write protocol version - this.Write(this.Context.Protocol); - - // Write Unix time - this.unixTime = this.Context.GetUnixTime(); - this.Write(this.unixTime); - - // Write Random bytes - random = this.Context.GetSecureRandomBytes(28); - this.Write(this.random); - - if (this.Context.SessionId == null) - { - this.WriteByte(0); - } - else - { - // Write Session ID length - this.WriteByte((byte)this.Context.SessionId.Length); - - // Write Session ID - this.Write(this.Context.SessionId); - } - - // Write selected cipher suite - this.Write(this.Context.Negotiating.Cipher.Code); - - // Write selected compression method - this.WriteByte((byte)this.Context.CompressionMethod); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs deleted file mode 100644 index 1ce467c062..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsServerHelloDone : HandshakeMessage - { - #region Constructors - - public TlsServerHelloDone(Context context) - : base(context, HandshakeType.ServerHelloDone) - { - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - } - - protected override void ProcessAsTls1() - { - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs deleted file mode 100644 index 8a2d03382a..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -using SX509 = System.Security.Cryptography.X509Certificates; - -using Mono.Security.Cryptography; -using Mono.Security.X509; - -namespace Mono.Security.Protocol.Tls.Handshake.Server -{ - internal class TlsServerKeyExchange : HandshakeMessage - { - #region Constructors - - public TlsServerKeyExchange(Context context) - : base(context, HandshakeType.ServerKeyExchange) - { - } - - #endregion - - #region Methods - - public override void Update() - { - throw new NotSupportedException(); - } - - #endregion - - #region Protected Methods - - protected override void ProcessAsSsl3() - { - this.ProcessAsTls1(); - } - - protected override void ProcessAsTls1() - { - ServerContext context = (ServerContext)this.Context; - - // Select the private key information - RSA rsa = (RSA)context.SslStream.PrivateKeyCertSelectionDelegate( - new SX509.X509Certificate(context.ServerSettings.Certificates[0].RawData), - null); - - RSAParameters rsaParams = rsa.ExportParameters(false); - - // Write Modulus - this.WriteInt24(rsaParams.Modulus.Length); - this.Write(rsaParams.Modulus, 0, rsaParams.Modulus.Length); - - // Write exponent - this.WriteInt24(rsaParams.Exponent.Length); - this.Write(rsaParams.Exponent, 0, rsaParams.Exponent.Length); - - // Write signed params - byte[] signature = this.createSignature(rsa, this.ToArray()); - this.WriteInt24(signature.Length); - this.Write(signature); - } - - #endregion - - #region Private Methods - - private byte[] createSignature(RSA rsa, byte[] buffer) - { - MD5SHA1 hash = new MD5SHA1(); - - // Create server params array - TlsStream stream = new TlsStream(); - - stream.Write(this.Context.RandomCS); - stream.Write(buffer, 0, buffer.Length); - - hash.ComputeHash(stream.ToArray()); - - stream.Reset(); - - return hash.CreateSignature(rsa); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs deleted file mode 100644 index 8bff712791..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls.Handshake -{ - [Serializable] - internal enum ClientCertificateType - { - RSA = 1, - DSS = 2, - RSAFixed = 3, - DSSFixed = 4, - Unknown = 255 - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs deleted file mode 100644 index 5407127416..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs +++ /dev/null @@ -1,170 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls.Handshake -{ - internal abstract class HandshakeMessage : TlsStream - { - #region Fields - - private Context context; - private HandshakeType handshakeType; - private ContentType contentType; - private byte[] cache; - - #endregion - - #region Properties - - public Context Context - { - get { return this.context; } - } - - public HandshakeType HandshakeType - { - get { return this.handshakeType; } - } - - public ContentType ContentType - { - get { return this.contentType; } - } - - #endregion - - #region Constructors - - public HandshakeMessage( - Context context, - HandshakeType handshakeType) - : this(context, handshakeType, ContentType.Handshake) - { - } - - public HandshakeMessage( - Context context, - HandshakeType handshakeType, - ContentType contentType) : base() - { - this.context = context; - this.handshakeType = handshakeType; - this.contentType = contentType; - } - - public HandshakeMessage( - Context context, - HandshakeType handshakeType, - byte[] data) : base(data) - { - this.context = context; - this.handshakeType = handshakeType; - } - - #endregion - - #region Abstract Methods - - protected abstract void ProcessAsTls1(); - - protected abstract void ProcessAsSsl3(); - - #endregion - - #region Methods - - public void Process() - { - switch (this.Context.SecurityProtocol) - { - case SecurityProtocolType.Tls: - case SecurityProtocolType.Default: - this.ProcessAsTls1(); - break; - - case SecurityProtocolType.Ssl3: - this.ProcessAsSsl3(); - break; - - case SecurityProtocolType.Ssl2: - default: - throw new NotSupportedException("Unsupported security protocol type"); - } - } - - public virtual void Update() - { - if (this.CanWrite) - { - // result may (should) be available from a previous call to EncodeMessage - if (cache == null) - cache = this.EncodeMessage (); - this.context.HandshakeMessages.Write (cache); - this.Reset(); - cache = null; - } - } - - public virtual byte[] EncodeMessage() - { - cache = null; - - if (CanWrite) - { - byte[] hs = this.ToArray (); - int len = hs.Length; - cache = new byte[4 + len]; - - cache[0] = (byte) HandshakeType; - // Length as an Int24 in Network Order - cache[1] = (byte) (len >> 16); - cache[2] = (byte) (len >> 8); - cache[3] = (byte) len; - Buffer.BlockCopy (hs, 0, cache, 4, len); - } - - return cache; - } - - static public bool Compare (byte[] buffer1, byte[] buffer2) - { - // in our case both null can't exist (or be valid) - if ((buffer1 == null) || (buffer2 == null)) - return false; - - if (buffer1.Length != buffer2.Length) - return false; - - for (int i = 0; i < buffer1.Length; i++) { - if (buffer1[i] != buffer2[i]) - return false; - } - return true; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs deleted file mode 100644 index a0165a3c61..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls.Handshake -{ - [Serializable] - internal enum HandshakeType : byte - { - HelloRequest = 0, - ClientHello = 1, - ServerHello = 2, - Certificate = 11, - ServerKeyExchange = 12, - CertificateRequest = 13, - ServerHelloDone = 14, - CertificateVerify = 15, - ClientKeyExchange = 16, - Finished = 20, - None = 255 - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/Alert.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/Alert.cs deleted file mode 100644 index b40292c2b9..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/Alert.cs +++ /dev/null @@ -1,267 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls -{ - #region Enumerations - - [Serializable] - internal enum AlertLevel : byte - { - Warning = 1, - Fatal = 2 - } - - [Serializable] - internal enum AlertDescription : byte - { - CloseNotify = 0, - UnexpectedMessage = 10, - BadRecordMAC = 20, - DecryptionFailed = 21, - RecordOverflow = 22, - DecompressionFailiure = 30, - HandshakeFailiure = 40, - NoCertificate = 41, // should be used in SSL3 - BadCertificate = 42, - UnsupportedCertificate = 43, - CertificateRevoked = 44, - CertificateExpired = 45, - CertificateUnknown = 46, - IlegalParameter = 47, - UnknownCA = 48, - AccessDenied = 49, - DecodeError = 50, - DecryptError = 51, - ExportRestriction = 60, - ProtocolVersion = 70, - InsuficientSecurity = 71, - InternalError = 80, - UserCancelled = 90, - NoRenegotiation = 100 - } - - #endregion - - internal class Alert - { - #region Fields - - private AlertLevel level; - private AlertDescription description; - - #endregion - - #region Properties - - public AlertLevel Level - { - get { return this.level; } - } - - public AlertDescription Description - { - get { return this.description; } - } - - public string Message - { - get { return Alert.GetAlertMessage(this.description); } - } - - public bool IsWarning - { - get { return this.level == AlertLevel.Warning ? true : false; } - } - - /* - public bool IsFatal - { - get { return this.level == AlertLevel.Fatal ? true : false; } - } - */ - - public bool IsCloseNotify - { - get - { - if (this.IsWarning && - this.description == AlertDescription.CloseNotify) - { - return true; - } - - return false; - } - } - - #endregion - - #region Constructors - - public Alert(AlertDescription description) - { - this.inferAlertLevel(); - this.description = description; - } - - public Alert( - AlertLevel level, - AlertDescription description) - { - this.level = level; - this.description = description; - } - - #endregion - - #region Private Methods - - private void inferAlertLevel() - { - switch (description) - { - case AlertDescription.CloseNotify: - case AlertDescription.NoRenegotiation: - case AlertDescription.UserCancelled: - this.level = AlertLevel.Warning; - break; - - case AlertDescription.AccessDenied: - case AlertDescription.BadCertificate: - case AlertDescription.BadRecordMAC: - case AlertDescription.CertificateExpired: - case AlertDescription.CertificateRevoked: - case AlertDescription.CertificateUnknown: - case AlertDescription.DecodeError: - case AlertDescription.DecompressionFailiure: - case AlertDescription.DecryptError: - case AlertDescription.DecryptionFailed: - case AlertDescription.ExportRestriction: - case AlertDescription.HandshakeFailiure: - case AlertDescription.IlegalParameter: - case AlertDescription.InsuficientSecurity: - case AlertDescription.InternalError: - case AlertDescription.ProtocolVersion: - case AlertDescription.RecordOverflow: - case AlertDescription.UnexpectedMessage: - case AlertDescription.UnknownCA: - case AlertDescription.UnsupportedCertificate: - default: - this.level = AlertLevel.Fatal; - break; - } - } - - #endregion - - #region Static Methods - - public static string GetAlertMessage(AlertDescription description) - { - #if (DEBUG) - switch (description) - { - case AlertDescription.AccessDenied: - return "An inappropriate message was received."; - - case AlertDescription.BadCertificate: - return "TLSCiphertext decrypted in an invalid way."; - - case AlertDescription.BadRecordMAC: - return "Record with an incorrect MAC."; - - case AlertDescription.CertificateExpired: - return "Certificate has expired or is not currently valid"; - - case AlertDescription.CertificateRevoked: - return "Certificate was revoked by its signer."; - - case AlertDescription.CertificateUnknown: - return "Certificate Unknown."; - - case AlertDescription.CloseNotify: - return "Connection closed"; - - case AlertDescription.DecodeError: - return "A message could not be decoded because some field was out of the specified range or the length of the message was incorrect."; - - case AlertDescription.DecompressionFailiure: - return "The decompression function received improper input (e.g. data that would expand to excessive length)."; - - case AlertDescription.DecryptError: - return "TLSCiphertext decrypted in an invalid way: either it wasn`t an even multiple of the block length or its padding values, when checked, weren`t correct."; - - case AlertDescription.DecryptionFailed: - return "Handshake cryptographic operation failed, including being unable to correctly verify a signature, decrypt a key exchange, or validate finished message."; - - case AlertDescription.ExportRestriction: - return "Negotiation not in compliance with export restrictions was detected."; - - case AlertDescription.HandshakeFailiure: - return "Unable to negotiate an acceptable set of security parameters given the options available."; - - case AlertDescription.IlegalParameter: - return "A field in the handshake was out of range or inconsistent with other fields."; - - case AlertDescription.InsuficientSecurity: - return "Negotiation has failed specifically because the server requires ciphers more secure than those supported by the client."; - - case AlertDescription.InternalError: - return "Internal error unrelated to the peer or the correctness of the protocol makes it impossible to continue."; - - case AlertDescription.NoRenegotiation: - return "Invalid renegotiation."; - - case AlertDescription.ProtocolVersion: - return "Unsupported protocol version."; - - case AlertDescription.RecordOverflow: - return "Invalid length on TLSCiphertext record or TLSCompressed record."; - - case AlertDescription.UnexpectedMessage: - return "Invalid message received."; - - case AlertDescription.UnknownCA: - return "CA can't be identified as a trusted CA."; - - case AlertDescription.UnsupportedCertificate: - return "Certificate was of an unsupported type."; - - case AlertDescription.UserCancelled: - return "Handshake cancelled by user."; - - default: - return ""; - } - #else - return "The authentication or decryption has failed."; - #endif - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs deleted file mode 100644 index e8e6171436..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls -{ - [Serializable] - public enum CipherAlgorithmType - { - Des, - None, - Rc2, - Rc4, - Rijndael, - SkipJack, - TripleDes - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuite.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuite.cs deleted file mode 100644 index 66f3a6536c..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuite.cs +++ /dev/null @@ -1,580 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using System.Text; -using System.Security.Cryptography; - -using Mono.Security; -using Mono.Security.Cryptography; -using M = Mono.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls -{ - internal abstract class CipherSuite - { - #region Static Fields - - public static byte[] EmptyArray = new byte[0]; - - #endregion - - #region Fields - - private short code; - private string name; - private CipherAlgorithmType cipherAlgorithmType; - private HashAlgorithmType hashAlgorithmType; - private ExchangeAlgorithmType exchangeAlgorithmType; - private bool isExportable; - private CipherMode cipherMode; - private byte keyMaterialSize; - private int keyBlockSize; - private byte expandedKeyMaterialSize; - private short effectiveKeyBits; - private byte ivSize; - private byte blockSize; - private Context context; - private SymmetricAlgorithm encryptionAlgorithm; - private ICryptoTransform encryptionCipher; - private SymmetricAlgorithm decryptionAlgorithm; - private ICryptoTransform decryptionCipher; - private KeyedHashAlgorithm clientHMAC; - private KeyedHashAlgorithm serverHMAC; - - #endregion - - #region Protected Properties - - protected ICryptoTransform EncryptionCipher - { - get { return this.encryptionCipher; } - } - - protected ICryptoTransform DecryptionCipher - { - get { return this.decryptionCipher; } - } - - protected KeyedHashAlgorithm ClientHMAC - { - get { return this.clientHMAC; } - } - - protected KeyedHashAlgorithm ServerHMAC - { - get { return this.serverHMAC; } - } - - #endregion - - #region Properties - - public CipherAlgorithmType CipherAlgorithmType - { - get { return this.cipherAlgorithmType; } - } - - public string HashAlgorithmName - { - get - { - switch (this.hashAlgorithmType) - { - case HashAlgorithmType.Md5: - return "MD5"; - - case HashAlgorithmType.Sha1: - return "SHA1"; - - default: - return "None"; - } - } - } - - public HashAlgorithmType HashAlgorithmType - { - get { return this.hashAlgorithmType; } - } - - public int HashSize - { - get - { - switch (this.hashAlgorithmType) - { - case HashAlgorithmType.Md5: - return 16; - - case HashAlgorithmType.Sha1: - return 20; - - default: - return 0; - } - } - } - - public ExchangeAlgorithmType ExchangeAlgorithmType - { - get { return this.exchangeAlgorithmType; } - } - - public CipherMode CipherMode - { - get { return this.cipherMode; } - } - - public short Code - { - get { return this.code; } - } - - public string Name - { - get { return this.name; } - } - - public bool IsExportable - { - get { return this.isExportable; } - } - - public byte KeyMaterialSize - { - get { return this.keyMaterialSize; } - } - - public int KeyBlockSize - { - get { return this.keyBlockSize; } - } - - public byte ExpandedKeyMaterialSize - { - get { return this.expandedKeyMaterialSize; } - } - - public short EffectiveKeyBits - { - get { return this.effectiveKeyBits; } - } - - public byte IvSize - { - get { return this.ivSize; } - } - - /* - public byte BlockSize - { - get { return this.blockSize; } - } - */ - - public Context Context - { - get { return this.context; } - set - { - this.context = value; - } - } - - #endregion - - #region Constructors - - public CipherSuite( - short code, string name, CipherAlgorithmType cipherAlgorithmType, - HashAlgorithmType hashAlgorithmType, ExchangeAlgorithmType exchangeAlgorithmType, - bool exportable, bool blockMode, byte keyMaterialSize, - byte expandedKeyMaterialSize, short effectiveKeyBits, - byte ivSize, byte blockSize) - { - this.code = code; - this.name = name; - this.cipherAlgorithmType = cipherAlgorithmType; - this.hashAlgorithmType = hashAlgorithmType; - this.exchangeAlgorithmType = exchangeAlgorithmType; - this.isExportable = exportable; - if (blockMode) - { - this.cipherMode = CipherMode.CBC; - } - this.keyMaterialSize = keyMaterialSize; - this.expandedKeyMaterialSize= expandedKeyMaterialSize; - this.effectiveKeyBits = effectiveKeyBits; - this.ivSize = ivSize; - this.blockSize = blockSize; - this.keyBlockSize = (this.keyMaterialSize + this.HashSize + this.ivSize) << 1; - } - - #endregion - - #region Methods - - internal void Write (byte[] array, int offset, short value) - { - if (offset > array.Length - 2) - throw new ArgumentException ("offset"); - - array [offset ] = (byte) (value >> 8); - array [offset + 1] = (byte) value; - } - - internal void Write (byte[] array, int offset, ulong value) - { - if (offset > array.Length - 8) - throw new ArgumentException ("offset"); - - array [offset ] = (byte) (value >> 56); - array [offset + 1] = (byte) (value >> 48); - array [offset + 2] = (byte) (value >> 40); - array [offset + 3] = (byte) (value >> 32); - array [offset + 4] = (byte) (value >> 24); - array [offset + 5] = (byte) (value >> 16); - array [offset + 6] = (byte) (value >> 8); - array [offset + 7] = (byte) value; - } - - public void InitializeCipher() - { - this.createEncryptionCipher(); - this.createDecryptionCipher(); - } - - public byte[] EncryptRecord(byte[] fragment, byte[] mac) - { - // Encryption ( fragment + mac [+ padding + padding_length] ) - int length = fragment.Length + mac.Length; - int padlen = 0; - if (this.CipherMode == CipherMode.CBC) { - // Calculate padding_length - length++; // keep an extra byte - padlen = (this.blockSize - length % this.blockSize); - if (padlen == this.blockSize) { - padlen = 0; - } - length += padlen; - } - - byte[] plain = new byte [length]; - Buffer.BlockCopy (fragment, 0, plain, 0, fragment.Length); - Buffer.BlockCopy (mac, 0, plain, fragment.Length, mac.Length); - if (padlen > 0) { - int start = fragment.Length + mac.Length; - for (int i = start; i < (start + padlen + 1); i++) { - plain[i] = (byte)padlen; - } - } - - this.EncryptionCipher.TransformBlock (plain, 0, plain.Length, plain, 0); - return plain; - } - - public void DecryptRecord(byte[] fragment, out byte[] dcrFragment, out byte[] dcrMAC) - { - int fragmentSize = 0; - int paddingLength = 0; - - // Decrypt message fragment ( fragment + mac [+ padding + padding_length] ) - this.DecryptionCipher.TransformBlock(fragment, 0, fragment.Length, fragment, 0); - // optimization: decrypt "in place", worst case: padding will reduce the size of the data - // this will cut in half the memory allocations (dcrFragment and dcrMAC remains) - - // Calculate fragment size - if (this.CipherMode == CipherMode.CBC) - { - // Calculate padding_length - paddingLength = fragment[fragment.Length - 1]; - fragmentSize = (fragment.Length - (paddingLength + 1)) - this.HashSize; - } - else - { - fragmentSize = fragment.Length - this.HashSize; - } - - dcrFragment = new byte[fragmentSize]; - dcrMAC = new byte[HashSize]; - - Buffer.BlockCopy(fragment, 0, dcrFragment, 0, dcrFragment.Length); - Buffer.BlockCopy(fragment, dcrFragment.Length, dcrMAC, 0, dcrMAC.Length); - } - - #endregion - - #region Abstract Methods - - public abstract byte[] ComputeClientRecordMAC(ContentType contentType, byte[] fragment); - - public abstract byte[] ComputeServerRecordMAC(ContentType contentType, byte[] fragment); - - public abstract void ComputeMasterSecret(byte[] preMasterSecret); - - public abstract void ComputeKeys(); - - #endregion - - #region Key Generation Methods - - public byte[] CreatePremasterSecret() - { - ClientContext context = (ClientContext)this.context; - - // Generate random bytes (total size) - byte[] preMasterSecret = this.context.GetSecureRandomBytes (48); - // and replace the first two bytes with the protocol version - // (maximum support version not actual) - preMasterSecret [0] = (byte)(context.ClientHelloProtocol >> 8); - preMasterSecret [1] = (byte)context.ClientHelloProtocol; - - return preMasterSecret; - } - - public byte[] PRF(byte[] secret, string label, byte[] data, int length) - { - /* Secret Length calc exmplain from the RFC2246. Section 5 - * - * S1 and S2 are the two halves of the secret and each is the same - * length. S1 is taken from the first half of the secret, S2 from the - * second half. Their length is created by rounding up the length of the - * overall secret divided by two; thus, if the original secret is an odd - * number of bytes long, the last byte of S1 will be the same as the - * first byte of S2. - */ - - // split secret in 2 - int secretLen = secret.Length >> 1; - // rounding up - if ((secret.Length & 0x1) == 0x1) - secretLen++; - - // Seed - TlsStream seedStream = new TlsStream(); - seedStream.Write(Encoding.ASCII.GetBytes(label)); - seedStream.Write(data); - byte[] seed = seedStream.ToArray(); - seedStream.Reset(); - - // Secret 1 - byte[] secret1 = new byte[secretLen]; - Buffer.BlockCopy(secret, 0, secret1, 0, secretLen); - - // Secret2 - byte[] secret2 = new byte[secretLen]; - Buffer.BlockCopy(secret, (secret.Length - secretLen), secret2, 0, secretLen); - - // Secret 1 processing - byte[] p_md5 = Expand("MD5", secret1, seed, length); - - // Secret 2 processing - byte[] p_sha = Expand("SHA1", secret2, seed, length); - - // Perfor XOR of both results - byte[] masterSecret = new byte[length]; - for (int i = 0; i < masterSecret.Length; i++) - { - masterSecret[i] = (byte)(p_md5[i] ^ p_sha[i]); - } - - return masterSecret; - } - - public byte[] Expand(string hashName, byte[] secret, byte[] seed, int length) - { - int hashLength = hashName == "MD5" ? 16 : 20; - int iterations = (int)(length / hashLength); - if ((length % hashLength) > 0) - { - iterations++; - } - - M.HMAC hmac = new M.HMAC(hashName, secret); - TlsStream resMacs = new TlsStream(); - - byte[][] hmacs = new byte[iterations + 1][]; - hmacs[0] = seed; - for (int i = 1; i <= iterations; i++) - { - TlsStream hcseed = new TlsStream(); - hmac.TransformFinalBlock(hmacs[i-1], 0, hmacs[i-1].Length); - hmacs[i] = hmac.Hash; - hcseed.Write(hmacs[i]); - hcseed.Write(seed); - hmac.TransformFinalBlock(hcseed.ToArray(), 0, (int)hcseed.Length); - resMacs.Write(hmac.Hash); - hcseed.Reset(); - } - - byte[] res = new byte[length]; - - Buffer.BlockCopy(resMacs.ToArray(), 0, res, 0, res.Length); - - resMacs.Reset(); - - return res; - } - - #endregion - - #region Private Methods - - private void createEncryptionCipher() - { - // Create and configure the symmetric algorithm - switch (this.cipherAlgorithmType) - { - case CipherAlgorithmType.Des: - this.encryptionAlgorithm = DES.Create(); - break; - - case CipherAlgorithmType.Rc2: - this.encryptionAlgorithm = RC2.Create(); - break; - - case CipherAlgorithmType.Rc4: - this.encryptionAlgorithm = new ARC4Managed(); - break; - - case CipherAlgorithmType.TripleDes: - this.encryptionAlgorithm = TripleDES.Create(); - break; - - case CipherAlgorithmType.Rijndael: - this.encryptionAlgorithm = Rijndael.Create(); - break; - } - - // If it's a block cipher - if (this.cipherMode == CipherMode.CBC) - { - // Configure encrypt algorithm - this.encryptionAlgorithm.Mode = this.cipherMode; - this.encryptionAlgorithm.Padding = PaddingMode.None; - this.encryptionAlgorithm.KeySize = this.expandedKeyMaterialSize * 8; - this.encryptionAlgorithm.BlockSize = this.blockSize * 8; - } - - // Set the key and IV for the algorithm - if (this.context is ClientContext) - { - this.encryptionAlgorithm.Key = this.context.ClientWriteKey; - this.encryptionAlgorithm.IV = this.context.ClientWriteIV; - } - else - { - this.encryptionAlgorithm.Key = this.context.ServerWriteKey; - this.encryptionAlgorithm.IV = this.context.ServerWriteIV; - } - - // Create encryption cipher - this.encryptionCipher = this.encryptionAlgorithm.CreateEncryptor(); - - // Create the HMAC algorithm - if (this.context is ClientContext) - { - this.clientHMAC = new M.HMAC( - this.HashAlgorithmName, - this.context.Negotiating.ClientWriteMAC); - } - else - { - this.serverHMAC = new M.HMAC( - this.HashAlgorithmName, - this.context.Negotiating.ServerWriteMAC); - } - } - - private void createDecryptionCipher() - { - // Create and configure the symmetric algorithm - switch (this.cipherAlgorithmType) - { - case CipherAlgorithmType.Des: - this.decryptionAlgorithm = DES.Create(); - break; - - case CipherAlgorithmType.Rc2: - this.decryptionAlgorithm = RC2.Create(); - break; - - case CipherAlgorithmType.Rc4: - this.decryptionAlgorithm = new ARC4Managed(); - break; - - case CipherAlgorithmType.TripleDes: - this.decryptionAlgorithm = TripleDES.Create(); - break; - - case CipherAlgorithmType.Rijndael: - this.decryptionAlgorithm = Rijndael.Create(); - break; - } - - // If it's a block cipher - if (this.cipherMode == CipherMode.CBC) - { - // Configure encrypt algorithm - this.decryptionAlgorithm.Mode = this.cipherMode; - this.decryptionAlgorithm.Padding = PaddingMode.None; - this.decryptionAlgorithm.KeySize = this.expandedKeyMaterialSize * 8; - this.decryptionAlgorithm.BlockSize = this.blockSize * 8; - } - - // Set the key and IV for the algorithm - if (this.context is ClientContext) - { - this.decryptionAlgorithm.Key = this.context.ServerWriteKey; - this.decryptionAlgorithm.IV = this.context.ServerWriteIV; - } - else - { - this.decryptionAlgorithm.Key = this.context.ClientWriteKey; - this.decryptionAlgorithm.IV = this.context.ClientWriteIV; - } - - // Create decryption cipher - this.decryptionCipher = this.decryptionAlgorithm.CreateDecryptor(); - - // Create the HMAC - if (this.context is ClientContext) - { - this.serverHMAC = new M.HMAC( - this.HashAlgorithmName, - this.context.Negotiating.ServerWriteMAC); - } - else - { - this.clientHMAC = new M.HMAC( - this.HashAlgorithmName, - this.context.Negotiating.ClientWriteMAC); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs deleted file mode 100644 index 8240e82a27..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs +++ /dev/null @@ -1,254 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Globalization; -using System.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls -{ - internal sealed class CipherSuiteCollection : ICollection, IList, IEnumerable - { - #region Fields - - private ArrayList cipherSuites; - private SecurityProtocolType protocol; - - #endregion - - #region Indexers - - public CipherSuite this[string name] - { - get { return (CipherSuite)this.cipherSuites[this.IndexOf(name)]; } - set { this.cipherSuites[this.IndexOf(name)] = (CipherSuite)value; } - } - - public CipherSuite this[int index] - { - get { return (CipherSuite)this.cipherSuites[index]; } - set { this.cipherSuites[index] = (CipherSuite)value; } - } - - public CipherSuite this[short code] - { - get { return (CipherSuite)this.cipherSuites[this.IndexOf(code)]; } - set { this.cipherSuites[this.IndexOf(code)] = (CipherSuite)value; } - } - - object IList.this[int index] - { - get { return this[index]; } - set { this[index] = (CipherSuite)value; } - } - - #endregion - - #region ICollection Properties - - bool ICollection.IsSynchronized - { - get { return this.cipherSuites.IsSynchronized; } - } - - object ICollection.SyncRoot - { - get { return this.cipherSuites.SyncRoot; } - } - - public int Count - { - get { return this.cipherSuites.Count; } - } - - #endregion - - #region IList Properties - - public bool IsFixedSize - { - get { return this.cipherSuites.IsFixedSize; } - } - - public bool IsReadOnly - { - get { return this.cipherSuites.IsReadOnly; } - } - - #endregion - - #region Constructors - - public CipherSuiteCollection(SecurityProtocolType protocol) : base() - { - this.protocol = protocol; - this.cipherSuites = new ArrayList(); - } - - #endregion - - #region ICollection Methods - - public void CopyTo(Array array, int index) - { - this.cipherSuites.CopyTo(array, index); - } - - #endregion - - #region IEnumerable Methods - - IEnumerator IEnumerable.GetEnumerator() - { - return this.cipherSuites.GetEnumerator(); - } - - #endregion - - #region IList Methods - - public void Clear() - { - this.cipherSuites.Clear(); - } - - bool IList.Contains(object value) - { - return this.cipherSuites.Contains(value as CipherSuite); - } - - public int IndexOf(string name) - { - int index = 0; - - foreach (CipherSuite cipherSuite in this.cipherSuites) - { - if (this.cultureAwareCompare(cipherSuite.Name, name)) - { - return index; - } - index++; - } - - return -1; - } - - public int IndexOf(short code) - { - int index = 0; - - foreach (CipherSuite cipherSuite in this.cipherSuites) - { - if (cipherSuite.Code == code) - { - return index; - } - index++; - } - - return -1; - } - - int IList.IndexOf(object value) - { - return this.cipherSuites.IndexOf(value as CipherSuite); - } - - void IList.Insert(int index, object value) - { - this.cipherSuites.Insert(index, value as CipherSuite); - } - - void IList.Remove(object value) - { - this.cipherSuites.Remove(value as CipherSuite); - } - - void IList.RemoveAt(int index) - { - this.cipherSuites.RemoveAt(index); - } - - public CipherSuite Add( - short code, string name, CipherAlgorithmType cipherType, - HashAlgorithmType hashType, ExchangeAlgorithmType exchangeType, - bool exportable, bool blockMode, byte keyMaterialSize, - byte expandedKeyMaterialSize, short effectiveKeyBytes, - byte ivSize, byte blockSize) - { - switch (this.protocol) - { - case SecurityProtocolType.Default: - case SecurityProtocolType.Tls: - return this.add( - new TlsCipherSuite( - code, name, cipherType, hashType, exchangeType, exportable, - blockMode, keyMaterialSize, expandedKeyMaterialSize, - effectiveKeyBytes, ivSize, blockSize)); - - case SecurityProtocolType.Ssl3: - return this.add( - new SslCipherSuite( - code, name, cipherType, hashType, exchangeType, exportable, - blockMode, keyMaterialSize, expandedKeyMaterialSize, - effectiveKeyBytes, ivSize, blockSize)); - - case SecurityProtocolType.Ssl2: - default: - throw new NotSupportedException("Unsupported security protocol type."); - } - } - - private TlsCipherSuite add(TlsCipherSuite cipherSuite) - { - this.cipherSuites.Add(cipherSuite); - - return cipherSuite; - } - - private SslCipherSuite add(SslCipherSuite cipherSuite) - { - this.cipherSuites.Add(cipherSuite); - - return cipherSuite; - } - - int IList.Add(object value) - { - return this.cipherSuites.Add(value as CipherSuite); - } - - private bool cultureAwareCompare(string strA, string strB) - { - return CultureInfo.CurrentCulture.CompareInfo.Compare( - strA, - strB, - CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | - CompareOptions.IgnoreCase) == 0 ? true : false; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs deleted file mode 100644 index 3fa618a280..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs +++ /dev/null @@ -1,191 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls -{ - internal class CipherSuiteFactory - { - public static CipherSuiteCollection GetSupportedCiphers(SecurityProtocolType protocol) - { - switch (protocol) - { - case SecurityProtocolType.Default: - case SecurityProtocolType.Tls: - return CipherSuiteFactory.GetTls1SupportedCiphers(); - - case SecurityProtocolType.Ssl3: - return CipherSuiteFactory.GetSsl3SupportedCiphers(); - - case SecurityProtocolType.Ssl2: - default: - throw new NotSupportedException("Unsupported security protocol type"); - } - } - - #region Private Static Methods - - private static CipherSuiteCollection GetTls1SupportedCiphers() - { - CipherSuiteCollection scs = new CipherSuiteCollection(SecurityProtocolType.Tls); - - // Supported ciphers - scs.Add((0x00 << 0x08) | 0x35, "TLS_RSA_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, true, 32, 32, 256, 16, 16); - scs.Add((0x00 << 0x08) | 0x2F, "TLS_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, true, 16, 16, 128, 16, 16); - scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, true, 24, 24, 168, 8, 8); - scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, false, 16, 16, 128, 0, 0); - scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, false, false, 16, 16, 128, 0, 0); - scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, true, 8, 8, 56, 8, 8); - - // Supported exportable ciphers - scs.Add((0x00 << 0x08) | 0x03, "TLS_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 5, 16, 40, 0, 0); - scs.Add((0x00 << 0x08) | 0x06, "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8); - scs.Add((0x00 << 0x08) | 0x08, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 8, 40, 8, 8); - scs.Add((0x00 << 0x08) | 0x60, "TLS_RSA_EXPORT_WITH_RC4_56_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0); - scs.Add((0x00 << 0x08) | 0x61, "TLS_RSA_EXPORT_WITH_RC2_CBC_56_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 7, 16, 56, 8, 8); - // 56 bits but we use 64 bits because of parity (DES is really 56 bits) - scs.Add((0x00 << 0x08) | 0x62, "TLS_RSA_EXPORT_WITH_DES_CBC_56_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 8, 8, 64, 8, 8); - scs.Add((0x00 << 0x08) | 0x64, "TLS_RSA_EXPORT_WITH_RC4_56_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0); - - // Default CipherSuite - // scs.Add(0, "TLS_NULL_WITH_NULL_NULL", CipherAlgorithmType.None, HashAlgorithmType.None, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); - - // RSA Cipher Suites - // scs.Add((0x00 << 0x08) | 0x01, "TLS_RSA_WITH_NULL_MD5", CipherAlgorithmType.None, HashAlgorithmType.Md5, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); - // scs.Add((0x00 << 0x08) | 0x02, "TLS_RSA_WITH_NULL_SHA", CipherAlgorithmType.None, HashAlgorithmType.Sha1, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); - // scs.Add((0x00 << 0x08) | 0x03, "TLS_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 5, 16, 40, 0, 0); - // scs.Add((0x00 << 0x08) | 0x05, "TLS_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); - // scs.Add((0x00 << 0x08) | 0x04, "TLS_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); - // scs.Add((0x00 << 0x08) | 0x06, "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x07, "TLS_RSA_WITH_IDEA_CBC_SHA", "IDEA", HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 8, 8); - // scs.Add((0x00 << 0x08) | 0x08, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0A, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8); - - // Diffie-Hellman Cipher Suites - // scs.Add((0x00 << 0x08) | 0x0B, "TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0C, "TLS_DH_DSS_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, false, ExchangeAlgorithmType.DiffieHellman, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0D, "TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0E, "TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0F, "TLS_DH_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, false, ExchangeAlgorithmType.DiffieHellman, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x10, "TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - // scs.Add((0x00 << 0x08) | 0x11, "TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x12, "TLS_DHE_DSS_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x13, "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - // scs.Add((0x00 << 0x08) | 0x14, "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x15, "TLS_DHE_RSA_WITH_DES_CBC_SHA", HashAlgorithmType.Sha1, CipherAlgorithmType.Des, false, ExchangeAlgorithmType.DiffieHellman, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x16, "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - - // Anonymous Diffie-Hellman Cipher Suites - // scs.Add((0x00 << 0x08) | 0x17, "TLS_DH_anon_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.DiffieHellman, true, false, 5, 16, 40, 0, 0); - // scs.Add((0x00 << 0x08) | 0x18, "TLS_DH_anon_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, false, ExchangeAlgorithmType.DiffieHellman, false, 16, 16, 128, 0, 0); - // scs.Add((0x00 << 0x08) | 0x19, "TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x1A, "TLS_DH_anon_WITH_DES_CBC_SHA", "DES4", HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x1B, "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - - // AES CipherSuites - // - // Ref: RFC3268 - (http://www.ietf.org/rfc/rfc3268.txt) - - // scs.Add((0x00 << 0x08) | 0x2F, "TLS_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 16, 16); - // scs.Add((0x00 << 0x08) | 0x30, "TLS_DH_DSS_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); - // scs.Add((0x00 << 0x08) | 0x31, "TLS_DH_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); - // scs.Add((0x00 << 0x08) | 0x32, "TLS_DHE_DSS_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); - // scs.Add((0x00 << 0x08) | 0x33, "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); - // scs.Add((0x00 << 0x08) | 0x34, "TLS_DH_anon_WITH_AES_128_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 16, 16, 128, 8, 8); - - // scs.Add((0x00 << 0x08) | 0x35, "TLS_RSA_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 32, 32, 256, 16, 16); - // scs.Add((0x00 << 0x08) | 0x36, "TLS_DH_DSS_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); - // scs.Add((0x00 << 0x08) | 0x37, "TLS_DH_RSA_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); - // scs.Add((0x00 << 0x08) | 0x38, "TLS_DHE_DSS_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); - // scs.Add((0x00 << 0x08) | 0x39, "TLS_DHE_RSA_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); - // scs.Add((0x00 << 0x08) | 0x3A, "TLS_DH_anon_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 32, 32, 256, 16, 16); - - return scs; - } - - private static CipherSuiteCollection GetSsl3SupportedCiphers() - { - CipherSuiteCollection scs = new CipherSuiteCollection(SecurityProtocolType.Ssl3); - - // Supported ciphers - scs.Add((0x00 << 0x08) | 0x35, "SSL_RSA_WITH_AES_256_CBC_SHA", CipherAlgorithmType.Rijndael, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, true, 32, 32, 256, 16, 16); - scs.Add((0x00 << 0x08) | 0x0A, "SSL_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, true, 24, 24, 168, 8, 8); - scs.Add((0x00 << 0x08) | 0x05, "SSL_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, false, 16, 16, 128, 0, 0); - scs.Add((0x00 << 0x08) | 0x04, "SSL_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, false, false, 16, 16, 128, 0, 0); - scs.Add((0x00 << 0x08) | 0x09, "SSL_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, true, 8, 8, 56, 8, 8); - - // Supported exportable ciphers - scs.Add((0x00 << 0x08) | 0x03, "SSL_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 5, 16, 40, 0, 0); - scs.Add((0x00 << 0x08) | 0x06, "SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8); - scs.Add((0x00 << 0x08) | 0x08, "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 8, 40, 8, 8); - scs.Add((0x00 << 0x08) | 0x60, "SSL_RSA_EXPORT_WITH_RC4_56_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0); - scs.Add((0x00 << 0x08) | 0x61, "SSL_RSA_EXPORT_WITH_RC2_CBC_56_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 7, 16, 56, 8, 8); - // 56 bits but we use 64 bits because of parity (DES is really 56 bits) - scs.Add((0x00 << 0x08) | 0x62, "SSL_RSA_EXPORT_WITH_DES_CBC_56_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 8, 8, 64, 8, 8); - scs.Add((0x00 << 0x08) | 0x64, "SSL_RSA_EXPORT_WITH_RC4_56_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0); - - // Default CipherSuite - // scs.Add(0, "SSL_NULL_WITH_NULL_NULL", CipherAlgorithmType.None, HashAlgorithmType.None, true, false, 0, 0, 0, 0, 0); - - // RSA Cipher Suites - // scs.Add((0x00 << 0x08) | 0x01, "SSL_RSA_WITH_NULL_MD5", CipherAlgorithmType.None, HashAlgorithmType.Md5, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0); - // scs.Add((0x00 << 0x08) | 0x02, "SSL_RSA_WITH_NULL_SHA", CipherAlgorithmType.None, HashAlgorithmType.Sha1, true, ExchangeAlgorithmType.None, false, 0, 0, 0, 0, 0); - // scs.Add((0x00 << 0x08) | 0x03, "SSL_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 5, 16, 40, 0, 0); - // scs.Add((0x00 << 0x08) | 0x05, "SSL_RSA_WITH_RC4_128_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); - // scs.Add((0x00 << 0x08) | 0x04, "SSL_RSA_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaSign, false, false, 16, 16, 128, 0, 0); - // scs.Add((0x00 << 0x08) | 0x06, "SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x07, "SSL_RSA_WITH_IDEA_CBC_SHA", "IDEA", HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 16, 16, 128, 8, 8); - // scs.Add((0x00 << 0x08) | 0x08, "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyEx, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x09, "SSL_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0A, "SSL_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaSign, false, true, 24, 24, 168, 8, 8); - - // Diffie-Hellman Cipher Suites - // scs.Add((0x00 << 0x08) | 0x0B, "SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0C, "SSL_DH_DSS_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0D, "SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0E, "SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x0F, "SSL_DH_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x10, "SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - // scs.Add((0x00 << 0x08) | 0x11, "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x12, "SSL_DHE_DSS_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x13, "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - // scs.Add((0x00 << 0x08) | 0x14, "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, true, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x15, "SSL_DHE_RSA_WITH_DES_CBC_SHA", HashAlgorithmType.Sha1, CipherAlgorithmType.Des, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x16, "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - - // Anonymous Diffie-Hellman Cipher Suites - // scs.Add((0x00 << 0x08) | 0x17, "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.DiffieHellman, true, false, 5, 16, 40, 0, 0); - // scs.Add((0x00 << 0x08) | 0x18, "SSL_DH_anon_WITH_RC4_128_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, false, ExchangeAlgorithmType.DiffieHellman, false, 16, 16, 128, 0, 0); - // scs.Add((0x00 << 0x08) | 0x19, "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 5, 8, 40, 8, 8); - // scs.Add((0x00 << 0x08) | 0x1A, "SSL_DH_anon_WITH_DES_CBC_SHA", "DES4", HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 8, 8, 56, 8, 8); - // scs.Add((0x00 << 0x08) | 0x1B, "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", CipherAlgorithmType.TripleDes, HashAlgorithmType.Sha1, ExchangeAlgorithmType.DiffieHellman, false, true, 24, 24, 168, 8, 8); - - return scs; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientContext.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientContext.cs deleted file mode 100644 index 2472f9a2fa..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientContext.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; - -namespace Mono.Security.Protocol.Tls -{ - internal class ClientContext : Context - { - #region Fields - - private SslClientStream sslStream; - private short clientHelloProtocol; - - #endregion - - #region Properties - - public SslClientStream SslStream - { - get { return this.sslStream; } - } - - public short ClientHelloProtocol - { - get { return this.clientHelloProtocol; } - set { this.clientHelloProtocol = value; } - } - - #endregion - - #region Constructors - - public ClientContext( - SslClientStream stream, - SecurityProtocolType securityProtocolType, - string targetHost, - X509CertificateCollection clientCertificates) - : base(securityProtocolType) - { - this.sslStream = stream; - this.ClientSettings.Certificates = clientCertificates; - this.ClientSettings.TargetHost = targetHost; - } - - #endregion - - #region Methods - - public override void Clear() - { - this.clientHelloProtocol = 0; - base.Clear(); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs deleted file mode 100644 index 7cece5060e..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs +++ /dev/null @@ -1,179 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Globalization; -using System.IO; - -using Mono.Security.Protocol.Tls.Handshake; -using Mono.Security.Protocol.Tls.Handshake.Client; - -namespace Mono.Security.Protocol.Tls -{ - internal class ClientRecordProtocol : RecordProtocol - { - #region Constructors - - public ClientRecordProtocol( - Stream innerStream, - ClientContext context) : base(innerStream, context) - { - } - - #endregion - - #region Send Messages - - public override HandshakeMessage GetMessage(HandshakeType type) - { - HandshakeMessage msg = this.createClientHandshakeMessage(type); - - return msg; - } - - #endregion - - #region Handshake Processing Methods - - protected override void ProcessHandshakeMessage(TlsStream handMsg) - { - HandshakeType handshakeType = (HandshakeType)handMsg.ReadByte(); - HandshakeMessage message = null; - - DebugHelper.WriteLine(">>>> Processing Handshake record ({0})", handshakeType); - - // Read message length - int length = handMsg.ReadInt24(); - - // Read message data - byte[] data = null; - if (length > 0) - { - data = new byte[length]; - handMsg.Read (data, 0, length); - } - - // Create and process the server message - message = this.createServerHandshakeMessage(handshakeType, data); - if (message != null) - { - message.Process(); - } - - // Update the last handshake message - this.Context.LastHandshakeMsg = handshakeType; - - // Update session - if (message != null) - { - message.Update(); - this.Context.HandshakeMessages.WriteByte ((byte) handshakeType); - this.Context.HandshakeMessages.WriteInt24 (length); - if (length > 0) - { - this.Context.HandshakeMessages.Write (data, 0, data.Length); - } - } - } - - #endregion - - #region Client Handshake Message Factories - - private HandshakeMessage createClientHandshakeMessage(HandshakeType type) - { - switch (type) - { - case HandshakeType.ClientHello: - return new TlsClientHello(this.context); - - case HandshakeType.Certificate: - return new TlsClientCertificate(this.context); - - case HandshakeType.ClientKeyExchange: - return new TlsClientKeyExchange(this.context); - - case HandshakeType.CertificateVerify: - return new TlsClientCertificateVerify(this.context); - - case HandshakeType.Finished: - return new TlsClientFinished(this.context); - - default: - throw new InvalidOperationException("Unknown client handshake message type: " + type.ToString() ); - } - } - - private HandshakeMessage createServerHandshakeMessage( - HandshakeType type, byte[] buffer) - { - ClientContext context = (ClientContext)this.context; - - switch (type) - { - case HandshakeType.HelloRequest: - if (context.HandshakeState != HandshakeState.Started) - { - context.HandshakeState = HandshakeState.None; - // re-negotiation will occur at next read/write - // (i.e. not during an existing encode/decode op) - } - else - { - this.SendAlert( - AlertLevel.Warning, - AlertDescription.NoRenegotiation); - } - return null; - - case HandshakeType.ServerHello: - return new TlsServerHello(this.context, buffer); - - case HandshakeType.Certificate: - return new TlsServerCertificate(this.context, buffer); - - case HandshakeType.ServerKeyExchange: - return new TlsServerKeyExchange(this.context, buffer); - - case HandshakeType.CertificateRequest: - return new TlsServerCertificateRequest(this.context, buffer); - - case HandshakeType.ServerHelloDone: - return new TlsServerHelloDone(this.context, buffer); - - case HandshakeType.Finished: - return new TlsServerFinished(this.context, buffer); - - default: - throw new TlsException( - AlertDescription.UnexpectedMessage, - String.Format(CultureInfo.CurrentUICulture, - "Unknown server handshake message received ({0})", - type.ToString())); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientSessionCache.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientSessionCache.cs deleted file mode 100644 index 749a51edea..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ClientSessionCache.cs +++ /dev/null @@ -1,254 +0,0 @@ -// -// ClientSessionCache.cs: Client-side cache for re-using sessions -// -// Author: -// Sebastien Pouliot -// -// Copyright (C) 2006 Novell (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; - -namespace Mono.Security.Protocol.Tls { - - internal class ClientSessionInfo : IDisposable { - - // (by default) we keep this item valid for 3 minutes (if unused) - private const int DefaultValidityInterval = 3 * 60; - private static readonly int ValidityInterval; - - private bool disposed; - private DateTime validuntil; - private string host; - - // see RFC2246 - Section 7 - private byte[] sid; - private byte[] masterSecret; - - static ClientSessionInfo () - { - string user_cache_timeout = Environment.GetEnvironmentVariable ("MONO_TLS_SESSION_CACHE_TIMEOUT"); - if (user_cache_timeout == null) { - ValidityInterval = DefaultValidityInterval; - } else { - try { - ValidityInterval = Int32.Parse (user_cache_timeout); - } - catch { - ValidityInterval = DefaultValidityInterval; - } - } - } - - public ClientSessionInfo (string hostname, byte[] id) - { - host = hostname; - sid = id; - KeepAlive (); - } - - ~ClientSessionInfo () - { - Dispose (false); - } - - - public string HostName { - get { return host; } - } - - public byte[] Id { - get { return sid; } - } - - public bool Valid { - get { return ((masterSecret != null) && (validuntil > DateTime.UtcNow)); } - } - - - public void GetContext (Context context) - { - CheckDisposed (); - if (context.MasterSecret != null) - masterSecret = (byte[]) context.MasterSecret.Clone (); - } - - public void SetContext (Context context) - { - CheckDisposed (); - if (masterSecret != null) - context.MasterSecret = (byte[]) masterSecret.Clone (); - } - - public void KeepAlive () - { - CheckDisposed (); - validuntil = DateTime.UtcNow.AddSeconds (ValidityInterval); - } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - private void Dispose (bool disposing) - { - if (!disposed) { - validuntil = DateTime.MinValue; - host = null; - sid = null; - - if (masterSecret != null) { - Array.Clear (masterSecret, 0, masterSecret.Length); - masterSecret = null; - } - } - disposed = true; - } - - private void CheckDisposed () - { - if (disposed) { - string msg = Locale.GetText ("Cache session information were disposed."); - throw new ObjectDisposedException (msg); - } - } - } - - // note: locking is aggressive but isn't used often (and we gain much more :) - internal class ClientSessionCache { - - static Hashtable cache; - static object locker; - - static ClientSessionCache () - { - cache = new Hashtable (); - locker = new object (); - } - - // note: we may have multiple connections with a host, so - // possibly multiple entries per host (each with a different - // id), so we do not use the host as the hashtable key - static public void Add (string host, byte[] id) - { - lock (locker) { - string uid = BitConverter.ToString (id); - ClientSessionInfo si = (ClientSessionInfo) cache[uid]; - if (si == null) { - cache.Add (uid, new ClientSessionInfo (host, id)); - } else if (si.HostName == host) { - // we already have this and it's still valid - // on the server, so we'll keep it a little longer - si.KeepAlive (); - } else { - // it's very unlikely but the same session id - // could be used by more than one host. In this - // case we replace the older one with the new one - si.Dispose (); - cache.Remove (uid); - cache.Add (uid, new ClientSessionInfo (host, id)); - } - } - } - - // return the first session us - static public byte[] FromHost (string host) - { - lock (locker) { - foreach (ClientSessionInfo si in cache.Values) { - if (si.HostName == host) { - if (si.Valid) { - // ensure it's still valid when we really need it - si.KeepAlive (); - return si.Id; - } - } - } - return null; - } - } - - // only called inside the lock - static private ClientSessionInfo FromContext (Context context, bool checkValidity) - { - if (context == null) - return null; - - byte[] id = context.SessionId; - if ((id == null) || (id.Length == 0)) - return null; - - // do we have a session cached for this host ? - string uid = BitConverter.ToString (id); - - ClientSessionInfo si = (ClientSessionInfo) cache[uid]; - if (si == null) - return null; - - // In the unlikely case of multiple hosts using the same - // session id, we just act like we do not know about it - if (context.ClientSettings.TargetHost != si.HostName) - return null; - - // yes, so what's its status ? - if (checkValidity && !si.Valid) { - si.Dispose (); - cache.Remove (uid); - return null; - } - - // ok, it make sense - return si; - } - - static public bool SetContextInCache (Context context) - { - lock (locker) { - // Don't check the validity because the masterKey of the ClientSessionInfo - // can still be null when this is called the first time - ClientSessionInfo csi = FromContext (context, false); - if (csi == null) - return false; - - csi.GetContext (context); - csi.KeepAlive (); - return true; - } - } - - static public bool SetContextFromCache (Context context) - { - lock (locker) { - ClientSessionInfo csi = FromContext (context, true); - if (csi == null) - return false; - - csi.SetContext (context); - csi.KeepAlive (); - return true; - } - } - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ContentType.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ContentType.cs deleted file mode 100644 index e07d64e461..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ContentType.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls -{ - [Serializable] - internal enum ContentType : byte - { - ChangeCipherSpec = 20, - Alert = 21, - Handshake = 22, - ApplicationData = 23, - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/Context.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/Context.cs deleted file mode 100644 index 792a9970a1..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/Context.cs +++ /dev/null @@ -1,515 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Text; -using System.Collections; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; - -using Mono.Security.Cryptography; -using Mono.Security.Protocol.Tls.Handshake; - -namespace Mono.Security.Protocol.Tls -{ - internal abstract class Context - { - #region Internal Constants - - internal const short MAX_FRAGMENT_SIZE = 16384; // 2^14 - internal const short TLS1_PROTOCOL_CODE = (0x03 << 8) | 0x01; - internal const short SSL3_PROTOCOL_CODE = (0x03 << 8) | 0x00; - internal const long UNIX_BASE_TICKS = 621355968000000000; - - #endregion - - #region Fields - - // Protocol version - private SecurityProtocolType securityProtocol; - - // Sesison ID - private byte[] sessionId; - - // Compression method - private SecurityCompressionType compressionMethod; - - // Information sent and request by the server in the Handshake protocol - private TlsServerSettings serverSettings; - - // Client configuration - private TlsClientSettings clientSettings; - - // Cipher suite information - private SecurityParameters current; - private SecurityParameters negotiating; - private SecurityParameters read; - private SecurityParameters write; - private CipherSuiteCollection supportedCiphers; - - // Last handshake message received - private HandshakeType lastHandshakeMsg; - - // Handshake negotiation state - private HandshakeState handshakeState; - - // Misc - private bool abbreviatedHandshake; - private bool receivedConnectionEnd; - private bool sentConnectionEnd; - private bool protocolNegotiated; - - // Sequence numbers - private ulong writeSequenceNumber; - private ulong readSequenceNumber; - - // Random data - private byte[] clientRandom; - private byte[] serverRandom; - private byte[] randomCS; - private byte[] randomSC; - - // Key information - private byte[] masterSecret; - private byte[] clientWriteKey; - private byte[] serverWriteKey; - private byte[] clientWriteIV; - private byte[] serverWriteIV; - - // Handshake hashes - private TlsStream handshakeMessages; - - // Secure Random generator - private RandomNumberGenerator random; - - // Record protocol - private RecordProtocol recordProtocol; - - #endregion - - #region Properties - - public bool AbbreviatedHandshake - { - get { return abbreviatedHandshake; } - set { abbreviatedHandshake = value; } - } - - public bool ProtocolNegotiated - { - get { return this.protocolNegotiated; } - set { this.protocolNegotiated = value; } - } - - public SecurityProtocolType SecurityProtocol - { - get - { - if ((this.securityProtocol & SecurityProtocolType.Tls) == SecurityProtocolType.Tls || - (this.securityProtocol & SecurityProtocolType.Default) == SecurityProtocolType.Default) - { - return SecurityProtocolType.Tls; - } - else - { - if ((this.securityProtocol & SecurityProtocolType.Ssl3) == SecurityProtocolType.Ssl3) - { - return SecurityProtocolType.Ssl3; - } - } - - throw new NotSupportedException("Unsupported security protocol type"); - } - - set { this.securityProtocol = value; } - } - - public SecurityProtocolType SecurityProtocolFlags - { - get { return this.securityProtocol; } - } - - public short Protocol - { - get - { - switch (this.SecurityProtocol) - { - case SecurityProtocolType.Tls: - case SecurityProtocolType.Default: - return Context.TLS1_PROTOCOL_CODE; - - case SecurityProtocolType.Ssl3: - return Context.SSL3_PROTOCOL_CODE; - - case SecurityProtocolType.Ssl2: - default: - throw new NotSupportedException("Unsupported security protocol type"); - } - } - } - - public byte[] SessionId - { - get { return this.sessionId; } - set { this.sessionId = value; } - } - - public SecurityCompressionType CompressionMethod - { - get { return this.compressionMethod; } - set { this.compressionMethod = value; } - } - - public TlsServerSettings ServerSettings - { - get { return this.serverSettings; } - } - - public TlsClientSettings ClientSettings - { - get { return this.clientSettings; } - } - - public HandshakeType LastHandshakeMsg - { - get { return this.lastHandshakeMsg; } - set { this.lastHandshakeMsg = value; } - } - - public HandshakeState HandshakeState - { - get { return this.handshakeState; } - set { this.handshakeState = value; } - } - - public bool ReceivedConnectionEnd - { - get { return this.receivedConnectionEnd; } - set { this.receivedConnectionEnd = value; } - } - - public bool SentConnectionEnd - { - get { return this.sentConnectionEnd; } - set { this.sentConnectionEnd = value; } - } - - public CipherSuiteCollection SupportedCiphers - { - get { return supportedCiphers; } - set { supportedCiphers = value; } - } - - public TlsStream HandshakeMessages - { - get { return this.handshakeMessages; } - } - - public ulong WriteSequenceNumber - { - get { return this.writeSequenceNumber; } - set { this.writeSequenceNumber = value; } - } - - public ulong ReadSequenceNumber - { - get { return this.readSequenceNumber; } - set { this.readSequenceNumber = value; } - } - - public byte[] ClientRandom - { - get { return this.clientRandom; } - set { this.clientRandom = value; } - } - - public byte[] ServerRandom - { - get { return this.serverRandom; } - set { this.serverRandom = value; } - } - - public byte[] RandomCS - { - get { return this.randomCS; } - set { this.randomCS = value; } - } - - public byte[] RandomSC - { - get { return this.randomSC; } - set { this.randomSC = value; } - } - - public byte[] MasterSecret - { - get { return this.masterSecret; } - set { this.masterSecret = value; } - } - - public byte[] ClientWriteKey - { - get { return this.clientWriteKey; } - set { this.clientWriteKey = value; } - } - - public byte[] ServerWriteKey - { - get { return this.serverWriteKey; } - set { this.serverWriteKey = value; } - } - - public byte[] ClientWriteIV - { - get { return this.clientWriteIV; } - set { this.clientWriteIV = value; } - } - - public byte[] ServerWriteIV - { - get { return this.serverWriteIV; } - set { this.serverWriteIV = value; } - } - - public RecordProtocol RecordProtocol - { - get { return this.recordProtocol; } - set { this.recordProtocol = value; } - } - - #endregion - - #region Constructors - - public Context(SecurityProtocolType securityProtocolType) - { - this.SecurityProtocol = securityProtocolType; - this.compressionMethod = SecurityCompressionType.None; - this.serverSettings = new TlsServerSettings(); - this.clientSettings = new TlsClientSettings(); - this.handshakeMessages = new TlsStream(); - this.sessionId = null; - this.handshakeState = HandshakeState.None; - this.random = RandomNumberGenerator.Create(); - } - - #endregion - - #region Methods - - public int GetUnixTime() - { - DateTime now = DateTime.UtcNow; - - return (int)((now.Ticks - UNIX_BASE_TICKS) / TimeSpan.TicksPerSecond); - } - - public byte[] GetSecureRandomBytes(int count) - { - byte[] secureBytes = new byte[count]; - - this.random.GetNonZeroBytes(secureBytes); - - return secureBytes; - } - - public virtual void Clear() - { - this.compressionMethod = SecurityCompressionType.None; - this.serverSettings = new TlsServerSettings(); - this.clientSettings = new TlsClientSettings(); - this.handshakeMessages = new TlsStream(); - this.sessionId = null; - this.handshakeState = HandshakeState.None; - - this.ClearKeyInfo(); - } - - public virtual void ClearKeyInfo() - { - // Clear Master Secret - if (masterSecret != null) { - Array.Clear (masterSecret, 0, masterSecret.Length); - masterSecret = null; - } - - // Clear client and server random - if (clientRandom != null) { - Array.Clear (clientRandom, 0, clientRandom.Length); - clientRandom = null; - } - if (serverRandom != null) { - Array.Clear (serverRandom, 0, serverRandom.Length); - serverRandom = null; - } - if (randomCS != null) { - Array.Clear (randomCS, 0, randomCS.Length); - randomCS = null; - } - if (randomSC != null) { - Array.Clear (randomSC, 0, randomSC.Length); - randomSC = null; - } - - // Clear client keys - if (clientWriteKey != null) { - Array.Clear (clientWriteKey, 0, clientWriteKey.Length); - clientWriteKey = null; - } - if (clientWriteIV != null) { - Array.Clear (clientWriteIV, 0, clientWriteIV.Length); - clientWriteIV = null; - } - - // Clear server keys - if (serverWriteKey != null) { - Array.Clear (serverWriteKey, 0, serverWriteKey.Length); - serverWriteKey = null; - } - if (serverWriteIV != null) { - Array.Clear (serverWriteIV, 0, serverWriteIV.Length); - serverWriteIV = null; - } - - // Reset handshake messages - this.handshakeMessages.Reset(); - - // Clear MAC keys if protocol is different than Ssl3 - // SSLv3 needs them inside Mono.Security.Protocol.Tls.SslCipherSuite.Compute[Client|Server]RecordMAC - if (this.securityProtocol != SecurityProtocolType.Ssl3) - { -// this.clientWriteMAC = null; -// this.serverWriteMAC = null; - } - } - - public SecurityProtocolType DecodeProtocolCode(short code) - { - switch (code) - { - case Context.TLS1_PROTOCOL_CODE: - return SecurityProtocolType.Tls; - - case Context.SSL3_PROTOCOL_CODE: - return SecurityProtocolType.Ssl3; - - default: - throw new NotSupportedException("Unsupported security protocol type"); - } - } - - public void ChangeProtocol(short protocol) - { - SecurityProtocolType protocolType = this.DecodeProtocolCode(protocol); - - if ((protocolType & this.SecurityProtocolFlags) == protocolType || - (this.SecurityProtocolFlags & SecurityProtocolType.Default) == SecurityProtocolType.Default) - { - this.SecurityProtocol = protocolType; - this.SupportedCiphers.Clear(); - this.SupportedCiphers = null; - this.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(protocolType); - } - else - { - throw new TlsException(AlertDescription.ProtocolVersion, "Incorrect protocol version received from server"); - } - } - - - public SecurityParameters Current - { - get - { - if (current == null) - current = new SecurityParameters (); - if (current.Cipher != null) - current.Cipher.Context = this; - return current; - } - } - - public SecurityParameters Negotiating - { - get - { - if (negotiating == null) - negotiating = new SecurityParameters (); - if (negotiating.Cipher != null) - negotiating.Cipher.Context = this; - return negotiating; - } - } - - public SecurityParameters Read - { - get { return read; } - } - - public SecurityParameters Write - { - get { return write; } - } - - public void StartSwitchingSecurityParameters (bool client) - { - if (client) { - // everything we write from now on is encrypted - write = negotiating; - // but we still read with the older cipher until we - // receive the ChangeCipherSpec message - read = current; - } else { - // everything we read from now on is encrypted - read = negotiating; - // but we still write with the older cipher until we - // receive the ChangeCipherSpec message - write = current; - } - current = negotiating; - } - - public void EndSwitchingSecurityParameters (bool client) - { - SecurityParameters temp; - if (client) { - temp = read; - // we now read with the new, negotiated, security parameters - read = current; - } else { - temp = write; - // we now write with the new, negotiated, security parameters - write = current; - } - // so we clear the old one (last reference) - if (temp != null) - temp.Clear (); - negotiating = temp; - // and are now ready for a future renegotiation - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/DebugHelper.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/DebugHelper.cs deleted file mode 100644 index ff122878c9..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/DebugHelper.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Diagnostics; - -namespace Mono.Security.Protocol.Tls -{ - internal class DebugHelper - { - private static bool isInitialized; - - [Conditional("DEBUG")] - public static void Initialize() - { - if (!isInitialized) - { -#if !MOBILE - Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); - // Debug.Listeners.Add(new TextWriterTraceListener(@"c:\ssl.log")); - Debug.AutoFlush = true; - Debug.Indent(); -#endif - - isInitialized = true; - } - } - - [Conditional("DEBUG")] - public static void WriteLine(string format, params object[] args) - { - Initialize(); - Debug.WriteLine(String.Format(format, args)); - } - - [Conditional("DEBUG")] - public static void WriteLine(string message) - { - Initialize(); - Debug.WriteLine(message); - } - - [Conditional("DEBUG")] - public static void WriteLine(string message, byte[] buffer) - { - Initialize(); - DebugHelper.WriteLine(String.Format("{0} ({1} bytes))", message, buffer.Length)); - DebugHelper.WriteBuffer(buffer); - } - - [Conditional("DEBUG")] - public static void WriteBuffer(byte[] buffer) - { - Initialize(); - DebugHelper.WriteBuffer(buffer, 0, buffer.Length); - } - - [Conditional("DEBUG")] - public static void WriteBuffer(byte[] buffer, int index, int length) - { - Initialize(); - for (int i = index; i < length; i += 16) - { - int count = (length - i) >= 16 ? 16 : (length - i); - string buf = ""; - for (int j = 0; j < count; j++) - { - buf += buffer[i + j].ToString("x2") + " "; - } - Debug.WriteLine(buf); - } - } - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs deleted file mode 100644 index a244b2ea3a..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls -{ - [Serializable] - public enum ExchangeAlgorithmType - { - DiffieHellman, - Fortezza, - None, - RsaKeyX, - RsaSign - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HandshakeState.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HandshakeState.cs deleted file mode 100644 index cf15386f0f..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HandshakeState.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls -{ - [Serializable] - internal enum HandshakeState - { - None, - Started, - Finished - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HashAlgorithmType.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HashAlgorithmType.cs deleted file mode 100644 index 092d7adcfd..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HashAlgorithmType.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls -{ - [Serializable] - public enum HashAlgorithmType - { - Md5, - None, - Sha1 - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HttpsClientStream.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HttpsClientStream.cs deleted file mode 100644 index f8b74e48de..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/HttpsClientStream.cs +++ /dev/null @@ -1,120 +0,0 @@ -// -// HttpsClientStream.cs: Glue between HttpWebRequest and SslClientStream to -// reduce reflection usage. -// -// Author: -// Sebastien Pouliot -// -// Copyright (C) 2004-2007 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using System.Net; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using SNS = System.Net.Security; -using SNCX = System.Security.Cryptography.X509Certificates; - -namespace Mono.Security.Protocol.Tls { - - // Note: DO NOT REUSE this class - instead use SslClientStream - - internal class HttpsClientStream : SslClientStream { - - private HttpWebRequest _request; - private int _status; - - public HttpsClientStream (Stream stream, X509CertificateCollection clientCertificates, - HttpWebRequest request, byte [] buffer) - : base (stream, request.Address.Host, false, (Mono.Security.Protocol.Tls.SecurityProtocolType) - ServicePointManager.SecurityProtocol, clientCertificates) - { - // this constructor permit access to the WebRequest to call - // ICertificatePolicy.CheckValidationResult - _request = request; - _status = 0; - if (buffer != null) - InputBuffer.Write (buffer, 0, buffer.Length); - // also saved from reflection - base.CheckCertRevocationStatus = ServicePointManager.CheckCertificateRevocationList; - ClientCertSelection += delegate (X509CertificateCollection clientCerts, X509Certificate serverCertificate, - string targetHost, X509CertificateCollection serverRequestedCertificates) { - return ((clientCerts == null) || (clientCerts.Count == 0)) ? null : clientCerts [0]; - }; - PrivateKeySelection += delegate (X509Certificate certificate, string targetHost) { - X509Certificate2 cert = (certificate as X509Certificate2); - return (cert == null) ? null : cert.PrivateKey; - }; - } - - public bool TrustFailure { - get { - switch (_status) { - case -2146762486: // CERT_E_CHAINING 0x800B010A - case -2146762487: // CERT_E_UNTRUSTEDROOT 0x800B0109 - return true; - default: - return false; - } - } - } - - internal override bool RaiseServerCertificateValidation (X509Certificate certificate, int[] certificateErrors) - { - bool failed = (certificateErrors.Length > 0); - // only one problem can be reported by this interface - _status = ((failed) ? certificateErrors [0] : 0); - -#pragma warning disable 618 - if (ServicePointManager.CertificatePolicy != null) { - ServicePoint sp = _request.ServicePoint; - bool res = ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, _request, _status); - if (!res) - return false; - failed = true; - } -#pragma warning restore 618 - if (HaveRemoteValidation2Callback) - return failed; // The validation already tried the 2.0 callback - - SNS.RemoteCertificateValidationCallback cb = ServicePointManager.ServerCertificateValidationCallback; - if (cb != null) { - SNS.SslPolicyErrors ssl_errors = 0; - foreach (int i in certificateErrors) { - if (i == (int)-2146762490) // TODO: is this what happens when the purpose is wrong? - ssl_errors |= SNS.SslPolicyErrors.RemoteCertificateNotAvailable; - else if (i == (int) -2146762481) - ssl_errors |= SNS.SslPolicyErrors.RemoteCertificateNameMismatch; - else - ssl_errors |= SNS.SslPolicyErrors.RemoteCertificateChainErrors; - } - SNCX.X509Certificate2 cert2 = new SNCX.X509Certificate2 (certificate.GetRawCertData ()); - SNCX.X509Chain chain = new SNCX.X509Chain (); - if (!chain.Build (cert2)) - ssl_errors |= SNS.SslPolicyErrors.RemoteCertificateChainErrors; - return cb (_request, cert2, chain, ssl_errors); - } - return failed; - } - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs deleted file mode 100644 index 1b9f5e4c68..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls -{ - internal class RSASslSignatureDeformatter : AsymmetricSignatureDeformatter - { - #region Fields - - private RSA key; - private HashAlgorithm hash; - - #endregion - - #region Constructors - - public RSASslSignatureDeformatter() - { - } - - public RSASslSignatureDeformatter(AsymmetricAlgorithm key) - { - this.SetKey(key); - } - - #endregion - - #region Methods - - public override bool VerifySignature( - byte[] rgbHash, - byte[] rgbSignature) - { - if (this.key == null) - { - throw new CryptographicUnexpectedOperationException("The key is a null reference"); - } - if (hash == null) - { - throw new CryptographicUnexpectedOperationException("The hash algorithm is a null reference."); - } - if (rgbHash == null) - { - throw new ArgumentNullException("The rgbHash parameter is a null reference."); - } - - return Mono.Security.Cryptography.PKCS1.Verify_v15( - this.key, - this.hash, - rgbHash, - rgbSignature); - } - - public override void SetHashAlgorithm(string strName) - { - switch (strName) - { - case "MD5SHA1": - this.hash = new Mono.Security.Cryptography.MD5SHA1(); - break; - - default: - this.hash = HashAlgorithm.Create(strName); - break; - } - } - - public override void SetKey(AsymmetricAlgorithm key) - { - if (!(key is RSA)) - { - throw new ArgumentException("Specfied key is not an RSA key"); - } - - this.key = key as RSA; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs deleted file mode 100644 index f2e168c47f..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls -{ - internal class RSASslSignatureFormatter : AsymmetricSignatureFormatter - { - #region Fields - - private RSA key; - private HashAlgorithm hash; - - #endregion - - #region Constructors - - public RSASslSignatureFormatter() - { - } - - public RSASslSignatureFormatter(AsymmetricAlgorithm key) - { - this.SetKey(key); - } - - #endregion - - #region Methods - - public override byte[] CreateSignature(byte[] rgbHash) - { - if (this.key == null) - { - throw new CryptographicUnexpectedOperationException("The key is a null reference"); - } - if (hash == null) - { - throw new CryptographicUnexpectedOperationException("The hash algorithm is a null reference."); - } - if (rgbHash == null) - { - throw new ArgumentNullException("The rgbHash parameter is a null reference."); - } - - return Mono.Security.Cryptography.PKCS1.Sign_v15( - this.key, - this.hash, - rgbHash); - } - - public override void SetHashAlgorithm(string strName) - { - switch (strName) - { - case "MD5SHA1": - this.hash = new Mono.Security.Cryptography.MD5SHA1(); - break; - - default: - this.hash = HashAlgorithm.Create(strName); - break; - } - } - - public override void SetKey(AsymmetricAlgorithm key) - { - if (!(key is RSA)) - { - throw new ArgumentException("Specfied key is not an RSA key"); - } - - this.key = key as RSA; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RecordProtocol.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RecordProtocol.cs deleted file mode 100644 index 9ef45da2c4..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/RecordProtocol.cs +++ /dev/null @@ -1,982 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.IO; -using System.Threading; - -using Mono.Security.Protocol.Tls.Handshake; - -namespace Mono.Security.Protocol.Tls -{ - internal abstract class RecordProtocol - { - #region Fields - - private static ManualResetEvent record_processing = new ManualResetEvent (true); - - protected Stream innerStream; - protected Context context; - - #endregion - - #region Properties - - public Context Context - { - get { return this.context; } - set { this.context = value; } - } - - #endregion - - #region Constructors - - public RecordProtocol(Stream innerStream, Context context) - { - this.innerStream = innerStream; - this.context = context; - this.context.RecordProtocol = this; - } - - #endregion - - #region Abstract Methods - - public virtual void SendRecord(HandshakeType type) - { - - IAsyncResult ar = this.BeginSendRecord(type, null, null); - - this.EndSendRecord(ar); - - } - - protected abstract void ProcessHandshakeMessage(TlsStream handMsg); - - protected virtual void ProcessChangeCipherSpec () - { - Context ctx = this.Context; - - // Reset sequence numbers - ctx.ReadSequenceNumber = 0; - - if (ctx is ClientContext) { - ctx.EndSwitchingSecurityParameters (true); - } else { - ctx.StartSwitchingSecurityParameters (false); - } - } - - public virtual HandshakeMessage GetMessage(HandshakeType type) - { - throw new NotSupportedException(); - } - - #endregion - - #region Receive Record Async Result - private class ReceiveRecordAsyncResult : IAsyncResult - { - private object locker = new object (); - private AsyncCallback _userCallback; - private object _userState; - private Exception _asyncException; - private ManualResetEvent handle; - private byte[] _resultingBuffer; - private Stream _record; - private bool completed; - - private byte[] _initialBuffer; - - public ReceiveRecordAsyncResult(AsyncCallback userCallback, object userState, byte[] initialBuffer, Stream record) - { - _userCallback = userCallback; - _userState = userState; - _initialBuffer = initialBuffer; - _record = record; - } - - public Stream Record - { - get { return _record; } - } - - public byte[] ResultingBuffer - { - get { return _resultingBuffer; } - } - - public byte[] InitialBuffer - { - get { return _initialBuffer; } - } - - public object AsyncState - { - get { return _userState; } - } - - public Exception AsyncException - { - get { return _asyncException; } - } - - public bool CompletedWithError - { - get { - if (!IsCompleted) - return false; // Perhaps throw InvalidOperationExcetion? - - return null != _asyncException; - } - } - - public WaitHandle AsyncWaitHandle - { - get { - lock (locker) { - if (handle == null) - handle = new ManualResetEvent (completed); - } - return handle; - } - - } - - public bool CompletedSynchronously - { - get { return false; } - } - - public bool IsCompleted - { - get { - lock (locker) { - return completed; - } - } - } - - private void SetComplete(Exception ex, byte[] resultingBuffer) - { - lock (locker) { - if (completed) - return; - - completed = true; - _asyncException = ex; - _resultingBuffer = resultingBuffer; - if (handle != null) - handle.Set (); - - if (_userCallback != null) - _userCallback.BeginInvoke (this, null, null); - } - } - - public void SetComplete(Exception ex) - { - SetComplete(ex, null); - } - - public void SetComplete(byte[] resultingBuffer) - { - SetComplete(null, resultingBuffer); - } - - public void SetComplete() - { - SetComplete(null, null); - } - } - #endregion - - #region Receive Record Async Result - private class SendRecordAsyncResult : IAsyncResult - { - private object locker = new object (); - private AsyncCallback _userCallback; - private object _userState; - private Exception _asyncException; - private ManualResetEvent handle; - private HandshakeMessage _message; - private bool completed; - - public SendRecordAsyncResult(AsyncCallback userCallback, object userState, HandshakeMessage message) - { - _userCallback = userCallback; - _userState = userState; - _message = message; - } - - public HandshakeMessage Message - { - get { return _message; } - } - - public object AsyncState - { - get { return _userState; } - } - - public Exception AsyncException - { - get { return _asyncException; } - } - - public bool CompletedWithError - { - get { - if (!IsCompleted) - return false; // Perhaps throw InvalidOperationExcetion? - - return null != _asyncException; - } - } - - public WaitHandle AsyncWaitHandle - { - get { - lock (locker) { - if (handle == null) - handle = new ManualResetEvent (completed); - } - return handle; - } - - } - - public bool CompletedSynchronously - { - get { return false; } - } - - public bool IsCompleted - { - get { - lock (locker) { - return completed; - } - } - } - - public void SetComplete(Exception ex) - { - lock (locker) { - if (completed) - return; - - completed = true; - if (handle != null) - handle.Set (); - - if (_userCallback != null) - _userCallback.BeginInvoke (this, null, null); - - _asyncException = ex; - } - } - - public void SetComplete() - { - SetComplete(null); - } - } - #endregion - - #region Reveive Record Methods - - public IAsyncResult BeginReceiveRecord(Stream record, AsyncCallback callback, object state) - { - if (this.context.ReceivedConnectionEnd) - { - throw new TlsException( - AlertDescription.InternalError, - "The session is finished and it's no longer valid."); - } - - record_processing.Reset (); - byte[] recordTypeBuffer = new byte[1]; - - ReceiveRecordAsyncResult internalResult = new ReceiveRecordAsyncResult(callback, state, recordTypeBuffer, record); - - record.BeginRead(internalResult.InitialBuffer, 0, internalResult.InitialBuffer.Length, new AsyncCallback(InternalReceiveRecordCallback), internalResult); - - return internalResult; - } - - private void InternalReceiveRecordCallback(IAsyncResult asyncResult) - { - ReceiveRecordAsyncResult internalResult = asyncResult.AsyncState as ReceiveRecordAsyncResult; - Stream record = internalResult.Record; - - try - { - - int bytesRead = internalResult.Record.EndRead(asyncResult); - - //We're at the end of the stream. Time to bail. - if (bytesRead == 0) - { - internalResult.SetComplete((byte[])null); - return; - } - - // Try to read the Record Content Type - int type = internalResult.InitialBuffer[0]; - - // Set last handshake message received to None - this.context.LastHandshakeMsg = HandshakeType.ClientHello; - - ContentType contentType = (ContentType)type; - byte[] buffer = this.ReadRecordBuffer(type, record); - if (buffer == null) - { - // record incomplete (at the moment) - internalResult.SetComplete((byte[])null); - return; - } - - // Decrypt message contents if needed - if (contentType == ContentType.Alert && buffer.Length == 2) - { - } - else if ((this.Context.Read != null) && (this.Context.Read.Cipher != null)) - { - buffer = this.decryptRecordFragment (contentType, buffer); - DebugHelper.WriteLine ("Decrypted record data", buffer); - } - - // Process record - switch (contentType) - { - case ContentType.Alert: - this.ProcessAlert((AlertLevel)buffer [0], (AlertDescription)buffer [1]); - if (record.CanSeek) - { - // don't reprocess that memory block - record.SetLength (0); - } - buffer = null; - break; - - case ContentType.ChangeCipherSpec: - this.ProcessChangeCipherSpec(); - break; - - case ContentType.ApplicationData: - break; - - case ContentType.Handshake: - TlsStream message = new TlsStream (buffer); - while (!message.EOF) - { - this.ProcessHandshakeMessage(message); - } - break; - - case (ContentType)0x80: - this.context.HandshakeMessages.Write (buffer); - break; - - default: - throw new TlsException( - AlertDescription.UnexpectedMessage, - "Unknown record received from server."); - } - - internalResult.SetComplete(buffer); - } - catch (Exception ex) - { - internalResult.SetComplete(ex); - } - - } - - public byte[] EndReceiveRecord(IAsyncResult asyncResult) - { - ReceiveRecordAsyncResult internalResult = asyncResult as ReceiveRecordAsyncResult; - - if (null == internalResult) - throw new ArgumentException("Either the provided async result is null or was not created by this RecordProtocol."); - - if (!internalResult.IsCompleted) - internalResult.AsyncWaitHandle.WaitOne(); - - if (internalResult.CompletedWithError) - throw internalResult.AsyncException; - - byte[] result = internalResult.ResultingBuffer; - record_processing.Set (); - return result; - } - - public byte[] ReceiveRecord(Stream record) - { - - IAsyncResult ar = this.BeginReceiveRecord(record, null, null); - return this.EndReceiveRecord(ar); - - } - - private byte[] ReadRecordBuffer (int contentType, Stream record) - { - switch (contentType) - { - case 0x80: - return this.ReadClientHelloV2(record); - - default: - if (!Enum.IsDefined(typeof(ContentType), (ContentType)contentType)) - { - throw new TlsException(AlertDescription.DecodeError); - } - return this.ReadStandardRecordBuffer(record); - } - } - - private byte[] ReadClientHelloV2 (Stream record) - { - int msgLength = record.ReadByte (); - // process further only if the whole record is available - if (record.CanSeek && (msgLength + 1 > record.Length)) - { - return null; - } - - byte[] message = new byte[msgLength]; - record.Read (message, 0, msgLength); - - int msgType = message [0]; - if (msgType != 1) - { - throw new TlsException(AlertDescription.DecodeError); - } - int protocol = (message [1] << 8 | message [2]); - int cipherSpecLength = (message [3] << 8 | message [4]); - int sessionIdLength = (message [5] << 8 | message [6]); - int challengeLength = (message [7] << 8 | message [8]); - int length = (challengeLength > 32) ? 32 : challengeLength; - - // Read CipherSpecs - byte[] cipherSpecV2 = new byte[cipherSpecLength]; - Buffer.BlockCopy (message, 9, cipherSpecV2, 0, cipherSpecLength); - - // Read session ID - byte[] sessionId = new byte[sessionIdLength]; - Buffer.BlockCopy (message, 9 + cipherSpecLength, sessionId, 0, sessionIdLength); - - // Read challenge ID - byte[] challenge = new byte[challengeLength]; - Buffer.BlockCopy (message, 9 + cipherSpecLength + sessionIdLength, challenge, 0, challengeLength); - - if (challengeLength < 16 || cipherSpecLength == 0 || (cipherSpecLength % 3) != 0) - { - throw new TlsException(AlertDescription.DecodeError); - } - - // Updated the Session ID - if (sessionId.Length > 0) - { - this.context.SessionId = sessionId; - } - - // Update the protocol version - this.Context.ChangeProtocol((short)protocol); - - // Select the Cipher suite - this.ProcessCipherSpecV2Buffer(this.Context.SecurityProtocol, cipherSpecV2); - - // Updated the Client Random - this.context.ClientRandom = new byte [32]; // Always 32 - // 1. if challenge is bigger than 32 bytes only use the last 32 bytes - // 2. right justify (0) challenge in ClientRandom if less than 32 - Buffer.BlockCopy (challenge, challenge.Length - length, this.context.ClientRandom, 32 - length, length); - - // Set - this.context.LastHandshakeMsg = HandshakeType.ClientHello; - this.context.ProtocolNegotiated = true; - - return message; - } - - private byte[] ReadStandardRecordBuffer (Stream record) - { - byte[] header = new byte[4]; - if (record.Read (header, 0, 4) != 4) - throw new TlsException ("buffer underrun"); - - short protocol = (short)((header [0] << 8) | header [1]); - short length = (short)((header [2] << 8) | header [3]); - - // process further only if the whole record is available - // note: the first 5 bytes aren't part of the length - if (record.CanSeek && (length + 5 > record.Length)) - { - return null; - } - - // Read Record data - int totalReceived = 0; - byte[] buffer = new byte[length]; - while (totalReceived != length) - { - int justReceived = record.Read(buffer, totalReceived, buffer.Length - totalReceived); - - //Make sure we get some data so we don't end up in an infinite loop here before shutdown. - if (0 == justReceived) - { - throw new TlsException(AlertDescription.CloseNotify, "Received 0 bytes from stream. It must be closed."); - } - - totalReceived += justReceived; - } - - // Check that the message has a valid protocol version - if (protocol != this.context.Protocol && this.context.ProtocolNegotiated) - { - throw new TlsException( - AlertDescription.ProtocolVersion, "Invalid protocol version on message received"); - } - - DebugHelper.WriteLine("Record data", buffer); - - return buffer; - } - - private void ProcessAlert(AlertLevel alertLevel, AlertDescription alertDesc) - { - switch (alertLevel) - { - case AlertLevel.Fatal: - throw new TlsException(alertLevel, alertDesc); - - case AlertLevel.Warning: - default: - switch (alertDesc) - { - case AlertDescription.CloseNotify: - this.context.ReceivedConnectionEnd = true; - break; - } - break; - } - } - - #endregion - - #region Send Alert Methods - - public void SendAlert(AlertDescription description) - { - this.SendAlert(new Alert(description)); - } - - public void SendAlert( - AlertLevel level, - AlertDescription description) - { - this.SendAlert(new Alert(level, description)); - } - - public void SendAlert(Alert alert) - { - AlertLevel level; - AlertDescription description; - bool close; - - if (alert == null) { - DebugHelper.WriteLine(">>>> Write Alert NULL"); - level = AlertLevel.Fatal; - description = AlertDescription.InternalError; - close = true; - } else { - DebugHelper.WriteLine(">>>> Write Alert ({0}|{1})", alert.Description, alert.Message); - level = alert.Level; - description = alert.Description; - close = alert.IsCloseNotify; - } - - // Write record - this.SendRecord (ContentType.Alert, new byte[2] { (byte) level, (byte) description }); - - if (close) { - this.context.SentConnectionEnd = true; - } - } - - #endregion - - #region Send Record Methods - - public void SendChangeCipherSpec() - { - DebugHelper.WriteLine(">>>> Write Change Cipher Spec"); - - // Send Change Cipher Spec message with the current cipher - // or as plain text if this is the initial negotiation - this.SendRecord(ContentType.ChangeCipherSpec, new byte[] {1}); - - Context ctx = this.context; - - // Reset sequence numbers - ctx.WriteSequenceNumber = 0; - - // all further data sent will be encrypted with the negotiated - // security parameters (now the current parameters) - if (ctx is ClientContext) { - ctx.StartSwitchingSecurityParameters (true); - } else { - ctx.EndSwitchingSecurityParameters (false); - } - } - - public IAsyncResult BeginSendRecord(HandshakeType handshakeType, AsyncCallback callback, object state) - { - HandshakeMessage msg = this.GetMessage(handshakeType); - - msg.Process(); - - DebugHelper.WriteLine(">>>> Write handshake record ({0}|{1})", context.Protocol, msg.ContentType); - - SendRecordAsyncResult internalResult = new SendRecordAsyncResult(callback, state, msg); - - this.BeginSendRecord(msg.ContentType, msg.EncodeMessage(), new AsyncCallback(InternalSendRecordCallback), internalResult); - - return internalResult; - } - - private void InternalSendRecordCallback(IAsyncResult ar) - { - SendRecordAsyncResult internalResult = ar.AsyncState as SendRecordAsyncResult; - - try - { - this.EndSendRecord(ar); - - // Update session - internalResult.Message.Update(); - - // Reset message contents - internalResult.Message.Reset(); - - internalResult.SetComplete(); - } - catch (Exception ex) - { - internalResult.SetComplete(ex); - } - } - - public IAsyncResult BeginSendRecord(ContentType contentType, byte[] recordData, AsyncCallback callback, object state) - { - if (this.context.SentConnectionEnd) - { - throw new TlsException( - AlertDescription.InternalError, - "The session is finished and it's no longer valid."); - } - - byte[] record = this.EncodeRecord(contentType, recordData); - - return this.innerStream.BeginWrite(record, 0, record.Length, callback, state); - } - - public void EndSendRecord(IAsyncResult asyncResult) - { - if (asyncResult is SendRecordAsyncResult) - { - SendRecordAsyncResult internalResult = asyncResult as SendRecordAsyncResult; - if (!internalResult.IsCompleted) - internalResult.AsyncWaitHandle.WaitOne(); - if (internalResult.CompletedWithError) - throw internalResult.AsyncException; - } - else - { - this.innerStream.EndWrite(asyncResult); - } - } - - public void SendRecord(ContentType contentType, byte[] recordData) - { - IAsyncResult ar = this.BeginSendRecord(contentType, recordData, null, null); - - this.EndSendRecord(ar); - } - - public byte[] EncodeRecord(ContentType contentType, byte[] recordData) - { - return this.EncodeRecord( - contentType, - recordData, - 0, - recordData.Length); - } - - public byte[] EncodeRecord( - ContentType contentType, - byte[] recordData, - int offset, - int count) - { - if (this.context.SentConnectionEnd) - { - throw new TlsException( - AlertDescription.InternalError, - "The session is finished and it's no longer valid."); - } - - TlsStream record = new TlsStream(); - - int position = offset; - - while (position < ( offset + count )) - { - short fragmentLength = 0; - byte[] fragment; - - if ((count + offset - position) > Context.MAX_FRAGMENT_SIZE) - { - fragmentLength = Context.MAX_FRAGMENT_SIZE; - } - else - { - fragmentLength = (short)(count + offset - position); - } - - // Fill the fragment data - fragment = new byte[fragmentLength]; - Buffer.BlockCopy(recordData, position, fragment, 0, fragmentLength); - - if ((this.Context.Write != null) && (this.Context.Write.Cipher != null)) - { - // Encrypt fragment - fragment = this.encryptRecordFragment (contentType, fragment); - } - - // Write tls message - record.Write((byte)contentType); - record.Write(this.context.Protocol); - record.Write((short)fragment.Length); - record.Write(fragment); - - DebugHelper.WriteLine("Record data", fragment); - - // Update buffer position - position += fragmentLength; - } - - return record.ToArray(); - } - - #endregion - - #region Cryptography Methods - - private byte[] encryptRecordFragment( - ContentType contentType, - byte[] fragment) - { - byte[] mac = null; - - // Calculate message MAC - if (this.Context is ClientContext) - { - mac = this.context.Write.Cipher.ComputeClientRecordMAC(contentType, fragment); - } - else - { - mac = this.context.Write.Cipher.ComputeServerRecordMAC (contentType, fragment); - } - - DebugHelper.WriteLine(">>>> Record MAC", mac); - - // Encrypt the message - byte[] ecr = this.context.Write.Cipher.EncryptRecord (fragment, mac); - - // Update sequence number - this.context.WriteSequenceNumber++; - - return ecr; - } - - private byte[] decryptRecordFragment( - ContentType contentType, - byte[] fragment) - { - byte[] dcrFragment = null; - byte[] dcrMAC = null; - - try - { - this.context.Read.Cipher.DecryptRecord (fragment, out dcrFragment, out dcrMAC); - } - catch - { - if (this.context is ServerContext) - { - this.Context.RecordProtocol.SendAlert(AlertDescription.DecryptionFailed); - } - throw; - } - - // Generate record MAC - byte[] mac = null; - - if (this.Context is ClientContext) - { - mac = this.context.Read.Cipher.ComputeServerRecordMAC(contentType, dcrFragment); - } - else - { - mac = this.context.Read.Cipher.ComputeClientRecordMAC (contentType, dcrFragment); - } - - DebugHelper.WriteLine(">>>> Record MAC", mac); - - // Check record MAC - if (!Compare (mac, dcrMAC)) - { - throw new TlsException(AlertDescription.BadRecordMAC, "Bad record MAC"); - } - - // Update sequence number - this.context.ReadSequenceNumber++; - - return dcrFragment; - } - - private bool Compare (byte[] array1, byte[] array2) - { - if (array1 == null) - return (array2 == null); - if (array2 == null) - return false; - if (array1.Length != array2.Length) - return false; - for (int i = 0; i < array1.Length; i++) { - if (array1[i] != array2[i]) - return false; - } - return true; - } - - #endregion - - #region CipherSpecV2 processing - - private void ProcessCipherSpecV2Buffer (SecurityProtocolType protocol, byte[] buffer) - { - TlsStream codes = new TlsStream(buffer); - - string prefix = (protocol == SecurityProtocolType.Ssl3) ? "SSL_" : "TLS_"; - - while (codes.Position < codes.Length) - { - byte check = codes.ReadByte(); - - if (check == 0) - { - // SSL/TLS cipher spec - short code = codes.ReadInt16(); - int index = this.Context.SupportedCiphers.IndexOf(code); - if (index != -1) - { - this.Context.Negotiating.Cipher = this.Context.SupportedCiphers[index]; - break; - } - } - else - { - byte[] tmp = new byte[2]; - codes.Read(tmp, 0, tmp.Length); - - int tmpCode = ((check & 0xff) << 16) | ((tmp[0] & 0xff) << 8) | (tmp[1] & 0xff); - CipherSuite cipher = this.MapV2CipherCode(prefix, tmpCode); - - if (cipher != null) - { - this.Context.Negotiating.Cipher = cipher; - break; - } - } - } - - if (this.Context.Negotiating == null) - { - throw new TlsException(AlertDescription.InsuficientSecurity, "Insuficient Security"); - } - } - - private CipherSuite MapV2CipherCode(string prefix, int code) - { - try - { - switch (code) - { - case 65664: - // TLS_RC4_128_WITH_MD5 - return this.Context.SupportedCiphers[prefix + "RSA_WITH_RC4_128_MD5"]; - - case 131200: - // TLS_RC4_128_EXPORT40_WITH_MD5 - return this.Context.SupportedCiphers[prefix + "RSA_EXPORT_WITH_RC4_40_MD5"]; - - case 196736: - // TLS_RC2_CBC_128_CBC_WITH_MD5 - return this.Context.SupportedCiphers[prefix + "RSA_EXPORT_WITH_RC2_CBC_40_MD5"]; - - case 262272: - // TLS_RC2_CBC_128_CBC_EXPORT40_WITH_MD5 - return this.Context.SupportedCiphers[prefix + "RSA_EXPORT_WITH_RC2_CBC_40_MD5"]; - - case 327808: - // TLS_IDEA_128_CBC_WITH_MD5 - return null; - - case 393280: - // TLS_DES_64_CBC_WITH_MD5 - return null; - - case 458944: - // TLS_DES_192_EDE3_CBC_WITH_MD5 - return null; - - default: - return null; - } - } - catch - { - return null; - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityCompressionType.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityCompressionType.cs deleted file mode 100644 index 730a807469..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityCompressionType.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls -{ - // Information about compression methods allowed by TLS - // can be found in: - // draft-ietf-tls-compression-05.txt (http://www.ietf.org/internet-drafts/draft-ietf-tls-compression-05.txt) - public enum SecurityCompressionType - { - None = 0, - Zlib = 1 - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityParameters.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityParameters.cs deleted file mode 100644 index 3c744ea240..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityParameters.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls { - - // note: other things should be moved here - internal class SecurityParameters { - - private CipherSuite cipher; - private byte[] clientWriteMAC; - private byte[] serverWriteMAC; - - public SecurityParameters () - { - } - - public CipherSuite Cipher { - get { return cipher; } - set { cipher = value; } - } - - public byte[] ClientWriteMAC { - get { return clientWriteMAC; } - set { clientWriteMAC = value; } - } - - public byte[] ServerWriteMAC { - get { return serverWriteMAC; } - set { serverWriteMAC = value; } - } - - public void Clear () - { - // FIXME: clear cipher - cipher = null; - } - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityProtocolType.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityProtocolType.cs deleted file mode 100644 index a914afc137..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SecurityProtocolType.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace Mono.Security.Protocol.Tls -{ - [Flags] - [Serializable] - public enum SecurityProtocolType - { - Default = -1073741824, - Ssl2 = 12, - Ssl3 = 48, - Tls = 192 - } -} \ No newline at end of file diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ServerContext.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ServerContext.cs deleted file mode 100644 index 2652501669..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ServerContext.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; - -using Mono.Security.Protocol.Tls.Handshake; -using MonoX509 = Mono.Security.X509; - -namespace Mono.Security.Protocol.Tls -{ - internal class ServerContext : Context - { - #region Fields - - private SslServerStream sslStream; - private bool request_client_certificate; - private bool clientCertificateRequired; - - #endregion - - #region Properties - - public SslServerStream SslStream - { - get { return this.sslStream; } - } - - public bool ClientCertificateRequired - { - get { return this.clientCertificateRequired; } - } - - public bool RequestClientCertificate { - get { return request_client_certificate; } - } - - #endregion - - #region Constructors - - public ServerContext( - SslServerStream stream, - SecurityProtocolType securityProtocolType, - X509Certificate serverCertificate, - bool clientCertificateRequired, - bool requestClientCertificate) - : base(securityProtocolType) - { - this.sslStream = stream; - this.clientCertificateRequired = clientCertificateRequired; - this.request_client_certificate = requestClientCertificate; - - // Convert the System.Security cert to a Mono Cert - MonoX509.X509Certificate cert = new MonoX509.X509Certificate(serverCertificate.GetRawCertData()); - - // Add server certificate to the certificate collection - this.ServerSettings.Certificates = new MonoX509.X509CertificateCollection(); - this.ServerSettings.Certificates.Add(cert); - - this.ServerSettings.UpdateCertificateRSA(); - - // Add requested certificate types - this.ServerSettings.CertificateTypes = new ClientCertificateType[1]; - this.ServerSettings.CertificateTypes[0] = ClientCertificateType.RSA; - - // Add certificate authorities - MonoX509.X509CertificateCollection trusted = MonoX509.X509StoreManager.TrustedRootCertificates; - string[] list = new string [trusted.Count]; - int i = 0; - foreach (MonoX509.X509Certificate root in trusted) - { - list [i++] = root.IssuerName; - } - this.ServerSettings.DistinguisedNames = list; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs deleted file mode 100644 index 6e316dc365..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Globalization; -using System.IO; - -using Mono.Security.Protocol.Tls.Handshake; -using Mono.Security.Protocol.Tls.Handshake.Server; - -namespace Mono.Security.Protocol.Tls -{ - internal class ServerRecordProtocol : RecordProtocol - { - #region Constructors - - public ServerRecordProtocol( - Stream innerStream, - ServerContext context) : base(innerStream, context) - { - } - - #endregion - - #region Send Messages - - public override HandshakeMessage GetMessage(HandshakeType type) - { - // Create and process the record message - HandshakeMessage msg = this.createServerHandshakeMessage(type); - - return msg; - } - - #endregion - - #region Handshake Processing Methods - - protected override void ProcessHandshakeMessage(TlsStream handMsg) - { - HandshakeType handshakeType = (HandshakeType)handMsg.ReadByte(); - HandshakeMessage message = null; - - // Read message length - int length = handMsg.ReadInt24(); - - // Read message data - byte[] data = new byte[length]; - handMsg.Read(data, 0, length); - - // Create and process the server message - message = this.createClientHandshakeMessage(handshakeType, data); - message.Process(); - - // Update the last handshake message - this.Context.LastHandshakeMsg = handshakeType; - - // Update session - if (message != null) - { - message.Update(); - this.Context.HandshakeMessages.WriteByte ((byte) handshakeType); - this.Context.HandshakeMessages.WriteInt24 (length); - this.Context.HandshakeMessages.Write (data, 0, data.Length); - } - } - - #endregion - - #region Server Handshake Message Factories - - private HandshakeMessage createClientHandshakeMessage( - HandshakeType type, byte[] buffer) - { - switch (type) - { - case HandshakeType.ClientHello: - return new TlsClientHello(this.context, buffer); - - case HandshakeType.Certificate: - return new TlsClientCertificate(this.context, buffer); - - case HandshakeType.ClientKeyExchange: - return new TlsClientKeyExchange(this.context, buffer); - - case HandshakeType.CertificateVerify: - return new TlsClientCertificateVerify(this.context, buffer); - - case HandshakeType.Finished: - return new TlsClientFinished(this.context, buffer); - - default: - throw new TlsException( - AlertDescription.UnexpectedMessage, - String.Format(CultureInfo.CurrentUICulture, - "Unknown server handshake message received ({0})", - type.ToString())); - } - } - - private HandshakeMessage createServerHandshakeMessage( - HandshakeType type) - { - switch (type) - { - case HandshakeType.HelloRequest: - this.SendRecord(HandshakeType.ClientHello); - return null; - - case HandshakeType.ServerHello: - return new TlsServerHello(this.context); - - case HandshakeType.Certificate: - return new TlsServerCertificate(this.context); - - case HandshakeType.ServerKeyExchange: - return new TlsServerKeyExchange(this.context); - - case HandshakeType.CertificateRequest: - return new TlsServerCertificateRequest(this.context); - - case HandshakeType.ServerHelloDone: - return new TlsServerHelloDone(this.context); - - case HandshakeType.Finished: - return new TlsServerFinished(this.context); - - default: - throw new InvalidOperationException("Unknown server handshake message type: " + type.ToString() ); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslCipherSuite.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslCipherSuite.cs deleted file mode 100644 index 14540520be..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslCipherSuite.cs +++ /dev/null @@ -1,295 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using System.Security.Cryptography; -using System.Text; - -namespace Mono.Security.Protocol.Tls -{ - internal class SslCipherSuite : CipherSuite - { - #region Fields - - private byte[] pad1; - private byte[] pad2; - - private const int MacHeaderLength = 11; - private byte[] header; - - #endregion - - #region Constructors - - public SslCipherSuite( - short code, string name, CipherAlgorithmType cipherAlgorithmType, - HashAlgorithmType hashAlgorithmType, ExchangeAlgorithmType exchangeAlgorithmType, - bool exportable, bool blockMode, byte keyMaterialSize, - byte expandedKeyMaterialSize, short effectiveKeyBytes, - byte ivSize, byte blockSize) : - base(code, name, cipherAlgorithmType, hashAlgorithmType, - exchangeAlgorithmType, exportable, blockMode, keyMaterialSize, - expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize) - - { - int padLength = (hashAlgorithmType == HashAlgorithmType.Md5) ? 48 : 40; - - // Fill pad arrays - this.pad1 = new byte[padLength]; - this.pad2 = new byte[padLength]; - - /* Pad the key for inner and outer digest */ - for (int i = 0; i < padLength; ++i) - { - this.pad1[i] = 0x36; - this.pad2[i] = 0x5C; - } - } - - #endregion - - #region MAC Generation Methods - - public override byte[] ComputeServerRecordMAC(ContentType contentType, byte[] fragment) - { - HashAlgorithm hash = HashAlgorithm.Create(this.HashAlgorithmName); - - byte[] smac = this.Context.Read.ServerWriteMAC; - hash.TransformBlock (smac, 0, smac.Length, smac, 0); - hash.TransformBlock (pad1, 0, pad1.Length, pad1, 0); - - if (header == null) - header = new byte [MacHeaderLength]; - - ulong seqnum = (Context is ClientContext) ? Context.ReadSequenceNumber : Context.WriteSequenceNumber; - Write (header, 0, seqnum); - header [8] = (byte) contentType; - Write (header, 9, (short)fragment.Length); - hash.TransformBlock (header, 0, header.Length, header, 0); - hash.TransformBlock (fragment, 0, fragment.Length, fragment, 0); - // hack, else the method will allocate a new buffer of the same length (negative half the optimization) - hash.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0); - - byte[] blockHash = hash.Hash; - - hash.Initialize (); - - hash.TransformBlock (smac, 0, smac.Length, smac, 0); - hash.TransformBlock (pad2, 0, pad2.Length, pad2, 0); - hash.TransformBlock (blockHash, 0, blockHash.Length, blockHash, 0); - // hack again - hash.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0); - - return hash.Hash; - } - - public override byte[] ComputeClientRecordMAC(ContentType contentType, byte[] fragment) - { - HashAlgorithm hash = HashAlgorithm.Create(this.HashAlgorithmName); - - byte[] cmac = this.Context.Current.ClientWriteMAC; - hash.TransformBlock (cmac, 0, cmac.Length, cmac, 0); - hash.TransformBlock (pad1, 0, pad1.Length, pad1, 0); - - if (header == null) - header = new byte [MacHeaderLength]; - - ulong seqnum = (Context is ClientContext) ? Context.WriteSequenceNumber : Context.ReadSequenceNumber; - Write (header, 0, seqnum); - header [8] = (byte) contentType; - Write (header, 9, (short)fragment.Length); - hash.TransformBlock (header, 0, header.Length, header, 0); - hash.TransformBlock (fragment, 0, fragment.Length, fragment, 0); - // hack, else the method will allocate a new buffer of the same length (negative half the optimization) - hash.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0); - - byte[] blockHash = hash.Hash; - - hash.Initialize (); - - hash.TransformBlock (cmac, 0, cmac.Length, cmac, 0); - hash.TransformBlock (pad2, 0, pad2.Length, pad2, 0); - hash.TransformBlock (blockHash, 0, blockHash.Length, blockHash, 0); - // hack again - hash.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0); - - return hash.Hash; - } - - #endregion - - #region Key Generation Methods - - public override void ComputeMasterSecret(byte[] preMasterSecret) - { - TlsStream masterSecret = new TlsStream(); - - masterSecret.Write(this.prf(preMasterSecret, "A", this.Context.RandomCS)); - masterSecret.Write(this.prf(preMasterSecret, "BB", this.Context.RandomCS)); - masterSecret.Write(this.prf(preMasterSecret, "CCC", this.Context.RandomCS)); - - this.Context.MasterSecret = masterSecret.ToArray(); - - DebugHelper.WriteLine(">>>> MasterSecret", this.Context.MasterSecret); - } - - public override void ComputeKeys() - { - // Compute KeyBlock - TlsStream tmp = new TlsStream(); - - char labelChar = 'A'; - int count = 1; - - while (tmp.Length < this.KeyBlockSize) - { - string label = String.Empty; - - for (int i = 0; i < count; i++) - { - label += labelChar.ToString(); - } - - byte[] block = this.prf(this.Context.MasterSecret, label.ToString(), this.Context.RandomSC); - - int size = (tmp.Length + block.Length) > this.KeyBlockSize ? (this.KeyBlockSize - (int)tmp.Length) : block.Length; - - tmp.Write(block, 0, size); - - labelChar++; - count++; - } - - // Create keyblock - TlsStream keyBlock = new TlsStream(tmp.ToArray()); - - this.Context.Negotiating.ClientWriteMAC = keyBlock.ReadBytes(this.HashSize); - this.Context.Negotiating.ServerWriteMAC = keyBlock.ReadBytes(this.HashSize); - this.Context.ClientWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize); - this.Context.ServerWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize); - - if (!this.IsExportable) - { - if (this.IvSize != 0) - { - this.Context.ClientWriteIV = keyBlock.ReadBytes(this.IvSize); - this.Context.ServerWriteIV = keyBlock.ReadBytes(this.IvSize); - } - else - { - this.Context.ClientWriteIV = CipherSuite.EmptyArray; - this.Context.ServerWriteIV = CipherSuite.EmptyArray; - } - } - else - { - HashAlgorithm md5 = MD5.Create(); - - int keySize = (md5.HashSize >> 3); //in bytes not bits - byte[] temp = new byte [keySize]; - - // Generate final write keys - md5.TransformBlock(this.Context.ClientWriteKey, 0, this.Context.ClientWriteKey.Length, temp, 0); - md5.TransformFinalBlock(this.Context.RandomCS, 0, this.Context.RandomCS.Length); - byte[] finalClientWriteKey = new byte[this.ExpandedKeyMaterialSize]; - Buffer.BlockCopy(md5.Hash, 0, finalClientWriteKey, 0, this.ExpandedKeyMaterialSize); - - md5.Initialize(); - md5.TransformBlock(this.Context.ServerWriteKey, 0, this.Context.ServerWriteKey.Length, temp, 0); - md5.TransformFinalBlock(this.Context.RandomSC, 0, this.Context.RandomSC.Length); - byte[] finalServerWriteKey = new byte[this.ExpandedKeyMaterialSize]; - Buffer.BlockCopy(md5.Hash, 0, finalServerWriteKey, 0, this.ExpandedKeyMaterialSize); - - this.Context.ClientWriteKey = finalClientWriteKey; - this.Context.ServerWriteKey = finalServerWriteKey; - - // Generate IV keys - if (this.IvSize > 0) - { - md5.Initialize(); - temp = md5.ComputeHash(this.Context.RandomCS, 0, this.Context.RandomCS.Length); - this.Context.ClientWriteIV = new byte[this.IvSize]; - Buffer.BlockCopy(temp, 0, this.Context.ClientWriteIV, 0, this.IvSize); - - md5.Initialize(); - temp = md5.ComputeHash(this.Context.RandomSC, 0, this.Context.RandomSC.Length); - this.Context.ServerWriteIV = new byte[this.IvSize]; - Buffer.BlockCopy(temp, 0, this.Context.ServerWriteIV, 0, this.IvSize); - } - else - { - this.Context.ClientWriteIV = CipherSuite.EmptyArray; - this.Context.ServerWriteIV = CipherSuite.EmptyArray; - } - } - - DebugHelper.WriteLine(">>>> KeyBlock", keyBlock.ToArray()); - DebugHelper.WriteLine(">>>> ClientWriteKey", this.Context.ClientWriteKey); - DebugHelper.WriteLine(">>>> ClientWriteIV", this.Context.ClientWriteIV); - DebugHelper.WriteLine(">>>> ClientWriteMAC", this.Context.Negotiating.ClientWriteMAC); - DebugHelper.WriteLine(">>>> ServerWriteKey", this.Context.ServerWriteKey); - DebugHelper.WriteLine(">>>> ServerWriteIV", this.Context.ServerWriteIV); - DebugHelper.WriteLine(">>>> ServerWriteMAC", this.Context.Negotiating.ServerWriteMAC); - - ClientSessionCache.SetContextInCache (this.Context); - // Clear no more needed data - keyBlock.Reset(); - tmp.Reset(); - } - - #endregion - - #region Private Methods - - private byte[] prf(byte[] secret, string label, byte[] random) - { - HashAlgorithm md5 = MD5.Create(); - HashAlgorithm sha = SHA1.Create(); - - // Compute SHA hash - TlsStream block = new TlsStream(); - block.Write(Encoding.ASCII.GetBytes(label)); - block.Write(secret); - block.Write(random); - - byte[] shaHash = sha.ComputeHash(block.ToArray(), 0, (int)block.Length); - - block.Reset(); - - // Compute MD5 hash - block.Write(secret); - block.Write(shaHash); - - byte[] result = md5.ComputeHash(block.ToArray(), 0, (int)block.Length); - - // Free resources - block.Reset(); - - return result; - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslClientStream.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslClientStream.cs deleted file mode 100644 index 3c95b62b32..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslClientStream.cs +++ /dev/null @@ -1,469 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Threading; - -using Mono.Security.Protocol.Tls.Handshake; - -namespace Mono.Security.Protocol.Tls -{ - #region Delegates - - public delegate bool CertificateValidationCallback( - X509Certificate certificate, - int[] certificateErrors); - - public class ValidationResult { - bool trusted; - bool user_denied; - int error_code; - - public ValidationResult (bool trusted, bool user_denied, int error_code) - { - this.trusted = trusted; - this.user_denied = user_denied; - this.error_code = error_code; - } - - public bool Trusted { - get { return trusted; } - } - - public bool UserDenied { - get { return user_denied; } - } - - public int ErrorCode { - get { return error_code; } - } - } - - public - delegate ValidationResult CertificateValidationCallback2 (Mono.Security.X509.X509CertificateCollection collection); - - public delegate X509Certificate CertificateSelectionCallback( - X509CertificateCollection clientCertificates, - X509Certificate serverCertificate, - string targetHost, - X509CertificateCollection serverRequestedCertificates); - - public delegate AsymmetricAlgorithm PrivateKeySelectionCallback( - X509Certificate certificate, - string targetHost); - - #endregion - - public class SslClientStream : SslStreamBase - { - #region Internal Events - - internal event CertificateValidationCallback ServerCertValidation; - internal event CertificateSelectionCallback ClientCertSelection; - internal event PrivateKeySelectionCallback PrivateKeySelection; - - #endregion - - #region Properties - - // required by HttpsClientStream for proxy support - internal Stream InputBuffer - { - get { return base.inputBuffer; } - } - - public X509CertificateCollection ClientCertificates - { - get { return this.context.ClientSettings.Certificates; } - } - - public X509Certificate SelectedClientCertificate - { - get { return this.context.ClientSettings.ClientCertificate; } - } - - #endregion - - #region Callback Properties - - public CertificateValidationCallback ServerCertValidationDelegate - { - get { return this.ServerCertValidation; } - set { this.ServerCertValidation = value; } - } - - public CertificateSelectionCallback ClientCertSelectionDelegate - { - get { return this.ClientCertSelection; } - set { this.ClientCertSelection = value; } - } - - public PrivateKeySelectionCallback PrivateKeyCertSelectionDelegate - { - get { return this.PrivateKeySelection; } - set { this.PrivateKeySelection = value; } - } - - #endregion - - public event CertificateValidationCallback2 ServerCertValidation2; - - #region Constructors - - public SslClientStream( - Stream stream, - string targetHost, - bool ownsStream) - : this( - stream, targetHost, ownsStream, - SecurityProtocolType.Default, null) - { - } - - public SslClientStream( - Stream stream, - string targetHost, - X509Certificate clientCertificate) - : this( - stream, targetHost, false, SecurityProtocolType.Default, - new X509CertificateCollection(new X509Certificate[]{clientCertificate})) - { - } - - public SslClientStream( - Stream stream, - string targetHost, - X509CertificateCollection clientCertificates) : - this( - stream, targetHost, false, SecurityProtocolType.Default, - clientCertificates) - { - } - - public SslClientStream( - Stream stream, - string targetHost, - bool ownsStream, - SecurityProtocolType securityProtocolType) - : this( - stream, targetHost, ownsStream, securityProtocolType, - new X509CertificateCollection()) - { - } - - public SslClientStream( - Stream stream, - string targetHost, - bool ownsStream, - SecurityProtocolType securityProtocolType, - X509CertificateCollection clientCertificates): - base(stream, ownsStream) - { - if (targetHost == null || targetHost.Length == 0) - { - throw new ArgumentNullException("targetHost is null or an empty string."); - } - - this.context = new ClientContext( - this, - securityProtocolType, - targetHost, - clientCertificates); - - this.protocol = new ClientRecordProtocol(innerStream, (ClientContext)this.context); - } - - #endregion - - #region Finalizer - - ~SslClientStream() - { - base.Dispose(false); - } - - #endregion - - #region IDisposable Methods - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - - if (disposing) - { - this.ServerCertValidation = null; - this.ClientCertSelection = null; - this.PrivateKeySelection = null; - this.ServerCertValidation2 = null; - } - } - - #endregion - - #region Handshake Methods - - /* - Client Server - - ClientHello --------> - ServerHello - Certificate* - ServerKeyExchange* - CertificateRequest* - <-------- ServerHelloDone - Certificate* - ClientKeyExchange - CertificateVerify* - [ChangeCipherSpec] - Finished --------> - [ChangeCipherSpec] - <-------- Finished - Application Data <-------> Application Data - - Fig. 1 - Message flow for a full handshake - */ - - internal override IAsyncResult OnBeginNegotiateHandshake(AsyncCallback callback, object state) - { - try - { - if (this.context.HandshakeState != HandshakeState.None) - { - this.context.Clear(); - } - - // Obtain supported cipher suites - this.context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(this.context.SecurityProtocol); - - // Set handshake state - this.context.HandshakeState = HandshakeState.Started; - - // Send client hello - return this.protocol.BeginSendRecord(HandshakeType.ClientHello, callback, state); - } - catch (TlsException ex) - { - this.protocol.SendAlert(ex.Alert); - - throw new IOException("The authentication or decryption has failed.", ex); - } - catch (Exception ex) - { - this.protocol.SendAlert(AlertDescription.InternalError); - - throw new IOException("The authentication or decryption has failed.", ex); - } - } - - private void SafeReceiveRecord (Stream s) - { - byte[] record = this.protocol.ReceiveRecord (s); - if ((record == null) || (record.Length == 0)) { - throw new TlsException ( - AlertDescription.HandshakeFailiure, - "The server stopped the handshake."); - } - } - - internal override void OnNegotiateHandshakeCallback(IAsyncResult asyncResult) - { - this.protocol.EndSendRecord(asyncResult); - - // Read server response - while (this.context.LastHandshakeMsg != HandshakeType.ServerHelloDone) - { - // Read next record - SafeReceiveRecord (this.innerStream); - - // special case for abbreviated handshake where no ServerHelloDone is sent from the server - if (this.context.AbbreviatedHandshake && (this.context.LastHandshakeMsg == HandshakeType.ServerHello)) - break; - } - - // the handshake is much easier if we can reuse a previous session settings - if (this.context.AbbreviatedHandshake) - { - ClientSessionCache.SetContextFromCache (this.context); - this.context.Negotiating.Cipher.ComputeKeys (); - this.context.Negotiating.Cipher.InitializeCipher (); - - // Send Cipher Spec protocol - this.protocol.SendChangeCipherSpec (); - - // Read record until server finished is received - while (this.context.HandshakeState != HandshakeState.Finished) - { - // If all goes well this will process messages: - // Change Cipher Spec - // Server finished - SafeReceiveRecord (this.innerStream); - } - - // Send Finished message - this.protocol.SendRecord (HandshakeType.Finished); - } - else - { - // Send client certificate if requested - // even if the server ask for it it _may_ still be optional - bool clientCertificate = this.context.ServerSettings.CertificateRequest; - - // NOTE: sadly SSL3 and TLS1 differs in how they handle this and - // the current design doesn't allow a very cute way to handle - // SSL3 alert warning for NoCertificate (41). - if (this.context.SecurityProtocol == SecurityProtocolType.Ssl3) - { - clientCertificate = ((this.context.ClientSettings.Certificates != null) && - (this.context.ClientSettings.Certificates.Count > 0)); - // this works well with OpenSSL (but only for SSL3) - } - - if (clientCertificate) - { - this.protocol.SendRecord(HandshakeType.Certificate); - } - - // Send Client Key Exchange - this.protocol.SendRecord(HandshakeType.ClientKeyExchange); - - // Now initialize session cipher with the generated keys - this.context.Negotiating.Cipher.InitializeCipher(); - - // Send certificate verify if requested (optional) - if (clientCertificate && (this.context.ClientSettings.ClientCertificate != null)) - { - this.protocol.SendRecord(HandshakeType.CertificateVerify); - } - - // Send Cipher Spec protocol - this.protocol.SendChangeCipherSpec (); - - // Send Finished message - this.protocol.SendRecord (HandshakeType.Finished); - - // Read record until server finished is received - while (this.context.HandshakeState != HandshakeState.Finished) { - // If all goes well this will process messages: - // Change Cipher Spec - // Server finished - SafeReceiveRecord (this.innerStream); - } - } - - // Reset Handshake messages information - this.context.HandshakeMessages.Reset (); - - // Clear Key Info - this.context.ClearKeyInfo(); - - } - - #endregion - - #region Event Methods - - internal override X509Certificate OnLocalCertificateSelection(X509CertificateCollection clientCertificates, X509Certificate serverCertificate, string targetHost, X509CertificateCollection serverRequestedCertificates) - { - if (this.ClientCertSelection != null) - { - return this.ClientCertSelection( - clientCertificates, - serverCertificate, - targetHost, - serverRequestedCertificates); - } - - return null; - } - - internal override bool HaveRemoteValidation2Callback { - get { return ServerCertValidation2 != null; } - } - - internal override ValidationResult OnRemoteCertificateValidation2 (Mono.Security.X509.X509CertificateCollection collection) - { - CertificateValidationCallback2 cb = ServerCertValidation2; - if (cb != null) - return cb (collection); - return null; - } - - internal override bool OnRemoteCertificateValidation(X509Certificate certificate, int[] errors) - { - if (this.ServerCertValidation != null) - { - return this.ServerCertValidation(certificate, errors); - } - - return (errors != null && errors.Length == 0); - } - - internal virtual bool RaiseServerCertificateValidation( - X509Certificate certificate, - int[] certificateErrors) - { - return base.RaiseRemoteCertificateValidation(certificate, certificateErrors); - } - - internal virtual ValidationResult RaiseServerCertificateValidation2 (Mono.Security.X509.X509CertificateCollection collection) - { - return base.RaiseRemoteCertificateValidation2 (collection); - } - - internal X509Certificate RaiseClientCertificateSelection( - X509CertificateCollection clientCertificates, - X509Certificate serverCertificate, - string targetHost, - X509CertificateCollection serverRequestedCertificates) - { - return base.RaiseLocalCertificateSelection(clientCertificates, serverCertificate, targetHost, serverRequestedCertificates); - } - - internal override AsymmetricAlgorithm OnLocalPrivateKeySelection(X509Certificate certificate, string targetHost) - { - if (this.PrivateKeySelection != null) - { - return this.PrivateKeySelection(certificate, targetHost); - } - - return null; - } - - internal AsymmetricAlgorithm RaisePrivateKeySelection( - X509Certificate certificate, - string targetHost) - { - return base.RaiseLocalPrivateKeySelection(certificate, targetHost); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslHandshakeHash.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslHandshakeHash.cs deleted file mode 100644 index fba0339099..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslHandshakeHash.cs +++ /dev/null @@ -1,185 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls -{ - internal class SslHandshakeHash : System.Security.Cryptography.HashAlgorithm - { - #region Fields - - private HashAlgorithm md5; - private HashAlgorithm sha; - private bool hashing; - private byte[] secret; - private byte[] innerPadMD5; - private byte[] outerPadMD5; - private byte[] innerPadSHA; - private byte[] outerPadSHA; - - #endregion - - #region Constructors - - public SslHandshakeHash(byte[] secret) - { - // Create md5 and sha1 hashes - this.md5 = HashAlgorithm.Create("MD5"); - this.sha = HashAlgorithm.Create("SHA1"); - - // Set HashSizeValue - this.HashSizeValue = md5.HashSize + sha.HashSize; - - // Update secret - this.secret = secret; - - this.Initialize(); - } - - #endregion - - #region Methods - - public override void Initialize() - { - this.md5.Initialize(); - this.sha.Initialize(); - this.initializePad(); - this.hashing = false; - } - - protected override byte[] HashFinal() - { - if (!this.hashing) - { - this.hashing = true; - } - - // Finalize the md5 hash - this.md5.TransformBlock(this.secret, 0, this.secret.Length, this.secret, 0); - this.md5.TransformFinalBlock(this.innerPadMD5, 0, this.innerPadMD5.Length); - - byte[] firstResultMD5 = this.md5.Hash; - - this.md5.Initialize(); - this.md5.TransformBlock(this.secret, 0, this.secret.Length, this.secret, 0); - this.md5.TransformBlock(this.outerPadMD5, 0, this.outerPadMD5.Length, this.outerPadMD5, 0); - this.md5.TransformFinalBlock(firstResultMD5, 0, firstResultMD5.Length); - - // Finalize the sha1 hash - this.sha.TransformBlock(this.secret, 0, this.secret.Length, this.secret, 0); - this.sha.TransformFinalBlock(this.innerPadSHA, 0, this.innerPadSHA.Length); - - byte[] firstResultSHA = this.sha.Hash; - - this.sha.Initialize(); - this.sha.TransformBlock(this.secret, 0, this.secret.Length, this.secret, 0); - this.sha.TransformBlock(this.outerPadSHA, 0, this.outerPadSHA.Length, this.outerPadSHA, 0); - this.sha.TransformFinalBlock(firstResultSHA, 0, firstResultSHA.Length); - - this.Initialize(); - - byte[] result = new byte[36]; - - Buffer.BlockCopy(this.md5.Hash, 0, result, 0, 16); - Buffer.BlockCopy(this.sha.Hash, 0, result, 16, 20); - - return result; - } - - protected override void HashCore(byte[] array, int ibStart, int cbSize) - { - if (!this.hashing) - { - this.hashing = true; - } - - this.md5.TransformBlock(array, ibStart, cbSize, array, ibStart); - this.sha.TransformBlock(array, ibStart, cbSize, array, ibStart); - } - - public byte[] CreateSignature(RSA rsa) - { - if (rsa == null) - { - throw new CryptographicUnexpectedOperationException ("missing key"); - } - - RSASslSignatureFormatter f = new RSASslSignatureFormatter(rsa); - f.SetHashAlgorithm("MD5SHA1"); - - return f.CreateSignature(this.Hash); - } - - public bool VerifySignature(RSA rsa, byte[] rgbSignature) - { - if (rsa == null) - { - throw new CryptographicUnexpectedOperationException ("missing key"); - } - if (rgbSignature == null) - { - throw new ArgumentNullException ("rgbSignature"); - } - - RSASslSignatureDeformatter d = new RSASslSignatureDeformatter(rsa); - d.SetHashAlgorithm("MD5SHA1"); - - return d.VerifySignature(this.Hash, rgbSignature); - } - - #endregion - - #region Private Methods - - private void initializePad() - { - // Fill md5 arrays - this.innerPadMD5 = new byte[48]; - this.outerPadMD5 = new byte[48]; - - /* Pad the key for inner and outer digest */ - for (int i = 0; i < 48; ++i) - { - this.innerPadMD5[i] = 0x36; - this.outerPadMD5[i] = 0x5C; - } - - // Fill sha arrays - this.innerPadSHA = new byte[40]; - this.outerPadSHA = new byte[40]; - - /* Pad the key for inner and outer digest */ - for (int i = 0; i < 40; ++i) - { - this.innerPadSHA[i] = 0x36; - this.outerPadSHA[i] = 0x5C; - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslServerStream.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslServerStream.cs deleted file mode 100644 index cc36ee83b7..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslServerStream.cs +++ /dev/null @@ -1,346 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; - -using Mono.Security.Protocol.Tls.Handshake; - -namespace Mono.Security.Protocol.Tls -{ - public class SslServerStream : SslStreamBase - { - #region Internal Events - - internal event CertificateValidationCallback ClientCertValidation; - internal event PrivateKeySelectionCallback PrivateKeySelection; - - #endregion - - #region Properties - - public X509Certificate ClientCertificate - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - return this.context.ClientSettings.ClientCertificate; - } - - return null; - } - } - - #endregion - - #region Callback Properties - - public CertificateValidationCallback ClientCertValidationDelegate - { - get { return this.ClientCertValidation; } - set { this.ClientCertValidation = value; } - } - - public PrivateKeySelectionCallback PrivateKeyCertSelectionDelegate - { - get { return this.PrivateKeySelection; } - set { this.PrivateKeySelection = value; } - } - - #endregion - - public event CertificateValidationCallback2 ClientCertValidation2; - #region Constructors - - public SslServerStream( - Stream stream, - X509Certificate serverCertificate) : this( - stream, - serverCertificate, - false, - false, - SecurityProtocolType.Default) - { - } - - public SslServerStream( - Stream stream, - X509Certificate serverCertificate, - bool clientCertificateRequired, - bool ownsStream): this( - stream, - serverCertificate, - clientCertificateRequired, - ownsStream, - SecurityProtocolType.Default) - { - } - - public SslServerStream( - Stream stream, - X509Certificate serverCertificate, - bool clientCertificateRequired, - bool requestClientCertificate, - bool ownsStream) - : this (stream, serverCertificate, clientCertificateRequired, requestClientCertificate, ownsStream, SecurityProtocolType.Default) - { - } - - public SslServerStream( - Stream stream, - X509Certificate serverCertificate, - bool clientCertificateRequired, - bool ownsStream, - SecurityProtocolType securityProtocolType) - : this (stream, serverCertificate, clientCertificateRequired, false, ownsStream, securityProtocolType) - { - } - - public SslServerStream( - Stream stream, - X509Certificate serverCertificate, - bool clientCertificateRequired, - bool requestClientCertificate, - bool ownsStream, - SecurityProtocolType securityProtocolType) - : base(stream, ownsStream) - { - this.context = new ServerContext( - this, - securityProtocolType, - serverCertificate, - clientCertificateRequired, - requestClientCertificate); - - this.protocol = new ServerRecordProtocol(innerStream, (ServerContext)this.context); - } - - #endregion - - #region Finalizer - - ~SslServerStream() - { - this.Dispose(false); - } - - #endregion - - #region IDisposable Methods - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - - if (disposing) - { - this.ClientCertValidation = null; - this.PrivateKeySelection = null; - } - } - - #endregion - - #region Handsake Methods - - /* - Client Server - - ClientHello --------> - ServerHello - Certificate* - ServerKeyExchange* - CertificateRequest* - <-------- ServerHelloDone - Certificate* - ClientKeyExchange - CertificateVerify* - [ChangeCipherSpec] - Finished --------> - [ChangeCipherSpec] - <-------- Finished - Application Data <-------> Application Data - - Fig. 1 - Message flow for a full handshake - */ - - internal override IAsyncResult OnBeginNegotiateHandshake(AsyncCallback callback, object state) - { - // Reset the context if needed - if (this.context.HandshakeState != HandshakeState.None) - { - this.context.Clear(); - } - - // Obtain supported cipher suites - this.context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers(this.context.SecurityProtocol); - - // Set handshake state - this.context.HandshakeState = HandshakeState.Started; - - // Receive Client Hello message - return this.protocol.BeginReceiveRecord(this.innerStream, callback, state); - - } - - internal override void OnNegotiateHandshakeCallback(IAsyncResult asyncResult) - { - // Receive Client Hello message and ignore it - this.protocol.EndReceiveRecord(asyncResult); - - // If received message is not an ClientHello send a - // Fatal Alert - if (this.context.LastHandshakeMsg != HandshakeType.ClientHello) - { - this.protocol.SendAlert(AlertDescription.UnexpectedMessage); - } - - // Send ServerHello message - this.protocol.SendRecord(HandshakeType.ServerHello); - - // Send ServerCertificate message - this.protocol.SendRecord(HandshakeType.Certificate); - - // If the negotiated cipher is a KeyEx cipher send ServerKeyExchange - if (this.context.Negotiating.Cipher.IsExportable) - { - this.protocol.SendRecord(HandshakeType.ServerKeyExchange); - } - - bool certRequested = false; - - // If the negotiated cipher is a KeyEx cipher or - // the client certificate is required send the CertificateRequest message - if (this.context.Negotiating.Cipher.IsExportable || - ((ServerContext)this.context).ClientCertificateRequired || - ((ServerContext)this.context).RequestClientCertificate) - { - this.protocol.SendRecord(HandshakeType.CertificateRequest); - certRequested = true; - } - - // Send ServerHelloDone message - this.protocol.SendRecord(HandshakeType.ServerHelloDone); - - // Receive client response, until the Client Finished message - // is received. IE can be interrupted at this stage and never - // complete the handshake - while (this.context.LastHandshakeMsg != HandshakeType.Finished) - { - byte[] record = this.protocol.ReceiveRecord(this.innerStream); - if ((record == null) || (record.Length == 0)) - { - throw new TlsException( - AlertDescription.HandshakeFailiure, - "The client stopped the handshake."); - } - } - - if (certRequested) { - X509Certificate client_cert = this.context.ClientSettings.ClientCertificate; - if (client_cert == null && ((ServerContext)this.context).ClientCertificateRequired) - throw new TlsException (AlertDescription.BadCertificate, "No certificate received from client."); - - if (!RaiseClientCertificateValidation (client_cert, new int[0])) - throw new TlsException (AlertDescription.BadCertificate, "Client certificate not accepted."); - } - - // Send ChangeCipherSpec and ServerFinished messages - this.protocol.SendChangeCipherSpec(); - this.protocol.SendRecord (HandshakeType.Finished); - - // The handshake is finished - this.context.HandshakeState = HandshakeState.Finished; - - // Reset Handshake messages information - this.context.HandshakeMessages.Reset (); - - // Clear Key Info - this.context.ClearKeyInfo(); - } - - #endregion - - #region Event Methods - - internal override X509Certificate OnLocalCertificateSelection(X509CertificateCollection clientCertificates, X509Certificate serverCertificate, string targetHost, X509CertificateCollection serverRequestedCertificates) - { - throw new NotSupportedException(); - } - - internal override bool OnRemoteCertificateValidation(X509Certificate certificate, int[] errors) - { - if (this.ClientCertValidation != null) - { - return this.ClientCertValidation(certificate, errors); - } - - return (errors != null && errors.Length == 0); - } - - internal override bool HaveRemoteValidation2Callback { - get { return ClientCertValidation2 != null; } - } - - internal override ValidationResult OnRemoteCertificateValidation2 (Mono.Security.X509.X509CertificateCollection collection) - { - CertificateValidationCallback2 cb = ClientCertValidation2; - if (cb != null) - return cb (collection); - return null; - } - - internal bool RaiseClientCertificateValidation( - X509Certificate certificate, - int[] certificateErrors) - { - return base.RaiseRemoteCertificateValidation(certificate, certificateErrors); - } - - internal override AsymmetricAlgorithm OnLocalPrivateKeySelection(X509Certificate certificate, string targetHost) - { - if (this.PrivateKeySelection != null) - { - return this.PrivateKeySelection(certificate, targetHost); - } - - return null; - } - - internal AsymmetricAlgorithm RaisePrivateKeySelection( - X509Certificate certificate, - string targetHost) - { - return base.RaiseLocalPrivateKeySelection(certificate, targetHost); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslStreamBase.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslStreamBase.cs deleted file mode 100644 index 646f8d928a..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/SslStreamBase.cs +++ /dev/null @@ -1,1228 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Threading; - -namespace Mono.Security.Protocol.Tls -{ - public abstract class SslStreamBase: Stream, IDisposable - { - private delegate void AsyncHandshakeDelegate(InternalAsyncResult asyncResult, bool fromWrite); - - #region Fields - - static ManualResetEvent record_processing = new ManualResetEvent (true); - - private const int WaitTimeOut = 5 * 60 * 1000; - - internal Stream innerStream; - internal MemoryStream inputBuffer; - internal Context context; - internal RecordProtocol protocol; - internal bool ownsStream; - private volatile bool disposed; - private bool checkCertRevocationStatus; - private object negotiate; - private object read; - private object write; - private ManualResetEvent negotiationComplete; - - #endregion - - - #region Constructors - - protected SslStreamBase( - Stream stream, - bool ownsStream) - { - if (stream == null) - { - throw new ArgumentNullException("stream is null."); - } - if (!stream.CanRead || !stream.CanWrite) - { - throw new ArgumentNullException("stream is not both readable and writable."); - } - - this.inputBuffer = new MemoryStream(); - this.innerStream = stream; - this.ownsStream = ownsStream; - this.negotiate = new object(); - this.read = new object(); - this.write = new object(); - this.negotiationComplete = new ManualResetEvent(false); - } - - #endregion - - #region Handshakes - private void AsyncHandshakeCallback(IAsyncResult asyncResult) - { - InternalAsyncResult internalResult = asyncResult.AsyncState as InternalAsyncResult; - - try - { - try - { - this.OnNegotiateHandshakeCallback(asyncResult); - } - catch (TlsException ex) - { - this.protocol.SendAlert(ex.Alert); - - throw new IOException("The authentication or decryption has failed.", ex); - } - catch (Exception ex) - { - this.protocol.SendAlert(AlertDescription.InternalError); - - throw new IOException("The authentication or decryption has failed.", ex); - } - - if (internalResult.ProceedAfterHandshake) - { - //kick off the read or write process (whichever called us) after the handshake is complete - if (internalResult.FromWrite) - { - InternalBeginWrite(internalResult); - } - else - { - InternalBeginRead(internalResult); - } - negotiationComplete.Set(); - } - else - { - negotiationComplete.Set(); - internalResult.SetComplete(); - } - - } - catch (Exception ex) - { - negotiationComplete.Set(); - internalResult.SetComplete(ex); - } - } - - internal bool MightNeedHandshake - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - return false; - } - else - { - lock (this.negotiate) - { - return (this.context.HandshakeState != HandshakeState.Finished); - } - } - } - } - - internal void NegotiateHandshake() - { - if (this.MightNeedHandshake) - { - InternalAsyncResult ar = new InternalAsyncResult(null, null, null, 0, 0, false, false); - - //if something already started negotiation, wait for it. - //otherwise end it ourselves. - if (!BeginNegotiateHandshake(ar)) - { - this.negotiationComplete.WaitOne(); - } - else - { - this.EndNegotiateHandshake(ar); - } - } - } - - #endregion - - #region Abstracts/Virtuals - - internal abstract IAsyncResult OnBeginNegotiateHandshake(AsyncCallback callback, object state); - internal abstract void OnNegotiateHandshakeCallback(IAsyncResult asyncResult); - - internal abstract X509Certificate OnLocalCertificateSelection(X509CertificateCollection clientCertificates, - X509Certificate serverCertificate, - string targetHost, - X509CertificateCollection serverRequestedCertificates); - - internal abstract bool OnRemoteCertificateValidation(X509Certificate certificate, int[] errors); - internal abstract ValidationResult OnRemoteCertificateValidation2 (Mono.Security.X509.X509CertificateCollection collection); - internal abstract bool HaveRemoteValidation2Callback { get; } - - internal abstract AsymmetricAlgorithm OnLocalPrivateKeySelection(X509Certificate certificate, string targetHost); - - #endregion - - #region Event Methods - - internal X509Certificate RaiseLocalCertificateSelection(X509CertificateCollection certificates, - X509Certificate remoteCertificate, - string targetHost, - X509CertificateCollection requestedCertificates) - { - return OnLocalCertificateSelection(certificates, remoteCertificate, targetHost, requestedCertificates); - } - - internal bool RaiseRemoteCertificateValidation(X509Certificate certificate, int[] errors) - { - return OnRemoteCertificateValidation(certificate, errors); - } - - internal ValidationResult RaiseRemoteCertificateValidation2 (Mono.Security.X509.X509CertificateCollection collection) - { - return OnRemoteCertificateValidation2 (collection); - } - - internal AsymmetricAlgorithm RaiseLocalPrivateKeySelection( - X509Certificate certificate, - string targetHost) - { - return OnLocalPrivateKeySelection(certificate, targetHost); - } - #endregion - - #region Security Properties - - public bool CheckCertRevocationStatus - { - get { return this.checkCertRevocationStatus; } - set { this.checkCertRevocationStatus = value; } - } - - public CipherAlgorithmType CipherAlgorithm - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - return this.context.Current.Cipher.CipherAlgorithmType; - } - - return CipherAlgorithmType.None; - } - } - - public int CipherStrength - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - return this.context.Current.Cipher.EffectiveKeyBits; - } - - return 0; - } - } - - public HashAlgorithmType HashAlgorithm - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - return this.context.Current.Cipher.HashAlgorithmType; - } - - return HashAlgorithmType.None; - } - } - - public int HashStrength - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - return this.context.Current.Cipher.HashSize * 8; - } - - return 0; - } - } - - public int KeyExchangeStrength - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - return this.context.ServerSettings.Certificates[0].RSA.KeySize; - } - - return 0; - } - } - - public ExchangeAlgorithmType KeyExchangeAlgorithm - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - return this.context.Current.Cipher.ExchangeAlgorithmType; - } - - return ExchangeAlgorithmType.None; - } - } - - public SecurityProtocolType SecurityProtocol - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - return this.context.SecurityProtocol; - } - - return 0; - } - } - - public X509Certificate ServerCertificate - { - get - { - if (this.context.HandshakeState == HandshakeState.Finished) - { - if (this.context.ServerSettings.Certificates != null && - this.context.ServerSettings.Certificates.Count > 0) - { - return new X509Certificate(this.context.ServerSettings.Certificates[0].RawData); - } - } - - return null; - } - } - - // this is used by Mono's certmgr tool to download certificates - internal Mono.Security.X509.X509CertificateCollection ServerCertificates - { - get { return context.ServerSettings.Certificates; } - } - - #endregion - - #region Internal Async Result/State Class - - private class InternalAsyncResult : IAsyncResult - { - private object locker = new object (); - private AsyncCallback _userCallback; - private object _userState; - private Exception _asyncException; - private ManualResetEvent handle; - private bool completed; - private int _bytesRead; - private bool _fromWrite; - private bool _proceedAfterHandshake; - - private byte[] _buffer; - private int _offset; - private int _count; - - public InternalAsyncResult(AsyncCallback userCallback, object userState, byte[] buffer, int offset, int count, bool fromWrite, bool proceedAfterHandshake) - { - _userCallback = userCallback; - _userState = userState; - _buffer = buffer; - _offset = offset; - _count = count; - _fromWrite = fromWrite; - _proceedAfterHandshake = proceedAfterHandshake; - } - - public bool ProceedAfterHandshake - { - get { return _proceedAfterHandshake; } - } - - public bool FromWrite - { - get { return _fromWrite; } - } - - public byte[] Buffer - { - get { return _buffer; } - } - - public int Offset - { - get { return _offset; } - } - - public int Count - { - get { return _count; } - } - - public int BytesRead - { - get { return _bytesRead; } - } - - public object AsyncState - { - get { return _userState; } - } - - public Exception AsyncException - { - get { return _asyncException; } - } - - public bool CompletedWithError - { - get { - if (IsCompleted == false) - return false; - return null != _asyncException; - } - } - - public WaitHandle AsyncWaitHandle - { - get { - lock (locker) { - if (handle == null) - handle = new ManualResetEvent (completed); - } - return handle; - } - } - - public bool CompletedSynchronously - { - get { return false; } - } - - public bool IsCompleted - { - get { - lock (locker) - return completed; - } - } - - private void SetComplete(Exception ex, int bytesRead) - { - lock (locker) { - if (completed) - return; - - completed = true; - _asyncException = ex; - _bytesRead = bytesRead; - if (handle != null) - handle.Set (); - } - if (_userCallback != null) - _userCallback.BeginInvoke (this, null, null); - } - - public void SetComplete(Exception ex) - { - SetComplete(ex, 0); - } - - public void SetComplete(int bytesRead) - { - SetComplete(null, bytesRead); - } - - public void SetComplete() - { - SetComplete(null, 0); - } - } - #endregion - - #region Stream Overrides and Async Stream Operations - - private bool BeginNegotiateHandshake(InternalAsyncResult asyncResult) - { - try - { - lock (this.negotiate) - { - if (this.context.HandshakeState == HandshakeState.None) - { - this.OnBeginNegotiateHandshake(new AsyncCallback(AsyncHandshakeCallback), asyncResult); - - return true; - } - else - { - return false; - } - } - } - catch (TlsException ex) - { - this.negotiationComplete.Set(); - this.protocol.SendAlert(ex.Alert); - - throw new IOException("The authentication or decryption has failed.", ex); - } - catch (Exception ex) - { - this.negotiationComplete.Set(); - this.protocol.SendAlert(AlertDescription.InternalError); - - throw new IOException("The authentication or decryption has failed.", ex); - } - } - - private void EndNegotiateHandshake(InternalAsyncResult asyncResult) - { - if (asyncResult.IsCompleted == false) - asyncResult.AsyncWaitHandle.WaitOne(); - - if (asyncResult.CompletedWithError) - { - throw asyncResult.AsyncException; - } - } - - public override IAsyncResult BeginRead( - byte[] buffer, - int offset, - int count, - AsyncCallback callback, - object state) - { - this.checkDisposed(); - - if (buffer == null) - { - throw new ArgumentNullException("buffer is a null reference."); - } - if (offset < 0) - { - throw new ArgumentOutOfRangeException("offset is less than 0."); - } - if (offset > buffer.Length) - { - throw new ArgumentOutOfRangeException("offset is greater than the length of buffer."); - } - if (count < 0) - { - throw new ArgumentOutOfRangeException("count is less than 0."); - } - if (count > (buffer.Length - offset)) - { - throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter."); - } - - InternalAsyncResult asyncResult = new InternalAsyncResult(callback, state, buffer, offset, count, false, true); - - if (this.MightNeedHandshake) - { - if (! BeginNegotiateHandshake(asyncResult)) - { - //we made it down here so the handshake was not started. - //another thread must have started it in the mean time. - //wait for it to complete and then perform our original operation - this.negotiationComplete.WaitOne(); - - InternalBeginRead(asyncResult); - } - } - else - { - InternalBeginRead(asyncResult); - } - - return asyncResult; - } - - // bigger than max record length for SSL/TLS - private byte[] recbuf = new byte[16384]; - - private void InternalBeginRead(InternalAsyncResult asyncResult) - { - try - { - int preReadSize = 0; - - lock (this.read) - { - // If actual buffer is fully read, reset it - bool shouldReset = this.inputBuffer.Position == this.inputBuffer.Length && this.inputBuffer.Length > 0; - - // If the buffer isn't fully read, but does have data, we need to immediately - // read the info from the buffer and let the user know that they have more data. - bool shouldReadImmediately = (this.inputBuffer.Length > 0) && (asyncResult.Count > 0); - - if (shouldReset) - { - this.resetBuffer(); - } - else if (shouldReadImmediately) - { - preReadSize = this.inputBuffer.Read(asyncResult.Buffer, asyncResult.Offset, asyncResult.Count); - } - } - - // This is explicitly done outside the synclock to avoid - // any potential deadlocks in the delegate call. - if (0 < preReadSize) - { - asyncResult.SetComplete(preReadSize); - } - else if (!this.context.ReceivedConnectionEnd) - { - // this will read data from the network until we have (at least) one - // record to send back to the caller - this.innerStream.BeginRead(recbuf, 0, recbuf.Length, - new AsyncCallback(InternalReadCallback), new object[] { recbuf, asyncResult }); - } - else - { - // We're done with the connection so we need to let the caller know with 0 bytes read - asyncResult.SetComplete(0); - } - } - catch (TlsException ex) - { - this.protocol.SendAlert(ex.Alert); - - throw new IOException("The authentication or decryption has failed.", ex); - } - catch (Exception ex) - { - throw new IOException("IO exception during read.", ex); - } - } - - - private MemoryStream recordStream = new MemoryStream(); - - // read encrypted data until we have enough to decrypt (at least) one - // record and return are the records (may be more than one) we have - private void InternalReadCallback(IAsyncResult result) - { - if (this.disposed) - return; - - object[] state = (object[])result.AsyncState; - byte[] recbuf = (byte[])state[0]; - InternalAsyncResult internalResult = (InternalAsyncResult)state[1]; - - try - { - int n = innerStream.EndRead(result); - if (n > 0) - { - // Add the just received data to the waiting data - recordStream.Write(recbuf, 0, n); - } - else - { - // 0 length data means this read operation is done (lost connection in the case of a network stream). - internalResult.SetComplete(0); - return; - } - - bool dataToReturn = false; - long pos = recordStream.Position; - - recordStream.Position = 0; - byte[] record = null; - - // don't try to decode record unless we have at least 5 bytes - // i.e. type (1), protocol (2) and length (2) - if (recordStream.Length >= 5) - { - record = this.protocol.ReceiveRecord(recordStream); - } - - // a record of 0 length is valid (and there may be more record after it) - while (record != null) - { - // we probably received more stuff after the record, and we must keep it! - long remainder = recordStream.Length - recordStream.Position; - byte[] outofrecord = null; - if (remainder > 0) - { - outofrecord = new byte[remainder]; - recordStream.Read(outofrecord, 0, outofrecord.Length); - } - - lock (this.read) - { - long position = this.inputBuffer.Position; - - if (record.Length > 0) - { - // Write new data to the inputBuffer - this.inputBuffer.Seek(0, SeekOrigin.End); - this.inputBuffer.Write(record, 0, record.Length); - - // Restore buffer position - this.inputBuffer.Seek(position, SeekOrigin.Begin); - dataToReturn = true; - } - } - - recordStream.SetLength(0); - record = null; - - if (remainder > 0) - { - recordStream.Write(outofrecord, 0, outofrecord.Length); - // type (1), protocol (2) and length (2) - if (recordStream.Length >= 5) - { - // try to see if another record is available - recordStream.Position = 0; - record = this.protocol.ReceiveRecord(recordStream); - if (record == null) - pos = recordStream.Length; - } - else - pos = remainder; - } - else - pos = 0; - } - - if (!dataToReturn && (n > 0)) - { - if (context.ReceivedConnectionEnd) { - internalResult.SetComplete (0); - } else { - // there is no record to return to caller and (possibly) more data waiting - // so continue reading from network (and appending to stream) - recordStream.Position = recordStream.Length; - this.innerStream.BeginRead(recbuf, 0, recbuf.Length, - new AsyncCallback(InternalReadCallback), state); - } - } - else - { - // we have record(s) to return -or- no more available to read from network - // reset position for further reading - recordStream.Position = pos; - - int bytesRead = 0; - lock (this.read) - { - bytesRead = this.inputBuffer.Read(internalResult.Buffer, internalResult.Offset, internalResult.Count); - } - - internalResult.SetComplete(bytesRead); - } - } - catch (Exception ex) - { - internalResult.SetComplete(ex); - } - - } - - private void InternalBeginWrite(InternalAsyncResult asyncResult) - { - try - { - // Send the buffer as a TLS record - - lock (this.write) - { - byte[] record = this.protocol.EncodeRecord( - ContentType.ApplicationData, asyncResult.Buffer, asyncResult.Offset, asyncResult.Count); - - this.innerStream.BeginWrite( - record, 0, record.Length, new AsyncCallback(InternalWriteCallback), asyncResult); - } - } - catch (TlsException ex) - { - this.protocol.SendAlert(ex.Alert); - this.Close(); - - throw new IOException("The authentication or decryption has failed.", ex); - } - catch (Exception ex) - { - throw new IOException("IO exception during Write.", ex); - } - } - - private void InternalWriteCallback(IAsyncResult ar) - { - if (this.disposed) - return; - - InternalAsyncResult internalResult = (InternalAsyncResult)ar.AsyncState; - - try - { - this.innerStream.EndWrite(ar); - internalResult.SetComplete(); - } - catch (Exception ex) - { - internalResult.SetComplete(ex); - } - } - - public override IAsyncResult BeginWrite( - byte[] buffer, - int offset, - int count, - AsyncCallback callback, - object state) - { - this.checkDisposed(); - - if (buffer == null) - { - throw new ArgumentNullException("buffer is a null reference."); - } - if (offset < 0) - { - throw new ArgumentOutOfRangeException("offset is less than 0."); - } - if (offset > buffer.Length) - { - throw new ArgumentOutOfRangeException("offset is greater than the length of buffer."); - } - if (count < 0) - { - throw new ArgumentOutOfRangeException("count is less than 0."); - } - if (count > (buffer.Length - offset)) - { - throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter."); - } - - - InternalAsyncResult asyncResult = new InternalAsyncResult(callback, state, buffer, offset, count, true, true); - - if (this.MightNeedHandshake) - { - if (! BeginNegotiateHandshake(asyncResult)) - { - //we made it down here so the handshake was not started. - //another thread must have started it in the mean time. - //wait for it to complete and then perform our original operation - this.negotiationComplete.WaitOne(); - - InternalBeginWrite(asyncResult); - } - } - else - { - InternalBeginWrite(asyncResult); - } - - return asyncResult; - } - - public override int EndRead(IAsyncResult asyncResult) - { - this.checkDisposed(); - - InternalAsyncResult internalResult = asyncResult as InternalAsyncResult; - if (internalResult == null) - { - throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginRead."); - } - - // Always wait until the read is complete - if (!asyncResult.IsCompleted) - { - if (!asyncResult.AsyncWaitHandle.WaitOne (WaitTimeOut, false)) - throw new TlsException (AlertDescription.InternalError, "Couldn't complete EndRead"); - } - - if (internalResult.CompletedWithError) - { - throw internalResult.AsyncException; - } - - return internalResult.BytesRead; - } - - public override void EndWrite(IAsyncResult asyncResult) - { - this.checkDisposed(); - - InternalAsyncResult internalResult = asyncResult as InternalAsyncResult; - if (internalResult == null) - { - throw new ArgumentNullException("asyncResult is null or was not obtained by calling BeginWrite."); - } - - - if (!asyncResult.IsCompleted) - { - if (!internalResult.AsyncWaitHandle.WaitOne (WaitTimeOut, false)) - throw new TlsException (AlertDescription.InternalError, "Couldn't complete EndWrite"); - } - - if (internalResult.CompletedWithError) - { - throw internalResult.AsyncException; - } - } - - public override void Close() - { - base.Close (); - } - - public override void Flush() - { - this.checkDisposed(); - - this.innerStream.Flush(); - } - - public int Read(byte[] buffer) - { - return this.Read(buffer, 0, buffer.Length); - } - - public override int Read(byte[] buffer, int offset, int count) - { - this.checkDisposed (); - - if (buffer == null) - { - throw new ArgumentNullException ("buffer"); - } - if (offset < 0) - { - throw new ArgumentOutOfRangeException("offset is less than 0."); - } - if (offset > buffer.Length) - { - throw new ArgumentOutOfRangeException("offset is greater than the length of buffer."); - } - if (count < 0) - { - throw new ArgumentOutOfRangeException("count is less than 0."); - } - if (count > (buffer.Length - offset)) - { - throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter."); - } - - if (this.context.HandshakeState != HandshakeState.Finished) - { - this.NegotiateHandshake (); // Handshake negotiation - } - - lock (this.read) { - try { - record_processing.Reset (); - // do we already have some decrypted data ? - if (this.inputBuffer.Position > 0) { - // or maybe we used all the buffer before ? - if (this.inputBuffer.Position == this.inputBuffer.Length) { - this.inputBuffer.SetLength (0); - } else { - int n = this.inputBuffer.Read (buffer, offset, count); - if (n > 0) { - record_processing.Set (); - return n; - } - } - } - - bool needMoreData = false; - while (true) { - // we first try to process the read with the data we already have - if ((recordStream.Position == 0) || needMoreData) { - needMoreData = false; - // if we loop, then it either means we need more data - byte[] recbuf = new byte[16384]; - int n = 0; - if (count == 1) { - int value = innerStream.ReadByte (); - if (value >= 0) { - recbuf[0] = (byte) value; - n = 1; - } - } else { - n = innerStream.Read (recbuf, 0, recbuf.Length); - } - if (n > 0) { - // Add the new received data to the waiting data - if ((recordStream.Length > 0) && (recordStream.Position != recordStream.Length)) - recordStream.Seek (0, SeekOrigin.End); - recordStream.Write (recbuf, 0, n); - } else { - // or that the read operation is done (lost connection in the case of a network stream). - record_processing.Set (); - return 0; - } - } - - bool dataToReturn = false; - - recordStream.Position = 0; - byte[] record = null; - - // don't try to decode record unless we have at least 5 bytes - // i.e. type (1), protocol (2) and length (2) - if (recordStream.Length >= 5) { - record = this.protocol.ReceiveRecord (recordStream); - needMoreData = (record == null); - } - - // a record of 0 length is valid (and there may be more record after it) - while (record != null) { - // we probably received more stuff after the record, and we must keep it! - long remainder = recordStream.Length - recordStream.Position; - byte[] outofrecord = null; - if (remainder > 0) { - outofrecord = new byte[remainder]; - recordStream.Read (outofrecord, 0, outofrecord.Length); - } - - long position = this.inputBuffer.Position; - - if (record.Length > 0) { - // Write new data to the inputBuffer - this.inputBuffer.Seek (0, SeekOrigin.End); - this.inputBuffer.Write (record, 0, record.Length); - - // Restore buffer position - this.inputBuffer.Seek (position, SeekOrigin.Begin); - dataToReturn = true; - } - - recordStream.SetLength (0); - record = null; - - if (remainder > 0) { - recordStream.Write (outofrecord, 0, outofrecord.Length); - } - - if (dataToReturn) { - // we have record(s) to return -or- no more available to read from network - // reset position for further reading - int i = inputBuffer.Read (buffer, offset, count); - record_processing.Set (); - return i; - } - } - } - } - catch (TlsException ex) - { - throw new IOException("The authentication or decryption has failed.", ex); - } - catch (Exception ex) - { - throw new IOException("IO exception during read.", ex); - } - } - } - - public override long Seek(long offset, SeekOrigin origin) - { - throw new NotSupportedException(); - } - - public override void SetLength(long value) - { - throw new NotSupportedException(); - } - - public void Write(byte[] buffer) - { - this.Write(buffer, 0, buffer.Length); - } - - public override void Write(byte[] buffer, int offset, int count) - { - this.checkDisposed (); - - if (buffer == null) - { - throw new ArgumentNullException ("buffer"); - } - if (offset < 0) - { - throw new ArgumentOutOfRangeException("offset is less than 0."); - } - if (offset > buffer.Length) - { - throw new ArgumentOutOfRangeException("offset is greater than the length of buffer."); - } - if (count < 0) - { - throw new ArgumentOutOfRangeException("count is less than 0."); - } - if (count > (buffer.Length - offset)) - { - throw new ArgumentOutOfRangeException("count is less than the length of buffer minus the value of the offset parameter."); - } - - if (this.context.HandshakeState != HandshakeState.Finished) - { - this.NegotiateHandshake (); - } - - lock (this.write) - { - try - { - // Send the buffer as a TLS record - byte[] record = this.protocol.EncodeRecord (ContentType.ApplicationData, buffer, offset, count); - this.innerStream.Write (record, 0, record.Length); - } - catch (TlsException ex) - { - this.protocol.SendAlert(ex.Alert); - this.Close(); - throw new IOException("The authentication or decryption has failed.", ex); - } - catch (Exception ex) - { - throw new IOException("IO exception during Write.", ex); - } - } - } - - public override bool CanRead - { - get { return this.innerStream.CanRead; } - } - - public override bool CanSeek - { - get { return false; } - } - - public override bool CanWrite - { - get { return this.innerStream.CanWrite; } - } - - public override long Length - { - get { throw new NotSupportedException(); } - } - - public override long Position - { - get - { - throw new NotSupportedException(); - } - set - { - throw new NotSupportedException(); - } - } - #endregion - - #region IDisposable Members and Finalizer - - ~SslStreamBase() - { - this.Dispose(false); - } - - protected override void Dispose (bool disposing) - { - if (!this.disposed) - { - if (disposing) - { - if (this.innerStream != null) - { - if (this.context.HandshakeState == HandshakeState.Finished && - !this.context.SentConnectionEnd) - { - // Write close notify - try { - this.protocol.SendAlert(AlertDescription.CloseNotify); - } catch { - } - } - - if (this.ownsStream) - { - // Close inner stream - this.innerStream.Close(); - } - } - this.ownsStream = false; - this.innerStream = null; - } - - this.disposed = true; - base.Dispose (disposing); - } - } - - #endregion - - #region Misc Methods - - private void resetBuffer() - { - this.inputBuffer.SetLength(0); - this.inputBuffer.Position = 0; - } - - internal void checkDisposed() - { - if (this.disposed) - { - throw new ObjectDisposedException("The Stream is closed."); - } - } - - #endregion - - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsCipherSuite.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsCipherSuite.cs deleted file mode 100644 index f4feb4e7de..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsCipherSuite.cs +++ /dev/null @@ -1,182 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using System.Security.Cryptography; - -namespace Mono.Security.Protocol.Tls -{ - internal class TlsCipherSuite : CipherSuite - { - private const int MacHeaderLength = 13; - private byte[] header; - private object headerLock = new object (); - - #region Constructors - - public TlsCipherSuite( - short code, string name, CipherAlgorithmType cipherAlgorithmType, - HashAlgorithmType hashAlgorithmType, ExchangeAlgorithmType exchangeAlgorithmType, - bool exportable, bool blockMode, byte keyMaterialSize, - byte expandedKeyMaterialSize, short effectiveKeyBytes, - byte ivSize, byte blockSize) - :base(code, name, cipherAlgorithmType, hashAlgorithmType, - exchangeAlgorithmType, exportable, blockMode, keyMaterialSize, - expandedKeyMaterialSize, effectiveKeyBytes, ivSize, blockSize) - { - } - - #endregion - - #region MAC Generation Methods - - public override byte[] ComputeServerRecordMAC(ContentType contentType, byte[] fragment) - { - lock (headerLock) { - if (header == null) - header = new byte [MacHeaderLength]; - - ulong seqnum = (Context is ClientContext) ? Context.ReadSequenceNumber : Context.WriteSequenceNumber; - Write (header, 0, seqnum); - header [8] = (byte)contentType; - Write (header, 9, this.Context.Protocol); - Write (header, 11, (short)fragment.Length); - - HashAlgorithm mac = this.ServerHMAC; - mac.TransformBlock (header, 0, header.Length, header, 0); - mac.TransformBlock (fragment, 0, fragment.Length, fragment, 0); - // hack, else the method will allocate a new buffer of the same length (negative half the optimization) - mac.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0); - return mac.Hash; - } - } - - public override byte[] ComputeClientRecordMAC(ContentType contentType, byte[] fragment) - { - lock (headerLock) { - if (header == null) - header = new byte [MacHeaderLength]; - - ulong seqnum = (Context is ClientContext) ? Context.WriteSequenceNumber : Context.ReadSequenceNumber; - Write (header, 0, seqnum); - header [8] = (byte)contentType; - Write (header, 9, this.Context.Protocol); - Write (header, 11, (short)fragment.Length); - - HashAlgorithm mac = this.ClientHMAC; - mac.TransformBlock (header, 0, header.Length, header, 0); - mac.TransformBlock (fragment, 0, fragment.Length, fragment, 0); - // hack, else the method will allocate a new buffer of the same length (negative half the optimization) - mac.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0); - return mac.Hash; - } - } - - #endregion - - #region Key Generation Methods - - public override void ComputeMasterSecret(byte[] preMasterSecret) - { - // Create master secret - this.Context.MasterSecret = new byte[preMasterSecret.Length]; - this.Context.MasterSecret = this.PRF( - preMasterSecret, "master secret", this.Context.RandomCS, 48); - - DebugHelper.WriteLine(">>>> MasterSecret", this.Context.MasterSecret); - } - - public override void ComputeKeys() - { - // Create keyblock - TlsStream keyBlock = new TlsStream( - this.PRF( - this.Context.MasterSecret, - "key expansion", - this.Context.RandomSC, - this.KeyBlockSize)); - - this.Context.Negotiating.ClientWriteMAC = keyBlock.ReadBytes(this.HashSize); - this.Context.Negotiating.ServerWriteMAC = keyBlock.ReadBytes(this.HashSize); - this.Context.ClientWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize); - this.Context.ServerWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize); - - if (!this.IsExportable) - { - if (this.IvSize != 0) - { - this.Context.ClientWriteIV = keyBlock.ReadBytes(this.IvSize); - this.Context.ServerWriteIV = keyBlock.ReadBytes(this.IvSize); - } - else - { - this.Context.ClientWriteIV = CipherSuite.EmptyArray; - this.Context.ServerWriteIV = CipherSuite.EmptyArray; - } - } - else - { - // Generate final write keys - byte[] finalClientWriteKey = PRF(this.Context.ClientWriteKey, "client write key", this.Context.RandomCS, this.ExpandedKeyMaterialSize); - byte[] finalServerWriteKey = PRF(this.Context.ServerWriteKey, "server write key", this.Context.RandomCS, this.ExpandedKeyMaterialSize); - - this.Context.ClientWriteKey = finalClientWriteKey; - this.Context.ServerWriteKey = finalServerWriteKey; - - if (this.IvSize > 0) - { - // Generate IV block - byte[] ivBlock = PRF(CipherSuite.EmptyArray, "IV block", this.Context.RandomCS, this.IvSize*2); - - // Generate IV keys - this.Context.ClientWriteIV = new byte[this.IvSize]; - Buffer.BlockCopy(ivBlock, 0, this.Context.ClientWriteIV, 0, this.Context.ClientWriteIV.Length); - - this.Context.ServerWriteIV = new byte[this.IvSize]; - Buffer.BlockCopy(ivBlock, this.IvSize, this.Context.ServerWriteIV, 0, this.Context.ServerWriteIV.Length); - } - else - { - this.Context.ClientWriteIV = CipherSuite.EmptyArray; - this.Context.ServerWriteIV = CipherSuite.EmptyArray; - } - } - - DebugHelper.WriteLine(">>>> KeyBlock", keyBlock.ToArray()); - DebugHelper.WriteLine(">>>> ClientWriteKey", this.Context.ClientWriteKey); - DebugHelper.WriteLine(">>>> ClientWriteIV", this.Context.ClientWriteIV); - DebugHelper.WriteLine(">>>> ClientWriteMAC", this.Context.Negotiating.ClientWriteMAC); - DebugHelper.WriteLine(">>>> ServerWriteKey", this.Context.ServerWriteKey); - DebugHelper.WriteLine(">>>> ServerWriteIV", this.Context.ServerWriteIV); - DebugHelper.WriteLine(">>>> ServerWriteMAC", this.Context.Negotiating.ServerWriteMAC); - - ClientSessionCache.SetContextInCache (this.Context); - // Clear no more needed data - keyBlock.Reset(); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsClientSettings.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsClientSettings.cs deleted file mode 100644 index bcbc882cf3..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsClientSettings.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Text; -using System.Security.Cryptography.X509Certificates; -using Mono.Security.Cryptography; -using X509 = Mono.Security.X509; - -namespace Mono.Security.Protocol.Tls -{ - internal sealed class TlsClientSettings - { - #region Fields - - private string targetHost; - private X509CertificateCollection certificates; - //private SecurityCompressionType compressionMethod; - private X509Certificate clientCertificate; - private RSAManaged certificateRSA; - - #endregion - - #region Properties - - public string TargetHost - { - get { return this.targetHost; } - set { this.targetHost = value; } - } - - public X509CertificateCollection Certificates - { - get { return this.certificates; } - set { this.certificates = value; } - } - - public X509Certificate ClientCertificate - { - get { return this.clientCertificate; } - set - { - this.clientCertificate = value; - this.UpdateCertificateRSA(); - } - } - - public RSAManaged CertificateRSA - { - get { return this.certificateRSA; } - } - - /* - public SecurityCompressionType CompressionMethod - { - get { return this.compressionMethod; } - set - { - if (value != SecurityCompressionType.None) - { - throw new NotSupportedException("Specified compression method is not supported"); - } - this.compressionMethod = value; - } - } - */ - - #endregion - - #region Constructors - - public TlsClientSettings() - { - // this.compressionMethod = SecurityCompressionType.None; - this.certificates = new X509CertificateCollection(); - this.targetHost = String.Empty; - } - - #endregion - - #region Methods - - public void UpdateCertificateRSA() - { - if (this.clientCertificate == null) - { - this.certificateRSA = null; - } - else - { - X509.X509Certificate cert = new X509.X509Certificate(this.clientCertificate.GetRawCertData()); - - this.certificateRSA = new RSAManaged( - cert.RSA.KeySize); - - this.certificateRSA.ImportParameters( - cert.RSA.ExportParameters(false)); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsException.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsException.cs deleted file mode 100644 index ef2c5ce090..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsException.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Text; -using System.Runtime.Serialization; - -namespace Mono.Security.Protocol.Tls -{ - [Serializable] - internal sealed class TlsException : Exception - { - #region Fields - - private Alert alert; - - #endregion - - #region Properties - - public Alert Alert - { - get { return this.alert; } - } - - #endregion - - #region Constructors - - internal TlsException(string message) : base(message) - { - } - - internal TlsException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - - internal TlsException(string message, Exception ex) : base(message, ex) - { - } - - internal TlsException( - AlertLevel level, - AlertDescription description) - : this (level, description, Alert.GetAlertMessage(description)) - { - } - - internal TlsException( - AlertLevel level, - AlertDescription description, - string message) : base (message) - { - this.alert = new Alert(level, description); - } - - internal TlsException( - AlertDescription description) - : this (description, Alert.GetAlertMessage(description)) - { - } - - internal TlsException( - AlertDescription description, - string message) : base (message) - { - this.alert = new Alert(description); - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsServerSettings.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsServerSettings.cs deleted file mode 100644 index fec31752e7..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsServerSettings.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Security.Cryptography; - -using Mono.Security.Cryptography; -using Mono.Security.X509; -using Mono.Security.Protocol.Tls.Handshake; - -namespace Mono.Security.Protocol.Tls -{ - internal class TlsServerSettings - { - #region Fields - - private X509CertificateCollection certificates; - private RSA certificateRSA; - private RSAParameters rsaParameters; - private byte[] signedParams; - private string[] distinguisedNames; - private bool serverKeyExchange; - private bool certificateRequest; - private ClientCertificateType[] certificateTypes; - - #endregion - - #region Properties - - public bool ServerKeyExchange - { - get { return this.serverKeyExchange; } - set { this.serverKeyExchange = value; } - } - - public X509CertificateCollection Certificates - { - get { return this.certificates; } - set { this.certificates = value; } - } - - public RSA CertificateRSA - { - get { return this.certificateRSA; } - } - - public RSAParameters RsaParameters - { - get { return this.rsaParameters; } - set { this.rsaParameters = value; } - } - - public byte[] SignedParams - { - get { return this.signedParams; } - set { this.signedParams = value; } - } - - public bool CertificateRequest - { - get { return this.certificateRequest; } - set { this.certificateRequest = value; } - } - - public ClientCertificateType[] CertificateTypes - { - get { return this.certificateTypes; } - set { this.certificateTypes = value; } - } - - public string[] DistinguisedNames - { - get { return this.distinguisedNames; } - set { this.distinguisedNames = value; } - } - - #endregion - - #region Constructors - - public TlsServerSettings() - { - } - - #endregion - - #region Methods - - public void UpdateCertificateRSA() - { - if (this.certificates == null || - this.certificates.Count == 0) - { - this.certificateRSA = null; - } - else - { - this.certificateRSA = new RSAManaged( - this.certificates[0].RSA.KeySize); - - this.certificateRSA.ImportParameters( - this.certificates[0].RSA.ExportParameters(false)); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsStream.cs b/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsStream.cs deleted file mode 100644 index 4130ad10ec..0000000000 --- a/mcs/class/System.ServiceModel/Mono.Security.Protocol.Tls/TlsStream.cs +++ /dev/null @@ -1,274 +0,0 @@ -// Transport Security Layer (TLS) -// Copyright (c) 2003-2004 Carlos Guzman Alvarez -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; - -namespace Mono.Security.Protocol.Tls -{ - internal class TlsStream : Stream - { - #region Fields - - private bool canRead; - private bool canWrite; - private MemoryStream buffer; - private byte[] temp; - private const int temp_size = 4; - - #endregion - - #region Properties - - public bool EOF - { - get - { - if (this.Position < this.Length) - { - return false; - } - else - { - return true; - } - } - } - - #endregion - - #region Stream Properties - - public override bool CanWrite - { - get { return this.canWrite; } - } - - public override bool CanRead - { - get { return this.canRead; } - } - - public override bool CanSeek - { - get { return this.buffer.CanSeek; } - } - - public override long Position - { - get { return this.buffer.Position; } - set { this.buffer.Position = value; } - } - - public override long Length - { - get { return this.buffer.Length; } - } - - #endregion - - #region Constructors - - public TlsStream() : base() - { - this.buffer = new MemoryStream(0); - this.canRead = false; - this.canWrite = true; - } - - public TlsStream(byte[] data) : base() - { - if (data != null) - this.buffer = new MemoryStream(data); - else - this.buffer = new MemoryStream (); - this.canRead = true; - this.canWrite = false; - } - - #endregion - - #region Specific Read Methods - - // hack for reducing memory allocations - // returned value is valid only for the length asked *and* - // cannot be directly returned outside the class - // note: Mono's Stream.ReadByte does a 1 byte array allocation - private byte[] ReadSmallValue (int length) - { - if (length > temp_size) - throw new ArgumentException ("8 bytes maximum"); - if (temp == null) - temp = new byte[temp_size]; - - if (this.Read (temp, 0, length) != length) - throw new TlsException (String.Format ("buffer underrun")); - return temp; - } - - public new byte ReadByte() - { - byte[] result = ReadSmallValue (1); - return result [0]; - } - - public short ReadInt16() - { - byte[] result = ReadSmallValue (2); - return (short) (result[0] << 8 | result[1]); - } - - public int ReadInt24() - { - byte[] result = ReadSmallValue (3); - return ((result[0] << 16) | (result[1] << 8) | result[2]); - } - - public int ReadInt32() - { - byte[] result = ReadSmallValue (4); - return ((result[0] << 24) | (result[1] << 16) | (result[2] << 8) | result[3]); - } - - public byte[] ReadBytes(int count) - { - byte[] bytes = new byte[count]; - if (this.Read(bytes, 0, count) != count) - throw new TlsException ("buffer underrun"); - - return bytes; - } - - #endregion - - #region Specific Write Methods - - // note: Mono's Stream.WriteByte does a 1 byte array allocation - public void Write(byte value) - { - if (temp == null) - temp = new byte[temp_size]; - temp[0] = value; - this.Write (temp, 0, 1); - } - - public void Write(short value) - { - if (temp == null) - temp = new byte[temp_size]; - temp[0] = ((byte)(value >> 8)); - temp[1] = ((byte)value); - this.Write (temp, 0, 2); - } - - public void WriteInt24(int value) - { - if (temp == null) - temp = new byte[temp_size]; - temp[0] = ((byte)(value >> 16)); - temp[1] = ((byte)(value >> 8)); - temp[2] = ((byte)value); - this.Write (temp, 0, 3); - } - - public void Write(int value) - { - if (temp == null) - temp = new byte[temp_size]; - temp[0] = ((byte)(value >> 24)); - temp[1] = ((byte)(value >> 16)); - temp[2] = ((byte)(value >> 8)); - temp[3] = ((byte)value); - this.Write (temp, 0, 4); - } - - public void Write(ulong value) - { - Write ((int)(value >> 32)); - Write ((int)value); - } - - public void Write(byte[] buffer) - { - this.Write(buffer, 0, buffer.Length); - } - - #endregion - - #region Methods - - public void Reset() - { - this.buffer.SetLength(0); - this.buffer.Position = 0; - } - - public byte[] ToArray() - { - return this.buffer.ToArray(); - } - - #endregion - - #region Stream Methods - - public override void Flush() - { - this.buffer.Flush(); - } - - public override void SetLength(long length) - { - this.buffer.SetLength(length); - } - - public override long Seek(long offset, System.IO.SeekOrigin loc) - { - return this.buffer.Seek(offset, loc); - } - - public override int Read(byte[] buffer, int offset, int count) - { - if (this.canRead) - { - return this.buffer.Read(buffer, offset, count); - } - throw new InvalidOperationException("Read operations are not allowed by this stream"); - } - - public override void Write(byte[] buffer, int offset, int count) - { - if (this.canWrite) - { - this.buffer.Write(buffer, offset, count); - } - else - { - throw new InvalidOperationException("Write operations are not allowed by this stream"); - } - } - - #endregion - } -} diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SpnegoSecurityTokenAuthenticator.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SpnegoSecurityTokenAuthenticator.cs deleted file mode 100755 index 4738c21e8b..0000000000 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SpnegoSecurityTokenAuthenticator.cs +++ /dev/null @@ -1,322 +0,0 @@ -// -// SpnegoSecurityTokenAuthenticator.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2007 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Net.Security; -using System.IdentityModel.Policy; -using System.IdentityModel.Selectors; -using System.IdentityModel.Tokens; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Security.Cryptography.Xml; -using System.ServiceModel.Channels; -using System.ServiceModel.Description; -using System.ServiceModel.Security; -using System.ServiceModel.Security.Tokens; -using System.Text; -using System.Xml; -using Mono.Security; - -using ReqType = System.ServiceModel.Security.Tokens.ServiceModelSecurityTokenRequirement; - -namespace System.ServiceModel.Security.Tokens -{ - // FIXME: implement all - class SpnegoSecurityTokenAuthenticator : CommunicationSecurityTokenAuthenticator - { - ServiceCredentialsSecurityTokenManager manager; - SpnegoAuthenticatorCommunicationObject comm; - - public SpnegoSecurityTokenAuthenticator ( - ServiceCredentialsSecurityTokenManager manager, - SecurityTokenRequirement r) - { - this.manager = manager; - comm = new SpnegoAuthenticatorCommunicationObject (this); - } - - public ServiceCredentialsSecurityTokenManager Manager { - get { return manager; } - } - - public override AuthenticatorCommunicationObject Communication { - get { return comm; } - } - - protected override bool CanValidateTokenCore (SecurityToken token) - { - throw new NotImplementedException (); - } - - protected override ReadOnlyCollection - ValidateTokenCore (SecurityToken token) - { - throw new NotImplementedException (); - } - } - - class SpnegoAuthenticatorCommunicationObject : AuthenticatorCommunicationObject - { - SpnegoSecurityTokenAuthenticator owner; - - public SpnegoAuthenticatorCommunicationObject (SpnegoSecurityTokenAuthenticator owner) - { - this.owner = owner; - } - - WSTrustSecurityTokenServiceProxy proxy; - - protected internal override TimeSpan DefaultCloseTimeout { - get { throw new NotImplementedException (); } - } - - protected internal override TimeSpan DefaultOpenTimeout { - get { throw new NotImplementedException (); } - } - - public override Message ProcessNegotiation (Message request, TimeSpan timeout) - { - if (request.Headers.Action == Constants.WstIssueAction) - return ProcessMessageType1 (request, timeout); - else - return ProcessMessageType3 (request, timeout); - } - - class TlsServerSessionInfo - { - public TlsServerSessionInfo (string context, TlsServerSession tls) - { - ContextId = context; - Tls = tls; - } - - public string ContextId; - public TlsServerSession Tls; - public MemoryStream Messages = new MemoryStream (); - } - - Dictionary sessions = - new Dictionary (); - - void AppendNegotiationMessageXml (XmlReader reader, TlsServerSessionInfo tlsInfo) - { - XmlDsigExcC14NTransform t = new XmlDsigExcC14NTransform (); - XmlDocument doc = new XmlDocument (); - doc.PreserveWhitespace = true; - reader.MoveToContent (); - doc.AppendChild (doc.ReadNode (reader)); - t.LoadInput (doc); - MemoryStream stream = (MemoryStream) t.GetOutput (); - byte [] bytes = stream.ToArray (); - tlsInfo.Messages.Write (bytes, 0, bytes.Length); - } - - // FIXME: use timeout - Message ProcessMessageType1 (Message request, TimeSpan timeout) - { - // FIXME: use correct buffer size - MessageBuffer buffer = request.CreateBufferedCopy (0x10000); - WSTrustRequestSecurityTokenReader reader = - new WSTrustRequestSecurityTokenReader (buffer.CreateMessage ().GetReaderAtBodyContents (), SecurityTokenSerializer); - reader.Read (); - - if (sessions.ContainsKey (reader.Value.Context)) - throw new SecurityNegotiationException (String.Format ("The context '{0}' already exists in this SSL negotiation manager", reader.Value.Context)); - -Console.WriteLine (buffer.CreateMessage ()); - - SspiServerSession sspi = new SspiServerSession (); -// AppendNegotiationMessageXml (buffer.CreateMessage ().GetReaderAtBodyContents (), tlsInfo); - - // FIXME: when an explicit endpoint identity is - // specified in the target EndpointAddress at client, - // it sends some other kind of binary octets that - // include NTLM octet, instead of raw NTLM octet itself. - - byte [] raw = reader.Value.BinaryExchange.Value; - - bool gss = "NTLMSSP" != Encoding.ASCII.GetString (raw, 0, 7); - - if (gss) - sspi.ProcessSpnegoInitialContextTokenRequest (raw); - else - sspi.ProcessMessageType1 (raw); - - WstRequestSecurityTokenResponse rstr = - new WstRequestSecurityTokenResponse (SecurityTokenSerializer); - rstr.Context = reader.Value.Context; - rstr.BinaryExchange = new WstBinaryExchange (Constants.WstBinaryExchangeValueGss); - - if (gss) - rstr.BinaryExchange.Value = sspi.ProcessSpnegoInitialContextTokenResponse (); - else - rstr.BinaryExchange.Value = sspi.ProcessMessageType2 (); - - Message reply = Message.CreateMessage (request.Version, Constants.WstIssueReplyAction, rstr); - reply.Headers.RelatesTo = request.Headers.MessageId; - - // FIXME: use correct buffer size - buffer = reply.CreateBufferedCopy (0x10000); -// AppendNegotiationMessageXml (buffer.CreateMessage ().GetReaderAtBodyContents (), tlsInfo); - - sessions [reader.Value.Context] = sspi; - - return buffer.CreateMessage (); - } - - // FIXME: use timeout - Message ProcessMessageType3 (Message request, TimeSpan timeout) - { - // FIXME: use correct buffer size - MessageBuffer buffer = request.CreateBufferedCopy (0x10000); -Console.WriteLine (buffer.CreateMessage ()); - WSTrustRequestSecurityTokenResponseReader reader = - new WSTrustRequestSecurityTokenResponseReader (Constants.WstSpnegoProofTokenType, buffer.CreateMessage ().GetReaderAtBodyContents (), SecurityTokenSerializer, null); - reader.Read (); - - byte [] raw = reader.Value.BinaryExchange.Value; - - bool gss = "NTLMSSP" != Encoding.ASCII.GetString (raw, 0, 7); - -foreach (byte b in raw) Console.Write ("{0:X02} ", b); Console.WriteLine (); - - SspiServerSession sspi; - if (!sessions.TryGetValue (reader.Value.Context, out sspi)) - throw new SecurityNegotiationException (String.Format ("The context '{0}' does not exist in this SSL negotiation manager", reader.Value.Context)); - - if (gss) - sspi.ProcessSpnegoProcessContextToken (raw); - else - sspi.ProcessMessageType3 (raw); - - throw new NotImplementedException (); -/* - AppendNegotiationMessageXml (buffer.CreateMessage ().GetReaderAtBodyContents (), tlsInfo); -//Console.WriteLine (System.Text.Encoding.UTF8.GetString (tlsInfo.Messages.ToArray ())); - - tls.ProcessClientKeyExchange (reader.Value.BinaryExchange.Value); - - byte [] serverFinished = tls.ProcessServerFinished (); - - // The shared key is computed as recommended in WS-Trust: - // P_SHA1(encrypted_key,SHA1(exc14n(RST..RSTRs))+"CK-HASH") - byte [] hash = SHA1.Create ().ComputeHash (tlsInfo.Messages.ToArray ()); - byte [] key = tls.CreateHash (tls.MasterSecret, hash, "CK-HASH"); -foreach (byte b in hash) Console.Write ("{0:X02} ", b); Console.WriteLine (); -foreach (byte b in key) Console.Write ("{0:X02} ", b); Console.WriteLine (); - - WstRequestSecurityTokenResponseCollection col = - new WstRequestSecurityTokenResponseCollection (); - WstRequestSecurityTokenResponse rstr = - new WstRequestSecurityTokenResponse (SecurityTokenSerializer); - rstr.Context = reader.Value.Context; - rstr.TokenType = Constants.WsscContextToken; - DateTime from = DateTime.Now; - // FIXME: not sure if arbitrary key is used here. - SecurityContextSecurityToken sct = SecurityContextSecurityToken.CreateCookieSecurityContextToken ( - // Create a new context. - // (do not use sslnego context here.) - new UniqueId (), - "uuid-" + Guid.NewGuid (), - key, - from, - // FIXME: use LocalServiceSecuritySettings.NegotiationTimeout - from.AddHours (8), - null, - owner.Manager.ServiceCredentials.SecureConversationAuthentication.SecurityStateEncoder); - rstr.RequestedSecurityToken = sct; - rstr.RequestedProofToken = tls.ProcessApplicationData (key); - rstr.RequestedAttachedReference = new LocalIdKeyIdentifierClause (sct.Id); - rstr.RequestedUnattachedReference = new SecurityContextKeyIdentifierClause (sct.ContextId, null); - WstLifetime lt = new WstLifetime (); - lt.Created = from; - // FIXME: use LocalServiceSecuritySettings.NegotiationTimeout - lt.Expires = from.AddHours (8); - rstr.Lifetime = lt; - rstr.BinaryExchange = new WstBinaryExchange (Constants.WstBinaryExchangeValueGss); - rstr.BinaryExchange.Value = serverFinished; - - col.Responses.Add (rstr); - - // Authenticator is mandatory for MS sslnego. - rstr = new WstRequestSecurityTokenResponse (SecurityTokenSerializer); - rstr.Context = reader.Value.Context; - rstr.Authenticator = tls.CreateHash (key, hash, "AUTH-HASH"); - col.Responses.Add (rstr); - - sessions.Remove (reader.Value.Context); - - return Message.CreateMessage (request.Version, Constants.WstIssueReplyAction, col); -*/ - } - - protected override void OnAbort () - { - throw new NotImplementedException (); - } - - protected override void OnOpen (TimeSpan timeout) - { - if (State == CommunicationState.Opened) - throw new InvalidOperationException ("Already opened."); - - EnsureProperties (); - - proxy = new WSTrustSecurityTokenServiceProxy ( - IssuerBinding, IssuerAddress); - } - - protected override IAsyncResult OnBeginOpen (TimeSpan timeout, AsyncCallback callback, object state) - { - throw new NotImplementedException (); - } - - protected override void OnEndOpen (IAsyncResult result) - { - throw new NotImplementedException (); - } - - protected override void OnClose (TimeSpan timeout) - { - if (proxy != null) - proxy.Close (); - } - - protected override IAsyncResult OnBeginClose (TimeSpan timeout, AsyncCallback callback, object state) - { - throw new NotImplementedException (); - } - - protected override void OnEndClose (IAsyncResult result) - { - throw new NotImplementedException (); - } - } -} diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SpnegoSecurityTokenProvider.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SpnegoSecurityTokenProvider.cs deleted file mode 100755 index 3fcdf9fd05..0000000000 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SpnegoSecurityTokenProvider.cs +++ /dev/null @@ -1,203 +0,0 @@ -// -// SpnegoSecurityTokenProvider.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2007 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System.Net; -using System.Security.Principal; -using System.IdentityModel.Selectors; -using System.IdentityModel.Tokens; -using System.ServiceModel.Channels; -using System.ServiceModel.Description; -using System.ServiceModel.Security.Tokens; -using System.Xml; -using Mono.Security; - -// mhm, why is this class not in S.SM.S.Tokens?? -namespace System.ServiceModel.Security -{ - // Anyways we won't support SSPI until it becomes open. - internal class SpnegoSecurityTokenProvider : CommunicationSecurityTokenProvider - { - ClientCredentialsSecurityTokenManager manager; - SecurityTokenRequirement requirement; - SpnegoCommunicationObject comm; - - public SpnegoSecurityTokenProvider (ClientCredentialsSecurityTokenManager manager, SecurityTokenRequirement requirement) - { - this.manager = manager; - comm = new SpnegoCommunicationObject (this); - } - - public ClientCredentialsSecurityTokenManager Manager { - get { return manager; } - } - - public override ProviderCommunicationObject Communication { - get { return comm; } - } - - public override SecurityToken GetOnlineToken (TimeSpan timeout) - { - return comm.GetToken (timeout); - } - } - - class SpnegoCommunicationObject : ProviderCommunicationObject - { - SpnegoSecurityTokenProvider owner; - - public SpnegoCommunicationObject (SpnegoSecurityTokenProvider owner) - { - this.owner = owner; - } - - WSTrustSecurityTokenServiceProxy proxy; - - protected internal override TimeSpan DefaultCloseTimeout { - get { throw new NotImplementedException (); } - } - - protected internal override TimeSpan DefaultOpenTimeout { - get { throw new NotImplementedException (); } - } - - protected override void OnAbort () - { - throw new NotImplementedException (); - } - - protected override void OnOpen (TimeSpan timeout) - { - if (State == CommunicationState.Opened) - throw new InvalidOperationException ("Already opened."); - - EnsureProperties (); - - proxy = new WSTrustSecurityTokenServiceProxy ( - IssuerBinding, IssuerAddress); - } - - protected override IAsyncResult OnBeginOpen (TimeSpan timeout, AsyncCallback callback, object state) - { - throw new NotImplementedException (); - } - - protected override void OnEndOpen (IAsyncResult result) - { - throw new NotImplementedException (); - } - - protected override void OnClose (TimeSpan timeout) - { - if (proxy != null) - proxy.Close (); - } - - protected override IAsyncResult OnBeginClose (TimeSpan timeout, AsyncCallback callback, object state) - { - throw new NotImplementedException (); - } - - protected override void OnEndClose (IAsyncResult result) - { - throw new NotImplementedException (); - } - - public SecurityToken GetToken (TimeSpan timeout) - { - bool gss = (TargetAddress.Identity == null); - SspiClientSession sspi = new SspiClientSession (); - - WstRequestSecurityToken rst = - new WstRequestSecurityToken (); - - // send MessageType1 - rst.BinaryExchange = new WstBinaryExchange (Constants.WstBinaryExchangeValueGss); - // When the TargetAddress does not contain the endpoint - // identity, then .net seems to use Kerberos instead of - // raw NTLM. - if (gss) - rst.BinaryExchange.Value = sspi.ProcessSpnegoInitialContextTokenRequest (); - else - rst.BinaryExchange.Value = sspi.ProcessMessageType1 (); - - Message request = Message.CreateMessage (IssuerBinding.MessageVersion, Constants.WstIssueAction, rst); - request.Headers.MessageId = new UniqueId (); - request.Headers.ReplyTo = new EndpointAddress (Constants.WsaAnonymousUri); - request.Headers.To = TargetAddress.Uri; - MessageBuffer buffer = request.CreateBufferedCopy (0x10000); -// tlsctx.StoreMessage (buffer.CreateMessage ().GetReaderAtBodyContents ()); - - // receive MessageType2 - Message response = proxy.Issue (buffer.CreateMessage ()); - buffer = response.CreateBufferedCopy (0x10000); -// tlsctx.StoreMessage (buffer.CreateMessage ().GetReaderAtBodyContents ()); - - WSTrustRequestSecurityTokenResponseReader reader = - new WSTrustRequestSecurityTokenResponseReader (Constants.WstSpnegoProofTokenType, buffer.CreateMessage ().GetReaderAtBodyContents (), SecurityTokenSerializer, null); - reader.Read (); - - byte [] raw = reader.Value.BinaryExchange.Value; - if (gss) - sspi.ProcessSpnegoInitialContextTokenResponse (raw); - else - sspi.ProcessMessageType2 (raw); - - // send MessageType3 - WstRequestSecurityTokenResponse rstr = - new WstRequestSecurityTokenResponse (SecurityTokenSerializer); - rstr.Context = reader.Value.Context; - rstr.BinaryExchange = new WstBinaryExchange (Constants.WstBinaryExchangeValueGss); - - NetworkCredential cred = owner.Manager.ClientCredentials.Windows.ClientCredential; - string user = string.IsNullOrEmpty (cred.UserName) ? Environment.UserName : cred.UserName; - string pass = cred.Password ?? String.Empty; - if (gss) - rstr.BinaryExchange.Value = sspi.ProcessSpnegoProcessContextToken (user, pass); - else - rstr.BinaryExchange.Value = sspi.ProcessMessageType3 (user, pass); - - request = Message.CreateMessage (IssuerBinding.MessageVersion, Constants.WstIssueReplyAction, rstr); - request.Headers.MessageId = new UniqueId (); - request.Headers.ReplyTo = new EndpointAddress (Constants.WsaAnonymousUri); - request.Headers.To = TargetAddress.Uri; - - buffer = request.CreateBufferedCopy (0x10000); -// tlsctx.StoreMessage (buffer.CreateMessage ().GetReaderAtBodyContents ()); - - proxy = new WSTrustSecurityTokenServiceProxy ( - IssuerBinding, IssuerAddress); - response = proxy.IssueReply (buffer.CreateMessage ()); - // FIXME: use correct limitation - buffer = response.CreateBufferedCopy (0x10000); - // don't store this message for ckhash (it's not part - // of exchange) -Console.WriteLine (buffer.CreateMessage ()); - - throw new NotImplementedException (); - } - } -} diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SslSecurityTokenAuthenticator.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SslSecurityTokenAuthenticator.cs deleted file mode 100644 index 5278e49633..0000000000 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SslSecurityTokenAuthenticator.cs +++ /dev/null @@ -1,306 +0,0 @@ -// -// SslSecurityTokenAuthenticator.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2007 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Net.Security; -using System.IdentityModel.Policy; -using System.IdentityModel.Selectors; -using System.IdentityModel.Tokens; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Security.Cryptography.Xml; -using System.ServiceModel.Channels; -using System.ServiceModel.Description; -using System.ServiceModel.Security; -using System.ServiceModel.Security.Tokens; -using System.Xml; - -using ReqType = System.ServiceModel.Security.Tokens.ServiceModelSecurityTokenRequirement; - -namespace System.ServiceModel.Security.Tokens -{ - // FIXME: implement all - class SslSecurityTokenAuthenticator : CommunicationSecurityTokenAuthenticator - { - ServiceCredentialsSecurityTokenManager manager; - SslAuthenticatorCommunicationObject comm; - bool mutual; - - public SslSecurityTokenAuthenticator ( - ServiceCredentialsSecurityTokenManager manager, - SecurityTokenRequirement r) - { - this.manager = manager; - mutual = (r.TokenType == ServiceModelSecurityTokenTypes.MutualSslnego); - comm = new SslAuthenticatorCommunicationObject (this); - } - - public bool IsMutual { - get { return mutual; } - } - - public ServiceCredentialsSecurityTokenManager Manager { - get { return manager; } - } - - public override AuthenticatorCommunicationObject Communication { - get { return comm; } - } - - protected override bool CanValidateTokenCore (SecurityToken token) - { - throw new NotImplementedException (); - } - - protected override ReadOnlyCollection - ValidateTokenCore (SecurityToken token) - { - throw new NotImplementedException (); - } - } - - class SslAuthenticatorCommunicationObject : AuthenticatorCommunicationObject - { - SslSecurityTokenAuthenticator owner; - - public SslAuthenticatorCommunicationObject (SslSecurityTokenAuthenticator owner) - { - this.owner = owner; - } - - WSTrustSecurityTokenServiceProxy proxy; - - protected internal override TimeSpan DefaultCloseTimeout { - get { throw new NotImplementedException (); } - } - - protected internal override TimeSpan DefaultOpenTimeout { - get { throw new NotImplementedException (); } - } - - public override Message ProcessNegotiation (Message request, TimeSpan timeout) - { - if (request.Headers.Action == Constants.WstIssueAction) - return ProcessClientHello (request, timeout); - else - return ProcessClientKeyExchange (request, timeout); - } - - class TlsServerSessionInfo - { - public TlsServerSessionInfo (string context, TlsServerSession tls) - { - ContextId = context; - Tls = tls; - } - - public string ContextId; - public TlsServerSession Tls; - public MemoryStream Messages = new MemoryStream (); - } - - Dictionary sessions = - new Dictionary (); - - void AppendNegotiationMessageXml (XmlReader reader, TlsServerSessionInfo tlsInfo) - { - XmlDsigExcC14NTransform t = new XmlDsigExcC14NTransform (); - XmlDocument doc = new XmlDocument (); - doc.PreserveWhitespace = true; - reader.MoveToContent (); - doc.AppendChild (doc.ReadNode (reader)); - t.LoadInput (doc); - MemoryStream stream = (MemoryStream) t.GetOutput (); - byte [] bytes = stream.ToArray (); - tlsInfo.Messages.Write (bytes, 0, bytes.Length); - } - - // FIXME: use timeout - Message ProcessClientHello (Message request, TimeSpan timeout) - { - // FIXME: use correct buffer size - MessageBuffer buffer = request.CreateBufferedCopy (0x10000); - WSTrustRequestSecurityTokenReader reader = - new WSTrustRequestSecurityTokenReader (buffer.CreateMessage ().GetReaderAtBodyContents (), SecurityTokenSerializer); - reader.Read (); - - if (sessions.ContainsKey (reader.Value.Context)) - throw new SecurityNegotiationException (String.Format ("The context '{0}' already exists in this SSL negotiation manager", reader.Value.Context)); - - // FIXME: it seems .NET retrieves X509 Certificate through CreateSecurityTokenProvider(somex509requirement).GetToken().SecurityKeys[0] - // (should result in X509AsymmetricSecurityKey) and continues tlsstart. - // That's not very required feature so I ignore it. - TlsServerSession tls = new TlsServerSession (owner.Manager.ServiceCredentials.ServiceCertificate.Certificate, owner.IsMutual); - TlsServerSessionInfo tlsInfo = new TlsServerSessionInfo ( - reader.Value.Context, tls); - - AppendNegotiationMessageXml (buffer.CreateMessage ().GetReaderAtBodyContents (), tlsInfo); - - tls.ProcessClientHello (reader.Value.BinaryExchange.Value); - WstRequestSecurityTokenResponse rstr = - new WstRequestSecurityTokenResponse (SecurityTokenSerializer); - rstr.Context = reader.Value.Context; - rstr.BinaryExchange = new WstBinaryExchange (Constants.WstBinaryExchangeValueTls); - rstr.BinaryExchange.Value = tls.ProcessServerHello (); - - Message reply = Message.CreateMessage (request.Version, Constants.WstIssueReplyAction, rstr); - reply.Headers.RelatesTo = request.Headers.MessageId; - - // FIXME: use correct buffer size - buffer = reply.CreateBufferedCopy (0x10000); - AppendNegotiationMessageXml (buffer.CreateMessage ().GetReaderAtBodyContents (), tlsInfo); - - sessions [reader.Value.Context] = tlsInfo; - - return buffer.CreateMessage (); - } - - // FIXME: use timeout - Message ProcessClientKeyExchange (Message request, TimeSpan timeout) - { - // FIXME: use correct buffer size - MessageBuffer buffer = request.CreateBufferedCopy (0x10000); - - WSTrustRequestSecurityTokenResponseReader reader = - new WSTrustRequestSecurityTokenResponseReader (Constants.WstTlsnegoProofTokenType, buffer.CreateMessage ().GetReaderAtBodyContents (), SecurityTokenSerializer, null); - reader.Read (); - - TlsServerSessionInfo tlsInfo; - if (!sessions.TryGetValue (reader.Value.Context, out tlsInfo)) - throw new SecurityNegotiationException (String.Format ("The context '{0}' does not exist in this SSL negotiation manager", reader.Value.Context)); - TlsServerSession tls = tlsInfo.Tls; - - AppendNegotiationMessageXml (buffer.CreateMessage ().GetReaderAtBodyContents (), tlsInfo); -//Console.WriteLine (System.Text.Encoding.UTF8.GetString (tlsInfo.Messages.ToArray ())); - - tls.ProcessClientKeyExchange (reader.Value.BinaryExchange.Value); - - byte [] serverFinished = tls.ProcessServerFinished (); - - // The shared key is computed as recommended in WS-Trust: - // P_SHA1(encrypted_key,SHA1(exc14n(RST..RSTRs))+"CK-HASH") - byte [] hash = SHA1.Create ().ComputeHash (tlsInfo.Messages.ToArray ()); - byte [] key = tls.CreateHash (tls.MasterSecret, hash, "CK-HASH"); - byte [] keyTlsApplied = tls.ProcessApplicationData (key); -foreach (byte b in hash) Console.Write ("{0:X02} ", b); Console.WriteLine (); -foreach (byte b in key) Console.Write ("{0:X02} ", b); Console.WriteLine (); - - WstRequestSecurityTokenResponseCollection col = - new WstRequestSecurityTokenResponseCollection (); - WstRequestSecurityTokenResponse rstr = - new WstRequestSecurityTokenResponse (SecurityTokenSerializer); - rstr.Context = reader.Value.Context; - rstr.TokenType = Constants.WsscContextToken; - DateTime from = DateTime.Now; - // FIXME: not sure if arbitrary key is used here. - SecurityContextSecurityToken sct = SecurityContextSecurityToken.CreateCookieSecurityContextToken ( - // Create a new context. - // (do not use sslnego context here.) - new UniqueId (), - "uuid-" + Guid.NewGuid (), - key, - from, - // FIXME: use LocalServiceSecuritySettings.NegotiationTimeout - from.AddHours (8), - null, - owner.Manager.ServiceCredentials.SecureConversationAuthentication.SecurityStateEncoder); - rstr.RequestedSecurityToken = sct; - // without this ProcessApplicationData(), .NET seems - // to fail recovering the key. - rstr.RequestedProofToken = keyTlsApplied; - rstr.RequestedAttachedReference = new LocalIdKeyIdentifierClause (sct.Id); - rstr.RequestedUnattachedReference = new SecurityContextKeyIdentifierClause (sct.ContextId, null); - WstLifetime lt = new WstLifetime (); - lt.Created = from; - lt.Expires = from.Add (SecurityBindingElement.LocalServiceSettings.IssuedCookieLifetime); - rstr.Lifetime = lt; - rstr.BinaryExchange = new WstBinaryExchange (Constants.WstBinaryExchangeValueTls); - rstr.BinaryExchange.Value = serverFinished; - - col.Responses.Add (rstr); - - // Authenticator is mandatory for MS sslnego. - rstr = new WstRequestSecurityTokenResponse (SecurityTokenSerializer); - rstr.Context = reader.Value.Context; - rstr.Authenticator = tls.CreateHash (key, hash, "AUTH-HASH"); - col.Responses.Add (rstr); - - sessions.Remove (reader.Value.Context); - - // FIXME: get correct tokenRequestor address (probably identity authorized?) - if (owner.IssuedSecurityTokenHandler != null) - owner.IssuedSecurityTokenHandler (sct, request.Headers.ReplyTo); - - return Message.CreateMessage (request.Version, Constants.WstIssueReplyAction, col); - } - - protected override void OnAbort () - { - throw new NotImplementedException (); - } - - protected override void OnOpen (TimeSpan timeout) - { - if (State == CommunicationState.Opened) - throw new InvalidOperationException ("Already opened."); - - EnsureProperties (); - - proxy = new WSTrustSecurityTokenServiceProxy ( - IssuerBinding, IssuerAddress); - } - - protected override IAsyncResult OnBeginOpen (TimeSpan timeout, AsyncCallback callback, object state) - { - throw new NotImplementedException (); - } - - protected override void OnEndOpen (IAsyncResult result) - { - throw new NotImplementedException (); - } - - protected override void OnClose (TimeSpan timeout) - { - if (proxy != null) - proxy.Close (); - } - - protected override IAsyncResult OnBeginClose (TimeSpan timeout, AsyncCallback callback, object state) - { - throw new NotImplementedException (); - } - - protected override void OnEndClose (IAsyncResult result) - { - throw new NotImplementedException (); - } - } -} diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SslSecurityTokenProvider.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SslSecurityTokenProvider.cs deleted file mode 100644 index 7cf3940044..0000000000 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/SslSecurityTokenProvider.cs +++ /dev/null @@ -1,284 +0,0 @@ -// -// SslSecurityTokenProvider.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2006-2007 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.Collections.Generic; -using System.IO; -using System.Net.Security; -using System.IdentityModel.Selectors; -using System.IdentityModel.Tokens; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Security.Cryptography.Xml; -using System.ServiceModel; -using System.ServiceModel.Channels; -using System.ServiceModel.Description; -using System.ServiceModel.Security; -using System.ServiceModel.Security.Tokens; -using System.Xml; - -using ReqType = System.ServiceModel.Security.Tokens.ServiceModelSecurityTokenRequirement; - -namespace System.ServiceModel.Security.Tokens -{ - class SslSecurityTokenProvider : CommunicationSecurityTokenProvider - { - SslCommunicationObject comm; - ClientCredentialsSecurityTokenManager manager; - - public SslSecurityTokenProvider (ClientCredentialsSecurityTokenManager manager, bool mutual) - { - this.manager = manager; - comm = new SslCommunicationObject (this, mutual); - } - - public override ProviderCommunicationObject Communication { - get { return comm; } - } - - public ClientCredentialsSecurityTokenManager Manager { - get { return manager; } - } - - public override SecurityToken GetOnlineToken (TimeSpan timeout) - { - return comm.GetToken (timeout); - } - } - - class SslCommunicationObject : ProviderCommunicationObject - { - SslSecurityTokenProvider owner; - WSTrustSecurityTokenServiceProxy proxy; - X509Certificate2 client_certificate; - - - public SslCommunicationObject (SslSecurityTokenProvider owner, bool mutual) - { - if (mutual) { - client_certificate = owner.Manager.ClientCredentials.ClientCertificate.Certificate; - if (client_certificate == null) - throw new InvalidOperationException ("ClientCertificate is required for mutual SSL negotiation."); - } - this.owner = owner; - } - - class TlsnegoClientSessionContext - { - XmlDocument doc = new XmlDocument (); - XmlDsigExcC14NTransform t = new XmlDsigExcC14NTransform (); - MemoryStream stream = new MemoryStream (); - - public void StoreMessage (XmlReader reader) - { - doc.RemoveAll (); - doc.AppendChild (doc.ReadNode (reader)); - t.LoadInput (doc); - MemoryStream s = (MemoryStream) t.GetOutput (); - byte [] bytes = s.ToArray (); - stream.Write (bytes, 0, bytes.Length); - } - - public byte [] GetC14NResults () - { - return stream.ToArray (); - } - } - - public SecurityToken GetToken (TimeSpan timeout) - { - TlsnegoClientSessionContext tlsctx = - new TlsnegoClientSessionContext (); - TlsClientSession tls = new TlsClientSession (IssuerAddress.Uri.ToString (), client_certificate, owner.Manager.ClientCredentials.ServiceCertificate.Authentication); - WstRequestSecurityToken rst = - new WstRequestSecurityToken (); - string contextId = rst.Context; - - // send ClientHello - rst.BinaryExchange = new WstBinaryExchange (Constants.WstBinaryExchangeValueTls); - rst.BinaryExchange.Value = tls.ProcessClientHello (); - - Message request = Message.CreateMessage (IssuerBinding.MessageVersion, Constants.WstIssueAction, rst); - request.Headers.MessageId = new UniqueId (); - request.Headers.ReplyTo = new EndpointAddress (Constants.WsaAnonymousUri); - request.Headers.To = TargetAddress.Uri; - MessageBuffer buffer = request.CreateBufferedCopy (0x10000); - tlsctx.StoreMessage (buffer.CreateMessage ().GetReaderAtBodyContents ()); - Message response = proxy.Issue (buffer.CreateMessage ()); - - // FIXME: use correct limitation - buffer = response.CreateBufferedCopy (0x10000); - tlsctx.StoreMessage (buffer.CreateMessage ().GetReaderAtBodyContents ()); - - // receive ServerHello - WSTrustRequestSecurityTokenResponseReader reader = - new WSTrustRequestSecurityTokenResponseReader (Constants.WstTlsnegoProofTokenType, buffer.CreateMessage ().GetReaderAtBodyContents (), SecurityTokenSerializer, null); - reader.Read (); - if (reader.Value.RequestedSecurityToken != null) - return reader.Value.RequestedSecurityToken; - - tls.ProcessServerHello (reader.Value.BinaryExchange.Value); - - // send ClientKeyExchange - WstRequestSecurityTokenResponse rstr = - new WstRequestSecurityTokenResponse (SecurityTokenSerializer); - rstr.Context = reader.Value.Context; - rstr.BinaryExchange = new WstBinaryExchange (Constants.WstBinaryExchangeValueTls); - rstr.BinaryExchange.Value = tls.ProcessClientKeyExchange (); - - request = Message.CreateMessage (IssuerBinding.MessageVersion, Constants.WstIssueReplyAction, rstr); - request.Headers.ReplyTo = new EndpointAddress (Constants.WsaAnonymousUri); - request.Headers.To = TargetAddress.Uri; - - buffer = request.CreateBufferedCopy (0x10000); - tlsctx.StoreMessage (buffer.CreateMessage ().GetReaderAtBodyContents ()); -//Console.WriteLine (System.Text.Encoding.UTF8.GetString (tlsctx.GetC14NResults ())); - - // FIXME: regeneration of this instance is somehow required, but should not be. - proxy = new WSTrustSecurityTokenServiceProxy ( - IssuerBinding, IssuerAddress); - response = proxy.IssueReply (buffer.CreateMessage ()); - // FIXME: use correct limitation - buffer = response.CreateBufferedCopy (0x10000); - - WstRequestSecurityTokenResponseCollection coll = - new WstRequestSecurityTokenResponseCollection (); - coll.Read (Constants.WstTlsnegoProofTokenType, buffer.CreateMessage ().GetReaderAtBodyContents (), SecurityTokenSerializer, null); - if (coll.Responses.Count != 2) - throw new SecurityNegotiationException (String.Format ("Expected response is RequestSecurityTokenResponseCollection which contains two RequestSecurityTokenResponse items, but it actually contains {0} items", coll.Responses.Count)); - - WstRequestSecurityTokenResponse r = coll.Responses [0]; - tls.ProcessServerFinished (r.BinaryExchange.Value); - SecurityContextSecurityToken sctSrc = - r.RequestedSecurityToken; - -#if false // FIXME: should this final RSTR included in RSTRC considered too? - XmlDocument doc = new XmlDocument (); - doc.PreserveWhitespace = true; - using (XmlDictionaryWriter dw = XmlDictionaryWriter.CreateDictionaryWriter (doc.CreateNavigator ().AppendChild ())) { - if (r == null) throw new Exception ("r"); - if (dw == null) throw new Exception ("dw"); - r.WriteBodyContents (dw); - } - tlsctx.StoreMessage (XmlDictionaryReader.CreateDictionaryReader (new XmlNodeReader (doc))); -#endif - - // the RequestedProofToken is represented as 32 bytes - // of TLS ApplicationData. - // - According to WSE2 doc, it is *the* key, but not - // sure it also applies to WCF. - // - WSS4J also seems to store the encryped shared key. - // - (Important) It seems that without tls decryption, - // .NET fails to recover the key. - byte [] proof = tls.ProcessApplicationData ( - (byte []) r.RequestedProofToken); - byte [] key = proof; - - // Authenticate token. - - byte [] actual = coll.Responses [1].Authenticator; - if (actual == null) - throw new SecurityNegotiationException ("Token authenticator is expected in the RequestSecurityTokenResponse but not found."); - - if (coll.Responses [0].Context != contextId) - throw new SecurityNegotiationException ("The context Id does not match with that of the corresponding token authenticator."); - - // H = sha1(exc14n(RST..RSTRs)) - byte [] hash = SHA1.Create ().ComputeHash (tlsctx.GetC14NResults ()); - byte [] referent = tls.CreateHash (key, hash, "AUTH-HASH"); -Console.WriteLine (System.Text.Encoding.ASCII.GetString (tlsctx.GetC14NResults ())); -Console.Write ("Hash: "); -foreach (byte b in hash) Console.Write ("{0:X02} ", b); Console.WriteLine (); -Console.Write ("Referent: "); -foreach (byte b in referent) Console.Write ("{0:X02} ", b); Console.WriteLine (); -Console.Write ("Actual: "); -foreach (byte b in actual) Console.Write ("{0:X02} ", b); Console.WriteLine (); -Console.Write ("Proof: "); -foreach (byte b in proof) Console.Write ("{0:X02} ", b); Console.WriteLine (); - bool mismatch = referent.Length != actual.Length; - if (!mismatch) - for (int i = 0; i < referent.Length; i++) - if (referent [i] != actual [i]) - mismatch = true; - - if (mismatch) - throw new SecurityNegotiationException ("The CombinedHash does not match the expected value."); - - return sctSrc; - } - - protected internal override TimeSpan DefaultCloseTimeout { - get { throw new NotImplementedException (); } - } - - protected internal override TimeSpan DefaultOpenTimeout { - get { throw new NotImplementedException (); } - } - - protected override void OnAbort () - { - throw new NotImplementedException (); - } - - protected override void OnOpen (TimeSpan timeout) - { - if (State == CommunicationState.Opened) - throw new InvalidOperationException ("Already opened."); - - EnsureProperties (); - - proxy = new WSTrustSecurityTokenServiceProxy ( - IssuerBinding, IssuerAddress); - } - - protected override IAsyncResult OnBeginOpen (TimeSpan timeout, AsyncCallback callback, object state) - { - throw new NotImplementedException (); - } - - protected override void OnEndOpen (IAsyncResult result) - { - throw new NotImplementedException (); - } - - protected override void OnClose (TimeSpan timeout) - { - if (proxy != null) - proxy.Close (); - } - - protected override IAsyncResult OnBeginClose (TimeSpan timeout, AsyncCallback callback, object state) - { - throw new NotImplementedException (); - } - - protected override void OnEndClose (IAsyncResult result) - { - throw new NotImplementedException (); - } - } -} diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/TlsClientSession.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/TlsClientSession.cs deleted file mode 100644 index e84d70dfdd..0000000000 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/TlsClientSession.cs +++ /dev/null @@ -1,270 +0,0 @@ -// -// TlsClientSession.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2007 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.Collections.Generic; -using System.IO; -using System.IdentityModel.Selectors; -using System.Security.Cryptography; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using Mono.Security.Protocol.Tls; -using Mono.Security.Protocol.Tls.Handshake; -using Mono.Security.Protocol.Tls.Handshake.Client; - -namespace System.ServiceModel.Security.Tokens -{ - internal abstract class TlsSession - { - protected abstract Context Context { get; } - - protected abstract RecordProtocol Protocol { get; } - - public byte [] MasterSecret { - get { return Context.MasterSecret; } - } - - public byte [] CreateHash (byte [] key, byte [] seedSrc, string label) - { - byte [] labelBytes = Encoding.UTF8.GetBytes (label); - byte [] seed = new byte [seedSrc.Length + labelBytes.Length]; - Array.Copy (seedSrc, seed, seedSrc.Length); - Array.Copy (labelBytes, 0, seed, seedSrc.Length, labelBytes.Length); - return Context.Current.Cipher.Expand ("SHA1", key, seed, 256 / 8); - } - - public byte [] CreateHashAlt (byte [] key, byte [] seed, string label) - { - return Context.Current.Cipher.PRF (key, label, seed, 256 / 8); - } - - protected void WriteHandshake (MemoryStream ms) - { - Context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers (SecurityProtocolType.Tls); - ms.WriteByte (0x16); // Handshake - ms.WriteByte (3); // version-major - ms.WriteByte (1); // version-minor - } - - protected void WriteChangeCipherSpec (MemoryStream ms) - { - ms.WriteByte (0x14); // Handshake - ms.WriteByte (3); // version-major - ms.WriteByte (1); // version-minor - ms.WriteByte (0); // size-upper - ms.WriteByte (1); // size-lower - ms.WriteByte (1); // ChangeCipherSpec content (1 byte) - } - - protected void ReadHandshake (MemoryStream ms) - { - if (ms.ReadByte () != 0x16) - throw new Exception ("INTERNAL ERROR: handshake is expected"); - Context.ChangeProtocol ((short) (ms.ReadByte () * 0x100 + ms.ReadByte ())); - } - - protected void ReadChangeCipherSpec (MemoryStream ms) - { - if (ms.ReadByte () != 0x14) - throw new Exception ("INTERNAL ERROR: ChangeCipherSpec is expected"); - Context.ChangeProtocol ((short) (ms.ReadByte () * 0x100 + ms.ReadByte ())); - if (ms.ReadByte () * 0x100 + ms.ReadByte () != 1) - throw new Exception ("INTERNAL ERROR: unexpected ChangeCipherSpec length"); - ms.ReadByte (); // ChangeCipherSpec content (1 byte) ... anything is OK? - } - - protected byte [] ReadNextOperation (MemoryStream ms, HandshakeType expected) - { - if (ms.ReadByte () != (int) expected) - throw new Exception ("INTERNAL ERROR: unexpected server response"); - int size = ms.ReadByte () * 0x10000 + ms.ReadByte () * 0x100 + ms.ReadByte (); - // FIXME: use correct valid input range - if (size > 0x100000) - throw new Exception ("rejected massive input size."); - byte [] bytes = new byte [size]; - ms.Read (bytes, 0, size); - return bytes; - } - - protected void WriteOperations (MemoryStream ms, params HandshakeMessage [] msgs) - { - List rawbufs = new List (); - int total = 0; - for (int i = 0; i < msgs.Length; i++) { - HandshakeMessage msg = msgs [i]; - msg.Process (); - rawbufs.Add (msg.EncodeMessage ()); - total += rawbufs [i].Length; - msg.Update (); - } - // FIXME: split packets when the size exceeded 0x10000 (or so) - ms.WriteByte ((byte) (total / 0x100)); - ms.WriteByte ((byte) (total % 0x100)); - foreach (byte [] bytes in rawbufs) - ms.Write (bytes, 0, bytes.Length); - } - - protected void VerifyEndOfTransmit (MemoryStream ms) - { - if (ms.Position == ms.Length) - return; - - /* - byte [] bytes = new byte [ms.Length - ms.Position]; - ms.Read (bytes, 0, bytes.Length); - foreach (byte b in bytes) - Console.Write ("{0:X02} ", b); - Console.WriteLine (" - total {0} bytes remained.", bytes.Length); - */ - - throw new Exception ("INTERNAL ERROR: unexpected server response"); - } - } - - internal class TlsClientSession : TlsSession - { - SslClientStream ssl; - MemoryStream stream; - bool mutual; - - public TlsClientSession (string host, X509Certificate2 clientCert, X509ServiceCertificateAuthentication auth) - { - stream = new MemoryStream (); - if (clientCert == null) - ssl = new SslClientStream (stream, host, true, SecurityProtocolType.Tls); - else { - ssl = new SslClientStream (stream, host, true, SecurityProtocolType.Tls, new X509CertificateCollection (new X509Certificate [] {clientCert})); - mutual = true; - ssl.ClientCertSelection += delegate ( - X509CertificateCollection clientCertificates, - X509Certificate serverCertificate, - string targetHost, - X509CertificateCollection serverRequestedCertificates) { - return clientCertificates [0]; - }; - } - X509CertificateValidator v = null; - switch (auth.CertificateValidationMode) { - case X509CertificateValidationMode.None: - v = X509CertificateValidator.None; - break; - case X509CertificateValidationMode.PeerTrust: - v = X509CertificateValidator.PeerTrust; - break; - case X509CertificateValidationMode.ChainTrust: - v = X509CertificateValidator.ChainTrust; - break; - case X509CertificateValidationMode.PeerOrChainTrust: - v = X509CertificateValidator.PeerOrChainTrust; - break; - case X509CertificateValidationMode.Custom: - v = auth.CustomCertificateValidator; - break; - } - ssl.ServerCertValidationDelegate = delegate (X509Certificate certificate, int [] certificateErrors) { - v.Validate (new X509Certificate2 (certificate)); // will throw SecurityTokenvalidationException if invalid. - return true; - }; - } - - protected override Context Context { - get { return ssl.context; } - } - - protected override RecordProtocol Protocol { - get { return ssl.protocol; } - } - - public byte [] ProcessClientHello () - { - Context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers (Context.SecurityProtocol); - Context.HandshakeState = HandshakeState.Started; - Protocol.SendRecord (HandshakeType.ClientHello); - stream.Flush (); - return stream.ToArray (); - } - - // ServerHello, ServerCertificate and ServerHelloDone - public void ProcessServerHello (byte [] raw) - { - stream.SetLength (0); - stream.Write (raw, 0, raw.Length); - stream.Seek (0, SeekOrigin.Begin); - -//foreach (var b in raw) Console.Write ("{0:X02} ", b); Console.WriteLine (); - -#if false // FIXME: should be enabled, taking some right shape. - ReadNextOperation (stream, HandshakeType.ServerHello); - ReadNextOperation (stream, HandshakeType.Certificate); - if (mutual) - ReadNextOperation (stream, HandshakeType.CertificateRequest); - ReadNextOperation (stream, HandshakeType.ServerHelloDone); -#else - Protocol.ReceiveRecord (stream); // ServerHello - Protocol.ReceiveRecord (stream); // ServerCertificate - if (mutual) - Protocol.ReceiveRecord (stream); // CertificateRequest - Protocol.ReceiveRecord (stream); // ServerHelloDone -#endif - if (stream.Position != stream.Length) - throw new SecurityNegotiationException (String.Format ("Unexpected SSL negotiation binary: {0} bytes of excess in {1} bytes of the octets", stream.Length - stream.Position, stream.Length)); - } - - public byte [] ProcessClientKeyExchange () - { - stream.SetLength (0); - if (mutual) - Protocol.SendRecord (HandshakeType.Certificate); - Protocol.SendRecord (HandshakeType.ClientKeyExchange); - Context.Negotiating.Cipher.ComputeKeys (); - Context.Negotiating.Cipher.InitializeCipher (); - Protocol.SendChangeCipherSpec (); - Context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers (SecurityProtocolType.Tls); - Protocol.SendRecord (HandshakeType.Finished); - stream.Flush (); - return stream.ToArray (); - } - - public void ProcessServerFinished (byte [] raw) - { - stream.SetLength (0); - stream.Write (raw, 0, raw.Length); - stream.Seek (0, SeekOrigin.Begin); - - Protocol.ReceiveRecord (stream); // ChangeCipherSpec - Protocol.ReceiveRecord (stream); // ServerFinished - } - - public byte [] ProcessApplicationData (byte [] raw) - { - stream.SetLength (0); - stream.Write (raw, 0, raw.Length); - stream.Seek (0, SeekOrigin.Begin); - return Protocol.ReceiveRecord (stream); // ApplicationData - } - } -} diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/TlsServerSession.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/TlsServerSession.cs deleted file mode 100644 index aa4ba993ea..0000000000 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Security.Tokens/TlsServerSession.cs +++ /dev/null @@ -1,154 +0,0 @@ -// -// TlsServerSession.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2007 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.IO; -using System.Security.Cryptography.X509Certificates; -using Mono.Security.Protocol.Tls; -using Mono.Security.Protocol.Tls.Handshake; -using Mono.Security.Protocol.Tls.Handshake.Server; - -namespace System.ServiceModel.Security.Tokens -{ - internal class TlsServerSession : TlsSession - { - SslServerStream ssl; - MemoryStream stream; - bool mutual; - - public TlsServerSession (X509Certificate2 cert, bool mutual) - { - this.mutual = mutual; - stream = new MemoryStream (); - ssl = new SslServerStream (stream, cert, mutual, true, SecurityProtocolType.Tls); - ssl.PrivateKeyCertSelectionDelegate = delegate (X509Certificate c, string host) { - if (c.GetCertHashString () == cert.GetCertHashString ()) - return cert.PrivateKey; - return null; - }; - ssl.ClientCertValidationDelegate = delegate (X509Certificate certificate, int[] certificateErrors) { - // FIXME: use X509CertificateValidator - return true; - }; - } - - protected override Context Context { - get { return ssl.context; } - } - - protected override RecordProtocol Protocol { - get { return ssl.protocol; } - } - - public void ProcessClientHello (byte [] raw) - { - Context.SupportedCiphers = CipherSuiteFactory.GetSupportedCiphers (Context.SecurityProtocol); - Context.HandshakeState = HandshakeState.Started; - - stream.Write (raw, 0, raw.Length); - stream.Seek (0, SeekOrigin.Begin); - - Protocol.ReceiveRecord (stream); - } - - // ServerHello, ServerCertificate and ServerHelloDone - public byte [] ProcessServerHello () - { - Context.SessionId = Context.GetSecureRandomBytes (32); - -#if false - // so, can I send handshake batch with RecordProtocol? - stream.SetLength (0); - Protocol.SendRecord (HandshakeType.ServerHello); - Protocol.SendRecord (HandshakeType.Certificate); - Protocol.SendRecord (HandshakeType.ServerHelloDone); - stream.Flush (); - return stream.ToArray (); - -#else - - MemoryStream ms = new MemoryStream (); - - WriteHandshake (ms); - - if (mutual) - WriteOperations (ms, - new TlsServerHello (ssl.context), - new TlsServerCertificate (ssl.context), - new TlsServerCertificateRequest (ssl.context), - new TlsServerHelloDone (ssl.context)); - else - WriteOperations (ms, - new TlsServerHello (ssl.context), - new TlsServerCertificate (ssl.context), - new TlsServerHelloDone (ssl.context)); - - return ms.ToArray (); -#endif - } - - public void ProcessClientKeyExchange (byte [] raw) - { - stream.SetLength (0); - stream.Write (raw, 0, raw.Length); - stream.Seek (0, SeekOrigin.Begin); - - if (mutual) - Protocol.ReceiveRecord (stream); // Certificate - Protocol.ReceiveRecord (stream); // ClientKeyExchange - Protocol.ReceiveRecord (stream); // ChangeCipherSpec - Protocol.ReceiveRecord (stream); // ClientFinished - - if (stream.Position != stream.Length) - throw new SecurityNegotiationException (String.Format ("Unexpected SSL negotiation binary: {0} bytes of excess in {1} bytes of the octets", stream.Length - stream.Position, stream.Length)); - } - - public byte [] ProcessServerFinished () - { - stream.SetLength (0); - Protocol.SendChangeCipherSpec (); -#if false - Protocol.SendRecord (HandshakeType.Finished); - stream.Flush (); - return stream.ToArray (); -#else - MemoryStream ms = new MemoryStream (); - WriteOperations (ms, new TlsServerFinished (ssl.context)); - ms.Flush (); - return ms.ToArray (); -#endif - } - - public byte [] ProcessApplicationData (byte [] raw) - { - stream.SetLength (0); - Protocol.SendRecord (ContentType.ApplicationData, raw); - stream.Flush (); - return stream.ToArray (); - } - } -} diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Security/ServiceCredentialsSecurityTokenManager.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Security/ServiceCredentialsSecurityTokenManager.cs index b747dee7c9..129b6b129e 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Security/ServiceCredentialsSecurityTokenManager.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Security/ServiceCredentialsSecurityTokenManager.cs @@ -94,30 +94,7 @@ namespace System.ServiceModel.Security new SecurityContextSecurityTokenAuthenticator (); return new SecureConversationSecurityTokenAuthenticator (tokenRequirement, sc, resolver); } - if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.AnonymousSslnego) - return CreateSslTokenAuthenticator (tokenRequirement); - if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.MutualSslnego) - return CreateSslTokenAuthenticator (tokenRequirement); - if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.Spnego) - return CreateSpnegoTokenAuthenticator (tokenRequirement); - else - throw new NotImplementedException ("Not implemented token type: " + tokenRequirement.TokenType); - } - - SpnegoSecurityTokenAuthenticator CreateSpnegoTokenAuthenticator (SecurityTokenRequirement requirement) - { - SpnegoSecurityTokenAuthenticator a = - new SpnegoSecurityTokenAuthenticator (this, requirement); - InitializeAuthenticatorCommunicationObject (a.Communication, requirement); - return a; - } - - SslSecurityTokenAuthenticator CreateSslTokenAuthenticator (SecurityTokenRequirement requirement) - { - SslSecurityTokenAuthenticator a = - new SslSecurityTokenAuthenticator (this, requirement); - InitializeAuthenticatorCommunicationObject (a.Communication, requirement); - return a; + throw new NotImplementedException ("Not implemented token type: " + tokenRequirement.TokenType); } UserNameSecurityTokenAuthenticator CreateUserNameAuthenticator (SecurityTokenRequirement requirement) diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources index 9863c8e1aa..a2834ac049 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources +++ b/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources @@ -52,8 +52,6 @@ Mono.CodeGeneration/CodeWhen.cs Mono.CodeGeneration/CodeWhile.cs Mono.CodeGeneration/CodeWriter.cs Mono.CodeGeneration/Exp.cs -Mono.Security.Cryptography/MD5SHA1.cs -Mono.Security.Cryptography/TlsHMAC.cs Mono.Security.Protocol.Ntlm/BitConverterLE.cs Mono.Security.Protocol.Ntlm/ChallengeResponse.cs Mono.Security.Protocol.Ntlm/MessageBase.cs @@ -63,64 +61,6 @@ Mono.Security.Protocol.Ntlm/NtlmVersion.cs Mono.Security.Protocol.Ntlm/Type1Message.cs Mono.Security.Protocol.Ntlm/Type2Message.cs Mono.Security.Protocol.Ntlm/Type3Message.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs -Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs -Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs -Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs -Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs -Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs -Mono.Security.Protocol.Tls/Alert.cs -Mono.Security.Protocol.Tls/CipherAlgorithmType.cs -Mono.Security.Protocol.Tls/CipherSuite.cs -Mono.Security.Protocol.Tls/CipherSuiteCollection.cs -Mono.Security.Protocol.Tls/CipherSuiteFactory.cs -Mono.Security.Protocol.Tls/ClientContext.cs -Mono.Security.Protocol.Tls/ClientRecordProtocol.cs -Mono.Security.Protocol.Tls/ClientSessionCache.cs -Mono.Security.Protocol.Tls/ContentType.cs -Mono.Security.Protocol.Tls/Context.cs -Mono.Security.Protocol.Tls/DebugHelper.cs -Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs -Mono.Security.Protocol.Tls/HandshakeState.cs -Mono.Security.Protocol.Tls/HashAlgorithmType.cs -Mono.Security.Protocol.Tls/HttpsClientStream.cs -Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs -Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs -Mono.Security.Protocol.Tls/RecordProtocol.cs -Mono.Security.Protocol.Tls/SecurityCompressionType.cs -Mono.Security.Protocol.Tls/SecurityParameters.cs -Mono.Security.Protocol.Tls/SecurityProtocolType.cs -Mono.Security.Protocol.Tls/ServerContext.cs -Mono.Security.Protocol.Tls/ServerRecordProtocol.cs -Mono.Security.Protocol.Tls/SslCipherSuite.cs -Mono.Security.Protocol.Tls/SslClientStream.cs -Mono.Security.Protocol.Tls/SslHandshakeHash.cs -Mono.Security.Protocol.Tls/SslServerStream.cs -Mono.Security.Protocol.Tls/SslStreamBase.cs -Mono.Security.Protocol.Tls/TlsCipherSuite.cs -Mono.Security.Protocol.Tls/TlsClientSettings.cs -Mono.Security.Protocol.Tls/TlsException.cs -Mono.Security.Protocol.Tls/TlsServerSettings.cs -Mono.Security.Protocol.Tls/TlsStream.cs Mono.Xml.XPath/DTMXPathDocument2.cs Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs Mono.Xml.XPath/DTMXPathDocumentWriter2.cs @@ -753,19 +693,13 @@ System.ServiceModel.Security.Tokens/SecurityTokenParameters.cs System.ServiceModel.Security.Tokens/SecurityTokenReferenceStyle.cs System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenRequirement.cs System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypes.cs -System.ServiceModel.Security.Tokens/SpnegoSecurityTokenAuthenticator.cs -System.ServiceModel.Security.Tokens/SpnegoSecurityTokenProvider.cs -System.ServiceModel.Security.Tokens/SslSecurityTokenAuthenticator.cs System.ServiceModel.Security.Tokens/SslSecurityTokenParameters.cs -System.ServiceModel.Security.Tokens/SslSecurityTokenProvider.cs System.ServiceModel.Security.Tokens/SslnegoCookieResolver.cs System.ServiceModel.Security.Tokens/SspiClientSecurityTokenAuthenticator.cs System.ServiceModel.Security.Tokens/SspiSecurityToken.cs System.ServiceModel.Security.Tokens/SspiSecurityTokenParameters.cs System.ServiceModel.Security.Tokens/SspiSession.cs System.ServiceModel.Security.Tokens/SupportingTokenParameters.cs -System.ServiceModel.Security.Tokens/TlsClientSession.cs -System.ServiceModel.Security.Tokens/TlsServerSession.cs System.ServiceModel.Security.Tokens/UserNameSecurityTokenParameters.cs System.ServiceModel.Security.Tokens/X509SecurityTokenParameters.cs System.ServiceModel.Security/BasicSecurityProfileVersion.cs diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ClientCredentialsSecurityTokenManager.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ClientCredentialsSecurityTokenManager.cs index c19ad84413..d77911b522 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ClientCredentialsSecurityTokenManager.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ClientCredentialsSecurityTokenManager.cs @@ -71,8 +71,6 @@ namespace System.ServiceModel return new RsaSecurityTokenAuthenticator (); else if (tokenRequirement.TokenType == SecurityTokenTypes.X509Certificate) return CreateX509Authenticator (tokenRequirement); - else if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.Spnego) - return new SspiClientSecurityTokenAuthenticator (this, tokenRequirement); else throw new NotImplementedException ("Security token type " + tokenRequirement.TokenType); @@ -114,16 +112,8 @@ namespace System.ServiceModel return CreateX509SecurityTokenProvider (tokenRequirement); else if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.SecureConversation) return CreateSecureConversationProvider (tokenRequirement); - else if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.AnonymousSslnego) { - if (tokenRequirement.TryGetProperty (ReqType.IsInitiatorProperty, out isInitiator) && isInitiator) - return CreateSslnegoProvider (tokenRequirement); - } else if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.MutualSslnego) { - if (tokenRequirement.TryGetProperty (ReqType.IsInitiatorProperty, out isInitiator) && isInitiator) - return CreateSslnegoProvider (tokenRequirement); - } else if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.SecurityContext) { + else if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.SecurityContext) { // FIXME: implement - } else if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.Spnego) { - return CreateSpnegoProvider (tokenRequirement); } else if (tokenRequirement.TokenType == ServiceModelSecurityTokenTypes.SspiCredential) { // FIXME: implement } else if (tokenRequirement.TokenType == SecurityTokenTypes.Rsa) { @@ -278,22 +268,6 @@ SecurityTokenRequirement requirement) return p; } - SecurityTokenProvider CreateSslnegoProvider (SecurityTokenRequirement r) - { - SslSecurityTokenProvider p = new SslSecurityTokenProvider (this, r.TokenType == ServiceModelSecurityTokenTypes.MutualSslnego); - InitializeProviderCommunicationObject (p.Communication, r); - - return p; - } - - SecurityTokenProvider CreateSpnegoProvider (SecurityTokenRequirement r) - { - SpnegoSecurityTokenProvider p = new SpnegoSecurityTokenProvider (this, r); - InitializeProviderCommunicationObject (p.Communication, r); - - return p; - } - IssuedSecurityTokenProvider CreateIssuedTokenProvider (SecurityTokenRequirement requirement) { IssuedSecurityTokenProvider p = diff --git a/mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources b/mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources index a2f154f29d..d19ab6a056 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources +++ b/mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources @@ -149,8 +149,6 @@ System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParametersTes System.ServiceModel.Security.Tokens/SecurityContextSecurityTokenTest.cs System.ServiceModel.Security.Tokens/SecurityTokenParametersTest.cs System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypesTest.cs -System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs System.ServiceModel.Security.Tokens/UserNameSecurityTokenParametersTest.cs System.ServiceModel.Security.Tokens/WrappedKeySecurityTokenTest.cs System.ServiceModel.Security.Tokens/X509ListedCertificateValidator.cs diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs deleted file mode 100644 index f68ada94cc..0000000000 --- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs +++ /dev/null @@ -1,280 +0,0 @@ -// -// SslSecurityTokenParametersTest.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2006 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -#if !MOBILE && !XAMMAC_4_5 -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Net; -using System.Net.Security; -using System.IdentityModel.Selectors; -using System.IdentityModel.Tokens; -using System.ServiceModel; -using System.ServiceModel.Channels; -using System.ServiceModel.Description; -using System.ServiceModel.Security; -using System.ServiceModel.Security.Tokens; -using System.Xml; -using NUnit.Framework; - -using ReqType = System.ServiceModel.Security.Tokens.ServiceModelSecurityTokenRequirement; - -namespace MonoTests.System.ServiceModel.Security.Tokens -{ - [TestFixture] - public class SslSecurityTokenParametersTest - { - class MyParameters : SslSecurityTokenParameters - { - public bool HasAsymmetricKeyEx { - get { return HasAsymmetricKey; } - } - - public bool SupportsClientAuthenticationEx { - get { return SupportsClientAuthentication; } - } - - public bool SupportsClientWindowsIdentityEx { - get { return SupportsClientWindowsIdentity; } - } - - public bool SupportsServerAuthenticationEx { - get { return SupportsServerAuthentication; } - } - - public SecurityKeyIdentifierClause CallCreateKeyIdentifierClause ( - SecurityToken token, SecurityTokenReferenceStyle referenceStyle) - { - return CreateKeyIdentifierClause (token, referenceStyle); - } - - public void InitRequirement (SecurityTokenRequirement requirement) - { - InitializeSecurityTokenRequirement (requirement); - } - } - - [Test] - public void DefaultValues () - { - MyParameters tp = new MyParameters (); - Assert.AreEqual (SecurityTokenInclusionMode.AlwaysToRecipient, tp.InclusionMode, "#1"); - Assert.AreEqual (SecurityTokenReferenceStyle.Internal, tp.ReferenceStyle, "#2"); - Assert.AreEqual (true, tp.RequireDerivedKeys, "#3"); - - Assert.AreEqual (false, tp.HasAsymmetricKeyEx, "#4"); - Assert.AreEqual (false, tp.SupportsClientAuthenticationEx, "#5"); - Assert.AreEqual (false, tp.SupportsClientWindowsIdentityEx, "#6"); - Assert.AreEqual (true, tp.SupportsServerAuthenticationEx, "#7"); - - Assert.AreEqual (false, tp.RequireCancellation, "#2-1"); - Assert.AreEqual (false, tp.RequireClientCertificate, "#2-2"); - } - - [Test] - public void InitializeSecurityTokenParameters () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - - Assert.AreEqual (ServiceModelSecurityTokenTypes.AnonymousSslnego, r.TokenType, "#1"); - Assert.AreEqual (false, r.Properties [ReqType.SupportSecurityContextCancellationProperty], "#2"); - SslSecurityTokenParameters dummy; - Assert.IsTrue (r.TryGetProperty (ReqType.IssuedSecurityTokenParametersProperty, out dummy), "#3"); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderNoTargetAddress () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - manager.CreateSecurityTokenProvider (r); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderNoSecurityBindingElement () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - manager.CreateSecurityTokenProvider (r); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderNoIssuerBindingContext () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - manager.CreateSecurityTokenProvider (r); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderNoMessageSecurityVersion () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (), - new BindingParameterCollection ()); - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - manager.CreateSecurityTokenProvider (r); - } - - [Test] - public void CreateProvider () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (), - new BindingParameterCollection ()); - r.MessageSecurityVersion = MessageSecurityVersion.Default.SecurityTokenVersion; - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - manager.CreateSecurityTokenProvider (r); - } - - [Test] - [Ignore ("This ends up to fail to connect. Anyways it's too implementation dependent.")] - public void CreateProviderGetToken () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (new HttpTransportBindingElement ()), - new BindingParameterCollection ()); - r.MessageSecurityVersion = MessageSecurityVersion.Default.SecurityTokenVersion; - // This is required at GetToken(). - r.SecurityAlgorithmSuite = SecurityAlgorithmSuite.Default; - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - // TLS negotiation token provider is created. - SecurityTokenProvider p = - manager.CreateSecurityTokenProvider (r); - - ((ICommunicationObject) p).Open (); - - p.GetToken (TimeSpan.FromSeconds (5)); - } - - [Test] - [ExpectedException (typeof (NotSupportedException))] - public void CreateRecipientProviderAnonymous () - { - CreateRecipientProviderCore (false); - } - - [Test] - [ExpectedException (typeof (NotSupportedException))] - public void CreateRecipientProviderMutual () - { - CreateRecipientProviderCore (true); - } - - void CreateRecipientProviderCore (bool mutual) - { - MyParameters tp = new MyParameters (); - tp.RequireClientCertificate = true; - RecipientServiceModelSecurityTokenRequirement r = - new RecipientServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.ListenUri = new Uri ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (), - new BindingParameterCollection ()); - r.MessageSecurityVersion = MessageSecurityVersion.Default.SecurityTokenVersion; - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - manager.CreateSecurityTokenProvider (r); - } - - [Test] - public void CreateKeyIdentifierClauseSCT () - { - MyParameters tp = new MyParameters (); - SecurityContextSecurityToken sct = - new SecurityContextSecurityToken (new UniqueId (), new byte [32], DateTime.MinValue, DateTime.MaxValue); - SecurityKeyIdentifierClause kic = - tp.CallCreateKeyIdentifierClause (sct, SecurityTokenReferenceStyle.Internal); - Assert.IsTrue (kic is LocalIdKeyIdentifierClause, "#1"); - SecurityContextKeyIdentifierClause scic = tp.CallCreateKeyIdentifierClause (sct, SecurityTokenReferenceStyle.External) - as SecurityContextKeyIdentifierClause; - Assert.IsNotNull (scic, "#2"); - Assert.IsNull (scic.Generation, "#3"); - } - } -} -#endif - diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs deleted file mode 100644 index 635104cfd4..0000000000 --- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs +++ /dev/null @@ -1,259 +0,0 @@ -// -// SspiSecurityTokenParametersTest.cs -// -// Author: -// Atsushi Enomoto -// -// Copyright (C) 2006 Novell, Inc. http://www.novell.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -#if !MOBILE && !XAMMAC_4_5 -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Net; -using System.Net.Security; -using System.IdentityModel.Selectors; -using System.IdentityModel.Tokens; -using System.ServiceModel; -using System.ServiceModel.Channels; -using System.ServiceModel.Description; -using System.ServiceModel.Security; -using System.ServiceModel.Security.Tokens; -using NUnit.Framework; - -using ReqType = System.ServiceModel.Security.Tokens.ServiceModelSecurityTokenRequirement; - -namespace MonoTests.System.ServiceModel.Security.Tokens -{ - [TestFixture] - public class SspiSecurityTokenParametersTest - { - class MyParameters : SspiSecurityTokenParameters - { - public bool HasAsymmetricKeyEx { - get { return HasAsymmetricKey; } - } - - public bool SupportsClientAuthenticationEx { - get { return SupportsClientAuthentication; } - } - - public bool SupportsClientWindowsIdentityEx { - get { return SupportsClientWindowsIdentity; } - } - - public bool SupportsServerAuthenticationEx { - get { return SupportsServerAuthentication; } - } - - public SecurityKeyIdentifierClause CallCreateKeyIdentifierClause ( - SecurityToken token, SecurityTokenReferenceStyle referenceStyle) - { - return CreateKeyIdentifierClause (token, referenceStyle); - } - - public void InitRequirement (SecurityTokenRequirement requirement) - { - InitializeSecurityTokenRequirement (requirement); - } - } - - [Test] - public void DefaultValues () - { - MyParameters tp = new MyParameters (); - Assert.AreEqual (SecurityTokenInclusionMode.AlwaysToRecipient, tp.InclusionMode, "#1"); - Assert.AreEqual (SecurityTokenReferenceStyle.Internal, tp.ReferenceStyle, "#2"); - Assert.AreEqual (true, tp.RequireDerivedKeys, "#3"); - - Assert.AreEqual (false, tp.HasAsymmetricKeyEx, "#4"); - Assert.AreEqual (true, tp.SupportsClientAuthenticationEx, "#5"); - Assert.AreEqual (true, tp.SupportsClientWindowsIdentityEx, "#6"); - Assert.AreEqual (true, tp.SupportsServerAuthenticationEx, "#7"); - - Assert.AreEqual (false, tp.RequireCancellation, "#2-1"); - } - - [Test] - public void InitializeSecurityTokenParameters () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - - Assert.AreEqual (ServiceModelSecurityTokenTypes.Spnego, r.TokenType, "#1"); - Assert.AreEqual (false, r.Properties [ReqType.SupportSecurityContextCancellationProperty], "#2"); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderNoTargetAddress () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - manager.CreateSecurityTokenProvider (r); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderNoSecurityBindingElement () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - manager.CreateSecurityTokenProvider (r); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderNoIssuerBindingContext () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - //SecurityTokenProvider p = - manager.CreateSecurityTokenProvider (r); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderNoMessageSecurityVersion () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (), - new BindingParameterCollection ()); - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - //SecurityTokenProvider p = - manager.CreateSecurityTokenProvider (r); - } - - [Test] - public void CreateProvider () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (), - new BindingParameterCollection ()); - r.MessageSecurityVersion = MessageSecurityVersion.Default.SecurityTokenVersion; - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - //SecurityTokenProvider p = - manager.CreateSecurityTokenProvider (r); - } - - void CreateProviderOpenGetToken (bool getToken) - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (new HttpTransportBindingElement ()), - new BindingParameterCollection ()); - r.MessageSecurityVersion = MessageSecurityVersion.Default.SecurityTokenVersion; - // This is required at GetToken(). - r.SecurityAlgorithmSuite = SecurityAlgorithmSuite.Default; - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - // TLS negotiation token provider is created. - SecurityTokenProvider p = - manager.CreateSecurityTokenProvider (r); - - ((ICommunicationObject) p).Open (); - - if (!getToken) - return; - - p.GetToken (TimeSpan.FromSeconds (5)); - } - - [Test] - public void CreateProviderOpen () - { - CreateProviderOpenGetToken (false); - } - - [Test] - [Ignore ("This ends up to fail to connect. Anyways it's too implementation dependent.")] - public void CreateProviderGetToken () - { - CreateProviderOpenGetToken (true); - } - - [Test] - public void CreateAuthenticator () - { - MyParameters tp = new MyParameters (); - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - tp.InitRequirement (r); - - ClientCredentials cred = new ClientCredentials (); - ClientCredentialsSecurityTokenManager manager = - new ClientCredentialsSecurityTokenManager (cred); - - SecurityTokenResolver resolver; -// SecurityTokenAuthenticator authenticator = - manager.CreateSecurityTokenAuthenticator (r, out resolver); - } - } -} -#endif diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs index e171357319..b599bd1dd3 100644 --- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs +++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs @@ -290,87 +290,6 @@ namespace MonoTests.System.ServiceModel.Security Assert.IsNotNull (p, "#1"); } - [Test] - [ExpectedException (typeof (NotSupportedException))] - public void CreateProviderAnonSslError () - { - RecipientServiceModelSecurityTokenRequirement r = - new RecipientServiceModelSecurityTokenRequirement (); - r.TokenType = ServiceModelSecurityTokenTypes.AnonymousSslnego; - r.ListenUri = new Uri ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (), new BindingParameterCollection ()); - r.MessageSecurityVersion = - MessageSecurityVersion.Default.SecurityTokenVersion; - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - } - - [Test] - [Ignore ("incomplete")] - [Category ("NotWorking")] - public void CreateProviderAnonSsl () - { - RecipientServiceModelSecurityTokenRequirement r = - new RecipientServiceModelSecurityTokenRequirement (); - new MySslSecurityTokenParameters ().InitRequirement (r); - - Assert.IsFalse (r.Properties.ContainsKey (ReqType.ChannelParametersCollectionProperty), "#1"); - Assert.IsFalse (r.Properties.ContainsKey (ReqType.EndpointFilterTableProperty), "#2"); - Assert.IsFalse (r.Properties.ContainsKey (ReqType.HttpAuthenticationSchemeProperty), "#3"); - Assert.IsFalse (r.Properties.ContainsKey (ReqType.IsOutOfBandTokenProperty), "#4"); - Assert.IsFalse (r.Properties.ContainsKey (ReqType.IssuerAddressProperty), "#5"); - Assert.IsFalse (r.Properties.ContainsKey (ReqType.MessageDirectionProperty), "#6"); - Assert.IsFalse (r.Properties.ContainsKey (ReqType.MessageSecurityVersionProperty), "#7"); - //Assert.IsTrue (r.Properties.ContainsKey (SecurityTokenRequirement.PeerAuthenticationMode), "#8"); - Assert.IsFalse (r.Properties.ContainsKey (ReqType.SecurityAlgorithmSuiteProperty), "#9"); - Assert.IsFalse (r.Properties.ContainsKey (ReqType.SecurityBindingElementProperty), "#10"); - Assert.IsFalse (r.Properties.ContainsKey (ReqType.SupportingTokenAttachmentModeProperty), "#11"); - Assert.AreEqual (null, r.TransportScheme, "#12"); - - r.TokenType = ServiceModelSecurityTokenTypes.AnonymousSslnego; - r.ListenUri = new Uri ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (), new BindingParameterCollection ()); - r.MessageSecurityVersion = - MessageSecurityVersion.Default.SecurityTokenVersion; - - r.Properties [ReqType.SecurityAlgorithmSuiteProperty] = - SecurityAlgorithmSuite.Default; - r.TransportScheme = "https"; - - r.Properties [ReqType.ChannelParametersCollectionProperty] = new ChannelParameterCollection (); - r.Properties [ReqType.EndpointFilterTableProperty] = null; - r.Properties [ReqType.HttpAuthenticationSchemeProperty] = AuthenticationSchemes.Anonymous; - r.Properties [ReqType.IsOutOfBandTokenProperty] = true; - r.Properties [ReqType.IssuerAddressProperty] = new EndpointAddress ("http://localhost:9090"); -// r.Properties [ReqType.MessageDirectionProperty] = MessageDirection.Input; - r.Properties [ReqType.SecurityBindingElementProperty] = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.SupportingTokenAttachmentModeProperty] = SecurityTokenAttachmentMode.Signed; - - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - } - - RecipientServiceModelSecurityTokenRequirement CreateAnonSslRequirement () - { - RecipientServiceModelSecurityTokenRequirement r = - new RecipientServiceModelSecurityTokenRequirement (); - MySslSecurityTokenParameters p = new MySslSecurityTokenParameters (); - p.InitRequirement (r); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (new X509SecurityTokenParameters ()); - r.Properties [ReqType.IssuedSecurityTokenParametersProperty] = p.Clone (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (new HttpTransportBindingElement ()), new BindingParameterCollection ()); - r.Properties [ReqType.MessageSecurityVersionProperty] = - MessageSecurityVersion.Default.SecurityTokenVersion; - return r; - } - RecipientServiceModelSecurityTokenRequirement CreateSecureConvRequirement () { RecipientServiceModelSecurityTokenRequirement r = @@ -396,107 +315,6 @@ namespace MonoTests.System.ServiceModel.Security return r; } - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateAuthenticatorAnonSslNoSecurityBindingElement () - { - RecipientServiceModelSecurityTokenRequirement r = - CreateAnonSslRequirement (); - r.SecurityBindingElement = null; - SecurityTokenResolver resolver; - def_c.CreateSecurityTokenAuthenticator (r, out resolver); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateAuthenticatorAnonSslNoIssuedSecurityTokenParameters () - { - RecipientServiceModelSecurityTokenRequirement r = - CreateAnonSslRequirement (); - r.Properties.Remove (ReqType.IssuedSecurityTokenParametersProperty); - SecurityTokenResolver resolver; - def_c.CreateSecurityTokenAuthenticator (r, out resolver); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateAuthenticatorAnonSslNoIssuerBindingContext () - { - RecipientServiceModelSecurityTokenRequirement r = - CreateAnonSslRequirement (); - r.Properties.Remove (ReqType.IssuerBindingContextProperty); - SecurityTokenResolver resolver; - def_c.CreateSecurityTokenAuthenticator (r, out resolver); - } - - [Test] - // The type of exception should not matter though. - [ExpectedException (typeof (NotSupportedException))] - [Category ("NotWorking")] - public void CreateAuthenticatorAnonSslNullMessageSecurityVersion () - { - RecipientServiceModelSecurityTokenRequirement r = - CreateAnonSslRequirement (); - r.MessageSecurityVersion = null; - SecurityTokenResolver resolver; - def_c.CreateSecurityTokenAuthenticator (r, out resolver); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateAuthenticatorAnonSslNoMessageSecurityVersion () - { - RecipientServiceModelSecurityTokenRequirement r = - CreateAnonSslRequirement (); - r.Properties.Remove (ReqType.MessageSecurityVersionProperty); - SecurityTokenResolver resolver; - def_c.CreateSecurityTokenAuthenticator (r, out resolver); - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - [Category ("NotWorking")] - public void CreateAuthenticatorAnonSslNoServiceCertificate () - { - RecipientServiceModelSecurityTokenRequirement r = - CreateAnonSslRequirement (); - SecurityTokenResolver resolver; - def_c.CreateSecurityTokenAuthenticator (r, out resolver); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateAuthenticatorAnonSslCertPublicOnly () - { - RecipientServiceModelSecurityTokenRequirement r = - CreateAnonSslRequirement (); - SecurityTokenResolver resolver; - def_c.ServiceCredentials.ServiceCertificate.Certificate = - new X509Certificate2 ("Test/Resources/test.cer"); - def_c.CreateSecurityTokenAuthenticator (r, out resolver); - } - - [Test] - [Category ("NotWorking")] - public void CreateAuthenticatorAnonSsl () - { - RecipientServiceModelSecurityTokenRequirement r = - CreateAnonSslRequirement (); - SecurityTokenResolver resolver; - X509Certificate2 cert = new X509Certificate2 ("Test/Resources/test.pfx", "mono"); - def_c.ServiceCredentials.ServiceCertificate.Certificate = cert; - SecurityTokenAuthenticator a = def_c.CreateSecurityTokenAuthenticator (r, out resolver); - // non-standard authenticator type. - Assert.IsNotNull (resolver, "#1"); - Assert.IsTrue (a is IIssuanceSecurityTokenAuthenticator, "#2"); - - try { - a.ValidateToken (new X509SecurityToken (cert)); - Assert.Fail ("It cannot validate raw X509SecurityToken"); - } catch (SecurityTokenValidationException) { - } - } - [Test] [ExpectedException (typeof (NotSupportedException))] public void CreateProviderSecureConv () diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs index 51a06265fe..db1b1f145a 100644 --- a/mcs/class/System.ServiceModel/Test/System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs +++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs @@ -229,204 +229,12 @@ namespace MonoTests.System.ServiceModel Assert.IsNotNull (p, "#1"); } - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderAnonSslNoTargetAddress () - { - SecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); -// r.TokenType = ServiceModelSecurityTokenTypes.AnonymousSslnego; - new MySslSecurityTokenParameters ().InitRequirement (r); - def_c.CreateSecurityTokenProvider (r); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderAnonSslNoBindingElement () - { - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - r.TokenType = ServiceModelSecurityTokenTypes.AnonymousSslnego; - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderAnonSslNoIssuerBindingContext () - { - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); -// r.TokenType = ServiceModelSecurityTokenTypes.AnonymousSslnego; - new MySslSecurityTokenParameters ().InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void CreateProviderAnonSslNoMessageSecurityVersion () - { - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); -// r.TokenType = ServiceModelSecurityTokenTypes.AnonymousSslnego; - new MySslSecurityTokenParameters ().InitRequirement (r); - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); - r.SecurityBindingElement = new SymmetricSecurityBindingElement (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (new CustomBinding (), new BindingParameterCollection ()); - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - } - EndpointAddress CreateEndpointAddress (string s, bool publicOnly) { return new EndpointAddress (new Uri (s), new X509CertificateEndpointIdentity (publicOnly ? certpub : cert)); } - InitiatorServiceModelSecurityTokenRequirement GetAnonSslProviderRequirement (bool useTransport) - { - return GetSslProviderRequirement (useTransport, false); - } - - InitiatorServiceModelSecurityTokenRequirement GetMutualSslProviderRequirement (bool useTransport) - { - return GetSslProviderRequirement (useTransport, true); - } - - InitiatorServiceModelSecurityTokenRequirement GetSslProviderRequirement (bool useTransport, bool mutual) - { - InitiatorServiceModelSecurityTokenRequirement r = - new InitiatorServiceModelSecurityTokenRequirement (); - new MySslSecurityTokenParameters (mutual).InitRequirement (r); -// r.TokenType = ServiceModelSecurityTokenTypes.AnonymousSslnego; - r.TargetAddress = new EndpointAddress ("http://localhost:8080"); -// r.TargetAddress = CreateEndpointAddress ("http://localhost:8080", true); - r.SecurityBindingElement = SecurityBindingElement.CreateUserNameForSslBindingElement (); - CustomBinding binding = - useTransport ? - new CustomBinding (new HandlerTransportBindingElement (null)) : - new CustomBinding (); - r.Properties [ReqType.IssuerBindingContextProperty] = - new BindingContext (binding, new BindingParameterCollection ()); - r.MessageSecurityVersion = - MessageSecurityVersion.Default.SecurityTokenVersion; - r.SecurityAlgorithmSuite = - SecurityAlgorithmSuite.Default; - -Assert.IsFalse (new MyManager (new MyClientCredentials ()).IsIssued (r), "premise"); - return r; - } - - [Test] - public void CreateProviderAnonSsl () - { - CreateProviderAnonSsl (false); - CreateProviderAnonSsl (true); - } - - public void CreateProviderAnonSsl (bool useTransport) - { - InitiatorServiceModelSecurityTokenRequirement r = - GetAnonSslProviderRequirement (useTransport); - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - - ICommunicationObject comm = p as ICommunicationObject; - Assert.IsNotNull (comm, "#2"); - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - [Category ("NotWorking")] - public void GetAnonSslProviderSecurityTokenNoTransport () - { - InitiatorServiceModelSecurityTokenRequirement r = - GetAnonSslProviderRequirement (false); - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - - ICommunicationObject comm = p as ICommunicationObject; - Assert.IsNotNull (comm, "#2"); - comm.Open (); - try { - p.GetToken (TimeSpan.FromSeconds (5)); - } finally { - comm.Close (); - } - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - public void GetAnonSslProviderSecurityTokenNoAlgorithmSuite () - { - InitiatorServiceModelSecurityTokenRequirement r = - GetAnonSslProviderRequirement (true); - r.Properties.Remove (ReqType.SecurityAlgorithmSuiteProperty); - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - - ICommunicationObject comm = p as ICommunicationObject; - Assert.IsNotNull (comm, "#2"); - comm.Open (); - try { - p.GetToken (TimeSpan.FromSeconds (5)); - } finally { - comm.Close (); - } - } - - [Test] - [Ignore ("it somehow causes NRE - smells .NET bug.")] - public void GetAnonSslProviderSecurityToken () - { - InitiatorServiceModelSecurityTokenRequirement r = - GetAnonSslProviderRequirement (true); - - // What causes NRE!? - def_c.ClientCredentials.ClientCertificate.Certificate = certpub; - r.Properties [ReqType.IssuedSecurityTokenParametersProperty] = - new X509SecurityTokenParameters (); - r.TargetAddress = CreateEndpointAddress ("http://localhost:8080", true); - r.IssuerAddress = CreateEndpointAddress ("http://localhost:8080", true); - r.IssuerBinding = new CustomBinding (new HandlerTransportBindingElement (null)); - def_c.ClientCredentials.ServiceCertificate.DefaultCertificate = certpub; - - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - - ICommunicationObject comm = p as ICommunicationObject; - Assert.IsNotNull (comm, "#2"); - comm.Open (); - try { - p.GetToken (TimeSpan.FromSeconds (5)); - } finally { - comm.Close (); - } - } - - [Test] - [ExpectedException (typeof (InvalidOperationException))] - public void CreateProviderMutualSslWithoutClientCert () - { - InitiatorServiceModelSecurityTokenRequirement r = - GetMutualSslProviderRequirement (true); - SecurityTokenProvider p = - def_c.CreateSecurityTokenProvider (r); - Assert.IsNotNull (p, "#1"); - } - [Test] [ExpectedException (typeof (ArgumentException))] public void CreateProviderSecureConvNoTargetAddress () diff --git a/mcs/class/System.ServiceModel/monodroid_System.ServiceModel_test.dll.exclude.sources b/mcs/class/System.ServiceModel/monodroid_System.ServiceModel_test.dll.exclude.sources new file mode 100644 index 0000000000..03d9e71105 --- /dev/null +++ b/mcs/class/System.ServiceModel/monodroid_System.ServiceModel_test.dll.exclude.sources @@ -0,0 +1,150 @@ +FeatureBased/Features.Contracts/AsyncCallTester.cs +FeatureBased/Features.Contracts/FaultsTester.cs +FeatureBased/Features.Serialization/AsyncCallTest.cs +FeatureBased/Features.Serialization/AsyncPatternTester.cs +FeatureBased/Features.Serialization/DataContractSerializerTest.cs +FeatureBased/Features.Serialization/DualContractTester.cs +FeatureBased/Features.Serialization/ExitProcessHelper.cs +FeatureBased/Features.Serialization/FaultsTest.cs +FeatureBased/Features.Serialization/KnownTypeTest.cs +FeatureBased/Features.Serialization/MessageContractTest.cs +FeatureBased/Features.Serialization/OperationContractTester.cs +FeatureBased/Features.Serialization/PrimitiveTesterTest.cs +FeatureBased/Features.Serialization/UntypedMessageTest.cs +FeatureBased/TestFixtureBase.cs +MetadataTests/BindingTestAssertions.cs +MetadataTests/ExportTests.cs +MetadataTests/ImportTests.cs +MetadataTests/ImportTests_CreateMetadata.cs +MetadataTests/ImportTests_LoadMetadata.cs +MetadataTests/ImportTests_RoundTrip.cs +MetadataTests/MetadataSamples.cs +MetadataTests/MiscImportTests.cs +MetadataTests/TestContext.cs +System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/BinaryMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/BindingElementTest.cs +System.ServiceModel.Channels/CalcSampleProxy.cs +System.ServiceModel.Channels/CommunicationObjectTest.cs +System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs +System.ServiceModel.Channels/CustomBindingTest.cs +System.ServiceModel.Channels/CustomPolicyConversionContext.cs +System.ServiceModel.Channels/HandlerTransportBindingElement.cs +System.ServiceModel.Channels/HttpTransportBindingElementTest.cs +System.ServiceModel.Channels/HttpsTransportBindingElementTest.cs +System.ServiceModel.Channels/InterceptorBindingElement.cs +System.ServiceModel.Channels/LocalClientSecuritySettingsTest.cs +System.ServiceModel.Channels/MessageBufferTest.cs +System.ServiceModel.Channels/MessageEncoderTest.cs +System.ServiceModel.Channels/MsmqBindingElementBaseTest.cs +System.ServiceModel.Channels/MsmqTransportBindingElementTest.cs +System.ServiceModel.Channels/NamedPipeTransportBindingElementTest.cs +System.ServiceModel.Channels/OneWayBindingElementTest.cs +System.ServiceModel.Channels/PeerTransportBindingElementTest.cs +System.ServiceModel.Channels/ReplyChannelBase.cs +System.ServiceModel.Channels/SecurityAssert.cs +System.ServiceModel.Channels/SecurityBindingElementTest.cs +System.ServiceModel.Channels/SslStreamSecurityBindingElementTest.cs +System.ServiceModel.Channels/SymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/TcpTransportBindingElementTest.cs +System.ServiceModel.Channels/TextMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/TransactionFlowBindingElementTest.cs +System.ServiceModel.Configuration/AddressHeaderCollectionElementTest.cs +System.ServiceModel.Configuration/BasicHttpBindingElementTest.cs +System.ServiceModel.Configuration/BehaviorsSectionTest.cs +System.ServiceModel.Configuration/BindingsSectionTest.cs +System.ServiceModel.Configuration/ChannelEndpointElementTest.cs +System.ServiceModel.Configuration/CustomBindingElementTest.cs +System.ServiceModel.Configuration/EndpointBehaviorElementTest.cs +System.ServiceModel.Configuration/ExtensionsSectionTest.cs +System.ServiceModel.Configuration/MetadataElementTest.cs +System.ServiceModel.Configuration/MexBindingElementTest.cs +System.ServiceModel.Configuration/NetNamedPipeBindingElementTest.cs +System.ServiceModel.Configuration/NetPeerTcpBindingElementTest.cs +System.ServiceModel.Configuration/NetTcpBindingElementTest.cs +System.ServiceModel.Configuration/ServiceBehaviorElementTest.cs +System.ServiceModel.Configuration/ServiceElementTest.cs +System.ServiceModel.Configuration/ServiceModelConfigurationElementCollectionTest.cs +System.ServiceModel.Configuration/ServiceModelSectionGroupTest.cs +System.ServiceModel.Configuration/StandardBindingCollectionElementTest.cs +System.ServiceModel.Configuration/StandardBindingElementCollectionTest.cs +System.ServiceModel.Configuration/StandardBindingElementTest.cs +System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs +System.ServiceModel.Configuration/UserBinding.cs +System.ServiceModel.Description/ClientCredentialsTest.cs +System.ServiceModel.Description/ContractDescriptionTest.cs +System.ServiceModel.Description/MetadataExchangeBindingsTest.cs +System.ServiceModel.Description/MetadataResolverTest.cs +System.ServiceModel.Description/MetadataSetTest.cs +System.ServiceModel.Description/ServiceAuthorizationBehaviorTest.cs +System.ServiceModel.Description/ServiceContractGeneratorTest.cs +System.ServiceModel.Description/ServiceCredentialsTest.cs +System.ServiceModel.Description/ServiceDebugBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataEndpointTest.cs +System.ServiceModel.Description/ServiceThrottlingBehaviorTest.cs +System.ServiceModel.Description/TypedMessageConverterTest.cs +System.ServiceModel.Description/WsdlExporterTest.cs +System.ServiceModel.Description/WsdlImporterTest.cs +System.ServiceModel.Dispatcher/ActionFilterTest.cs +System.ServiceModel.Dispatcher/Bug32886Test.cs +System.ServiceModel.Dispatcher/Bug46971Test.cs +System.ServiceModel.Dispatcher/Bug652331Test.cs +System.ServiceModel.Dispatcher/Bug652331_2Test.cs +System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs +System.ServiceModel.Dispatcher/DispatchOperationTest.cs +System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs +System.ServiceModel.Dispatcher/EndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/EndpointDispatcherTest.cs +System.ServiceModel.Dispatcher/ExceptionHandlerTest.cs +System.ServiceModel.Dispatcher/FilterTableTest.cs +System.ServiceModel.Dispatcher/InvalidBodyAccessExceptionTest.cs +System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/XPathMessageContextTest.cs +System.ServiceModel.PeerResolvers/CustomPeerResolverServiceTest.cs +System.ServiceModel.PeerResolvers/PeerResolverSerializationTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenProviderTest.cs +System.ServiceModel.Security.Tokens/RsaSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecurityContextSecurityTokenTest.cs +System.ServiceModel.Security.Tokens/SecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypesTest.cs +System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/UserNameSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/WrappedKeySecurityTokenTest.cs +System.ServiceModel.Security.Tokens/X509ListedCertificateValidator.cs +System.ServiceModel.Security.Tokens/X509SecurityTokenParametersTest.cs +System.ServiceModel.Security/ChannelProtectionRequirementsTest.cs +System.ServiceModel.Security/SecurityAlgorithmSuiteTest.cs +System.ServiceModel.Security/SecurityMessagePropertyTest.cs +System.ServiceModel.Security/SecurityTokenSpeficicationTest.cs +System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs +System.ServiceModel.Security/ServiceSecurityContextTest.cs +System.ServiceModel.Security/SupportingTokenParametersTest.cs +System.ServiceModel.Security/TransportSecurityBindingElementTest.cs +System.ServiceModel.Security/WSSecurityTokenSerializerTest.cs +System.ServiceModel/BasicHttpBindingTest.cs +System.ServiceModel/CallbackBehaviorAttributeTest.cs +System.ServiceModel/ChannelFactoryTest.cs +System.ServiceModel/ChannelFactory_1Test.cs +System.ServiceModel/ClientBaseTest.cs +System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs +System.ServiceModel/EndpointAddress10Test.cs +System.ServiceModel/EndpointAddressBuilderTest.cs +System.ServiceModel/EndpointAddressTest.cs +System.ServiceModel/EndpointIdentityTest.cs +System.ServiceModel/IntegratedConnectionTest.cs +System.ServiceModel/MessageSecurityVersionTest.cs +System.ServiceModel/MsmqTransportSecurityTest.cs +System.ServiceModel/NetMsmqBindingTest.cs +System.ServiceModel/NetPeerTcpBindingTest.cs +System.ServiceModel/NetTcpBindingTest.cs +System.ServiceModel/OperationContextTest.cs +System.ServiceModel/PeerNodeAddressTest.cs +System.ServiceModel/ServiceHostBaseTest.cs +System.ServiceModel/ServiceHostTest.cs +System.ServiceModel/TransactionProtocolTest.cs +System.ServiceModel/WSFederationHttpBindingTest.cs +System.ServiceModel/WSHttpBindingTest.cs diff --git a/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.exclude.sources b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.exclude.sources new file mode 100644 index 0000000000..4628790927 --- /dev/null +++ b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.exclude.sources @@ -0,0 +1,152 @@ +FeatureBased/Features.Contracts/AsyncCallTester.cs +FeatureBased/Features.Contracts/FaultsTester.cs +FeatureBased/Features.Serialization/AsyncCallTest.cs +FeatureBased/Features.Serialization/AsyncPatternTester.cs +FeatureBased/Features.Serialization/DataContractSerializerTest.cs +FeatureBased/Features.Serialization/DualContractTester.cs +FeatureBased/Features.Serialization/ExitProcessHelper.cs +FeatureBased/Features.Serialization/FaultsTest.cs +FeatureBased/Features.Serialization/KnownTypeTest.cs +FeatureBased/Features.Serialization/MessageContractTest.cs +FeatureBased/Features.Serialization/OperationContractTester.cs +FeatureBased/Features.Serialization/PrimitiveTesterTest.cs +FeatureBased/Features.Serialization/UntypedMessageTest.cs +FeatureBased/TestFixtureBase.cs +MetadataTests/BindingTestAssertions.cs +MetadataTests/ExportTests.cs +MetadataTests/ImportTests.cs +MetadataTests/ImportTests_CreateMetadata.cs +MetadataTests/ImportTests_LoadMetadata.cs +MetadataTests/ImportTests_RoundTrip.cs +MetadataTests/MetadataSamples.cs +MetadataTests/MiscImportTests.cs +MetadataTests/TestContext.cs +System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/BinaryMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/BindingElementTest.cs +System.ServiceModel.Channels/CalcSampleProxy.cs +System.ServiceModel.Channels/CommunicationObjectTest.cs +System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs +System.ServiceModel.Channels/CustomBindingTest.cs +System.ServiceModel.Channels/CustomPolicyConversionContext.cs +System.ServiceModel.Channels/HandlerTransportBindingElement.cs +System.ServiceModel.Channels/HttpTransportBindingElementTest.cs +System.ServiceModel.Channels/HttpsTransportBindingElementTest.cs +System.ServiceModel.Channels/InterceptorBindingElement.cs +System.ServiceModel.Channels/LocalClientSecuritySettingsTest.cs +System.ServiceModel.Channels/MessageBufferTest.cs +System.ServiceModel.Channels/MessageEncoderTest.cs +System.ServiceModel.Channels/MsmqBindingElementBaseTest.cs +System.ServiceModel.Channels/MsmqTransportBindingElementTest.cs +System.ServiceModel.Channels/NamedPipeTransportBindingElementTest.cs +System.ServiceModel.Channels/OneWayBindingElementTest.cs +System.ServiceModel.Channels/PeerTransportBindingElementTest.cs +System.ServiceModel.Channels/ReplyChannelBase.cs +System.ServiceModel.Channels/SecurityAssert.cs +System.ServiceModel.Channels/SecurityBindingElementTest.cs +System.ServiceModel.Channels/SslStreamSecurityBindingElementTest.cs +System.ServiceModel.Channels/SymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/TcpTransportBindingElementTest.cs +System.ServiceModel.Channels/TextMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/TransactionFlowBindingElementTest.cs +System.ServiceModel.Configuration/AddressHeaderCollectionElementTest.cs +System.ServiceModel.Configuration/BasicHttpBindingElementTest.cs +System.ServiceModel.Configuration/BehaviorsSectionTest.cs +System.ServiceModel.Configuration/BindingsSectionTest.cs +System.ServiceModel.Configuration/ChannelEndpointElementTest.cs +System.ServiceModel.Configuration/CustomBindingElementTest.cs +System.ServiceModel.Configuration/EndpointBehaviorElementTest.cs +System.ServiceModel.Configuration/ExtensionsSectionTest.cs +System.ServiceModel.Configuration/MetadataElementTest.cs +System.ServiceModel.Configuration/MexBindingElementTest.cs +System.ServiceModel.Configuration/NetNamedPipeBindingElementTest.cs +System.ServiceModel.Configuration/NetPeerTcpBindingElementTest.cs +System.ServiceModel.Configuration/NetTcpBindingElementTest.cs +System.ServiceModel.Configuration/ServiceBehaviorElementTest.cs +System.ServiceModel.Configuration/ServiceElementTest.cs +System.ServiceModel.Configuration/ServiceModelConfigurationElementCollectionTest.cs +System.ServiceModel.Configuration/ServiceModelSectionGroupTest.cs +System.ServiceModel.Configuration/StandardBindingCollectionElementTest.cs +System.ServiceModel.Configuration/StandardBindingElementCollectionTest.cs +System.ServiceModel.Configuration/StandardBindingElementTest.cs +System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs +System.ServiceModel.Configuration/UserBinding.cs +System.ServiceModel.Description/ClientCredentialsTest.cs +System.ServiceModel.Description/ContractDescriptionTest.cs +System.ServiceModel.Description/MetadataExchangeBindingsTest.cs +System.ServiceModel.Description/MetadataResolverTest.cs +System.ServiceModel.Description/MetadataSetTest.cs +System.ServiceModel.Description/ServiceAuthorizationBehaviorTest.cs +System.ServiceModel.Description/ServiceContractGeneratorTest.cs +System.ServiceModel.Description/ServiceCredentialsTest.cs +System.ServiceModel.Description/ServiceDebugBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataEndpointTest.cs +System.ServiceModel.Description/ServiceThrottlingBehaviorTest.cs +System.ServiceModel.Description/TypedMessageConverterTest.cs +System.ServiceModel.Description/WsdlExporterTest.cs +System.ServiceModel.Description/WsdlImporterTest.cs +System.ServiceModel.Dispatcher/ActionFilterTest.cs +System.ServiceModel.Dispatcher/Bug32886Test.cs +System.ServiceModel.Dispatcher/Bug46971Test.cs +System.ServiceModel.Dispatcher/Bug652331Test.cs +System.ServiceModel.Dispatcher/Bug652331_2Test.cs +System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs +System.ServiceModel.Dispatcher/DispatchOperationTest.cs +System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs +System.ServiceModel.Dispatcher/EndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/EndpointDispatcherTest.cs +System.ServiceModel.Dispatcher/ExceptionHandlerTest.cs +System.ServiceModel.Dispatcher/FilterTableTest.cs +System.ServiceModel.Dispatcher/InvalidBodyAccessExceptionTest.cs +System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/XPathMessageContextTest.cs +System.ServiceModel.PeerResolvers/CustomPeerResolverServiceTest.cs +System.ServiceModel.PeerResolvers/PeerResolverSerializationTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenProviderTest.cs +System.ServiceModel.Security.Tokens/RsaSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecurityContextSecurityTokenTest.cs +System.ServiceModel.Security.Tokens/SecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypesTest.cs +System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/UserNameSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/WrappedKeySecurityTokenTest.cs +System.ServiceModel.Security.Tokens/X509ListedCertificateValidator.cs +System.ServiceModel.Security.Tokens/X509SecurityTokenParametersTest.cs +System.ServiceModel.Security/ChannelProtectionRequirementsTest.cs +System.ServiceModel.Security/MessagePartSpecificationTest.cs +System.ServiceModel.Security/ScopedMessagePartSpecificationTest.cs +System.ServiceModel.Security/SecurityAlgorithmSuiteTest.cs +System.ServiceModel.Security/SecurityMessagePropertyTest.cs +System.ServiceModel.Security/SecurityTokenSpeficicationTest.cs +System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs +System.ServiceModel.Security/ServiceSecurityContextTest.cs +System.ServiceModel.Security/SupportingTokenParametersTest.cs +System.ServiceModel.Security/TransportSecurityBindingElementTest.cs +System.ServiceModel.Security/WSSecurityTokenSerializerTest.cs +System.ServiceModel/BasicHttpBindingTest.cs +System.ServiceModel/CallbackBehaviorAttributeTest.cs +System.ServiceModel/ChannelFactoryTest.cs +System.ServiceModel/ChannelFactory_1Test.cs +System.ServiceModel/ClientBaseTest.cs +System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs +System.ServiceModel/EndpointAddress10Test.cs +System.ServiceModel/EndpointAddressBuilderTest.cs +System.ServiceModel/EndpointAddressTest.cs +System.ServiceModel/EndpointIdentityTest.cs +System.ServiceModel/IntegratedConnectionTest.cs +System.ServiceModel/MessageSecurityVersionTest.cs +System.ServiceModel/MsmqTransportSecurityTest.cs +System.ServiceModel/NetMsmqBindingTest.cs +System.ServiceModel/NetPeerTcpBindingTest.cs +System.ServiceModel/NetTcpBindingTest.cs +System.ServiceModel/OperationContextTest.cs +System.ServiceModel/PeerNodeAddressTest.cs +System.ServiceModel/ServiceHostBaseTest.cs +System.ServiceModel/ServiceHostTest.cs +System.ServiceModel/TransactionProtocolTest.cs +System.ServiceModel/WSFederationHttpBindingTest.cs +System.ServiceModel/WSHttpBindingTest.cs diff --git a/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.sources b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.sources new file mode 100644 index 0000000000..275d9f3305 --- /dev/null +++ b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.sources @@ -0,0 +1 @@ +#include System.ServiceModel_test.dll.sources diff --git a/mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel_test.dll.exclude.sources b/mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel_test.dll.exclude.sources new file mode 100644 index 0000000000..4628790927 --- /dev/null +++ b/mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel_test.dll.exclude.sources @@ -0,0 +1,152 @@ +FeatureBased/Features.Contracts/AsyncCallTester.cs +FeatureBased/Features.Contracts/FaultsTester.cs +FeatureBased/Features.Serialization/AsyncCallTest.cs +FeatureBased/Features.Serialization/AsyncPatternTester.cs +FeatureBased/Features.Serialization/DataContractSerializerTest.cs +FeatureBased/Features.Serialization/DualContractTester.cs +FeatureBased/Features.Serialization/ExitProcessHelper.cs +FeatureBased/Features.Serialization/FaultsTest.cs +FeatureBased/Features.Serialization/KnownTypeTest.cs +FeatureBased/Features.Serialization/MessageContractTest.cs +FeatureBased/Features.Serialization/OperationContractTester.cs +FeatureBased/Features.Serialization/PrimitiveTesterTest.cs +FeatureBased/Features.Serialization/UntypedMessageTest.cs +FeatureBased/TestFixtureBase.cs +MetadataTests/BindingTestAssertions.cs +MetadataTests/ExportTests.cs +MetadataTests/ImportTests.cs +MetadataTests/ImportTests_CreateMetadata.cs +MetadataTests/ImportTests_LoadMetadata.cs +MetadataTests/ImportTests_RoundTrip.cs +MetadataTests/MetadataSamples.cs +MetadataTests/MiscImportTests.cs +MetadataTests/TestContext.cs +System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/BinaryMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/BindingElementTest.cs +System.ServiceModel.Channels/CalcSampleProxy.cs +System.ServiceModel.Channels/CommunicationObjectTest.cs +System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs +System.ServiceModel.Channels/CustomBindingTest.cs +System.ServiceModel.Channels/CustomPolicyConversionContext.cs +System.ServiceModel.Channels/HandlerTransportBindingElement.cs +System.ServiceModel.Channels/HttpTransportBindingElementTest.cs +System.ServiceModel.Channels/HttpsTransportBindingElementTest.cs +System.ServiceModel.Channels/InterceptorBindingElement.cs +System.ServiceModel.Channels/LocalClientSecuritySettingsTest.cs +System.ServiceModel.Channels/MessageBufferTest.cs +System.ServiceModel.Channels/MessageEncoderTest.cs +System.ServiceModel.Channels/MsmqBindingElementBaseTest.cs +System.ServiceModel.Channels/MsmqTransportBindingElementTest.cs +System.ServiceModel.Channels/NamedPipeTransportBindingElementTest.cs +System.ServiceModel.Channels/OneWayBindingElementTest.cs +System.ServiceModel.Channels/PeerTransportBindingElementTest.cs +System.ServiceModel.Channels/ReplyChannelBase.cs +System.ServiceModel.Channels/SecurityAssert.cs +System.ServiceModel.Channels/SecurityBindingElementTest.cs +System.ServiceModel.Channels/SslStreamSecurityBindingElementTest.cs +System.ServiceModel.Channels/SymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/TcpTransportBindingElementTest.cs +System.ServiceModel.Channels/TextMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/TransactionFlowBindingElementTest.cs +System.ServiceModel.Configuration/AddressHeaderCollectionElementTest.cs +System.ServiceModel.Configuration/BasicHttpBindingElementTest.cs +System.ServiceModel.Configuration/BehaviorsSectionTest.cs +System.ServiceModel.Configuration/BindingsSectionTest.cs +System.ServiceModel.Configuration/ChannelEndpointElementTest.cs +System.ServiceModel.Configuration/CustomBindingElementTest.cs +System.ServiceModel.Configuration/EndpointBehaviorElementTest.cs +System.ServiceModel.Configuration/ExtensionsSectionTest.cs +System.ServiceModel.Configuration/MetadataElementTest.cs +System.ServiceModel.Configuration/MexBindingElementTest.cs +System.ServiceModel.Configuration/NetNamedPipeBindingElementTest.cs +System.ServiceModel.Configuration/NetPeerTcpBindingElementTest.cs +System.ServiceModel.Configuration/NetTcpBindingElementTest.cs +System.ServiceModel.Configuration/ServiceBehaviorElementTest.cs +System.ServiceModel.Configuration/ServiceElementTest.cs +System.ServiceModel.Configuration/ServiceModelConfigurationElementCollectionTest.cs +System.ServiceModel.Configuration/ServiceModelSectionGroupTest.cs +System.ServiceModel.Configuration/StandardBindingCollectionElementTest.cs +System.ServiceModel.Configuration/StandardBindingElementCollectionTest.cs +System.ServiceModel.Configuration/StandardBindingElementTest.cs +System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs +System.ServiceModel.Configuration/UserBinding.cs +System.ServiceModel.Description/ClientCredentialsTest.cs +System.ServiceModel.Description/ContractDescriptionTest.cs +System.ServiceModel.Description/MetadataExchangeBindingsTest.cs +System.ServiceModel.Description/MetadataResolverTest.cs +System.ServiceModel.Description/MetadataSetTest.cs +System.ServiceModel.Description/ServiceAuthorizationBehaviorTest.cs +System.ServiceModel.Description/ServiceContractGeneratorTest.cs +System.ServiceModel.Description/ServiceCredentialsTest.cs +System.ServiceModel.Description/ServiceDebugBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataEndpointTest.cs +System.ServiceModel.Description/ServiceThrottlingBehaviorTest.cs +System.ServiceModel.Description/TypedMessageConverterTest.cs +System.ServiceModel.Description/WsdlExporterTest.cs +System.ServiceModel.Description/WsdlImporterTest.cs +System.ServiceModel.Dispatcher/ActionFilterTest.cs +System.ServiceModel.Dispatcher/Bug32886Test.cs +System.ServiceModel.Dispatcher/Bug46971Test.cs +System.ServiceModel.Dispatcher/Bug652331Test.cs +System.ServiceModel.Dispatcher/Bug652331_2Test.cs +System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs +System.ServiceModel.Dispatcher/DispatchOperationTest.cs +System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs +System.ServiceModel.Dispatcher/EndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/EndpointDispatcherTest.cs +System.ServiceModel.Dispatcher/ExceptionHandlerTest.cs +System.ServiceModel.Dispatcher/FilterTableTest.cs +System.ServiceModel.Dispatcher/InvalidBodyAccessExceptionTest.cs +System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/XPathMessageContextTest.cs +System.ServiceModel.PeerResolvers/CustomPeerResolverServiceTest.cs +System.ServiceModel.PeerResolvers/PeerResolverSerializationTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenProviderTest.cs +System.ServiceModel.Security.Tokens/RsaSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecurityContextSecurityTokenTest.cs +System.ServiceModel.Security.Tokens/SecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypesTest.cs +System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/UserNameSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/WrappedKeySecurityTokenTest.cs +System.ServiceModel.Security.Tokens/X509ListedCertificateValidator.cs +System.ServiceModel.Security.Tokens/X509SecurityTokenParametersTest.cs +System.ServiceModel.Security/ChannelProtectionRequirementsTest.cs +System.ServiceModel.Security/MessagePartSpecificationTest.cs +System.ServiceModel.Security/ScopedMessagePartSpecificationTest.cs +System.ServiceModel.Security/SecurityAlgorithmSuiteTest.cs +System.ServiceModel.Security/SecurityMessagePropertyTest.cs +System.ServiceModel.Security/SecurityTokenSpeficicationTest.cs +System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs +System.ServiceModel.Security/ServiceSecurityContextTest.cs +System.ServiceModel.Security/SupportingTokenParametersTest.cs +System.ServiceModel.Security/TransportSecurityBindingElementTest.cs +System.ServiceModel.Security/WSSecurityTokenSerializerTest.cs +System.ServiceModel/BasicHttpBindingTest.cs +System.ServiceModel/CallbackBehaviorAttributeTest.cs +System.ServiceModel/ChannelFactoryTest.cs +System.ServiceModel/ChannelFactory_1Test.cs +System.ServiceModel/ClientBaseTest.cs +System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs +System.ServiceModel/EndpointAddress10Test.cs +System.ServiceModel/EndpointAddressBuilderTest.cs +System.ServiceModel/EndpointAddressTest.cs +System.ServiceModel/EndpointIdentityTest.cs +System.ServiceModel/IntegratedConnectionTest.cs +System.ServiceModel/MessageSecurityVersionTest.cs +System.ServiceModel/MsmqTransportSecurityTest.cs +System.ServiceModel/NetMsmqBindingTest.cs +System.ServiceModel/NetPeerTcpBindingTest.cs +System.ServiceModel/NetTcpBindingTest.cs +System.ServiceModel/OperationContextTest.cs +System.ServiceModel/PeerNodeAddressTest.cs +System.ServiceModel/ServiceHostBaseTest.cs +System.ServiceModel/ServiceHostTest.cs +System.ServiceModel/TransactionProtocolTest.cs +System.ServiceModel/WSFederationHttpBindingTest.cs +System.ServiceModel/WSHttpBindingTest.cs diff --git a/mcs/class/System.Threading.Tasks.Dataflow/System.Threading.Tasks.Dataflow_xtest.dll.sources b/mcs/class/System.Threading.Tasks.Dataflow/System.Threading.Tasks.Dataflow_xtest.dll.sources new file mode 100644 index 0000000000..b2b77b17e1 --- /dev/null +++ b/mcs/class/System.Threading.Tasks.Dataflow/System.Threading.Tasks.Dataflow_xtest.dll.sources @@ -0,0 +1,3 @@ +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs +../../../external/corefx/src/Common/tests/System/Diagnostics/DebuggerAttributes.cs +../../../external/corefx/src/System.Threading.Tasks.Dataflow/tests/Dataflow/*.cs:EtwTests.cs,DataflowBlockExtensionTests.cs diff --git a/mcs/class/System.Web.Services/monodroid_System.Web.Services_test.dll.exclude.sources b/mcs/class/System.Web.Services/monodroid_System.Web.Services_test.dll.exclude.sources new file mode 100644 index 0000000000..54e315b498 --- /dev/null +++ b/mcs/class/System.Web.Services/monodroid_System.Web.Services_test.dll.exclude.sources @@ -0,0 +1,7 @@ +System.Web.Services.Configuration/DiagnosticsElementTest.cs +System.Web.Services.Configuration/ProtocolElementTest.cs +System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs +System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs +System.Web.Services.Configuration/TypeElementTest.cs +System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs +System.Web.Services.Configuration/WsiProfilesElementTest.cs diff --git a/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.exclude.sources b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.exclude.sources new file mode 100644 index 0000000000..0dee611d62 --- /dev/null +++ b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.exclude.sources @@ -0,0 +1,8 @@ +System.Web.Services.Configuration/DiagnosticsElementTest.cs +System.Web.Services.Configuration/ProtocolElementTest.cs +System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs +System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs +System.Web.Services.Configuration/TypeElementTest.cs +System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs +System.Web.Services.Configuration/WsiProfilesElementTest.cs +System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs diff --git a/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.sources b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.sources new file mode 100644 index 0000000000..915ba6cbbe --- /dev/null +++ b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.sources @@ -0,0 +1 @@ +#include System.Web.Services_test.dll.sources diff --git a/mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services_test.dll.exclude.sources b/mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services_test.dll.exclude.sources new file mode 100644 index 0000000000..0dee611d62 --- /dev/null +++ b/mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services_test.dll.exclude.sources @@ -0,0 +1,8 @@ +System.Web.Services.Configuration/DiagnosticsElementTest.cs +System.Web.Services.Configuration/ProtocolElementTest.cs +System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs +System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs +System.Web.Services.Configuration/TypeElementTest.cs +System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs +System.Web.Services.Configuration/WsiProfilesElementTest.cs +System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs diff --git a/mcs/class/System.Web/Makefile b/mcs/class/System.Web/Makefile index e8693e46d3..d71f7e957b 100644 --- a/mcs/class/System.Web/Makefile +++ b/mcs/class/System.Web/Makefile @@ -273,8 +273,6 @@ EXTRA_DISTFILES = \ $(shell find Test/standalone-tests/ -name "*.cs" -type f -printf "'%p' " -o -name "*.cs.in" -type f -printf "'%p' ") \ $(shell find Test/standalone/ -path '*/.svn' -prune -o -type f -printf "'%p' ") \ $(shell find Test/tools/ -path '*/.svn' -prune -o -type f -printf "'%p' ") \ - System.Web_standalone_test.dll.sources \ - standalone-runner-support.dll.sources \ $(shell find Test/System.Web.Caching/CacheItemPriorityQueueTestData/ -name "Sequence*.*" -type f -printf "'%p' ") \ ASPState.sql diff --git a/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs b/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs index ad72d9f44e..a20d7c72ed 100644 --- a/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs +++ b/mcs/class/System.Web/System.Web.Mail/SmtpClient.cs @@ -33,6 +33,7 @@ using System.IO; using System.Text; using System.Collections; using System.Net.Sockets; +using System.Net.Security; using System.Security.Permissions; using System.Reflection; @@ -68,27 +69,9 @@ namespace System.Web.Mail { void ChangeToSSLSocket () { - // Load Mono.Security.dll - Assembly a; - try { - a = Assembly.Load (Consts.AssemblyMono_Security); - } catch (System.IO.FileNotFoundException) { - throw new SmtpException ("Cannot load Mono.Security.dll"); - } - Type tSslClientStream = a.GetType ("Mono.Security.Protocol.Tls.SslClientStream"); - object[] consArgs = new object[4]; - consArgs[0] = smtp.Stream; - consArgs[1] = server; - consArgs[2] = true; - Type tSecurityProtocolType = a.GetType ("Mono.Security.Protocol.Tls.SecurityProtocolType"); - int nSsl3Val = (int) Enum.Parse (tSecurityProtocolType, "Ssl3"); - int nTlsVal = (int) Enum.Parse (tSecurityProtocolType, "Tls"); - consArgs[3] = Enum.ToObject (tSecurityProtocolType, nSsl3Val | nTlsVal); - - object objSslClientStream = Activator.CreateInstance (tSslClientStream, consArgs); - - if (objSslClientStream != null) - smtp = new SmtpStream ((Stream)objSslClientStream); + var sslStream = new SslStream (smtp.Stream); + sslStream.AuthenticateAsClient (server); + smtp = new SmtpStream (sslStream); } void ReadFields (MailMessageWrapper msg) diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs index 7feb1d471b..8967adf1f8 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridViewCell.cs @@ -170,7 +170,7 @@ namespace System.Windows.Forms { [Browsable (false)] public virtual Type FormattedValueType { - get { return null; } + get { return this.ValueType; } } [Browsable (false)] diff --git a/mcs/class/System.XML/Makefile b/mcs/class/System.XML/Makefile index 3031c13c3c..871bdae89e 100644 --- a/mcs/class/System.XML/Makefile +++ b/mcs/class/System.XML/Makefile @@ -7,6 +7,8 @@ LIBRARY = System.Xml.dll TXT_RESOURCE_STRINGS = \ ../referencesource/System.Xml/System.Xml.txt \ ../referencesource/System.Data.SqlXml/System.Xml.Utils.txt +RESX_RESOURCE_STRING = \ + ../../../external/corefx/src/System.Private.Xml/src/Resources/Strings.resx LIB_MCS_FLAGS = -nowarn:219,414,649,1717 -unsafe -d:ASYNC @@ -16,6 +18,7 @@ endif TEST_LIB_REFS = System.Data System.Core TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 +XTEST_LIB_REFS = System System.Core System.Xml System.Xml.Linq System.Drawing Facades/System.Threading.Tasks System.Runtime.Serialization Facades/System.Text.Encoding.CodePages LIBRARY_WARN_AS_ERROR = yes diff --git a/mcs/class/System.XML/ReferenceSources/LocalAppContextSwitches.cs b/mcs/class/System.XML/ReferenceSources/LocalAppContextSwitches.cs index ce9e157775..d7384c2d63 100644 --- a/mcs/class/System.XML/ReferenceSources/LocalAppContextSwitches.cs +++ b/mcs/class/System.XML/ReferenceSources/LocalAppContextSwitches.cs @@ -5,5 +5,7 @@ namespace System public static readonly bool DontThrowOnInvalidSurrogatePairs = false; public static readonly bool IgnoreKindInUtcTimeSerialization = false; public static readonly bool EnableTimeSpanSerialization = false; + public static readonly bool LimitXPathComplexity = false; + public static readonly bool AllowDefaultResolver = false; } } \ No newline at end of file diff --git a/mcs/class/System.XML/System.Xml.dll.sources b/mcs/class/System.XML/System.Xml.dll.sources index 19dfe3dd7d..74ec712ced 100644 --- a/mcs/class/System.XML/System.Xml.dll.sources +++ b/mcs/class/System.XML/System.Xml.dll.sources @@ -1,11 +1,4 @@ -Assembly/AssemblyInfo.cs -../../build/common/Consts.cs -../../build/common/SR.cs -../../build/common/AssemblyRef.cs -ReferenceSources/Res.cs -ReferenceSources/LocalAppContextSwitches.cs -ReferenceSources/ThisAssembly.cs -ReferenceSources/BinaryCompatibility.cs +#include common.sources ../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/GenerateHelper.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/IteratorDescriptor.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/OptimizerPatterns.cs @@ -19,74 +12,26 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/XmlIlTrace.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/XmlIlTypeHelper.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/XmlIlVisitor.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/ISourceLineInfo.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/ListBase.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Pair.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilBinary.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilChoice.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilCloneVisitor.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilDataSource.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilExpression.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilFactory.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilFunction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilInvoke.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilInvokeEarlyBound.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilInvokeLateBound.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilIterator.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilList.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilLiteral.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilLoop.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilName.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilNode.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilNodeType.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilParameter.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilPatternFactory.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilPatternVisitor.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilReference.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilReplaceVisitor.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilScopedVisitor.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilSortKey.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilStrConcat.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilTargetType.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilTernary.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilTypeChecker.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilUnary.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilValidationVisitor.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilVisitor.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilXmlReader.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/QilXmlWriter.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/SerializationHints.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/SubstitutionList.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QIL/WhitespaceRule.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QueryReaderSettings.cs +../../../external/corefx/src/System.Private.Xml/src/System/Xml/Xsl/QIL/*.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/ContentIterators.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/DecimalFormatter.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/DocumentOrderComparer.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/DodSequenceMerge.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/EarlyBoundInfo.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/NumberFormatter.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/RtfNavigator.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/SetIterators.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/SiblingIterators.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/StringConcat.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/TreeIterators.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/WhitespaceRuleLookup.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/WhitespaceRuleReader.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlAggregates.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlAttributeCache.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlCollation.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlExtensionFunction.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlILIndex.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlILStorageConverter.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlIterators.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlNavigatorFilter.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlNavigatorStack.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlQueryContext.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlQueryOutput.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlQueryRuntime.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlQuerySequence.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlQueryStaticData.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlRawWriterWrapper.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlSequenceWriter.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlSortKeyAccumulator.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlSortKey.cs @@ -94,105 +39,18 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XsltConvert.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XsltFunctions.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XsltLibrary.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/SourceLineInfo.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlILCommand.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlIlGenerator.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlNodeKindFlags.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQualifiedNameTest.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQueryCardinality.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQueryType.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQueryTypeFactory.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPathConvert.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/IXpathBuilder.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/IXPathEnvironment.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathAxis.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathBuilder.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathCompileException.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathContext.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathOperator.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathParser.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathQilFactory.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathScanner.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XslException.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/Compiler.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/CompilerScopeManager.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/Focus.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/IErrorHelper.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/InvokeGenerator.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/KeyMatchBuilder.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/Keywords.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/MatcherBuilder.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Action.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ActionFrame.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ApplyImportsAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ApplyTemplatesAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/AttributeAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/AttributeSetAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Avt.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/AvtEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/BeginEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/BuilderInfo.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CallTemplateAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ChooseAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CommentAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CompiledAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Compiler.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ContainerAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyAttributesAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyCodeAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyNamespacesAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyNodesetAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyOfAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/DbgCompiler.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/DocumentScope.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ElementAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/EndEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Event.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ForeachAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/HtmlProps.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/IfAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/InputScope.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/InputScopeManager.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/MessageAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NamespaceDecl.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NamespaceEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NavigatorInput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NavigatorOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NewInstructionAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NumberAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/OutKeywords.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/OutputScope.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/OutputScopeManager.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/PrefixQname.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ProcessingInstructionAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Processor.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ReaderOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/RecordBuilder.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/RecordOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/RootAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/SequentialOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/SortAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/StateMachine.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/StringOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Stylesheet.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TemplateAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TemplateBaseAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TemplateLookupAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Templatemanager.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextOnlyOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TheQuery.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/UseAttributesetsAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ValueOfAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/VariableAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/WithParamAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/WriterOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltCompileContext.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltDebugger.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltOutput.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/OutputScopeManager.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/QilGenerator.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/QilGeneratorEnv.cs @@ -209,281 +67,11 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/XsltQilFactory.cs ../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/XslVisitor.cs ../referencesource/System.Xml/InternalApis/NDP_Common/inc/Win8Helpers.cs -../referencesource/System.Xml/misc/HResults.cs -../referencesource/System.Xml/misc/InvariantComparer.cs -../referencesource/System.Xml/misc/PrivilegedConfigurationManager.cs -../referencesource/System.Xml/System/Xml/Assembly/System.Xml.Assembly.cs -../referencesource/System.Xml/System/Xml/AsyncHelper.cs -../referencesource/System.Xml/System/Xml/Base64Decoder.cs -../referencesource/System.Xml/System/Xml/Base64EncoderAsync.cs -../referencesource/System.Xml/System/Xml/Base64Encoder.cs -../referencesource/System.Xml/System/Xml/BinaryXml/BinXmltoken.cs -../referencesource/System.Xml/System/Xml/BinaryXml/SqlUtils.cs -../referencesource/System.Xml/System/Xml/BinaryXml/XmlBinaryReaderAsync.cs -../referencesource/System.Xml/System/Xml/BinaryXml/XmlBinaryReader.cs -../referencesource/System.Xml/System/Xml/BinHexDecoder.cs -../referencesource/System.Xml/System/Xml/BinHexEncoderAsync.cs -../referencesource/System.Xml/System/Xml/BinHexEncoder.cs -../referencesource/System.Xml/System/Xml/Bits.cs -../referencesource/System.Xml/System/Xml/BitStack.cs -../referencesource/System.Xml/System/Xml/ByteStack.cs -../referencesource/System.Xml/System/Xml/Cache/Shape.cs -../referencesource/System.Xml/System/Xml/Cache/ShapeGenerator.cs -../referencesource/System.Xml/System/Xml/Cache/XPathDocumentBuilder.cs -../referencesource/System.Xml/System/Xml/Cache/XPathDocumentIterator.cs -../referencesource/System.Xml/System/Xml/Cache/XPathDocumentNavigator.cs -../referencesource/System.Xml/System/Xml/Cache/XPathDocumentView.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNode.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNodeHelper.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNodeInfoAtom.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNodeView.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNodeViewPropertyDescriptor.cs -../referencesource/System.Xml/System/Xml/Core/CharEntityEncoderFallback.cs -../referencesource/System.Xml/System/Xml/Core/ConformanceLevel.cs -../referencesource/System.Xml/System/Xml/Core/DtdProcessing.cs -../referencesource/System.Xml/System/Xml/Core/EntityHandling.cs -../referencesource/System.Xml/System/Xml/Core/HtmlEncodedRawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/HtmlTernaryTree.cs -../referencesource/System.Xml/System/Xml/Core/HtmlUtf8RawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/IDtdInfo.cs -../referencesource/System.Xml/System/Xml/Core/IDtdParserAdapterAsync.cs -../referencesource/System.Xml/System/Xml/Core/IDtdParserAdapter.cs -../referencesource/System.Xml/System/Xml/Core/IDtdParserAsync.cs -../referencesource/System.Xml/System/Xml/Core/IDtdParser.cs -../referencesource/System.Xml/System/Xml/Core/IncrementalReadDecoders.cs -../referencesource/System.Xml/System/Xml/Core/IRemovableWriter.cs -../referencesource/System.Xml/System/Xml/Core/IValidationEventHandling.cs -../referencesource/System.Xml/System/Xml/Core/NamespaceHandling.cs -../referencesource/System.Xml/System/Xml/Core/NewLineHandling.cs -../referencesource/System.Xml/System/Xml/Core/QueryOutputWriter.cs -../referencesource/System.Xml/System/Xml/Core/QueryOutputWriterV1.cs -../referencesource/System.Xml/System/Xml/Core/ReadContentAsBinaryHelperAsync.cs -../referencesource/System.Xml/System/Xml/Core/ReadContentAsBinaryHelper.cs -../referencesource/System.Xml/System/Xml/Core/ReadOnlyTernaryTree.cs -../referencesource/System.Xml/System/Xml/Core/ReadState.cs -../referencesource/System.Xml/System/Xml/Core/SecureStringHasher.cs -../referencesource/System.Xml/System/Xml/Core/TextEncodedRawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/TextUtf8RawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/ValidatingReaderNodeData.cs -../referencesource/System.Xml/System/Xml/Core/ValidationType.cs -../referencesource/System.Xml/System/Xml/Core/WhitespaceHandling.cs -../referencesource/System.Xml/System/Xml/Core/XmlAsyncCheckReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlAsyncCheckWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlAutoDetectWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlConfiguration.cs -../referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlEventCache.cs -../referencesource/System.Xml/System/Xml/Core/XmlParserContext.cs -../referencesource/System.Xml/System/Xml/Core/XmlRawWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlRawWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlReaderSettings.cs -../referencesource/System.Xml/System/Xml/Core/XmlSpace.cs -../referencesource/System.Xml/System/Xml/Core/XmlSubtreeReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlSubtreeReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextEncoder.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImplAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImplHelpersAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImplHelpers.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlUtf8RawTextWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlUtf8RawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlValidatingReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlValidatingReaderImplAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlValidatingReaderImpl.cs -../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriterHelpersAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriterHelpers.cs -../referencesource/System.Xml/System/Xml/Core/XmlWrappingReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWrappingReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlWrappingWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWrappingWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlWriterSettings.cs -../referencesource/System.Xml/System/Xml/Core/XsdCachingReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XsdCachingReader.cs -../referencesource/System.Xml/System/Xml/Core/XsdValidatingReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XsdValidatingReader.cs -../referencesource/System.Xml/System/Xml/DiagnosticsSwitches.cs -../referencesource/System.Xml/System/Xml/Dom/DocumentSchemaValidator.cs -../referencesource/System.Xml/System/Xml/Dom/DocumentXmlWriter.cs -../referencesource/System.Xml/System/Xml/Dom/DocumentXPathNavigator.cs -../referencesource/System.Xml/System/Xml/Dom/DomNameTable.cs -../referencesource/System.Xml/System/Xml/Dom/XmlAttributeCollection.cs -../referencesource/System.Xml/System/Xml/Dom/XmlAttribute.cs -../referencesource/System.Xml/System/Xml/Dom/XmlCDataSection.cs -../referencesource/System.Xml/System/Xml/Dom/XmlCharacterData.cs -../referencesource/System.Xml/System/Xml/Dom/XmlChildEnumerator.cs -../referencesource/System.Xml/System/Xml/Dom/XmlChildNodes.cs -../referencesource/System.Xml/System/Xml/Dom/XmlComment.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDeclaration.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDocument.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDocumentFragment.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDocumentType.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDomTextWriter.cs -../referencesource/System.Xml/System/Xml/Dom/XmlElement.cs -../referencesource/System.Xml/System/Xml/Dom/XmlElementList.cs -../referencesource/System.Xml/System/Xml/Dom/XmlEntity.cs -../referencesource/System.Xml/System/Xml/Dom/XmlEntityReference.cs -../referencesource/System.Xml/System/Xml/Dom/XmlEventChangedAction.cs -../referencesource/System.Xml/System/Xml/Dom/XmlImplementation.cs -../referencesource/System.Xml/System/Xml/Dom/XmlLinkedNode.cs -../referencesource/System.Xml/System/Xml/Dom/XmlLoader.cs -../referencesource/System.Xml/System/Xml/Dom/XmlName.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNamedNodemap.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNamedNodeMap.SmallXmlNodeList.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNodeChangedEventArgs.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNodeChangedEventHandler.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNode.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNodeList.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNodeReader.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNotation.cs -../referencesource/System.Xml/System/Xml/Dom/XmlProcessingInstruction.cs -../referencesource/System.Xml/System/Xml/Dom/XmlSignificantWhiteSpace.cs -../referencesource/System.Xml/System/Xml/Dom/XmlText.cs -../referencesource/System.Xml/System/Xml/Dom/XmlUnspecifiedAttribute.cs -../referencesource/System.Xml/System/Xml/Dom/XmlWhitespace.cs -../referencesource/System.Xml/System/Xml/Dom/XPathNodeList.cs -../referencesource/System.Xml/System/Xml/EmptyEnumerator.cs -../referencesource/System.Xml/System/Xml/HWStack.cs -../referencesource/System.Xml/System/Xml/IApplicationResourceStreamResolver.cs -../referencesource/System.Xml/System/Xml/IHasXmlNode.cs -../referencesource/System.Xml/System/Xml/IXmlLineInfo.cs -../referencesource/System.Xml/System/Xml/IXmlNamespaceResolver.cs -../referencesource/System.Xml/System/Xml/LineInfo.cs -../referencesource/System.Xml/System/Xml/MTNameTable.cs -../referencesource/System.Xml/System/Xml/NameTable.cs -../referencesource/System.Xml/System/Xml/Ref.cs -../referencesource/System.Xml/System/Xml/Resolvers/XmlKnownDtds.cs -../referencesource/System.Xml/System/Xml/Resolvers/XmlPreloadedResolverAsync.cs -../referencesource/System.Xml/System/Xml/Resolvers/XmlPreloadedResolver.cs -../referencesource/System.Xml/System/Xml/Schema/Asttree.cs -../referencesource/System.Xml/System/Xml/Schema/AutoValidator.cs -../referencesource/System.Xml/System/Xml/Schema/BaseProcessor.cs -../referencesource/System.Xml/System/Xml/Schema/BaseValidator.cs -../referencesource/System.Xml/System/Xml/Schema/BitSet.cs -../referencesource/System.Xml/System/Xml/Schema/Chameleonkey.cs -../referencesource/System.Xml/System/Xml/Schema/CompiledidEntityConstraint.cs -../referencesource/System.Xml/System/Xml/Schema/ConstraintStruct.cs -../referencesource/System.Xml/System/Xml/Schema/ContentValidator.cs -../referencesource/System.Xml/System/Xml/Schema/DataTypeImplementation.cs -../referencesource/System.Xml/System/Xml/Schema/DtdParserAsync.cs -../referencesource/System.Xml/System/Xml/Schema/DtdParser.cs -../referencesource/System.Xml/System/Xml/Schema/DtdValidator.cs -../referencesource/System.Xml/System/Xml/Schema/FacetChecker.cs -../referencesource/System.Xml/System/Xml/Schema/Inference/Infer.cs -../referencesource/System.Xml/System/Xml/Schema/Inference/XmlSchemaInferenceException.cs -../referencesource/System.Xml/System/Xml/Schema/IXmlSchemaInfo.cs -../referencesource/System.Xml/System/Xml/Schema/NamespaceList.cs -../referencesource/System.Xml/System/Xml/Schema/ParserAsync.cs -../referencesource/System.Xml/System/Xml/Schema/Parser.cs -../referencesource/System.Xml/System/Xml/Schema/Preprocessor.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaAttDef.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaBuilder.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaCollectionCompiler.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaCollectionpreProcessor.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaDeclBase.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaElementDecl.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaEntity.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaInfo.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaNames.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaNamespacemanager.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaNotation.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaSetCompiler.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaType.cs -../referencesource/System.Xml/System/Xml/Schema/ValidationEventArgs.cs -../referencesource/System.Xml/System/Xml/Schema/ValidationEventHandler.cs -../referencesource/System.Xml/System/Xml/Schema/ValidationState.cs -../referencesource/System.Xml/System/Xml/Schema/XdrBuilder.cs -../referencesource/System.Xml/System/Xml/Schema/XdrValidator.cs -../referencesource/System.Xml/System/Xml/Schema/XmlAtomicValue.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAll.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAnnotated.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAnnotation.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAnyAttribute.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAny.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAppInfo.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAttribute.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAttributeGroup.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAttributeGroupref.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaChoice.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaCollection.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaCompilationSettings.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexContent.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexContentExtension.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexContentRestriction.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContent.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContentModel.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContentProcessing.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContentType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchema.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaDataType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaDerivationMethod.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaDocumentation.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaElement.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaException.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaExternal.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaFacet.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaForm.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaGroupBase.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaGroup.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaGroupRef.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaIdEntityConstraint.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaImport.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaInclude.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaInfo.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaNotation.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaObjectCollection.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaObject.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaObjectTable.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaParticle.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaRedefine.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSequence.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSet.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleContent.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleContentExtension.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleContentRestriction.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeContent.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeList.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeRestriction.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeUnion.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSubstitutionGroup.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaUse.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaValidationException.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaValidator.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaValidity.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSeverityType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlTokenizedType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlTypeCode.cs -../referencesource/System.Xml/System/Xml/Schema/XmlValueConverter.cs -../referencesource/System.Xml/System/Xml/Schema/XsdBuilder.cs -../referencesource/System.Xml/System/Xml/Schema/XsdDateTime.cs -../referencesource/System.Xml/System/Xml/Schema/XsdDuration.cs -../referencesource/System.Xml/System/Xml/Schema/XsdValidator.cs - -../referencesource/System.Xml/System/Xml/Serialization/_Events.cs ../referencesource/System.Xml/System/Xml/Serialization/AppSettings.cs ../referencesource/System.Xml/System/Xml/Serialization/CodeExporter.cs -../referencesource/System.Xml/System/Xml/Serialization/CodeGenerationoptions.cs ../referencesource/System.Xml/System/Xml/Serialization/CodeGenerator.cs -../referencesource/System.Xml/System/Xml/Serialization/CodeIdentifier.cs -../referencesource/System.Xml/System/Xml/Serialization/CodeIdentifiers.cs ../referencesource/System.Xml/System/Xml/Serialization/Compilation.cs ../referencesource/System.Xml/System/Xml/Serialization/Compiler.cs -../referencesource/System.Xml/System/Xml/Serialization/ImportContext.cs ../referencesource/System.Xml/System/Xml/Serialization/indentedWriter.cs ../referencesource/System.Xml/System/Xml/Serialization/IXmlSerializable.cs ../referencesource/System.Xml/System/Xml/Serialization/IXmlTextParser.cs @@ -492,7 +80,6 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/System.Xml/System/Xml/Serialization/NameTable.cs ../referencesource/System.Xml/System/Xml/Serialization/PrimitiveXmlSerializers.cs ../referencesource/System.Xml/System/Xml/Serialization/SchemaImporter.cs -../referencesource/System.Xml/System/Xml/Serialization/SchemaObjectWriter.cs ../referencesource/System.Xml/System/Xml/Serialization/SoapAttributeAttribute.cs ../referencesource/System.Xml/System/Xml/Serialization/SoapAttributeOverrides.cs ../referencesource/System.Xml/System/Xml/Serialization/SoapAttributes.cs @@ -537,7 +124,6 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSchemaExporter.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSchemaImporter.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSchemaProviderAttribute.cs -../referencesource/System.Xml/System/Xml/Serialization/XmlSchemas.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSerializationGeneratedCode.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSerializationILGen.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSerializationReader.cs @@ -547,14 +133,11 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSerializer.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSerializerAssemblyAttribute.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSerializerFactory.cs -../referencesource/System.Xml/System/Xml/Serialization/XmlSerializerNamespaces.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlSerializerVersionAttribute.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlTextAttribute.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlTypeAttribute.cs ../referencesource/System.Xml/System/Xml/Serialization/XmlTypeMapping.cs - ../referencesource/System.Xml/System/Xml/Serialization/Advanced/SchemaImporterExtension.cs - ../referencesource/System.Xml/System/Xml/Serialization/Configuration/ConfigurationStrings.cs ../referencesource/System.Xml/System/Xml/Serialization/Configuration/DateTimeSerializationSection.cs ../referencesource/System.Xml/System/Xml/Serialization/Configuration/SchemaImporterExtensionElement.cs @@ -562,111 +145,4 @@ ReferenceSources/BinaryCompatibility.cs ../referencesource/System.Xml/System/Xml/Serialization/Configuration/SchemaImporterExtensionsSection.cs ../referencesource/System.Xml/System/Xml/Serialization/Configuration/SerializationSectionGroup.cs ../referencesource/System.Xml/System/Xml/Serialization/Configuration/XmlSerializerSection.cs - -../referencesource/System.Xml/System/Xml/ValidateNames.cs -../referencesource/System.Xml/System/Xml/XmlCharType.cs -../referencesource/System.Xml/System/Xml/XmlComplianceUtil.cs -../referencesource/System.Xml/System/Xml/XmlConvert.cs -../referencesource/System.Xml/System/Xml/XmlDownloadManagerAsync.cs -../referencesource/System.Xml/System/Xml/XmlDownloadManager.cs -../referencesource/System.Xml/System/Xml/XmlEncoding.cs -../referencesource/System.Xml/System/Xml/XmlException.cs -../referencesource/System.Xml/System/Xml/XmlNamespacemanager.cs -../referencesource/System.Xml/System/Xml/XmlNamespaceScope.cs -../referencesource/System.Xml/System/Xml/XmlNameTable.cs -../referencesource/System.Xml/System/Xml/XmlNodeOrder.cs -../referencesource/System.Xml/System/Xml/XmlNodeType.cs -../referencesource/System.Xml/System/Xml/XmlNullResolver.cs -../referencesource/System.Xml/System/Xml/XmlQualifiedName.cs -../referencesource/System.Xml/System/Xml/XmlReservedNs.cs -../referencesource/System.Xml/System/Xml/XmlResolverAsync.cs -../referencesource/System.Xml/System/Xml/XmlResolver.cs -../referencesource/System.Xml/System/Xml/XmlSecureResolverAsync.cs -../referencesource/System.Xml/System/Xml/XmlSecureResolver.cs -../referencesource/System.Xml/System/Xml/XmlUrlResolverAsync.cs -../referencesource/System.Xml/System/Xml/XmlUrlResolver.cs -../referencesource/System.Xml/System/Xml/XmlXapResolver.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/AbsoluteQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/AstNode.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/AttributeQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Axis.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/BaseAxisQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/BooleanExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/BooleanFunctions.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/CacheAxisQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/CacheChildrenQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/CacheOutputQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ChildrenQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ClonableStack.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/CompiledXPathExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ContextQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/DescendantBaseQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/DescendantoverDescendantQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/DescendantQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/DocumentorderQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/EmptyQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ExtensionQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Filter.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/FilterQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/FollowingQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/FollowingSibling.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ForwardPositionQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Function.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/FunctionQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Group.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/GroupQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/IdQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/IteratorFilter.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/LogicalExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/MergeFilterQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/NamespaceQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/NodeFunctions.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/NumberFunctions.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/NumericExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Operand.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/OperandQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Operator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ParentQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/PrecedingQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/PrecedingSibling.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/QueryBuilder.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Query.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ResetableIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ReversePositionQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Root.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/SortQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/StringFunctions.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/UnionExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ValueQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Variable.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/VariableQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathAncestorIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathAncestorQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathArrayIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathAxisIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathChildIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathDescendantIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathEmptyIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathMultyIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathParser.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathScanner.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathSelectionIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathSelfQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathSingletonIterator.cs -../referencesource/System.Xml/System/Xml/XPath/IXPathNavigable.cs -../referencesource/System.Xml/System/Xml/XPath/XPathDocument.cs -../referencesource/System.Xml/System/Xml/XPath/XPathException.cs -../referencesource/System.Xml/System/Xml/XPath/XPathExpr.cs -../referencesource/System.Xml/System/Xml/XPath/XPathItem.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNamespaceScope.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNavigator.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNavigatorKeyComparer.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNavigatorReader.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNodeIterator.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNodeType.cs ../referencesource/System.Xml/System/Xml/Xslt/XslCompiledTransform.cs -../referencesource/System.Xml/System/Xml/Xslt/XsltArgumentList.cs -../referencesource/System.Xml/System/Xml/Xslt/XsltContext.cs -../referencesource/System.Xml/System/Xml/Xslt/XsltException.cs -../referencesource/System.Xml/System/Xml/Xslt/XslTransform.cs -../referencesource/System.Xml/System/Xml/Xslt/XsltSettings.cs diff --git a/mcs/class/System.XML/System.Xml_xtest.dll.sources b/mcs/class/System.XML/System.Xml_xtest.dll.sources new file mode 100644 index 0000000000..72a3d8e0e9 --- /dev/null +++ b/mcs/class/System.XML/System.Xml_xtest.dll.sources @@ -0,0 +1,20 @@ +#../../../external/corefx/src/System.Private.Xml/tests/XmlSerializer/XmlSerializerTests.cs +../../../external/corefx/src/Common/tests/System/Runtime/Serialization/Utils.cs +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs +../../../external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.cs + +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlAttributeCollectionTests/*.cs:InsertAfterTests.cs,SetNamedItemTests.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlAttributeTests/*.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlCharacterDataTests/*.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlDocumentTests/*.cs:LoadTests.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlElementTests/*.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlImplementationTests/*.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlNamedNodeMapTests/*.cs:SetNamedItemTests.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlNodeListTests/*.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlNodeTests/*.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlNodeTests/InsertTests/*.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlProcessingInstructionTests/*.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlDocument/XmlTextTests/*.cs +../../../external/corefx/src/Common/tests/System/ShouldNotBeInvokedException.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlWriter/*.cs:WriteWithEncoding.cs +../../../external/corefx/src/System.Private.Xml/tests/XmlReader/ReadContentAs/*.cs diff --git a/mcs/class/System.XML/common.sources b/mcs/class/System.XML/common.sources new file mode 100644 index 0000000000..5ef83ad942 --- /dev/null +++ b/mcs/class/System.XML/common.sources @@ -0,0 +1,409 @@ +Assembly/AssemblyInfo.cs +../../build/common/Consts.cs +../../build/common/SR.cs +../../build/common/AssemblyRef.cs +corefx/SR.cs +ReferenceSources/Res.cs +ReferenceSources/LocalAppContextSwitches.cs +ReferenceSources/ThisAssembly.cs +ReferenceSources/BinaryCompatibility.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/ISourceLineInfo.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/ListBase.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Pair.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/QueryReaderSettings.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/DecimalFormatter.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/DocumentOrderComparer.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/EarlyBoundInfo.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/NumberFormatter.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/RtfNavigator.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/StringConcat.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlAttributeCache.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlNavigatorStack.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlRawWriterWrapper.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/SourceLineInfo.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlNodeKindFlags.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQualifiedNameTest.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQueryCardinality.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQueryType.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQueryTypeFactory.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPathConvert.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/IXpathBuilder.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathAxis.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathCompileException.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathOperator.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathParser.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathScanner.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XslException.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/IErrorHelper.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/Keywords.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Action.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ActionFrame.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ApplyImportsAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ApplyTemplatesAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/AttributeAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/AttributeSetAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Avt.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/AvtEvent.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/BeginEvent.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/BuilderInfo.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CallTemplateAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ChooseAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CommentAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CompiledAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Compiler.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ContainerAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyAttributesAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyCodeAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyNamespacesAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyNodesetAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyOfAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/DbgCompiler.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/DocumentScope.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ElementAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/EndEvent.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Event.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ForeachAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/HtmlProps.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/IfAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/InputScope.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/InputScopeManager.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/MessageAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NamespaceDecl.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NamespaceEvent.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NavigatorInput.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NavigatorOutput.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NewInstructionAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NumberAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/OutKeywords.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/OutputScope.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/OutputScopeManager.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/PrefixQname.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ProcessingInstructionAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Processor.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ReaderOutput.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/RecordBuilder.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/RecordOutput.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/RootAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/SequentialOutput.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/SortAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/StateMachine.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/StringOutput.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Stylesheet.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TemplateAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TemplateBaseAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TemplateLookupAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Templatemanager.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextEvent.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextOnlyOutput.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextOutput.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TheQuery.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/UseAttributesetsAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ValueOfAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/VariableAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/WithParamAction.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/WriterOutput.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltCompileContext.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltDebugger.cs +../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltOutput.cs +../referencesource/System.Xml/misc/HResults.cs +../referencesource/System.Xml/misc/InvariantComparer.cs +../referencesource/System.Xml/misc/PrivilegedConfigurationManager.cs +../referencesource/System.Xml/System/Xml/Assembly/System.Xml.Assembly.cs +../referencesource/System.Xml/System/Xml/AsyncHelper.cs +../referencesource/System.Xml/System/Xml/Base64Decoder.cs +../referencesource/System.Xml/System/Xml/Base64EncoderAsync.cs +../referencesource/System.Xml/System/Xml/Base64Encoder.cs +../referencesource/System.Xml/System/Xml/BinaryXml/BinXmltoken.cs +../referencesource/System.Xml/System/Xml/BinaryXml/SqlUtils.cs +../referencesource/System.Xml/System/Xml/BinaryXml/XmlBinaryReaderAsync.cs +../referencesource/System.Xml/System/Xml/BinaryXml/XmlBinaryReader.cs +../referencesource/System.Xml/System/Xml/BinHexDecoder.cs +../referencesource/System.Xml/System/Xml/BinHexEncoderAsync.cs +../referencesource/System.Xml/System/Xml/BinHexEncoder.cs +../referencesource/System.Xml/System/Xml/Bits.cs +../referencesource/System.Xml/System/Xml/BitStack.cs +../referencesource/System.Xml/System/Xml/ByteStack.cs +../../../external/corefx/src/System.Private.Xml/src/System/Xml/Cache/*.cs +../referencesource/System.Xml/System/Xml/Core/CharEntityEncoderFallback.cs +../referencesource/System.Xml/System/Xml/Core/ConformanceLevel.cs +../referencesource/System.Xml/System/Xml/Core/DtdProcessing.cs +../referencesource/System.Xml/System/Xml/Core/EntityHandling.cs +../referencesource/System.Xml/System/Xml/Core/HtmlEncodedRawTextWriter.cs +../referencesource/System.Xml/System/Xml/Core/HtmlTernaryTree.cs +../referencesource/System.Xml/System/Xml/Core/HtmlUtf8RawTextWriter.cs +../referencesource/System.Xml/System/Xml/Core/IDtdInfo.cs +../referencesource/System.Xml/System/Xml/Core/IDtdParserAdapterAsync.cs +../referencesource/System.Xml/System/Xml/Core/IDtdParserAdapter.cs +../referencesource/System.Xml/System/Xml/Core/IDtdParserAsync.cs +../referencesource/System.Xml/System/Xml/Core/IDtdParser.cs +../referencesource/System.Xml/System/Xml/Core/IncrementalReadDecoders.cs +../referencesource/System.Xml/System/Xml/Core/IRemovableWriter.cs +../referencesource/System.Xml/System/Xml/Core/IValidationEventHandling.cs +../referencesource/System.Xml/System/Xml/Core/NamespaceHandling.cs +../referencesource/System.Xml/System/Xml/Core/NewLineHandling.cs +../referencesource/System.Xml/System/Xml/Core/QueryOutputWriter.cs +../referencesource/System.Xml/System/Xml/Core/QueryOutputWriterV1.cs +../referencesource/System.Xml/System/Xml/Core/ReadContentAsBinaryHelperAsync.cs +../referencesource/System.Xml/System/Xml/Core/ReadContentAsBinaryHelper.cs +../referencesource/System.Xml/System/Xml/Core/ReadOnlyTernaryTree.cs +../referencesource/System.Xml/System/Xml/Core/ReadState.cs +../referencesource/System.Xml/System/Xml/Core/SecureStringHasher.cs +../referencesource/System.Xml/System/Xml/Core/TextEncodedRawTextWriter.cs +../referencesource/System.Xml/System/Xml/Core/TextUtf8RawTextWriter.cs +../referencesource/System.Xml/System/Xml/Core/ValidatingReaderNodeData.cs +../referencesource/System.Xml/System/Xml/Core/ValidationType.cs +../referencesource/System.Xml/System/Xml/Core/WhitespaceHandling.cs +../referencesource/System.Xml/System/Xml/Core/XmlAsyncCheckReader.cs +../referencesource/System.Xml/System/Xml/Core/XmlAsyncCheckWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlAutoDetectWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingReaderAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingReader.cs +../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingWriterAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlConfiguration.cs +../referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriterAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlEventCache.cs +../referencesource/System.Xml/System/Xml/Core/XmlParserContext.cs +../referencesource/System.Xml/System/Xml/Core/XmlRawWriterAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlRawWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlReaderAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlReader.cs +../referencesource/System.Xml/System/Xml/Core/XmlReaderSettings.cs +../referencesource/System.Xml/System/Xml/Core/XmlSpace.cs +../referencesource/System.Xml/System/Xml/Core/XmlSubtreeReaderAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlSubtreeReader.cs +../referencesource/System.Xml/System/Xml/Core/XmlTextEncoder.cs +../referencesource/System.Xml/System/Xml/Core/XmlTextReader.cs +../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImplAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs +../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImplHelpersAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImplHelpers.cs +../referencesource/System.Xml/System/Xml/Core/XmlTextWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlUtf8RawTextWriterAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlUtf8RawTextWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlValidatingReader.cs +../referencesource/System.Xml/System/Xml/Core/XmlValidatingReaderImplAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlValidatingReaderImpl.cs +../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriterAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriterHelpersAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriterHelpers.cs +../referencesource/System.Xml/System/Xml/Core/XmlWrappingReaderAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlWrappingReader.cs +../referencesource/System.Xml/System/Xml/Core/XmlWrappingWriterAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlWrappingWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlWriterAsync.cs +../referencesource/System.Xml/System/Xml/Core/XmlWriter.cs +../referencesource/System.Xml/System/Xml/Core/XmlWriterSettings.cs +../referencesource/System.Xml/System/Xml/Core/XsdCachingReaderAsync.cs +../referencesource/System.Xml/System/Xml/Core/XsdCachingReader.cs +../referencesource/System.Xml/System/Xml/Core/XsdValidatingReaderAsync.cs +../referencesource/System.Xml/System/Xml/Core/XsdValidatingReader.cs +../referencesource/System.Xml/System/Xml/DiagnosticsSwitches.cs +../referencesource/System.Xml/System/Xml/Dom/DocumentSchemaValidator.cs +../referencesource/System.Xml/System/Xml/Dom/DocumentXmlWriter.cs +../referencesource/System.Xml/System/Xml/Dom/DocumentXPathNavigator.cs +../referencesource/System.Xml/System/Xml/Dom/DomNameTable.cs +../referencesource/System.Xml/System/Xml/Dom/XmlAttributeCollection.cs +../referencesource/System.Xml/System/Xml/Dom/XmlAttribute.cs +../referencesource/System.Xml/System/Xml/Dom/XmlCDataSection.cs +../referencesource/System.Xml/System/Xml/Dom/XmlCharacterData.cs +../referencesource/System.Xml/System/Xml/Dom/XmlChildEnumerator.cs +../referencesource/System.Xml/System/Xml/Dom/XmlChildNodes.cs +../referencesource/System.Xml/System/Xml/Dom/XmlComment.cs +../referencesource/System.Xml/System/Xml/Dom/XmlDeclaration.cs +../referencesource/System.Xml/System/Xml/Dom/XmlDocument.cs +../referencesource/System.Xml/System/Xml/Dom/XmlDocumentFragment.cs +../referencesource/System.Xml/System/Xml/Dom/XmlDocumentType.cs +../referencesource/System.Xml/System/Xml/Dom/XmlDomTextWriter.cs +../referencesource/System.Xml/System/Xml/Dom/XmlElement.cs +../referencesource/System.Xml/System/Xml/Dom/XmlElementList.cs +../referencesource/System.Xml/System/Xml/Dom/XmlEntity.cs +../referencesource/System.Xml/System/Xml/Dom/XmlEntityReference.cs +../referencesource/System.Xml/System/Xml/Dom/XmlEventChangedAction.cs +../referencesource/System.Xml/System/Xml/Dom/XmlImplementation.cs +../referencesource/System.Xml/System/Xml/Dom/XmlLinkedNode.cs +../referencesource/System.Xml/System/Xml/Dom/XmlLoader.cs +../referencesource/System.Xml/System/Xml/Dom/XmlName.cs +../referencesource/System.Xml/System/Xml/Dom/XmlNamedNodemap.cs +../referencesource/System.Xml/System/Xml/Dom/XmlNamedNodeMap.SmallXmlNodeList.cs +../referencesource/System.Xml/System/Xml/Dom/XmlNodeChangedEventArgs.cs +../referencesource/System.Xml/System/Xml/Dom/XmlNodeChangedEventHandler.cs +../referencesource/System.Xml/System/Xml/Dom/XmlNode.cs +../referencesource/System.Xml/System/Xml/Dom/XmlNodeList.cs +../referencesource/System.Xml/System/Xml/Dom/XmlNodeReader.cs +../referencesource/System.Xml/System/Xml/Dom/XmlNotation.cs +../referencesource/System.Xml/System/Xml/Dom/XmlProcessingInstruction.cs +../referencesource/System.Xml/System/Xml/Dom/XmlSignificantWhiteSpace.cs +../referencesource/System.Xml/System/Xml/Dom/XmlText.cs +../referencesource/System.Xml/System/Xml/Dom/XmlUnspecifiedAttribute.cs +../referencesource/System.Xml/System/Xml/Dom/XmlWhitespace.cs +../referencesource/System.Xml/System/Xml/Dom/XPathNodeList.cs +../referencesource/System.Xml/System/Xml/EmptyEnumerator.cs +../referencesource/System.Xml/System/Xml/HWStack.cs +../referencesource/System.Xml/System/Xml/IApplicationResourceStreamResolver.cs +../referencesource/System.Xml/System/Xml/IHasXmlNode.cs +../referencesource/System.Xml/System/Xml/IXmlLineInfo.cs +../referencesource/System.Xml/System/Xml/IXmlNamespaceResolver.cs +../referencesource/System.Xml/System/Xml/LineInfo.cs +../referencesource/System.Xml/System/Xml/MTNameTable.cs +../referencesource/System.Xml/System/Xml/NameTable.cs +../referencesource/System.Xml/System/Xml/Ref.cs +../../../external/corefx/src/System.Private.Xml/src/System/Xml/Resolvers/*.cs +../../../external/corefx/src/System.Private.Xml/src/System/Xml/Schema/Asttree.cs +../referencesource/System.Xml/System/Xml/Schema/AutoValidator.cs +../referencesource/System.Xml/System/Xml/Schema/BaseProcessor.cs +../referencesource/System.Xml/System/Xml/Schema/BaseValidator.cs +../referencesource/System.Xml/System/Xml/Schema/BitSet.cs +../referencesource/System.Xml/System/Xml/Schema/Chameleonkey.cs +../referencesource/System.Xml/System/Xml/Schema/CompiledidEntityConstraint.cs +../referencesource/System.Xml/System/Xml/Schema/ConstraintStruct.cs +../referencesource/System.Xml/System/Xml/Schema/ContentValidator.cs +../referencesource/System.Xml/System/Xml/Schema/DataTypeImplementation.cs +../referencesource/System.Xml/System/Xml/Schema/DtdParserAsync.cs +../referencesource/System.Xml/System/Xml/Schema/DtdParser.cs +../referencesource/System.Xml/System/Xml/Schema/DtdValidator.cs +../referencesource/System.Xml/System/Xml/Schema/FacetChecker.cs +../referencesource/System.Xml/System/Xml/Schema/Inference/Infer.cs +../referencesource/System.Xml/System/Xml/Schema/Inference/XmlSchemaInferenceException.cs +../referencesource/System.Xml/System/Xml/Schema/IXmlSchemaInfo.cs +../referencesource/System.Xml/System/Xml/Schema/NamespaceList.cs +../referencesource/System.Xml/System/Xml/Schema/ParserAsync.cs +../referencesource/System.Xml/System/Xml/Schema/Parser.cs +../referencesource/System.Xml/System/Xml/Schema/Preprocessor.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaAttDef.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaBuilder.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaCollectionCompiler.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaCollectionpreProcessor.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaDeclBase.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaElementDecl.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaEntity.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaInfo.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaNames.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaNamespacemanager.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaNotation.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaSetCompiler.cs +../referencesource/System.Xml/System/Xml/Schema/SchemaType.cs +../referencesource/System.Xml/System/Xml/Schema/ValidationEventArgs.cs +../referencesource/System.Xml/System/Xml/Schema/ValidationEventHandler.cs +../referencesource/System.Xml/System/Xml/Schema/ValidationState.cs +../referencesource/System.Xml/System/Xml/Schema/XdrBuilder.cs +../referencesource/System.Xml/System/Xml/Schema/XdrValidator.cs +../referencesource/System.Xml/System/Xml/Schema/XmlAtomicValue.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAll.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAnnotated.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAnnotation.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAnyAttribute.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAny.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAppInfo.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAttribute.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAttributeGroup.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAttributeGroupref.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaChoice.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaCollection.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaCompilationSettings.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexContent.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexContentExtension.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexContentRestriction.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexType.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContent.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContentModel.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContentProcessing.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContentType.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchema.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaDataType.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaDerivationMethod.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaDocumentation.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaElement.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaException.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaExternal.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaFacet.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaForm.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaGroupBase.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaGroup.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaGroupRef.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaIdEntityConstraint.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaImport.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaInclude.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaInfo.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaNotation.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaObjectCollection.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaObject.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaObjectTable.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaParticle.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaRedefine.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSequence.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSet.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleContent.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleContentExtension.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleContentRestriction.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeContent.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleType.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeList.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeRestriction.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeUnion.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSubstitutionGroup.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaType.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaUse.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaValidationException.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaValidator.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSchemaValidity.cs +../referencesource/System.Xml/System/Xml/Schema/XmlSeverityType.cs +../referencesource/System.Xml/System/Xml/Schema/XmlTokenizedType.cs +../referencesource/System.Xml/System/Xml/Schema/XmlTypeCode.cs +../referencesource/System.Xml/System/Xml/Schema/XmlValueConverter.cs +../referencesource/System.Xml/System/Xml/Schema/XsdBuilder.cs +../referencesource/System.Xml/System/Xml/Schema/XsdDateTime.cs +../referencesource/System.Xml/System/Xml/Schema/XsdDuration.cs +../referencesource/System.Xml/System/Xml/Schema/XsdValidator.cs +../referencesource/System.Xml/System/Xml/Serialization/_Events.cs +../referencesource/System.Xml/System/Xml/Serialization/CodeGenerationoptions.cs +../referencesource/System.Xml/System/Xml/Serialization/CodeIdentifier.cs +../referencesource/System.Xml/System/Xml/Serialization/CodeIdentifiers.cs +../referencesource/System.Xml/System/Xml/Serialization/ImportContext.cs +../referencesource/System.Xml/System/Xml/Serialization/SchemaObjectWriter.cs +../referencesource/System.Xml/System/Xml/Serialization/XmlSchemas.cs +../referencesource/System.Xml/System/Xml/Serialization/XmlSerializerNamespaces.cs +../referencesource/System.Xml/System/Xml/ValidateNames.cs +../referencesource/System.Xml/System/Xml/XmlCharType.cs +../referencesource/System.Xml/System/Xml/XmlComplianceUtil.cs +../referencesource/System.Xml/System/Xml/XmlConvert.cs +../referencesource/System.Xml/System/Xml/XmlDownloadManagerAsync.cs +../referencesource/System.Xml/System/Xml/XmlDownloadManager.cs +../referencesource/System.Xml/System/Xml/XmlEncoding.cs +../referencesource/System.Xml/System/Xml/XmlException.cs +../referencesource/System.Xml/System/Xml/XmlNamespacemanager.cs +../referencesource/System.Xml/System/Xml/XmlNamespaceScope.cs +../referencesource/System.Xml/System/Xml/XmlNameTable.cs +../referencesource/System.Xml/System/Xml/XmlNodeOrder.cs +../referencesource/System.Xml/System/Xml/XmlNodeType.cs +../referencesource/System.Xml/System/Xml/XmlNullResolver.cs +../referencesource/System.Xml/System/Xml/XmlQualifiedName.cs +../referencesource/System.Xml/System/Xml/XmlReservedNs.cs +../referencesource/System.Xml/System/Xml/XmlResolverAsync.cs +../referencesource/System.Xml/System/Xml/XmlResolver.cs +../referencesource/System.Xml/System/Xml/XmlSecureResolverAsync.cs +../referencesource/System.Xml/System/Xml/XmlSecureResolver.cs +../referencesource/System.Xml/System/Xml/XmlUrlResolverAsync.cs +../referencesource/System.Xml/System/Xml/XmlUrlResolver.cs +../referencesource/System.Xml/System/Xml/XmlXapResolver.cs +../../../external/corefx/src/System.Private.Xml/src/System/Xml/XPath/Internal/*.cs +../referencesource/System.Xml/System/Xml/XPath/IXPathNavigable.cs +../referencesource/System.Xml/System/Xml/XPath/XPathDocument.cs +../referencesource/System.Xml/System/Xml/XPath/XPathException.cs +../referencesource/System.Xml/System/Xml/XPath/XPathExpr.cs +../referencesource/System.Xml/System/Xml/XPath/XPathItem.cs +../referencesource/System.Xml/System/Xml/XPath/XPathNamespaceScope.cs +../referencesource/System.Xml/System/Xml/XPath/XPathNavigator.cs +../referencesource/System.Xml/System/Xml/XPath/XPathNavigatorKeyComparer.cs +../referencesource/System.Xml/System/Xml/XPath/XPathNavigatorReader.cs +../referencesource/System.Xml/System/Xml/XPath/XPathNodeIterator.cs +../referencesource/System.Xml/System/Xml/XPath/XPathNodeType.cs +../referencesource/System.Xml/System/Xml/Xslt/XsltArgumentList.cs +../referencesource/System.Xml/System/Xml/Xslt/XsltContext.cs +../referencesource/System.Xml/System/Xml/Xslt/XsltException.cs +../referencesource/System.Xml/System/Xml/Xslt/XslTransform.cs +../referencesource/System.Xml/System/Xml/Xslt/XsltSettings.cs diff --git a/mcs/class/System.XML/corefx/SR.cs.REMOVED.git-id b/mcs/class/System.XML/corefx/SR.cs.REMOVED.git-id new file mode 100644 index 0000000000..b13efc751e --- /dev/null +++ b/mcs/class/System.XML/corefx/SR.cs.REMOVED.git-id @@ -0,0 +1 @@ +e05fad0fa5f8985fe9e318e9deed7771e4809c77 \ No newline at end of file diff --git a/mcs/class/System.XML/mobile_System.Xml.dll.sources b/mcs/class/System.XML/mobile_System.Xml.dll.sources index dc961893ec..718bc9b447 100644 --- a/mcs/class/System.XML/mobile_System.Xml.dll.sources +++ b/mcs/class/System.XML/mobile_System.Xml.dll.sources @@ -1,495 +1,8 @@ -Assembly/AssemblyInfo.cs -../../build/common/Consts.cs +#include common.sources ../../build/common/MonoTODOAttribute.cs -../../build/common/SR.cs -../../build/common/AssemblyRef.cs -ReferenceSources/Res.cs -ReferenceSources/LocalAppContextSwitches.cs -ReferenceSources/ThisAssembly.cs ReferenceSources/TypeScope.cs ReferenceSources/Wsdl.cs ReferenceSources/CodeDom.cs -ReferenceSources/BinaryCompatibility.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/ISourceLineInfo.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/ListBase.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Pair.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/QueryReaderSettings.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/DecimalFormatter.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/DocumentOrderComparer.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/EarlyBoundInfo.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/NumberFormatter.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/RtfNavigator.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/StringConcat.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlAttributeCache.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlNavigatorStack.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XmlRawWriterWrapper.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/SourceLineInfo.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlNodeKindFlags.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQualifiedNameTest.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQueryCardinality.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQueryType.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XmlQueryTypeFactory.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPathConvert.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/IXpathBuilder.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathAxis.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathCompileException.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathOperator.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathParser.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XPath/XPathScanner.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XslException.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/IErrorHelper.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/Xslt/Keywords.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Action.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ActionFrame.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ApplyImportsAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ApplyTemplatesAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/AttributeAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/AttributeSetAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Avt.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/AvtEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/BeginEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/BuilderInfo.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CallTemplateAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ChooseAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CommentAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CompiledAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Compiler.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ContainerAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyAttributesAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyCodeAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyNamespacesAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyNodesetAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/CopyOfAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/DbgCompiler.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/DocumentScope.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ElementAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/EndEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Event.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ForeachAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/HtmlProps.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/IfAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/InputScope.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/InputScopeManager.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/MessageAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NamespaceDecl.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NamespaceEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NavigatorInput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NavigatorOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NewInstructionAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/NumberAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/OutKeywords.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/OutputScope.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/OutputScopeManager.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/PrefixQname.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ProcessingInstructionAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Processor.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ReaderOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/RecordBuilder.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/RecordOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/RootAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/SequentialOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/SortAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/StateMachine.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/StringOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Stylesheet.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TemplateAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TemplateBaseAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TemplateLookupAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Templatemanager.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextEvent.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextOnlyOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TextOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/TheQuery.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/UseAttributesetsAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/ValueOfAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/VariableAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/WithParamAction.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/WriterOutput.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltCompileContext.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltDebugger.cs -../referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltOutput.cs -../referencesource/System.Xml/misc/HResults.cs -../referencesource/System.Xml/misc/InvariantComparer.cs -../referencesource/System.Xml/misc/PrivilegedConfigurationManager.cs -../referencesource/System.Xml/System/Xml/Assembly/System.Xml.Assembly.cs -../referencesource/System.Xml/System/Xml/AsyncHelper.cs -../referencesource/System.Xml/System/Xml/Base64Decoder.cs -../referencesource/System.Xml/System/Xml/Base64EncoderAsync.cs -../referencesource/System.Xml/System/Xml/Base64Encoder.cs -../referencesource/System.Xml/System/Xml/BinaryXml/BinXmltoken.cs -../referencesource/System.Xml/System/Xml/BinaryXml/SqlUtils.cs -../referencesource/System.Xml/System/Xml/BinaryXml/XmlBinaryReaderAsync.cs -../referencesource/System.Xml/System/Xml/BinaryXml/XmlBinaryReader.cs -../referencesource/System.Xml/System/Xml/BinHexDecoder.cs -../referencesource/System.Xml/System/Xml/BinHexEncoderAsync.cs -../referencesource/System.Xml/System/Xml/BinHexEncoder.cs -../referencesource/System.Xml/System/Xml/Bits.cs -../referencesource/System.Xml/System/Xml/BitStack.cs -../referencesource/System.Xml/System/Xml/ByteStack.cs -../referencesource/System.Xml/System/Xml/Cache/Shape.cs -../referencesource/System.Xml/System/Xml/Cache/ShapeGenerator.cs -../referencesource/System.Xml/System/Xml/Cache/XPathDocumentBuilder.cs -../referencesource/System.Xml/System/Xml/Cache/XPathDocumentIterator.cs -../referencesource/System.Xml/System/Xml/Cache/XPathDocumentNavigator.cs -../referencesource/System.Xml/System/Xml/Cache/XPathDocumentView.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNode.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNodeHelper.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNodeInfoAtom.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNodeView.cs -../referencesource/System.Xml/System/Xml/Cache/XPathNodeViewPropertyDescriptor.cs -../referencesource/System.Xml/System/Xml/Core/CharEntityEncoderFallback.cs -../referencesource/System.Xml/System/Xml/Core/ConformanceLevel.cs -../referencesource/System.Xml/System/Xml/Core/DtdProcessing.cs -../referencesource/System.Xml/System/Xml/Core/EntityHandling.cs -../referencesource/System.Xml/System/Xml/Core/HtmlEncodedRawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/HtmlTernaryTree.cs -../referencesource/System.Xml/System/Xml/Core/HtmlUtf8RawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/IDtdInfo.cs -../referencesource/System.Xml/System/Xml/Core/IDtdParserAdapterAsync.cs -../referencesource/System.Xml/System/Xml/Core/IDtdParserAdapter.cs -../referencesource/System.Xml/System/Xml/Core/IDtdParserAsync.cs -../referencesource/System.Xml/System/Xml/Core/IDtdParser.cs -../referencesource/System.Xml/System/Xml/Core/IncrementalReadDecoders.cs -../referencesource/System.Xml/System/Xml/Core/IRemovableWriter.cs -../referencesource/System.Xml/System/Xml/Core/IValidationEventHandling.cs -../referencesource/System.Xml/System/Xml/Core/NamespaceHandling.cs -../referencesource/System.Xml/System/Xml/Core/NewLineHandling.cs -../referencesource/System.Xml/System/Xml/Core/QueryOutputWriter.cs -../referencesource/System.Xml/System/Xml/Core/QueryOutputWriterV1.cs -../referencesource/System.Xml/System/Xml/Core/ReadContentAsBinaryHelperAsync.cs -../referencesource/System.Xml/System/Xml/Core/ReadContentAsBinaryHelper.cs -../referencesource/System.Xml/System/Xml/Core/ReadOnlyTernaryTree.cs -../referencesource/System.Xml/System/Xml/Core/ReadState.cs -../referencesource/System.Xml/System/Xml/Core/SecureStringHasher.cs -../referencesource/System.Xml/System/Xml/Core/TextEncodedRawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/TextUtf8RawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/ValidatingReaderNodeData.cs -../referencesource/System.Xml/System/Xml/Core/ValidationType.cs -../referencesource/System.Xml/System/Xml/Core/WhitespaceHandling.cs -../referencesource/System.Xml/System/Xml/Core/XmlAsyncCheckReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlAsyncCheckWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlAutoDetectWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlCharCheckingWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlConfiguration.cs -../referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlEncodedRawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlEventCache.cs -../referencesource/System.Xml/System/Xml/Core/XmlParserContext.cs -../referencesource/System.Xml/System/Xml/Core/XmlRawWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlRawWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlReaderSettings.cs -../referencesource/System.Xml/System/Xml/Core/XmlSpace.cs -../referencesource/System.Xml/System/Xml/Core/XmlSubtreeReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlSubtreeReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextEncoder.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImplAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImpl.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImplHelpersAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextReaderImplHelpers.cs -../referencesource/System.Xml/System/Xml/Core/XmlTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlUtf8RawTextWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlUtf8RawTextWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlValidatingReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlValidatingReaderImplAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlValidatingReaderImpl.cs -../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriterHelpersAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWellFormedWriterHelpers.cs -../referencesource/System.Xml/System/Xml/Core/XmlWrappingReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWrappingReader.cs -../referencesource/System.Xml/System/Xml/Core/XmlWrappingWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWrappingWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlWriterAsync.cs -../referencesource/System.Xml/System/Xml/Core/XmlWriter.cs -../referencesource/System.Xml/System/Xml/Core/XmlWriterSettings.cs -../referencesource/System.Xml/System/Xml/Core/XsdCachingReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XsdCachingReader.cs -../referencesource/System.Xml/System/Xml/Core/XsdValidatingReaderAsync.cs -../referencesource/System.Xml/System/Xml/Core/XsdValidatingReader.cs -../referencesource/System.Xml/System/Xml/DiagnosticsSwitches.cs -../referencesource/System.Xml/System/Xml/Dom/DocumentSchemaValidator.cs -../referencesource/System.Xml/System/Xml/Dom/DocumentXmlWriter.cs -../referencesource/System.Xml/System/Xml/Dom/DocumentXPathNavigator.cs -../referencesource/System.Xml/System/Xml/Dom/DomNameTable.cs -../referencesource/System.Xml/System/Xml/Dom/XmlAttributeCollection.cs -../referencesource/System.Xml/System/Xml/Dom/XmlAttribute.cs -../referencesource/System.Xml/System/Xml/Dom/XmlCDataSection.cs -../referencesource/System.Xml/System/Xml/Dom/XmlCharacterData.cs -../referencesource/System.Xml/System/Xml/Dom/XmlChildEnumerator.cs -../referencesource/System.Xml/System/Xml/Dom/XmlChildNodes.cs -../referencesource/System.Xml/System/Xml/Dom/XmlComment.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDeclaration.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDocument.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDocumentFragment.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDocumentType.cs -../referencesource/System.Xml/System/Xml/Dom/XmlDomTextWriter.cs -../referencesource/System.Xml/System/Xml/Dom/XmlElement.cs -../referencesource/System.Xml/System/Xml/Dom/XmlElementList.cs -../referencesource/System.Xml/System/Xml/Dom/XmlEntity.cs -../referencesource/System.Xml/System/Xml/Dom/XmlEntityReference.cs -../referencesource/System.Xml/System/Xml/Dom/XmlEventChangedAction.cs -../referencesource/System.Xml/System/Xml/Dom/XmlImplementation.cs -../referencesource/System.Xml/System/Xml/Dom/XmlLinkedNode.cs -../referencesource/System.Xml/System/Xml/Dom/XmlLoader.cs -../referencesource/System.Xml/System/Xml/Dom/XmlName.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNamedNodemap.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNamedNodeMap.SmallXmlNodeList.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNodeChangedEventArgs.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNodeChangedEventHandler.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNode.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNodeList.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNodeReader.cs -../referencesource/System.Xml/System/Xml/Dom/XmlNotation.cs -../referencesource/System.Xml/System/Xml/Dom/XmlProcessingInstruction.cs -../referencesource/System.Xml/System/Xml/Dom/XmlSignificantWhiteSpace.cs -../referencesource/System.Xml/System/Xml/Dom/XmlText.cs -../referencesource/System.Xml/System/Xml/Dom/XmlUnspecifiedAttribute.cs -../referencesource/System.Xml/System/Xml/Dom/XmlWhitespace.cs -../referencesource/System.Xml/System/Xml/Dom/XPathNodeList.cs -../referencesource/System.Xml/System/Xml/EmptyEnumerator.cs -../referencesource/System.Xml/System/Xml/HWStack.cs -../referencesource/System.Xml/System/Xml/IApplicationResourceStreamResolver.cs -../referencesource/System.Xml/System/Xml/IHasXmlNode.cs -../referencesource/System.Xml/System/Xml/IXmlLineInfo.cs -../referencesource/System.Xml/System/Xml/IXmlNamespaceResolver.cs -../referencesource/System.Xml/System/Xml/LineInfo.cs -../referencesource/System.Xml/System/Xml/MTNameTable.cs -../referencesource/System.Xml/System/Xml/NameTable.cs -../referencesource/System.Xml/System/Xml/Ref.cs -../referencesource/System.Xml/System/Xml/Resolvers/XmlKnownDtds.cs -../referencesource/System.Xml/System/Xml/Resolvers/XmlPreloadedResolverAsync.cs -../referencesource/System.Xml/System/Xml/Resolvers/XmlPreloadedResolver.cs -../referencesource/System.Xml/System/Xml/Schema/Asttree.cs -../referencesource/System.Xml/System/Xml/Schema/AutoValidator.cs -../referencesource/System.Xml/System/Xml/Schema/BaseProcessor.cs -../referencesource/System.Xml/System/Xml/Schema/BaseValidator.cs -../referencesource/System.Xml/System/Xml/Schema/BitSet.cs -../referencesource/System.Xml/System/Xml/Schema/Chameleonkey.cs -../referencesource/System.Xml/System/Xml/Schema/CompiledidEntityConstraint.cs -../referencesource/System.Xml/System/Xml/Schema/ConstraintStruct.cs -../referencesource/System.Xml/System/Xml/Schema/ContentValidator.cs -../referencesource/System.Xml/System/Xml/Schema/DataTypeImplementation.cs -../referencesource/System.Xml/System/Xml/Schema/DtdParserAsync.cs -../referencesource/System.Xml/System/Xml/Schema/DtdParser.cs -../referencesource/System.Xml/System/Xml/Schema/DtdValidator.cs -../referencesource/System.Xml/System/Xml/Schema/FacetChecker.cs -../referencesource/System.Xml/System/Xml/Schema/Inference/Infer.cs -../referencesource/System.Xml/System/Xml/Schema/Inference/XmlSchemaInferenceException.cs -../referencesource/System.Xml/System/Xml/Schema/IXmlSchemaInfo.cs -../referencesource/System.Xml/System/Xml/Schema/NamespaceList.cs -../referencesource/System.Xml/System/Xml/Schema/ParserAsync.cs -../referencesource/System.Xml/System/Xml/Schema/Parser.cs -../referencesource/System.Xml/System/Xml/Schema/Preprocessor.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaAttDef.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaBuilder.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaCollectionCompiler.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaCollectionpreProcessor.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaDeclBase.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaElementDecl.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaEntity.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaInfo.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaNames.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaNamespacemanager.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaNotation.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaSetCompiler.cs -../referencesource/System.Xml/System/Xml/Schema/SchemaType.cs -../referencesource/System.Xml/System/Xml/Schema/ValidationEventArgs.cs -../referencesource/System.Xml/System/Xml/Schema/ValidationEventHandler.cs -../referencesource/System.Xml/System/Xml/Schema/ValidationState.cs -../referencesource/System.Xml/System/Xml/Schema/XdrBuilder.cs -../referencesource/System.Xml/System/Xml/Schema/XdrValidator.cs -../referencesource/System.Xml/System/Xml/Schema/XmlAtomicValue.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAll.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAnnotated.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAnnotation.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAnyAttribute.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAny.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAppInfo.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAttribute.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAttributeGroup.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaAttributeGroupref.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaChoice.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaCollection.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaCompilationSettings.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexContent.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexContentExtension.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexContentRestriction.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaComplexType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContent.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContentModel.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContentProcessing.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaContentType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchema.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaDataType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaDerivationMethod.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaDocumentation.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaElement.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaException.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaExternal.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaFacet.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaForm.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaGroupBase.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaGroup.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaGroupRef.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaIdEntityConstraint.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaImport.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaInclude.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaInfo.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaNotation.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaObjectCollection.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaObject.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaObjectTable.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaParticle.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaRedefine.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSequence.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSet.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleContent.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleContentExtension.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleContentRestriction.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeContent.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeList.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeRestriction.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSimpleTypeUnion.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaSubstitutionGroup.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaUse.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaValidationException.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaValidator.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSchemaValidity.cs -../referencesource/System.Xml/System/Xml/Schema/XmlSeverityType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlTokenizedType.cs -../referencesource/System.Xml/System/Xml/Schema/XmlTypeCode.cs -../referencesource/System.Xml/System/Xml/Schema/XmlValueConverter.cs -../referencesource/System.Xml/System/Xml/Schema/XsdBuilder.cs -../referencesource/System.Xml/System/Xml/Schema/XsdDateTime.cs -../referencesource/System.Xml/System/Xml/Schema/XsdDuration.cs -../referencesource/System.Xml/System/Xml/Schema/XsdValidator.cs - -../referencesource/System.Xml/System/Xml/Serialization/_Events.cs -../referencesource/System.Xml/System/Xml/Serialization/CodeGenerationoptions.cs -../referencesource/System.Xml/System/Xml/Serialization/CodeIdentifier.cs -../referencesource/System.Xml/System/Xml/Serialization/CodeIdentifiers.cs -../referencesource/System.Xml/System/Xml/Serialization/ImportContext.cs -../referencesource/System.Xml/System/Xml/Serialization/SchemaObjectWriter.cs -../referencesource/System.Xml/System/Xml/Serialization/XmlSchemas.cs -../referencesource/System.Xml/System/Xml/Serialization/XmlSerializerNamespaces.cs - -../referencesource/System.Xml/System/Xml/ValidateNames.cs -../referencesource/System.Xml/System/Xml/XmlCharType.cs -../referencesource/System.Xml/System/Xml/XmlComplianceUtil.cs -../referencesource/System.Xml/System/Xml/XmlConvert.cs -../referencesource/System.Xml/System/Xml/XmlDownloadManagerAsync.cs -../referencesource/System.Xml/System/Xml/XmlDownloadManager.cs -../referencesource/System.Xml/System/Xml/XmlEncoding.cs -../referencesource/System.Xml/System/Xml/XmlException.cs -../referencesource/System.Xml/System/Xml/XmlNamespacemanager.cs -../referencesource/System.Xml/System/Xml/XmlNamespaceScope.cs -../referencesource/System.Xml/System/Xml/XmlNameTable.cs -../referencesource/System.Xml/System/Xml/XmlNodeOrder.cs -../referencesource/System.Xml/System/Xml/XmlNodeType.cs -../referencesource/System.Xml/System/Xml/XmlNullResolver.cs -../referencesource/System.Xml/System/Xml/XmlQualifiedName.cs -../referencesource/System.Xml/System/Xml/XmlReservedNs.cs -../referencesource/System.Xml/System/Xml/XmlResolverAsync.cs -../referencesource/System.Xml/System/Xml/XmlResolver.cs -../referencesource/System.Xml/System/Xml/XmlSecureResolverAsync.cs -../referencesource/System.Xml/System/Xml/XmlSecureResolver.cs -../referencesource/System.Xml/System/Xml/XmlUrlResolverAsync.cs -../referencesource/System.Xml/System/Xml/XmlUrlResolver.cs -../referencesource/System.Xml/System/Xml/XmlXapResolver.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/AbsoluteQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/AstNode.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/AttributeQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Axis.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/BaseAxisQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/BooleanExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/BooleanFunctions.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/CacheAxisQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/CacheChildrenQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/CacheOutputQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ChildrenQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ClonableStack.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/CompiledXPathExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ContextQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/DescendantBaseQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/DescendantoverDescendantQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/DescendantQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/DocumentorderQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/EmptyQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ExtensionQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Filter.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/FilterQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/FollowingQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/FollowingSibling.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ForwardPositionQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Function.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/FunctionQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Group.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/GroupQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/IdQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/IteratorFilter.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/LogicalExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/MergeFilterQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/NamespaceQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/NodeFunctions.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/NumberFunctions.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/NumericExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Operand.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/OperandQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Operator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ParentQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/PrecedingQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/PrecedingSibling.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/QueryBuilder.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Query.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ResetableIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ReversePositionQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Root.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/SortQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/StringFunctions.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/UnionExpr.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/ValueQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/Variable.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/VariableQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathAncestorIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathAncestorQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathArrayIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathAxisIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathChildIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathDescendantIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathEmptyIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathMultyIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathParser.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathScanner.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathSelectionIterator.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathSelfQuery.cs -../referencesource/System.Xml/System/Xml/XPath/Internal/XPathSingletonIterator.cs -../referencesource/System.Xml/System/Xml/XPath/IXPathNavigable.cs -../referencesource/System.Xml/System/Xml/XPath/XPathDocument.cs -../referencesource/System.Xml/System/Xml/XPath/XPathException.cs -../referencesource/System.Xml/System/Xml/XPath/XPathExpr.cs -../referencesource/System.Xml/System/Xml/XPath/XPathItem.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNamespaceScope.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNavigator.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNavigatorKeyComparer.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNavigatorReader.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNodeIterator.cs -../referencesource/System.Xml/System/Xml/XPath/XPathNodeType.cs -../referencesource/System.Xml/System/Xml/Xslt/XsltArgumentList.cs -../referencesource/System.Xml/System/Xml/Xslt/XsltContext.cs -../referencesource/System.Xml/System/Xml/Xslt/XsltException.cs -../referencesource/System.Xml/System/Xml/Xslt/XslTransform.cs -../referencesource/System.Xml/System/Xml/Xslt/XsltSettings.cs System.Xml.Serialization/ImportContext.cs System.Xml.Serialization/IXmlSerializable.cs System.Xml.Serialization/IXmlTextParser.cs diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs index d1e4214fda..00af049209 100755 --- a/mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs +++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlLanguageTest.cs @@ -805,7 +805,11 @@ namespace MonoTests.System.Xaml Assert.IsNull (t.MarkupExtensionReturnType, "#29"); var l = t.GetAllMembers ().ToArray (); - Assert.AreEqual (0, l.Length, "#31"); + + if (underlyingType == typeof (decimal)) + Assert.AreEqual (6, l.Length, "#31"); //decimal has 6 internal properties (see Decimal.DecCalc.cs) + else + Assert.AreEqual (0, l.Length, "#31"); } void TestXamlTypeExtension (XamlType t, string name, Type underlyingType, Type extReturnType, bool noTypeConverter) diff --git a/mcs/class/System.Xml.Linq/System.Xml.Linq_xtest.dll.sources b/mcs/class/System.Xml.Linq/System.Xml.Linq_xtest.dll.sources new file mode 100644 index 0000000000..ea594c0e18 --- /dev/null +++ b/mcs/class/System.Xml.Linq/System.Xml.Linq_xtest.dll.sources @@ -0,0 +1,25 @@ +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs + +../../../external/corefx/src/Common/tests/System/Xml/ModuleCore/*.cs +../../../external/corefx/src/Common/tests/System/Xml/XmlCoreTest/*.cs +../../../external/corefx/src/Common/tests/System/Xml/XmlDiff/*.cs +../../../external/corefx/src/Common/src/System/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAssemblyAttribute.cs + +../../../external/corefx/src/Common/tests/System/IO/TempFile.cs + +../../../external/corefx/src/Common/tests/System/Xml/XPath/XmlDocument/CreateNavigatorFromXmlDocument.cs +../../../external/corefx/src/Common/tests/System/Xml/XPath/Common/*.cs + +../../../external/corefx/src/System.Private.Xml.Linq/tests/axes/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/events/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/misc/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/Properties/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/Schema/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/SDMSample/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/Streaming/*.cs:StreamingOutput.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/TreeManipulation/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/XDocument.Common/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/XDocument.Test.ModuleCore/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/xNodeBuilder/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/xNodeReader/*.cs +../../../external/corefx/src/System.Private.Xml.Linq/tests/XPath/XDocument/*.cs diff --git a/mcs/class/System/Assembly/AssemblyInfo.cs b/mcs/class/System/Assembly/AssemblyInfo.cs index 9b7145c113..8a5b95edf4 100644 --- a/mcs/class/System/Assembly/AssemblyInfo.cs +++ b/mcs/class/System/Assembly/AssemblyInfo.cs @@ -81,4 +81,4 @@ using System.Runtime.InteropServices; #if XAMMAC || XAMMAC_4_5 [assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -#endif \ No newline at end of file +#endif diff --git a/mcs/class/System/Internal.Cryptography/OidLookup.Managed.cs b/mcs/class/System/Internal.Cryptography/OidLookup.Managed.cs new file mode 100644 index 0000000000..92e334d333 --- /dev/null +++ b/mcs/class/System/Internal.Cryptography/OidLookup.Managed.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) 2018 Microsoft +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; + +namespace Internal.Cryptography +{ + /// + /// Fully managed implementation of OidLookup for the commonly supported Oids. + /// + internal static partial class OidLookup + { + private static bool ShouldUseCache(OidGroup oidGroup) + { + return true; + } + + private static string NativeOidToFriendlyName(string oid, OidGroup oidGroup, bool fallBackToAllGroups) + { + switch (oid) { + case "1.2.840.113549.1.7.1": return "PKCS 7 Data"; + case "1.2.840.113549.1.9.3": return "Content Type"; + case "1.2.840.113549.1.9.4": return "Message Digest"; + case "1.2.840.113549.1.9.5": return "Signing Time"; + case "1.2.840.113549.1.9.16.3.3": return "id-smime-alg-3DESwrap"; + case "2.5.29.14": return "Subject Key Identifier"; + case "2.5.29.15": return "Key Usage"; + case "2.5.29.17": return "Subject Alternative Name"; + case "2.5.29.19": return "Basic Constraints"; + case "2.5.29.37": return "Extended Key Usage"; + case "2.16.840.1.113730.1.1": return "Netscape Cert Type"; + } + return null; + } + + private static string NativeFriendlyNameToOid(string friendlyName, OidGroup oidGroup, bool fallBackToAllGroups) + { + switch (friendlyName) { + case "PKCS 7 Data": return "1.2.840.113549.1.7.1"; + case "Content Type": return "1.2.840.113549.1.9.3"; + case "Message Digest": return "1.2.840.113549.1.9.4"; + case "Signing Time": return "1.2.840.113549.1.9.5"; + case "id-smime-alg-3DESwrap": return "1.2.840.113549.1.9.16.3.3"; + case "Subject Key Identifier": return "2.5.29.14"; + case "Key Usage": return "2.5.29.15"; + case "Subject Alternative Name": return "2.5.29.17"; + case "Basic Constraints": return "2.5.29.19"; + case "Extended Key Usage": return "2.5.29.37"; + case "Netscape Cert Type": return "2.16.840.1.113730.1.1"; + }; + return null; + } + } +} diff --git a/mcs/class/System/Makefile b/mcs/class/System/Makefile index 799740c743..6e3bcebf7a 100644 --- a/mcs/class/System/Makefile +++ b/mcs/class/System/Makefile @@ -29,7 +29,8 @@ RESX_RESOURCE_STRING = \ ../../../external/corefx/src/System.Net.Http/src/Resources/Strings.resx \ ../../../external/corefx/src/System.Text.RegularExpressions/src/Resources/Strings.resx \ ../../../external/corefx/src/System.IO.FileSystem.Watcher/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.ComponentModel.TypeConverter/src/Resources/Strings.resx + ../../../external/corefx/src/System.ComponentModel.TypeConverter/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Security.Cryptography.Encoding/src/Resources/Strings.resx TEST_RESOURCES = \ Test/System/test-uri-props.txt \ @@ -110,7 +111,7 @@ endif TXT_RESOURCE_STRINGS = ../referencesource/System/System.txt -API_BIN_REFS := System.Net.Http System.Xml +API_BIN_REFS := System.Net.Http System.Xml System.Core ifndef MOBILE_PROFILE API_BIN_REFS += System.Configuration @@ -118,9 +119,6 @@ LIB_MCS_FLAGS += -d:CONFIGURATION_DEP endif EXTRA_DISTFILES = \ - common.sources \ - common_networking.sources \ - corefx.unix.sources \ Test/test-config-file \ Test/System.Security.Cryptography.X509Certificates/pkits/Makefile \ Test/System.Security.Cryptography.X509Certificates/pkits/README \ diff --git a/mcs/class/System/Mono.AppleTls/AppleCertificateHelper.cs b/mcs/class/System/Mono.AppleTls/AppleCertificateHelper.cs index 073f160800..18212bb54d 100644 --- a/mcs/class/System/Mono.AppleTls/AppleCertificateHelper.cs +++ b/mcs/class/System/Mono.AppleTls/AppleCertificateHelper.cs @@ -1,5 +1,4 @@ -#if SECURITY_DEP && MONO_FEATURE_APPLETLS -// +// // AppleCertificateHelper.cs // // Author: @@ -28,7 +27,7 @@ namespace Mono.AppleTls { static class AppleCertificateHelper { - public static SecIdentity GetIdentity (X509Certificate certificate) + public static SafeSecIdentityHandle GetIdentity (X509Certificate certificate) { /* * If we got an 'X509Certificate2', then we require it to have a private key @@ -36,11 +35,7 @@ namespace Mono.AppleTls */ var certificate2 = certificate as X509Certificate2; if (certificate2 != null) -#if MONOTOUCH - return SecIdentity.Import (certificate2); -#else - return SecImportExport.ItemImport (certificate2); -#endif + return MonoCertificatePal.ImportIdentity (certificate2); /* * Reading Certificates from the Mac Keychain @@ -87,32 +82,35 @@ namespace Mono.AppleTls */ #if MOBILE - using (var secCert = new SecCertificate (certificate)) { - return SecKeyChain.FindIdentity (secCert, true); - } + using (var secCert = MonoCertificatePal.FromOtherCertificate (certificate)) + return MonoCertificatePal.FindIdentity (secCert, true); #else - return null; + return new SafeSecIdentityHandle (); #endif } - public static SecIdentity GetIdentity (X509Certificate certificate, out SecCertificate[] intermediateCerts) + public static SafeSecIdentityHandle GetIdentity (X509Certificate certificate, out SafeSecCertificateHandle[] intermediateCerts) { var identity = GetIdentity (certificate); var impl2 = certificate.Impl as X509Certificate2Impl; if (impl2 == null || impl2.IntermediateCertificates == null) { - intermediateCerts = new SecCertificate [0]; + intermediateCerts = new SafeSecCertificateHandle [0]; return identity; } + intermediateCerts = new SafeSecCertificateHandle [impl2.IntermediateCertificates.Count]; + try { - intermediateCerts = new SecCertificate [impl2.IntermediateCertificates.Count]; for (int i = 0; i < intermediateCerts.Length; i++) - intermediateCerts [i] = new SecCertificate (impl2.IntermediateCertificates [i]); + intermediateCerts [i] = MonoCertificatePal.FromOtherCertificate (impl2.IntermediateCertificates[i]); return identity; } catch { - identity.Dispose (); + for (int i = 0; i < intermediateCerts.Length; i++) { + intermediateCerts [i]?.Dispose (); + } + identity?.Dispose (); throw; } } @@ -158,4 +156,3 @@ namespace Mono.AppleTls } } } -#endif diff --git a/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs b/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs index 1e35e003a5..b8855fbd69 100644 --- a/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs +++ b/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs @@ -1,4 +1,3 @@ -#if SECURITY_DEP && MONO_FEATURE_APPLETLS // // AppleTlsContext.cs // @@ -48,8 +47,8 @@ namespace Mono.AppleTls SslReadFunc readFunc; SslWriteFunc writeFunc; - SecIdentity serverIdentity; - SecIdentity clientIdentity; + SafeSecIdentityHandle serverIdentity; + SafeSecIdentityHandle clientIdentity; X509Certificate remoteCertificate; X509Certificate localClientCertificate; @@ -168,9 +167,9 @@ namespace Mono.AppleTls SetSessionOption (SslSessionOption.BreakOnServerAuth, true); if (IsServer) { - SecCertificate[] intermediateCerts; + SafeSecCertificateHandle[] intermediateCerts; serverIdentity = AppleCertificateHelper.GetIdentity (LocalServerCertificate, out intermediateCerts); - if (serverIdentity == null) + if (serverIdentity.IsInvalid) throw new SSA.AuthenticationException ("Unable to get server certificate from keychain."); SetCertificate (serverIdentity, intermediateCerts); @@ -225,9 +224,9 @@ namespace Mono.AppleTls if (localClientCertificate == null) return; clientIdentity = AppleCertificateHelper.GetIdentity (localClientCertificate); - if (clientIdentity == null) + if (clientIdentity.IsInvalid) throw new TlsException (AlertDescription.CertificateUnknown); - SetCertificate (clientIdentity, new SecCertificate [0]); + SetCertificate (clientIdentity, new SafeSecCertificateHandle [0]); } void EvaluateTrust () @@ -662,26 +661,21 @@ namespace Mono.AppleTls [DllImport (SecurityLibrary)] extern unsafe static /* OSStatus */ SslStatus SSLSetCertificate (/* SSLContextRef */ IntPtr context, /* CFArrayRef */ IntPtr certRefs); - CFArray Bundle (SecIdentity identity, IEnumerable certificates) + CFArray Bundle (SafeSecIdentityHandle identity, IList certificates) { - if (identity == null) - throw new ArgumentNullException ("identity"); - int i = 0; + if (identity == null || identity.IsInvalid) + throw new ArgumentNullException (nameof (identity)); + if (certificates == null) + throw new ArgumentNullException (nameof (certificates)); - int n = 0; - if (certificates != null) { - foreach (var obj in certificates) - n++; - } - - var ptrs = new IntPtr [n + 1]; - ptrs [0] = identity.Handle; - foreach (var certificate in certificates) - ptrs [++i] = certificate.Handle; + var ptrs = new IntPtr [certificates.Count + 1]; + ptrs [0] = identity.DangerousGetHandle (); + for (int i = 0; i < certificates.Count; i++) + ptrs [i + 1] = certificates [i].DangerousGetHandle (); return CFArray.CreateArray (ptrs); } - public void SetCertificate (SecIdentity identify, IEnumerable certificates) + void SetCertificate (SafeSecIdentityHandle identify, IList certificates) { using (var array = Bundle (identify, certificates)) { var result = SSLSetCertificate (Handle, array.Handle); @@ -1020,4 +1014,3 @@ namespace Mono.AppleTls } } } -#endif diff --git a/mcs/class/System/Mono.AppleTls/AppleTlsProvider.cs b/mcs/class/System/Mono.AppleTls/AppleTlsProvider.cs index 9582f6aceb..3ec4ded73b 100644 --- a/mcs/class/System/Mono.AppleTls/AppleTlsProvider.cs +++ b/mcs/class/System/Mono.AppleTls/AppleTlsProvider.cs @@ -1,5 +1,4 @@ -#if SECURITY_DEP && MONO_FEATURE_APPLETLS -// +// // AppleTlsProvider.cs // // Author: @@ -84,4 +83,3 @@ namespace Mono.AppleTls } } } -#endif diff --git a/mcs/class/System/Mono.AppleTls/AppleTlsStream.cs b/mcs/class/System/Mono.AppleTls/AppleTlsStream.cs index 23edbf9908..03c47f26dd 100644 --- a/mcs/class/System/Mono.AppleTls/AppleTlsStream.cs +++ b/mcs/class/System/Mono.AppleTls/AppleTlsStream.cs @@ -1,4 +1,3 @@ -#if SECURITY_DEP && MONO_FEATURE_APPLETLS // // AppleTlsStream.cs // @@ -43,4 +42,3 @@ namespace Mono.AppleTls } } } -#endif diff --git a/mcs/class/System/Mono.AppleTls/Certificate.cs b/mcs/class/System/Mono.AppleTls/Certificate.cs deleted file mode 100644 index 7463ef1aa3..0000000000 --- a/mcs/class/System/Mono.AppleTls/Certificate.cs +++ /dev/null @@ -1,450 +0,0 @@ -// -// Certificate.cs: Implements the managed SecCertificate wrapper. -// -// Authors: -// Miguel de Icaza -// Sebastien Pouliot -// -// Copyright 2010 Novell, Inc -// Copyright 2012-2013 Xamarin Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP && MONO_FEATURE_APPLETLS - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Security.Cryptography.X509Certificates; -using Mono.Net; - -using ObjCRuntimeInternal; - -namespace Mono.AppleTls { - - partial class SecCertificate : INativeObject, IDisposable { - internal IntPtr handle; - - internal SecCertificate (IntPtr handle, bool owns = false) - { - if (handle == IntPtr.Zero) - throw new Exception ("Invalid handle"); - - this.handle = handle; - if (!owns) - CFObject.CFRetain (handle); - } - - [DllImport (AppleTlsContext.SecurityLibrary, EntryPoint="SecCertificateGetTypeID")] - public extern static IntPtr GetTypeID (); - - [DllImport (AppleTlsContext.SecurityLibrary)] - extern static IntPtr SecCertificateCreateWithData (IntPtr allocator, IntPtr cfData); - - public SecCertificate (X509Certificate certificate) - { - if (certificate == null) - throw new ArgumentNullException ("certificate"); - - handle = certificate.Impl.GetNativeAppleCertificate (); - if (handle != IntPtr.Zero) { - CFObject.CFRetain (handle); - return; - } - - using (CFData cert = CFData.FromData (certificate.GetRawCertData ())) { - Initialize (cert); - } - } - - internal SecCertificate (X509CertificateImpl impl) - { - handle = impl.GetNativeAppleCertificate (); - if (handle != IntPtr.Zero) { - CFObject.CFRetain (handle); - return; - } - - using (CFData cert = CFData.FromData (impl.GetRawCertData ())) { - Initialize (cert); - } - } - - void Initialize (CFData data) - { - handle = SecCertificateCreateWithData (IntPtr.Zero, data.Handle); - if (handle == IntPtr.Zero) - throw new ArgumentException ("Not a valid DER-encoded X.509 certificate"); - } - - [DllImport (AppleTlsContext.SecurityLibrary)] - extern static IntPtr SecCertificateCopySubjectSummary (IntPtr cert); - - public string SubjectSummary { - get { - if (handle == IntPtr.Zero) - throw new ObjectDisposedException ("SecCertificate"); - - IntPtr subjectSummaryHandle = IntPtr.Zero; - try { - subjectSummaryHandle = SecCertificateCopySubjectSummary (handle); - CFString subjectSummary = CFString.AsString (subjectSummaryHandle); - return subjectSummary; - } - finally { - if (subjectSummaryHandle != IntPtr.Zero) - CFObject.CFRelease (subjectSummaryHandle); - } - } - } - - [DllImport (AppleTlsContext.SecurityLibrary)] - extern static /* CFDataRef */ IntPtr SecCertificateCopyData (/* SecCertificateRef */ IntPtr cert); - - public CFData DerData { - get { - if (handle == IntPtr.Zero) - throw new ObjectDisposedException ("SecCertificate"); - - IntPtr data = SecCertificateCopyData (handle); - if (data == IntPtr.Zero) - throw new ArgumentException ("Not a valid certificate"); - return new CFData (data, true); - } - } - - public X509Certificate ToX509Certificate () - { - if (handle == IntPtr.Zero) - throw new ObjectDisposedException ("SecCertificate"); - - return new X509Certificate (handle); - } - - internal static bool Equals (SecCertificate first, SecCertificate second) - { - /* - * This is a little bit expensive, but unfortunately there is no better API to compare two - * SecCertificateRef's for equality. - */ - if (first == null) - throw new ArgumentNullException ("first"); - if (second == null) - throw new ArgumentNullException ("second"); - if (first.Handle == second.Handle) - return true; - - using (var firstData = first.DerData) - using (var secondData = second.DerData) { - if (firstData.Handle == secondData.Handle) - return true; - - if (firstData.Length != secondData.Length) - return false; - IntPtr length = (IntPtr)firstData.Length; - for (long i = 0; i < (long)length; i++) { - if (firstData [i] != secondData [i]) - return false; - } - - return true; - } - } - - ~SecCertificate () - { - Dispose (false); - } - - public IntPtr Handle { - get { - return handle; - } - } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - protected virtual void Dispose (bool disposing) - { - if (handle != IntPtr.Zero){ - CFObject.CFRelease (handle); - handle = IntPtr.Zero; - } - } - } - - partial class SecIdentity : INativeObject, IDisposable { - - static readonly CFString ImportExportPassphase; - static readonly CFString ImportItemIdentity; - static readonly CFString ImportExportAccess; - static readonly CFString ImportExportKeychain; - - static SecIdentity () - { - var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0); - if (handle == IntPtr.Zero) - return; - - try { - ImportExportPassphase = CFObject.GetStringConstant (handle, "kSecImportExportPassphrase"); - ImportItemIdentity = CFObject.GetStringConstant (handle, "kSecImportItemIdentity"); - ImportExportAccess = CFObject.GetStringConstant (handle, "kSecImportExportAccess"); - ImportExportKeychain = CFObject.GetStringConstant (handle, "kSecImportExportKeychain"); - } finally { - CFObject.dlclose (handle); - } - } - - internal IntPtr handle; - - internal SecIdentity (IntPtr handle, bool owns = false) - { - this.handle = handle; - if (!owns) - CFObject.CFRetain (handle); - } - - [DllImport (AppleTlsContext.SecurityLibrary, EntryPoint="SecIdentityGetTypeID")] - public extern static IntPtr GetTypeID (); - - [DllImport (AppleTlsContext.SecurityLibrary)] - extern static /* OSStatus */ SecStatusCode SecIdentityCopyCertificate (/* SecIdentityRef */ IntPtr identityRef, /* SecCertificateRef* */ out IntPtr certificateRef); - - public SecCertificate Certificate { - get { - if (handle == IntPtr.Zero) - throw new ObjectDisposedException ("SecIdentity"); - IntPtr cert; - SecStatusCode result = SecIdentityCopyCertificate (handle, out cert); - if (result != SecStatusCode.Success) - throw new InvalidOperationException (result.ToString ()); - return new SecCertificate (cert, true); - } - } - - internal class ImportOptions - { -#if !MONOTOUCH - public SecAccess Access { - get; set; - } - public SecKeyChain KeyChain { - get; set; - } -#endif - } - - static CFDictionary CreateImportOptions (CFString password, ImportOptions options = null) - { - if (options == null) - return CFDictionary.FromObjectAndKey (password.Handle, ImportExportPassphase.Handle); - - var items = new List> (); - items.Add (new Tuple (ImportExportPassphase.Handle, password.Handle)); - -#if !MONOTOUCH - if (options.KeyChain != null) - items.Add (new Tuple (ImportExportKeychain.Handle, options.KeyChain.Handle)); - if (options.Access != null) - items.Add (new Tuple (ImportExportAccess.Handle, options.Access.Handle)); -#endif - - return CFDictionary.FromKeysAndObjects (items); - } - - public static SecIdentity Import (byte[] data, string password, ImportOptions options = null) - { - if (data == null) - throw new ArgumentNullException ("data"); - if (string.IsNullOrEmpty (password)) // SecPKCS12Import() doesn't allow empty passwords. - throw new ArgumentException ("password"); - using (var pwstring = CFString.Create (password)) - using (var optionDict = CreateImportOptions (pwstring, options)) { - CFDictionary [] array; - SecStatusCode result = SecImportExport.ImportPkcs12 (data, optionDict, out array); - if (result != SecStatusCode.Success) - throw new InvalidOperationException (result.ToString ()); - - return new SecIdentity (array [0].GetValue (ImportItemIdentity.Handle)); - } - } - - public static SecIdentity Import (X509Certificate2 certificate, ImportOptions options = null) - { - if (certificate == null) - throw new ArgumentNullException ("certificate"); - if (!certificate.HasPrivateKey) - throw new InvalidOperationException ("Need X509Certificate2 with a private key."); - - /* - * SecPSK12Import does not allow any empty passwords, so let's generate - * a semi-random one here. - */ - var password = Guid.NewGuid ().ToString (); - var pkcs12 = certificate.Export (X509ContentType.Pfx, password); - return Import (pkcs12, password, options); - } - - ~SecIdentity () - { - Dispose (false); - } - - public IntPtr Handle { - get { - return handle; - } - } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - protected virtual void Dispose (bool disposing) - { - if (handle != IntPtr.Zero){ - CFObject.CFRelease (handle); - handle = IntPtr.Zero; - } - } - } - - partial class SecKey : INativeObject, IDisposable { - internal IntPtr handle; - internal IntPtr owner; - - public SecKey (IntPtr handle, bool owns = false) - { - this.handle = handle; - if (!owns) - CFObject.CFRetain (handle); - } - - /* - * SecItemImport() returns a SecArrayRef. We need to free the array, not the items inside it. - * - */ - internal SecKey (IntPtr handle, IntPtr owner) - { - this.handle = handle; - this.owner = owner; - CFObject.CFRetain (owner); - } - - [DllImport (AppleTlsContext.SecurityLibrary, EntryPoint="SecKeyGetTypeID")] - public extern static IntPtr GetTypeID (); - - ~SecKey () - { - Dispose (false); - } - - public IntPtr Handle { - get { - return handle; - } - } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - protected virtual void Dispose (bool disposing) - { - if (owner != IntPtr.Zero) { - CFObject.CFRelease (owner); - owner = handle = IntPtr.Zero; - } else if (handle != IntPtr.Zero) { - CFObject.CFRelease (handle); - handle = IntPtr.Zero; - } - } - } - -#if !MONOTOUCH - class SecAccess : INativeObject, IDisposable { - internal IntPtr handle; - - public SecAccess (IntPtr handle, bool owns = false) - { - this.handle = handle; - if (!owns) - CFObject.CFRetain (handle); - } - - ~SecAccess () - { - Dispose (false); - } - - public IntPtr Handle { - get { - return handle; - } - } - - [DllImport (AppleTlsContext.SecurityLibrary)] - extern static /* OSStatus */ SecStatusCode SecAccessCreate (/* CFStringRef */ IntPtr descriptor, /* CFArrayRef */ IntPtr trustedList, /* SecAccessRef _Nullable * */ out IntPtr accessRef); - - public static SecAccess Create (string descriptor) - { - var descriptorHandle = CFString.Create (descriptor); - if (descriptorHandle == null) - throw new InvalidOperationException (); - - try { - IntPtr accessRef; - var result = SecAccessCreate (descriptorHandle.Handle, IntPtr.Zero, out accessRef); - if (result != SecStatusCode.Success) - throw new InvalidOperationException (result.ToString ()); - - return new SecAccess (accessRef, true); - } finally { - descriptorHandle.Dispose (); - } - } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - protected virtual void Dispose (bool disposing) - { - if (handle != IntPtr.Zero) { - CFObject.CFRelease (handle); - handle = IntPtr.Zero; - } - } - } -#endif -} -#endif diff --git a/mcs/class/System/Mono.AppleTls/Enums.cs b/mcs/class/System/Mono.AppleTls/Enums.cs index 99c952f171..052ecb4457 100644 --- a/mcs/class/System/Mono.AppleTls/Enums.cs +++ b/mcs/class/System/Mono.AppleTls/Enums.cs @@ -1,4 +1,3 @@ -#if MONO_FEATURE_APPLETLS // Copyright 2011-2015 Xamarin Inc. All rights reserved. using ObjCRuntimeInternal; @@ -405,4 +404,3 @@ namespace Mono.AppleTls { ResultOtherError, } } -#endif diff --git a/mcs/class/System/Mono.AppleTls/Items.cs b/mcs/class/System/Mono.AppleTls/Items.cs deleted file mode 100644 index 7d28e64a22..0000000000 --- a/mcs/class/System/Mono.AppleTls/Items.cs +++ /dev/null @@ -1,356 +0,0 @@ -#if SECURITY_DEP && MONO_FEATURE_APPLETLS -// -// Items.cs: Implements the KeyChain query access APIs -// -// We use strong types and a helper SecQuery class to simplify the -// creation of the dictionary used to query the Keychain -// -// Authors: -// Miguel de Icaza -// Sebastien Pouliot -// -// Copyright 2010 Novell, Inc -// Copyright 2011-2016 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.Collections; -using System.Runtime.InteropServices; -using ObjCRuntimeInternal; -using Mono.Net; - -namespace Mono.AppleTls { - - enum SecKind { - Identity, - Certificate - } - -#if MONOTOUCH - static class SecKeyChain { -#else - class SecKeyChain : INativeObject, IDisposable { -#endif - internal static readonly IntPtr MatchLimitAll; - internal static readonly IntPtr MatchLimitOne; - internal static readonly IntPtr MatchLimit; - -#if !MONOTOUCH - IntPtr handle; - - internal SecKeyChain (IntPtr handle, bool owns = false) - { - if (handle == IntPtr.Zero) - throw new ArgumentException ("Invalid handle"); - - this.handle = handle; - if (!owns) - CFObject.CFRetain (handle); - } -#endif - - static SecKeyChain () - { - var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0); - if (handle == IntPtr.Zero) - return; - - try { - MatchLimit = CFObject.GetIntPtr (handle, "kSecMatchLimit"); - MatchLimitAll = CFObject.GetIntPtr (handle, "kSecMatchLimitAll"); - MatchLimitOne = CFObject.GetIntPtr (handle, "kSecMatchLimitOne"); - } finally { - CFObject.dlclose (handle); - } - } - - public static SecIdentity FindIdentity (SecCertificate certificate, bool throwOnError = false) - { - if (certificate == null) - throw new ArgumentNullException ("certificate"); - var identity = FindIdentity (cert => SecCertificate.Equals (certificate, cert)); - if (!throwOnError || identity != null) - return identity; - - throw new InvalidOperationException (string.Format ("Could not find SecIdentity for certificate '{0}' in keychain.", certificate.SubjectSummary)); - } - - static SecIdentity FindIdentity (Predicate filter) - { - /* - * Unfortunately, SecItemCopyMatching() does not allow any search - * filters when looking up an identity. - * - * The following lookup will return all identities from the keychain - - * we then need need to find the right one. - */ - using (var record = new SecRecord (SecKind.Identity)) { - SecStatusCode status; - var result = SecKeyChain.QueryAsReference (record, -1, out status); - if (status != SecStatusCode.Success || result == null) - return null; - - for (int i = 0; i < result.Length; i++) { - var identity = (SecIdentity)result [i]; - if (filter (identity.Certificate)) - return identity; - } - } - - return null; - } - - static INativeObject [] QueryAsReference (SecRecord query, int max, out SecStatusCode result) - { - if (query == null) { - result = SecStatusCode.Param; - return null; - } - - using (var copy = query.QueryDict.MutableCopy ()) { - copy.SetValue (CFBoolean.True.Handle, SecItem.ReturnRef); - SetLimit (copy, max); - return QueryAsReference (copy, out result); - } - } - - static INativeObject [] QueryAsReference (CFDictionary query, out SecStatusCode result) - { - if (query == null) { - result = SecStatusCode.Param; - return null; - } - - IntPtr ptr; - result = SecItem.SecItemCopyMatching (query.Handle, out ptr); - if (result == SecStatusCode.Success && ptr != IntPtr.Zero) { - var array = CFArray.ArrayFromHandle (ptr, p => { - IntPtr cfType = CFType.GetTypeID (p); - if (cfType == SecCertificate.GetTypeID ()) - return new SecCertificate (p, true); - if (cfType == SecKey.GetTypeID ()) - return new SecKey (p, true); - if (cfType == SecIdentity.GetTypeID ()) - return new SecIdentity (p, true); - throw new Exception (String.Format ("Unexpected type: 0x{0:x}", cfType)); - }); - return array; - } - return null; - } - - internal static CFNumber SetLimit (CFMutableDictionary dict, int max) - { - CFNumber n = null; - IntPtr val; - if (max == -1) - val = MatchLimitAll; - else if (max == 1) - val = MatchLimitOne; - else { - n = CFNumber.FromInt32 (max); - val = n.Handle; - } - - dict.SetValue (val, SecKeyChain.MatchLimit); - return n; - } - -#if !MONOTOUCH - [DllImport (AppleTlsContext.SecurityLibrary)] - extern static /* OSStatus */ SecStatusCode SecKeychainCreate (/* const char * */ IntPtr pathName, uint passwordLength, /* const void * */ IntPtr password, - bool promptUser, /* SecAccessRef */ IntPtr initialAccess, - /* SecKeychainRef _Nullable * */ out IntPtr keychain); - - internal static SecKeyChain Create (string pathName, string password) - { - IntPtr handle; - var pathNamePtr = Marshal.StringToHGlobalAnsi (pathName); - var passwordPtr = Marshal.StringToHGlobalAnsi (password); - var result = SecKeychainCreate (pathNamePtr, (uint)password.Length, passwordPtr, false, IntPtr.Zero, out handle); - if (result != SecStatusCode.Success) - throw new InvalidOperationException (result.ToString ()); - return new SecKeyChain (handle, true); - } - - [DllImport (AppleTlsContext.SecurityLibrary)] - extern static /* OSStatus */ SecStatusCode SecKeychainOpen (/* const char * */ IntPtr pathName, /* SecKeychainRef _Nullable * */ out IntPtr keychain); - - internal static SecKeyChain Open (string pathName) - { - IntPtr handle; - IntPtr pathNamePtr = IntPtr.Zero; - try { - pathNamePtr = Marshal.StringToHGlobalAnsi (pathName); - var result = SecKeychainOpen (pathNamePtr, out handle); - if (result != SecStatusCode.Success) - throw new InvalidOperationException (result.ToString ()); - return new SecKeyChain (handle, true); - } finally { - if (pathNamePtr != IntPtr.Zero) - Marshal.FreeHGlobal (pathNamePtr); - } - } - - internal static SecKeyChain OpenSystemRootCertificates () - { - return Open ("/System/Library/Keychains/SystemRootCertificates.keychain"); - } - - ~SecKeyChain () - { - Dispose (false); - } - - public IntPtr Handle { - get { - return handle; - } - } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - protected virtual void Dispose (bool disposing) - { - if (handle != IntPtr.Zero) { - CFObject.CFRelease (handle); - handle = IntPtr.Zero; - } - } -#endif - } - - class SecRecord : IDisposable { - - internal static readonly IntPtr SecClassKey; - static SecRecord () - { - var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0); - if (handle == IntPtr.Zero) - return; - - try { - SecClassKey = CFObject.GetIntPtr (handle, "kSecClass"); - } finally { - CFObject.dlclose (handle); - } - } - - CFMutableDictionary _queryDict; - internal CFMutableDictionary QueryDict { - get { - return _queryDict; - } - } - - internal void SetValue (IntPtr key, IntPtr value) - { - _queryDict.SetValue (key, value); - } - - public SecRecord (SecKind secKind) - { - var kind = SecClass.FromSecKind (secKind); - _queryDict = CFMutableDictionary.Create (); - _queryDict.SetValue (SecClassKey, kind); - } - - public void Dispose () - { - Dispose (true); - GC.SuppressFinalize (this); - } - - protected virtual void Dispose (bool disposing) - { - if (_queryDict != null){ - if (disposing){ - _queryDict.Dispose (); - _queryDict = null; - } - } - } - - ~SecRecord () - { - Dispose (false); - } - } - - partial class SecItem { - public static readonly IntPtr ReturnRef; - public static readonly IntPtr MatchSearchList; - - static SecItem () - { - var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0); - if (handle == IntPtr.Zero) - return; - - try { - ReturnRef = CFObject.GetIntPtr (handle, "kSecReturnRef"); - MatchSearchList = CFObject.GetIntPtr (handle, "kSecMatchSearchList"); - } finally { - CFObject.dlclose (handle); - } - } - - [DllImport (AppleTlsContext.SecurityLibrary)] - internal extern static SecStatusCode SecItemCopyMatching (/* CFDictionaryRef */ IntPtr query, /* CFTypeRef* */ out IntPtr result); - } - - static partial class SecClass { - - public static readonly IntPtr Identity; - public static readonly IntPtr Certificate; - - static SecClass () - { - var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0); - if (handle == IntPtr.Zero) - return; - - try { - Identity = CFObject.GetIntPtr (handle, "kSecClassIdentity"); - Certificate = CFObject.GetIntPtr (handle, "kSecClassCertificate"); - } finally { - CFObject.dlclose (handle); - } - } - - public static IntPtr FromSecKind (SecKind secKind) - { - switch (secKind){ - case SecKind.Identity: - return Identity; - case SecKind.Certificate: - return Certificate; - default: - throw new ArgumentException ("secKind"); - } - } - } -} -#endif diff --git a/mcs/class/System/Mono.AppleTls/MonoCertificatePal.Mobile.cs b/mcs/class/System/Mono.AppleTls/MonoCertificatePal.Mobile.cs new file mode 100644 index 0000000000..0d9c57a8e8 --- /dev/null +++ b/mcs/class/System/Mono.AppleTls/MonoCertificatePal.Mobile.cs @@ -0,0 +1,189 @@ +// +// MonoCertificatePal.Mobile.cs +// +// Authors: +// Miguel de Icaza +// Sebastien Pouliot +// Martin Baulig +// +// Copyright 2010 Novell, Inc +// Copyright 2011-2014 Xamarin Inc. +// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.Threading; +using System.Runtime.InteropServices; +using System.Security.Cryptography.Apple; +using System.Security.Cryptography.X509Certificates; +using Microsoft.Win32.SafeHandles; +using Mono.Net; + +namespace Mono.AppleTls +{ + static partial class MonoCertificatePal + { + static int initialized; + static CFString ImportExportPassphase; + static CFString ImportItemIdentity; + static IntPtr MatchLimitAll; + static IntPtr MatchLimitOne; + static IntPtr MatchLimit; + static IntPtr SecClassKey; + static IntPtr SecClassIdentity; + static IntPtr SecClassCertificate; + static IntPtr ReturnRef; + static IntPtr MatchSearchList; + + static void Initialize () + { + if (Interlocked.CompareExchange (ref initialized, 1, 0) != 0) + return; + + var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0); + if (handle == IntPtr.Zero) + return; + + try { + ImportExportPassphase = CFObject.GetStringConstant (handle, "kSecImportExportPassphrase"); + ImportItemIdentity = CFObject.GetStringConstant (handle, "kSecImportItemIdentity"); + MatchLimit = CFObject.GetIntPtr (handle, "kSecMatchLimit"); + MatchLimitAll = CFObject.GetIntPtr (handle, "kSecMatchLimitAll"); + MatchLimitOne = CFObject.GetIntPtr (handle, "kSecMatchLimitOne"); + SecClassKey = CFObject.GetIntPtr (handle, "kSecClass"); + SecClassIdentity = CFObject.GetIntPtr (handle, "kSecClassIdentity"); + SecClassCertificate = CFObject.GetIntPtr (handle, "kSecClassCertificate"); + ReturnRef = CFObject.GetIntPtr (handle, "kSecReturnRef"); + MatchSearchList = CFObject.GetIntPtr (handle, "kSecMatchSearchList"); + } finally { + CFObject.dlclose (handle); + } + } + + static SafeSecIdentityHandle ImportIdentity (byte[] data, string password) + { + if (data == null) + throw new ArgumentNullException (nameof (data)); + if (string.IsNullOrEmpty (password)) // SecPKCS12Import() doesn't allow empty passwords. + throw new ArgumentException (nameof (password)); + Initialize (); + using (var pwstring = CFString.Create (password)) + using (var optionDict = CFDictionary.FromObjectAndKey (pwstring.Handle, ImportExportPassphase.Handle)) { + var result = ImportPkcs12 (data, optionDict, out var array); + if (result != SecStatusCode.Success) + throw new InvalidOperationException (result.ToString ()); + + return new SafeSecIdentityHandle (array [0].GetValue (ImportItemIdentity.Handle)); + } + } + + [DllImport (AppleTlsContext.SecurityLibrary)] + extern static SecStatusCode SecPKCS12Import (IntPtr pkcs12_data, IntPtr options, out IntPtr items); + + static SecStatusCode ImportPkcs12 (byte[] buffer, CFDictionary options, out CFDictionary[] array) + { + using (CFData data = CFData.FromData (buffer)) { + return ImportPkcs12 (data, options, out array); + } + } + + static SecStatusCode ImportPkcs12 (CFData data, CFDictionary options, out CFDictionary[] array) + { + if (options == null) + throw new ArgumentNullException (nameof (options)); + + var code = SecPKCS12Import (data.Handle, options.Handle, out var handle); + array = CFArray.ArrayFromHandle (handle, h => new CFDictionary (h, false)); + if (handle != IntPtr.Zero) + CFObject.CFRelease (handle); + return code; + } + + public static SafeSecIdentityHandle ImportIdentity (X509Certificate2 certificate) + { + if (certificate == null) + throw new ArgumentNullException (nameof (certificate)); + if (!certificate.HasPrivateKey) + throw new InvalidOperationException ("Need X509Certificate2 with a private key."); + + SafeSecIdentityHandle identity; + /* + * SecPSK12Import does not allow any empty passwords, so let's generate + * a semi-random one here. + */ + Initialize (); + var password = Guid.NewGuid ().ToString (); + var pkcs12 = certificate.Export (X509ContentType.Pfx, password); + identity = ImportIdentity (pkcs12, password); + return identity ?? new SafeSecIdentityHandle (); + } + + [DllImport (AppleTlsContext.SecurityLibrary)] + extern static SecStatusCode SecItemCopyMatching (/* CFDictionaryRef */ IntPtr query, /* CFTypeRef* */ out IntPtr result); + + public static SafeSecIdentityHandle FindIdentity (SafeSecCertificateHandle certificate, bool throwOnError = false) + { + if (certificate == null || certificate.IsInvalid) + throw new ObjectDisposedException (nameof (certificate)); + var identity = FindIdentity (cert => MonoCertificatePal.Equals (certificate, cert)) ?? new SafeSecIdentityHandle (); + if (!throwOnError || identity.IsInvalid) + return identity; + + var subject = MonoCertificatePal.GetSubjectSummary (certificate); + throw new InvalidOperationException ($"Could not find SecIdentity for certificate '{subject}' in keychain."); + } + + static SafeSecIdentityHandle FindIdentity (Predicate filter) + { + Initialize (); + + /* + * Unfortunately, SecItemCopyMatching() does not allow any search + * filters when looking up an identity. + * + * The following lookup will return all identities from the keychain - + * we then need need to find the right one. + */ + using (var query = CFMutableDictionary.Create ()) { + query.SetValue (SecClassKey, SecClassIdentity); + query.SetValue (CFBoolean.True.Handle, ReturnRef); + query.SetValue (MatchLimitAll, MatchLimit); + + var status = SecItemCopyMatching (query.Handle, out var ptr); + if (status != SecStatusCode.Success || ptr == IntPtr.Zero) + return null; + + using (var array = new CFArray (ptr, false)) { + for (int i = 0; i < array.Count; i++) { + var item = array[i]; + if (!MonoCertificatePal.IsSecIdentity (item)) + throw new InvalidOperationException (); + using (var identity = new SafeSecIdentityHandle (item)) + using (var certificate = MonoCertificatePal.GetCertificate (identity)) { + if (filter (certificate)) + return new SafeSecIdentityHandle (item); + } + } + } + } + + return null; + } + } +} diff --git a/mcs/class/System/Mono.AppleTls/ImportExport.cs b/mcs/class/System/Mono.AppleTls/MonoCertificatePal.OSX.cs similarity index 61% rename from mcs/class/System/Mono.AppleTls/ImportExport.cs rename to mcs/class/System/Mono.AppleTls/MonoCertificatePal.OSX.cs index dae101bc6b..657756ae31 100644 --- a/mcs/class/System/Mono.AppleTls/ImportExport.cs +++ b/mcs/class/System/Mono.AppleTls/MonoCertificatePal.OSX.cs @@ -1,37 +1,39 @@ -#if SECURITY_DEP && MONO_FEATURE_APPLETLS -// -// ImportExport.cs +// +// MonoCertificatePal.OSX.cs // // Authors: -// Sebastien Pouliot -// +// Miguel de Icaza +// Sebastien Pouliot +// Martin Baulig +// +// Copyright 2010 Novell, Inc // Copyright 2011-2014 Xamarin Inc. +// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com) // -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // - +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. using System; +using System.Threading; using System.Runtime.InteropServices; using System.Security.Cryptography; +using System.Security.Cryptography.Apple; using System.Security.Cryptography.X509Certificates; -using ObjCRuntimeInternal; +using Microsoft.Win32.SafeHandles; using Mono.Net; #if MONO_FEATURE_BTLS @@ -40,34 +42,20 @@ using Mono.Btls; using Mono.Security.Cryptography; #endif -namespace Mono.AppleTls { - - internal partial class SecImportExport { - - [DllImport (AppleTlsContext.SecurityLibrary)] - extern static SecStatusCode SecPKCS12Import (IntPtr pkcs12_data, IntPtr options, out IntPtr items); - - static public SecStatusCode ImportPkcs12 (byte[] buffer, CFDictionary options, out CFDictionary[] array) +namespace Mono.AppleTls +{ + static partial class MonoCertificatePal + { + public static SafeSecIdentityHandle ImportIdentity (X509Certificate2 certificate) { - using (CFData data = CFData.FromData (buffer)) { - return ImportPkcs12 (data, options, out array); - } + if (certificate == null) + throw new ArgumentNullException (nameof (certificate)); + if (!certificate.HasPrivateKey) + throw new InvalidOperationException ("Need X509Certificate2 with a private key."); + + return ItemImport (certificate) ?? new SafeSecIdentityHandle (); } - static public SecStatusCode ImportPkcs12 (CFData data, CFDictionary options, out CFDictionary [] array) - { - if (options == null) - throw new ArgumentNullException ("options"); - - IntPtr handle; - SecStatusCode code = SecPKCS12Import (data.Handle, options.Handle, out handle); - array = CFArray.ArrayFromHandle (handle, h => new CFDictionary (h, false)); - if (handle != IntPtr.Zero) - CFObject.CFRelease (handle); - return code; - } - -#if !MONOTOUCH [DllImport (AppleTlsContext.SecurityLibrary)] extern static SecStatusCode SecItemImport ( /* CFDataRef */ IntPtr importedData, @@ -91,15 +79,15 @@ namespace Mono.AppleTls { } static CFArray ItemImport (CFData data, SecExternalFormat format, SecExternalItemType itemType, - SecItemImportExportFlags flags = SecItemImportExportFlags.None, - SecItemImportExportKeyParameters? keyParams = null) + SecItemImportExportFlags flags = SecItemImportExportFlags.None, + SecItemImportExportKeyParameters? keyParams = null) { return ItemImport (data, ref format, ref itemType, flags, keyParams); } static CFArray ItemImport (CFData data, ref SecExternalFormat format, ref SecExternalItemType itemType, - SecItemImportExportFlags flags = SecItemImportExportFlags.None, - SecItemImportExportKeyParameters? keyParams = null) + SecItemImportExportFlags flags = SecItemImportExportFlags.None, + SecItemImportExportKeyParameters? keyParams = null) { IntPtr keyParamsPtr = IntPtr.Zero; if (keyParams != null) { @@ -127,18 +115,18 @@ namespace Mono.AppleTls { /* SecCertificateRef */ IntPtr certificate, /* SecKeyRef */ IntPtr privateKey); - static public SecIdentity ItemImport (X509Certificate2 certificate) + static public SafeSecIdentityHandle ItemImport (X509Certificate2 certificate) { if (!certificate.HasPrivateKey) throw new NotSupportedException (); using (var key = ImportPrivateKey (certificate)) - using (var cert = new SecCertificate (certificate)) { - var identity = SecIdentityCreate (IntPtr.Zero, cert.Handle, key.Handle); - if (CFType.GetTypeID (identity) != SecIdentity.GetTypeID ()) + using (var cert = MonoCertificatePal.FromOtherCertificate (certificate)) { + var identity = SecIdentityCreate (IntPtr.Zero, cert.DangerousGetHandle (), key.DangerousGetHandle ()); + if (!MonoCertificatePal.IsSecIdentity (identity)) throw new InvalidOperationException (); - return new SecIdentity (identity, true); + return new SafeSecIdentityHandle (identity, true); } } @@ -152,7 +140,7 @@ namespace Mono.AppleTls { #endif } - static SecKey ImportPrivateKey (X509Certificate2 certificate) + static SafeSecKeyRefHandle ImportPrivateKey (X509Certificate2 certificate) { if (!certificate.HasPrivateKey) throw new NotSupportedException (); @@ -166,10 +154,10 @@ namespace Mono.AppleTls { throw new InvalidOperationException ("Private key import failed."); var imported = items[0]; - if (CFType.GetTypeID (imported) != SecKey.GetTypeID ()) + if (!MonoCertificatePal.IsSecKey (imported)) throw new InvalidOperationException ("Private key import doesn't return SecKey."); - return new SecKey (imported, items.Handle); + return new SafeSecKeyRefHandle (imported, items.Handle); } finally { items.Dispose (); } @@ -178,7 +166,8 @@ namespace Mono.AppleTls { const int SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION = 0; // Native enum; don't change. - enum SecExternalFormat : int { + enum SecExternalFormat : int + { Unknown = 0, OpenSSL = 1, X509Cert = 9, @@ -188,7 +177,8 @@ namespace Mono.AppleTls { } // Native enum; don't change. - enum SecExternalItemType : int { + enum SecExternalItemType : int + { Unknown = 0, PrivateKey = 1, PublicKey = 2, @@ -198,14 +188,16 @@ namespace Mono.AppleTls { } // Native enum; don't change - enum SecItemImportExportFlags : int { + enum SecItemImportExportFlags : int + { None, PemArmour = 0x00000001, /* exported blob is PEM formatted */ } // Native struct; don't change [StructLayout (LayoutKind.Sequential)] - struct SecItemImportExportKeyParameters { + struct SecItemImportExportKeyParameters + { public int version; /* SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION */ public int flags; /* SecKeyImportExportFlags bits */ public IntPtr passphrase; /* SecExternalFormat.PKCS12 only. Legal types are CFStringRef and CFDataRef. */ @@ -218,7 +210,5 @@ namespace Mono.AppleTls { IntPtr keyUsage; IntPtr keyAttributes; } -#endif } } -#endif diff --git a/mcs/class/System/Mono.AppleTls/MonoCertificatePal.cs b/mcs/class/System/Mono.AppleTls/MonoCertificatePal.cs new file mode 100644 index 0000000000..d0dd11181a --- /dev/null +++ b/mcs/class/System/Mono.AppleTls/MonoCertificatePal.cs @@ -0,0 +1,190 @@ +// +// MonoCertificatePal.cs +// +// Authors: +// Miguel de Icaza +// Sebastien Pouliot +// Martin Baulig +// +// Copyright 2010 Novell, Inc +// Copyright 2011-2014 Xamarin Inc. +// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.Threading; +using System.Runtime.InteropServices; +using System.Security.Cryptography.Apple; +using System.Security.Cryptography.X509Certificates; +using Microsoft.Win32.SafeHandles; +using Mono.Net; + +namespace Mono.AppleTls +{ + static partial class MonoCertificatePal + { + [DllImport (AppleTlsContext.SecurityLibrary)] + extern static IntPtr SecCertificateCreateWithData (IntPtr allocator, IntPtr cfData); + + public static SafeSecCertificateHandle FromOtherCertificate (X509Certificate certificate) + { + if (certificate == null) + throw new ArgumentNullException (nameof (certificate)); + return FromOtherCertificate (certificate.Impl); + } + + public static SafeSecCertificateHandle FromOtherCertificate (X509CertificateImpl impl) + { + X509Helper.ThrowIfContextInvalid (impl); + + var handle = impl.GetNativeAppleCertificate (); + if (handle != IntPtr.Zero) + return new SafeSecCertificateHandle (handle, false); + + using (var data = CFData.FromData (impl.RawData)) { + handle = SecCertificateCreateWithData (IntPtr.Zero, data.Handle); + if (handle == IntPtr.Zero) + throw new ArgumentException ("Not a valid DER-encoded X.509 certificate"); + + return new SafeSecCertificateHandle (handle, true); + } + } + + [DllImport (AppleTlsContext.SecurityLibrary)] + extern static IntPtr SecIdentityGetTypeID (); + + public static bool IsSecIdentity (IntPtr ptr) + { + if (ptr == IntPtr.Zero) + return false; + return CFType.GetTypeID (ptr) == SecIdentityGetTypeID (); + } + + [DllImport (AppleTlsContext.SecurityLibrary)] + public extern static IntPtr SecKeyGetTypeID (); + + public static bool IsSecKey (IntPtr ptr) + { + if (ptr == IntPtr.Zero) + return false; + return CFType.GetTypeID (ptr) == SecKeyGetTypeID (); + } + + [DllImport (AppleTlsContext.SecurityLibrary)] + extern static /* OSStatus */ SecStatusCode SecIdentityCopyCertificate (/* SecIdentityRef */ IntPtr identityRef, /* SecCertificateRef* */ out IntPtr certificateRef); + + public static SafeSecCertificateHandle GetCertificate (SafeSecIdentityHandle identity) + { + if (identity == null || identity.IsInvalid) + throw new ArgumentNullException (nameof (identity)); + var result = SecIdentityCopyCertificate (identity.DangerousGetHandle (), out var cert); + if (result != SecStatusCode.Success) + throw new InvalidOperationException (result.ToString ()); + return new SafeSecCertificateHandle (cert, true); + } + + [DllImport (AppleTlsContext.SecurityLibrary)] + extern static IntPtr SecCertificateCopySubjectSummary (IntPtr cert); + + public static string GetSubjectSummary (SafeSecCertificateHandle certificate) + { + if (certificate == null || certificate.IsInvalid) + throw new ArgumentNullException (nameof (certificate)); + + var subjectSummaryHandle = IntPtr.Zero; + try { + subjectSummaryHandle = SecCertificateCopySubjectSummary (certificate.DangerousGetHandle ()); + return CFString.AsString (subjectSummaryHandle); + } finally { + if (subjectSummaryHandle != IntPtr.Zero) + CFObject.CFRelease (subjectSummaryHandle); + } + } + + [DllImport (AppleTlsContext.SecurityLibrary)] + extern static /* CFDataRef */ IntPtr SecCertificateCopyData (/* SecCertificateRef */ IntPtr cert); + + public static byte[] GetRawData (SafeSecCertificateHandle certificate) + { + if (certificate == null || certificate.IsInvalid) + throw new ArgumentNullException (nameof (certificate)); + + var dataPtr = SecCertificateCopyData (certificate.DangerousGetHandle ()); + if (dataPtr == IntPtr.Zero) + throw new ArgumentException ("Not a valid certificate"); + + using (var data = new CFData (dataPtr, true)) { + var buffer = new byte[(int)data.Length]; + Marshal.Copy (data.Bytes, buffer, 0, buffer.Length); + return buffer; + } + } + + + public static bool Equals (SafeSecCertificateHandle first, SafeSecCertificateHandle second) + { + /* + * This is a little bit expensive, but unfortunately there is no better API to compare two + * SecCertificateRef's for equality. + */ + if (first == null || first.IsInvalid) + throw new ArgumentNullException (nameof (first)); + if (second == null || second.IsInvalid) + throw new ArgumentNullException (nameof (second)); + if (first.DangerousGetHandle () == second.DangerousGetHandle ()) + return true; + + var firstDataPtr = SecCertificateCopyData (first.DangerousGetHandle ()); + var secondDataPtr = SecCertificateCopyData (first.DangerousGetHandle ()); + + try { + if (firstDataPtr == IntPtr.Zero || secondDataPtr == IntPtr.Zero) + throw new ArgumentException ("Not a valid certificate."); + if (firstDataPtr == secondDataPtr) + return true; + + var firstLength = (int)CFData.CFDataGetLength (firstDataPtr); + var secondLength = (int)CFData.CFDataGetLength (secondDataPtr); + if (firstLength != secondLength) + return false; + + var firstBytePtr = CFData.CFDataGetBytePtr (firstDataPtr); + var secondBytePtr = CFData.CFDataGetBytePtr (secondDataPtr); + if (firstBytePtr == secondBytePtr) + return true; + + var firstBuffer = new byte[firstLength]; + var secondBuffer = new byte[secondLength]; + Marshal.Copy (firstBytePtr, firstBuffer, 0, firstBuffer.Length); + Marshal.Copy (secondBytePtr, secondBuffer, 0, secondBuffer.Length); + + for (int i = 0; i < firstBuffer.Length; i++) + if (firstBuffer[i] != secondBuffer[i]) + return false; + + return true; + } finally { + if (firstDataPtr != IntPtr.Zero) + CFObject.CFRelease (firstDataPtr); + if (secondDataPtr != IntPtr.Zero) + CFObject.CFRelease (secondDataPtr); + } + } + } +} diff --git a/mcs/class/System/Mono.AppleTls/Policy.cs b/mcs/class/System/Mono.AppleTls/Policy.cs index 4c14f891b7..47073992e0 100644 --- a/mcs/class/System/Mono.AppleTls/Policy.cs +++ b/mcs/class/System/Mono.AppleTls/Policy.cs @@ -1,4 +1,3 @@ -#if SECURITY_DEP && MONO_FEATURE_APPLETLS // // Policy.cs: Implements the managed SecPolicy wrapper. // @@ -84,4 +83,3 @@ namespace Mono.AppleTls { } } } -#endif diff --git a/mcs/class/System/Mono.AppleTls/SafeHandles.Mono.cs b/mcs/class/System/Mono.AppleTls/SafeHandles.Mono.cs new file mode 100644 index 0000000000..cfb760c145 --- /dev/null +++ b/mcs/class/System/Mono.AppleTls/SafeHandles.Mono.cs @@ -0,0 +1,94 @@ +// +// SafeHandles.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System.Runtime.InteropServices; +using System.Security.Cryptography.Apple; +using Microsoft.Win32.SafeHandles; +using Mono.Net; + +namespace System.Security.Cryptography.X509Certificates +{ + partial class SafeSecIdentityHandle + { + public SafeSecIdentityHandle (IntPtr handle, bool ownsHandle = false) + : base (handle, ownsHandle) + { + } + } + + partial class SafeSecCertificateHandle + { + public SafeSecCertificateHandle (IntPtr handle, bool ownsHandle = false) + : base (handle, ownsHandle) + { + } + } +} + +namespace System.Security.Cryptography.Apple +{ + partial class SafeKeychainItemHandle + { + public SafeKeychainItemHandle (IntPtr handle, bool ownsHandle) + : base (handle, ownsHandle) + { + if (!ownsHandle) + CFObject.CFRetain (handle); + } + } + + partial class SafeSecKeyRefHandle + { + public SafeSecKeyRefHandle (IntPtr handle, bool ownsHandle = false) + : base (handle, ownsHandle) + { + } + + IntPtr owner; + + /* + * SecItemImport() returns a SecArrayRef. We need to free the array, not the items inside it. + * + */ + public SafeSecKeyRefHandle (IntPtr handle, IntPtr owner) + : base (handle, false) + { + this.owner = owner; + CFObject.CFRetain (owner); + } + + protected override bool ReleaseHandle () + { + if (owner != IntPtr.Zero) { + CFObject.CFRelease (owner); + owner = IntPtr.Zero; + SetHandle (IntPtr.Zero); + return true; + } + return base.ReleaseHandle (); + } + } + +} diff --git a/mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/VisualBasicCodeDomGenerator.cs b/mcs/class/System/Mono.AppleTls/SafeHandles.cs similarity index 50% rename from mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/VisualBasicCodeDomGenerator.cs rename to mcs/class/System/Mono.AppleTls/SafeHandles.cs index ba72fdaec1..c859aee9e0 100644 --- a/mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/VisualBasicCodeDomGenerator.cs +++ b/mcs/class/System/Mono.AppleTls/SafeHandles.cs @@ -1,49 +1,71 @@ -#region MIT license -// -// MIT license -// -// Copyright (c) 2007-2008 Jiri Moudry, Pascal Craponne -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -#endregion - -using System.CodeDom.Compiler; -using System.IO; -using DbLinq.Schema.Dbml; -using Microsoft.VisualBasic; - -namespace DbMetal.Generator.Implementation.CodeDomGenerator -{ -#if !MONO_STRICT - public -#endif - class VisualBasicCodeDomGenerator : AbstractCodeDomGenerator - { - public override string LanguageCode { get { return "VB"; } } - public override string Extension { get { return ".vb"; } } - - public override void Write(TextWriter textWriter, Database dbSchema, GenerationContext context) - { - new VBCodeProvider().CreateGenerator(textWriter).GenerateCodeFromNamespace(GenerateCodeDomModel(dbSchema), textWriter, - new CodeGeneratorOptions() { BracingStyle = "C" }); - } - - } -} +// +// SafeHandles.Mono.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System.Runtime.InteropServices; +using System.Security.Cryptography.Apple; +using Microsoft.Win32.SafeHandles; +using Mono.Net; + +namespace System.Security.Cryptography.X509Certificates +{ + sealed partial class SafeSecIdentityHandle : SafeKeychainItemHandle + { + public SafeSecIdentityHandle () + { + } + } + + sealed partial class SafeSecCertificateHandle : SafeKeychainItemHandle + { + public SafeSecCertificateHandle () + { + } + } +} + +namespace System.Security.Cryptography.Apple +{ + partial class SafeKeychainItemHandle : SafeHandle + { + internal SafeKeychainItemHandle () + : base (IntPtr.Zero, ownsHandle: true) + { + } + + protected override bool ReleaseHandle () + { + if (handle != IntPtr.Zero) + CFObject.CFRelease (handle); + SetHandle (IntPtr.Zero); + return true; + } + + public override bool IsInvalid => handle == IntPtr.Zero; + } + + partial class SafeSecKeyRefHandle : SafeKeychainItemHandle + { + } +} diff --git a/mcs/class/System/Mono.AppleTls/SecureTransport.cs b/mcs/class/System/Mono.AppleTls/SecureTransport.cs index 6e8f29f16c..26c19c7fb1 100644 --- a/mcs/class/System/Mono.AppleTls/SecureTransport.cs +++ b/mcs/class/System/Mono.AppleTls/SecureTransport.cs @@ -1,4 +1,3 @@ -#if MONO_FEATURE_APPLETLS // Copyright 2014 Xamarin Inc. All rights reserved. namespace Mono.AppleTls { @@ -248,4 +247,3 @@ namespace Mono.AppleTls { TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 = 0xC032, // iOS 9+ } } -#endif diff --git a/mcs/class/System/Mono.AppleTls/SslConnection.cs b/mcs/class/System/Mono.AppleTls/SslConnection.cs index 888a7776cc..f6ba33b486 100644 --- a/mcs/class/System/Mono.AppleTls/SslConnection.cs +++ b/mcs/class/System/Mono.AppleTls/SslConnection.cs @@ -1,4 +1,3 @@ -#if MONO_FEATURE_APPLETLS // // SslConnection // @@ -15,4 +14,3 @@ namespace Mono.AppleTls delegate SslStatus SslReadFunc (IntPtr connection, IntPtr data, /* size_t* */ ref IntPtr dataLength); delegate SslStatus SslWriteFunc (IntPtr connection, IntPtr data, /* size_t* */ ref IntPtr dataLength); } -#endif diff --git a/mcs/class/System/Mono.AppleTls/Trust.cs b/mcs/class/System/Mono.AppleTls/Trust.cs index 3ec3c4dd60..36ca668da5 100644 --- a/mcs/class/System/Mono.AppleTls/Trust.cs +++ b/mcs/class/System/Mono.AppleTls/Trust.cs @@ -1,4 +1,3 @@ -#if SECURITY_DEP && MONO_FEATURE_APPLETLS // // Trust.cs: Implements the managed SecTrust wrapper. // @@ -61,18 +60,21 @@ namespace Mono.AppleTls { if (certificates == null) throw new ArgumentNullException ("certificates"); - SecCertificate[] array = new SecCertificate [certificates.Count]; + var array = new SafeSecCertificateHandle [certificates.Count]; int i = 0; foreach (var certificate in certificates) - array [i++] = new SecCertificate (certificate); + array [i++] = MonoCertificatePal.FromOtherCertificate (certificate); Initialize (array, policy); for (i = 0; i < array.Length; i++) array [i].Dispose (); } - void Initialize (SecCertificate[] array, SecPolicy policy) + void Initialize (SafeSecCertificateHandle[] array, SecPolicy policy) { - using (var certs = CFArray.CreateArray (array)) { + var handles = new IntPtr [array.Length]; + for (int i = 0; i < array.Length; i++) + handles [i] = array [i].DangerousGetHandle (); + using (var certs = CFArray.CreateArray (handles)) { Initialize (certs.Handle, policy); } } @@ -113,17 +115,6 @@ namespace Mono.AppleTls { [DllImport (AppleTlsContext.SecurityLibrary)] extern static IntPtr /* SecCertificateRef */ SecTrustGetCertificateAtIndex (IntPtr /* SecTrustRef */ trust, IntPtr /* CFIndex */ ix); - public SecCertificate this [IntPtr index] { - get { - if (handle == IntPtr.Zero) - throw new ObjectDisposedException ("SecTrust"); - if (((long)index < 0) || ((long)index >= Count)) - throw new ArgumentOutOfRangeException ("index"); - - return new SecCertificate (SecTrustGetCertificateAtIndex (handle, index)); - } - } - internal X509Certificate GetCertificate (int index) { if (handle == IntPtr.Zero) @@ -132,7 +123,8 @@ namespace Mono.AppleTls { throw new ArgumentOutOfRangeException ("index"); var ptr = SecTrustGetCertificateAtIndex (handle, (IntPtr)index); - return new X509Certificate (ptr); + var impl = new X509CertificateImplApple (ptr, false); + return new X509Certificate (impl); } [DllImport (AppleTlsContext.SecurityLibrary)] @@ -145,18 +137,21 @@ namespace Mono.AppleTls { if (certificates == null) return SecTrustSetAnchorCertificates (handle, IntPtr.Zero); - SecCertificate[] array = new SecCertificate [certificates.Count]; + var array = new SafeSecCertificateHandle [certificates.Count]; int i = 0; foreach (var certificate in certificates) - array [i++] = new SecCertificate (certificate); + array [i++] = MonoCertificatePal.FromOtherCertificate (certificate); return SetAnchorCertificates (array); } - public SecStatusCode SetAnchorCertificates (SecCertificate[] array) + public SecStatusCode SetAnchorCertificates (SafeSecCertificateHandle[] array) { if (array == null) return SecTrustSetAnchorCertificates (handle, IntPtr.Zero); - using (var certs = CFArray.FromNativeObjects (array)) { + var handles = new IntPtr [array.Length]; + for (int i = 0; i < array.Length; i++) + handles [i] = array [i].DangerousGetHandle (); + using (var certs = CFArray.CreateArray (handles)) { return SecTrustSetAnchorCertificates (handle, certs.Handle); } } @@ -205,4 +200,3 @@ namespace Mono.AppleTls { } } } -#endif diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs b/mcs/class/System/Mono.AppleTls/X509CertificateImplApple.cs similarity index 51% rename from mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs rename to mcs/class/System/Mono.AppleTls/X509CertificateImplApple.cs index 3ffe8ee3f8..ec30415d53 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs +++ b/mcs/class/System/Mono.AppleTls/X509CertificateImplApple.cs @@ -1,11 +1,23 @@ #if MONO_FEATURE_APPLETLS || MONO_FEATURE_APPLE_X509 +#if MONO_SECURITY_ALIAS +extern alias MonoSecurity; +#endif + +#if MONO_SECURITY_ALIAS +using MX = MonoSecurity::Mono.Security.X509; +#else +using MX = Mono.Security.X509; +#endif + using System; using System.Text; using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using Microsoft.Win32.SafeHandles; using XamMac.CoreFoundation; -using MX = Mono.Security.X509; -namespace System.Security.Cryptography.X509Certificates +namespace Mono.AppleTls { class X509CertificateImplApple : X509CertificateImpl { @@ -45,17 +57,18 @@ namespace System.Security.Cryptography.X509Certificates [DllImport (CFHelpers.SecurityLibrary)] extern static IntPtr SecCertificateCopyData (IntPtr cert); - public override byte[] GetRawCertData () - { - ThrowIfContextInvalid (); - var data = SecCertificateCopyData (handle); - if (data == IntPtr.Zero) - throw new ArgumentException ("Not a valid certificate"); + public override byte[] RawData { + get { + ThrowIfContextInvalid (); + var data = SecCertificateCopyData (handle); + if (data == IntPtr.Zero) + throw new ArgumentException ("Not a valid certificate"); - try { - return CFHelpers.FetchDataBuffer (data); - } finally { - CFHelpers.CFRelease (data); + try { + return CFHelpers.FetchDataBuffer (data); + } finally { + CFHelpers.CFRelease (data); + } } } @@ -68,12 +81,13 @@ namespace System.Security.Cryptography.X509Certificates return ret; } - protected override byte[] GetCertHash (bool lazy) - { - // FIXME: might just return 'null' when 'lazy' is true. - ThrowIfContextInvalid (); - SHA1 sha = SHA1.Create (); - return sha.ComputeHash (GetRawCertData ()); + public override byte[] Thumbprint { + get { + // FIXME: might just return 'null' when 'lazy' is true. + ThrowIfContextInvalid (); + SHA1 sha = SHA1.Create (); + return sha.ComputeHash (RawData); + } } public override bool Equals (X509CertificateImpl other, out bool result) @@ -93,8 +107,8 @@ namespace System.Security.Cryptography.X509Certificates ThrowIfContextInvalid (); if (fallback != null) return; - var mxCert = new MX.X509Certificate (GetRawCertData ()); - fallback = new X509CertificateImplMono (mxCert); + var mxCert = new MX.X509Certificate (RawData); + fallback = new X509Certificate2ImplMono (mxCert); } public X509CertificateImpl FallbackImpl { @@ -104,53 +118,33 @@ namespace System.Security.Cryptography.X509Certificates } } - public override string GetSubjectName (bool legacyV1Mode) - { - return FallbackImpl.GetSubjectName (legacyV1Mode); - } + public override string Subject => FallbackImpl.Subject; - public override string GetIssuerName (bool legacyV1Mode) - { - return FallbackImpl.GetIssuerName (legacyV1Mode); - } + public override string Issuer => FallbackImpl.Issuer; - public override DateTime GetValidFrom () - { - return FallbackImpl.GetValidFrom (); - } + public override string LegacySubject => FallbackImpl.LegacySubject; - public override DateTime GetValidUntil () - { - return FallbackImpl.GetValidUntil (); - } + public override string LegacyIssuer => FallbackImpl.LegacyIssuer; - public override string GetKeyAlgorithm () - { - return FallbackImpl.GetKeyAlgorithm (); - } + public override DateTime NotAfter => FallbackImpl.NotAfter; - public override byte[] GetKeyAlgorithmParameters () - { - return FallbackImpl.GetKeyAlgorithmParameters (); - } + public override DateTime NotBefore => FallbackImpl.NotBefore; - public override byte[] GetPublicKey () - { - return FallbackImpl.GetPublicKey (); - } + public override string KeyAlgorithm => FallbackImpl.KeyAlgorithm; - public override byte[] GetSerialNumber () - { - return FallbackImpl.GetSerialNumber (); - } + public override byte[] KeyAlgorithmParameters => FallbackImpl.KeyAlgorithmParameters; - public override byte[] Export (X509ContentType contentType, byte[] password) + public override byte[] PublicKeyValue => FallbackImpl.PublicKeyValue; + + public override byte[] SerialNumber => FallbackImpl.SerialNumber; + + public override byte[] Export (X509ContentType contentType, SafePasswordHandle password) { ThrowIfContextInvalid (); switch (contentType) { case X509ContentType.Cert: - return GetRawCertData (); + return RawData; case X509ContentType.Pfx: // this includes Pkcs12 // TODO throw new NotSupportedException (); @@ -163,28 +157,6 @@ namespace System.Security.Cryptography.X509Certificates } } - public override string ToString (bool full) - { - ThrowIfContextInvalid (); - - if (!full || fallback == null) { - var summary = GetSubjectSummary (); - return string.Format ("[X509Certificate: {0}]", summary); - } - - string nl = Environment.NewLine; - StringBuilder sb = new StringBuilder (); - sb.AppendFormat ("[Subject]{0} {1}{0}{0}", nl, GetSubjectName (false)); - - sb.AppendFormat ("[Issuer]{0} {1}{0}{0}", nl, GetIssuerName (false)); - sb.AppendFormat ("[Not Before]{0} {1}{0}{0}", nl, GetValidFrom ().ToLocalTime ()); - sb.AppendFormat ("[Not After]{0} {1}{0}{0}", nl, GetValidUntil ().ToLocalTime ()); - sb.AppendFormat ("[Thumbprint]{0} {1}{0}", nl, X509Helper.ToHexString (GetCertHash ())); - - sb.Append (nl); - return sb.ToString (); - } - protected override void Dispose (bool disposing) { if (handle != IntPtr.Zero){ diff --git a/mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/CSharpCodeDomGenerator.cs b/mcs/class/System/Mono.AppleTls/X509PalImpl.Apple.cs similarity index 53% rename from mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/CSharpCodeDomGenerator.cs rename to mcs/class/System/Mono.AppleTls/X509PalImpl.Apple.cs index 4b1ed349a1..19e28bc1db 100644 --- a/mcs/class/System.Data.Linq/src/DbMetal/Generator/Implementation/CodeDomGenerator/CSharpCodeDomGenerator.cs +++ b/mcs/class/System/Mono.AppleTls/X509PalImpl.Apple.cs @@ -1,49 +1,60 @@ -#region MIT license -// -// MIT license -// -// Copyright (c) 2007-2008 Jiri Moudry, Pascal Craponne -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -#endregion - -using System.CodeDom.Compiler; -using System.IO; -using DbLinq.Schema.Dbml; -using Microsoft.CSharp; - -namespace DbMetal.Generator.Implementation.CodeDomGenerator -{ -#if !MONO_STRICT - public -#endif - class CSharpCodeDomGenerator: AbstractCodeDomGenerator - { - public override string LanguageCode { get { return "C#2"; } } - public override string Extension { get { return ".cs2"; } } - - public override void Write(TextWriter textWriter, Database dbSchema, GenerationContext context) - { - new CSharpCodeProvider().CreateGenerator(textWriter).GenerateCodeFromNamespace(GenerateCodeDomModel(dbSchema), textWriter, - new CodeGeneratorOptions() { BracingStyle = "C" }); - } - - } -} +// +// X509PalImpl.Apple.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2018 Xamarin, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +#if MONO_FEATURE_APPLETLS || MONO_FEATURE_APPLE_X509 +using System; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using Microsoft.Win32.SafeHandles; +using XamMac.CoreFoundation; + +namespace Mono.AppleTls +{ + class X509PalImplApple : X509PalImpl + { + public override X509CertificateImpl Import (byte[] data) + { + data = ConvertData (data); + + var handle = CFHelpers.CreateCertificateFromData (data); + if (handle != IntPtr.Zero) + return new X509CertificateImplApple (handle, true); + + return null; + } + + public override X509Certificate2Impl Import ( + byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + return null; + } + + public override X509Certificate2Impl Import (X509Certificate cert) + { + return null; + } + } +} +#endif diff --git a/mcs/class/System/Mono.Btls/MonoBtlsContext.cs b/mcs/class/System/Mono.Btls/MonoBtlsContext.cs index 40020f9968..7dd92ae95e 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsContext.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsContext.cs @@ -35,6 +35,7 @@ using System.Threading.Tasks; using System.Security.Cryptography.X509Certificates; using System.Security.Authentication; using System.Runtime.InteropServices; +using Microsoft.Win32.SafeHandles; #if MONO_SECURITY_ALIAS using MonoSecurity::Mono.Security.Interface; @@ -76,11 +77,13 @@ namespace Mono.Btls return (X509CertificateImplBtls)impl.Clone (); var password = Guid.NewGuid ().ToString (); - var buffer = certificate.Export (X509ContentType.Pfx, password); + using (var handle = new SafePasswordHandle (password)) { + var buffer = certificate.Export (X509ContentType.Pfx, password); - impl = new X509CertificateImplBtls (); - impl.Import (buffer, password, X509KeyStorageFlags.DefaultKeySet); - return impl; + impl = new X509CertificateImplBtls (); + impl.Import (buffer, handle, X509KeyStorageFlags.DefaultKeySet); + return impl; + } } new public MonoBtlsProvider Provider { diff --git a/mcs/class/System/Mono.Btls/MonoBtlsObject.cs b/mcs/class/System/Mono.Btls/MonoBtlsObject.cs index 19e72cbda6..f1b4fd7685 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsObject.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsObject.cs @@ -26,6 +26,7 @@ #if SECURITY_DEP && MONO_FEATURE_BTLS using System; using System.Threading; +using System.Security.Cryptography; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; @@ -90,11 +91,10 @@ namespace Mono.Btls { if (!ok) { if (callerName != null) - throw new MonoBtlsException ("{0}.{1} failed.", GetType ().Name, callerName); + throw new CryptographicException ($"`{GetType ().Name}.{callerName}` failed."); else - throw new MonoBtlsException (); + throw new CryptographicException (); } - } protected void CheckError (int ret, [CallerMemberName] string callerName = null) @@ -110,10 +110,10 @@ namespace Mono.Btls string message; if (callerName != null) - message = string.Format ("Caught unhandled exception in {0}.{1}.", GetType ().Name, callerName); + message = $"Caught unhandled exception in `{GetType ().Name}.{callerName}`."; else - message = string.Format ("Caught unhandled exception."); - throw new MonoBtlsException (message, error); + message = "Caught unhandled exception."; + throw new CryptographicException (message, error); } [DllImport (BTLS_DYLIB)] diff --git a/mcs/class/System/Mono.Btls/MonoBtlsPkcs12.cs b/mcs/class/System/Mono.Btls/MonoBtlsPkcs12.cs index 92e432092b..fcd04c6e41 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsPkcs12.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsPkcs12.cs @@ -29,6 +29,7 @@ using System.IO; using System.Security.Cryptography.X509Certificates; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Microsoft.Win32.SafeHandles; namespace Mono.Btls { @@ -68,7 +69,7 @@ namespace Mono.Btls extern static int mono_btls_pkcs12_add_cert (IntPtr chain, IntPtr x509); [DllImport (BTLS_DYLIB)] - extern unsafe static int mono_btls_pkcs12_import (IntPtr chain, void* data, int len, IntPtr password); + extern unsafe static int mono_btls_pkcs12_import (IntPtr chain, void* data, int len, SafePasswordHandle password); [DllImport (BTLS_DYLIB)] extern static int mono_btls_pkcs12_has_private_key (IntPtr pkcs12); @@ -108,20 +109,12 @@ namespace Mono.Btls x509.Handle.DangerousGetHandle ()); } - public unsafe void Import (byte[] buffer, string password) + public unsafe void Import (byte[] buffer, SafePasswordHandle password) { - var passptr = IntPtr.Zero; - fixed (void* ptr = buffer) - try { - if (password != null) - passptr = Marshal.StringToHGlobalAnsi (password); + fixed (void* ptr = buffer) { var ret = mono_btls_pkcs12_import ( - Handle.DangerousGetHandle (), ptr, - buffer.Length, passptr); + Handle.DangerousGetHandle (), ptr, buffer.Length, password); CheckError (ret); - } finally { - if (passptr != IntPtr.Zero) - Marshal.FreeHGlobal (passptr); } } diff --git a/mcs/class/System/Mono.Btls/MonoBtlsProvider.cs b/mcs/class/System/Mono.Btls/MonoBtlsProvider.cs index 076e058425..d2323b0479 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsProvider.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsProvider.cs @@ -36,6 +36,7 @@ using System.Net.Security; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Security.Authentication; +using Microsoft.Win32.SafeHandles; #if MONO_SECURITY_ALIAS using MonoSecurity::Mono.Security.Interface; @@ -106,9 +107,8 @@ namespace Mono.Btls internal override X509Certificate2Impl GetNativeCertificate ( byte[] data, string password, X509KeyStorageFlags flags) { - var impl = new X509CertificateImplBtls (false); - impl.Import (data, password, flags); - return impl; + using (var handle = new SafePasswordHandle (password)) + return GetNativeCertificate (data, handle, flags); } internal override X509Certificate2Impl GetNativeCertificate ( @@ -122,6 +122,14 @@ namespace Mono.Btls return new X509CertificateImplBtls (data, MonoBtlsX509Format.DER, false); } + internal X509Certificate2Impl GetNativeCertificate ( + byte[] data, SafePasswordHandle password, X509KeyStorageFlags flags) + { + var impl = new X509CertificateImplBtls (false); + impl.Import (data, password, flags); + return impl; + } + internal static MonoBtlsX509VerifyParam GetVerifyParam (MonoTlsSettings settings, string targetHost, bool serverMode) { MonoBtlsX509VerifyParam param; @@ -428,8 +436,9 @@ namespace Mono.Btls public static X509Certificate2 CreateCertificate2 (byte[] data, string password, bool disallowFallback = false) { - using (var impl = new X509CertificateImplBtls (disallowFallback)) { - impl.Import (data, password, X509KeyStorageFlags.DefaultKeySet); + using (var impl = new X509CertificateImplBtls (disallowFallback)) + using (var handle = new SafePasswordHandle (password)) { + impl.Import (data, handle, X509KeyStorageFlags.DefaultKeySet); return new X509Certificate2 (impl); } } diff --git a/mcs/class/System/Mono.Btls/MonoBtlsUtils.cs b/mcs/class/System/Mono.Btls/MonoBtlsUtils.cs index 4175968195..f0041ae045 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsUtils.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsUtils.cs @@ -112,6 +112,9 @@ namespace Mono.Btls case MonoBtlsX509NameEntryType.Initial: sb.Append ("I="); break; + case MonoBtlsX509NameEntryType.SerialNumber: + sb.Append ("SERIALNUMBER="); + break; default: // unknown OID sb.Append ("OID."); // NOTE: Not present as RFC2253 diff --git a/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs b/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs index 29bfb5bbfd..0b170e2775 100644 --- a/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs +++ b/mcs/class/System/Mono.Btls/X509CertificateImplBtls.cs @@ -23,7 +23,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if SECURITY_DEP && MONO_FEATURE_BTLS +#if MONO_FEATURE_BTLS #if MONO_SECURITY_ALIAS extern alias MonoSecurity; #endif @@ -40,7 +40,9 @@ using System.Collections; using System.Security; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; +using System.Runtime.InteropServices; using Mono.Security.Cryptography; +using Microsoft.Win32.SafeHandles; namespace Mono.Btls { @@ -133,105 +135,34 @@ namespace Mono.Btls return true; } - protected override byte[] GetCertHash (bool lazy) - { - return X509.GetCertHash (); - } + public override byte[] Thumbprint => X509.GetCertHash (); - public override byte[] GetRawCertData () - { - return X509.GetRawData (MonoBtlsX509Format.DER); - } + public override byte[] RawData => X509.GetRawData (MonoBtlsX509Format.DER); - public override string GetSubjectName (bool legacyV1Mode) - { - if (legacyV1Mode) - return SubjectName.Decode (X500DistinguishedNameFlags.None); - return SubjectName.Name; - } + public override string Subject => SubjectName.Name; - public override string GetIssuerName (bool legacyV1Mode) - { - if (legacyV1Mode) - return IssuerName.Decode (X500DistinguishedNameFlags.None); - return IssuerName.Name; - } + public override string Issuer => IssuerName.Name; - public override DateTime GetValidFrom () - { - return X509.GetNotBefore ().ToLocalTime (); - } + public override string LegacySubject => SubjectName.Decode (X500DistinguishedNameFlags.None); - public override DateTime GetValidUntil () - { - return X509.GetNotAfter ().ToLocalTime (); - } + public override string LegacyIssuer => IssuerName.Decode (X500DistinguishedNameFlags.None); - public override byte[] GetPublicKey () - { - return X509.GetPublicKeyData (); - } + public override DateTime NotBefore => X509.GetNotBefore ().ToLocalTime (); - public override byte[] GetSerialNumber () - { - return X509.GetSerialNumber (true); - } + public override DateTime NotAfter => X509.GetNotAfter ().ToLocalTime (); - public override string GetKeyAlgorithm () - { - return PublicKey.Oid.Value; - } + public override byte[] PublicKeyValue => X509.GetPublicKeyData (); - public override byte[] GetKeyAlgorithmParameters () - { - return PublicKey.EncodedParameters.RawData; - } + public override byte[] SerialNumber => X509.GetSerialNumber (true); - public override byte[] Export (X509ContentType contentType, byte[] password) - { - ThrowIfContextInvalid (); + public override string KeyAlgorithm => PublicKey.Oid.Value; - switch (contentType) { - case X509ContentType.Cert: - return GetRawCertData (); - case X509ContentType.Pfx: // this includes Pkcs12 - // TODO - throw new NotSupportedException (); - case X509ContentType.SerializedCert: - // TODO - throw new NotSupportedException (); - default: - string msg = Locale.GetText ("This certificate format '{0}' cannot be exported.", contentType); - throw new CryptographicException (msg); - } - } + public override byte[] KeyAlgorithmParameters => PublicKey.EncodedParameters.RawData; internal override X509CertificateImplCollection IntermediateCertificates { get { return intermediateCerts; } } - public override string ToString (bool full) - { - ThrowIfContextInvalid (); - - if (!full) { - var summary = GetSubjectName (false); - return string.Format ("[X509Certificate: {0}]", summary); - } - - string nl = Environment.NewLine; - StringBuilder sb = new StringBuilder (); - sb.AppendFormat ("[Subject]{0} {1}{0}{0}", nl, GetSubjectName (false)); - - sb.AppendFormat ("[Issuer]{0} {1}{0}{0}", nl, GetIssuerName (false)); - sb.AppendFormat ("[Not Before]{0} {1}{0}{0}", nl, GetValidFrom ().ToLocalTime ()); - sb.AppendFormat ("[Not After]{0} {1}{0}{0}", nl, GetValidUntil ().ToLocalTime ()); - sb.AppendFormat ("[Thumbprint]{0} {1}{0}", nl, X509Helper.ToHexString (GetCertHash ())); - - sb.Append (nl); - return sb.ToString (); - } - protected override void Dispose (bool disposing) { if (x509 != null) { @@ -250,7 +181,9 @@ namespace Mono.Btls throw new InvalidOperationException (); if (fallback != null) return; - fallback = X509Helper2.Import (GetRawCertData (), null, X509KeyStorageFlags.DefaultKeySet, true); + fallback = SystemDependencyProvider.Instance.CertificateProvider.Import ( + RawData, null, X509KeyStorageFlags.DefaultKeySet, + CertificateImportFlags.DisableNativeBackend); } internal override X509Certificate2Impl FallbackImpl { @@ -353,10 +286,10 @@ namespace Mono.Btls return FallbackImpl.GetNameInfo (nameType, forIssuer); } - public override void Import (byte[] data, string password, X509KeyStorageFlags keyStorageFlags) + public override void Import (byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) { Reset (); - if (password == null) { + if (password == null || password.IsInvalid) { try { Import (data); } catch (Exception e) { @@ -397,16 +330,17 @@ namespace Mono.Btls } } - void ImportPkcs12 (byte[] data, string password) + void ImportPkcs12 (byte[] data, SafePasswordHandle password) { using (var pkcs12 = new MonoBtlsPkcs12 ()) { - if (string.IsNullOrEmpty (password)) { + if (password == null || password.IsInvalid) { try { // Support both unencrypted PKCS#12.. pkcs12.Import (data, null); } catch { // ..and PKCS#12 encrypted with an empty password - pkcs12.Import (data, string.Empty); + using (var empty = new SafePasswordHandle (string.Empty)) + pkcs12.Import (data, empty); } } else { pkcs12.Import (data, password); @@ -429,13 +363,13 @@ namespace Mono.Btls } } - public override byte[] Export (X509ContentType contentType, string password) + public override byte[] Export (X509ContentType contentType, SafePasswordHandle password) { ThrowIfContextInvalid (); switch (contentType) { case X509ContentType.Cert: - return GetRawCertData (); + return RawData; case X509ContentType.Pfx: // this includes Pkcs12 return ExportPkcs12 (password); case X509ContentType.SerializedCert: @@ -447,6 +381,14 @@ namespace Mono.Btls } } + byte[] ExportPkcs12 (SafePasswordHandle password) + { + if (password == null || password.IsInvalid) + return ExportPkcs12 ((string)null); + var passwordString = password.Mono_DangerousGetString (); + return ExportPkcs12 (passwordString); + } + byte[] ExportPkcs12 (string password) { var pfx = new MX.PKCS12 (); @@ -457,10 +399,10 @@ namespace Mono.Btls attrs.Add (MX.PKCS9.localKeyId, localKeyId); if (password != null) pfx.Password = password; - pfx.AddCertificate (new MX.X509Certificate (GetRawCertData ()), attrs); + pfx.AddCertificate (new MX.X509Certificate (RawData), attrs); if (IntermediateCertificates != null) { for (int i = 0; i < IntermediateCertificates.Count; i++) - pfx.AddCertificate (new MX.X509Certificate (IntermediateCertificates [i].GetRawCertData ())); + pfx.AddCertificate (new MX.X509Certificate (IntermediateCertificates [i].RawData)); } var privateKey = PrivateKey; if (privateKey != null) diff --git a/mcs/class/System/Mono.Btls/X509PalImpl.Btls.cs b/mcs/class/System/Mono.Btls/X509PalImpl.Btls.cs new file mode 100644 index 0000000000..5b8a360f17 --- /dev/null +++ b/mcs/class/System/Mono.Btls/X509PalImpl.Btls.cs @@ -0,0 +1,74 @@ +// +// X509PalImpl.Btls.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2018 Xamarin, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +#if MONO_FEATURE_BTLS +#if MONO_SECURITY_ALIAS +extern alias MonoSecurity; +#endif + +#if MONO_SECURITY_ALIAS +using MonoSecurity::Mono.Security.Interface; +#else +using Mono.Security.Interface; +#endif + +using System; +using System.IO; +using System.Text; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using Microsoft.Win32.SafeHandles; + +namespace Mono.Btls +{ + class X509PalImplBtls : X509PalImpl + { + public X509PalImplBtls (MonoTlsProvider provider) + { + Provider = (MonoBtlsProvider)provider; + } + + MonoBtlsProvider Provider { + get; + } + + public override X509CertificateImpl Import (byte[] data) + { + return Provider.GetNativeCertificate (data, null, X509KeyStorageFlags.DefaultKeySet); + } + + public override X509Certificate2Impl Import ( + byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + return Provider.GetNativeCertificate (data, password, keyStorageFlags); + } + + public override X509Certificate2Impl Import (X509Certificate cert) + { + return Provider.GetNativeCertificate (cert); + } + } +} +#endif diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs index 295b96c7db..c38752e060 100644 --- a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs +++ b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs @@ -84,6 +84,8 @@ namespace Mono.Net.Security if (initialized) return; + SystemDependencyProvider.Initialize (); + InitializeProviderRegistration (); MSI.MonoTlsProvider provider; @@ -99,8 +101,6 @@ namespace Mono.Net.Security if (!providerCache.ContainsKey (provider.ID)) providerCache.Add (provider.ID, provider); - X509Helper2.Initialize (); - defaultProvider = provider; initialized = true; } @@ -112,9 +112,10 @@ namespace Mono.Net.Security if (initialized) throw new NotSupportedException ("TLS Subsystem already initialized."); + SystemDependencyProvider.Initialize (); + defaultProvider = LookupProvider (provider, true); - X509Helper2.Initialize (); initialized = true; } } diff --git a/mcs/class/System/Mono/SystemCertificateProvider.cs b/mcs/class/System/Mono/SystemCertificateProvider.cs new file mode 100644 index 0000000000..e3b0ac701d --- /dev/null +++ b/mcs/class/System/Mono/SystemCertificateProvider.cs @@ -0,0 +1,176 @@ +// +// SystemCertificateProvider.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2018 Xamarin, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +#if MONO_FEATURE_BTLS || MONO_FEATURE_APPLETLS +#if MONO_SECURITY_ALIAS +extern alias MonoSecurity; +#endif + +#if MONO_SECURITY_ALIAS +using MonoSecurity::Mono.Security.Interface; +#else +using Mono.Security.Interface; +#endif +using MNS = Mono.Net.Security; +#endif + +using System; +using System.Threading; +using System.Threading.Tasks; +using System.Security.Cryptography.X509Certificates; +using Microsoft.Win32.SafeHandles; + +namespace Mono +{ + class SystemCertificateProvider : ISystemCertificateProvider + { +#if MONO_FEATURE_BTLS || MONO_FEATURE_APPLETLS + public MonoTlsProvider Provider { + get { + EnsureInitialized (); + return provider; + } + } + + static MonoTlsProvider provider; +#endif + + static X509PalImpl GetX509Pal () + { +#if MONO_FEATURE_APPLETLS + if (provider?.ID == MNS.MonoTlsProviderFactory.AppleTlsId) + return new Mono.AppleTls.X509PalImplApple (); +#elif MONO_FEATURE_APPLE_X509 + return new Mono.AppleTls.X509PalImplApple (); +#endif +#if MONO_FEATURE_BTLS + if (provider?.ID == MNS.MonoTlsProviderFactory.BtlsId) + return new Mono.Btls.X509PalImplBtls (provider); +#endif + + return new X509PalImplMono (); + } + + static int initialized; + static X509PalImpl x509pal; + + static void EnsureInitialized () + { + /* + * We need to lazily initialize because we might be called from + * MonoTlsProviderFactory.InitializeInternal(). + * + */ + if (Interlocked.CompareExchange (ref initialized, 1, 0) != 0) + return; + +#if MONO_FEATURE_BTLS || MONO_FEATURE_APPLETLS + provider = MonoTlsProviderFactory.GetProvider (); +#endif + x509pal = GetX509Pal (); + } + + public X509PalImpl X509Pal { + get { + EnsureInitialized (); + return x509pal; + } + } + + public X509CertificateImpl Import ( + byte[] data, CertificateImportFlags importFlags = CertificateImportFlags.None) + { + if (data == null || data.Length == 0) + return null; + + X509CertificateImpl impl = null; + if ((importFlags & CertificateImportFlags.DisableNativeBackend) == 0) { + impl = X509Pal.Import (data); + if (impl != null) + return impl; + } + + if ((importFlags & CertificateImportFlags.DisableAutomaticFallback) != 0) + return null; + + return X509Pal.ImportFallback (data); + } + + X509CertificateImpl ISystemCertificateProvider.Import ( + byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags, + CertificateImportFlags importFlags) + { + return Import (data, password, keyStorageFlags, importFlags); + } + + public X509Certificate2Impl Import ( + byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags, + CertificateImportFlags importFlags = CertificateImportFlags.None) + { + if (data == null || data.Length == 0) + return null; + + X509Certificate2Impl impl = null; + if ((importFlags & CertificateImportFlags.DisableNativeBackend) == 0) { + impl = X509Pal.Import (data, password, keyStorageFlags); + if (impl != null) + return impl; + } + + if ((importFlags & CertificateImportFlags.DisableAutomaticFallback) != 0) + return null; + + return X509Pal.ImportFallback (data, password, keyStorageFlags); + } + + X509CertificateImpl ISystemCertificateProvider.Import (X509Certificate cert, CertificateImportFlags importFlags) + { + return Import (cert, importFlags); + } + + public X509Certificate2Impl Import ( + X509Certificate cert, CertificateImportFlags importFlags = CertificateImportFlags.None) + { + if (cert.Impl == null) + return null; + + X509Certificate2Impl impl = null; + if ((importFlags & CertificateImportFlags.DisableNativeBackend) == 0) { + impl = X509Pal.Import (cert); + if (impl != null) + return impl; + } + + impl = cert.Impl as X509Certificate2Impl; + if (impl != null) + return (X509Certificate2Impl)impl.Clone (); + + if ((importFlags & CertificateImportFlags.DisableAutomaticFallback) != 0) + return null; + + return X509Pal.ImportFallback (cert.GetRawCertData ()); + } + } +} diff --git a/mcs/class/System/Mono/SystemDependencyProvider.cs b/mcs/class/System/Mono/SystemDependencyProvider.cs new file mode 100644 index 0000000000..e3b4a80438 --- /dev/null +++ b/mcs/class/System/Mono/SystemDependencyProvider.cs @@ -0,0 +1,69 @@ +// +// SystemDependencyProvider.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2018 Xamarin, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.Threading; + +namespace Mono +{ + /* + * The purpose of this class is to allow code in `corlib.dll` to access `System.dll` APIs. + */ + class SystemDependencyProvider : ISystemDependencyProvider + { + static SystemDependencyProvider instance; + + public static SystemDependencyProvider Instance { + get { + Initialize (); + return instance; + } + } + + internal static void Initialize () + { + if (instance == null) + Interlocked.CompareExchange (ref instance, new SystemDependencyProvider (), null); + } + + ISystemCertificateProvider ISystemDependencyProvider.CertificateProvider => CertificateProvider; + + public SystemCertificateProvider CertificateProvider { + get; + } + + public X509PalImpl X509Pal => CertificateProvider.X509Pal; + + SystemDependencyProvider () + { + CertificateProvider = new SystemCertificateProvider (); + + /* + * Register ourselves with corlib's `DependencyInjector`. + */ + DependencyInjector.Register (this); + } + } +} diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/INativeCertificateHelper.cs b/mcs/class/System/Mono/X509Pal.cs similarity index 75% rename from mcs/class/corlib/System.Security.Cryptography.X509Certificates/INativeCertificateHelper.cs rename to mcs/class/System/Mono/X509Pal.cs index 2d56ac1564..9a8956d4b4 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/INativeCertificateHelper.cs +++ b/mcs/class/System/Mono/X509Pal.cs @@ -1,10 +1,10 @@ // -// INativeCertificateHelper.cs +// X509Pal.cs // // Author: -// Martin Baulig +// Martin Baulig // -// Copyright (c) 2016 Xamarin, Inc. +// Copyright (c) 2018 Xamarin, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -23,13 +23,16 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +using System; +using System.IO; +using System.Text; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; -namespace System.Security.Cryptography.X509Certificates +namespace Mono { - internal interface INativeCertificateHelper + static class X509Pal { - X509CertificateImpl Import (byte[] data, string password, X509KeyStorageFlags flags); - - X509CertificateImpl Import (X509Certificate cert); + public static X509PalImpl Instance => SystemDependencyProvider.Instance.X509Pal; } } diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeAccessRights.cs b/mcs/class/System/Mono/X509PalImpl.Mono.cs similarity index 56% rename from mcs/class/System.Core/System.IO.Pipes/PipeAccessRights.cs rename to mcs/class/System/Mono/X509PalImpl.Mono.cs index 96cbfd6367..d6044ba980 100644 --- a/mcs/class/System.Core/System.IO.Pipes/PipeAccessRights.cs +++ b/mcs/class/System/Mono/X509PalImpl.Mono.cs @@ -1,10 +1,10 @@ // -// PipeAccessRights.cs +// X509PalImpl.Mono.cs // -// Authors: -// Marek Safar +// Author: +// Martin Baulig // -// Copyright 2011 Xamarin Inc (http://www.xamarin.com). +// Copyright (c) 2018 Xamarin, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -23,33 +23,28 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -// -// +using System; +using System.Security.Cryptography.X509Certificates; +using Microsoft.Win32.SafeHandles; -namespace System.IO.Pipes +namespace Mono { - [Flags] - public enum PipeAccessRights + class X509PalImplMono : X509PalImpl { - ReadData = 1, - WriteData = 1 << 1, - CreateNewInstance = 1 << 2, - ReadExtendedAttributes = 1 << 3, - WriteExtendedAttributes = 1 << 4, - ReadAttributes = 1 << 7, - WriteAttributes = 1 << 8, + public override X509CertificateImpl Import (byte[] data) + { + return ImportFallback (data); + } - Delete = 1 << 16, - ReadPermissions = 1 << 17, - ChangePermissions = 1 << 18, - TakeOwnership = 1 << 19, - Synchronize = 1 << 20, + public override X509Certificate2Impl Import ( + byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + return ImportFallback (data, password, keyStorageFlags); + } - AccessSystemSecurity = 1 << 24, - - Read = ReadData | ReadAttributes | ReadExtendedAttributes | ReadPermissions, - Write = WriteData | WriteAttributes | WriteExtendedAttributes, - ReadWrite = Read | Write, - FullControl = ReadWrite | CreateNewInstance | Delete | ChangePermissions | TakeOwnership | Synchronize + public override X509Certificate2Impl Import (X509Certificate cert) + { + return null; + } } } diff --git a/mcs/class/System/Mono/X509PalImpl.cs b/mcs/class/System/Mono/X509PalImpl.cs new file mode 100644 index 0000000000..e9656ce0ae --- /dev/null +++ b/mcs/class/System/Mono/X509PalImpl.cs @@ -0,0 +1,88 @@ +// +// X509PalImpl.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2018 Xamarin, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.IO; +using System.Text; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using Microsoft.Win32.SafeHandles; + +namespace Mono +{ + abstract class X509PalImpl + { + public abstract X509CertificateImpl Import (byte[] data); + + public abstract X509Certificate2Impl Import ( + byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags); + + public abstract X509Certificate2Impl Import (X509Certificate cert); + + static byte[] PEM (string type, byte[] data) + { + string pem = Encoding.ASCII.GetString (data); + string header = String.Format ("-----BEGIN {0}-----", type); + string footer = String.Format ("-----END {0}-----", type); + int start = pem.IndexOf (header) + header.Length; + int end = pem.IndexOf (footer, start); + string base64 = pem.Substring (start, (end - start)); + return Convert.FromBase64String (base64); + } + + protected static byte[] ConvertData (byte[] data) + { + if (data == null || data.Length == 0) + return data; + + // does it looks like PEM ? + if (data[0] != 0x30) { + try { + return PEM ("CERTIFICATE", data); + } catch { + // let the implementation take care of it. + } + } + return data; + } + + internal X509Certificate2Impl ImportFallback (byte[] data) + { + data = ConvertData (data); + + var impl = new X509Certificate2ImplMono (); + using (var handle = new SafePasswordHandle ((string)null)) + impl.Import (data, handle, X509KeyStorageFlags.DefaultKeySet); + return impl; + } + + internal X509Certificate2Impl ImportFallback (byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) + { + var impl = new X509Certificate2ImplMono (); + impl.Import (data, password, keyStorageFlags); + return impl; + } + } +} diff --git a/mcs/class/System/ReferenceSources/CAPI.cs b/mcs/class/System/ReferenceSources/CAPI.cs deleted file mode 100644 index 9a8d89fab4..0000000000 --- a/mcs/class/System/ReferenceSources/CAPI.cs +++ /dev/null @@ -1,160 +0,0 @@ -namespace System.Security.Cryptography { - - static class CAPI { - // OID key type. - internal const uint CRYPT_OID_INFO_OID_KEY = 1; - internal const uint CRYPT_OID_INFO_NAME_KEY = 2; - internal const uint CRYPT_OID_INFO_ALGID_KEY = 3; - internal const uint CRYPT_OID_INFO_SIGN_KEY = 4; - - public static string CryptFindOIDInfoNameFromKey (string key, OidGroup oidGroup) - { - // TODO: incomplete - // TODO: oidGroup is ignored - switch (key) { - case "1.2.840.113549.1.1.5": - case "1.3.14.3.2.29": - case "1.3.14.3.2.15": - return "sha1RSA"; - case "1.2.840.113549.1.1.4": - case "1.3.14.3.2.3": - return "md5RSA"; - case "1.2.840.10040.4.3": - case "1.3.14.3.2.13": - return "sha1DSA"; - case "1.2.840.113549.1.1.2": - case "1.3.14.7.2.3.1": - return "md2RSA"; - case "1.2.840.113549.1.1.3": - return "md4RSA"; - case "1.3.14.3.2.27": - return "dsaSHA1"; - case "2.16.840.1.101.2.1.1.19": - return "mosaicUpdatedSig"; - case "1.3.14.3.2.26": - return "sha1"; - case "1.2.840.113549.2.5": - return "md5"; - case "2.16.840.1.101.3.4.2.1": - return "sha256"; - case "2.16.840.1.101.3.4.2.2": - return "sha384"; - case "2.16.840.1.101.3.4.2.3": - return "sha512"; - case "1.2.840.113549.1.1.11": - return "sha256RSA"; - case "1.2.840.113549.1.1.12": - return "sha384RSA"; - case "1.2.840.113549.1.1.13": - return "sha512RSA"; - case "1.2.840.113549.1.1.10": - return "RSASSA-PSS"; - case "1.2.840.10045.4.1": - return "sha1ECDSA"; - case "1.2.840.10045.4.3.2": - return "sha256ECDSA"; - case "1.2.840.10045.4.3.3": - return "sha384ECDSA"; - case "1.2.840.10045.4.3.4": - return "sha512ECDSA"; - case "1.2.840.10045.4.3": - return "specifiedECDSA"; - case "1.2.840.113549.1.1.1": - return "RSA"; - case "1.2.840.113549.1.7.1": - return "PKCS 7 Data"; - case "1.2.840.113549.1.9.3": - return "Content Type"; - case "1.2.840.113549.1.9.4": - return "Message Digest"; - case "1.2.840.113549.1.9.5": - return "Signing Time"; - case "1.2.840.113549.3.7": - return "3des"; - case "2.5.29.17": - return "Subject Alternative Name"; - case "2.16.840.1.101.3.4.1.2": - return "aes128"; - case "2.16.840.1.101.3.4.1.42": - return "aes256"; - case "2.16.840.1.113730.1.1": - return "Netscape Cert Type"; - } - - return null; - } - - public static string CryptFindOIDInfoKeyFromName (string name, OidGroup oidGroup) - { - // TODO: incomplete - // TODO: oidGroup is ignored - switch(name) { - case "sha1RSA": - return "1.2.840.113549.1.1.5"; - case "md5RSA": - return "1.2.840.113549.1.1.4"; - case "sha1DSA": - return "1.2.840.10040.4.3"; - case "shaRSA": - return "1.3.14.3.2.29"; - case "md2RSA": - return "1.2.840.113549.1.1.2"; - case "md4RSA": - return "1.2.840.113549.1.1.3"; - case "dsaSHA1": - return "1.3.14.3.2.27"; - case "mosaicUpdatedSig": - return "2.16.840.1.101.2.1.1.19"; - case "sha1": - return "1.3.14.3.2.26"; - case "md5": - return "1.2.840.113549.2.5"; - case "sha256": - return "2.16.840.1.101.3.4.2.1"; - case "sha384": - return "2.16.840.1.101.3.4.2.2"; - case "sha512": - return "2.16.840.1.101.3.4.2.3"; - case "sha256RSA": - return "1.2.840.113549.1.1.11"; - case "sha384RSA": - return "1.2.840.113549.1.1.12"; - case "sha512RSA": - return "1.2.840.113549.1.1.13"; - case "RSASSA-PSS": - return "1.2.840.113549.1.1.10"; - case "sha1ECDSA": - return "1.2.840.10045.4.1"; - case "sha256ECDSA": - return "1.2.840.10045.4.3.2"; - case "sha384ECDSA": - return "1.2.840.10045.4.3.3"; - case "sha512ECDSA": - return "1.2.840.10045.4.3.4"; - case "specifiedECDSA": - return "1.2.840.10045.4.3"; - case "RSA": - return "1.2.840.113549.1.1.1"; - case "PKCS 7 Data": - return "1.2.840.113549.1.7.1"; - case "Content Type": - return "1.2.840.113549.1.9.3"; - case "Message Digest": - return "1.2.840.113549.1.9.4"; - case "Signing Time": - return "1.2.840.113549.1.9.5"; - case "3des": - return "1.2.840.113549.3.7"; - case "Subject Alternative Name": - return "2.5.29.17"; - case "aes128": - return "2.16.840.1.101.3.4.1.2"; - case "aes256": - return "2.16.840.1.101.3.4.1.42"; - case "Netscape Cert Type": - return "2.16.840.1.113730.1.1"; - } - return null; - } - } -} \ No newline at end of file diff --git a/mcs/class/System/ReferenceSources/SR.cs.REMOVED.git-id b/mcs/class/System/ReferenceSources/SR.cs.REMOVED.git-id deleted file mode 100644 index e1a2805522..0000000000 --- a/mcs/class/System/ReferenceSources/SR.cs.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4c1d88b51c1ca6902aa3ee4c56a4bbf6c7ac20c6 \ No newline at end of file diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs b/mcs/class/System/System.Net.NetworkInformation/IPGlobalPropertiesFactory.cs similarity index 58% rename from mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs rename to mcs/class/System/System.Net.NetworkInformation/IPGlobalPropertiesFactory.cs index 97476d28f8..82d343d471 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs +++ b/mcs/class/System/System.Net.NetworkInformation/IPGlobalPropertiesFactory.cs @@ -1,11 +1,15 @@ // -// SubjectIdentifierOrKey.cs - System.Security.Cryptography.Pkcs.SubjectIdentifierOrKey +// System.Net.NetworkInformation.IPGlobalProperties // -// Author: -// Sebastien Pouliot +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Miguel de Icaza (miguel@novell.com) +// Eric Butler (eric@extremeboredom.net) +// Marek Habersack (mhabersack@novell.com) +// Marek Safar (marek.safar@gmail.com) // -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell Inc. (http://www.novell.com) +// Copyright (c) 2006-2008 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -26,32 +30,21 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // - - -using System; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class SubjectIdentifierOrKey { - - private SubjectIdentifierOrKeyType _type; - private object _value; - - internal SubjectIdentifierOrKey (SubjectIdentifierOrKeyType type, object value) +namespace System.Net.NetworkInformation { + internal static class IPGlobalPropertiesFactoryPal { + public static IPGlobalProperties Create () { - _type = type; - _value = value; - } + var instance = UnixIPGlobalPropertiesFactoryPal.Create (); - // properties +#if WIN_PLATFORM + if (instance == null) + instance = Win32IPGlobalPropertiesFactoryPal.Create (); +#endif - public SubjectIdentifierOrKeyType Type { - get { return _type; } - } + if (instance == null) + throw new NotImplementedException (); - public object Value { - get { return _value; } + return instance; } } } - diff --git a/mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs deleted file mode 100644 index bcae621e00..0000000000 --- a/mcs/class/System/System.Net.NetworkInformation/IPInterfaceProperties.cs +++ /dev/null @@ -1,484 +0,0 @@ -// -// System.Net.NetworkInformation.IPInterfaceProperties -// -// Authors: -// Gonzalo Paniagua Javier (gonzalo@novell.com) -// Atsushi Enomoto (atsushi@ximian.com) -// -// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Net.Sockets; -using System.Runtime.CompilerServices; -using System.Text.RegularExpressions; -using System.Runtime.InteropServices; - -namespace System.Net.NetworkInformation { - abstract class UnixIPInterfaceProperties : IPInterfaceProperties - { - protected IPv4InterfaceProperties ipv4iface_properties; - protected UnixNetworkInterface iface; - List addresses; - IPAddressCollection dns_servers; - - public UnixIPInterfaceProperties (UnixNetworkInterface iface, List addresses) - { - this.iface = iface; - this.addresses = addresses; - } - - public override IPv6InterfaceProperties GetIPv6Properties () - { - throw new NotImplementedException (); - } -#if MONODROID - [DllImport ("__Internal")] - static extern int _monodroid_get_dns_servers (out IntPtr dns_servers_array); - - void GetDNSServersFromOS () - { - IntPtr dsa; - int len = _monodroid_get_dns_servers (out dsa); - if (len <= 0) - return; - - var servers = new IntPtr [len]; - Marshal.Copy (dsa, servers, 0, len); - - dns_servers = new IPAddressCollection (); - foreach (IntPtr s in servers) { - string server_ip = Marshal.PtrToStringAnsi (s); - Marshal.FreeHGlobal (s); - - IPAddress addr; - if (!IPAddress.TryParse (server_ip, out addr)) - continue; - dns_servers.InternalAdd (addr); - } - Marshal.FreeHGlobal (dsa); - } -#else - static Regex ns = new Regex (@"\s*nameserver\s+(?
.*)"); - static Regex search = new Regex (@"\s*search\s+(?.*)"); - - string dns_suffix; - DateTime last_parse; - - void ParseResolvConf () - { - try { - DateTime wt = File.GetLastWriteTime ("/etc/resolv.conf"); - if (wt <= last_parse) - return; - - last_parse = wt; - dns_suffix = ""; - dns_servers = new IPAddressCollection (); - using (StreamReader reader = new StreamReader ("/etc/resolv.conf")) { - string str; - string line; - while ((line = reader.ReadLine ()) != null) { - line = line.Trim (); - if (line.Length == 0 || line [0] == '#') - continue; - Match match = ns.Match (line); - if (match.Success) { - try { - str = match.Groups ["address"].Value; - str = str.Trim (); - dns_servers.InternalAdd (IPAddress.Parse (str)); - } catch { - } - } else { - match = search.Match (line); - if (match.Success) { - str = match.Groups ["domain"].Value; - string [] parts = str.Split (','); - dns_suffix = parts [0].Trim (); - } - } - } - } - } catch { - } - } -#endif - public override IPAddressInformationCollection AnycastAddresses { - get { - var c = new IPAddressInformationCollection (); - foreach (IPAddress address in addresses) { - c.InternalAdd (new SystemIPAddressInformation (address, false, false)); - } - return c; - } - } - - [MonoTODO ("Always returns an empty collection.")] - public override IPAddressCollection DhcpServerAddresses { - get { - // There are lots of different DHCP clients - // that all store their configuration differently. - // I'm not sure what to do here. - IPAddressCollection coll = new IPAddressCollection (); - return coll; - } - } - - public override IPAddressCollection DnsAddresses { - get { -#if MONODROID - GetDNSServersFromOS (); -#else - ParseResolvConf (); -#endif - return dns_servers; - } - } - - public override string DnsSuffix { - get { -#if MONODROID - return String.Empty; -#else - ParseResolvConf (); - return dns_suffix; -#endif - } - } - - [MonoTODO ("Always returns true")] - public override bool IsDnsEnabled { - get { - return true; - } - } - - [MonoTODO ("Always returns false")] - public override bool IsDynamicDnsEnabled { - get { - return false; - } - } - - public override MulticastIPAddressInformationCollection MulticastAddresses { - get { - var multicastAddresses = new MulticastIPAddressInformationCollection (); - foreach (IPAddress address in addresses) { - byte[] addressBytes = address.GetAddressBytes (); - if (addressBytes[0] >= 224 && addressBytes[0] <= 239) { - multicastAddresses.InternalAdd (new SystemMulticastIPAddressInformation (new SystemIPAddressInformation (address, true, false))); - } - } - return multicastAddresses; - } - } - - public override UnicastIPAddressInformationCollection UnicastAddresses { - get { - var unicastAddresses = new UnicastIPAddressInformationCollection (); - foreach (IPAddress address in addresses) { - switch (address.AddressFamily) { - case AddressFamily.InterNetwork: - byte top = address.GetAddressBytes () [0]; - if (top >= 224 && top <= 239) - continue; - unicastAddresses.InternalAdd (new LinuxUnicastIPAddressInformation (address)); - break; - - case AddressFamily.InterNetworkV6: - if (address.IsIPv6Multicast) - continue; - unicastAddresses.InternalAdd (new LinuxUnicastIPAddressInformation (address)); - break; - } - } - return unicastAddresses; - } - } - - [MonoTODO ("Always returns an empty collection.")] - public override IPAddressCollection WinsServersAddresses { - get { - // I do SUPPOSE we could scrape /etc/samba/smb.conf, but.. yeesh. - return new IPAddressCollection (); - } - } - } - - class LinuxIPInterfaceProperties : UnixIPInterfaceProperties - { - public LinuxIPInterfaceProperties (LinuxNetworkInterface iface, List addresses) - : base (iface, addresses) - { - } - - public override IPv4InterfaceProperties GetIPv4Properties () - { - if (ipv4iface_properties == null) - ipv4iface_properties = new LinuxIPv4InterfaceProperties (iface as LinuxNetworkInterface); - - return ipv4iface_properties; - } - - IPAddressCollection ParseRouteInfo (string iface) - { - var col = new IPAddressCollection (); - try { - using (StreamReader reader = new StreamReader ("/proc/net/route")) { - string line; - reader.ReadLine (); // Ignore first line - while ((line = reader.ReadLine ()) != null) { - line = line.Trim (); - if (line.Length == 0) - continue; - - string [] parts = line.Split ('\t'); - if (parts.Length < 3) - continue; - string gw_address = parts [2].Trim (); - byte [] ipbytes = new byte [4]; - if (gw_address.Length == 8 && iface.Equals (parts [0], StringComparison.OrdinalIgnoreCase)) { - for (int i = 0; i < 4; i++) { - if (!Byte.TryParse (gw_address.Substring (i * 2, 2), NumberStyles.HexNumber, null, out ipbytes [3 - i])) - continue; - } - IPAddress ip = new IPAddress (ipbytes); - if (!ip.Equals (IPAddress.Any) && !col.Contains (ip)) - col.InternalAdd (ip); - } - } - } - } catch { - } - - return col; - } - - public override GatewayIPAddressInformationCollection GatewayAddresses { - get { - return SystemGatewayIPAddressInformation.ToGatewayIpAddressInformationCollection (ParseRouteInfo (this.iface.Name.ToString())); - } - } - } - - class MacOsIPInterfaceProperties : UnixIPInterfaceProperties - { - public MacOsIPInterfaceProperties (MacOsNetworkInterface iface, List addresses) - : base (iface, addresses) - { - } - - public override IPv4InterfaceProperties GetIPv4Properties () - { - if (ipv4iface_properties == null) - ipv4iface_properties = new MacOsIPv4InterfaceProperties (iface as MacOsNetworkInterface); - - return ipv4iface_properties; - } - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern static bool ParseRouteInfo_internal(string iface, out string[] gw_addr_list); - - public override GatewayIPAddressInformationCollection GatewayAddresses { - get { - var gateways = new IPAddressCollection (); - string[] gw_addrlist; - if (!ParseRouteInfo_internal (this.iface.Name.ToString(), out gw_addrlist)) - return new GatewayIPAddressInformationCollection (); - - for(int i=0; i addresses) + : base (iface, addresses) + { + } + + public override IPv4InterfaceProperties GetIPv4Properties () + { + if (ipv4iface_properties == null) + ipv4iface_properties = new LinuxIPv4InterfaceProperties (iface as LinuxNetworkInterface); + + return ipv4iface_properties; + } + + IPAddressCollection ParseRouteInfo (string iface) + { + var col = new IPAddressCollection (); + try { + using (StreamReader reader = new StreamReader ("/proc/net/route")) { + string line; + reader.ReadLine (); // Ignore first line + while ((line = reader.ReadLine ()) != null) { + line = line.Trim (); + if (line.Length == 0) + continue; + + string [] parts = line.Split ('\t'); + if (parts.Length < 3) + continue; + string gw_address = parts [2].Trim (); + byte [] ipbytes = new byte [4]; + if (gw_address.Length == 8 && iface.Equals (parts [0], StringComparison.OrdinalIgnoreCase)) { + for (int i = 0; i < 4; i++) { + if (!Byte.TryParse (gw_address.Substring (i * 2, 2), NumberStyles.HexNumber, null, out ipbytes [3 - i])) + continue; + } + IPAddress ip = new IPAddress (ipbytes); + if (!ip.Equals (IPAddress.Any) && !col.Contains (ip)) + col.InternalAdd (ip); + } + } + } + } catch { + } + + return col; + } + + public override GatewayIPAddressInformationCollection GatewayAddresses { + get { + return SystemGatewayIPAddressInformation.ToGatewayIpAddressInformationCollection (ParseRouteInfo (this.iface.Name.ToString())); + } + } + } +} diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeAuditRule.cs b/mcs/class/System/System.Net.NetworkInformation/LinuxIPv4InterfaceProperties.cs similarity index 51% rename from mcs/class/System.Core/System.IO.Pipes/PipeAuditRule.cs rename to mcs/class/System/System.Net.NetworkInformation/LinuxIPv4InterfaceProperties.cs index 5fe9dc8981..e7fa653e8e 100644 --- a/mcs/class/System.Core/System.IO.Pipes/PipeAuditRule.cs +++ b/mcs/class/System/System.Net.NetworkInformation/LinuxIPv4InterfaceProperties.cs @@ -1,10 +1,12 @@ // -// PipeAuditRule.cs +// System.Net.NetworkInformation.IPv4InterfaceProperties // -// Author: -// Atsushi Enomoto +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Marek Habersack (mhabersack@novell.com) // -// Copyright (C) 2009 Novell, Inc. http://www.novell.com +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -25,31 +27,47 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System; using System.IO; -using System.Linq; -using System.Security.AccessControl; -using System.Security.Permissions; -using System.Security.Principal; -namespace System.IO.Pipes -{ - [HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort = true)] - public sealed class PipeAuditRule : AuditRule +namespace System.Net.NetworkInformation { + sealed class LinuxIPv4InterfaceProperties : UnixIPv4InterfaceProperties { - public PipeAuditRule (IdentityReference identity, PipeAccessRights rights, AuditFlags flags) - : base (identity, (int)rights, false, InheritanceFlags.None, PropagationFlags.None, flags) + public LinuxIPv4InterfaceProperties (LinuxNetworkInterface iface) + : base (iface) { } - public PipeAuditRule (string identity, PipeAccessRights rights, AuditFlags flags) - : this (new NTAccount (identity), rights, flags) - { + public override bool IsForwardingEnabled { + get { + string iface_path = "/proc/sys/net/ipv4/conf/" + iface.Name + "/forwarding"; + + if (File.Exists (iface_path)) { + string val = LinuxNetworkInterface.ReadLine (iface_path); + + return val != "0"; + } + + return false; + } } - public PipeAccessRights PipeAccessRights { - get { return (PipeAccessRights)AccessMask; } + public override int Mtu { + get { + string iface_path = (iface as LinuxNetworkInterface).IfacePath + "mtu"; + int ret = 0; + + if (File.Exists (iface_path)) { + string val = LinuxNetworkInterface.ReadLine (iface_path); + + try { + ret = Int32.Parse (val); + } catch { + } + } + + return ret; + + } } } } - diff --git a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/LinuxIPv4InterfaceStatistics.cs similarity index 56% rename from mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceStatistics.cs rename to mcs/class/System/System.Net.NetworkInformation/LinuxIPv4InterfaceStatistics.cs index 5554131865..c5177a824d 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceStatistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/LinuxIPv4InterfaceStatistics.cs @@ -28,71 +28,10 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace System.Net.NetworkInformation { -#if WIN_PLATFORM - class Win32IPv4InterfaceStatistics : IPv4InterfaceStatistics - { - Win32_MIB_IFROW info; - - public Win32IPv4InterfaceStatistics (Win32_MIB_IFROW info) - { - this.info = info; - } - - public override long BytesReceived { - get { return info.InOctets; } - } - - public override long BytesSent { - get { return info.OutOctets; } - } - - public override long IncomingPacketsDiscarded { - get { return info.InDiscards; } - } - - public override long IncomingPacketsWithErrors { - get { return info.InErrors; } - } - - public override long IncomingUnknownProtocolPackets { - get { return info.InUnknownProtos; } - } - - public override long NonUnicastPacketsReceived { - get { return info.InNUcastPkts; } - } - - public override long NonUnicastPacketsSent { - get { return info.OutNUcastPkts; } - } - - public override long OutgoingPacketsDiscarded { - get { return info.OutDiscards; } - } - - public override long OutgoingPacketsWithErrors { - get { return info.OutErrors; } - } - - public override long OutputQueueLength { - get { return info.OutQLen; } - } - - public override long UnicastPacketsReceived { - get { return info.InUcastPkts; } - } - - public override long UnicastPacketsSent { - get { return info.OutUcastPkts; } - } - - } -#endif - class LinuxIPv4InterfaceStatistics : IPv4InterfaceStatistics { LinuxNetworkInterface linux; - + public LinuxIPv4InterfaceStatistics (LinuxNetworkInterface parent) { linux = parent; @@ -106,7 +45,7 @@ namespace System.Net.NetworkInformation { return 0; } } - + public override long BytesReceived { get { return Read ("statistics/rx_bytes"); @@ -182,65 +121,4 @@ namespace System.Net.NetworkInformation { } } } - - // dummy class - class MacOsIPv4InterfaceStatistics : IPv4InterfaceStatistics - { - //MacOsNetworkInterface macos; - - public MacOsIPv4InterfaceStatistics (MacOsNetworkInterface parent) - { - //macos = parent; - } - - public override long BytesReceived { - get { return 0; } - } - - public override long BytesSent { - get { return 0; } - } - - public override long IncomingPacketsDiscarded { - get { return 0; } - } - - public override long IncomingPacketsWithErrors { - get { return 0; } - } - - public override long IncomingUnknownProtocolPackets { - get { return 0; } - } - - public override long NonUnicastPacketsReceived { - get { return 0; } - } - - public override long NonUnicastPacketsSent { - get { return 0; } - } - - public override long OutgoingPacketsDiscarded { - get { return 0; } - } - - public override long OutgoingPacketsWithErrors { - get { return 0; } - } - - public override long OutputQueueLength { - get { return 0; } - } - - public override long UnicastPacketsReceived { - get { return 0; } - } - - public override long UnicastPacketsSent { - get { return 0; } - } - } - } - diff --git a/mcs/class/System/System.Net.NetworkInformation/LinuxNetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/LinuxNetworkInterface.cs new file mode 100644 index 0000000000..218ad9887b --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/LinuxNetworkInterface.cs @@ -0,0 +1,385 @@ +// +// System.Net.NetworkInformation.NetworkInterface +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Miguel de Icaza (miguel@novell.com) +// Eric Butler (eric@extremeboredom.net) +// Marek Habersack (mhabersack@novell.com) +// Marek Safar (marek.safar@gmail.com) +// +// Copyright (c) 2006-2008 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.IO; +using System.Globalization; + +namespace System.Net.NetworkInformation { + + internal class LinuxNetworkInterfaceAPI : UnixNetworkInterfaceAPI + { + const int AF_INET = 2; + const int AF_INET6 = 10; + const int AF_PACKET = 17; + + static void FreeInterfaceAddresses (IntPtr ifap) + { +#if MONODROID + AndroidPlatform.FreeInterfaceAddresses (ifap); +#else + freeifaddrs (ifap); +#endif + } + + static int GetInterfaceAddresses (out IntPtr ifap) + { +#if MONODROID + return AndroidPlatform.GetInterfaceAddresses (out ifap); +#else + return getifaddrs (out ifap); +#endif + } + + public override NetworkInterface [] GetAllNetworkInterfaces () + { + + var interfaces = new Dictionary (); + IntPtr ifap; + if (GetInterfaceAddresses (out ifap) != 0) + throw new SystemException ("getifaddrs() failed"); + + try { + IntPtr next = ifap; + while (next != IntPtr.Zero) { + ifaddrs addr = (ifaddrs) Marshal.PtrToStructure (next, typeof (ifaddrs)); + IPAddress address = IPAddress.None; + string name = addr.ifa_name; + int index = -1; + byte[] macAddress = null; + NetworkInterfaceType type = NetworkInterfaceType.Unknown; + int nullNameCount = 0; + + if (addr.ifa_addr != IntPtr.Zero) { + sockaddr_in sockaddr = (sockaddr_in) Marshal.PtrToStructure (addr.ifa_addr, typeof (sockaddr_in)); + + if (sockaddr.sin_family == AF_INET6) { + sockaddr_in6 sockaddr6 = (sockaddr_in6) Marshal.PtrToStructure (addr.ifa_addr, typeof (sockaddr_in6)); + address = new IPAddress (sockaddr6.sin6_addr.u6_addr8, sockaddr6.sin6_scope_id); + } else if (sockaddr.sin_family == AF_INET) { + address = new IPAddress (sockaddr.sin_addr); + } else if (sockaddr.sin_family == AF_PACKET) { + sockaddr_ll sockaddrll = (sockaddr_ll) Marshal.PtrToStructure (addr.ifa_addr, typeof (sockaddr_ll)); + if (((int)sockaddrll.sll_halen) > sockaddrll.sll_addr.Length){ + next = addr.ifa_next; + continue; + } + + macAddress = new byte [(int) sockaddrll.sll_halen]; + Array.Copy (sockaddrll.sll_addr, 0, macAddress, 0, macAddress.Length); + index = sockaddrll.sll_ifindex; + + int hwtype = (int)sockaddrll.sll_hatype; + if (Enum.IsDefined (typeof (LinuxArpHardware), hwtype)) { + switch ((LinuxArpHardware)hwtype) { + case LinuxArpHardware.EETHER: + goto case LinuxArpHardware.ETHER; + + case LinuxArpHardware.ETHER: + type = NetworkInterfaceType.Ethernet; + break; + + case LinuxArpHardware.PRONET: + type = NetworkInterfaceType.TokenRing; + break; + + case LinuxArpHardware.ATM: + type = NetworkInterfaceType.Atm; + break; + + case LinuxArpHardware.SLIP: + case LinuxArpHardware.CSLIP: + case LinuxArpHardware.SLIP6: + case LinuxArpHardware.CSLIP6: + type = NetworkInterfaceType.Slip; + break; + + case LinuxArpHardware.PPP: + type = NetworkInterfaceType.Ppp; + break; + + case LinuxArpHardware.LOOPBACK: + type = NetworkInterfaceType.Loopback; + macAddress = null; + break; + + case LinuxArpHardware.FDDI: + type = NetworkInterfaceType.Fddi; + break; + + case LinuxArpHardware.SIT: + case LinuxArpHardware.IPDDP: + case LinuxArpHardware.IPGRE: + case LinuxArpHardware.IP6GRE: + case LinuxArpHardware.TUNNEL6: + case LinuxArpHardware.TUNNEL: + type = NetworkInterfaceType.Tunnel; + break; + } + } + } + } + + LinuxNetworkInterface iface = null; + + if (String.IsNullOrEmpty (name)) + name = "\0" + (++nullNameCount).ToString (); + + if (!interfaces.TryGetValue (name, out iface)) { + iface = new LinuxNetworkInterface (name); + interfaces.Add (name, iface); + } + + if (!address.Equals (IPAddress.None)) + iface.AddAddress (address); + + if (macAddress != null || type == NetworkInterfaceType.Loopback) { + if (type == NetworkInterfaceType.Ethernet) { + if (Directory.Exists(iface.IfacePath + "wireless")) { + type = NetworkInterfaceType.Wireless80211; + } + } + iface.SetLinkLayerInfo (index, macAddress, type); + } + + next = addr.ifa_next; + } + } finally { + FreeInterfaceAddresses (ifap); + } + + NetworkInterface [] result = new NetworkInterface [interfaces.Count]; + int x = 0; + foreach (NetworkInterface thisInterface in interfaces.Values) { + result [x] = thisInterface; + x++; + } + return result; + } + + public override int GetLoopbackInterfaceIndex () + { + return if_nametoindex ("lo"); + } + + public override IPAddress GetNetMask (IPAddress address) + { + foreach (ifaddrs networkInteface in GetNetworkInterfaces()) { + if (networkInteface.ifa_addr == IntPtr.Zero) + continue; + + var sockaddr = (sockaddr_in)Marshal.PtrToStructure(networkInteface.ifa_addr, typeof(sockaddr_in)); + + if (sockaddr.sin_family != AF_INET) + continue; + + if (!address.Equals(new IPAddress(sockaddr.sin_addr))) + continue; + + var netmask = (sockaddr_in)Marshal.PtrToStructure(networkInteface.ifa_netmask, typeof(sockaddr_in)); + return new IPAddress(netmask.sin_addr); + } + + return null; + } + + private static IEnumerable GetNetworkInterfaces() + { + IntPtr ifap = IntPtr.Zero; + + try { + if (GetInterfaceAddresses(out ifap) != 0) + yield break; + + var next = ifap; + while (next != IntPtr.Zero) { + var addr = (ifaddrs)Marshal.PtrToStructure(next, typeof(ifaddrs)); + yield return addr; + next = addr.ifa_next; + } + } finally { + if (ifap != IntPtr.Zero) + FreeInterfaceAddresses(ifap); + } + } + } + + // + // This class needs support from the libsupport.so library to fetch the + // data using arch-specific ioctls. + // + // For this to work, we have to create this on the factory above. + // + sealed class LinuxNetworkInterface : UnixNetworkInterface + { + //NetworkInterfaceType type; + string iface_path; + string iface_operstate_path; + string iface_flags_path; + +#if MONODROID + [DllImport ("__Internal")] + static extern int _monodroid_get_android_api_level (); + + [DllImport ("__Internal")] + static extern bool _monodroid_get_network_interface_up_state (string ifname, ref bool is_up); + + [DllImport ("__Internal")] + static extern bool _monodroid_get_network_interface_supports_multicast (string ifname, ref bool supports_multicast); + + bool android_use_java_api; +#endif + + internal string IfacePath { + get { return iface_path; } + } + + internal LinuxNetworkInterface (string name) + : base (name) + { + iface_path = "/sys/class/net/" + name + "/"; + iface_operstate_path = iface_path + "operstate"; + iface_flags_path = iface_path + "flags"; +#if MONODROID + android_use_java_api = _monodroid_get_android_api_level () >= 24; +#endif + } + + public override IPInterfaceProperties GetIPProperties () + { + if (ipproperties == null) + ipproperties = new LinuxIPInterfaceProperties (this, addresses); + return ipproperties; + } + + public override IPv4InterfaceStatistics GetIPv4Statistics () + { + if (ipv4stats == null) + ipv4stats = new LinuxIPv4InterfaceStatistics (this); + return ipv4stats; + } + + public override OperationalStatus OperationalStatus { + get { +#if MONODROID + if (android_use_java_api) { + // Starting from API 24 (Android 7 "Nougat") Android restricts access to many + // files in the /sys filesystem (see https://code.google.com/p/android/issues/detail?id=205565 + // for more information) and therefore we are forced to call into Java API in + // order to get the information. Alas, what we can obtain in this way is quite + // limited. In the case of OperationalStatus we can only determine whether the + // interface is up or down. There is a way to get more detailed information but + // it requires an instance of the Android Context class which is not available + // to us here. + bool is_up = false; + if (_monodroid_get_network_interface_up_state (Name, ref is_up)) + return is_up ? OperationalStatus.Up : OperationalStatus.Down; + else + return OperationalStatus.Unknown; + } +#endif + if (!Directory.Exists (iface_path)) + return OperationalStatus.Unknown; + + try { + string s = ReadLine (iface_operstate_path); + + switch (s){ + case "unknown": + return OperationalStatus.Unknown; + + case "notpresent": + return OperationalStatus.NotPresent; + + case "down": + return OperationalStatus.Down; + + case "lowerlayerdown": + return OperationalStatus.LowerLayerDown; + + case "testing": + return OperationalStatus.Testing; + + case "dormant": + return OperationalStatus.Dormant; + + case "up": + return OperationalStatus.Up; + } + } catch { + } + return OperationalStatus.Unknown; + } + } + + public override bool SupportsMulticast { + get { +#if MONODROID + if (android_use_java_api) { + // Starting from API 24 (Android 7 "Nougat") Android restricts access to many + // files in the /sys filesystem (see https://code.google.com/p/android/issues/detail?id=205565 + // for more information) and therefore we are forced to call into Java API in + // order to get the information. + bool supports_multicast = false; + _monodroid_get_network_interface_supports_multicast (Name, ref supports_multicast); + return supports_multicast; + } +#endif + if (!Directory.Exists (iface_path)) + return false; + + try { + string s = ReadLine (iface_flags_path); + if (s.Length > 2 && s [0] == '0' && s [1] == 'x') + s = s.Substring (2); + + ulong f = UInt64.Parse (s, NumberStyles.HexNumber); + + // Hardcoded, only useful for Linux. + return ((f & 0x1000) == 0x1000); + } catch { + return false; + } + } + } + + internal static string ReadLine (string path) + { + using (FileStream fs = File.OpenRead (path)){ + using (StreamReader sr = new StreamReader (fs)){ + return sr.ReadLine (); + } + } + } + } +} diff --git a/mcs/class/System/System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs b/mcs/class/System/System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs index feeaec42d5..f78fa98acf 100644 --- a/mcs/class/System/System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs +++ b/mcs/class/System/System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs @@ -25,7 +25,6 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System; using System.Runtime.InteropServices; namespace System.Net.NetworkInformation { diff --git a/mcs/class/System/System.Net.NetworkInformation/LinuxUnicastIPAddressInformation.cs b/mcs/class/System/System.Net.NetworkInformation/LinuxUnicastIPAddressInformation.cs new file mode 100644 index 0000000000..2ef926bf67 --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/LinuxUnicastIPAddressInformation.cs @@ -0,0 +1,98 @@ +// +// System.Net.NetworkInformation.UnicastIPAddressInformation +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Eric Butler (eric@extremeboredom.net) +// +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Net.Sockets; + +namespace System.Net.NetworkInformation { + class LinuxUnicastIPAddressInformation : UnicastIPAddressInformation + { + IPAddress address; + IPAddress ipv4Mask; + + public LinuxUnicastIPAddressInformation (IPAddress address) + { + this.address = address; + } + + public override IPAddress Address { + get { return address; } + } + + public override bool IsDnsEligible { + get { + byte[] addressBytes = address.GetAddressBytes (); + return !(addressBytes[0] == 169 && addressBytes[1] == 254); + } + } + + [MonoTODO("Always returns false")] + public override bool IsTransient { + get { return false; } + } + + // UnicastIPAddressInformation members + + public override long AddressPreferredLifetime { + get { throw new NotImplementedException (); } + } + + public override long AddressValidLifetime { + get { throw new NotImplementedException (); } + } + + public override long DhcpLeaseLifetime { + get { throw new NotImplementedException (); } + } + + public override DuplicateAddressDetectionState DuplicateAddressDetectionState { + get { throw new NotImplementedException (); } + } + + public override IPAddress IPv4Mask { + get { + // The IPv6 equivilant (for .net compatibility) + if (Address.AddressFamily != AddressFamily.InterNetwork) + return IPAddress.Any; + + if (ipv4Mask == null) + ipv4Mask = SystemNetworkInterface.GetNetMask (address); + + return ipv4Mask; + } + } + + public override PrefixOrigin PrefixOrigin { + get { throw new NotImplementedException (); } + } + + public override SuffixOrigin SuffixOrigin { + get { throw new NotImplementedException (); } + } + } +} diff --git a/mcs/class/System/System.Net.NetworkInformation/MacOsIPInterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/MacOsIPInterfaceProperties.cs new file mode 100644 index 0000000000..f621d42291 --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/MacOsIPInterfaceProperties.cs @@ -0,0 +1,78 @@ +// +// System.Net.NetworkInformation.IPInterfaceProperties +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace System.Net.NetworkInformation { + class MacOsIPInterfaceProperties : UnixIPInterfaceProperties + { + public MacOsIPInterfaceProperties (MacOsNetworkInterface iface, List addresses) + : base (iface, addresses) + { + } + + public override IPv4InterfaceProperties GetIPv4Properties () + { + if (ipv4iface_properties == null) + ipv4iface_properties = new MacOsIPv4InterfaceProperties (iface as MacOsNetworkInterface); + + return ipv4iface_properties; + } + + [MethodImplAttribute(MethodImplOptions.InternalCall)] + private extern static bool ParseRouteInfo_internal(string iface, out string[] gw_addr_list); + + public override GatewayIPAddressInformationCollection GatewayAddresses { + get { + var gateways = new IPAddressCollection (); + string[] gw_addrlist; + if (!ParseRouteInfo_internal (this.iface.Name.ToString(), out gw_addrlist)) + return new GatewayIPAddressInformationCollection (); + + for(int i=0; i (); + IntPtr ifap; + if (getifaddrs (out ifap) != 0) + throw new SystemException ("getifaddrs() failed"); + + try { + IntPtr next = ifap; + while (next != IntPtr.Zero) { + MacOsStructs.ifaddrs addr = (MacOsStructs.ifaddrs) Marshal.PtrToStructure (next, typeof (MacOsStructs.ifaddrs)); + IPAddress address = IPAddress.None; + string name = addr.ifa_name; + int index = -1; + byte[] macAddress = null; + NetworkInterfaceType type = NetworkInterfaceType.Unknown; + + if (addr.ifa_addr != IntPtr.Zero) { + // optain IPAddress + MacOsStructs.sockaddr sockaddr = (MacOsStructs.sockaddr) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr)); + + if (sockaddr.sa_family == AF_INET6) { + MacOsStructs.sockaddr_in6 sockaddr6 = (MacOsStructs.sockaddr_in6) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr_in6)); + address = new IPAddress (sockaddr6.sin6_addr.u6_addr8, sockaddr6.sin6_scope_id); + } else if (sockaddr.sa_family == AF_INET) { + MacOsStructs.sockaddr_in sockaddrin = (MacOsStructs.sockaddr_in) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr_in)); + address = new IPAddress (sockaddrin.sin_addr); + } else if (sockaddr.sa_family == AF_LINK) { + MacOsStructs.sockaddr_dl sockaddrdl = new MacOsStructs.sockaddr_dl (); + sockaddrdl.Read (addr.ifa_addr); + + macAddress = new byte [(int) sockaddrdl.sdl_alen]; + // copy mac address from sdl_data field starting at last index pos of interface name into array macaddress, starting + // at index 0 + Array.Copy (sockaddrdl.sdl_data, sockaddrdl.sdl_nlen, macAddress, 0, Math.Min (macAddress.Length, sockaddrdl.sdl_data.Length - sockaddrdl.sdl_nlen)); + + index = sockaddrdl.sdl_index; + + int hwtype = (int) sockaddrdl.sdl_type; + if (Enum.IsDefined (typeof (MacOsArpHardware), hwtype)) { + switch ((MacOsArpHardware) hwtype) { + case MacOsArpHardware.ETHER: + type = NetworkInterfaceType.Ethernet; + break; + + case MacOsArpHardware.ATM: + type = NetworkInterfaceType.Atm; + break; + + case MacOsArpHardware.SLIP: + type = NetworkInterfaceType.Slip; + break; + + case MacOsArpHardware.PPP: + type = NetworkInterfaceType.Ppp; + break; + + case MacOsArpHardware.LOOPBACK: + type = NetworkInterfaceType.Loopback; + macAddress = null; + break; + + case MacOsArpHardware.FDDI: + type = NetworkInterfaceType.Fddi; + break; + } + } + } + } + + MacOsNetworkInterface iface = null; + + // create interface if not already present + if (!interfaces.TryGetValue (name, out iface)) { + iface = new MacOsNetworkInterface (name, addr.ifa_flags); + interfaces.Add (name, iface); + } + + // if a new address has been found, add it + if (!address.Equals (IPAddress.None)) + iface.AddAddress (address); + + // set link layer info, if iface has macaddress or is loopback device + if (macAddress != null || type == NetworkInterfaceType.Loopback) + iface.SetLinkLayerInfo (index, macAddress, type); + + next = addr.ifa_next; + } + } finally { + freeifaddrs (ifap); + } + + NetworkInterface [] result = new NetworkInterface [interfaces.Count]; + int x = 0; + foreach (NetworkInterface thisInterface in interfaces.Values) { + result [x] = thisInterface; + x++; + } + return result; + } + + public override int GetLoopbackInterfaceIndex () + { + return if_nametoindex ("lo0"); + } + + public override IPAddress GetNetMask (IPAddress address) + { + IntPtr ifap; + if (getifaddrs (out ifap) != 0) + throw new SystemException ("getifaddrs() failed"); + + try { + IntPtr next = ifap; + while (next != IntPtr.Zero) { + MacOsStructs.ifaddrs addr = (MacOsStructs.ifaddrs) Marshal.PtrToStructure (next, typeof (MacOsStructs.ifaddrs)); + + if (addr.ifa_addr != IntPtr.Zero) { + // optain IPAddress + MacOsStructs.sockaddr sockaddr = (MacOsStructs.sockaddr) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr)); + + if (sockaddr.sa_family == AF_INET) { + MacOsStructs.sockaddr_in sockaddrin = (MacOsStructs.sockaddr_in) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr_in)); + var saddress = new IPAddress (sockaddrin.sin_addr); + if (address.Equals (saddress)) + return new IPAddress(((sockaddr_in)Marshal.PtrToStructure(addr.ifa_netmask, typeof(sockaddr_in))).sin_addr); + } + } + next = addr.ifa_next; + } + } finally { + freeifaddrs (ifap); + } + + return null; + } + } + + sealed class MacOsNetworkInterface : UnixNetworkInterface + { + private uint _ifa_flags; + + internal MacOsNetworkInterface (string name, uint ifa_flags) + : base (name) + { + _ifa_flags = ifa_flags; + } + + public override IPInterfaceProperties GetIPProperties () + { + if (ipproperties == null) + ipproperties = new MacOsIPInterfaceProperties (this, addresses); + return ipproperties; + } + + public override IPv4InterfaceStatistics GetIPv4Statistics () + { + if (ipv4stats == null) + ipv4stats = new MacOsIPv4InterfaceStatistics (this); + return ipv4stats; + } + + public override OperationalStatus OperationalStatus { + get { + if(((MacOsInterfaceFlags)_ifa_flags & MacOsInterfaceFlags.IFF_UP) == MacOsInterfaceFlags.IFF_UP){ + return OperationalStatus.Up; + } + return OperationalStatus.Unknown; + } + } + + public override bool SupportsMulticast { + get { + return ((MacOsInterfaceFlags)_ifa_flags & MacOsInterfaceFlags.IFF_MULTICAST) == MacOsInterfaceFlags.IFF_MULTICAST; + } + } + } +} \ No newline at end of file diff --git a/mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs b/mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs index 840fc53103..bb7a4c07a5 100644 --- a/mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs +++ b/mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs @@ -1,4 +1,3 @@ -using System; using System.Runtime.InteropServices; namespace System.Net.NetworkInformation { diff --git a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs index fedf95dbb4..3ecbec9c73 100644 --- a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs +++ b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs @@ -80,856 +80,13 @@ namespace System.Net.NetworkInformation { abstract class NetworkInterfaceFactory { - internal abstract class UnixNetworkInterfaceAPI : NetworkInterfaceFactory - { -#if ORBIS - public static int if_nametoindex(string ifname) - { - throw new PlatformNotSupportedException (); - } - - protected static int getifaddrs (out IntPtr ifap) - { - throw new PlatformNotSupportedException (); - } - - protected static void freeifaddrs (IntPtr ifap) - { - throw new PlatformNotSupportedException (); - } -#else - [DllImport("libc")] - public static extern int if_nametoindex(string ifname); - - [DllImport ("libc")] - protected static extern int getifaddrs (out IntPtr ifap); - - [DllImport ("libc")] - protected static extern void freeifaddrs (IntPtr ifap); -#endif - } - - class MacOsNetworkInterfaceAPI : UnixNetworkInterfaceAPI - { - const int AF_INET = 2; - const int AF_INET6 = 30; - const int AF_LINK = 18; - - public override NetworkInterface [] GetAllNetworkInterfaces () - { - var interfaces = new Dictionary (); - IntPtr ifap; - if (getifaddrs (out ifap) != 0) - throw new SystemException ("getifaddrs() failed"); - - try { - IntPtr next = ifap; - while (next != IntPtr.Zero) { - MacOsStructs.ifaddrs addr = (MacOsStructs.ifaddrs) Marshal.PtrToStructure (next, typeof (MacOsStructs.ifaddrs)); - IPAddress address = IPAddress.None; - string name = addr.ifa_name; - int index = -1; - byte[] macAddress = null; - NetworkInterfaceType type = NetworkInterfaceType.Unknown; - - if (addr.ifa_addr != IntPtr.Zero) { - // optain IPAddress - MacOsStructs.sockaddr sockaddr = (MacOsStructs.sockaddr) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr)); - - if (sockaddr.sa_family == AF_INET6) { - MacOsStructs.sockaddr_in6 sockaddr6 = (MacOsStructs.sockaddr_in6) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr_in6)); - address = new IPAddress (sockaddr6.sin6_addr.u6_addr8, sockaddr6.sin6_scope_id); - } else if (sockaddr.sa_family == AF_INET) { - MacOsStructs.sockaddr_in sockaddrin = (MacOsStructs.sockaddr_in) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr_in)); - address = new IPAddress (sockaddrin.sin_addr); - } else if (sockaddr.sa_family == AF_LINK) { - MacOsStructs.sockaddr_dl sockaddrdl = new MacOsStructs.sockaddr_dl (); - sockaddrdl.Read (addr.ifa_addr); - - macAddress = new byte [(int) sockaddrdl.sdl_alen]; - // copy mac address from sdl_data field starting at last index pos of interface name into array macaddress, starting - // at index 0 - Array.Copy (sockaddrdl.sdl_data, sockaddrdl.sdl_nlen, macAddress, 0, Math.Min (macAddress.Length, sockaddrdl.sdl_data.Length - sockaddrdl.sdl_nlen)); - - index = sockaddrdl.sdl_index; - - int hwtype = (int) sockaddrdl.sdl_type; - if (Enum.IsDefined (typeof (MacOsArpHardware), hwtype)) { - switch ((MacOsArpHardware) hwtype) { - case MacOsArpHardware.ETHER: - type = NetworkInterfaceType.Ethernet; - break; - - case MacOsArpHardware.ATM: - type = NetworkInterfaceType.Atm; - break; - - case MacOsArpHardware.SLIP: - type = NetworkInterfaceType.Slip; - break; - - case MacOsArpHardware.PPP: - type = NetworkInterfaceType.Ppp; - break; - - case MacOsArpHardware.LOOPBACK: - type = NetworkInterfaceType.Loopback; - macAddress = null; - break; - - case MacOsArpHardware.FDDI: - type = NetworkInterfaceType.Fddi; - break; - } - } - } - } - - MacOsNetworkInterface iface = null; - - // create interface if not already present - if (!interfaces.TryGetValue (name, out iface)) { - iface = new MacOsNetworkInterface (name, addr.ifa_flags); - interfaces.Add (name, iface); - } - - // if a new address has been found, add it - if (!address.Equals (IPAddress.None)) - iface.AddAddress (address); - - // set link layer info, if iface has macaddress or is loopback device - if (macAddress != null || type == NetworkInterfaceType.Loopback) - iface.SetLinkLayerInfo (index, macAddress, type); - - next = addr.ifa_next; - } - } finally { - freeifaddrs (ifap); - } - - NetworkInterface [] result = new NetworkInterface [interfaces.Count]; - int x = 0; - foreach (NetworkInterface thisInterface in interfaces.Values) { - result [x] = thisInterface; - x++; - } - return result; - } - - public override int GetLoopbackInterfaceIndex () - { - return if_nametoindex ("lo0"); - } - - public override IPAddress GetNetMask (IPAddress address) - { - IntPtr ifap; - if (getifaddrs (out ifap) != 0) - throw new SystemException ("getifaddrs() failed"); - - try { - IntPtr next = ifap; - while (next != IntPtr.Zero) { - MacOsStructs.ifaddrs addr = (MacOsStructs.ifaddrs) Marshal.PtrToStructure (next, typeof (MacOsStructs.ifaddrs)); - - if (addr.ifa_addr != IntPtr.Zero) { - // optain IPAddress - MacOsStructs.sockaddr sockaddr = (MacOsStructs.sockaddr) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr)); - - if (sockaddr.sa_family == AF_INET) { - MacOsStructs.sockaddr_in sockaddrin = (MacOsStructs.sockaddr_in) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr_in)); - var saddress = new IPAddress (sockaddrin.sin_addr); - if (address.Equals (saddress)) - return new IPAddress(((sockaddr_in)Marshal.PtrToStructure(addr.ifa_netmask, typeof(sockaddr_in))).sin_addr); - } - } - next = addr.ifa_next; - } - } finally { - freeifaddrs (ifap); - } - - return null; - } - } - - class LinuxNetworkInterfaceAPI : UnixNetworkInterfaceAPI - { - const int AF_INET = 2; - const int AF_INET6 = 10; - const int AF_PACKET = 17; - - static void FreeInterfaceAddresses (IntPtr ifap) - { -#if MONODROID - AndroidPlatform.FreeInterfaceAddresses (ifap); -#else - freeifaddrs (ifap); -#endif - } - - static int GetInterfaceAddresses (out IntPtr ifap) - { -#if MONODROID - return AndroidPlatform.GetInterfaceAddresses (out ifap); -#else - return getifaddrs (out ifap); -#endif - } - - public override NetworkInterface [] GetAllNetworkInterfaces () - { - - var interfaces = new Dictionary (); - IntPtr ifap; - if (GetInterfaceAddresses (out ifap) != 0) - throw new SystemException ("getifaddrs() failed"); - - try { - IntPtr next = ifap; - while (next != IntPtr.Zero) { - ifaddrs addr = (ifaddrs) Marshal.PtrToStructure (next, typeof (ifaddrs)); - IPAddress address = IPAddress.None; - string name = addr.ifa_name; - int index = -1; - byte[] macAddress = null; - NetworkInterfaceType type = NetworkInterfaceType.Unknown; - int nullNameCount = 0; - - if (addr.ifa_addr != IntPtr.Zero) { - sockaddr_in sockaddr = (sockaddr_in) Marshal.PtrToStructure (addr.ifa_addr, typeof (sockaddr_in)); - - if (sockaddr.sin_family == AF_INET6) { - sockaddr_in6 sockaddr6 = (sockaddr_in6) Marshal.PtrToStructure (addr.ifa_addr, typeof (sockaddr_in6)); - address = new IPAddress (sockaddr6.sin6_addr.u6_addr8, sockaddr6.sin6_scope_id); - } else if (sockaddr.sin_family == AF_INET) { - address = new IPAddress (sockaddr.sin_addr); - } else if (sockaddr.sin_family == AF_PACKET) { - sockaddr_ll sockaddrll = (sockaddr_ll) Marshal.PtrToStructure (addr.ifa_addr, typeof (sockaddr_ll)); - if (((int)sockaddrll.sll_halen) > sockaddrll.sll_addr.Length){ - next = addr.ifa_next; - continue; - } - - macAddress = new byte [(int) sockaddrll.sll_halen]; - Array.Copy (sockaddrll.sll_addr, 0, macAddress, 0, macAddress.Length); - index = sockaddrll.sll_ifindex; - - int hwtype = (int)sockaddrll.sll_hatype; - if (Enum.IsDefined (typeof (LinuxArpHardware), hwtype)) { - switch ((LinuxArpHardware)hwtype) { - case LinuxArpHardware.EETHER: - goto case LinuxArpHardware.ETHER; - - case LinuxArpHardware.ETHER: - type = NetworkInterfaceType.Ethernet; - break; - - case LinuxArpHardware.PRONET: - type = NetworkInterfaceType.TokenRing; - break; - - case LinuxArpHardware.ATM: - type = NetworkInterfaceType.Atm; - break; - - case LinuxArpHardware.SLIP: - case LinuxArpHardware.CSLIP: - case LinuxArpHardware.SLIP6: - case LinuxArpHardware.CSLIP6: - type = NetworkInterfaceType.Slip; - break; - - case LinuxArpHardware.PPP: - type = NetworkInterfaceType.Ppp; - break; - - case LinuxArpHardware.LOOPBACK: - type = NetworkInterfaceType.Loopback; - macAddress = null; - break; - - case LinuxArpHardware.FDDI: - type = NetworkInterfaceType.Fddi; - break; - - case LinuxArpHardware.SIT: - case LinuxArpHardware.IPDDP: - case LinuxArpHardware.IPGRE: - case LinuxArpHardware.IP6GRE: - case LinuxArpHardware.TUNNEL6: - case LinuxArpHardware.TUNNEL: - type = NetworkInterfaceType.Tunnel; - break; - } - } - } - } - - LinuxNetworkInterface iface = null; - - if (String.IsNullOrEmpty (name)) - name = "\0" + (++nullNameCount).ToString (); - - if (!interfaces.TryGetValue (name, out iface)) { - iface = new LinuxNetworkInterface (name); - interfaces.Add (name, iface); - } - - if (!address.Equals (IPAddress.None)) - iface.AddAddress (address); - - if (macAddress != null || type == NetworkInterfaceType.Loopback) { - if (type == NetworkInterfaceType.Ethernet) { - if (Directory.Exists(iface.IfacePath + "wireless")) { - type = NetworkInterfaceType.Wireless80211; - } - } - iface.SetLinkLayerInfo (index, macAddress, type); - } - - next = addr.ifa_next; - } - } finally { - FreeInterfaceAddresses (ifap); - } - - NetworkInterface [] result = new NetworkInterface [interfaces.Count]; - int x = 0; - foreach (NetworkInterface thisInterface in interfaces.Values) { - result [x] = thisInterface; - x++; - } - return result; - } - - public override int GetLoopbackInterfaceIndex () - { - return if_nametoindex ("lo"); - } - - public override IPAddress GetNetMask (IPAddress address) - { - foreach (ifaddrs networkInteface in GetNetworkInterfaces()) { - if (networkInteface.ifa_addr == IntPtr.Zero) - continue; - - var sockaddr = (sockaddr_in)Marshal.PtrToStructure(networkInteface.ifa_addr, typeof(sockaddr_in)); - - if (sockaddr.sin_family != AF_INET) - continue; - - if (!address.Equals(new IPAddress(sockaddr.sin_addr))) - continue; - - var netmask = (sockaddr_in)Marshal.PtrToStructure(networkInteface.ifa_netmask, typeof(sockaddr_in)); - return new IPAddress(netmask.sin_addr); - } - - return null; - } - - private static IEnumerable GetNetworkInterfaces() - { - IntPtr ifap = IntPtr.Zero; - - try { - if (GetInterfaceAddresses(out ifap) != 0) - yield break; - - var next = ifap; - while (next != IntPtr.Zero) { - var addr = (ifaddrs)Marshal.PtrToStructure(next, typeof(ifaddrs)); - yield return addr; - next = addr.ifa_next; - } - } finally { - if (ifap != IntPtr.Zero) - FreeInterfaceAddresses(ifap); - } - } - } - -#if WIN_PLATFORM - class Win32NetworkInterfaceAPI : NetworkInterfaceFactory - { - private const string IPHLPAPI = "iphlpapi.dll"; - - [DllImport (IPHLPAPI, SetLastError = true)] - static extern int GetAdaptersAddresses (uint family, uint flags, IntPtr reserved, IntPtr info, ref int size); - - [DllImport (IPHLPAPI)] - static extern uint GetBestInterfaceEx (byte[] ipAddress, out int index); - - static Win32_IP_ADAPTER_ADDRESSES [] GetAdaptersAddresses () - { - IntPtr ptr = IntPtr.Zero; - int len = 0; - GetAdaptersAddresses (0, 0, IntPtr.Zero, ptr, ref len); - ptr = Marshal.AllocHGlobal(len); - int ret = GetAdaptersAddresses (0, 0, IntPtr.Zero, ptr, ref len); - if (ret != 0) - throw new NetworkInformationException (ret); - - List l = new List (); - Win32_IP_ADAPTER_ADDRESSES info; - for (IntPtr p = ptr; p != IntPtr.Zero; p = info.Next) { - info = Marshal.PtrToStructure (p); - l.Add (info); - } - - return l.ToArray (); - } - - public override NetworkInterface [] GetAllNetworkInterfaces () - { - // Win32_IP_ADAPTER_INFO [] ai = GetAdaptersInfo (); - Win32_IP_ADAPTER_ADDRESSES [] aa = GetAdaptersAddresses (); - NetworkInterface [] ret = new NetworkInterface [aa.Length]; - for (int i = 0; i < ret.Length; i++) - ret [i] = new Win32NetworkInterface2 (aa [i]); - return ret; - } - - private static int GetBestInterfaceForAddress (IPAddress addr) { - int index; - SocketAddress address = new SocketAddress (addr); - int error = (int) GetBestInterfaceEx (address.m_Buffer, out index); - if (error != 0) { - throw new NetworkInformationException (error); - } - - return index; - } - - public override int GetLoopbackInterfaceIndex () - { - return GetBestInterfaceForAddress (IPAddress.Loopback); - } - - public override IPAddress GetNetMask (IPAddress address) - { - throw new NotImplementedException (); - } - } -#endif - public abstract NetworkInterface [] GetAllNetworkInterfaces (); public abstract int GetLoopbackInterfaceIndex (); public abstract IPAddress GetNetMask (IPAddress address); public static NetworkInterfaceFactory Create () { -#if MONOTOUCH || XAMMAC - return new MacOsNetworkInterfaceAPI (); -#else - bool runningOnUnix = (Environment.OSVersion.Platform == PlatformID.Unix); - - if (runningOnUnix) { - if (Platform.IsMacOS || Platform.IsFreeBSD) - return new MacOsNetworkInterfaceAPI (); - - return new LinuxNetworkInterfaceAPI (); - } - -#if WIN_PLATFORM - Version windowsVer51 = new Version (5, 1); - if (Environment.OSVersion.Version >= windowsVer51) - return new Win32NetworkInterfaceAPI (); -#endif - - throw new NotImplementedException (); -#endif + return NetworkInterfaceFactoryPal.Create (); } } - - abstract class UnixNetworkInterface : NetworkInterface - { - - protected IPv4InterfaceStatistics ipv4stats; - protected IPInterfaceProperties ipproperties; - - string name; - //int index; - protected List addresses; - byte[] macAddress; - NetworkInterfaceType type; - - internal UnixNetworkInterface (string name) - { - this.name = name; - addresses = new List (); - } - - internal void AddAddress (IPAddress address) - { - addresses.Add (address); - } - - internal void SetLinkLayerInfo (int index, byte[] macAddress, NetworkInterfaceType type) - { - //this.index = index; - this.macAddress = macAddress; - this.type = type; - } - - public override PhysicalAddress GetPhysicalAddress () - { - if (macAddress != null) - return new PhysicalAddress (macAddress); - else - return PhysicalAddress.None; - } - - public override bool Supports (NetworkInterfaceComponent networkInterfaceComponent) - { - bool wantIPv4 = networkInterfaceComponent == NetworkInterfaceComponent.IPv4; - bool wantIPv6 = wantIPv4 ? false : networkInterfaceComponent == NetworkInterfaceComponent.IPv6; - - foreach (IPAddress address in addresses) { - if (wantIPv4 && address.AddressFamily == AddressFamily.InterNetwork) - return true; - else if (wantIPv6 && address.AddressFamily == AddressFamily.InterNetworkV6) - return true; - } - - return false; - } - - public override string Description { - get { return name; } - } - - public override string Id { - get { return name; } - } - - public override bool IsReceiveOnly { - get { return false; } - } - - public override string Name { - get { return name; } - } - - public override NetworkInterfaceType NetworkInterfaceType { - get { return type; } - } - - [MonoTODO ("Parse dmesg?")] - public override long Speed { - get { - // Bits/s - return 1000000; - } - } - - internal int NameIndex { - get { - return NetworkInterfaceFactory.UnixNetworkInterfaceAPI.if_nametoindex (Name); - } - } - } - - // - // This class needs support from the libsupport.so library to fetch the - // data using arch-specific ioctls. - // - // For this to work, we have to create this on the factory above. - // - sealed class LinuxNetworkInterface : UnixNetworkInterface - { - //NetworkInterfaceType type; - string iface_path; - string iface_operstate_path; - string iface_flags_path; - -#if MONODROID - [DllImport ("__Internal")] - static extern int _monodroid_get_android_api_level (); - - [DllImport ("__Internal")] - static extern bool _monodroid_get_network_interface_up_state (string ifname, ref bool is_up); - - [DllImport ("__Internal")] - static extern bool _monodroid_get_network_interface_supports_multicast (string ifname, ref bool supports_multicast); - - bool android_use_java_api; -#endif - - internal string IfacePath { - get { return iface_path; } - } - - internal LinuxNetworkInterface (string name) - : base (name) - { - iface_path = "/sys/class/net/" + name + "/"; - iface_operstate_path = iface_path + "operstate"; - iface_flags_path = iface_path + "flags"; -#if MONODROID - android_use_java_api = _monodroid_get_android_api_level () >= 24; -#endif - } - - public override IPInterfaceProperties GetIPProperties () - { - if (ipproperties == null) - ipproperties = new LinuxIPInterfaceProperties (this, addresses); - return ipproperties; - } - - public override IPv4InterfaceStatistics GetIPv4Statistics () - { - if (ipv4stats == null) - ipv4stats = new LinuxIPv4InterfaceStatistics (this); - return ipv4stats; - } - - public override OperationalStatus OperationalStatus { - get { -#if MONODROID - if (android_use_java_api) { - // Starting from API 24 (Android 7 "Nougat") Android restricts access to many - // files in the /sys filesystem (see https://code.google.com/p/android/issues/detail?id=205565 - // for more information) and therefore we are forced to call into Java API in - // order to get the information. Alas, what we can obtain in this way is quite - // limited. In the case of OperationalStatus we can only determine whether the - // interface is up or down. There is a way to get more detailed information but - // it requires an instance of the Android Context class which is not available - // to us here. - bool is_up = false; - if (_monodroid_get_network_interface_up_state (Name, ref is_up)) - return is_up ? OperationalStatus.Up : OperationalStatus.Down; - else - return OperationalStatus.Unknown; - } -#endif - if (!Directory.Exists (iface_path)) - return OperationalStatus.Unknown; - - try { - string s = ReadLine (iface_operstate_path); - - switch (s){ - case "unknown": - return OperationalStatus.Unknown; - - case "notpresent": - return OperationalStatus.NotPresent; - - case "down": - return OperationalStatus.Down; - - case "lowerlayerdown": - return OperationalStatus.LowerLayerDown; - - case "testing": - return OperationalStatus.Testing; - - case "dormant": - return OperationalStatus.Dormant; - - case "up": - return OperationalStatus.Up; - } - } catch { - } - return OperationalStatus.Unknown; - } - } - - public override bool SupportsMulticast { - get { -#if MONODROID - if (android_use_java_api) { - // Starting from API 24 (Android 7 "Nougat") Android restricts access to many - // files in the /sys filesystem (see https://code.google.com/p/android/issues/detail?id=205565 - // for more information) and therefore we are forced to call into Java API in - // order to get the information. - bool supports_multicast = false; - _monodroid_get_network_interface_supports_multicast (Name, ref supports_multicast); - return supports_multicast; - } -#endif - if (!Directory.Exists (iface_path)) - return false; - - try { - string s = ReadLine (iface_flags_path); - if (s.Length > 2 && s [0] == '0' && s [1] == 'x') - s = s.Substring (2); - - ulong f = UInt64.Parse (s, NumberStyles.HexNumber); - - // Hardcoded, only useful for Linux. - return ((f & 0x1000) == 0x1000); - } catch { - return false; - } - } - } - - internal static string ReadLine (string path) - { - using (FileStream fs = File.OpenRead (path)){ - using (StreamReader sr = new StreamReader (fs)){ - return sr.ReadLine (); - } - } - } - } - - sealed class MacOsNetworkInterface : UnixNetworkInterface - { - private uint _ifa_flags; - - internal MacOsNetworkInterface (string name, uint ifa_flags) - : base (name) - { - _ifa_flags = ifa_flags; - } - - public override IPInterfaceProperties GetIPProperties () - { - if (ipproperties == null) - ipproperties = new MacOsIPInterfaceProperties (this, addresses); - return ipproperties; - } - - public override IPv4InterfaceStatistics GetIPv4Statistics () - { - if (ipv4stats == null) - ipv4stats = new MacOsIPv4InterfaceStatistics (this); - return ipv4stats; - } - - public override OperationalStatus OperationalStatus { - get { - if(((MacOsInterfaceFlags)_ifa_flags & MacOsInterfaceFlags.IFF_UP) == MacOsInterfaceFlags.IFF_UP){ - return OperationalStatus.Up; - } - return OperationalStatus.Unknown; - } - } - - public override bool SupportsMulticast { - get { - return ((MacOsInterfaceFlags)_ifa_flags & MacOsInterfaceFlags.IFF_MULTICAST) == MacOsInterfaceFlags.IFF_MULTICAST; - } - } - } - -#if WIN_PLATFORM - class Win32NetworkInterface2 : NetworkInterface - { - [DllImport ("iphlpapi.dll", SetLastError = true)] - static extern int GetAdaptersInfo (IntPtr info, ref int size); - - [DllImport ("iphlpapi.dll", SetLastError = true)] - static extern int GetIfEntry (ref Win32_MIB_IFROW row); - - public static Win32_IP_ADAPTER_INFO GetAdapterInfoByIndex (int index) - { - foreach (Win32_IP_ADAPTER_INFO info in GetAdaptersInfo ()) - if (info.Index == index) - return info; - throw new IndexOutOfRangeException ("No adapter found for index " + index); - } - - static Win32_IP_ADAPTER_INFO [] GetAdaptersInfo () - { - int len = 0; - IntPtr ptr = IntPtr.Zero; - GetAdaptersInfo (ptr, ref len); - ptr = Marshal.AllocHGlobal(len); - int ret = GetAdaptersInfo (ptr, ref len); - - if (ret != 0) - throw new NetworkInformationException (ret); - - List l = new List (); - Win32_IP_ADAPTER_INFO info; - for (IntPtr p = ptr; p != IntPtr.Zero; p = info.Next) { - info = Marshal.PtrToStructure (p); - l.Add (info); - } - return l.ToArray (); - } - - Win32_IP_ADAPTER_ADDRESSES addr; - Win32_MIB_IFROW mib4, mib6; - Win32IPv4InterfaceStatistics ip4stats; - IPInterfaceProperties ip_if_props; - - internal Win32NetworkInterface2 (Win32_IP_ADAPTER_ADDRESSES addr) - { - this.addr = addr; - mib4 = default (Win32_MIB_IFROW); - mib4.Index = addr.Alignment.IfIndex; - if (GetIfEntry (ref mib4) != 0) - mib4.Index = -1; // unavailable; - mib6 = default (Win32_MIB_IFROW); - mib6.Index = addr.Ipv6IfIndex; - if (GetIfEntry (ref mib6) != 0) - mib6.Index = -1; // unavailable; - ip4stats = new Win32IPv4InterfaceStatistics (mib4); - ip_if_props = new Win32IPInterfaceProperties2 (addr, mib4, mib6); - } - - public override IPInterfaceProperties GetIPProperties () - { - return ip_if_props; - } - - public override IPv4InterfaceStatistics GetIPv4Statistics () - { - return ip4stats; - } - - public override PhysicalAddress GetPhysicalAddress () - { - byte [] bytes = new byte [addr.PhysicalAddressLength]; - Array.Copy (addr.PhysicalAddress, 0, bytes, 0, bytes.Length); - return new PhysicalAddress (bytes); - } - - public override bool Supports (NetworkInterfaceComponent networkInterfaceComponent) - { - switch (networkInterfaceComponent) { - case NetworkInterfaceComponent.IPv4: - return mib4.Index >= 0; - case NetworkInterfaceComponent.IPv6: - return mib6.Index >= 0; - } - return false; - } - - public override string Description { - get { return addr.Description; } - } - public override string Id { - get { return addr.AdapterName; } - } - public override bool IsReceiveOnly { - get { return addr.IsReceiveOnly; } - } - public override string Name { - get { return addr.FriendlyName; } - } - public override NetworkInterfaceType NetworkInterfaceType { - get { return addr.IfType; } - } - public override OperationalStatus OperationalStatus { - get { return addr.OperStatus; } - } - public override long Speed { - get { return mib6.Index >= 0 ? mib6.Speed : mib4.Speed; } - } - public override bool SupportsMulticast { - get { return !addr.NoMulticast; } - } - } -#endif } - diff --git a/mcs/class/System/System.Net.NetworkInformation/NetworkInterfaceFactory.cs b/mcs/class/System/System.Net.NetworkInformation/NetworkInterfaceFactory.cs new file mode 100644 index 0000000000..3f2fd1a835 --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/NetworkInterfaceFactory.cs @@ -0,0 +1,52 @@ +// +// System.Net.NetworkInformation.NetworkInterface +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Miguel de Icaza (miguel@novell.com) +// Eric Butler (eric@extremeboredom.net) +// Marek Habersack (mhabersack@novell.com) +// Marek Safar (marek.safar@gmail.com) +// +// Copyright (c) 2006-2008 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +namespace System.Net.NetworkInformation { + + internal static class NetworkInterfaceFactoryPal + { + public static NetworkInterfaceFactory Create () + { + var instance = UnixNetworkInterfaceFactoryPal.Create (); + +#if WIN_PLATFORM + if (instance == null) + instance = Win32NetworkInterfaceFactoryPal.Create (); +#endif + + if (instance == null) + throw new NotImplementedException (); + + return instance; + } + } +} diff --git a/mcs/class/System/System.Net.NetworkInformation/UnixIPGlobalProperties.cs b/mcs/class/System/System.Net.NetworkInformation/UnixIPGlobalProperties.cs new file mode 100644 index 0000000000..3c09d9f446 --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/UnixIPGlobalProperties.cs @@ -0,0 +1,393 @@ +// +// System.Net.NetworkInformation.IPGlobalProperties +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Marek Safar (marek.safar@gmail.com) +// +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Globalization; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; + +namespace System.Net.NetworkInformation { + abstract class CommonUnixIPGlobalProperties : IPGlobalProperties + { + [DllImport ("libc")] + static extern int gethostname ([MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 1)] byte [] name, int len); + +#if !ORBIS + [DllImport ("libc")] + static extern int getdomainname ([MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 1)] byte [] name, int len); +#else + static int getdomainname ([MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 1)] byte [] name, int len) + { + throw new PlatformNotSupportedException (); + } +#endif + + public override string DhcpScopeName { + get { return String.Empty; } + } + + public override string DomainName { + get { + byte [] bytes = new byte [256]; + if (getdomainname (bytes, 256) != 0) + throw new NetworkInformationException (); + int len = Array.IndexOf (bytes, 0); + return Encoding.ASCII.GetString (bytes, 0, len < 0 ? 256 : len); + } + } + + public override string HostName { + get { + byte [] bytes = new byte [256]; + if (gethostname (bytes, 256) != 0) + throw new NetworkInformationException (); + int len = Array.IndexOf (bytes, 0); + return Encoding.ASCII.GetString (bytes, 0, len < 0 ? 256 : len); + } + } + + public override bool IsWinsProxy { + get { return false; } // no WINS + } + + public override NetBiosNodeType NodeType { + get { return NetBiosNodeType.Unknown; } // no NetBios + } + } + + class UnixIPGlobalProperties : CommonUnixIPGlobalProperties + { + public override TcpConnectionInformation [] GetActiveTcpConnections () + { + throw new NotImplementedException (); + } + + public override IPEndPoint [] GetActiveTcpListeners () + { + throw new NotImplementedException (); + } + + public override IPEndPoint [] GetActiveUdpListeners () + { + throw new NotImplementedException (); + } + + public override IcmpV4Statistics GetIcmpV4Statistics () + { + throw new NotImplementedException (); + } + + public override IcmpV6Statistics GetIcmpV6Statistics () + { + throw new NotImplementedException (); + } + + public override IPGlobalStatistics GetIPv4GlobalStatistics () + { + throw new NotImplementedException (); + } + + public override IPGlobalStatistics GetIPv6GlobalStatistics () + { + throw new NotImplementedException (); + } + + public override TcpStatistics GetTcpIPv4Statistics () + { + throw new NotImplementedException (); + } + + public override TcpStatistics GetTcpIPv6Statistics () + { + throw new NotImplementedException (); + } + + public override UdpStatistics GetUdpIPv4Statistics () + { + throw new NotImplementedException (); + } + + public override UdpStatistics GetUdpIPv6Statistics () + { + throw new NotImplementedException (); + } + } + +#if MONODROID + sealed class AndroidIPGlobalProperties : UnixIPGlobalProperties + { + public override string DomainName { + get { + return String.Empty; + } + } + } +#endif + + // It expects /proc/net/snmp (or /usr/compat/linux/proc/net/snmp), + // formatted like: + // http://www.linuxdevcenter.com/linux/2000/11/16/example5.html + // http://www.linuxdevcenter.com/linux/2000/11/16/example2.html + class MibIPGlobalProperties : UnixIPGlobalProperties + { + public const string ProcDir = "/proc"; + public const string CompatProcDir = "/usr/compat/linux/proc"; + + public readonly string StatisticsFile, StatisticsFileIPv6, TcpFile, Tcp6File, UdpFile, Udp6File; + + public MibIPGlobalProperties (string procDir) + { + StatisticsFile = Path.Combine (procDir, "net/snmp"); + StatisticsFileIPv6 = Path.Combine (procDir, "net/snmp6"); + TcpFile = Path.Combine (procDir,"net/tcp"); + Tcp6File = Path.Combine (procDir,"net/tcp6"); + UdpFile = Path.Combine (procDir,"net/udp"); + Udp6File = Path.Combine (procDir,"net/udp6"); + } + + StringDictionary GetProperties4 (string item) + { + string file = StatisticsFile; + + string head = item + ": "; + using (StreamReader sr = new StreamReader (file, Encoding.ASCII)) { + string [] keys = null; + string [] values = null; + string s = String.Empty; + do { + s = sr.ReadLine (); + if (String.IsNullOrEmpty (s)) + continue; + if (s.Length <= head.Length || String.CompareOrdinal (s, 0, head, 0, head.Length) != 0) + continue; + if (keys == null) + keys = s.Substring (head.Length).Split (' '); + else if (values != null) + // hmm, there may be better error type... + throw CreateException (file, String.Format ("Found duplicate line for values for the same item '{0}'", item)); + else { + values = s.Substring (head.Length).Split (' '); + break; + } + } while (!sr.EndOfStream); + + if (values == null) + throw CreateException (file, String.Format ("No corresponding line was not found for '{0}'", item)); + if (keys.Length != values.Length) + throw CreateException (file, String.Format ("The counts in the header line and the value line do not match for '{0}'", item)); + StringDictionary dic = new StringDictionary (); + for (int i = 0; i < keys.Length; i++) + dic [keys [i]] = values [i]; + return dic; + } + } + + StringDictionary GetProperties6 (string item) + { + if (!File.Exists (StatisticsFileIPv6)) + throw new NetworkInformationException (); + + string file = StatisticsFileIPv6; + + string head = item; + using (StreamReader sr = new StreamReader (file, Encoding.ASCII)) { + StringDictionary dic = new StringDictionary (); + string s = String.Empty; + do { + s = sr.ReadLine (); + if (String.IsNullOrEmpty (s)) + continue; + if (s.Length <= head.Length || String.CompareOrdinal (s, 0, head, 0, head.Length) != 0) + continue; + int idx = s.IndexOfAny (wsChars, head.Length); + if (idx < 0) + throw CreateException (file, null); + dic [s.Substring (head.Length, idx - head.Length)] = s.Substring (idx + 1).Trim (wsChars); + } while (!sr.EndOfStream); + + return dic; + } + } + + static readonly char [] wsChars = new char [] {' ', '\t'}; + + Exception CreateException (string file, string msg) + { + return new InvalidOperationException (String.Format ("Unsupported (unexpected) '{0}' file format. ", file) + msg); + } + IPEndPoint [] GetLocalAddresses (List list) + { + IPEndPoint [] ret = new IPEndPoint [list.Count]; + for (int i = 0; i < ret.Length; i++) + ret [i] = ToEndpoint (list [i] [1]); + return ret; + } + + IPEndPoint ToEndpoint (string s) + { + int idx = s.IndexOf (':'); + int port = int.Parse (s.Substring (idx + 1), NumberStyles.HexNumber); + if (s.Length == 13) + return new IPEndPoint (long.Parse (s.Substring (0, idx), NumberStyles.HexNumber), port); + else { + byte [] bytes = new byte [16]; + for (int i = 0; (i << 1) < idx; i++) + bytes [i] = byte.Parse (s.Substring (i << 1, 2), NumberStyles.HexNumber); + return new IPEndPoint (new IPAddress (bytes), port); + } + } + + void GetRows (string file, List list) + { + if (!File.Exists (file)) + return; + using (StreamReader sr = new StreamReader (file, Encoding.ASCII)) { + sr.ReadLine (); // skip first line + while (!sr.EndOfStream) { + string [] item = sr.ReadLine ().Split (wsChars, StringSplitOptions.RemoveEmptyEntries); + if (item.Length < 4) + throw CreateException (file, null); + list.Add (item); + } + } + } + + public override TcpConnectionInformation [] GetActiveTcpConnections () + { + List list = new List (); + GetRows (TcpFile, list); + GetRows (Tcp6File, list); + + TcpConnectionInformation [] ret = new TcpConnectionInformation [list.Count]; + for (int i = 0; i < ret.Length; i++) { + // sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode + IPEndPoint local = ToEndpoint (list [i] [1]); + IPEndPoint remote = ToEndpoint (list [i] [2]); + TcpState state = (TcpState) int.Parse (list [i] [3], NumberStyles.HexNumber); + ret [i] = new SystemTcpConnectionInformation (local, remote, state); + } + return ret; + } + + public override IPEndPoint [] GetActiveTcpListeners () + { + List list = new List (); + GetRows (TcpFile, list); + GetRows (Tcp6File, list); + return GetLocalAddresses (list); + } + + public override IPEndPoint [] GetActiveUdpListeners () + { + List list = new List (); + GetRows (UdpFile, list); + GetRows (Udp6File, list); + return GetLocalAddresses (list); + } + + public override IcmpV4Statistics GetIcmpV4Statistics () + { + return new MibIcmpV4Statistics (GetProperties4 ("Icmp")); + } + + public override IcmpV6Statistics GetIcmpV6Statistics () + { + return new MibIcmpV6Statistics (GetProperties6 ("Icmp6")); + } + + public override IPGlobalStatistics GetIPv4GlobalStatistics () + { + return new MibIPGlobalStatistics (GetProperties4 ("Ip")); + } + + public override IPGlobalStatistics GetIPv6GlobalStatistics () + { + return new MibIPGlobalStatistics (GetProperties6 ("Ip6")); + } + + public override TcpStatistics GetTcpIPv4Statistics () + { + return new MibTcpStatistics (GetProperties4 ("Tcp")); + } + + public override TcpStatistics GetTcpIPv6Statistics () + { + // There is no TCP info in /proc/net/snmp, + // so it is shared with IPv4 info. + return new MibTcpStatistics (GetProperties4 ("Tcp")); + } + + public override UdpStatistics GetUdpIPv4Statistics () + { + return new MibUdpStatistics (GetProperties4 ("Udp")); + } + + public override UdpStatistics GetUdpIPv6Statistics () + { + return new MibUdpStatistics (GetProperties6 ("Udp6")); + } + } + + internal static class UnixIPGlobalPropertiesFactoryPal { + public static IPGlobalProperties Create () + { +#if MONODROID + return new AndroidIPGlobalProperties (); +#elif MONOTOUCH || XAMMAC + return new UnixIPGlobalProperties (); +#elif MONO + switch (Environment.OSVersion.Platform) { + case PlatformID.Unix: + MibIPGlobalProperties impl = null; + if (Directory.Exists (MibIPGlobalProperties.ProcDir)) { + impl = new MibIPGlobalProperties (MibIPGlobalProperties.ProcDir); + if (File.Exists (impl.StatisticsFile)) + return impl; + } + if (Directory.Exists (MibIPGlobalProperties.CompatProcDir)) { + impl = new MibIPGlobalProperties (MibIPGlobalProperties.CompatProcDir); + if (File.Exists (impl.StatisticsFile)) + return impl; + } + return new UnixIPGlobalProperties (); + default: +#if !WIN_PLATFORM + return new UnixIPGlobalProperties (); +#endif + return null; + } +#else + (new NetworkInformationPermission (NetworkInformationAccess.Read)).Demand (); + return new SystemIPGlobalProperties (); +#endif + } + } +} diff --git a/mcs/class/System/System.Net.NetworkInformation/UnixIPGlobalStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/UnixIPGlobalStatistics.cs new file mode 100644 index 0000000000..480b8524a4 --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/UnixIPGlobalStatistics.cs @@ -0,0 +1,114 @@ +// +// System.Net.NetworkInformation.IPGlobalProperties +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Collections.Specialized; +using System.Globalization; + +namespace System.Net.NetworkInformation { + class MibIPGlobalStatistics : IPGlobalStatistics + { + StringDictionary dic; + + public MibIPGlobalStatistics (StringDictionary dic) + { + this.dic = dic; + } + + long Get (string name) + { + return dic [name] != null ? long.Parse (dic [name], NumberFormatInfo.InvariantInfo) : 0; + } + + public override int DefaultTtl { + get { return (int) Get ("DefaultTTL"); } + } + public override bool ForwardingEnabled { + get { return Get ("Forwarding") != 0; } + } + public override int NumberOfInterfaces { + get { return (int) Get ("NumIf"); } + } + public override int NumberOfIPAddresses { + get { return (int) Get ("NumAddr"); } + } + public override int NumberOfRoutes { + get { return (int) Get ("NumRoutes"); } + } + public override long OutputPacketRequests { + get { return Get ("OutRequests"); } + } + public override long OutputPacketRoutingDiscards { + get { return Get ("RoutingDiscards"); } + } + public override long OutputPacketsDiscarded { + get { return Get ("OutDiscards"); } + } + public override long OutputPacketsWithNoRoute { + get { return Get ("OutNoRoutes"); } + } + public override long PacketFragmentFailures { + get { return Get ("FragFails"); } + } + public override long PacketReassembliesRequired { + get { return Get ("ReasmReqds"); } + } + public override long PacketReassemblyFailures { + get { return Get ("ReasmFails"); } + } + public override long PacketReassemblyTimeout { + get { return Get ("ReasmTimeout"); } + } + public override long PacketsFragmented { + get { return Get ("FragOks"); } + } + public override long PacketsReassembled { + get { return Get ("ReasmOks"); } + } + public override long ReceivedPackets { + get { return Get ("InReceives"); } + } + public override long ReceivedPacketsDelivered { + get { return Get ("InDelivers"); } + } + public override long ReceivedPacketsDiscarded { + get { return Get ("InDiscards"); } + } + public override long ReceivedPacketsForwarded { + get { return Get ("ForwDatagrams"); } + } + public override long ReceivedPacketsWithAddressErrors { + get { return Get ("InAddrErrors"); } + } + public override long ReceivedPacketsWithHeadersErrors { + get { return Get ("InHdrErrors"); } + } + public override long ReceivedPacketsWithUnknownProtocol { + get { return Get ("InUnknownProtos"); } + } + } +} diff --git a/mcs/class/System/System.Net.NetworkInformation/UnixIPInterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/UnixIPInterfaceProperties.cs new file mode 100644 index 0000000000..2259533610 --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/UnixIPInterfaceProperties.cs @@ -0,0 +1,226 @@ +// +// System.Net.NetworkInformation.IPInterfaceProperties +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Collections.Generic; +using System.Net.Sockets; +using System.IO; +using System.Text.RegularExpressions; +using System.Runtime.InteropServices; + +namespace System.Net.NetworkInformation { + abstract class UnixIPInterfaceProperties : IPInterfaceProperties + { + protected IPv4InterfaceProperties ipv4iface_properties; + protected UnixNetworkInterface iface; + List addresses; + IPAddressCollection dns_servers; + + public UnixIPInterfaceProperties (UnixNetworkInterface iface, List addresses) + { + this.iface = iface; + this.addresses = addresses; + } + + public override IPv6InterfaceProperties GetIPv6Properties () + { + throw new NotImplementedException (); + } +#if MONODROID + [DllImport ("__Internal")] + static extern int _monodroid_get_dns_servers (out IntPtr dns_servers_array); + + void GetDNSServersFromOS () + { + IntPtr dsa; + int len = _monodroid_get_dns_servers (out dsa); + if (len <= 0) + return; + + var servers = new IntPtr [len]; + Marshal.Copy (dsa, servers, 0, len); + + dns_servers = new IPAddressCollection (); + foreach (IntPtr s in servers) { + string server_ip = Marshal.PtrToStringAnsi (s); + Marshal.FreeHGlobal (s); + + IPAddress addr; + if (!IPAddress.TryParse (server_ip, out addr)) + continue; + dns_servers.InternalAdd (addr); + } + Marshal.FreeHGlobal (dsa); + } +#else + static Regex ns = new Regex (@"\s*nameserver\s+(?
.*)"); + static Regex search = new Regex (@"\s*search\s+(?.*)"); + + string dns_suffix; + DateTime last_parse; + + void ParseResolvConf () + { + try { + DateTime wt = File.GetLastWriteTime ("/etc/resolv.conf"); + if (wt <= last_parse) + return; + + last_parse = wt; + dns_suffix = ""; + dns_servers = new IPAddressCollection (); + using (StreamReader reader = new StreamReader ("/etc/resolv.conf")) { + string str; + string line; + while ((line = reader.ReadLine ()) != null) { + line = line.Trim (); + if (line.Length == 0 || line [0] == '#') + continue; + Match match = ns.Match (line); + if (match.Success) { + try { + str = match.Groups ["address"].Value; + str = str.Trim (); + dns_servers.InternalAdd (IPAddress.Parse (str)); + } catch { + } + } else { + match = search.Match (line); + if (match.Success) { + str = match.Groups ["domain"].Value; + string [] parts = str.Split (','); + dns_suffix = parts [0].Trim (); + } + } + } + } + } catch { + } + } +#endif + public override IPAddressInformationCollection AnycastAddresses { + get { + var c = new IPAddressInformationCollection (); + foreach (IPAddress address in addresses) { + c.InternalAdd (new SystemIPAddressInformation (address, false, false)); + } + return c; + } + } + + [MonoTODO ("Always returns an empty collection.")] + public override IPAddressCollection DhcpServerAddresses { + get { + // There are lots of different DHCP clients + // that all store their configuration differently. + // I'm not sure what to do here. + IPAddressCollection coll = new IPAddressCollection (); + return coll; + } + } + + public override IPAddressCollection DnsAddresses { + get { +#if MONODROID + GetDNSServersFromOS (); +#else + ParseResolvConf (); +#endif + return dns_servers; + } + } + + public override string DnsSuffix { + get { +#if MONODROID + return String.Empty; +#else + ParseResolvConf (); + return dns_suffix; +#endif + } + } + + [MonoTODO ("Always returns true")] + public override bool IsDnsEnabled { + get { + return true; + } + } + + [MonoTODO ("Always returns false")] + public override bool IsDynamicDnsEnabled { + get { + return false; + } + } + + public override MulticastIPAddressInformationCollection MulticastAddresses { + get { + var multicastAddresses = new MulticastIPAddressInformationCollection (); + foreach (IPAddress address in addresses) { + byte[] addressBytes = address.GetAddressBytes (); + if (addressBytes[0] >= 224 && addressBytes[0] <= 239) { + multicastAddresses.InternalAdd (new SystemMulticastIPAddressInformation (new SystemIPAddressInformation (address, true, false))); + } + } + return multicastAddresses; + } + } + + public override UnicastIPAddressInformationCollection UnicastAddresses { + get { + var unicastAddresses = new UnicastIPAddressInformationCollection (); + foreach (IPAddress address in addresses) { + switch (address.AddressFamily) { + case AddressFamily.InterNetwork: + byte top = address.GetAddressBytes () [0]; + if (top >= 224 && top <= 239) + continue; + unicastAddresses.InternalAdd (new LinuxUnicastIPAddressInformation (address)); + break; + + case AddressFamily.InterNetworkV6: + if (address.IsIPv6Multicast) + continue; + unicastAddresses.InternalAdd (new LinuxUnicastIPAddressInformation (address)); + break; + } + } + return unicastAddresses; + } + } + + [MonoTODO ("Always returns an empty collection.")] + public override IPAddressCollection WinsServersAddresses { + get { + // I do SUPPOSE we could scrape /etc/samba/smb.conf, but.. yeesh. + return new IPAddressCollection (); + } + } + } +} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipientEnumerator.cs b/mcs/class/System/System.Net.NetworkInformation/UnixIPv4InterfaceProperties.cs similarity index 52% rename from mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipientEnumerator.cs rename to mcs/class/System/System.Net.NetworkInformation/UnixIPv4InterfaceProperties.cs index 7bfcf737b7..1925c3936a 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsRecipientEnumerator.cs +++ b/mcs/class/System/System.Net.NetworkInformation/UnixIPv4InterfaceProperties.cs @@ -1,11 +1,12 @@ // -// System.Security.Cryptography.Pkcs.CmsRecipientEnumerator +// System.Net.NetworkInformation.IPv4InterfaceProperties // -// Author: -// Sebastien Pouliot +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Marek Habersack (mhabersack@novell.com) // -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -26,45 +27,37 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +namespace System.Net.NetworkInformation { + abstract class UnixIPv4InterfaceProperties : IPv4InterfaceProperties + { + protected UnixNetworkInterface iface; - -using System; -using System.Collections; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class CmsRecipientEnumerator : IEnumerator { - - private IEnumerator enumerator; - - // constructors - - internal CmsRecipientEnumerator (IEnumerable enumerable) + public UnixIPv4InterfaceProperties (UnixNetworkInterface iface) { - enumerator = enumerable.GetEnumerator (); + this.iface = iface; } - // properties - - public CmsRecipient Current { - get { return (CmsRecipient) enumerator.Current; } + public override int Index { + get { return iface.NameIndex; } } - object IEnumerator.Current { - get { return enumerator.Current; } + // TODO: how to discover that? + public override bool IsAutomaticPrivateAddressingActive { + get { return false; } } - // methods - - public bool MoveNext () - { - return enumerator.MoveNext (); + // TODO: how to discover that? + public override bool IsAutomaticPrivateAddressingEnabled { + get { return false; } } - public void Reset () - { - enumerator.Reset (); + // TODO: how to discover that? The only way is distribution-specific... + public override bool IsDhcpEnabled { + get { return false; } + } + + public override bool UsesWins { + get { return false; } } } } - diff --git a/mcs/class/System/System.Net.NetworkInformation/UnixIcmpV4Statistics.cs b/mcs/class/System/System.Net.NetworkInformation/UnixIcmpV4Statistics.cs new file mode 100644 index 0000000000..92c3ef8cba --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/UnixIcmpV4Statistics.cs @@ -0,0 +1,126 @@ +// +// System.Net.NetworkInformation.IcmpV4Statistics +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Collections.Specialized; +using System.Globalization; + +namespace System.Net.NetworkInformation { + class MibIcmpV4Statistics : IcmpV4Statistics + { + StringDictionary dic; + + public MibIcmpV4Statistics (StringDictionary dic) + { + this.dic = dic; + } + + long Get (string name) + { + return dic [name] != null ? long.Parse (dic [name], NumberFormatInfo.InvariantInfo) : 0; + } + + public override long AddressMaskRepliesReceived { + get { return Get ("InAddrMaskReps"); } + } + public override long AddressMaskRepliesSent { + get { return Get ("OutAddrMaskReps"); } + } + public override long AddressMaskRequestsReceived { + get { return Get ("InAddrMasks"); } + } + public override long AddressMaskRequestsSent { + get { return Get ("OutAddrMasks"); } + } + public override long DestinationUnreachableMessagesReceived { + get { return Get ("InDestUnreachs"); } + } + public override long DestinationUnreachableMessagesSent { + get { return Get ("OutDestUnreachs"); } + } + public override long EchoRepliesReceived { + get { return Get ("InEchoReps"); } + } + public override long EchoRepliesSent { + get { return Get ("OutEchoReps"); } + } + public override long EchoRequestsReceived { + get { return Get ("InEchos"); } + } + public override long EchoRequestsSent { + get { return Get ("OutEchos"); } + } + public override long ErrorsReceived { + get { return Get ("InErrors"); } + } + public override long ErrorsSent { + get { return Get ("OutErrors"); } + } + public override long MessagesReceived { + get { return Get ("InMsgs"); } + } + public override long MessagesSent { + get { return Get ("OutMsgs"); } + } + public override long ParameterProblemsReceived { + get { return Get ("InParmProbs"); } + } + public override long ParameterProblemsSent { + get { return Get ("OutParmProbs"); } + } + public override long RedirectsReceived { + get { return Get ("InRedirects"); } + } + public override long RedirectsSent { + get { return Get ("OutRedirects"); } + } + public override long SourceQuenchesReceived { + get { return Get ("InSrcQuenchs"); } + } + public override long SourceQuenchesSent { + get { return Get ("OutSrcQuenchs"); } + } + public override long TimeExceededMessagesReceived { + get { return Get ("InTimeExcds"); } + } + public override long TimeExceededMessagesSent { + get { return Get ("OutTimeExcds"); } + } + public override long TimestampRepliesReceived { + get { return Get ("InTimestampReps"); } + } + public override long TimestampRepliesSent { + get { return Get ("OutTimestampReps"); } + } + public override long TimestampRequestsReceived { + get { return Get ("InTimestamps"); } + } + public override long TimestampRequestsSent { + get { return Get ("OutTimestamps"); } + } + } +} diff --git a/mcs/class/System/System.Net.NetworkInformation/UnixIcmpV6Statistics.cs b/mcs/class/System/System.Net.NetworkInformation/UnixIcmpV6Statistics.cs new file mode 100644 index 0000000000..b71fdfe4bb --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/UnixIcmpV6Statistics.cs @@ -0,0 +1,145 @@ +// +// System.Net.NetworkInformation.IcmpV6Statistics +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Collections.Specialized; +using System.Globalization; + +namespace System.Net.NetworkInformation { + class MibIcmpV6Statistics : IcmpV6Statistics + { + StringDictionary dic; + + public MibIcmpV6Statistics (StringDictionary dic) + { + this.dic = dic; + } + + long Get (string name) + { + return dic [name] != null ? long.Parse (dic [name], NumberFormatInfo.InvariantInfo) : 0; + } + + public override long DestinationUnreachableMessagesReceived { + get { return Get ("InDestUnreachs"); } + } + public override long DestinationUnreachableMessagesSent { + get { return Get ("OutDestUnreachs"); } + } + public override long EchoRepliesReceived { + get { return Get ("InEchoReplies"); } + } + public override long EchoRepliesSent { + get { return Get ("OutEchoReplies"); } + } + public override long EchoRequestsReceived { + get { return Get ("InEchos"); } + } + public override long EchoRequestsSent { + get { return Get ("OutEchos"); } + } + public override long ErrorsReceived { + get { return Get ("InErrors"); } + } + public override long ErrorsSent { + get { return Get ("OutErrors"); } + } + public override long MembershipQueriesReceived { + get { return Get ("InGroupMembQueries"); } + } + public override long MembershipQueriesSent { + get { return Get ("OutGroupMembQueries"); } + } + public override long MembershipReductionsReceived { + get { return Get ("InGroupMembReductiions"); } + } + public override long MembershipReductionsSent { + get { return Get ("OutGroupMembReductiions"); } + } + public override long MembershipReportsReceived { + get { return Get ("InGroupMembRespons"); } + } + public override long MembershipReportsSent { + get { return Get ("OutGroupMembRespons"); } + } + public override long MessagesReceived { + get { return Get ("InMsgs"); } + } + public override long MessagesSent { + get { return Get ("OutMsgs"); } + } + public override long NeighborAdvertisementsReceived { + get { return Get ("InNeighborAdvertisements"); } + } + public override long NeighborAdvertisementsSent { + get { return Get ("OutNeighborAdvertisements"); } + } + public override long NeighborSolicitsReceived { + get { return Get ("InNeighborSolicits"); } + } + public override long NeighborSolicitsSent { + get { return Get ("OutNeighborSolicits"); } + } + public override long PacketTooBigMessagesReceived { + get { return Get ("InPktTooBigs"); } + } + public override long PacketTooBigMessagesSent { + get { return Get ("OutPktTooBigs"); } + } + public override long ParameterProblemsReceived { + get { return Get ("InParmProblems"); } + } + public override long ParameterProblemsSent { + get { return Get ("OutParmProblems"); } + } + public override long RedirectsReceived { + get { return Get ("InRedirects"); } + } + public override long RedirectsSent { + get { return Get ("OutRedirects"); } + } + public override long RouterAdvertisementsReceived { + get { return Get ("InRouterAdvertisements"); } + } + public override long RouterAdvertisementsSent { + get { return Get ("OutRouterAdvertisements"); } + } + public override long RouterSolicitsReceived { + get { return Get ("InRouterSolicits"); } + } + public override long RouterSolicitsSent { + get { return Get ("OutRouterSolicits"); } + } + public override long TimeExceededMessagesReceived { + get { return Get ("InTimeExcds"); } + } + public override long TimeExceededMessagesSent { + get { return Get ("OutTimeExcds"); } + } + } +} + diff --git a/mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterface.cs new file mode 100644 index 0000000000..a50ef0784e --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterface.cs @@ -0,0 +1,154 @@ +// +// System.Net.NetworkInformation.NetworkInterface +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Miguel de Icaza (miguel@novell.com) +// Eric Butler (eric@extremeboredom.net) +// Marek Habersack (mhabersack@novell.com) +// Marek Safar (marek.safar@gmail.com) +// +// Copyright (c) 2006-2008 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Collections.Generic; +using System.Net.Sockets; +using System.Runtime.InteropServices; + +namespace System.Net.NetworkInformation { + internal abstract class UnixNetworkInterfaceAPI : NetworkInterfaceFactory + { +#if ORBIS + public static int if_nametoindex(string ifname) + { + throw new PlatformNotSupportedException (); + } + + protected static int getifaddrs (out IntPtr ifap) + { + throw new PlatformNotSupportedException (); + } + + protected static void freeifaddrs (IntPtr ifap) + { + throw new PlatformNotSupportedException (); + } +#else + [DllImport("libc")] + public static extern int if_nametoindex(string ifname); + + [DllImport ("libc")] + protected static extern int getifaddrs (out IntPtr ifap); + + [DllImport ("libc")] + protected static extern void freeifaddrs (IntPtr ifap); +#endif + } + + abstract class UnixNetworkInterface : NetworkInterface + { + + protected IPv4InterfaceStatistics ipv4stats; + protected IPInterfaceProperties ipproperties; + + string name; + //int index; + protected List addresses; + byte[] macAddress; + NetworkInterfaceType type; + + internal UnixNetworkInterface (string name) + { + this.name = name; + addresses = new List (); + } + + internal void AddAddress (IPAddress address) + { + addresses.Add (address); + } + + internal void SetLinkLayerInfo (int index, byte[] macAddress, NetworkInterfaceType type) + { + //this.index = index; + this.macAddress = macAddress; + this.type = type; + } + + public override PhysicalAddress GetPhysicalAddress () + { + if (macAddress != null) + return new PhysicalAddress (macAddress); + else + return PhysicalAddress.None; + } + + public override bool Supports (NetworkInterfaceComponent networkInterfaceComponent) + { + bool wantIPv4 = networkInterfaceComponent == NetworkInterfaceComponent.IPv4; + bool wantIPv6 = wantIPv4 ? false : networkInterfaceComponent == NetworkInterfaceComponent.IPv6; + + foreach (IPAddress address in addresses) { + if (wantIPv4 && address.AddressFamily == AddressFamily.InterNetwork) + return true; + else if (wantIPv6 && address.AddressFamily == AddressFamily.InterNetworkV6) + return true; + } + + return false; + } + + public override string Description { + get { return name; } + } + + public override string Id { + get { return name; } + } + + public override bool IsReceiveOnly { + get { return false; } + } + + public override string Name { + get { return name; } + } + + public override NetworkInterfaceType NetworkInterfaceType { + get { return type; } + } + + [MonoTODO ("Parse dmesg?")] + public override long Speed { + get { + // Bits/s + return 1000000; + } + } + + internal int NameIndex { + get { + return UnixNetworkInterfaceAPI.if_nametoindex (Name); + } + } + } +} diff --git a/mcs/class/corlib/System/ResolveEventArgs.cs b/mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs similarity index 56% rename from mcs/class/corlib/System/ResolveEventArgs.cs rename to mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs index 98ca78e261..2f2f1b016d 100644 --- a/mcs/class/corlib/System/ResolveEventArgs.cs +++ b/mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs @@ -1,14 +1,15 @@ // -// System.ResolveEventArgs.cs +// System.Net.NetworkInformation.NetworkInterface // -// Author: -// Nick Drochak (ndrochak@gol.com) +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Miguel de Icaza (miguel@novell.com) +// Eric Butler (eric@extremeboredom.net) +// Marek Habersack (mhabersack@novell.com) +// Marek Safar (marek.safar@gmail.com) // -// (C) 2001 Nick Drochak, All Rights Reserved -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// Copyright (c) 2006-2008 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -29,37 +30,25 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System.Runtime.InteropServices; -using System.Reflection; - -namespace System -{ - [ComVisible (true)] - public class ResolveEventArgs : EventArgs +namespace System.Net.NetworkInformation { + internal static class UnixNetworkInterfaceFactoryPal { - private string m_Name; - private Assembly m_Requesting; - - public ResolveEventArgs (string name) + public static NetworkInterfaceFactory Create () { - m_Name = name; - } +#if MONOTOUCH || XAMMAC + return new MacOsNetworkInterfaceAPI (); +#else + bool runningOnUnix = (Environment.OSVersion.Platform == PlatformID.Unix); - public ResolveEventArgs (string name, Assembly requestingAssembly) { - this.m_Name = name; - this.m_Requesting = requestingAssembly; - } + if (runningOnUnix) { + if (Platform.IsMacOS || Platform.IsFreeBSD) + return new MacOsNetworkInterfaceAPI (); - public string Name { - get { - return m_Name; + return new LinuxNetworkInterfaceAPI (); } - } - public Assembly RequestingAssembly { - get { - return m_Requesting; - } + return null; +#endif } } } diff --git a/mcs/class/System/System.Net.NetworkInformation/UnixTcpStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/UnixTcpStatistics.cs new file mode 100644 index 0000000000..39f8236e80 --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/UnixTcpStatistics.cs @@ -0,0 +1,90 @@ +// +// System.Net.NetworkInformation.TcpStatistics +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System.Collections.Specialized; +using System.Globalization; + +namespace System.Net.NetworkInformation { + class MibTcpStatistics : TcpStatistics + { + StringDictionary dic; + + public MibTcpStatistics (StringDictionary dic) + { + this.dic = dic; + } + + long Get (string name) + { + return dic [name] != null ? long.Parse (dic [name], NumberFormatInfo.InvariantInfo) : 0; + } + + public override long ConnectionsAccepted { + get { return Get ("PassiveOpens"); } + } + public override long ConnectionsInitiated { + get { return Get ("ActiveOpens"); } + } + public override long CumulativeConnections { + get { return Get ("NumConns"); } + } + public override long CurrentConnections { + get { return Get ("CurrEstab"); } + } + public override long ErrorsReceived { + get { return Get ("InErrs"); } + } + public override long FailedConnectionAttempts { + get { return Get ("AttemptFails"); } + } + public override long MaximumConnections { + get { return Get ("MaxConn"); } + } + public override long MaximumTransmissionTimeout { + get { return Get ("RtoMax"); } + } + public override long MinimumTransmissionTimeout { + get { return Get ("RtoMin"); } + } + public override long ResetConnections { + get { return Get ("EstabResets"); } + } + public override long ResetsSent { + get { return Get ("OutRsts"); } + } + public override long SegmentsReceived { + get { return Get ("InSegs"); } + } + public override long SegmentsResent { + get { return Get ("RetransSegs"); } + } + public override long SegmentsSent { + get { return Get ("OutSegs"); } + } + } +} diff --git a/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/UnixUdpStatistics.cs similarity index 73% rename from mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs rename to mcs/class/System/System.Net.NetworkInformation/UnixUdpStatistics.cs index 970d9747b1..cc045c908e 100644 --- a/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/UnixUdpStatistics.cs @@ -60,46 +60,4 @@ namespace System.Net.NetworkInformation { get { return (int) Get ("NumAddrs"); } } } - -#if WIN_PLATFORM - class Win32UdpStatistics : UdpStatistics - { - Win32_MIB_UDPSTATS info; - - public Win32UdpStatistics (Win32_MIB_UDPSTATS info) - { - this.info = info; - } - - public override long DatagramsReceived { - get { return info.InDatagrams; } - } - - public override long DatagramsSent { - get { return info.OutDatagrams; } - } - - public override long IncomingDatagramsDiscarded { - get { return info.NoPorts; } - } - - public override long IncomingDatagramsWithErrors { - get { return info.InErrors; } - } - - public override int UdpListeners { - get { return info.NumAddrs; } - } - } - - struct Win32_MIB_UDPSTATS - { - public uint InDatagrams; - public uint NoPorts; - public uint InErrors; - public uint OutDatagrams; - public int NumAddrs; - } -#endif } - diff --git a/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IPAddressCollection.cs similarity index 97% rename from mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32IPAddressCollection.cs index 54b831f6a4..e22e7137d5 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPAddressCollection.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32IPAddressCollection.cs @@ -26,15 +26,10 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System; -using System.Collections; -using System.Collections.Generic; -using System.Net; +#if WIN_PLATFORM using System.Runtime.InteropServices; namespace System.Net.NetworkInformation { - -#if WIN_PLATFORM class Win32IPAddressCollection : IPAddressCollection { public static readonly Win32IPAddressCollection Empty = new Win32IPAddressCollection (IntPtr.Zero); @@ -93,7 +88,5 @@ namespace System.Net.NetworkInformation { } } } -#endif } - - +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalProperties.cs similarity index 54% rename from mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalProperties.cs index 3d5476a67c..49d9a2617d 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalProperties.cs @@ -27,338 +27,12 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // - +#if WIN_PLATFORM using System.Collections.Generic; -using System.Collections.Specialized; -using System.Globalization; -using System.IO; using System.Net.Sockets; using System.Runtime.InteropServices; -using System.Text; namespace System.Net.NetworkInformation { - abstract class CommonUnixIPGlobalProperties : IPGlobalProperties - { - [DllImport ("libc")] - static extern int gethostname ([MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 1)] byte [] name, int len); - -#if !ORBIS - [DllImport ("libc")] - static extern int getdomainname ([MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 1)] byte [] name, int len); -#else - static int getdomainname ([MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 1)] byte [] name, int len) - { - throw new PlatformNotSupportedException (); - } -#endif - - public override string DhcpScopeName { - get { return String.Empty; } - } - - public override string DomainName { - get { - byte [] bytes = new byte [256]; - if (getdomainname (bytes, 256) != 0) - throw new NetworkInformationException (); - int len = Array.IndexOf (bytes, 0); - return Encoding.ASCII.GetString (bytes, 0, len < 0 ? 256 : len); - } - } - - public override string HostName { - get { - byte [] bytes = new byte [256]; - if (gethostname (bytes, 256) != 0) - throw new NetworkInformationException (); - int len = Array.IndexOf (bytes, 0); - return Encoding.ASCII.GetString (bytes, 0, len < 0 ? 256 : len); - } - } - - public override bool IsWinsProxy { - get { return false; } // no WINS - } - - public override NetBiosNodeType NodeType { - get { return NetBiosNodeType.Unknown; } // no NetBios - } - } - - class UnixIPGlobalProperties : CommonUnixIPGlobalProperties - { - public override TcpConnectionInformation [] GetActiveTcpConnections () - { - throw new NotImplementedException (); - } - - public override IPEndPoint [] GetActiveTcpListeners () - { - throw new NotImplementedException (); - } - - public override IPEndPoint [] GetActiveUdpListeners () - { - throw new NotImplementedException (); - } - - public override IcmpV4Statistics GetIcmpV4Statistics () - { - throw new NotImplementedException (); - } - - public override IcmpV6Statistics GetIcmpV6Statistics () - { - throw new NotImplementedException (); - } - - public override IPGlobalStatistics GetIPv4GlobalStatistics () - { - throw new NotImplementedException (); - } - - public override IPGlobalStatistics GetIPv6GlobalStatistics () - { - throw new NotImplementedException (); - } - - public override TcpStatistics GetTcpIPv4Statistics () - { - throw new NotImplementedException (); - } - - public override TcpStatistics GetTcpIPv6Statistics () - { - throw new NotImplementedException (); - } - - public override UdpStatistics GetUdpIPv4Statistics () - { - throw new NotImplementedException (); - } - - public override UdpStatistics GetUdpIPv6Statistics () - { - throw new NotImplementedException (); - } - } - -#if MONODROID - sealed class AndroidIPGlobalProperties : UnixIPGlobalProperties - { - public override string DomainName { - get { - return String.Empty; - } - } - } -#endif - - // It expects /proc/net/snmp (or /usr/compat/linux/proc/net/snmp), - // formatted like: - // http://www.linuxdevcenter.com/linux/2000/11/16/example5.html - // http://www.linuxdevcenter.com/linux/2000/11/16/example2.html - class MibIPGlobalProperties : UnixIPGlobalProperties - { - public const string ProcDir = "/proc"; - public const string CompatProcDir = "/usr/compat/linux/proc"; - - public readonly string StatisticsFile, StatisticsFileIPv6, TcpFile, Tcp6File, UdpFile, Udp6File; - - public MibIPGlobalProperties (string procDir) - { - StatisticsFile = Path.Combine (procDir, "net/snmp"); - StatisticsFileIPv6 = Path.Combine (procDir, "net/snmp6"); - TcpFile = Path.Combine (procDir,"net/tcp"); - Tcp6File = Path.Combine (procDir,"net/tcp6"); - UdpFile = Path.Combine (procDir,"net/udp"); - Udp6File = Path.Combine (procDir,"net/udp6"); - } - - StringDictionary GetProperties4 (string item) - { - string file = StatisticsFile; - - string head = item + ": "; - using (StreamReader sr = new StreamReader (file, Encoding.ASCII)) { - string [] keys = null; - string [] values = null; - string s = String.Empty; - do { - s = sr.ReadLine (); - if (String.IsNullOrEmpty (s)) - continue; - if (s.Length <= head.Length || String.CompareOrdinal (s, 0, head, 0, head.Length) != 0) - continue; - if (keys == null) - keys = s.Substring (head.Length).Split (' '); - else if (values != null) - // hmm, there may be better error type... - throw CreateException (file, String.Format ("Found duplicate line for values for the same item '{0}'", item)); - else { - values = s.Substring (head.Length).Split (' '); - break; - } - } while (!sr.EndOfStream); - - if (values == null) - throw CreateException (file, String.Format ("No corresponding line was not found for '{0}'", item)); - if (keys.Length != values.Length) - throw CreateException (file, String.Format ("The counts in the header line and the value line do not match for '{0}'", item)); - StringDictionary dic = new StringDictionary (); - for (int i = 0; i < keys.Length; i++) - dic [keys [i]] = values [i]; - return dic; - } - } - - StringDictionary GetProperties6 (string item) - { - if (!File.Exists (StatisticsFileIPv6)) - throw new NetworkInformationException (); - - string file = StatisticsFileIPv6; - - string head = item; - using (StreamReader sr = new StreamReader (file, Encoding.ASCII)) { - StringDictionary dic = new StringDictionary (); - string s = String.Empty; - do { - s = sr.ReadLine (); - if (String.IsNullOrEmpty (s)) - continue; - if (s.Length <= head.Length || String.CompareOrdinal (s, 0, head, 0, head.Length) != 0) - continue; - int idx = s.IndexOfAny (wsChars, head.Length); - if (idx < 0) - throw CreateException (file, null); - dic [s.Substring (head.Length, idx - head.Length)] = s.Substring (idx + 1).Trim (wsChars); - } while (!sr.EndOfStream); - - return dic; - } - } - - static readonly char [] wsChars = new char [] {' ', '\t'}; - - Exception CreateException (string file, string msg) - { - return new InvalidOperationException (String.Format ("Unsupported (unexpected) '{0}' file format. ", file) + msg); - } - IPEndPoint [] GetLocalAddresses (List list) - { - IPEndPoint [] ret = new IPEndPoint [list.Count]; - for (int i = 0; i < ret.Length; i++) - ret [i] = ToEndpoint (list [i] [1]); - return ret; - } - - IPEndPoint ToEndpoint (string s) - { - int idx = s.IndexOf (':'); - int port = int.Parse (s.Substring (idx + 1), NumberStyles.HexNumber); - if (s.Length == 13) - return new IPEndPoint (long.Parse (s.Substring (0, idx), NumberStyles.HexNumber), port); - else { - byte [] bytes = new byte [16]; - for (int i = 0; (i << 1) < idx; i++) - bytes [i] = byte.Parse (s.Substring (i << 1, 2), NumberStyles.HexNumber); - return new IPEndPoint (new IPAddress (bytes), port); - } - } - - void GetRows (string file, List list) - { - if (!File.Exists (file)) - return; - using (StreamReader sr = new StreamReader (file, Encoding.ASCII)) { - sr.ReadLine (); // skip first line - while (!sr.EndOfStream) { - string [] item = sr.ReadLine ().Split (wsChars, StringSplitOptions.RemoveEmptyEntries); - if (item.Length < 4) - throw CreateException (file, null); - list.Add (item); - } - } - } - - public override TcpConnectionInformation [] GetActiveTcpConnections () - { - List list = new List (); - GetRows (TcpFile, list); - GetRows (Tcp6File, list); - - TcpConnectionInformation [] ret = new TcpConnectionInformation [list.Count]; - for (int i = 0; i < ret.Length; i++) { - // sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode - IPEndPoint local = ToEndpoint (list [i] [1]); - IPEndPoint remote = ToEndpoint (list [i] [2]); - TcpState state = (TcpState) int.Parse (list [i] [3], NumberStyles.HexNumber); - ret [i] = new SystemTcpConnectionInformation (local, remote, state); - } - return ret; - } - - public override IPEndPoint [] GetActiveTcpListeners () - { - List list = new List (); - GetRows (TcpFile, list); - GetRows (Tcp6File, list); - return GetLocalAddresses (list); - } - - public override IPEndPoint [] GetActiveUdpListeners () - { - List list = new List (); - GetRows (UdpFile, list); - GetRows (Udp6File, list); - return GetLocalAddresses (list); - } - - public override IcmpV4Statistics GetIcmpV4Statistics () - { - return new MibIcmpV4Statistics (GetProperties4 ("Icmp")); - } - - public override IcmpV6Statistics GetIcmpV6Statistics () - { - return new MibIcmpV6Statistics (GetProperties6 ("Icmp6")); - } - - public override IPGlobalStatistics GetIPv4GlobalStatistics () - { - return new MibIPGlobalStatistics (GetProperties4 ("Ip")); - } - - public override IPGlobalStatistics GetIPv6GlobalStatistics () - { - return new MibIPGlobalStatistics (GetProperties6 ("Ip6")); - } - - public override TcpStatistics GetTcpIPv4Statistics () - { - return new MibTcpStatistics (GetProperties4 ("Tcp")); - } - - public override TcpStatistics GetTcpIPv6Statistics () - { - // There is no TCP info in /proc/net/snmp, - // so it is shared with IPv4 info. - return new MibTcpStatistics (GetProperties4 ("Tcp")); - } - - public override UdpStatistics GetUdpIPv4Statistics () - { - return new MibUdpStatistics (GetProperties4 ("Udp")); - } - - public override UdpStatistics GetUdpIPv6Statistics () - { - return new MibUdpStatistics (GetProperties6 ("Udp6")); - } - } - -#if WIN_PLATFORM class Win32IPGlobalProperties : IPGlobalProperties { public const int AF_INET = 2; @@ -695,5 +369,21 @@ namespace System.Net.NetworkInformation { } } } + + internal static class Win32IPGlobalPropertiesFactoryPal { + public static IPGlobalProperties Create () + { +#if MONO +#if WIN_PLATFORM + return new Win32IPGlobalProperties (); +#else + return null; #endif +#else + (new NetworkInformationPermission (NetworkInformationAccess.Read)).Demand (); + return new SystemIPGlobalProperties (); +#endif + } + } } +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalStatistics.cs similarity index 63% rename from mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalStatistics.cs index 117e59e680..e3d05a4d3e 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32IPGlobalStatistics.cs @@ -26,95 +26,11 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System.Collections.Specialized; -using System.Globalization; +#if WIN_PLATFORM using System.Runtime.InteropServices; namespace System.Net.NetworkInformation { - class MibIPGlobalStatistics : IPGlobalStatistics - { - StringDictionary dic; - - public MibIPGlobalStatistics (StringDictionary dic) - { - this.dic = dic; - } - - long Get (string name) - { - return dic [name] != null ? long.Parse (dic [name], NumberFormatInfo.InvariantInfo) : 0; - } - - public override int DefaultTtl { - get { return (int) Get ("DefaultTTL"); } - } - public override bool ForwardingEnabled { - get { return Get ("Forwarding") != 0; } - } - public override int NumberOfInterfaces { - get { return (int) Get ("NumIf"); } - } - public override int NumberOfIPAddresses { - get { return (int) Get ("NumAddr"); } - } - public override int NumberOfRoutes { - get { return (int) Get ("NumRoutes"); } - } - public override long OutputPacketRequests { - get { return Get ("OutRequests"); } - } - public override long OutputPacketRoutingDiscards { - get { return Get ("RoutingDiscards"); } - } - public override long OutputPacketsDiscarded { - get { return Get ("OutDiscards"); } - } - public override long OutputPacketsWithNoRoute { - get { return Get ("OutNoRoutes"); } - } - public override long PacketFragmentFailures { - get { return Get ("FragFails"); } - } - public override long PacketReassembliesRequired { - get { return Get ("ReasmReqds"); } - } - public override long PacketReassemblyFailures { - get { return Get ("ReasmFails"); } - } - public override long PacketReassemblyTimeout { - get { return Get ("ReasmTimeout"); } - } - public override long PacketsFragmented { - get { return Get ("FragOks"); } - } - public override long PacketsReassembled { - get { return Get ("ReasmOks"); } - } - public override long ReceivedPackets { - get { return Get ("InReceives"); } - } - public override long ReceivedPacketsDelivered { - get { return Get ("InDelivers"); } - } - public override long ReceivedPacketsDiscarded { - get { return Get ("InDiscards"); } - } - public override long ReceivedPacketsForwarded { - get { return Get ("ForwDatagrams"); } - } - public override long ReceivedPacketsWithAddressErrors { - get { return Get ("InAddrErrors"); } - } - public override long ReceivedPacketsWithHeadersErrors { - get { return Get ("InHdrErrors"); } - } - public override long ReceivedPacketsWithUnknownProtocol { - get { return Get ("InUnknownProtos"); } - } - } - -#if WIN_PLATFORM - class Win32IPGlobalStatistics : IPGlobalStatistics + class Win32IPGlobalStatistics : IPGlobalStatistics { Win32_MIB_IPSTATS info; @@ -190,7 +106,7 @@ namespace System.Net.NetworkInformation { get { return info.InUnknownProtos; } } } - + [StructLayout (LayoutKind.Sequential)] struct Win32_MIB_IPSTATS { @@ -218,6 +134,5 @@ namespace System.Net.NetworkInformation { public int NumAddr; public int NumRoutes; } -#endif } - +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/Win32IPInterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IPInterfaceProperties.cs new file mode 100644 index 0000000000..845fffebde --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/Win32IPInterfaceProperties.cs @@ -0,0 +1,183 @@ +// +// System.Net.NetworkInformation.IPInterfaceProperties +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +#if WIN_PLATFORM +using System.Runtime.InteropServices; + +namespace System.Net.NetworkInformation { + class Win32IPInterfaceProperties2 : IPInterfaceProperties + { + readonly Win32_IP_ADAPTER_ADDRESSES addr; + readonly Win32_MIB_IFROW mib4, mib6; + + public Win32IPInterfaceProperties2 (Win32_IP_ADAPTER_ADDRESSES addr, Win32_MIB_IFROW mib4, Win32_MIB_IFROW mib6) + { + this.addr = addr; + this.mib4 = mib4; + this.mib6 = mib6; + } + + public override IPv4InterfaceProperties GetIPv4Properties () + { + Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index); + return new Win32IPv4InterfaceProperties (v4info, mib4); + } + + public override IPv6InterfaceProperties GetIPv6Properties () + { + Win32_IP_ADAPTER_INFO v6info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib6.Index); + return new Win32IPv6InterfaceProperties (mib6); + } + + public override IPAddressInformationCollection AnycastAddresses { + get { return Win32FromAnycast (addr.FirstAnycastAddress); } + } + + static IPAddressInformationCollection Win32FromAnycast (IntPtr ptr) + { + var c = new IPAddressInformationCollection (); + Win32_IP_ADAPTER_ANYCAST_ADDRESS a; + for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) { + a = (Win32_IP_ADAPTER_ANYCAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_ANYCAST_ADDRESS)); + c.InternalAdd (new SystemIPAddressInformation ( + a.Address.GetIPAddress (), + a.LengthFlags.IsDnsEligible, + a.LengthFlags.IsTransient)); + } + return c; + } + + public override IPAddressCollection DhcpServerAddresses { + get { + Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index); + // FIXME: should ipv6 DhcpServer be considered? + try { + return new Win32IPAddressCollection (v4info.DhcpServer); + } catch (IndexOutOfRangeException) { + return Win32IPAddressCollection.Empty; + } + } + } + + public override IPAddressCollection DnsAddresses { + get { return Win32IPAddressCollection.FromDnsServer (addr.FirstDnsServerAddress); } + } + + public override string DnsSuffix { + get { return addr.DnsSuffix; } + } + + public override GatewayIPAddressInformationCollection GatewayAddresses { + get { + var col = new GatewayIPAddressInformationCollection (); + try { + Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index); + // FIXME: should ipv6 DhcpServer be considered? + + var a = v4info.GatewayList; + if (!String.IsNullOrEmpty (a.IpAddress)) { + col.InternalAdd(new SystemGatewayIPAddressInformation(IPAddress.Parse (a.IpAddress))); + AddSubsequently (a.Next, col); + } + } catch (IndexOutOfRangeException) {} + return col; + } + } + + static void AddSubsequently (IntPtr head, GatewayIPAddressInformationCollection col) + { + Win32_IP_ADDR_STRING a; + for (IntPtr p = head; p != IntPtr.Zero; p = a.Next) { + a = (Win32_IP_ADDR_STRING) Marshal.PtrToStructure (p, typeof (Win32_IP_ADDR_STRING)); + col.InternalAdd (new SystemGatewayIPAddressInformation (IPAddress.Parse (a.IpAddress))); + } + } + + public override bool IsDnsEnabled { + get { return Win32NetworkInterface.FixedInfo.EnableDns != 0; } + } + + public override bool IsDynamicDnsEnabled { + get { return addr.DdnsEnabled; } + } + + public override MulticastIPAddressInformationCollection MulticastAddresses { + get { return Win32FromMulticast (addr.FirstMulticastAddress); } + } + + static MulticastIPAddressInformationCollection Win32FromMulticast (IntPtr ptr) + { + var c = new MulticastIPAddressInformationCollection (); + Win32_IP_ADAPTER_MULTICAST_ADDRESS a; + for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) { + a = (Win32_IP_ADAPTER_MULTICAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_MULTICAST_ADDRESS)); + c.InternalAdd (new SystemMulticastIPAddressInformation (new SystemIPAddressInformation ( + a.Address.GetIPAddress (), + a.LengthFlags.IsDnsEligible, + a.LengthFlags.IsTransient))); + } + return c; + } + + public override UnicastIPAddressInformationCollection UnicastAddresses { + get { + try { + Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index); + // FIXME: should ipv6 DhcpServer be considered? + return Win32FromUnicast (addr.FirstUnicastAddress); + } catch (IndexOutOfRangeException) { + return new UnicastIPAddressInformationCollection (); + } + } + } + + static UnicastIPAddressInformationCollection Win32FromUnicast (IntPtr ptr) + { + UnicastIPAddressInformationCollection c = new UnicastIPAddressInformationCollection (); + Win32_IP_ADAPTER_UNICAST_ADDRESS a; + for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) { + a = (Win32_IP_ADAPTER_UNICAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_UNICAST_ADDRESS)); + c.InternalAdd (new Win32UnicastIPAddressInformation (a)); + } + return c; + } + + public override IPAddressCollection WinsServersAddresses { + get { + try { + Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index); + // FIXME: should ipv6 DhcpServer be considered? + return new Win32IPAddressCollection (v4info.PrimaryWinsServer, v4info.SecondaryWinsServer); + } catch (IndexOutOfRangeException) { + return Win32IPAddressCollection.Empty; + } + } + } + } +} +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IPv4InterfaceProperties.cs similarity index 62% rename from mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32IPv4InterfaceProperties.cs index 86fba917ab..47f296f684 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPv4InterfaceProperties.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32IPv4InterfaceProperties.cs @@ -27,103 +27,10 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System.IO; +#if WIN_PLATFORM using System.Runtime.InteropServices; namespace System.Net.NetworkInformation { - abstract class UnixIPv4InterfaceProperties : IPv4InterfaceProperties - { - protected UnixNetworkInterface iface; - - public UnixIPv4InterfaceProperties (UnixNetworkInterface iface) - { - this.iface = iface; - } - - public override int Index { - get { return iface.NameIndex; } - } - - // TODO: how to discover that? - public override bool IsAutomaticPrivateAddressingActive { - get { return false; } - } - - // TODO: how to discover that? - public override bool IsAutomaticPrivateAddressingEnabled { - get { return false; } - } - - // TODO: how to discover that? The only way is distribution-specific... - public override bool IsDhcpEnabled { - get { return false; } - } - - public override bool UsesWins { - get { return false; } - } - } - - sealed class LinuxIPv4InterfaceProperties : UnixIPv4InterfaceProperties - { - public LinuxIPv4InterfaceProperties (LinuxNetworkInterface iface) - : base (iface) - { - } - - public override bool IsForwardingEnabled { - get { - string iface_path = "/proc/sys/net/ipv4/conf/" + iface.Name + "/forwarding"; - - if (File.Exists (iface_path)) { - string val = LinuxNetworkInterface.ReadLine (iface_path); - - return val != "0"; - } - - return false; - } - } - - public override int Mtu { - get { - string iface_path = (iface as LinuxNetworkInterface).IfacePath + "mtu"; - int ret = 0; - - if (File.Exists (iface_path)) { - string val = LinuxNetworkInterface.ReadLine (iface_path); - - try { - ret = Int32.Parse (val); - } catch { - } - } - - return ret; - - } - } - } - - sealed class MacOsIPv4InterfaceProperties : UnixIPv4InterfaceProperties - { - public MacOsIPv4InterfaceProperties (MacOsNetworkInterface iface) - : base (iface) - { - } - - // dummy - public override bool IsForwardingEnabled { - get { return false; } - } - - // dummy - public override int Mtu { - get { return 0; } - } - } - -#if WIN_PLATFORM sealed class Win32IPv4InterfaceProperties : IPv4InterfaceProperties { [DllImport ("iphlpapi.dll")] @@ -185,6 +92,5 @@ namespace System.Net.NetworkInformation { public IntPtr CurrentDnsServer; // to Win32_IP_ADDR_STRING public Win32_IP_ADDR_STRING DnsServerList; } -#endif } - +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/Win32IPv4InterfaceStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IPv4InterfaceStatistics.cs new file mode 100644 index 0000000000..710ff87a63 --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/Win32IPv4InterfaceStatistics.cs @@ -0,0 +1,91 @@ +// +// System.Net.NetworkInformation.IPv4InterfaceStatistics +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Miguel de Icaza (miguel@ximian.com) +// +// Copyright (c) 2006-2008 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +#if WIN_PLATFORM +namespace System.Net.NetworkInformation { + class Win32IPv4InterfaceStatistics : IPv4InterfaceStatistics + { + Win32_MIB_IFROW info; + + public Win32IPv4InterfaceStatistics (Win32_MIB_IFROW info) + { + this.info = info; + } + + public override long BytesReceived { + get { return info.InOctets; } + } + + public override long BytesSent { + get { return info.OutOctets; } + } + + public override long IncomingPacketsDiscarded { + get { return info.InDiscards; } + } + + public override long IncomingPacketsWithErrors { + get { return info.InErrors; } + } + + public override long IncomingUnknownProtocolPackets { + get { return info.InUnknownProtos; } + } + + public override long NonUnicastPacketsReceived { + get { return info.InNUcastPkts; } + } + + public override long NonUnicastPacketsSent { + get { return info.OutNUcastPkts; } + } + + public override long OutgoingPacketsDiscarded { + get { return info.OutDiscards; } + } + + public override long OutgoingPacketsWithErrors { + get { return info.OutErrors; } + } + + public override long OutputQueueLength { + get { return info.OutQLen; } + } + + public override long UnicastPacketsReceived { + get { return info.InUcastPkts; } + } + + public override long UnicastPacketsSent { + get { return info.OutUcastPkts; } + } + + } +} +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/IPv6InterfaceProperties.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IPv6InterfaceProperties.cs similarity index 99% rename from mcs/class/System/System.Net.NetworkInformation/IPv6InterfaceProperties.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32IPv6InterfaceProperties.cs index f38eb3e2da..67ba201d4a 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IPv6InterfaceProperties.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32IPv6InterfaceProperties.cs @@ -26,8 +26,8 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace System.Net.NetworkInformation { #if WIN_PLATFORM +namespace System.Net.NetworkInformation { class Win32IPv6InterfaceProperties : IPv6InterfaceProperties { Win32_MIB_IFROW mib; @@ -45,6 +45,5 @@ namespace System.Net.NetworkInformation { get { return mib.Mtu; } } } -#endif } - +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IcmpV4Statistics.cs similarity index 61% rename from mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32IcmpV4Statistics.cs index 5708dd41a8..8bb197c8e7 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32IcmpV4Statistics.cs @@ -26,105 +26,8 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System.Collections.Specialized; -using System.Globalization; - -namespace System.Net.NetworkInformation { - class MibIcmpV4Statistics : IcmpV4Statistics - { - StringDictionary dic; - - public MibIcmpV4Statistics (StringDictionary dic) - { - this.dic = dic; - } - - long Get (string name) - { - return dic [name] != null ? long.Parse (dic [name], NumberFormatInfo.InvariantInfo) : 0; - } - - public override long AddressMaskRepliesReceived { - get { return Get ("InAddrMaskReps"); } - } - public override long AddressMaskRepliesSent { - get { return Get ("OutAddrMaskReps"); } - } - public override long AddressMaskRequestsReceived { - get { return Get ("InAddrMasks"); } - } - public override long AddressMaskRequestsSent { - get { return Get ("OutAddrMasks"); } - } - public override long DestinationUnreachableMessagesReceived { - get { return Get ("InDestUnreachs"); } - } - public override long DestinationUnreachableMessagesSent { - get { return Get ("OutDestUnreachs"); } - } - public override long EchoRepliesReceived { - get { return Get ("InEchoReps"); } - } - public override long EchoRepliesSent { - get { return Get ("OutEchoReps"); } - } - public override long EchoRequestsReceived { - get { return Get ("InEchos"); } - } - public override long EchoRequestsSent { - get { return Get ("OutEchos"); } - } - public override long ErrorsReceived { - get { return Get ("InErrors"); } - } - public override long ErrorsSent { - get { return Get ("OutErrors"); } - } - public override long MessagesReceived { - get { return Get ("InMsgs"); } - } - public override long MessagesSent { - get { return Get ("OutMsgs"); } - } - public override long ParameterProblemsReceived { - get { return Get ("InParmProbs"); } - } - public override long ParameterProblemsSent { - get { return Get ("OutParmProbs"); } - } - public override long RedirectsReceived { - get { return Get ("InRedirects"); } - } - public override long RedirectsSent { - get { return Get ("OutRedirects"); } - } - public override long SourceQuenchesReceived { - get { return Get ("InSrcQuenchs"); } - } - public override long SourceQuenchesSent { - get { return Get ("OutSrcQuenchs"); } - } - public override long TimeExceededMessagesReceived { - get { return Get ("InTimeExcds"); } - } - public override long TimeExceededMessagesSent { - get { return Get ("OutTimeExcds"); } - } - public override long TimestampRepliesReceived { - get { return Get ("InTimestampReps"); } - } - public override long TimestampRepliesSent { - get { return Get ("OutTimestampReps"); } - } - public override long TimestampRequestsReceived { - get { return Get ("InTimestamps"); } - } - public override long TimestampRequestsSent { - get { return Get ("OutTimestamps"); } - } - } - #if WIN_PLATFORM +namespace System.Net.NetworkInformation { class Win32IcmpV4Statistics : IcmpV4Statistics { Win32_MIBICMPSTATS iin, iout; @@ -237,6 +140,5 @@ namespace System.Net.NetworkInformation { public uint AddrMasks; public uint AddrMaskReps; } -#endif } - +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs b/mcs/class/System/System.Net.NetworkInformation/Win32IcmpV6Statistics.cs similarity index 64% rename from mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32IcmpV6Statistics.cs index e7518a0a86..63246cac09 100644 --- a/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32IcmpV6Statistics.cs @@ -26,125 +26,11 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System.Collections.Specialized; -using System.Globalization; +#if WIN_PLATFORM using System.Runtime.InteropServices; namespace System.Net.NetworkInformation { - class MibIcmpV6Statistics : IcmpV6Statistics - { - StringDictionary dic; - - public MibIcmpV6Statistics (StringDictionary dic) - { - this.dic = dic; - } - - long Get (string name) - { - return dic [name] != null ? long.Parse (dic [name], NumberFormatInfo.InvariantInfo) : 0; - } - - public override long DestinationUnreachableMessagesReceived { - get { return Get ("InDestUnreachs"); } - } - public override long DestinationUnreachableMessagesSent { - get { return Get ("OutDestUnreachs"); } - } - public override long EchoRepliesReceived { - get { return Get ("InEchoReplies"); } - } - public override long EchoRepliesSent { - get { return Get ("OutEchoReplies"); } - } - public override long EchoRequestsReceived { - get { return Get ("InEchos"); } - } - public override long EchoRequestsSent { - get { return Get ("OutEchos"); } - } - public override long ErrorsReceived { - get { return Get ("InErrors"); } - } - public override long ErrorsSent { - get { return Get ("OutErrors"); } - } - public override long MembershipQueriesReceived { - get { return Get ("InGroupMembQueries"); } - } - public override long MembershipQueriesSent { - get { return Get ("OutGroupMembQueries"); } - } - public override long MembershipReductionsReceived { - get { return Get ("InGroupMembReductiions"); } - } - public override long MembershipReductionsSent { - get { return Get ("OutGroupMembReductiions"); } - } - public override long MembershipReportsReceived { - get { return Get ("InGroupMembRespons"); } - } - public override long MembershipReportsSent { - get { return Get ("OutGroupMembRespons"); } - } - public override long MessagesReceived { - get { return Get ("InMsgs"); } - } - public override long MessagesSent { - get { return Get ("OutMsgs"); } - } - public override long NeighborAdvertisementsReceived { - get { return Get ("InNeighborAdvertisements"); } - } - public override long NeighborAdvertisementsSent { - get { return Get ("OutNeighborAdvertisements"); } - } - public override long NeighborSolicitsReceived { - get { return Get ("InNeighborSolicits"); } - } - public override long NeighborSolicitsSent { - get { return Get ("OutNeighborSolicits"); } - } - public override long PacketTooBigMessagesReceived { - get { return Get ("InPktTooBigs"); } - } - public override long PacketTooBigMessagesSent { - get { return Get ("OutPktTooBigs"); } - } - public override long ParameterProblemsReceived { - get { return Get ("InParmProblems"); } - } - public override long ParameterProblemsSent { - get { return Get ("OutParmProblems"); } - } - public override long RedirectsReceived { - get { return Get ("InRedirects"); } - } - public override long RedirectsSent { - get { return Get ("OutRedirects"); } - } - public override long RouterAdvertisementsReceived { - get { return Get ("InRouterAdvertisements"); } - } - public override long RouterAdvertisementsSent { - get { return Get ("OutRouterAdvertisements"); } - } - public override long RouterSolicitsReceived { - get { return Get ("InRouterSolicits"); } - } - public override long RouterSolicitsSent { - get { return Get ("OutRouterSolicits"); } - } - public override long TimeExceededMessagesReceived { - get { return Get ("InTimeExcds"); } - } - public override long TimeExceededMessagesSent { - get { return Get ("OutTimeExcds"); } - } - } - - class IcmpV6MessageTypes - { + class IcmpV6MessageTypes { public const int DestinationUnreachable = 1; public const int PacketTooBig = 2; public const int TimeExceeded = 3; @@ -162,7 +48,6 @@ namespace System.Net.NetworkInformation { public const int RouterRenumbering = 138; } -#if WIN_PLATFORM class Win32IcmpV6Statistics : IcmpV6Statistics { Win32_MIBICMPSTATS_EX iin, iout; @@ -284,6 +169,5 @@ namespace System.Net.NetworkInformation { [MarshalAs (UnmanagedType.ByValArray, SizeConst = 256)] public uint [] Counts; } -#endif } - +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterface.cs new file mode 100644 index 0000000000..3f08393569 --- /dev/null +++ b/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterface.cs @@ -0,0 +1,210 @@ +// +// System.Net.NetworkInformation.NetworkInterface +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Miguel de Icaza (miguel@novell.com) +// Eric Butler (eric@extremeboredom.net) +// Marek Habersack (mhabersack@novell.com) +// Marek Safar (marek.safar@gmail.com) +// +// Copyright (c) 2006-2008 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +#if WIN_PLATFORM +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace System.Net.NetworkInformation { + internal class Win32NetworkInterfaceAPI : NetworkInterfaceFactory + { + private const string IPHLPAPI = "iphlpapi.dll"; + + [DllImport (IPHLPAPI, SetLastError = true)] + static extern int GetAdaptersAddresses (uint family, uint flags, IntPtr reserved, IntPtr info, ref int size); + + [DllImport (IPHLPAPI)] + static extern uint GetBestInterfaceEx (byte[] ipAddress, out int index); + + static Win32_IP_ADAPTER_ADDRESSES [] GetAdaptersAddresses () + { + IntPtr ptr = IntPtr.Zero; + int len = 0; + GetAdaptersAddresses (0, 0, IntPtr.Zero, ptr, ref len); + ptr = Marshal.AllocHGlobal(len); + int ret = GetAdaptersAddresses (0, 0, IntPtr.Zero, ptr, ref len); + if (ret != 0) + throw new NetworkInformationException (ret); + + List l = new List (); + Win32_IP_ADAPTER_ADDRESSES info; + for (IntPtr p = ptr; p != IntPtr.Zero; p = info.Next) { + info = Marshal.PtrToStructure (p); + l.Add (info); + } + + return l.ToArray (); + } + + public override NetworkInterface [] GetAllNetworkInterfaces () + { +// Win32_IP_ADAPTER_INFO [] ai = GetAdaptersInfo (); + Win32_IP_ADAPTER_ADDRESSES [] aa = GetAdaptersAddresses (); + NetworkInterface [] ret = new NetworkInterface [aa.Length]; + for (int i = 0; i < ret.Length; i++) + ret [i] = new Win32NetworkInterface2 (aa [i]); + return ret; + } + + private static int GetBestInterfaceForAddress (IPAddress addr) { + int index; + SocketAddress address = new SocketAddress (addr); + int error = (int) GetBestInterfaceEx (address.m_Buffer, out index); + if (error != 0) { + throw new NetworkInformationException (error); + } + + return index; + } + + public override int GetLoopbackInterfaceIndex () + { + return GetBestInterfaceForAddress (IPAddress.Loopback); + } + + public override IPAddress GetNetMask (IPAddress address) + { + throw new NotImplementedException (); + } + } + + sealed class Win32NetworkInterface2 : NetworkInterface + { + [DllImport ("iphlpapi.dll", SetLastError = true)] + static extern int GetAdaptersInfo (IntPtr info, ref int size); + + [DllImport ("iphlpapi.dll", SetLastError = true)] + static extern int GetIfEntry (ref Win32_MIB_IFROW row); + + public static Win32_IP_ADAPTER_INFO GetAdapterInfoByIndex (int index) + { + foreach (Win32_IP_ADAPTER_INFO info in GetAdaptersInfo ()) + if (info.Index == index) + return info; + throw new IndexOutOfRangeException ("No adapter found for index " + index); + } + + static Win32_IP_ADAPTER_INFO [] GetAdaptersInfo () + { + int len = 0; + IntPtr ptr = IntPtr.Zero; + GetAdaptersInfo (ptr, ref len); + ptr = Marshal.AllocHGlobal(len); + int ret = GetAdaptersInfo (ptr, ref len); + + if (ret != 0) + throw new NetworkInformationException (ret); + + List l = new List (); + Win32_IP_ADAPTER_INFO info; + for (IntPtr p = ptr; p != IntPtr.Zero; p = info.Next) { + info = Marshal.PtrToStructure (p); + l.Add (info); + } + return l.ToArray (); + } + + Win32_IP_ADAPTER_ADDRESSES addr; + Win32_MIB_IFROW mib4, mib6; + Win32IPv4InterfaceStatistics ip4stats; + IPInterfaceProperties ip_if_props; + + internal Win32NetworkInterface2 (Win32_IP_ADAPTER_ADDRESSES addr) + { + this.addr = addr; + mib4 = default (Win32_MIB_IFROW); + mib4.Index = addr.Alignment.IfIndex; + if (GetIfEntry (ref mib4) != 0) + mib4.Index = -1; // unavailable; + mib6 = default (Win32_MIB_IFROW); + mib6.Index = addr.Ipv6IfIndex; + if (GetIfEntry (ref mib6) != 0) + mib6.Index = -1; // unavailable; + ip4stats = new Win32IPv4InterfaceStatistics (mib4); + ip_if_props = new Win32IPInterfaceProperties2 (addr, mib4, mib6); + } + + public override IPInterfaceProperties GetIPProperties () + { + return ip_if_props; + } + + public override IPv4InterfaceStatistics GetIPv4Statistics () + { + return ip4stats; + } + + public override PhysicalAddress GetPhysicalAddress () + { + byte [] bytes = new byte [addr.PhysicalAddressLength]; + Array.Copy (addr.PhysicalAddress, 0, bytes, 0, bytes.Length); + return new PhysicalAddress (bytes); + } + + public override bool Supports (NetworkInterfaceComponent networkInterfaceComponent) + { + switch (networkInterfaceComponent) { + case NetworkInterfaceComponent.IPv4: + return mib4.Index >= 0; + case NetworkInterfaceComponent.IPv6: + return mib6.Index >= 0; + } + return false; + } + + public override string Description { + get { return addr.Description; } + } + public override string Id { + get { return addr.AdapterName; } + } + public override bool IsReceiveOnly { + get { return addr.IsReceiveOnly; } + } + public override string Name { + get { return addr.FriendlyName; } + } + public override NetworkInterfaceType NetworkInterfaceType { + get { return addr.IfType; } + } + public override OperationalStatus OperationalStatus { + get { return addr.OperStatus; } + } + public override long Speed { + get { return mib6.Index >= 0 ? mib6.Speed : mib4.Speed; } + } + public override bool SupportsMulticast { + get { return !addr.NoMulticast; } + } + } +} +#endif diff --git a/mcs/class/corlib/System.Reflection/PortableExecutableKinds.cs b/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterfaceFactory.cs similarity index 60% rename from mcs/class/corlib/System.Reflection/PortableExecutableKinds.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterfaceFactory.cs index c282a81847..d278274a63 100644 --- a/mcs/class/corlib/System.Reflection/PortableExecutableKinds.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterfaceFactory.cs @@ -1,12 +1,15 @@ // -// System.Reflection.PortableExecutableKinds flag +// System.Net.NetworkInformation.NetworkInterface // // Authors: -// Sebastien Pouliot -// Marek Safar +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Miguel de Icaza (miguel@novell.com) +// Eric Butler (eric@extremeboredom.net) +// Marek Habersack (mhabersack@novell.com) +// Marek Safar (marek.safar@gmail.com) // -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com) +// Copyright (c) 2006-2008 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -27,21 +30,17 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if WIN_PLATFORM +namespace System.Net.NetworkInformation { + internal static class Win32NetworkInterfaceFactoryPal { + public static NetworkInterfaceFactory Create () + { + Version windowsVer51 = new Version (5, 1); + if (Environment.OSVersion.Version >= windowsVer51) + return new Win32NetworkInterfaceAPI (); -using System.Runtime.InteropServices; - -namespace System.Reflection { - - [ComVisible (true)] - [Flags] - [Serializable] - public enum PortableExecutableKinds { - NotAPortableExecutableImage = 0, - ILOnly = 1, - Required32Bit = 2, - PE32Plus = 4, - Unmanaged32Bit = 8, - Preferred32Bit = 16 + return null; + } } } - +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs b/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs index 88ae0b8e35..f608446cc8 100644 --- a/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs @@ -25,22 +25,14 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System; -using System.Collections.Generic; -using System.Net; +#if WIN_PLATFORM using System.Runtime.InteropServices; -using System.Text; namespace System.Net.NetworkInformation { - - class Win32NetworkInterface { - // Can't have unresolvable pinvokes on ios -#if WIN_PLATFORM [DllImport ("iphlpapi.dll", SetLastError = true)] static extern int GetNetworkParams (IntPtr ptr, ref int size); -#endif static Win32_FIXED_INFO fixedInfo; static bool initialized = false; @@ -48,16 +40,12 @@ namespace System.Net.NetworkInformation public static Win32_FIXED_INFO FixedInfo { get { if (!initialized) { -#if WIN_PLATFORM int len = 0; IntPtr ptr = IntPtr.Zero; GetNetworkParams (ptr, ref len); ptr = Marshal.AllocHGlobal(len); GetNetworkParams (ptr, ref len); fixedInfo = Marshal.PtrToStructure (ptr); -#else - throw new NotImplementedException (); -#endif initialized = true; } return fixedInfo; @@ -317,4 +305,4 @@ namespace System.Net.NetworkInformation const int AF_INET6 = 23; } } - +#endif diff --git a/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs b/mcs/class/System/System.Net.NetworkInformation/Win32TcpStatistics.cs similarity index 66% rename from mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32TcpStatistics.cs index 61269a0ecb..d2d966511d 100644 --- a/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32TcpStatistics.cs @@ -26,69 +26,8 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System.Collections.Specialized; -using System.Globalization; - -namespace System.Net.NetworkInformation { - class MibTcpStatistics : TcpStatistics - { - StringDictionary dic; - - public MibTcpStatistics (StringDictionary dic) - { - this.dic = dic; - } - - long Get (string name) - { - return dic [name] != null ? long.Parse (dic [name], NumberFormatInfo.InvariantInfo) : 0; - } - - public override long ConnectionsAccepted { - get { return Get ("PassiveOpens"); } - } - public override long ConnectionsInitiated { - get { return Get ("ActiveOpens"); } - } - public override long CumulativeConnections { - get { return Get ("NumConns"); } - } - public override long CurrentConnections { - get { return Get ("CurrEstab"); } - } - public override long ErrorsReceived { - get { return Get ("InErrs"); } - } - public override long FailedConnectionAttempts { - get { return Get ("AttemptFails"); } - } - public override long MaximumConnections { - get { return Get ("MaxConn"); } - } - public override long MaximumTransmissionTimeout { - get { return Get ("RtoMax"); } - } - public override long MinimumTransmissionTimeout { - get { return Get ("RtoMin"); } - } - public override long ResetConnections { - get { return Get ("EstabResets"); } - } - public override long ResetsSent { - get { return Get ("OutRsts"); } - } - public override long SegmentsReceived { - get { return Get ("InSegs"); } - } - public override long SegmentsResent { - get { return Get ("RetransSegs"); } - } - public override long SegmentsSent { - get { return Get ("OutSegs"); } - } - } - #if WIN_PLATFORM +namespace System.Net.NetworkInformation { class Win32TcpStatistics : TcpStatistics { Win32_MIB_TCPSTATS info; @@ -173,6 +112,5 @@ namespace System.Net.NetworkInformation { public uint OutRsts; public uint NumConns; } -#endif } - +#endif diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoEnumerator.cs b/mcs/class/System/System.Net.NetworkInformation/Win32UdpStatistics.cs similarity index 53% rename from mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoEnumerator.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32UdpStatistics.cs index 32a165faf0..504e648df7 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoEnumerator.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32UdpStatistics.cs @@ -1,11 +1,11 @@ // -// SignerInfoEnumerator.cs - System.Security.Cryptography.Pkcs.SignerInfoEnumerator +// System.Net.NetworkInformation.UdpStatistics // -// Author: -// Sebastien Pouliot +// Authors: +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) // -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell Inc. (http://www.novell.com) +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -26,47 +26,45 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if WIN_PLATFORM +namespace System.Net.NetworkInformation { + class Win32UdpStatistics : UdpStatistics + { + Win32_MIB_UDPSTATS info; -#if SECURITY_DEP - -using System; -using System.Collections; - -namespace System.Security.Cryptography.Pkcs { - - public sealed class SignerInfoEnumerator : IEnumerator { - - private IEnumerator enumerator; - - // constructors - - internal SignerInfoEnumerator (IEnumerable enumerable) + public Win32UdpStatistics (Win32_MIB_UDPSTATS info) { - enumerator = enumerable.GetEnumerator (); + this.info = info; } - // properties - - public SignerInfo Current { - get { return (SignerInfo) enumerator.Current; } + public override long DatagramsReceived { + get { return info.InDatagrams; } } - object IEnumerator.Current { - get { return enumerator.Current; } + public override long DatagramsSent { + get { return info.OutDatagrams; } } - // methods - - public bool MoveNext () - { - return enumerator.MoveNext (); + public override long IncomingDatagramsDiscarded { + get { return info.NoPorts; } } - public void Reset () - { - enumerator.Reset (); + public override long IncomingDatagramsWithErrors { + get { return info.InErrors; } + } + + public override int UdpListeners { + get { return info.NumAddrs; } } } -} + struct Win32_MIB_UDPSTATS + { + public uint InDatagrams; + public uint NoPorts; + public uint InErrors; + public uint OutDatagrams; + public int NumAddrs; + } +} #endif diff --git a/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs b/mcs/class/System/System.Net.NetworkInformation/Win32UnicastIPAddressInformation.cs similarity index 71% rename from mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32UnicastIPAddressInformation.cs index 449b995426..a52a6d9246 100644 --- a/mcs/class/System/System.Net.NetworkInformation/UnicastIPAddressInformation.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32UnicastIPAddressInformation.cs @@ -27,14 +27,12 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System; -using System.Runtime.InteropServices; +#if WIN_PLATFORM using System.Net.Sockets; using System.Diagnostics.Contracts; namespace System.Net.NetworkInformation { -#if WIN_PLATFORM - class Win32UnicastIPAddressInformation : UnicastIPAddressInformation + class Win32UnicastIPAddressInformation : UnicastIPAddressInformation { Win32_IP_ADAPTER_UNICAST_ADDRESS info; IPAddress ipv4Mask; @@ -121,72 +119,5 @@ namespace System.Net.NetworkInformation { return new IPAddress (addressBytes); } } -#endif - - class LinuxUnicastIPAddressInformation : UnicastIPAddressInformation - { - IPAddress address; - IPAddress ipv4Mask; - - public LinuxUnicastIPAddressInformation (IPAddress address) - { - this.address = address; - } - - public override IPAddress Address { - get { return address; } - } - - public override bool IsDnsEligible { - get { - byte[] addressBytes = address.GetAddressBytes (); - return !(addressBytes[0] == 169 && addressBytes[1] == 254); - } - } - - [MonoTODO("Always returns false")] - public override bool IsTransient { - get { return false; } - } - - // UnicastIPAddressInformation members - - public override long AddressPreferredLifetime { - get { throw new NotImplementedException (); } - } - - public override long AddressValidLifetime { - get { throw new NotImplementedException (); } - } - - public override long DhcpLeaseLifetime { - get { throw new NotImplementedException (); } - } - - public override DuplicateAddressDetectionState DuplicateAddressDetectionState { - get { throw new NotImplementedException (); } - } - - public override IPAddress IPv4Mask { - get { - // The IPv6 equivilant (for .net compatibility) - if (Address.AddressFamily != AddressFamily.InterNetwork) - return IPAddress.Any; - - if (ipv4Mask == null) - ipv4Mask = SystemNetworkInterface.GetNetMask (address); - - return ipv4Mask; - } - } - - public override PrefixOrigin PrefixOrigin { - get { throw new NotImplementedException (); } - } - - public override SuffixOrigin SuffixOrigin { - get { throw new NotImplementedException (); } - } - } } - +#endif diff --git a/mcs/class/corlib/System.Reflection/ImageFileMachine.cs b/mcs/class/System/System.Net.NetworkInformation/Win32UnixFactoryPal.cs similarity index 62% rename from mcs/class/corlib/System.Reflection/ImageFileMachine.cs rename to mcs/class/System/System.Net.NetworkInformation/Win32UnixFactoryPal.cs index 50c24aefc2..e80088f43e 100644 --- a/mcs/class/corlib/System.Reflection/ImageFileMachine.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Win32UnixFactoryPal.cs @@ -1,12 +1,12 @@ // -// System.Reflection.ImageFileMachine enumeration +// System.Net.NetworkInformation.IPGlobalProperties // // Authors: -// Sebastien Pouliot -// Marek Safar +// Gonzalo Paniagua Javier (gonzalo@novell.com) +// Atsushi Enomoto (atsushi@ximian.com) +// Marek Safar (marek.safar@gmail.com) // -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com) +// Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -27,17 +27,25 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // - +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Globalization; +using System.IO; using System.Runtime.InteropServices; +using System.Text; -namespace System.Reflection { +namespace System.Net.NetworkInformation { + internal static class UnixNetworkInterfaceFactoryPal { + public static NetworkInterfaceFactory Create () + { + return null; + } + } - [ComVisible (true)] - [Serializable] - public enum ImageFileMachine { - I386 = 332, - IA64 = 512, - AMD64 = 34404, - ARM = 452, + internal static class UnixIPGlobalPropertiesFactoryPal { + public static IPGlobalProperties Create () + { + return null; + } } } diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs index f70fc2f37d..ae6ea97bf8 100644 --- a/mcs/class/System/System.Net.Sockets/Socket.cs +++ b/mcs/class/System/System.Net.Sockets/Socket.cs @@ -392,6 +392,11 @@ namespace System.Net.Sockets [MethodImplAttribute(MethodImplOptions.InternalCall)] extern static SocketAddress RemoteEndPoint_internal (IntPtr socket, int family, out int error); + internal SafeHandle SafeHandle + { + get { return m_Handle; } + } + #endregion #region Select @@ -1172,6 +1177,10 @@ namespace System.Net.Sockets DnsEndPoint dep = e.RemoteEndPoint as DnsEndPoint; if (dep != null) { addresses = Dns.GetHostAddresses (dep.Host); + + if (dep.AddressFamily == AddressFamily.Unspecified) + return true; + int last_valid = 0; for (int i = 0; i < addresses.Length; ++i) { if (addresses [i].AddressFamily != dep.AddressFamily) @@ -1374,6 +1383,14 @@ namespace System.Net.Sockets return ret; } + public int Receive (Span buffer, SocketFlags socketFlags) + { + byte[] tempBuffer = new byte[buffer.Length]; + int ret = Receive (tempBuffer, SocketFlags.None); + tempBuffer.CopyTo (buffer); + return ret; + } + public bool ReceiveAsync (SocketAsyncEventArgs e) { // NO check is made whether e != null in MS.NET (NRE is thrown in such case) @@ -1860,6 +1877,11 @@ namespace System.Net.Sockets return ret; } + public int Send (ReadOnlySpan buffer, SocketFlags socketFlags) + { + return Send (buffer.ToArray(), socketFlags); + } + public bool SendAsync (SocketAsyncEventArgs e) { // NO check is made whether e != null in MS.NET (NRE is thrown in such case) diff --git a/mcs/class/System/System.Net/MacProxy.cs b/mcs/class/System/System.Net/MacProxy.cs index a292ede5d0..6a1959b35f 100644 --- a/mcs/class/System/System.Net/MacProxy.cs +++ b/mcs/class/System/System.Net/MacProxy.cs @@ -426,10 +426,10 @@ namespace Mono.Net } [DllImport (CoreFoundationLibrary)] - extern static /* CFIndex */ IntPtr CFDataGetLength (/* CFDataRef */ IntPtr theData); + internal extern static /* CFIndex */ IntPtr CFDataGetLength (/* CFDataRef */ IntPtr theData); [DllImport (CoreFoundationLibrary)] - extern static /* UInt8* */ IntPtr CFDataGetBytePtr (/* CFDataRef */ IntPtr theData); + internal extern static /* UInt8* */ IntPtr CFDataGetBytePtr (/* CFDataRef */ IntPtr theData); /* * Exposes a read-only pointer to the underlying storage. diff --git a/mcs/class/System/System.Net/WebResponseStream.cs b/mcs/class/System/System.Net/WebResponseStream.cs index bad3604cd5..0d6508b9ea 100644 --- a/mcs/class/System/System.Net/WebResponseStream.cs +++ b/mcs/class/System/System.Net/WebResponseStream.cs @@ -309,7 +309,7 @@ namespace System.Net break; ms.Write (buffer, 0, ret); } - return ms.GetBuffer (); + return ms.ToArray (); } } diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs index c31141c3cb..f234f33b92 100644 --- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs +++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs @@ -42,6 +42,8 @@ using System.IO; using System.Text; using System.Collections; using System.Runtime.Serialization; +using Microsoft.Win32.SafeHandles; +using Mono; namespace System.Security.Cryptography.X509Certificates { @@ -51,7 +53,7 @@ namespace System.Security.Cryptography.X509Certificates { new internal X509Certificate2Impl Impl { get { var impl2 = base.Impl as X509Certificate2Impl; - X509Helper2.ThrowIfContextInvalid (impl2); + X509Helper.ThrowIfContextInvalid (impl2); return impl2; } } @@ -120,7 +122,7 @@ namespace System.Security.Cryptography.X509Certificates { } public X509Certificate2 (X509Certificate certificate) - : base (X509Helper2.Import (certificate)) + : base (SystemDependencyProvider.Instance.CertificateProvider.Import (certificate)) { } @@ -146,11 +148,11 @@ namespace System.Security.Cryptography.X509Certificates { public string FriendlyName { get { - ThrowIfContextInvalid (); + ThrowIfInvalid (); return friendlyName; } set { - ThrowIfContextInvalid (); + ThrowIfInvalid (); friendlyName = value; } } @@ -164,11 +166,11 @@ namespace System.Security.Cryptography.X509Certificates { } public DateTime NotAfter { - get { return Impl.GetValidUntil ().ToLocalTime (); } + get { return Impl.NotAfter.ToLocalTime (); } } public DateTime NotBefore { - get { return Impl.GetValidFrom ().ToLocalTime (); } + get { return Impl.NotBefore.ToLocalTime (); } } public AsymmetricAlgorithm PrivateKey { @@ -220,14 +222,20 @@ namespace System.Security.Cryptography.X509Certificates { [MonoTODO ("missing KeyStorageFlags support")] public override void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags) { - var impl = X509Helper2.Import (rawData, password, keyStorageFlags); - ImportHandle (impl); + Reset (); + using (var handle = new SafePasswordHandle (password)) { + var impl = SystemDependencyProvider.Instance.CertificateProvider.Import (rawData, handle, keyStorageFlags); + ImportHandle (impl); + } } - [MonoTODO ("SecureString is incomplete")] public override void Import (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags) { - Import (rawData, (string) null, keyStorageFlags); + Reset (); + using (var handle = new SafePasswordHandle (password)) { + var impl = SystemDependencyProvider.Instance.CertificateProvider.Import (rawData, handle, keyStorageFlags); + ImportHandle (impl); + } } public override void Import (string fileName) @@ -247,13 +255,16 @@ namespace System.Security.Cryptography.X509Certificates { public override void Import (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags) { byte[] rawData = File.ReadAllBytes (fileName); - Import (rawData, (string)null, keyStorageFlags); + Import (rawData, password, keyStorageFlags); } [MonoTODO ("X509ContentType.SerializedCert is not supported")] public override byte[] Export (X509ContentType contentType, string password) { - return Impl.Export (contentType, password); + X509Helper.ThrowIfContextInvalid (Impl); + using (var handle = new SafePasswordHandle (password)) { + return Impl.Export (contentType, handle); + } } public override void Reset () @@ -328,49 +339,43 @@ namespace System.Security.Cryptography.X509Certificates { private static byte[] signedData = new byte[] { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02 }; - [MonoTODO ("Detection limited to Cert, Pfx, Pkcs12, Pkcs7 and Unknown")] + [MonoTODO ("Detection limited to Cert, Pfx/Pkcs12, Pkcs7 and Unknown")] public static X509ContentType GetCertContentType (byte[] rawData) { if ((rawData == null) || (rawData.Length == 0)) throw new ArgumentException ("rawData"); - X509ContentType type = X509ContentType.Unknown; - try { - ASN1 data = new ASN1 (rawData); - if (data.Tag != 0x30) { - string msg = Locale.GetText ("Unable to decode certificate."); - throw new CryptographicException (msg); - } + if (rawData[0] == 0x30) { + // ASN.1 SEQUENCE + try { + ASN1 data = new ASN1 (rawData); - if (data.Count == 0) - return type; + // SEQUENCE / SEQUENCE / BITSTRING + if (data.Count == 3 && data [0].Tag == 0x30 && data [1].Tag == 0x30 && data [2].Tag == 0x03) + return X509ContentType.Cert; - if (data.Count == 3) { - switch (data [0].Tag) { - case 0x30: - // SEQUENCE / SEQUENCE / BITSTRING - if ((data [1].Tag == 0x30) && (data [2].Tag == 0x03)) - type = X509ContentType.Cert; - break; - case 0x02: - // INTEGER / SEQUENCE / SEQUENCE - if ((data [1].Tag == 0x30) && (data [2].Tag == 0x30)) - type = X509ContentType.Pkcs12; - // note: Pfx == Pkcs12 - break; - } + // INTEGER / SEQUENCE / SEQUENCE + if (data.Count == 3 && data [0].Tag == 0x02 && data [1].Tag == 0x30 && data [2].Tag == 0x30) + return X509ContentType.Pkcs12; // note: Pfx == Pkcs12 + + // check for PKCS#7 (count unknown but greater than 0) + // SEQUENCE / OID (signedData) + if (data.Count > 0 && data [0].Tag == 0x06 && data [0].CompareValue (signedData)) + return X509ContentType.Pkcs7; + + return X509ContentType.Unknown; } - // check for PKCS#7 (count unknown but greater than 0) - // SEQUENCE / OID (signedData) - if ((data [0].Tag == 0x06) && data [0].CompareValue (signedData)) - type = X509ContentType.Pkcs7; - } - catch (Exception e) { - string msg = Locale.GetText ("Unable to decode certificate."); - throw new CryptographicException (msg, e); + catch (Exception) { + return X509ContentType.Unknown; + } + } else { + string pem = Encoding.ASCII.GetString (rawData); + int start = pem.IndexOf ("-----BEGIN CERTIFICATE-----"); + if (start >= 0) + return X509ContentType.Cert; } - return type; + return X509ContentType.Unknown; } [MonoTODO ("Detection limited to Cert, Pfx, Pkcs12 and Unknown")] diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Collection.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Collection.cs index e63d350cfe..02ff9b1a8b 100644 --- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Collection.cs +++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Collection.cs @@ -33,6 +33,7 @@ using System.Collections; using System.Globalization; +using Mono.Security; namespace System.Security.Cryptography.X509Certificates { @@ -146,6 +147,17 @@ namespace System.Security.Cryptography.X509Certificates { static string[] newline_split = new string[] { Environment.NewLine }; + private string GetKeyIdentifier (X509Certificate2 x) + { + // if present in certificate return value of the SubjectKeyIdentifier + X509SubjectKeyIdentifierExtension ski = (x.Extensions ["2.5.29.14"] as X509SubjectKeyIdentifierExtension); + if (ski == null) { + // if not then we must calculate the SubjectKeyIdentifier ourselve + ski = new X509SubjectKeyIdentifierExtension (x.PublicKey, X509SubjectKeyIdentifierHashAlgorithm.CapiSha1, false); + } + return ski.SubjectKeyIdentifier; + } + [MonoTODO ("Does not support X509FindType.FindByTemplateName, FindByApplicationPolicy and FindByCertificatePolicy")] public X509Certificate2Collection Find (X509FindType findType, object findValue, bool validOnly) { @@ -261,10 +273,7 @@ namespace System.Security.Cryptography.X509Certificates { // TODO - find a valid test case break; case X509FindType.FindBySubjectKeyIdentifier: - X509SubjectKeyIdentifierExtension ski = (x.Extensions ["2.5.29.14"] as X509SubjectKeyIdentifierExtension); - if (ski != null) { - value_match = (String.Compare (str, ski.SubjectKeyIdentifier, true, cinv) == 0); - } + value_match = (String.Compare (str, GetKeyIdentifier (x), true, cinv) == 0); break; case X509FindType.FindByApplicationPolicy: // note: include when no extensions are present (even if v3) diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Impl.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Impl.cs index 38797d55fc..76ee659fa9 100644 --- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Impl.cs +++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Impl.cs @@ -25,12 +25,12 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +using Microsoft.Win32.SafeHandles; + namespace System.Security.Cryptography.X509Certificates { internal abstract class X509Certificate2Impl : X509CertificateImpl { -#if SECURITY_DEP - public abstract bool Archived { get; set; } @@ -77,14 +77,10 @@ namespace System.Security.Cryptography.X509Certificates public abstract string GetNameInfo (X509NameType nameType, bool forIssuer); - public abstract void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags); - - public abstract byte[] Export (X509ContentType contentType, string password); + public abstract void Import (byte[] rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags); public abstract bool Verify (X509Certificate2 thisCertificate); public abstract void Reset (); - -#endif } } diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2ImplMono.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2ImplMono.cs index 1314a137b5..de2e7d350c 100644 --- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2ImplMono.cs +++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2ImplMono.cs @@ -29,8 +29,6 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if SECURITY_DEP - #if MONO_SECURITY_ALIAS extern alias MonoSecurity; using MonoSecurity::Mono.Security; @@ -45,6 +43,8 @@ using MX = Mono.Security.X509; using System.IO; using System.Text; using System.Collections; +using System.Runtime.InteropServices; +using Microsoft.Win32.SafeHandles; namespace System.Security.Cryptography.X509Certificates { @@ -77,7 +77,7 @@ namespace System.Security.Cryptography.X509Certificates return IntPtr.Zero; } - X509Certificate2ImplMono (MX.X509Certificate cert) + public X509Certificate2ImplMono (MX.X509Certificate cert) { this._cert = cert; } @@ -95,50 +95,37 @@ namespace System.Security.Cryptography.X509Certificates return new X509Certificate2ImplMono (this); } -#region Implemented X509CertificateImpl members - - public override string GetIssuerName (bool legacyV1Mode) - { - ThrowIfContextInvalid (); - if (legacyV1Mode) - return _cert.IssuerName; - else - return MX.X501.ToString (_cert.GetIssuerName (), true, ", ", true); + MX.X509Certificate Cert { + get { + ThrowIfContextInvalid (); + return _cert; + } } - public override string GetSubjectName (bool legacyV1Mode) - { - ThrowIfContextInvalid (); - if (legacyV1Mode) - return _cert.SubjectName; - else - return MX.X501.ToString (_cert.GetSubjectName (), true, ", ", true); + + #region Implemented X509CertificateImpl members + + public override string Issuer => MX.X501.ToString (Cert.GetIssuerName (), true, ", ", true); + + public override string Subject => MX.X501.ToString (Cert.GetSubjectName (), true, ", ", true); + + public override string LegacyIssuer => Cert.IssuerName; + + public override string LegacySubject => Cert.SubjectName; + + public override byte[] RawData => Cert.RawData; + + public override byte[] Thumbprint { + get { + ThrowIfContextInvalid (); + SHA1 sha = SHA1.Create (); + return sha.ComputeHash (_cert.RawData); + } } - public override byte[] GetRawCertData () - { - ThrowIfContextInvalid (); - return _cert.RawData; - } + public override DateTime NotBefore => Cert.ValidFrom.ToLocalTime (); - protected override byte[] GetCertHash (bool lazy) - { - ThrowIfContextInvalid (); - SHA1 sha = SHA1.Create (); - return sha.ComputeHash (_cert.RawData); - } - - public override DateTime GetValidFrom () - { - ThrowIfContextInvalid (); - return _cert.ValidFrom; - } - - public override DateTime GetValidUntil () - { - ThrowIfContextInvalid (); - return _cert.ValidUntil; - } + public override DateTime NotAfter => Cert.ValidUntil.ToLocalTime (); public override bool Equals (X509CertificateImpl other, out bool result) { @@ -147,46 +134,18 @@ namespace System.Security.Cryptography.X509Certificates return false; } - public override string GetKeyAlgorithm () - { - ThrowIfContextInvalid (); - return _cert.KeyAlgorithm; - } + public override string KeyAlgorithm => Cert.KeyAlgorithm; - public override byte[] GetKeyAlgorithmParameters () - { - ThrowIfContextInvalid (); - return _cert.KeyAlgorithmParameters; - } + public override byte[] KeyAlgorithmParameters => Cert.KeyAlgorithmParameters ?? throw new CryptographicException (); - public override byte[] GetPublicKey () - { - ThrowIfContextInvalid (); - return _cert.PublicKey; - } + public override byte[] PublicKeyValue => Cert.PublicKey; - public override byte[] GetSerialNumber () - { - ThrowIfContextInvalid (); - return _cert.SerialNumber; - } - - public override byte[] Export (X509ContentType contentType, byte[] password) - { - ThrowIfContextInvalid (); - - switch (contentType) { - case X509ContentType.Cert: - return GetRawCertData (); - case X509ContentType.Pfx: // this includes Pkcs12 - // TODO - throw new NotSupportedException (); - case X509ContentType.SerializedCert: - // TODO - throw new NotSupportedException (); - default: - string msg = Locale.GetText ("This certificate format '{0}' cannot be exported.", contentType); - throw new CryptographicException (msg); + public override byte[] SerialNumber { + get { + ThrowIfContextInvalid (); + var serial = Cert.SerialNumber; + Array.Reverse (serial); + return serial; } } @@ -237,7 +196,7 @@ namespace System.Security.Cryptography.X509Certificates issuer_name = new X500DistinguishedName (_cert.GetIssuerName ().GetBytes ()); return issuer_name; } - } + } public override AsymmetricAlgorithm PrivateKey { get { @@ -248,25 +207,24 @@ namespace System.Security.Cryptography.X509Certificates if (rcsp.PublicOnly) return null; var key = new RSACryptoServiceProvider (); - key.ImportParameters (_cert.RSA.ExportParameters(true)); + key.ImportParameters (_cert.RSA.ExportParameters (true)); return key; } if (_cert.RSA is RSAManaged rsam) { if (rsam.PublicOnly) return null; var key = new RSAManaged (); - key.ImportParameters (_cert.RSA.ExportParameters(true)); + key.ImportParameters (_cert.RSA.ExportParameters (true)); return key; } if (_cert.DSA is DSACryptoServiceProvider dcsp) { if (dcsp.PublicOnly) return null; - var key = new DSACryptoServiceProvider(); - key.ImportParameters(_cert.DSA.ExportParameters(true)); + var key = new DSACryptoServiceProvider (); + key.ImportParameters (_cert.DSA.ExportParameters (true)); return key; } - } - catch { + } catch { } return null; } @@ -279,25 +237,24 @@ namespace System.Security.Cryptography.X509Certificates if (value == null) { _cert.RSA = null; _cert.DSA = null; - } else if (value is RSA) - _cert.RSA = (RSA) value; + } else if (value is RSA) + _cert.RSA = (RSA)value; else if (value is DSA) - _cert.DSA = (DSA) value; + _cert.DSA = (DSA)value; else throw new NotSupportedException (); } - } + } public override PublicKey PublicKey { - get { + get { if (_cert == null) throw new CryptographicException (empty_error); if (_publicKey == null) { try { _publicKey = new PublicKey (_cert); - } - catch (Exception e) { + } catch (Exception e) { string msg = Locale.GetText ("Unable to decode public key."); throw new CryptographicException (msg, e); } @@ -315,7 +272,7 @@ namespace System.Security.Cryptography.X509Certificates signature_algorithm = new Oid (_cert.SignatureAlgorithm); return signature_algorithm; } - } + } public override X500DistinguishedName SubjectName { get { @@ -326,7 +283,7 @@ namespace System.Security.Cryptography.X509Certificates subject_name = new X500DistinguishedName (_cert.GetSubjectName ().GetBytes ()); return subject_name; } - } + } public override int Version { get { @@ -339,7 +296,7 @@ namespace System.Security.Cryptography.X509Certificates // methods [MonoTODO ("always return String.Empty for UpnName, DnsFromAlternativeName and UrlName")] - public override string GetNameInfo (X509NameType nameType, bool forIssuer) + public override string GetNameInfo (X509NameType nameType, bool forIssuer) { switch (nameType) { case X509NameType.SimpleName: @@ -352,10 +309,10 @@ namespace System.Security.Cryptography.X509Certificates return GetValueAsString (dn); if (sn.Count == 0) return String.Empty; - ASN1 last_entry = sn [sn.Count - 1]; + ASN1 last_entry = sn[sn.Count - 1]; if (last_entry.Count == 0) return String.Empty; - return GetValueAsString (last_entry [0]); + return GetValueAsString (last_entry[0]); case X509NameType.EmailName: // return the E= part of the DN (if present) ASN1 e = Find (email, forIssuer ? _cert.GetIssuerName () : _cert.GetSubjectName ()); @@ -392,13 +349,13 @@ namespace System.Security.Cryptography.X509Certificates // process SET for (int i = 0; i < dn.Count; i++) { - ASN1 set = dn [i]; + ASN1 set = dn[i]; for (int j = 0; j < set.Count; j++) { - ASN1 pair = set [j]; + ASN1 pair = set[j]; if (pair.Count != 2) continue; - ASN1 poid = pair [0]; + ASN1 poid = pair[0]; if (poid == null) continue; @@ -414,7 +371,7 @@ namespace System.Security.Cryptography.X509Certificates if (pair.Count != 2) return String.Empty; - ASN1 value = pair [1]; + ASN1 value = pair[1]; if ((value.Value == null) || (value.Length == 0)) return String.Empty; @@ -422,14 +379,22 @@ namespace System.Security.Cryptography.X509Certificates // BMPSTRING StringBuilder sb = new StringBuilder (); for (int j = 1; j < value.Value.Length; j += 2) - sb.Append ((char)value.Value [j]); + sb.Append ((char)value.Value[j]); return sb.ToString (); } else { return Encoding.UTF8.GetString (value.Value); } } - private MX.X509Certificate ImportPkcs12 (byte[] rawData, string password) + MX.X509Certificate ImportPkcs12 (byte[] rawData, SafePasswordHandle password) + { + if (password == null || password.IsInvalid) + return ImportPkcs12 (rawData, (string)null); + var passwordString = password.Mono_DangerousGetString (); + return ImportPkcs12 (rawData, passwordString); + } + + MX.X509Certificate ImportPkcs12 (byte[] rawData, string password) { MX.PKCS12 pfx = null; if (string.IsNullOrEmpty (password)) { @@ -482,40 +447,28 @@ namespace System.Security.Cryptography.X509Certificates } [MonoTODO ("missing KeyStorageFlags support")] - public override void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags) + public override void Import (byte[] rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) { Reset (); - MX.X509Certificate cert = null; - if (password == null) { - try { - cert = new MX.X509Certificate (rawData); - } - catch (Exception e) { - try { - cert = ImportPkcs12 (rawData, null); - } - catch { - string msg = Locale.GetText ("Unable to decode certificate."); - // inner exception is the original (not second) exception - throw new CryptographicException (msg, e); - } - } - } else { - // try PKCS#12 - try { - cert = ImportPkcs12 (rawData, password); - } - catch { - // it's possible to supply a (unrequired/unusued) password - // fix bug #79028 - cert = new MX.X509Certificate (rawData); - } + + switch (X509Certificate2.GetCertContentType (rawData)) { + case X509ContentType.Pkcs12: + _cert = ImportPkcs12 (rawData, password); + break; + + case X509ContentType.Cert: + case X509ContentType.Pkcs7: + _cert = new MX.X509Certificate (rawData); + break; + + default: + string msg = Locale.GetText ("Unable to decode certificate."); + throw new CryptographicException (msg); } - _cert = cert; } [MonoTODO ("X509ContentType.SerializedCert is not supported")] - public override byte[] Export (X509ContentType contentType, string password) + public override byte[] Export (X509ContentType contentType, SafePasswordHandle password) { if (_cert == null) throw new CryptographicException (empty_error); @@ -534,6 +487,14 @@ namespace System.Security.Cryptography.X509Certificates } } + byte[] ExportPkcs12 (SafePasswordHandle password) + { + if (password == null || password.IsInvalid) + return ExportPkcs12 ((string)null); + var passwordString = password.Mono_DangerousGetString (); + return ExportPkcs12 (passwordString); + } + byte[] ExportPkcs12 (string password) { var pfx = new MX.PKCS12 (); @@ -570,71 +531,6 @@ namespace System.Security.Cryptography.X509Certificates } } - public override string ToString () - { - if (_cert == null) - return "System.Security.Cryptography.X509Certificates.X509Certificate2"; - - return ToString (true); - } - - public override string ToString (bool verbose) - { - if (_cert == null) - return "System.Security.Cryptography.X509Certificates.X509Certificate2"; - - string nl = Environment.NewLine; - StringBuilder sb = new StringBuilder (); - - // the non-verbose X509Certificate2 == verbose X509Certificate - if (!verbose) { - sb.AppendFormat ("[Subject]{0} {1}{0}{0}", nl, GetSubjectName (false)); - sb.AppendFormat ("[Issuer]{0} {1}{0}{0}", nl, GetIssuerName (false)); - sb.AppendFormat ("[Not Before]{0} {1}{0}{0}", nl, GetValidFrom ().ToLocalTime ()); - sb.AppendFormat ("[Not After]{0} {1}{0}{0}", nl, GetValidUntil ().ToLocalTime ()); - sb.AppendFormat ("[Thumbprint]{0} {1}{0}", nl, X509Helper.ToHexString (GetCertHash ())); - sb.Append (nl); - return sb.ToString (); - } - - sb.AppendFormat ("[Version]{0} V{1}{0}{0}", nl, Version); - sb.AppendFormat ("[Subject]{0} {1}{0}{0}", nl, GetSubjectName (false)); - sb.AppendFormat ("[Issuer]{0} {1}{0}{0}", nl, GetIssuerName (false)); - sb.AppendFormat ("[Serial Number]{0} {1}{0}{0}", nl, GetSerialNumber ()); - sb.AppendFormat ("[Not Before]{0} {1}{0}{0}", nl, GetValidFrom ().ToLocalTime ()); - sb.AppendFormat ("[Not After]{0} {1}{0}{0}", nl, GetValidUntil ().ToLocalTime ()); - sb.AppendFormat ("[Thumbprint]{0} {1}{0}", nl, X509Helper.ToHexString (GetCertHash ())); - sb.AppendFormat ("[Signature Algorithm]{0} {1}({2}){0}{0}", nl, SignatureAlgorithm.FriendlyName, - SignatureAlgorithm.Value); - - AsymmetricAlgorithm key = PublicKey.Key; - sb.AppendFormat ("[Public Key]{0} Algorithm: ", nl); - if (key is RSA) - sb.Append ("RSA"); - else if (key is DSA) - sb.Append ("DSA"); - else - sb.Append (key.ToString ()); - sb.AppendFormat ("{0} Length: {1}{0} Key Blob: ", nl, key.KeySize); - AppendBuffer (sb, PublicKey.EncodedKeyValue.RawData); - sb.AppendFormat ("{0} Parameters: ", nl); - AppendBuffer (sb, PublicKey.EncodedParameters.RawData); - sb.Append (nl); - - return sb.ToString (); - } - - private static void AppendBuffer (StringBuilder sb, byte[] buffer) - { - if (buffer == null) - return; - for (int i=0; i < buffer.Length; i++) { - sb.Append (buffer [i].ToString ("x2")); - if (i < buffer.Length - 1) - sb.Append (" "); - } - } - [MonoTODO ("by default this depends on the incomplete X509Chain")] public override bool Verify (X509Certificate2 thisCertificate) { @@ -725,5 +621,3 @@ namespace System.Security.Cryptography.X509Certificates } } } - -#endif diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs index f535f400b3..7e7ecbb393 100644 --- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs +++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs @@ -26,143 +26,28 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if SECURITY_DEP #if MONO_SECURITY_ALIAS extern alias MonoSecurity; #endif #if MONO_SECURITY_ALIAS -using MonoSecurity::Mono.Security.Interface; using MX = MonoSecurity::Mono.Security.X509; #else -#if MONO_FEATURE_BTLS -using Mono.Security.Interface; -#endif using MX = Mono.Security.X509; #endif #if MONO_FEATURE_BTLS using Mono.Btls; #endif -#endif using System.IO; using System.Text; +using Mono; namespace System.Security.Cryptography.X509Certificates { internal static class X509Helper2 { - internal static long GetSubjectNameHash (X509Certificate certificate) - { - return GetSubjectNameHash (certificate.Impl); - } - - internal static long GetSubjectNameHash (X509CertificateImpl impl) - { -#if SECURITY_DEP - using (var x509 = GetNativeInstance (impl)) - return GetSubjectNameHash (x509); -#else - throw new NotSupportedException (); -#endif - } - - internal static void ExportAsPEM (X509Certificate certificate, Stream stream, bool includeHumanReadableForm) - { - ExportAsPEM (certificate.Impl, stream, includeHumanReadableForm); - } - - internal static void ExportAsPEM (X509CertificateImpl impl, Stream stream, bool includeHumanReadableForm) - { -#if SECURITY_DEP - using (var x509 = GetNativeInstance (impl)) - ExportAsPEM (x509, stream, includeHumanReadableForm); -#else - throw new NotSupportedException (); -#endif - } - -#if SECURITY_DEP - internal static void Initialize () - { - X509Helper.InstallNativeHelper (new MyNativeHelper ()); - } - - internal static void ThrowIfContextInvalid (X509CertificateImpl impl) - { - X509Helper.ThrowIfContextInvalid (impl); - } - -#if !MONO_FEATURE_BTLS - static X509Certificate GetNativeInstance (X509CertificateImpl impl) - { - throw new PlatformNotSupportedException (); - } -#else - static MonoBtlsX509 GetNativeInstance (X509CertificateImpl impl) - { - ThrowIfContextInvalid (impl); - var btlsImpl = impl as X509CertificateImplBtls; - if (btlsImpl != null) - return btlsImpl.X509.Copy (); - else - return MonoBtlsX509.LoadFromData (impl.GetRawCertData (), MonoBtlsX509Format.DER); - } - - internal static long GetSubjectNameHash (MonoBtlsX509 x509) - { - using (var subject = x509.GetSubjectName ()) - return subject.GetHash (); - } - - internal static void ExportAsPEM (MonoBtlsX509 x509, Stream stream, bool includeHumanReadableForm) - { - using (var bio = MonoBtlsBio.CreateMonoStream (stream)) { - x509.ExportAsPEM (bio, includeHumanReadableForm); - } - } -#endif // !MONO_FEATURE_BTLS - - internal static X509Certificate2Impl Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags, bool disableProvider = false) - { - if (rawData == null || rawData.Length == 0) - return null; - -#if MONO_FEATURE_BTLS - if (!disableProvider) { - var provider = MonoTlsProviderFactory.GetProvider (); - if (provider.HasNativeCertificates) { - var impl = provider.GetNativeCertificate (rawData, password, keyStorageFlags); - return impl; - } - } -#endif // MONO_FEATURE_BTLS - var impl2 = new X509Certificate2ImplMono (); - impl2.Import (rawData, password, keyStorageFlags); - return impl2; - } - - internal static X509Certificate2Impl Import (X509Certificate cert, bool disableProvider = false) - { - if (cert.Impl == null) - return null; - -#if MONO_FEATURE_BTLS - if (!disableProvider) { - var provider = MonoTlsProviderFactory.GetProvider (); - if (provider.HasNativeCertificates) { - var impl = provider.GetNativeCertificate (cert); - return impl; - } - } -#endif // MONO_FEATURE_BTLS - var impl2 = cert.Impl as X509Certificate2Impl; - if (impl2 != null) - return (X509Certificate2Impl)impl2.Clone (); - return Import (cert.GetRawCertData (), null, X509KeyStorageFlags.DefaultKeySet); - } - /* * This is used by X509ChainImplMono * @@ -175,13 +60,15 @@ namespace System.Security.Cryptography.X509Certificates [MonoTODO ("Investigate replacement; see comments in source.")] internal static MX.X509Certificate GetMonoCertificate (X509Certificate2 certificate) { - var impl2 = certificate.Impl as X509Certificate2Impl; - if (impl2 == null) - impl2 = Import (certificate, true); - var fallbackImpl = impl2.FallbackImpl as X509Certificate2ImplMono; - if (fallbackImpl == null) - throw new NotSupportedException (); - return fallbackImpl.MonoCertificate; + if (certificate.Impl is X509Certificate2ImplMono monoImpl) + return monoImpl.MonoCertificate; + if (certificate.Impl is X509Certificate2Impl impl2 && impl2.FallbackImpl is X509Certificate2ImplMono fallbackImpl) + return fallbackImpl.MonoCertificate; + + var impl = SystemDependencyProvider.Instance.CertificateProvider.Import (certificate, CertificateImportFlags.DisableNativeBackend); + if (impl is X509Certificate2ImplMono fallbackImpl2) + return fallbackImpl2.MonoCertificate; + throw new NotSupportedException (); } internal static X509ChainImpl CreateChainImpl (bool useMachineContext) @@ -205,18 +92,41 @@ namespace System.Security.Cryptography.X509Certificates return new CryptographicException (Locale.GetText ("Chain instance is empty.")); } - class MyNativeHelper : INativeCertificateHelper + [Obsolete ("This is only used by Mono.Security's X509Store and will be replaced shortly.")] + internal static long GetSubjectNameHash (X509Certificate certificate) { - public X509CertificateImpl Import ( - byte[] data, string password, X509KeyStorageFlags flags) - { - return X509Helper2.Import (data, password, flags); - } +#if MONO_FEATURE_BTLS + X509Helper.ThrowIfContextInvalid (certificate.Impl); + using (var x509 = GetNativeInstance (certificate.Impl)) + using (var subject = x509.GetSubjectName ()) + return subject.GetHash (); +#else + throw new PlatformNotSupportedException (); +#endif + } - public X509CertificateImpl Import (X509Certificate cert) - { - return X509Helper2.Import (cert); - } + [Obsolete ("This is only used by Mono.Security's X509Store and will be replaced shortly.")] + internal static void ExportAsPEM (X509Certificate certificate, Stream stream, bool includeHumanReadableForm) + { +#if MONO_FEATURE_BTLS + X509Helper.ThrowIfContextInvalid (certificate.Impl); + using (var x509 = GetNativeInstance (certificate.Impl)) + using (var bio = MonoBtlsBio.CreateMonoStream (stream)) + x509.ExportAsPEM (bio, includeHumanReadableForm); +#else + throw new PlatformNotSupportedException (); +#endif + } + +#if MONO_FEATURE_BTLS + static MonoBtlsX509 GetNativeInstance (X509CertificateImpl impl) + { + X509Helper.ThrowIfContextInvalid (impl); + var btlsImpl = impl as X509CertificateImplBtls; + if (btlsImpl != null) + return btlsImpl.X509.Copy (); + else + return MonoBtlsX509.LoadFromData (impl.RawData, MonoBtlsX509Format.DER); } #endif } diff --git a/mcs/class/System/System.Security.Cryptography/AsnEncodedDataCollection.cs b/mcs/class/System/System.Security.Cryptography/AsnEncodedDataCollection.cs deleted file mode 100644 index def3c8350c..0000000000 --- a/mcs/class/System/System.Security.Cryptography/AsnEncodedDataCollection.cs +++ /dev/null @@ -1,107 +0,0 @@ -// -// System.Security.Cryptography.AsnEncodedDataCollection -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Collections; - -namespace System.Security.Cryptography { - - public sealed class AsnEncodedDataCollection : ICollection, IEnumerable { - - private ArrayList _list; - - // constructors - - public AsnEncodedDataCollection () - { - _list = new ArrayList (); - } - - public AsnEncodedDataCollection (AsnEncodedData asnEncodedData) - { - _list = new ArrayList (); - _list.Add (asnEncodedData); - } - - // properties - - public int Count { - get { return _list.Count; } - } - - public bool IsSynchronized { - get { return _list.IsSynchronized; } - } - - public AsnEncodedData this [int index] { - get { return (AsnEncodedData) _list [index]; } - } - - public object SyncRoot { - get { return _list.SyncRoot; } - } - - // methods - - public int Add (AsnEncodedData asnEncodedData) - { - return _list.Add (asnEncodedData); - } - - public void CopyTo (AsnEncodedData[] array, int index) - { - _list.CopyTo ((Array)array, index); - } - - // to satisfy ICollection - private - void ICollection.CopyTo (Array array, int index) - { - _list.CopyTo (array, index); - } - - public AsnEncodedDataEnumerator GetEnumerator () - { - return new AsnEncodedDataEnumerator (this); - } - - // to satisfy IEnumerator - private - IEnumerator IEnumerable.GetEnumerator () - { - return new AsnEncodedDataEnumerator (this); - } - - public void Remove (AsnEncodedData asnEncodedData) - { - _list.Remove (asnEncodedData); - } - } -} - -#endif diff --git a/mcs/class/System/System.Security.Cryptography/AsnEncodedDataEnumerator.cs b/mcs/class/System/System.Security.Cryptography/AsnEncodedDataEnumerator.cs deleted file mode 100644 index 714b553448..0000000000 --- a/mcs/class/System/System.Security.Cryptography/AsnEncodedDataEnumerator.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// System.Security.Cryptography.AsnEncodedDataEnumerator -// -// Author: -// Sebastien Pouliot -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell Inc. (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if SECURITY_DEP - -using System.Collections; - -namespace System.Security.Cryptography { - - public sealed class AsnEncodedDataEnumerator : IEnumerator { - - private AsnEncodedDataCollection _collection; - private int _position; - - // note: couldn't reuse the IEnumerator from ArrayList because - // it doesn't throw the same exceptions - internal AsnEncodedDataEnumerator (AsnEncodedDataCollection collection) - { - _collection = collection; - _position = -1; - } - - // properties - - public AsnEncodedData Current { - get { - if (_position < 0) - throw new ArgumentOutOfRangeException (); - return (AsnEncodedData) _collection [_position]; - } - } - - object IEnumerator.Current { - get { - if (_position < 0) - throw new ArgumentOutOfRangeException (); - return _collection [_position]; - } - } - - // methods - - public bool MoveNext () - { - if (++_position < _collection.Count) - return true; - else { - // strangely we must always be able to return the last entry - _position = _collection.Count - 1; - return false; - } - } - - public void Reset () - { - _position = -1; - } - } -} - -#endif diff --git a/mcs/class/System/System/AndroidPlatform.cs b/mcs/class/System/System/AndroidPlatform.cs index dc4f4aaa54..1734fb1268 100644 --- a/mcs/class/System/System/AndroidPlatform.cs +++ b/mcs/class/System/System/AndroidPlatform.cs @@ -32,7 +32,7 @@ using System.Net; using System.Net.Security; using System.Security.Cryptography.X509Certificates; #if SECURITY_DEP -using MSX = Mono.Security.X509; +using Mono; #if MONO_FEATURE_BTLS using Mono.Btls; #endif @@ -70,6 +70,7 @@ namespace System { ignoreCase:false, throwOnBindFailure:true); #endif // MONO_FEATURE_BTLS + SystemDependencyProvider.Initialize (); #endif // SECURITY_DEP getDefaultProxy = (Func)Delegate.CreateDelegate ( typeof (Func), t, "GetDefaultProxy", diff --git a/mcs/class/System/System_xtest.dll.sources b/mcs/class/System/System_xtest.dll.sources new file mode 100644 index 0000000000..c5ef8026a3 --- /dev/null +++ b/mcs/class/System/System_xtest.dll.sources @@ -0,0 +1,112 @@ +../test-helpers/Configuration.Http.cs + +../../../external/corefx/src/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs + +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs +System/RemoteExecutorTests.cs +../../../external/corefx/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.NonGeneric.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/IList.NonGeneric.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/TestBase.NonGeneric.cs +../../../external/corefx/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs + +# System.CodeDom +../../../external/corefx/src/System.CodeDom/tests/CodeCollections/*.cs +../../../external/corefx/src/System.CodeDom/tests/CodeExpressions/*.cs +../../../external/corefx/src/System.CodeDom/tests/CodeObjects/*.cs +../../../external/corefx/src/System.CodeDom/tests/CodeStatements/*.cs +../../../external/corefx/src/System.CodeDom/tests/CodeTypeMembers/*.cs +../../../external/corefx/src/System.CodeDom/tests/Compiler/*.cs +../../../external/corefx/src/System.CodeDom/tests/Other/*.cs +../../../external/corefx/src/System.CodeDom/tests/Microsoft/CSharp/*.cs +../../../external/corefx/src/System.CodeDom/tests/Microsoft/VisualBasic/*.cs +../../../external/corefx/src/System.CodeDom/tests/*.cs:CodeGenerationTests.cs,CSharpCodeGenerationTests.cs,VBCodeGenerationTests.cs + +# System.Net.Requests +../../../external/corefx/src/Common/tests/System/Net/Http/LoopbackServer.cs +../../../external/corefx/src/Common/tests/System/Net/Configuration.cs +../../../external/corefx/src/Common/tests/System/Net/Configuration.Http.cs +../../../external/corefx/src/Common/tests/System/Net/Configuration.Certificates.cs +../../../external/corefx/src/System.Net.Requests/tests/FtpWebRequestTest.cs +#../../../external/corefx/src/System.Net.Requests/tests/*.cs:AuthenticationManagerTest.cs + +# System.Net.WebHeaderCollection +#../../../external/corefx/src/System.Net.WebHeaderCollection/tests/*.cs + +# System.Net.NameResolution +#../../../external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/*.cs + +# System.Net.WebClient +../../../external/corefx/src/System.Net.WebClient/tests/*.cs + +# System.Net.Security +../../../external/corefx/src/Common/tests/System/Net/SslProtocolSupport.cs +#../../../external/corefx/src/System.Net.Security/tests/UnitTests/*.cs:TlsAlertsMatchWindowsInterop.cs +#../../../external/corefx/src/System.Net.Security/tests/UnitTests/System/Security/Authentication/ExtendedProtection/*.cs +../../../external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/*.cs:FakeSslState.cs,FakeLazyAsyncResult.cs +../../../external/corefx/src/Common/src/System/Net/Logging/NetEventSource.Common.cs +../../../external/corefx/src/Common/src/System/Net/InternalException.cs +../../../external/corefx/src/System.Net.Security/src/System/Net/Security/TlsAlertMessage.cs +../../../external/corefx/src/System.Net.Security/src/System/Net/Security/TlsAlertType.cs + +# System.Net.Ping +../../../external/corefx/src/Common/src/System/Net/NetworkInformation/UnixCommandLinePing.cs +../../../external/corefx/src/Common/tests/System/Net/Capability.RawSocketPermissions.cs +../../../external/corefx/src/Common/src/System/Net/RawSocketPermissions.cs +#../../../external/corefx/src/System.Net.Ping/tests/FunctionalTests/*.cs + +# System.Net.WebSockets +../../../external/corefx/src/System.Net.WebSockets/tests/*.cs + +# System.Net.WebProxy +#../../../external/corefx/src/System.Net.WebProxy/tests/*.cs + +# System.Net.ServicePoint +#../../../external/corefx/src/System.Net.ServicePoint/tests/*.cs + +# System.Net.Sockets +../../../external/corefx/src/Common/tests/System/Diagnostics/Tracing/TestEventListener.cs +../../../external/corefx/src/Common/src/System/Net/Logging/NetEventSource.Common.cs +../../../external/corefx/src/Common/tests/System/Net/Capability.Sockets.cs +../../../external/corefx/src/Common/tests/System/Net/EventSourceTestLogging.cs +../../../external/corefx/src/Common/tests/System/Net/TestLogging.cs +../../../external/corefx/src/Common/tests/System/Net/VerboseTestLogging.cs +../../../external/corefx/src/Common/src/System/Threading/Tasks/TaskToApm.cs +../../../external/corefx/src/Common/tests/System/ShouldNotBeInvokedException.cs +../../../external/corefx/src/Common/tests/System/Net/Configuration.cs +../../../external/corefx/src/Common/tests/System/Net/Configuration.Sockets.cs +../../../external/corefx/src/Common/tests/System/Net/Sockets/Fletcher32.cs +../../../external/corefx/src/Common/tests/System/Net/Sockets/SocketImplementationType.cs +../../../external/corefx/src/Common/tests/System/Net/Sockets/SocketTestExtensions.cs +../../../external/corefx/src/Common/tests/System/Net/Sockets/SocketTestServer.cs +../../../external/corefx/src/Common/tests/System/Net/Sockets/SocketTestServerAPM.cs +../../../external/corefx/src/Common/tests/System/Net/Sockets/SocketTestServerAsync.cs +../../../external/corefx/src/Common/tests/System/Net/Sockets/TestSettings.cs +#../../../external/corefx/src/System.Net.Sockets/tests/FunctionalTests/*.cs:NetworkStreamTest.netcoreapp.cs,SocketTestHelper.netcoreapp.cs,SendReceive.netcoreapp.cs,SocketAsyncEventArgsTest.cs,LoggingTest.cs,SendReceive.cs + +# System.Net.Primitives +../../../external/corefx/src/System.Net.Primitives/tests/FunctionalTests/CookieTest/*.cs +#../../../external/corefx/src/System.Net.Primitives/tests/FunctionalTests/*.cs:IPAddressParsingSpan.cs,IPAddressSpanTest.cs + +# System.Net.Http +# Lots of stuff here need Spans +../../../external/corefx/src/Common/src/System/Net/UriScheme.cs +../../../external/corefx/src/Common/src/System/SerializableAttribute.cs +../../../external/corefx/src/Common/tests/System/ShouldNotBeInvokedException.cs + +# System.IO.FileSystemWatcher +../../../external/corefx/src/System.IO.FileSystem.Watcher/tests/Utility/*.cs +../../../external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.cs +../../../external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs +../../../external/corefx/src/Common/tests/System/IO/TempFile.cs +../../../external/corefx/src/Common/tests/System/IO/TempDirectory.cs + +# System.Text.RegularExpressions +../../../external/corefx/src/Common/tests/System/Diagnostics/DebuggerAttributes.cs +../../../external/corefx/src/System.Text.RegularExpressions/tests/*.cs:Regex.Serialization.cs,MatchCollectionTests.cs,MatchCollectionTests2.cs + +# System.Security.Cryptography +#../../../external/corefx/src/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/tests/AsnEncodedDataCollectionTests.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/tests/Oid.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/tests/OidCollectionTests.cs diff --git a/mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs b/mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs index 3681b5cc25..9d54e0f601 100644 --- a/mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs +++ b/mcs/class/System/Test/System.IO.Compression/DeflateStreamTest.cs @@ -480,6 +480,61 @@ namespace MonoTests.System.IO.Compression Assert.AreEqual(125387, byteCount); } + + [Test] + public void Issue10054_ZeroRead() + { + // "HelloWorld" as UTF8/DeflateStream(...,CompressionMode.Compress) + var buffer = new byte[] { 243, 72, 205, 201, 201, 15, 207, 47, 202, 73, 1, 0 }; + var mem = new MemoryStream(buffer); + var chu = new ChunkedReader(mem); + var def = new DeflateStream(chu, CompressionMode.Decompress); + + var buffer2 = new byte[4096]; + int read2 = 0; + + chu.limit = 3; + read2 += def.Read(buffer2, read2, buffer2.Length - read2); + chu.limit = 100; + read2 += def.Read(buffer2, read2, buffer2.Length - read2); + + var res = Encoding.UTF8.GetString(buffer2, 0, read2); + Assert.AreEqual("HelloWorld", res); + } + + public class ChunkedReader : Stream + { + public int limit = 0; + private Stream baseStream; + + public ChunkedReader(Stream baseStream) + { + this.baseStream = baseStream; + } + + public override int Read(byte[] buffer, int offset, int count) + { + int read = baseStream.Read(buffer, offset, Math.Min(count, this.limit)); + this.limit -= read; + return read; + } + + public override void Flush() => baseStream.Flush(); + public override long Seek(long offset, SeekOrigin origin) => baseStream.Seek(offset, origin); + public override void SetLength(long value) => baseStream.SetLength(value); + public override void Write(byte[] buffer, int offset, int count) => baseStream.Write(buffer, offset, count); + + public override bool CanRead => baseStream.CanRead; + public override bool CanSeek => baseStream.CanSeek; + public override bool CanWrite => baseStream.CanWrite; + public override long Length => baseStream.Length; + + public override long Position + { + get => baseStream.Position; + set => baseStream.Position = value; + } + } } } diff --git a/mcs/class/System/Test/System.Net.Security/SslStreamTest.cs b/mcs/class/System/Test/System.Net.Security/SslStreamTest.cs index 8c343df1a4..5118f30de1 100644 --- a/mcs/class/System/Test/System.Net.Security/SslStreamTest.cs +++ b/mcs/class/System/Test/System.Net.Security/SslStreamTest.cs @@ -129,7 +129,7 @@ public class SslStreamTest { } catch (ObjectDisposedException) { /* this can happen when closing connection it's irrelevant for the test result*/ } catch (IOException) { // The authentication or decryption has failed. - // ---> Mono.Security.Protocol.Tls.TlsException: Insuficient Security + // ---> TlsException: Insuficient Security // that's fine for MismatchedCipherSuites if (!state.ServerIOException) throw; diff --git a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs.REMOVED.git-id b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs.REMOVED.git-id index 11f9b1535b..77d840e614 100644 --- a/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs.REMOVED.git-id +++ b/mcs/class/System/Test/System.Net/HttpWebRequestTest.cs.REMOVED.git-id @@ -1 +1 @@ -0fd53cdea741d804cf43f8d862815523224ef66f \ No newline at end of file +0e5e4fa3cc55421e0c4f859790f4f9db6af83d40 \ No newline at end of file diff --git a/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X500DistinguishedNameTest.cs b/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X500DistinguishedNameTest.cs index 1e49fac416..046a885eae 100644 --- a/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X500DistinguishedNameTest.cs +++ b/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X500DistinguishedNameTest.cs @@ -315,7 +315,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates { [Test] public void RFC3280MandatoryAttributeTypes () { - string expected = "dnQualifier=CA, OID.2.5.4.5=345, S=Maryland, DC=testcertificates, DC=gov, O=Test Certificates, C=US"; + string expected = "dnQualifier=CA, SERIALNUMBER=345, S=Maryland, DC=testcertificates, DC=gov, O=Test Certificates, C=US"; X509Certificate2 cert = new X509Certificate2 (RFC3280MandatoryAttributeTypesCACert_crt); // note: strangely the (also CryptoAPI based) certificate viewer in Windows seems to resolve 2.5.4.5 as "Serial Number" Assert.AreEqual (expected, cert.SubjectName.Name, "SubjectName"); @@ -347,7 +347,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates { 0x13, 0x1D, 0x43, 0x56, 0x52, 0x3A, 0x31, 0x33, 0x34, 0x37, 0x31, 0x39, 0x36, 0x37, 0x2D, 0x55, 0x49, 0x44, 0x3A, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32, 0x31, 0x32 }; X500DistinguishedName dn = new X500DistinguishedName (sn); - string subject = "OID.2.5.4.5=CVR:13471967-UID:121212121212, E=vhm@use.test.dk, CN=Hedeby's Møbelhandel - Salgsafdelingen, O=Hedeby's Møbelhandel // CVR:13471967, C=DK"; + string subject = "SERIALNUMBER=CVR:13471967-UID:121212121212, E=vhm@use.test.dk, CN=Hedeby's Møbelhandel - Salgsafdelingen, O=Hedeby's Møbelhandel // CVR:13471967, C=DK"; Assert.AreEqual (subject, dn.Name, "Name"); } } diff --git a/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Cert20Test.cs b/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Cert20Test.cs index 869154d630..75d04b12f7 100644 --- a/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Cert20Test.cs +++ b/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Cert20Test.cs @@ -454,6 +454,7 @@ mgk3bWUV6ChegutbguiKrI/DbO7wPiDLxw== new X509Certificate ().GetSerialNumberString (); } +#if !MOBILE [Test] [ExpectedException (typeof (NullReferenceException))] public void GetObjectData_Null () @@ -474,6 +475,7 @@ mgk3bWUV6ChegutbguiKrI/DbO7wPiDLxw== Assert.AreEqual (1, info.MemberCount, "MemberCount"); byte[] raw = (byte[]) info.GetValue ("RawData", typeof (byte[])); } +#endif [Test] [ExpectedException (typeof (NullReferenceException))] diff --git a/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Certificate2Test.cs.REMOVED.git-id b/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Certificate2Test.cs.REMOVED.git-id index 1e8ea28bab..f4a834896c 100644 --- a/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Certificate2Test.cs.REMOVED.git-id +++ b/mcs/class/System/Test/System.Security.Cryptography.X509Certificates/X509Certificate2Test.cs.REMOVED.git-id @@ -1 +1 @@ -58b7b1819107b4116d60ac04a1f27d5b8af4a0d7 \ No newline at end of file +154d250723232cec39579047ce3ebd3ed2839f24 \ No newline at end of file diff --git a/mcs/class/System/appletls.sources b/mcs/class/System/appletls.sources new file mode 100644 index 0000000000..c978cbe67e --- /dev/null +++ b/mcs/class/System/appletls.sources @@ -0,0 +1,14 @@ +Mono.AppleTls/AppleCertificateHelper.cs +Mono.AppleTls/AppleTlsContext.cs +Mono.AppleTls/AppleTlsProvider.cs +Mono.AppleTls/AppleTlsStream.cs +Mono.AppleTls/Enums.cs +Mono.AppleTls/SecureTransport.cs +Mono.AppleTls/Policy.cs +Mono.AppleTls/Trust.cs +Mono.AppleTls/SslConnection.cs +Mono.AppleTls/X509CertificateImplApple.cs +Mono.AppleTls/X509PalImpl.Apple.cs + +Mono.AppleTls/MonoCertificatePal.cs +Mono.AppleTls/SafeHandles.Mono.cs diff --git a/mcs/class/System/basic_System.dll.sources b/mcs/class/System/basic_System.dll.sources index fa6e1453a9..a58c10aa6d 100644 --- a/mcs/class/System/basic_System.dll.sources +++ b/mcs/class/System/basic_System.dll.sources @@ -1,3 +1,4 @@ #include net_4_x_System.dll.sources ../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.UnknownUnix.cs ../../../external/corefx/src/Common/src/System/Net/ContextAwareResult.Unix.cs +Internal.Cryptography/OidLookup.Managed.cs diff --git a/mcs/class/System/build_System.dll.sources b/mcs/class/System/build_System.dll.sources index fa6e1453a9..a58c10aa6d 100644 --- a/mcs/class/System/build_System.dll.sources +++ b/mcs/class/System/build_System.dll.sources @@ -1,3 +1,4 @@ #include net_4_x_System.dll.sources ../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.UnknownUnix.cs ../../../external/corefx/src/Common/src/System/Net/ContextAwareResult.Unix.cs +Internal.Cryptography/OidLookup.Managed.cs diff --git a/mcs/class/System/common.sources b/mcs/class/System/common.sources index 2185a80a13..2840111891 100644 --- a/mcs/class/System/common.sources +++ b/mcs/class/System/common.sources @@ -1,5 +1,4 @@ Assembly/AssemblyInfo.cs -../../build/common/SR.cs corefx/*.cs Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs @@ -79,26 +78,19 @@ System.Net.Mail/SmtpFailedRecipientException.cs System.Net.Mail/SmtpFailedRecipientsException.cs System.Net.Mail/SmtpStatusCode.cs -System.Net.NetworkInformation/IcmpV4Statistics.cs -System.Net.NetworkInformation/IcmpV6Statistics.cs -System.Net.NetworkInformation/IPAddressCollection.cs -System.Net.NetworkInformation/IPGlobalProperties.cs -System.Net.NetworkInformation/IPGlobalStatistics.cs -System.Net.NetworkInformation/IPInterfaceProperties.cs -System.Net.NetworkInformation/IPv4InterfaceProperties.cs -System.Net.NetworkInformation/IPv4InterfaceStatistics.cs -System.Net.NetworkInformation/IPv6InterfaceProperties.cs -System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs -System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs +System.Net.NetworkInformation/IPGlobalPropertiesFactory.cs System.Net.NetworkInformation/NetworkChange.cs System.Net.NetworkInformation/NetworkInterface.cs +System.Net.NetworkInformation/NetworkInterfaceFactory.cs System.Net.NetworkInformation/Ping.cs System.Net.NetworkInformation/PingCompletedEventArgs.cs System.Net.NetworkInformation/PingCompletedEventHandler.cs -System.Net.NetworkInformation/TcpStatistics.cs -System.Net.NetworkInformation/UdpStatistics.cs -System.Net.NetworkInformation/UnicastIPAddressInformation.cs -System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs + +#include unix_networkinfo.sources +#include linux_networkinfo.sources +#include macos_networkinfo.sources +#include win32_networkinfo.sources + System.Net.Security/EncryptionPolicy.cs System.Net.Security/LocalCertificateSelectionCallback.cs System.Net.Security/NegotiateStream.cs @@ -148,8 +140,8 @@ System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameEleme System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElementCollection.cs System.Security.Cryptography/AsnEncodedData.cs -System.Security.Cryptography/AsnEncodedDataCollection.cs -System.Security.Cryptography/AsnEncodedDataEnumerator.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/src/System/Security/Cryptography/AsnEncodedDataCollection.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/src/System/Security/Cryptography/AsnEncodedDataEnumerator.cs ../../../external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/OpenFlags.cs System.Security.Cryptography.X509Certificates/OSX509Certificates.cs @@ -199,6 +191,12 @@ System.Timers/ElapsedEventArgs.cs System.Windows.Input/ICommand.cs +Mono/SystemCertificateProvider.cs +Mono/SystemDependencyProvider.cs +Mono/X509Pal.cs +Mono/X509PalImpl.cs +Mono/X509PalImpl.Mono.cs + Mono.Btls/MonoBtlsBio.cs Mono.Btls/MonoBtlsContext.cs Mono.Btls/MonoBtlsError.cs @@ -237,20 +235,9 @@ Mono.Btls/MonoBtlsX509VerifyFlags.cs Mono.Btls/MonoBtlsX509VerifyParam.cs Mono.Btls/X509CertificateImplBtls.cs Mono.Btls/X509ChainImplBtls.cs +Mono.Btls/X509PalImpl.Btls.cs -Mono.AppleTls/AppleCertificateHelper.cs -Mono.AppleTls/AppleTlsContext.cs -Mono.AppleTls/AppleTlsProvider.cs -Mono.AppleTls/AppleTlsStream.cs Mono.AppleTls/INativeObject.cs -Mono.AppleTls/Certificate.cs -Mono.AppleTls/ImportExport.cs -Mono.AppleTls/Enums.cs -Mono.AppleTls/SecureTransport.cs -Mono.AppleTls/Policy.cs -Mono.AppleTls/Trust.cs -Mono.AppleTls/SslConnection.cs -Mono.AppleTls/Items.cs Mono.Util/MonoPInvokeCallbackAttribute.cs @@ -258,7 +245,6 @@ MonoTouch/Dummy.cs ReferenceSources/AutoWebProxyScriptEngine.cs ReferenceSources/AssertWrapper.cs -ReferenceSources/CAPI.cs ReferenceSources/EnvironmentHelpers.cs ReferenceSources/HttpApi.cs ReferenceSources/LocalAppContextSwitches.cs @@ -270,8 +256,6 @@ ReferenceSources/ServerCertValidationCallback.cs ReferenceSources/SettingsSectionInternal.cs ReferenceSources/SecureStringHelper.cs ReferenceSources/Socket.cs -ReferenceSources/SR.cs -ReferenceSources/SR2.cs ReferenceSources/SRCategoryAttribute.cs ReferenceSources/Win32Exception.cs @@ -768,9 +752,11 @@ ReferenceSources/Win32Exception.cs ../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs ../referencesource/System/security/system/security/Authentication/ExtendedProtection/ServiceNameCollection.cs -../referencesource/System/security/system/security/cryptography/oid.cs - -../referencesource/System/security/system/security/cryptography/x509/x509utils.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/src/System/Security/Cryptography/OidGroup.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/src/System/Security/Cryptography/Oid.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/src/System/Security/Cryptography/OidCollection.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/src/System/Security/Cryptography/OidEnumerator.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/src/Internal/Cryptography/OidLookup.cs ../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs @@ -794,8 +780,6 @@ ReferenceSources/Win32Exception.cs ../referencesource/System/compmod/microsoft/win32/safehandles/SafeProcessHandle.cs -corefx/SR.cs - ../../../external/corefx/src/Common/src/CoreLib/System/Collections/Generic/ValueListBuilder.cs ../../../external/corefx/src/Common/src/System/NotImplemented.cs diff --git a/mcs/class/System/corefx.unix.sources b/mcs/class/System/corefx.unix.sources index bec78d856d..f8e5c2a671 100644 --- a/mcs/class/System/corefx.unix.sources +++ b/mcs/class/System/corefx.unix.sources @@ -1 +1,3 @@ ../../../external/corefx/src/Common/src/Interop/Unix/*.cs +corefx/Unix/Interop.cs +corefx/Unix/Interop.Read.cs diff --git a/mcs/class/System/corefx/SR.cs b/mcs/class/System/corefx/SR.cs deleted file mode 100644 index c6c8b7432f..0000000000 --- a/mcs/class/System/corefx/SR.cs +++ /dev/null @@ -1,555 +0,0 @@ -// -// This file was generated by resx2sr tool -// - -partial class SR -{ - public const string BlockingCollection_Add_ConcurrentCompleteAdd = "CompleteAdding may not be used concurrently with additions to the collection."; - public const string BlockingCollection_Add_Failed = "The underlying collection didn't accept the item."; - public const string BlockingCollection_CantAddAnyWhenCompleted = "At least one of the specified collections is marked as complete with regards to additions."; - public const string BlockingCollection_CantTakeAnyWhenAllDone = "All collections are marked as complete with regards to additions."; - public const string BlockingCollection_CantTakeWhenDone = "The collection argument is empty and has been marked as complete with regards to additions."; - public const string BlockingCollection_Completed = "The collection has been marked as complete with regards to additions."; - public const string BlockingCollection_CopyTo_IncorrectType = "The array argument is of the incorrect type."; - public const string BlockingCollection_CopyTo_MultiDim = "The array argument is multidimensional."; - public const string BlockingCollection_CopyTo_NonNegative = "The index argument must be greater than or equal zero."; - public const string Collection_CopyTo_TooManyElems = "The number of elements in the collection is greater than the available space from index to the end of the destination array."; - public const string BlockingCollection_ctor_BoundedCapacityRange = "The boundedCapacity argument must be positive."; - public const string BlockingCollection_ctor_CountMoreThanCapacity = "The collection argument contains more items than are allowed by the boundedCapacity."; - public const string BlockingCollection_Disposed = "The collection has been disposed."; - public const string BlockingCollection_Take_CollectionModified = "The underlying collection was modified from outside of the BlockingCollection."; - public const string BlockingCollection_TimeoutInvalid = "The specified timeout must represent a value between -1 and {0}, inclusive."; - public const string BlockingCollection_ValidateCollectionsArray_DispElems = "The collections argument contains at least one disposed element."; - public const string BlockingCollection_ValidateCollectionsArray_LargeSize = "The collections length is greater than the supported range for 32 bit machine."; - public const string BlockingCollection_ValidateCollectionsArray_NullElems = "The collections argument contains at least one null element."; - public const string BlockingCollection_ValidateCollectionsArray_ZeroSize = "The collections argument is a zero-length array."; - public const string Common_OperationCanceled = "The operation was canceled."; - public const string ConcurrentBag_Ctor_ArgumentNullException = "The collection argument is null."; - public const string ConcurrentBag_CopyTo_ArgumentNullException = "The array argument is null."; - public const string Collection_CopyTo_ArgumentOutOfRangeException = "The index argument must be greater than or equal zero."; - public const string ConcurrentCollection_SyncRoot_NotSupported = "The SyncRoot property may not be used for the synchronization of concurrent collections."; - public const string ConcurrentDictionary_ArrayIncorrectType = "The array is multidimensional, or the type parameter for the set cannot be cast automatically to the type of the destination array."; - public const string ConcurrentDictionary_SourceContainsDuplicateKeys = "The source argument contains duplicate keys."; - public const string ConcurrentDictionary_ConcurrencyLevelMustBePositive = "The concurrencyLevel argument must be positive."; - public const string ConcurrentDictionary_CapacityMustNotBeNegative = "The capacity argument must be greater than or equal to zero."; - public const string ConcurrentDictionary_IndexIsNegative = "The index argument is less than zero."; - public const string ConcurrentDictionary_ArrayNotLargeEnough = "The index is equal to or greater than the length of the array, or the number of elements in the dictionary is greater than the available space from index to the end of the destination array."; - public const string ConcurrentDictionary_KeyAlreadyExisted = "The key already existed in the dictionary."; - public const string ConcurrentDictionary_ItemKeyIsNull = "TKey is a reference type and item.Key is null."; - public const string ConcurrentDictionary_TypeOfKeyIncorrect = "The key was of an incorrect type for this dictionary."; - public const string ConcurrentDictionary_TypeOfValueIncorrect = "The value was of an incorrect type for this dictionary."; - public const string ConcurrentStack_PushPopRange_CountOutOfRange = "The count argument must be greater than or equal to zero."; - public const string ConcurrentStack_PushPopRange_InvalidCount = "The sum of the startIndex and count arguments must be less than or equal to the collection's Count."; - public const string ConcurrentStack_PushPopRange_StartOutOfRange = "The startIndex argument must be greater than or equal to zero."; - public const string Partitioner_DynamicPartitionsNotSupported = "Dynamic partitions are not supported by this partitioner."; - public const string PartitionerStatic_CanNotCallGetEnumeratorAfterSourceHasBeenDisposed = "Can not call GetEnumerator on partitions after the source enumerable is disposed"; - public const string PartitionerStatic_CurrentCalledBeforeMoveNext = "MoveNext must be called at least once before calling Current."; - public const string ConcurrentBag_Enumerator_EnumerationNotStartedOrAlreadyFinished = "Enumeration has either not started or has already finished."; - public const string Arg_KeyNotFoundWithKey = "The given key '{0}' was not present in the dictionary."; - public const string IO_FileExists_Name = "The file '{0}' already exists."; - public const string IO_FileName_Name = "File name: '{0}'"; - public const string IO_FileNotFound = "Unable to find the specified file."; - public const string IO_FileNotFound_FileName = "Could not load file or assembly '{0}'. The system cannot find the file specified."; - public const string IO_FileLoad = "Could not load the specified file."; - public const string IO_NoPermissionToDirectoryName = " defaultString; -} \ No newline at end of file diff --git a/mcs/class/System/corefx/Unix/Interop.Read.cs b/mcs/class/System/corefx/Unix/Interop.Read.cs new file mode 100644 index 0000000000..2eeb90cb2b --- /dev/null +++ b/mcs/class/System/corefx/Unix/Interop.Read.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// This file reiimplements CoreFX source file 'src/Common/src/Interop/Unix/System.Native/Interop.Read.cs' + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Microsoft.Win32.SafeHandles; +using System; + +internal static partial class Interop +{ + internal static partial class Sys + { + static Sys () + { + Interop.mono_pal_init (); + } + + /// + /// Reads a number of bytes from an open file descriptor into a specified buffer. + /// + /// The open file descriptor to try to read from + /// The buffer to read info into + /// The size of the buffer + /// + /// Returns the number of bytes read on success; otherwise, -1 is returned + /// Note - on fail. the position of the stream may change depending on the platform; consult man 2 read for more info + /// + internal static unsafe int Read (SafeFileHandle fd, byte* buffer, int count) + { + int bytes_read = -1; + bool release = false; + try { + fd.DangerousAddRef (ref release); + do { + bytes_read = Read (fd.DangerousGetHandle (), buffer, count); + } while (bytes_read < 0 && Marshal.GetLastWin32Error () == (int) Interop.Error.EINTR); + } + finally { + if (release) + fd.DangerousRelease (); + } + return bytes_read; + } + + [MethodImplAttribute(MethodImplOptions.InternalCall)] + internal static extern unsafe int Read (IntPtr fd, byte* buffer, int count); + } +} diff --git a/mcs/class/System/corefx/Unix/Interop.cs b/mcs/class/System/corefx/Unix/Interop.cs new file mode 100644 index 0000000000..312b1efa86 --- /dev/null +++ b/mcs/class/System/corefx/Unix/Interop.cs @@ -0,0 +1,11 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport("__Internal")] + internal static extern void mono_pal_init (); +} diff --git a/mcs/class/System/linux_net_4_x_System.dll.sources b/mcs/class/System/linux_net_4_x_System.dll.sources index ad3a599b15..125b1a15bb 100644 --- a/mcs/class/System/linux_net_4_x_System.dll.sources +++ b/mcs/class/System/linux_net_4_x_System.dll.sources @@ -1,17 +1 @@ -#include corefx.unix.sources -#include net_4_x_System.dll.sources - -../../../external/corefx/src/Common/src/Interop/Linux/Interop.Libraries.cs -../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs -../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeDirectoryHandle.Unix.cs -../../../external/corefx/src/Common/src/Interop/Linux/System.Native/Interop.INotify.cs -../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs -../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.OpenFlags.cs -../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.ReadDir.cs -../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.FLock.cs -../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Stat.cs -../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Poll.cs -../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Open.cs -../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Read.cs -../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Close.cs -../../../external/corefx/src/Common/src/System/Net/ContextAwareResult.Unix.cs +#include unix_net_4_x_System.dll.sources diff --git a/mcs/class/System/linux_networkinfo.sources b/mcs/class/System/linux_networkinfo.sources new file mode 100644 index 0000000000..162a3384eb --- /dev/null +++ b/mcs/class/System/linux_networkinfo.sources @@ -0,0 +1,6 @@ +System.Net.NetworkInformation/LinuxIPInterfaceProperties.cs +System.Net.NetworkInformation/LinuxIPv4InterfaceProperties.cs +System.Net.NetworkInformation/LinuxIPv4InterfaceStatistics.cs +System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs +System.Net.NetworkInformation/LinuxNetworkInterface.cs +System.Net.NetworkInformation/LinuxUnicastIPAddressInformation.cs diff --git a/mcs/class/System/darwin_net_4_x_System.dll.sources b/mcs/class/System/macos_net_4_x_System.dll.sources similarity index 86% rename from mcs/class/System/darwin_net_4_x_System.dll.sources rename to mcs/class/System/macos_net_4_x_System.dll.sources index 7a4b90afb9..483f315b3c 100644 --- a/mcs/class/System/darwin_net_4_x_System.dll.sources +++ b/mcs/class/System/macos_net_4_x_System.dll.sources @@ -1,5 +1,9 @@ #include corefx.unix.sources #include net_4_x_System.dll.sources +#include appletls.sources + +Mono.AppleTls/MonoCertificatePal.OSX.cs +Mono.AppleTls/SafeHandles.cs ../../../external/corefx/src/Common/src/Interop/OSX/Interop.Libraries.cs ../../../external/corefx/src/Common/src/Interop/OSX/Interop.EventStream.cs @@ -11,4 +15,4 @@ ../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeCreateHandle.OSX.cs ../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeEventStreamHandle.OSX.cs ../../../external/corefx/src/Common/src/System/Net/ContextAwareResult.OSX.cs - +Internal.Cryptography/OidLookup.Managed.cs diff --git a/mcs/class/System/macos_networkinfo.sources b/mcs/class/System/macos_networkinfo.sources new file mode 100644 index 0000000000..8a03393938 --- /dev/null +++ b/mcs/class/System/macos_networkinfo.sources @@ -0,0 +1,5 @@ +System.Net.NetworkInformation/MacOsIPInterfaceProperties.cs +System.Net.NetworkInformation/MacOsIPv4InterfaceProperties.cs +System.Net.NetworkInformation/MacOsIPv4InterfaceStatistics.cs +System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs +System.Net.NetworkInformation/MacOsNetworkInterface.cs diff --git a/mcs/class/System/mobile_System.dll.sources b/mcs/class/System/mobile_System.dll.sources index 2b750726b8..665c31ae90 100644 --- a/mcs/class/System/mobile_System.dll.sources +++ b/mcs/class/System/mobile_System.dll.sources @@ -2,3 +2,4 @@ #include common_networking.sources ../../../external/corefx/src/Common/src/System/Net/ContextAwareResult.Unix.cs ../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.UnknownUnix.cs +Internal.Cryptography/OidLookup.Managed.cs diff --git a/mcs/class/System/monodroid_System_test.dll.exclude.sources b/mcs/class/System/monodroid_System_test.dll.exclude.sources new file mode 100644 index 0000000000..c2f4d70d80 --- /dev/null +++ b/mcs/class/System/monodroid_System_test.dll.exclude.sources @@ -0,0 +1,81 @@ +#include testing_aot_full_System_test.dll.exclude.sources +Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs +Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs +Microsoft.Win32/PowerModeChangedEventArgsCas.cs +Microsoft.Win32/SessionEndedEventArgsCas.cs +Microsoft.Win32/SessionEndingEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsTest.cs +Microsoft.Win32/SystemEventsCas.cs +Microsoft.Win32/TimerElapsedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangingEventArgsCas.cs +System.Collections.Specialized/BitVector32Cas.cs +System.Collections.Specialized/CollectionsUtilCas.cs +System.Collections.Specialized/HybridDictionaryCas.cs +System.Collections.Specialized/ListDictionaryCas.cs +System.Collections.Specialized/NameObjectCollectionBaseCas.cs +System.Collections.Specialized/NameValueCollectionCas.cs +System.Collections.Specialized/OrderedDictionaryCas.cs +System.Collections.Specialized/StringCollectionCas.cs +System.Collections.Specialized/StringDictionaryCas.cs +System.ComponentModel.Design.Serialization/InstanceDescriptorCas.cs +System/FileStyleUriParserCas.cs +System/FtpStyleUriParserCas.cs +System/GenericUriParserCas.cs +System/GopherStyleUriParserCas.cs +System/HttpStyleUriParserCas.cs +System.IO.Compression/DeflateStreamCas.cs +System.IO.Compression/GZipStreamCas.cs +System/LdapStyleUriParserCas.cs +System.Net/DnsCas.cs +System.Net/FileWebRequestCas.cs +System.Net/HttpListener2Test.cs +System.Net/HttpListenerRequestTest.cs +System.Net/HttpWebRequestCas.cs +System/NetPipeStyleUriParserCas.cs +System.Net.Sockets/NetworkStreamCas.cs +System.Net.Sockets/SocketCas.cs +System.Net.Sockets/TcpClientCas.cs +System/NetTcpStyleUriParserCas.cs +System/NewsStyleUriParserCas.cs +System.Security.Cryptography.X509Certificates/PublicKeyCas.cs +System.Security.Cryptography.X509Certificates/X500DistinguishedNameCas.cs +System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtensionCas.cs +System.Security.Cryptography.X509Certificates/X509CertificateCollectionCas.cs +System.Security.Cryptography.X509Certificates/X509ChainCas.cs +System.Security.Cryptography.X509Certificates/X509ChainPolicyCas.cs +System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtensionCas.cs +System.Security.Cryptography.X509Certificates/X509ExtensionCas.cs +System.Security.Cryptography.X509Certificates/X509KeyUsageExtensionCas.cs +System.Security.Cryptography.X509Certificates/X509StoreCas.cs +System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtensionCas.cs +System.Security.Permissions/ResourcePermissionBaseCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryTest.cs +System.Security.Permissions/ResourcePermissionBaseTest.cs +System.Security.Permissions/StorePermissionAttributeCas.cs +System.Security.Permissions/StorePermissionAttributeTest.cs +System.Security.Permissions/StorePermissionCas.cs +System.Security.Permissions/StorePermissionTest.cs +System.Text.RegularExpressions/CaptureCas.cs +System.Text.RegularExpressions/CaptureCollectionCas.cs +System.Text.RegularExpressions/GroupCas.cs +System.Text.RegularExpressions/GroupCollectionCas.cs +System.Text.RegularExpressions/MatchCas.cs +System.Text.RegularExpressions/MatchCollectionCas.cs +System.Text.RegularExpressions/RegexCas.cs +System.Text.RegularExpressions/RegexCompilationInfoCas.cs +System.Text.RegularExpressions/RegexRunnerCas.cs +System.Text.RegularExpressions/RegexRunnerFactoryCas.cs +System.Threading/SemaphoreCas.cs +System.Threading/SemaphoreFullExceptionCas.cs +System.Threading/ThreadExceptionEventArgsCas.cs +System.Timers/ElapsedEventArgsCas.cs +System.Timers/TimerCas.cs +System.Timers/TimersDescriptionAttributeCas.cs +System/UriBuilderCas.cs +System/UriCas.cs +System/UriFormatExceptionCas.cs +System/UriParserCas.cs +System/UriTypeConverterCas.cs diff --git a/mcs/class/System/monodroid_System_test.dll.sources b/mcs/class/System/monodroid_System_test.dll.sources new file mode 100644 index 0000000000..3944a95be6 --- /dev/null +++ b/mcs/class/System/monodroid_System_test.dll.sources @@ -0,0 +1 @@ +#include System_test.dll.sources diff --git a/mcs/class/System/monotouch_System.dll.sources b/mcs/class/System/monotouch_System.dll.sources index e478e8894e..904d01afd9 100644 --- a/mcs/class/System/monotouch_System.dll.sources +++ b/mcs/class/System/monotouch_System.dll.sources @@ -1,2 +1,5 @@ #include mobile_System.dll.sources +#include appletls.sources +Mono.AppleTls/MonoCertificatePal.Mobile.cs +Mono.AppleTls/SafeHandles.cs diff --git a/mcs/class/System/monotouch_System_test.dll.exclude.sources b/mcs/class/System/monotouch_System_test.dll.exclude.sources new file mode 100644 index 0000000000..1a8bef11f6 --- /dev/null +++ b/mcs/class/System/monotouch_System_test.dll.exclude.sources @@ -0,0 +1,207 @@ +System.CodeDom/CodeArgumentReferenceExpressionCas.cs +System.CodeDom/CodeArgumentReferenceExpressionTest.cs +System.CodeDom/CodeArrayCreateExpressionCas.cs +System.CodeDom/CodeArrayCreateExpressionTest.cs +System.CodeDom/CodeArrayIndexerExpressionCas.cs +System.CodeDom/CodeAssignStatementCas.cs +System.CodeDom/CodeAttachEventStatementCas.cs +System.CodeDom/CodeAttachEventStatementTest.cs +System.CodeDom/CodeAttributeArgumentCas.cs +System.CodeDom/CodeAttributeArgumentCollectionCas.cs +System.CodeDom/CodeAttributeArgumentCollectionTest.cs +System.CodeDom/CodeAttributeArgumentTest.cs +System.CodeDom/CodeAttributeDeclarationCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionTest.cs +System.CodeDom/CodeAttributeDeclarationTest.cs +System.CodeDom/CodeBaseReferenceExpressionCas.cs +System.CodeDom/CodeBinaryOperatorExpressionCas.cs +System.CodeDom/CodeCastExpressionCas.cs +System.CodeDom/CodeCastExpressionTest.cs +System.CodeDom/CodeCatchClauseCas.cs +System.CodeDom/CodeCatchClauseCollectionCas.cs +System.CodeDom/CodeCatchClauseCollectionTest.cs +System.CodeDom/CodeCatchClauseTest.cs +System.CodeDom/CodeChecksumPragmaCas.cs +System.CodeDom/CodeChecksumPragmaTest.cs +System.CodeDom/CodeCommentStatementCas.cs +System.CodeDom/CodeCommentStatementCollectionCas.cs +System.CodeDom/CodeCommentStatementCollectionTest.cs +System.CodeDom/CodeCompileUnitCas.cs +System.CodeDom/CodeConditionStatementCas.cs +System.CodeDom/CodeConstructorCas.cs +System.CodeDom/CodeConstructorTest.cs +System.CodeDom/CodeDefaultValueExpressionCas.cs +System.CodeDom/CodeDefaultValueExpressionTest.cs +System.CodeDom/CodeDelegateCreateExpressionCas.cs +System.CodeDom/CodeDelegateCreateExpressionTest.cs +System.CodeDom/CodeDelegateInvokeExpressionCas.cs +System.CodeDom/CodeDirectionExpressionCas.cs +System.CodeDom/CodeDirectiveCas.cs +System.CodeDom/CodeDirectiveCollectionCas.cs +System.CodeDom/CodeDirectiveCollectionTest.cs +System.CodeDom/CodeEntryPointMethodCas.cs +System.CodeDom/CodeEventReferenceExpressionCas.cs +System.CodeDom/CodeEventReferenceExpressionTest.cs +System.CodeDom/CodeExpressionCas.cs +System.CodeDom/CodeExpressionCollectionCas.cs +System.CodeDom/CodeExpressionCollectionTest.cs +System.CodeDom/CodeExpressionStatementCas.cs +System.CodeDom/CodeFieldReferenceExpressionCas.cs +System.CodeDom/CodeGotoStatementCas.cs +System.CodeDom/CodeGotoStatementTest.cs +System.CodeDom/CodeIndexerExpressionCas.cs +System.CodeDom/CodeIterationStatementCas.cs +System.CodeDom/CodeLabeledStatementTest.cs +System.CodeDom/CodeLinePragmaCas.cs +System.CodeDom/CodeLinePragmaTest.cs +System.CodeDom/CodeMemberEventCas.cs +System.CodeDom/CodeMemberFieldCas.cs +System.CodeDom/CodeMemberFieldTest.cs +System.CodeDom/CodeMemberMethodCas.cs +System.CodeDom/CodeMemberMethodTest.cs +System.CodeDom/CodeMemberPropertyCas.cs +System.CodeDom/CodeMemberPropertyTest.cs +System.CodeDom/CodeMethodInvokeExpressionCas.cs +System.CodeDom/CodeMethodInvokeExpressionTest.cs +System.CodeDom/CodeMethodReferenceExpressionCas.cs +System.CodeDom/CodeMethodReferenceExpressionTest.cs +System.CodeDom/CodeMethodReturnStatementCas.cs +System.CodeDom/CodeNamespaceCas.cs +System.CodeDom/CodeNamespaceCollectionCas.cs +System.CodeDom/CodeNamespaceCollectionTest.cs +System.CodeDom/CodeNamespaceImportCas.cs +System.CodeDom/CodeNamespaceImportCollectionCas.cs +System.CodeDom/CodeNamespaceImportCollectionTest.cs +System.CodeDom/CodeNamespaceImportTest.cs +System.CodeDom/CodeNamespaceTest.cs +System.CodeDom/CodeObjectCas.cs +System.CodeDom/CodeObjectCreateExpressionCas.cs +System.CodeDom/CodeObjectCreateExpressionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionTest.cs +System.CodeDom/CodePrimitiveExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionTest.cs +System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs +System.CodeDom/CodeRegionDirectiveCas.cs +System.CodeDom/CodeRegionDirectiveTest.cs +System.CodeDom/CodeRemoveEventStatementCas.cs +System.CodeDom/CodeRemoveEventStatementTest.cs +System.CodeDom/CodeSnippetCompileUnitCas.cs +System.CodeDom/CodeSnippetCompileUnitTest.cs +System.CodeDom/CodeSnippetExpressionCas.cs +System.CodeDom/CodeSnippetExpressionTest.cs +System.CodeDom/CodeSnippetStatementCas.cs +System.CodeDom/CodeSnippetStatementTest.cs +System.CodeDom/CodeSnippetTypeMemberCas.cs +System.CodeDom/CodeSnippetTypeMemberTest.cs +System.CodeDom/CodeStatementCas.cs +System.CodeDom/CodeStatementCollectionCas.cs +System.CodeDom/CodeStatementCollectionTest.cs +System.CodeDom/CodeThisReferenceExpressionCas.cs +System.CodeDom/CodeThrowExceptionStatementCas.cs +System.CodeDom/CodeTryCatchFinallyStatementCas.cs +System.CodeDom/CodeTypeConstructorCas.cs +System.CodeDom/CodeTypeConstructorTest.cs +System.CodeDom/CodeTypeDeclarationCas.cs +System.CodeDom/CodeTypeDeclarationCollectionCas.cs +System.CodeDom/CodeTypeDeclarationCollectionTest.cs +System.CodeDom/CodeTypeDelegateCas.cs +System.CodeDom/CodeTypeDelegateTest.cs +System.CodeDom/CodeTypeMemberCas.cs +System.CodeDom/CodeTypeMemberCollectionCas.cs +System.CodeDom/CodeTypeMemberCollectionTest.cs +System.CodeDom/CodeTypeOfExpressionCas.cs +System.CodeDom/CodeTypeOfExpressionTest.cs +System.CodeDom/CodeTypeParameterCas.cs +System.CodeDom/CodeTypeParameterCollectionTest.cs +System.CodeDom/CodeTypeParameterTest.cs +System.CodeDom/CodeTypeReferenceCas.cs +System.CodeDom/CodeTypeReferenceCollectionCas.cs +System.CodeDom/CodeTypeReferenceCollectionTest.cs +System.CodeDom/CodeTypeReferenceExpressionCas.cs +System.CodeDom/CodeTypeReferenceExpressionTest.cs +System.CodeDom/CodeTypeReferenceTest.cs +System.CodeDom/CodeVariableDeclarationStatementCas.cs +System.CodeDom/CodeVariableDeclarationStatementTest.cs +System.CodeDom/CodeVariableReferenceExpressionCas.cs +System.CodeDom/CodeVariableReferenceExpressionTest.cs +System.CodeDom.Compiler/CodeCompilerCas.cs +System.CodeDom.Compiler/CodeDomProviderCas.cs +System.CodeDom.Compiler/CodeGeneratorCas.cs +System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs +System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs +System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs +System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs +System.CodeDom.Compiler/CodeGeneratorTest.cs +System.CodeDom.Compiler/CodeGeneratorTestBase.cs +System.CodeDom.Compiler/CodeParserCas.cs +System.CodeDom.Compiler/CompilerErrorCas.cs +System.CodeDom.Compiler/CompilerErrorCollectionCas.cs +System.CodeDom.Compiler/CompilerInfoCas.cs +System.CodeDom.Compiler/CompilerParametersCas.cs +System.CodeDom.Compiler/CompilerResultsCas.cs +System.CodeDom.Compiler/ExecutorCas.cs +System.CodeDom.Compiler/ExecutorTest.cs +System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs +System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs +System.CodeDom.Compiler/IndentedTextWriterCas.cs +System.CodeDom.Compiler/IndentedTextWriterTest.cs +System.CodeDom.Compiler/TempFileCollectionCas.cs +System.CodeDom.Compiler/TempFileCollectionTest.cs +System.Security.Permissions/ResourcePermissionBaseCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryTest.cs +System.Security.Permissions/ResourcePermissionBaseTest.cs +System.Security.Permissions/StorePermissionAttributeCas.cs +System.Security.Permissions/StorePermissionAttributeTest.cs +System.Security.Permissions/StorePermissionCas.cs +System.Security.Permissions/StorePermissionTest.cs +System.Configuration/ApplicationSettingsBaseTest.cs +System.Configuration/ConfigXmlDocumentTest.cs +System.Configuration/ConfigurationExceptionTest.cs +System.Configuration/LocalFileSettingsProviderTest.cs +System.Configuration/SettingElementTest.cs +System.Configuration/SettingsBaseTest.cs +System.Configuration/SettingsPropertyCollectionTest.cs +System.Configuration/SettingsPropertyTest.cs +System.Configuration/SettingsPropertyValueCollectionTest.cs +System.Configuration/SettingsPropertyValueTest.cs +Microsoft.VisualBasic/CodeGeneratorFromBinaryOperatorTest.cs +Microsoft.VisualBasic/CodeGeneratorFromCompileUnitTest.cs +Microsoft.VisualBasic/CodeGeneratorFromExpressionTest.cs +Microsoft.VisualBasic/CodeGeneratorFromNamespaceTest.cs +Microsoft.VisualBasic/CodeGeneratorFromStatementTest.cs +Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs +Microsoft.VisualBasic/CodeGeneratorTestBase.cs +Microsoft.VisualBasic/VBCodeProviderCas.cs +Microsoft.VisualBasic/VBCodeProviderTest.cs +Microsoft.CSharp/CSharpCodeProviderCas.cs +Microsoft.CSharp/CSharpCodeProviderTest.cs +Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs +Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs +Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs +Microsoft.CSharp/CodeGeneratorFromStatementTest.cs +Microsoft.CSharp/CodeGeneratorFromTypeTest.cs +Microsoft.CSharp/CodeGeneratorIdentifierTest.cs +Microsoft.CSharp/CodeGeneratorTestBase.cs +Microsoft.CSharp/CodeGeneratorTypeOutputTest.cs +System.Web/AspNetHostingPermissionAttributeCas.cs +System.Web/AspNetHostingPermissionAttributeTest.cs +System.Web/AspNetHostingPermissionCas.cs +System.Web/AspNetHostingPermissionTest.cs +Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs +Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs +Microsoft.Win32/PowerModeChangedEventArgsCas.cs +Microsoft.Win32/SessionEndedEventArgsCas.cs +Microsoft.Win32/SessionEndingEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsTest.cs +Microsoft.Win32/SystemEventsCas.cs +Microsoft.Win32/TimerElapsedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangingEventArgsCas.cs +System.IO.Ports/SerialPortTest.cs diff --git a/mcs/class/System/monotouch_watch_System.dll.exclude.sources b/mcs/class/System/monotouch_watch_System.dll.exclude.sources index 58aa75573b..894cae9713 100644 --- a/mcs/class/System/monotouch_watch_System.dll.exclude.sources +++ b/mcs/class/System/monotouch_watch_System.dll.exclude.sources @@ -1 +1,4 @@ #include common_networking.sources +#include appletls.sources +Mono.AppleTls/MonoCertificatePal.Mobile.cs +Mono.AppleTls/SafeHandles.cs diff --git a/mcs/class/System/testing_aot_full_System_test.dll.exclude.sources b/mcs/class/System/testing_aot_full_System_test.dll.exclude.sources new file mode 100644 index 0000000000..3df5e78e1a --- /dev/null +++ b/mcs/class/System/testing_aot_full_System_test.dll.exclude.sources @@ -0,0 +1,209 @@ + +Microsoft.CSharp/CSharpCodeProviderCas.cs +Microsoft.CSharp/CSharpCodeProviderTest.cs +Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs +Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs +Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs +Microsoft.CSharp/CodeGeneratorFromStatementTest.cs +Microsoft.CSharp/CodeGeneratorFromTypeTest.cs +Microsoft.CSharp/CodeGeneratorIdentifierTest.cs +Microsoft.CSharp/CodeGeneratorTestBase.cs +Microsoft.CSharp/CodeGeneratorTypeOutputTest.cs +Microsoft.VisualBasic/CodeGeneratorFromBinaryOperatorTest.cs +Microsoft.VisualBasic/CodeGeneratorFromCompileUnitTest.cs +Microsoft.VisualBasic/CodeGeneratorFromExpressionTest.cs +Microsoft.VisualBasic/CodeGeneratorFromNamespaceTest.cs +Microsoft.VisualBasic/CodeGeneratorFromStatementTest.cs +Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs +Microsoft.VisualBasic/CodeGeneratorTestBase.cs +Microsoft.VisualBasic/VBCodeProviderCas.cs +Microsoft.VisualBasic/VBCodeProviderTest.cs +Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs +Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs +Microsoft.Win32/PowerModeChangedEventArgsCas.cs +Microsoft.Win32/SessionEndedEventArgsCas.cs +Microsoft.Win32/SessionEndingEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsTest.cs +Microsoft.Win32/SystemEventsCas.cs +Microsoft.Win32/TimerElapsedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangingEventArgsCas.cs +System.CodeDom.Compiler/CodeCompilerCas.cs +System.CodeDom.Compiler/CodeDomProviderCas.cs +System.CodeDom.Compiler/CodeGeneratorCas.cs +System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs +System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs +System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs +System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs +System.CodeDom.Compiler/CodeGeneratorTest.cs +System.CodeDom.Compiler/CodeGeneratorTestBase.cs +System.CodeDom.Compiler/CodeParserCas.cs +System.CodeDom.Compiler/CompilerErrorCas.cs +System.CodeDom.Compiler/CompilerErrorCollectionCas.cs +System.CodeDom.Compiler/CompilerInfoCas.cs +System.CodeDom.Compiler/CompilerParametersCas.cs +System.CodeDom.Compiler/CompilerResultsCas.cs +System.CodeDom.Compiler/ExecutorCas.cs +System.CodeDom.Compiler/ExecutorTest.cs +System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs +System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs +System.CodeDom.Compiler/IndentedTextWriterCas.cs +System.CodeDom.Compiler/IndentedTextWriterTest.cs +System.CodeDom.Compiler/TempFileCollectionCas.cs +System.CodeDom.Compiler/TempFileCollectionTest.cs +System.CodeDom/CodeArgumentReferenceExpressionCas.cs +System.CodeDom/CodeArgumentReferenceExpressionTest.cs +System.CodeDom/CodeArrayCreateExpressionCas.cs +System.CodeDom/CodeArrayCreateExpressionTest.cs +System.CodeDom/CodeArrayIndexerExpressionCas.cs +System.CodeDom/CodeAssignStatementCas.cs +System.CodeDom/CodeAttachEventStatementCas.cs +System.CodeDom/CodeAttachEventStatementTest.cs +System.CodeDom/CodeAttributeArgumentCas.cs +System.CodeDom/CodeAttributeArgumentCollectionCas.cs +System.CodeDom/CodeAttributeArgumentCollectionTest.cs +System.CodeDom/CodeAttributeArgumentTest.cs +System.CodeDom/CodeAttributeDeclarationCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionTest.cs +System.CodeDom/CodeAttributeDeclarationTest.cs +System.CodeDom/CodeBaseReferenceExpressionCas.cs +System.CodeDom/CodeBinaryOperatorExpressionCas.cs +System.CodeDom/CodeCastExpressionCas.cs +System.CodeDom/CodeCastExpressionTest.cs +System.CodeDom/CodeCatchClauseCas.cs +System.CodeDom/CodeCatchClauseCollectionCas.cs +System.CodeDom/CodeCatchClauseCollectionTest.cs +System.CodeDom/CodeCatchClauseTest.cs +System.CodeDom/CodeChecksumPragmaCas.cs +System.CodeDom/CodeChecksumPragmaTest.cs +System.CodeDom/CodeCommentStatementCas.cs +System.CodeDom/CodeCommentStatementCollectionCas.cs +System.CodeDom/CodeCommentStatementCollectionTest.cs +System.CodeDom/CodeCompileUnitCas.cs +System.CodeDom/CodeConditionStatementCas.cs +System.CodeDom/CodeConstructorCas.cs +System.CodeDom/CodeConstructorTest.cs +System.CodeDom/CodeDefaultValueExpressionCas.cs +System.CodeDom/CodeDefaultValueExpressionTest.cs +System.CodeDom/CodeDelegateCreateExpressionCas.cs +System.CodeDom/CodeDelegateCreateExpressionTest.cs +System.CodeDom/CodeDelegateInvokeExpressionCas.cs +System.CodeDom/CodeDirectionExpressionCas.cs +System.CodeDom/CodeDirectiveCas.cs +System.CodeDom/CodeDirectiveCollectionCas.cs +System.CodeDom/CodeDirectiveCollectionTest.cs +System.CodeDom/CodeEntryPointMethodCas.cs +System.CodeDom/CodeEventReferenceExpressionCas.cs +System.CodeDom/CodeEventReferenceExpressionTest.cs +System.CodeDom/CodeExpressionCas.cs +System.CodeDom/CodeExpressionCollectionCas.cs +System.CodeDom/CodeExpressionCollectionTest.cs +System.CodeDom/CodeExpressionStatementCas.cs +System.CodeDom/CodeFieldReferenceExpressionCas.cs +System.CodeDom/CodeGotoStatementCas.cs +System.CodeDom/CodeGotoStatementTest.cs +System.CodeDom/CodeIndexerExpressionCas.cs +System.CodeDom/CodeIterationStatementCas.cs +System.CodeDom/CodeLabeledStatementTest.cs +System.CodeDom/CodeLinePragmaCas.cs +System.CodeDom/CodeLinePragmaTest.cs +System.CodeDom/CodeMemberEventCas.cs +System.CodeDom/CodeMemberFieldCas.cs +System.CodeDom/CodeMemberFieldTest.cs +System.CodeDom/CodeMemberMethodCas.cs +System.CodeDom/CodeMemberMethodTest.cs +System.CodeDom/CodeMemberPropertyCas.cs +System.CodeDom/CodeMemberPropertyTest.cs +System.CodeDom/CodeMethodInvokeExpressionCas.cs +System.CodeDom/CodeMethodInvokeExpressionTest.cs +System.CodeDom/CodeMethodReferenceExpressionCas.cs +System.CodeDom/CodeMethodReferenceExpressionTest.cs +System.CodeDom/CodeMethodReturnStatementCas.cs +System.CodeDom/CodeNamespaceCas.cs +System.CodeDom/CodeNamespaceCollectionCas.cs +System.CodeDom/CodeNamespaceCollectionTest.cs +System.CodeDom/CodeNamespaceImportCas.cs +System.CodeDom/CodeNamespaceImportCollectionCas.cs +System.CodeDom/CodeNamespaceImportCollectionTest.cs +System.CodeDom/CodeNamespaceImportTest.cs +System.CodeDom/CodeNamespaceTest.cs +System.CodeDom/CodeObjectCas.cs +System.CodeDom/CodeObjectCreateExpressionCas.cs +System.CodeDom/CodeObjectCreateExpressionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionTest.cs +System.CodeDom/CodePrimitiveExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionTest.cs +System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs +System.CodeDom/CodeRegionDirectiveCas.cs +System.CodeDom/CodeRegionDirectiveTest.cs +System.CodeDom/CodeRemoveEventStatementCas.cs +System.CodeDom/CodeRemoveEventStatementTest.cs +System.CodeDom/CodeSnippetCompileUnitCas.cs +System.CodeDom/CodeSnippetCompileUnitTest.cs +System.CodeDom/CodeSnippetExpressionCas.cs +System.CodeDom/CodeSnippetExpressionTest.cs +System.CodeDom/CodeSnippetStatementCas.cs +System.CodeDom/CodeSnippetStatementTest.cs +System.CodeDom/CodeSnippetTypeMemberCas.cs +System.CodeDom/CodeSnippetTypeMemberTest.cs +System.CodeDom/CodeStatementCas.cs +System.CodeDom/CodeStatementCollectionCas.cs +System.CodeDom/CodeStatementCollectionTest.cs +System.CodeDom/CodeThisReferenceExpressionCas.cs +System.CodeDom/CodeThrowExceptionStatementCas.cs +System.CodeDom/CodeTryCatchFinallyStatementCas.cs +System.CodeDom/CodeTypeConstructorCas.cs +System.CodeDom/CodeTypeConstructorTest.cs +System.CodeDom/CodeTypeDeclarationCas.cs +System.CodeDom/CodeTypeDeclarationCollectionCas.cs +System.CodeDom/CodeTypeDeclarationCollectionTest.cs +System.CodeDom/CodeTypeDelegateCas.cs +System.CodeDom/CodeTypeDelegateTest.cs +System.CodeDom/CodeTypeMemberCas.cs +System.CodeDom/CodeTypeMemberCollectionCas.cs +System.CodeDom/CodeTypeMemberCollectionTest.cs +System.CodeDom/CodeTypeOfExpressionCas.cs +System.CodeDom/CodeTypeOfExpressionTest.cs +System.CodeDom/CodeTypeParameterCas.cs +System.CodeDom/CodeTypeParameterCollectionTest.cs +System.CodeDom/CodeTypeParameterTest.cs +System.CodeDom/CodeTypeReferenceCas.cs +System.CodeDom/CodeTypeReferenceCollectionCas.cs +System.CodeDom/CodeTypeReferenceCollectionTest.cs +System.CodeDom/CodeTypeReferenceExpressionCas.cs +System.CodeDom/CodeTypeReferenceExpressionTest.cs +System.CodeDom/CodeTypeReferenceTest.cs +System.CodeDom/CodeVariableDeclarationStatementCas.cs +System.CodeDom/CodeVariableDeclarationStatementTest.cs +System.CodeDom/CodeVariableReferenceExpressionCas.cs +System.CodeDom/CodeVariableReferenceExpressionTest.cs +System.Configuration.Provider/ProviderBaseTest.cs +System.Configuration/ApplicationSettingsBaseTest.cs +System.Configuration/ConfigXmlDocumentTest.cs +System.Configuration/ConfigurationExceptionTest.cs +System.Configuration/LocalFileSettingsProviderTest.cs +System.Configuration/SettingElementTest.cs +System.Configuration/SettingsBaseTest.cs +System.Configuration/SettingsPropertyCollectionTest.cs +System.Configuration/SettingsPropertyTest.cs +System.Configuration/SettingsPropertyValueCollectionTest.cs +System.Configuration/SettingsPropertyValueTest.cs +System.IO.Ports/SerialPortTest.cs +System.Security.Permissions/ResourcePermissionBaseCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryTest.cs +System.Security.Permissions/ResourcePermissionBaseTest.cs +System.Security.Permissions/StorePermissionAttributeCas.cs +System.Security.Permissions/StorePermissionAttributeTest.cs +System.Security.Permissions/StorePermissionCas.cs +System.Security.Permissions/StorePermissionTest.cs +System.Web/AspNetHostingPermissionAttributeCas.cs +System.Web/AspNetHostingPermissionAttributeTest.cs +System.Web/AspNetHostingPermissionCas.cs +System.Web/AspNetHostingPermissionTest.cs diff --git a/mcs/class/System/testing_aot_full_System_test.dll.sources b/mcs/class/System/testing_aot_full_System_test.dll.sources new file mode 100644 index 0000000000..3944a95be6 --- /dev/null +++ b/mcs/class/System/testing_aot_full_System_test.dll.sources @@ -0,0 +1 @@ +#include System_test.dll.sources diff --git a/mcs/class/System/testing_aot_hybrid_System_test.dll.exclude.sources b/mcs/class/System/testing_aot_hybrid_System_test.dll.exclude.sources new file mode 100644 index 0000000000..3df5e78e1a --- /dev/null +++ b/mcs/class/System/testing_aot_hybrid_System_test.dll.exclude.sources @@ -0,0 +1,209 @@ + +Microsoft.CSharp/CSharpCodeProviderCas.cs +Microsoft.CSharp/CSharpCodeProviderTest.cs +Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs +Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs +Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs +Microsoft.CSharp/CodeGeneratorFromStatementTest.cs +Microsoft.CSharp/CodeGeneratorFromTypeTest.cs +Microsoft.CSharp/CodeGeneratorIdentifierTest.cs +Microsoft.CSharp/CodeGeneratorTestBase.cs +Microsoft.CSharp/CodeGeneratorTypeOutputTest.cs +Microsoft.VisualBasic/CodeGeneratorFromBinaryOperatorTest.cs +Microsoft.VisualBasic/CodeGeneratorFromCompileUnitTest.cs +Microsoft.VisualBasic/CodeGeneratorFromExpressionTest.cs +Microsoft.VisualBasic/CodeGeneratorFromNamespaceTest.cs +Microsoft.VisualBasic/CodeGeneratorFromStatementTest.cs +Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs +Microsoft.VisualBasic/CodeGeneratorTestBase.cs +Microsoft.VisualBasic/VBCodeProviderCas.cs +Microsoft.VisualBasic/VBCodeProviderTest.cs +Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs +Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs +Microsoft.Win32/PowerModeChangedEventArgsCas.cs +Microsoft.Win32/SessionEndedEventArgsCas.cs +Microsoft.Win32/SessionEndingEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsTest.cs +Microsoft.Win32/SystemEventsCas.cs +Microsoft.Win32/TimerElapsedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangingEventArgsCas.cs +System.CodeDom.Compiler/CodeCompilerCas.cs +System.CodeDom.Compiler/CodeDomProviderCas.cs +System.CodeDom.Compiler/CodeGeneratorCas.cs +System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs +System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs +System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs +System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs +System.CodeDom.Compiler/CodeGeneratorTest.cs +System.CodeDom.Compiler/CodeGeneratorTestBase.cs +System.CodeDom.Compiler/CodeParserCas.cs +System.CodeDom.Compiler/CompilerErrorCas.cs +System.CodeDom.Compiler/CompilerErrorCollectionCas.cs +System.CodeDom.Compiler/CompilerInfoCas.cs +System.CodeDom.Compiler/CompilerParametersCas.cs +System.CodeDom.Compiler/CompilerResultsCas.cs +System.CodeDom.Compiler/ExecutorCas.cs +System.CodeDom.Compiler/ExecutorTest.cs +System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs +System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs +System.CodeDom.Compiler/IndentedTextWriterCas.cs +System.CodeDom.Compiler/IndentedTextWriterTest.cs +System.CodeDom.Compiler/TempFileCollectionCas.cs +System.CodeDom.Compiler/TempFileCollectionTest.cs +System.CodeDom/CodeArgumentReferenceExpressionCas.cs +System.CodeDom/CodeArgumentReferenceExpressionTest.cs +System.CodeDom/CodeArrayCreateExpressionCas.cs +System.CodeDom/CodeArrayCreateExpressionTest.cs +System.CodeDom/CodeArrayIndexerExpressionCas.cs +System.CodeDom/CodeAssignStatementCas.cs +System.CodeDom/CodeAttachEventStatementCas.cs +System.CodeDom/CodeAttachEventStatementTest.cs +System.CodeDom/CodeAttributeArgumentCas.cs +System.CodeDom/CodeAttributeArgumentCollectionCas.cs +System.CodeDom/CodeAttributeArgumentCollectionTest.cs +System.CodeDom/CodeAttributeArgumentTest.cs +System.CodeDom/CodeAttributeDeclarationCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionTest.cs +System.CodeDom/CodeAttributeDeclarationTest.cs +System.CodeDom/CodeBaseReferenceExpressionCas.cs +System.CodeDom/CodeBinaryOperatorExpressionCas.cs +System.CodeDom/CodeCastExpressionCas.cs +System.CodeDom/CodeCastExpressionTest.cs +System.CodeDom/CodeCatchClauseCas.cs +System.CodeDom/CodeCatchClauseCollectionCas.cs +System.CodeDom/CodeCatchClauseCollectionTest.cs +System.CodeDom/CodeCatchClauseTest.cs +System.CodeDom/CodeChecksumPragmaCas.cs +System.CodeDom/CodeChecksumPragmaTest.cs +System.CodeDom/CodeCommentStatementCas.cs +System.CodeDom/CodeCommentStatementCollectionCas.cs +System.CodeDom/CodeCommentStatementCollectionTest.cs +System.CodeDom/CodeCompileUnitCas.cs +System.CodeDom/CodeConditionStatementCas.cs +System.CodeDom/CodeConstructorCas.cs +System.CodeDom/CodeConstructorTest.cs +System.CodeDom/CodeDefaultValueExpressionCas.cs +System.CodeDom/CodeDefaultValueExpressionTest.cs +System.CodeDom/CodeDelegateCreateExpressionCas.cs +System.CodeDom/CodeDelegateCreateExpressionTest.cs +System.CodeDom/CodeDelegateInvokeExpressionCas.cs +System.CodeDom/CodeDirectionExpressionCas.cs +System.CodeDom/CodeDirectiveCas.cs +System.CodeDom/CodeDirectiveCollectionCas.cs +System.CodeDom/CodeDirectiveCollectionTest.cs +System.CodeDom/CodeEntryPointMethodCas.cs +System.CodeDom/CodeEventReferenceExpressionCas.cs +System.CodeDom/CodeEventReferenceExpressionTest.cs +System.CodeDom/CodeExpressionCas.cs +System.CodeDom/CodeExpressionCollectionCas.cs +System.CodeDom/CodeExpressionCollectionTest.cs +System.CodeDom/CodeExpressionStatementCas.cs +System.CodeDom/CodeFieldReferenceExpressionCas.cs +System.CodeDom/CodeGotoStatementCas.cs +System.CodeDom/CodeGotoStatementTest.cs +System.CodeDom/CodeIndexerExpressionCas.cs +System.CodeDom/CodeIterationStatementCas.cs +System.CodeDom/CodeLabeledStatementTest.cs +System.CodeDom/CodeLinePragmaCas.cs +System.CodeDom/CodeLinePragmaTest.cs +System.CodeDom/CodeMemberEventCas.cs +System.CodeDom/CodeMemberFieldCas.cs +System.CodeDom/CodeMemberFieldTest.cs +System.CodeDom/CodeMemberMethodCas.cs +System.CodeDom/CodeMemberMethodTest.cs +System.CodeDom/CodeMemberPropertyCas.cs +System.CodeDom/CodeMemberPropertyTest.cs +System.CodeDom/CodeMethodInvokeExpressionCas.cs +System.CodeDom/CodeMethodInvokeExpressionTest.cs +System.CodeDom/CodeMethodReferenceExpressionCas.cs +System.CodeDom/CodeMethodReferenceExpressionTest.cs +System.CodeDom/CodeMethodReturnStatementCas.cs +System.CodeDom/CodeNamespaceCas.cs +System.CodeDom/CodeNamespaceCollectionCas.cs +System.CodeDom/CodeNamespaceCollectionTest.cs +System.CodeDom/CodeNamespaceImportCas.cs +System.CodeDom/CodeNamespaceImportCollectionCas.cs +System.CodeDom/CodeNamespaceImportCollectionTest.cs +System.CodeDom/CodeNamespaceImportTest.cs +System.CodeDom/CodeNamespaceTest.cs +System.CodeDom/CodeObjectCas.cs +System.CodeDom/CodeObjectCreateExpressionCas.cs +System.CodeDom/CodeObjectCreateExpressionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionTest.cs +System.CodeDom/CodePrimitiveExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionTest.cs +System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs +System.CodeDom/CodeRegionDirectiveCas.cs +System.CodeDom/CodeRegionDirectiveTest.cs +System.CodeDom/CodeRemoveEventStatementCas.cs +System.CodeDom/CodeRemoveEventStatementTest.cs +System.CodeDom/CodeSnippetCompileUnitCas.cs +System.CodeDom/CodeSnippetCompileUnitTest.cs +System.CodeDom/CodeSnippetExpressionCas.cs +System.CodeDom/CodeSnippetExpressionTest.cs +System.CodeDom/CodeSnippetStatementCas.cs +System.CodeDom/CodeSnippetStatementTest.cs +System.CodeDom/CodeSnippetTypeMemberCas.cs +System.CodeDom/CodeSnippetTypeMemberTest.cs +System.CodeDom/CodeStatementCas.cs +System.CodeDom/CodeStatementCollectionCas.cs +System.CodeDom/CodeStatementCollectionTest.cs +System.CodeDom/CodeThisReferenceExpressionCas.cs +System.CodeDom/CodeThrowExceptionStatementCas.cs +System.CodeDom/CodeTryCatchFinallyStatementCas.cs +System.CodeDom/CodeTypeConstructorCas.cs +System.CodeDom/CodeTypeConstructorTest.cs +System.CodeDom/CodeTypeDeclarationCas.cs +System.CodeDom/CodeTypeDeclarationCollectionCas.cs +System.CodeDom/CodeTypeDeclarationCollectionTest.cs +System.CodeDom/CodeTypeDelegateCas.cs +System.CodeDom/CodeTypeDelegateTest.cs +System.CodeDom/CodeTypeMemberCas.cs +System.CodeDom/CodeTypeMemberCollectionCas.cs +System.CodeDom/CodeTypeMemberCollectionTest.cs +System.CodeDom/CodeTypeOfExpressionCas.cs +System.CodeDom/CodeTypeOfExpressionTest.cs +System.CodeDom/CodeTypeParameterCas.cs +System.CodeDom/CodeTypeParameterCollectionTest.cs +System.CodeDom/CodeTypeParameterTest.cs +System.CodeDom/CodeTypeReferenceCas.cs +System.CodeDom/CodeTypeReferenceCollectionCas.cs +System.CodeDom/CodeTypeReferenceCollectionTest.cs +System.CodeDom/CodeTypeReferenceExpressionCas.cs +System.CodeDom/CodeTypeReferenceExpressionTest.cs +System.CodeDom/CodeTypeReferenceTest.cs +System.CodeDom/CodeVariableDeclarationStatementCas.cs +System.CodeDom/CodeVariableDeclarationStatementTest.cs +System.CodeDom/CodeVariableReferenceExpressionCas.cs +System.CodeDom/CodeVariableReferenceExpressionTest.cs +System.Configuration.Provider/ProviderBaseTest.cs +System.Configuration/ApplicationSettingsBaseTest.cs +System.Configuration/ConfigXmlDocumentTest.cs +System.Configuration/ConfigurationExceptionTest.cs +System.Configuration/LocalFileSettingsProviderTest.cs +System.Configuration/SettingElementTest.cs +System.Configuration/SettingsBaseTest.cs +System.Configuration/SettingsPropertyCollectionTest.cs +System.Configuration/SettingsPropertyTest.cs +System.Configuration/SettingsPropertyValueCollectionTest.cs +System.Configuration/SettingsPropertyValueTest.cs +System.IO.Ports/SerialPortTest.cs +System.Security.Permissions/ResourcePermissionBaseCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryTest.cs +System.Security.Permissions/ResourcePermissionBaseTest.cs +System.Security.Permissions/StorePermissionAttributeCas.cs +System.Security.Permissions/StorePermissionAttributeTest.cs +System.Security.Permissions/StorePermissionCas.cs +System.Security.Permissions/StorePermissionTest.cs +System.Web/AspNetHostingPermissionAttributeCas.cs +System.Web/AspNetHostingPermissionAttributeTest.cs +System.Web/AspNetHostingPermissionCas.cs +System.Web/AspNetHostingPermissionTest.cs diff --git a/mcs/class/System/unix_net_4_x_System.dll.sources b/mcs/class/System/unix_net_4_x_System.dll.sources new file mode 100644 index 0000000000..75bd68eeea --- /dev/null +++ b/mcs/class/System/unix_net_4_x_System.dll.sources @@ -0,0 +1,17 @@ +#include corefx.unix.sources +#include net_4_x_System.dll.sources + +../../../external/corefx/src/Common/src/Interop/Linux/Interop.Libraries.cs +../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs +../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/SafeDirectoryHandle.Unix.cs +../../../external/corefx/src/Common/src/Interop/Linux/System.Native/Interop.INotify.cs +../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.OpenFlags.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.ReadDir.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.FLock.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Stat.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Poll.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Open.cs +../../../external/corefx/src/Common/src/Interop/Unix/System.Native/Interop.Close.cs +../../../external/corefx/src/Common/src/System/Net/ContextAwareResult.Unix.cs +Internal.Cryptography/OidLookup.Managed.cs diff --git a/mcs/class/System/unix_networkinfo.sources b/mcs/class/System/unix_networkinfo.sources new file mode 100644 index 0000000000..e57369b4fb --- /dev/null +++ b/mcs/class/System/unix_networkinfo.sources @@ -0,0 +1,10 @@ +System.Net.NetworkInformation/UnixIcmpV4Statistics.cs +System.Net.NetworkInformation/UnixIcmpV6Statistics.cs +System.Net.NetworkInformation/UnixIPGlobalProperties.cs +System.Net.NetworkInformation/UnixIPGlobalStatistics.cs +System.Net.NetworkInformation/UnixIPInterfaceProperties.cs +System.Net.NetworkInformation/UnixIPv4InterfaceProperties.cs +System.Net.NetworkInformation/UnixNetworkInterface.cs +System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs +System.Net.NetworkInformation/UnixTcpStatistics.cs +System.Net.NetworkInformation/UnixUdpStatistics.cs diff --git a/mcs/class/System/wasm_System_test.dll.exclude.sources b/mcs/class/System/wasm_System_test.dll.exclude.sources new file mode 100644 index 0000000000..7263b4896b --- /dev/null +++ b/mcs/class/System/wasm_System_test.dll.exclude.sources @@ -0,0 +1 @@ +#include monotouch_System_test.dll.exclude.sources diff --git a/mcs/class/System/win32_net_4_x_System.dll.exclude.sources b/mcs/class/System/win32_net_4_x_System.dll.exclude.sources new file mode 100644 index 0000000000..122210b4ff --- /dev/null +++ b/mcs/class/System/win32_net_4_x_System.dll.exclude.sources @@ -0,0 +1,3 @@ +#include unix_networkinfo.sources +#include linux_networkinfo.sources +#include macos_networkinfo.sources diff --git a/mcs/class/System/win32_net_4_x_System.dll.sources b/mcs/class/System/win32_net_4_x_System.dll.sources index c0b68e4bff..75ee3d5009 100644 --- a/mcs/class/System/win32_net_4_x_System.dll.sources +++ b/mcs/class/System/win32_net_4_x_System.dll.sources @@ -1,5 +1,7 @@ #include net_4_x_System.dll.sources +System.Net.NetworkInformation/Win32UnixFactoryPal.cs + ../../../external/corefx/src/Common/src/Interop/Windows/Interop.Libraries.cs ../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.CreateFile.cs ../../../external/corefx/src/Common/src/Interop/Windows/kernel32/Interop.FileOperations.cs @@ -10,3 +12,5 @@ ../../../external/corefx/src/Common/src/System/IO/PathInternal.Windows.cs ../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs ../../../external/corefx/src/Common/src/System/Net/ContextAwareResult.Windows.cs +../../../external/corefx/src/Common/src/Interop/Windows/Crypt32/Interop.FindOidInfo.cs +../../../external/corefx/src/System.Security.Cryptography.Encoding/src/Internal/Cryptography/OidLookup.Windows.cs diff --git a/mcs/class/System/win32_networkinfo.sources b/mcs/class/System/win32_networkinfo.sources new file mode 100644 index 0000000000..adbd4ab856 --- /dev/null +++ b/mcs/class/System/win32_networkinfo.sources @@ -0,0 +1,15 @@ +System.Net.NetworkInformation/Win32IcmpV4Statistics.cs +System.Net.NetworkInformation/Win32IcmpV6Statistics.cs +System.Net.NetworkInformation/Win32IPGlobalProperties.cs +System.Net.NetworkInformation/Win32IPGlobalStatistics.cs +System.Net.NetworkInformation/Win32IPAddressCollection.cs +System.Net.NetworkInformation/Win32IPInterfaceProperties.cs +System.Net.NetworkInformation/Win32IPv4InterfaceProperties.cs +System.Net.NetworkInformation/Win32IPv4InterfaceStatistics.cs +System.Net.NetworkInformation/Win32IPv6InterfaceProperties.cs +System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs +System.Net.NetworkInformation/Win32NetworkInterface.cs +System.Net.NetworkInformation/Win32NetworkInterfaceFactory.cs +System.Net.NetworkInformation/Win32TcpStatistics.cs +System.Net.NetworkInformation/Win32UdpStatistics.cs +System.Net.NetworkInformation/Win32UnicastIPAddressInformation.cs diff --git a/mcs/class/System/winaot_System.dll.exclude.sources b/mcs/class/System/winaot_System.dll.exclude.sources new file mode 100644 index 0000000000..122210b4ff --- /dev/null +++ b/mcs/class/System/winaot_System.dll.exclude.sources @@ -0,0 +1,3 @@ +#include unix_networkinfo.sources +#include linux_networkinfo.sources +#include macos_networkinfo.sources diff --git a/mcs/class/System/winaot_System.dll.sources b/mcs/class/System/winaot_System.dll.sources index 70a77a6dbf..68fd46dc73 100644 --- a/mcs/class/System/winaot_System.dll.sources +++ b/mcs/class/System/winaot_System.dll.sources @@ -1 +1,3 @@ #include mobile_System.dll.sources + +System.Net.NetworkInformation/Win32UnixFactoryPal.cs diff --git a/mcs/class/System/winaot_System_test.dll.exclude.sources b/mcs/class/System/winaot_System_test.dll.exclude.sources new file mode 100755 index 0000000000..9e038968d9 --- /dev/null +++ b/mcs/class/System/winaot_System_test.dll.exclude.sources @@ -0,0 +1 @@ +#include testing_aot_full_System_test.dll.exclude.sources diff --git a/mcs/class/System/xammac_System.dll.sources b/mcs/class/System/xammac_System.dll.sources index 95b9dd9a46..6838ae6202 100644 --- a/mcs/class/System/xammac_System.dll.sources +++ b/mcs/class/System/xammac_System.dll.sources @@ -1,5 +1,11 @@ #include mobile_System.dll.sources +#include appletls.sources + +Mono.AppleTls/MonoCertificatePal.Mobile.cs +Mono.AppleTls/SafeHandles.cs + ../../../external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompiler.cs ../../../external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/CompiledRegexRunner.cs ../../../external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/CompiledRegexRunnerFactory.cs ../../../external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexLWCGCompiler.cs + diff --git a/mcs/class/System/xammac_net_4_5_System.dll.sources b/mcs/class/System/xammac_net_4_5_System.dll.sources index 502ec37dff..dc24b49a5d 100644 --- a/mcs/class/System/xammac_net_4_5_System.dll.sources +++ b/mcs/class/System/xammac_net_4_5_System.dll.sources @@ -1 +1 @@ -#include darwin_net_4_x_System.dll.sources +#include macos_net_4_x_System.dll.sources diff --git a/mcs/class/corlib/Assembly/AssemblyInfo.cs b/mcs/class/corlib/Assembly/AssemblyInfo.cs index 6e1e9ef126..b6f4410851 100644 --- a/mcs/class/corlib/Assembly/AssemblyInfo.cs +++ b/mcs/class/corlib/Assembly/AssemblyInfo.cs @@ -75,6 +75,8 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("System, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)] [assembly: InternalsVisibleTo ("System.Core, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)] +[assembly: InternalsVisibleTo ("System.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] + [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000")] @@ -84,7 +86,6 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("Xamarin.TVOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] #elif MONOTOUCH_WATCH [assembly: InternalsVisibleTo ("Xamarin.WatchOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -[assembly: InternalsVisibleTo ("System.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] #else [assembly: InternalsVisibleTo ("monotouch, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] [assembly: InternalsVisibleTo ("Xamarin.iOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] diff --git a/mcs/class/corlib/CommonCrypto/CommonCrypto.cs b/mcs/class/corlib/CommonCrypto/CommonCrypto.cs index c765b95735..f80b67571a 100644 --- a/mcs/class/corlib/CommonCrypto/CommonCrypto.cs +++ b/mcs/class/corlib/CommonCrypto/CommonCrypto.cs @@ -101,13 +101,22 @@ namespace Crimson.CommonCrypto { // size_t was changed to IntPtr for 32/64 bits size difference - even if mono is (moslty) used in 32bits only on OSX today [DllImport ("/System/Library/Frameworks/Security.framework/Security")] - extern internal static /* int */ int SecRandomCopyBytes (/* SecRandomRef */ IntPtr rnd, /* size_t */ IntPtr count, /* uint8_t* */ byte[] bytes); + unsafe extern internal static /* int */ int SecRandomCopyBytes (/* SecRandomRef */ IntPtr rnd, /* size_t */ IntPtr count, /* uint8_t* */ byte *data); - static internal void GetRandom (byte[] buffer) + unsafe static internal void GetRandom (byte[] buffer) { - if (SecRandomCopyBytes (IntPtr.Zero, (IntPtr) buffer.Length, buffer) != 0) + fixed (byte* fixed_bytes = buffer) { + if (SecRandomCopyBytes (IntPtr.Zero, (IntPtr)buffer.Length, fixed_bytes) != 0) + throw new CryptographicException (Marshal.GetLastWin32Error ()); // errno + } + } + + static internal unsafe void GetRandom (byte* data, IntPtr data_length) + { + if (SecRandomCopyBytes (IntPtr.Zero, data_length, data) != 0) throw new CryptographicException (Marshal.GetLastWin32Error ()); // errno } + } #if !MONOTOUCH && !XAMMAC diff --git a/mcs/class/corlib/CommonCrypto/RNGCryptoServiceProvider.cryptor.cs b/mcs/class/corlib/CommonCrypto/RNGCryptoServiceProvider.cryptor.cs index 8500840887..cf9d557185 100644 --- a/mcs/class/corlib/CommonCrypto/RNGCryptoServiceProvider.cryptor.cs +++ b/mcs/class/corlib/CommonCrypto/RNGCryptoServiceProvider.cryptor.cs @@ -64,6 +64,11 @@ namespace System.Security.Cryptography { Cryptor.GetRandom (data); } + + unsafe internal void GetBytes (byte* data, IntPtr data_length) + { + Cryptor.GetRandom (data, data_length); + } public override void GetNonZeroBytes (byte[] data) { diff --git a/mcs/class/corlib/LinkerDescriptor/mscorlib.xml b/mcs/class/corlib/LinkerDescriptor/mscorlib.xml index 07528ca07e..e0001bee05 100644 --- a/mcs/class/corlib/LinkerDescriptor/mscorlib.xml +++ b/mcs/class/corlib/LinkerDescriptor/mscorlib.xml @@ -355,8 +355,6 @@ - - diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile index c719456956..c1748da231 100644 --- a/mcs/class/corlib/Makefile +++ b/mcs/class/corlib/Makefile @@ -26,26 +26,47 @@ ifeq ($(PROFILE),build) CSC_RUNTIME_FLAGS=--profile=aot:output=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/csc.$(LIBRARY).aotprofile endif +RESX_EXTRA_ARGUMENTS = \ + --in=ReferenceSources/SR.cs \ + --in=ReferenceSources/SR2.cs + RESX_RESOURCE_STRING = \ - ../../../external/corert/src/System.Private.CoreLib/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.Collections.Concurrent/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.Memory/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.Threading.Tasks.Parallel/src/Resources/Strings.resx \ ../../../external/corefx/src/System.Collections/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Collections.Concurrent/src/Resources/Strings.resx \ ../../../external/corefx/src/System.Collections.NonGeneric/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.Runtime.Extensions/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.ObjectModel/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.ComponentModel.TypeConverter/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Buffers/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.IO.FileSystem.Watcher/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.IO.Ports/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Memory/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Net.Requests/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Net.Http/src/Resources/Strings.resx \ ../../../external/corefx/src/System.Numerics.Vectors/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.Runtime.Numerics/src/Resources/Strings.resx + ../../../external/corefx/src/System.Runtime.Extensions/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Runtime.Numerics/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Security.Cryptography.Encoding/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Security.Cryptography.ProtectedData/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Security.Cryptography.X509Certificates/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Text.RegularExpressions/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Threading.Tasks.Parallel/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.ObjectModel/src/Resources/Strings.resx \ + ../../../external/corert/src/System.Private.CoreLib/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Private.Uri/src/Resources/Strings.resx + LIBRARY_COMPILE = $(BOOT_COMPILE) LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION) -ifneq ($(PROFILE),basic) -RESOURCE_STRINGS = ../referencesource/mscorlib/mscorlib.txt include il/il.make +RESOURCE_STRINGS_FILES = --mscorlib-debug + +ifneq ($(PROFILE),basic) +RESOURCE_STRINGS = ../referencesource/mscorlib/mscorlib.txt MODULE_DEPS = $(IL_REPLACE) endif diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeOptions.cs b/mcs/class/corlib/Mono/CertificateImportFlags.cs similarity index 81% rename from mcs/class/System.Core/System.IO.Pipes/PipeOptions.cs rename to mcs/class/corlib/Mono/CertificateImportFlags.cs index 13c06e18e5..020297fe19 100644 --- a/mcs/class/System.Core/System.IO.Pipes/PipeOptions.cs +++ b/mcs/class/corlib/Mono/CertificateImportFlags.cs @@ -1,10 +1,10 @@ // -// PipeAccessRights.cs +// CertificateImportFlags.cs // -// Authors: -// Marek Safar +// Author: +// Martin Baulig // -// Copyright 2011 Xamarin Inc (http://www.xamarin.com). +// Copyright (c) 2016 Xamarin, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -23,16 +23,15 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -// -// +using System; -namespace System.IO.Pipes +namespace Mono { [Flags] - public enum PipeOptions + enum CertificateImportFlags { None = 0, - WriteThrough = int.MinValue, - Asynchronous = 1 << 30 + DisableNativeBackend = 1, + DisableAutomaticFallback = 2 } } diff --git a/mcs/class/corlib/Mono/DependencyInjector.cs b/mcs/class/corlib/Mono/DependencyInjector.cs new file mode 100644 index 0000000000..61e502e918 --- /dev/null +++ b/mcs/class/corlib/Mono/DependencyInjector.cs @@ -0,0 +1,90 @@ +// +// DependencyInjector.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2018 Xamarin, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +#if !(MONOTOUCH || MONODROID) +using System.Reflection; +#endif + +namespace Mono +{ + static class DependencyInjector + { + /* + * Allows us to use code from `System.dll` in `mscorlib.dll`. + * + */ + internal static ISystemDependencyProvider SystemProvider { + get { + if (systemDependency != null) + return systemDependency; + + lock (locker) { + if (systemDependency != null) + return systemDependency; + + // Not using `MOBILE` as a conditional here because we want to use this on full-aot. +#if !(MONOTOUCH || MONODROID) + // On Mobile, we initializes this during system startup. + systemDependency = ReflectionLoad (); +#endif + if (systemDependency == null) + throw new PlatformNotSupportedException ("Cannot get `ISystemDependencyProvider`."); + + return systemDependency; + } + } + } + + internal static void Register (ISystemDependencyProvider provider) + { + lock (locker) { + if (systemDependency != null && systemDependency != provider) + throw new InvalidOperationException (); + systemDependency = provider; + } + } + +#if !(MONOTOUCH || MONODROID) + const string TypeName = "Mono.SystemDependencyProvider, " + Consts.AssemblySystem; + + static ISystemDependencyProvider ReflectionLoad () + { + var type = Type.GetType (TypeName); + if (type == null) + return null; + + var prop = type.GetProperty ("Instance", BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public); + if (prop == null) + return null; + + return (ISystemDependencyProvider)prop.GetValue (null); + } +#endif + + static object locker = new object (); + static ISystemDependencyProvider systemDependency; + } +} diff --git a/mcs/class/corlib/Mono/ISystemCertificateProvider.cs b/mcs/class/corlib/Mono/ISystemCertificateProvider.cs new file mode 100644 index 0000000000..857689c39a --- /dev/null +++ b/mcs/class/corlib/Mono/ISystemCertificateProvider.cs @@ -0,0 +1,43 @@ +// +// ISystemCertificateProvider.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2016 Xamarin, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.Security.Cryptography.X509Certificates; +using Microsoft.Win32.SafeHandles; + +namespace Mono +{ + interface ISystemCertificateProvider + { + X509CertificateImpl Import (byte[] data, + CertificateImportFlags importFlags = CertificateImportFlags.None); + + X509CertificateImpl Import (byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags, + CertificateImportFlags importFlags = CertificateImportFlags.None); + + X509CertificateImpl Import (X509Certificate cert, + CertificateImportFlags importFlags = CertificateImportFlags.None); + } +} diff --git a/mcs/class/corlib/Mono/ISystemDependencyProvider.cs b/mcs/class/corlib/Mono/ISystemDependencyProvider.cs new file mode 100644 index 0000000000..cc7a0eded6 --- /dev/null +++ b/mcs/class/corlib/Mono/ISystemDependencyProvider.cs @@ -0,0 +1,34 @@ +// +// ISystemDependencyProvider.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2018 Xamarin, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +namespace Mono +{ + interface ISystemDependencyProvider + { + ISystemCertificateProvider CertificateProvider { + get; + } + } +} diff --git a/mcs/class/corlib/ReferenceSources/ParseNumbers.cs b/mcs/class/corlib/ReferenceSources/ParseNumbers.cs deleted file mode 100644 index 9ab569e933..0000000000 --- a/mcs/class/corlib/ReferenceSources/ParseNumbers.cs +++ /dev/null @@ -1,426 +0,0 @@ -// -// ParseNumbers.cs -// -// Authors: -// Marek Safar -// -// Copyright (C) 2015 Xamarin Inc (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Globalization; -using System.Text; - -namespace System { - - static class ParseNumbers - { - internal const int PrintAsI1=0x40; - internal const int PrintAsI2=0x80; -// internal const int PrintAsI4=0x100; - internal const int TreatAsUnsigned=0x200; - internal const int TreatAsI1=0x400; - internal const int TreatAsI2=0x800; - internal const int IsTight=0x1000; - internal const int NoSpace=0x2000; - - public static int StringToInt (string value, int fromBase, int flags) - { - unsafe { - return StringToInt (value, fromBase, flags, null); - } - } - - public unsafe static int StringToInt (string value, int fromBase, int flags, int* parsePos) - { - if ((flags & (IsTight | NoSpace)) == 0) - throw new NotImplementedException (flags.ToString ()); - - if (value == null) - return 0; - - int chars = 0; - uint result = 0; - int digitValue; - - int len = value.Length; - bool negative = false; - - if (len == 0) { - // Mimic broken .net behaviour - throw new ArgumentOutOfRangeException ("Empty string"); - } - - int i = parsePos == null ? 0 : *parsePos; - - //Check for a sign - if (value [i] == '-') { - if (fromBase != 10) - throw new ArgumentException ("String cannot contain a minus sign if the base is not 10."); - - if ((flags & TreatAsUnsigned) != 0) - throw new OverflowException ("Negative number"); - - negative = true; - i++; - } else if (value [i] == '+') { - i++; - } - - if (fromBase == 16 && i + 1 < len && value [i] =='0' && (value [i + 1] == 'x' || value [i + 1] == 'X')) { - i += 2; - } - - uint max_value; - if ((flags & TreatAsI1) != 0) { - max_value = Byte.MaxValue; - } else if ((flags & TreatAsI2) != 0) { - max_value = UInt16.MaxValue; - } else { - max_value = UInt32.MaxValue; - } - - while (i < len) { - char c = value [i]; - if (Char.IsNumber (c)) { - digitValue = c - '0'; - } else if (Char.IsLetter (c)) { - digitValue = Char.ToLowerInvariant (c) - 'a' + 10; - } else { - if (i == 0) - throw new FormatException ("Could not find any parsable digits."); - - if ((flags & IsTight) != 0) - throw new FormatException ("Additional unparsable characters are at the end of the string."); - - break; - } - - if (digitValue >= fromBase) { - if (chars > 0) { - throw new FormatException ("Additional unparsable characters are at the end of the string."); - } - - throw new FormatException ("Could not find any parsable digits."); - } - - long res = fromBase * result + digitValue; - if (res > max_value) - throw new OverflowException (); - - result = (uint)res; - chars++; - ++i; - } - - if (chars == 0) - throw new FormatException ("Could not find any parsable digits."); - - if (parsePos != null) - *parsePos = i; - - return negative ? -(int)result : (int)result; - } - - public static string LongToString (long value, int toBase, int width, char paddingChar, int flags) - { - if (value == 0) - return "0"; - if (toBase == 10) - return value.ToString (); - - byte[] val = BitConverter.GetBytes (value); - - switch (toBase) { - case 2: - return ConvertToBase2 (val).ToString (); - case 8: - return ConvertToBase8 (val).ToString (); - case 16: - return ConvertToBase16 (val).ToString (); - default: - throw new NotImplementedException (); - } - } - - public static long StringToLong (string value, int fromBase, int flags) - { - unsafe { - return StringToLong (value, fromBase, flags, null); - } - } - - // Value from which a new base 16 digit can cause an overflow. - const ulong base16MaxOverflowFreeValue = ulong.MaxValue / (16 * 16); - - // From ulong we can only cast to positive long. - // As |long.MinValue| > |long.MaxValue| we need to do this to avoid an overflow. - const ulong longMinValue = ((ulong) long.MaxValue) + (ulong) -(long.MinValue + long.MaxValue); - - public unsafe static long StringToLong (string value, int fromBase, int flags, int* parsePos) - { - if ((flags & (IsTight | NoSpace)) == 0) - throw new NotImplementedException (flags.ToString ()); - - if (value == null) - return 0; - - int chars = 0; - ulong fromBaseULong = (ulong) fromBase; - ulong digitValue = 0; - ulong result = 0; - - int len = value.Length; - bool negative = false; - bool treatAsUnsigned = (flags & ParseNumbers.TreatAsUnsigned) != 0; - - if (len == 0) { - // Mimic broken .net behaviour - throw new ArgumentOutOfRangeException ("Empty string"); - } - - int i = parsePos == null ? 0 : *parsePos; - - //Check for a sign - if (value [i] == '-') { - if (fromBase != 10) - throw new ArgumentException ("String cannot contain a minus sign if the base is not 10."); - - if (treatAsUnsigned) - throw new OverflowException ("Negative number"); - - negative = true; - i++; - } else if (value [i] == '+') { - i++; - } - - if (fromBase == 16 && i + 1 < len && value [i] =='0' && (value [i + 1] == 'x' || value [i + 1] == 'X')) { - i += 2; - } - - while (i < len) { - char c = value[i]; - if (Char.IsNumber (c)) { - digitValue = (ulong) (c - '0'); - } else if (Char.IsLetter (c)) { - digitValue = (ulong) (Char.ToLowerInvariant (c) - 'a' + 10); - } else { - if (i == 0) - throw new FormatException ("Could not find any parsable digits."); - - if ((flags & IsTight) != 0) - throw new FormatException ("Additional unparsable characters are at the end of the string."); - - break; - } - - if (digitValue >= fromBaseULong) { - if (chars > 0) { - throw new FormatException ("Additional unparsable " - + "characters are at the end of the string."); - } else { - throw new FormatException ("Could not find any parsable" - + " digits."); - } - } - - if (result <= base16MaxOverflowFreeValue) { - result = result * (ulong) fromBaseULong + digitValue; - } else { - // decompose 64 bit operation into 32 bit operations so we can check for overflows - ulong a = (result >> 32) * fromBaseULong; - ulong b = (result & uint.MaxValue) * fromBaseULong + digitValue; - if (((b >> 32) + a) > uint.MaxValue) - throw new OverflowException (); - - result = (a << 32) + b; - } - - chars++; - ++i; - } - - if (chars == 0) - throw new FormatException ("Could not find any parsable digits."); - - if (parsePos != null) - *parsePos = i; - - if (treatAsUnsigned) - return (long) result; - - if (!negative) { - if (fromBase == 10 && result > ((ulong) long.MaxValue)) - throw new OverflowException (); - - return (long)result; - } - - if (result <= (ulong) long.MaxValue) - return -((long) result); - - if (result > longMinValue) - throw new OverflowException (); - - // Avoids overflow of -result when result > long.MaxValue - return long.MinValue + (long) (longMinValue - result); - } - - public static string IntToString (int value, int toBase, int width, char paddingChar, int flags) - { - StringBuilder sb; - - if (value == 0) { - if (width <= 0) - return "0"; - - sb = new StringBuilder ("0", width); - } else if (toBase == 10) - sb = new StringBuilder (value.ToString ()); - else { - byte[] val; - if ((flags & PrintAsI1) != 0) { - val = BitConverter.GetBytes ((byte) value); - } else if ((flags & PrintAsI2) != 0) { - val = BitConverter.GetBytes ((short) value); - } else { - val = BitConverter.GetBytes (value); - } - - switch (toBase) { - case 2: - sb = ConvertToBase2 (val); - break; - case 8: - sb = ConvertToBase8 (val); - break; - case 16: - sb = ConvertToBase16 (val); - break; - default: - throw new NotImplementedException (); - } - } - - var padding = width - sb.Length; - while (padding > 0) { - sb.Insert (0, paddingChar); - --padding; - } - - return sb.ToString (); - } - - static void EndianSwap (ref byte[] value) - { - byte[] buf = new byte[value.Length]; - for (int i = 0; i < value.Length; i++) - buf[i] = value[value.Length-1-i]; - value = buf; - } - - static StringBuilder ConvertToBase2 (byte[] value) - { - if (!BitConverter.IsLittleEndian) - EndianSwap (ref value); - StringBuilder sb = new StringBuilder (); - for (int i = value.Length - 1; i >= 0; i--) { - byte b = value [i]; - for (int j = 0; j < 8; j++) { - if ((b & 0x80) == 0x80) { - sb.Append ('1'); - } - else { - if (sb.Length > 0) - sb.Append ('0'); - } - b <<= 1; - } - } - return sb; - } - - static StringBuilder ConvertToBase8 (byte[] value) - { - ulong l = 0; - switch (value.Length) { - case 1: - l = (ulong) value [0]; - break; - case 2: - l = (ulong) BitConverter.ToUInt16 (value, 0); - break; - case 4: - l = (ulong) BitConverter.ToUInt32 (value, 0); - break; - case 8: - l = BitConverter.ToUInt64 (value, 0); - break; - default: - throw new ArgumentException ("value"); - } - - StringBuilder sb = new StringBuilder (); - for (int i = 21; i >= 0; i--) { - // 3 bits at the time - char val = (char) ((l >> i * 3) & 0x7); - if ((val != 0) || (sb.Length > 0)) { - val += '0'; - sb.Append (val); - } - } - return sb; - } - - static StringBuilder ConvertToBase16 (byte[] value) - { - if (!BitConverter.IsLittleEndian) - EndianSwap (ref value); - StringBuilder sb = new StringBuilder (); - for (int i = value.Length - 1; i >= 0; i--) { - char high = (char)((value[i] >> 4) & 0x0f); - if ((high != 0) || (sb.Length > 0)) { - if (high < 10) - high += '0'; - else { - high -= (char) 10; - high += 'a'; - } - sb.Append (high); - } - - char low = (char)(value[i] & 0x0f); - if ((low != 0) || (sb.Length > 0)) { - if (low < 10) - low += '0'; - else { - low -= (char) 10; - low += 'a'; - } - sb.Append (low); - } - } - return sb; - } - - } -} diff --git a/mcs/class/corlib/ReferenceSources/SR.cs.REMOVED.git-id b/mcs/class/corlib/ReferenceSources/SR.cs.REMOVED.git-id new file mode 100644 index 0000000000..7a630e2812 --- /dev/null +++ b/mcs/class/corlib/ReferenceSources/SR.cs.REMOVED.git-id @@ -0,0 +1 @@ +ef52a767836e65a2d95397f2ff17fa3ca5124ea8 \ No newline at end of file diff --git a/mcs/class/System/ReferenceSources/SR2.cs b/mcs/class/corlib/ReferenceSources/SR2.cs similarity index 100% rename from mcs/class/System/ReferenceSources/SR2.cs rename to mcs/class/corlib/ReferenceSources/SR2.cs diff --git a/mcs/class/corlib/ReferenceSources/String.cs b/mcs/class/corlib/ReferenceSources/String.cs index f194b7c0f8..628fa968ff 100644 --- a/mcs/class/corlib/ReferenceSources/String.cs +++ b/mcs/class/corlib/ReferenceSources/String.cs @@ -46,7 +46,7 @@ using System.Globalization; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; -using System.Diagnostics.Private; +using System.Diagnostics; namespace System { @@ -59,6 +59,8 @@ namespace System public static readonly String Empty; + public int Length => _stringLength; + internal unsafe int IndexOfUnchecked (string value, int startIndex, int count) { int valueLen = value.Length; diff --git a/mcs/class/System.Core/System.Security.Cryptography/ECPoint.cs b/mcs/class/corlib/System.Diagnostics/Debug.cs similarity index 53% rename from mcs/class/System.Core/System.Security.Cryptography/ECPoint.cs rename to mcs/class/corlib/System.Diagnostics/Debug.cs index f0ab84b9b1..b3b4e1293b 100644 --- a/mcs/class/System.Core/System.Security.Cryptography/ECPoint.cs +++ b/mcs/class/corlib/System.Diagnostics/Debug.cs @@ -1,10 +1,10 @@ // -// ECPoint.cs +// Debug.cs: Private corlib debug implememtation. // // Authors: // Marek Safar // -// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// Copyright (C) 2018 Microsoft Corporation // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -26,12 +26,42 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -namespace System.Security.Cryptography +namespace System.Diagnostics { - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public struct ECPoint + // + // The type is renamed to DebugInternal in the post processing to avoid conficts in IVT assemblies. The proper + // solution is to have support for IVT for members + // + static class Debug { - public byte[] X; - public byte[] Y; + [ConditionalAttribute ("DEBUG")] + public static void Assert (bool condition) + { + } + + [ConditionalAttribute ("DEBUG")] + public static void Assert (bool condition, string message) + { + } + + [ConditionalAttribute ("DEBUG")] + public static void Assert (bool condition, string message, string detailMessage) + { + } + + [ConditionalAttribute ("DEBUG")] + public static void Assert (bool condition, string message, string detailMessageFormat, params object[] args) + { + } + + [ConditionalAttribute ("DEBUG")] + public static void Fail (string message) + { + } + + [ConditionalAttribute ("DEBUG")] + public static void Fail (string message, string detailMessage) + { + } } } diff --git a/mcs/class/corlib/System.IO/DriveInfo.cs b/mcs/class/corlib/System.IO/DriveInfo.cs index 6c4c7eee87..b71e5d0038 100644 --- a/mcs/class/corlib/System.IO/DriveInfo.cs +++ b/mcs/class/corlib/System.IO/DriveInfo.cs @@ -140,10 +140,9 @@ namespace System.IO { } } - [MonoTODO("It always returns true")] public bool IsReady { get { - return true; + return Directory.Exists (Name); } } diff --git a/mcs/class/corlib/System.IO/FileAttributes.cs b/mcs/class/corlib/System.IO/FileAttributes.cs deleted file mode 100644 index 4fb16ea096..0000000000 --- a/mcs/class/corlib/System.IO/FileAttributes.cs +++ /dev/null @@ -1,66 +0,0 @@ -//------------------------------------------------------------------------------ -// -// System.IO.FileAttributes.cs -// -// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved -// -// Author: Jim Richardson, develop@wtfo-guru.com -// Created: Monday, August 13, 2001 -// -//------------------------------------------------------------------------------ - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Runtime.InteropServices; - -namespace System.IO -{ - [Flags] - [Serializable] - [ComVisible (true)] - public enum FileAttributes - { - Archive = 0x00020, - Compressed = 0x00800, - Device = 0x00040, // Reserved for future use (NOT the w32 value). - Directory = 0x00010, - Encrypted = 0x04000, // NOT the w32 value - Hidden = 0x00002, - Normal = 0x00080, - NotContentIndexed = 0x02000, - Offline = 0x01000, - ReadOnly = 0x00001, - ReparsePoint = 0x00400, - SparseFile = 0x00200, - System = 0x00004, - Temporary = 0x00100, - IntegrityStream = 0x8000, - NoScrubData = 0x20000, - // - // This flag is used internall by Mono to make it Executable - // - // Executable = 0x80000000 - } - -} diff --git a/mcs/class/corlib/System.Reflection/CustomAttributeData.cs b/mcs/class/corlib/System.Reflection/CustomAttributeData.cs index d884714401..e29530927a 100644 --- a/mcs/class/corlib/System.Reflection/CustomAttributeData.cs +++ b/mcs/class/corlib/System.Reflection/CustomAttributeData.cs @@ -64,6 +64,18 @@ namespace System.Reflection { this.lazyData.data_length = data_length; } + internal CustomAttributeData (ConstructorInfo ctorInfo) + : this (ctorInfo, Array.Empty (), Array.Empty ()) + { + } + + internal CustomAttributeData (ConstructorInfo ctorInfo, IList ctorArgs, IList namedArgs) + { + this.ctorInfo = ctorInfo; + this.ctorArgs = ctorArgs; + this.namedArgs = namedArgs; + } + [MethodImplAttribute (MethodImplOptions.InternalCall)] static extern void ResolveArgumentsInternal (ConstructorInfo ctor, Assembly assembly, IntPtr data, uint data_length, out object[] ctorArgs, out object[] namedArgs); diff --git a/mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs b/mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs deleted file mode 100644 index fcd29e1fee..0000000000 --- a/mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// System.Reflection.CustomAttributeFormatException.cs -// -// Author: Duncan Mak (duncan@ximian.com) -// -// (C) 2001 Ximian, Inc. http://www.ximian.com -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Globalization; -using System.Runtime.Serialization; -using System.Runtime.InteropServices; - -namespace System.Reflection -{ - [ComVisible (true)] - [Serializable] - public class CustomAttributeFormatException : FormatException - { - // Constructors - public CustomAttributeFormatException () - : base (Locale.GetText ("The Binary format of the custom attribute is invalid.")) - { - } - public CustomAttributeFormatException (string message) - : base (message) - { - } - - public CustomAttributeFormatException (string message, Exception inner) - : base (message, inner) - { - } - - protected CustomAttributeFormatException (SerializationInfo info, - StreamingContext context) - { - } - } -} - diff --git a/mcs/class/corlib/System.Reflection/FieldInfo.cs b/mcs/class/corlib/System.Reflection/FieldInfo.cs index 47021a3ffe..7c806b78f8 100644 --- a/mcs/class/corlib/System.Reflection/FieldInfo.cs +++ b/mcs/class/corlib/System.Reflection/FieldInfo.cs @@ -27,6 +27,7 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Runtime.CompilerServices; @@ -222,6 +223,46 @@ namespace System.Reflection { return attrs; } + internal CustomAttributeData[] GetPseudoCustomAttributesData () + { + int count = 0; + + if (IsNotSerialized) + count++; + + if (DeclaringType.IsExplicitLayout) + count++; + + MarshalAsAttribute marshalAs = get_marshal_info (); + if (marshalAs != null) + count++; + + if (count == 0) + return null; + CustomAttributeData[] attrsData = new CustomAttributeData [count]; + count = 0; + + if (IsNotSerialized) + attrsData [count++] = new CustomAttributeData ((typeof (NonSerializedAttribute)).GetConstructor (Type.EmptyTypes)); + if (DeclaringType.IsExplicitLayout) { + var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (int), GetFieldOffset ()) }; + attrsData [count++] = new CustomAttributeData ( + (typeof (FieldOffsetAttribute)).GetConstructor (new[] { typeof (int) }), + ctorArgs, + EmptyArray.Value); + } + + if (marshalAs != null) { + var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (UnmanagedType), marshalAs.Value) }; + attrsData [count++] = new CustomAttributeData ( + (typeof (MarshalAsAttribute)).GetConstructor (new[] { typeof (UnmanagedType) }), + ctorArgs, + EmptyArray.Value);//FIXME Get named params + } + + return attrsData; + } + [MethodImplAttribute (MethodImplOptions.InternalCall)] extern Type[] GetTypeModifiers (bool optional); diff --git a/mcs/class/corlib/System.Reflection/MonoMethod.cs b/mcs/class/corlib/System.Reflection/MonoMethod.cs index ce428e82e3..e3e22863f6 100644 --- a/mcs/class/corlib/System.Reflection/MonoMethod.cs +++ b/mcs/class/corlib/System.Reflection/MonoMethod.cs @@ -427,6 +427,37 @@ namespace System.Reflection { return attrs; } + internal CustomAttributeData[] GetPseudoCustomAttributesData () + { + int count = 0; + + /* MS.NET doesn't report MethodImplAttribute */ + + MonoMethodInfo info = MonoMethodInfo.GetMethodInfo (mhandle); + if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0) + count++; + if ((info.attrs & MethodAttributes.PinvokeImpl) != 0) + count++; + + if (count == 0) + return null; + CustomAttributeData[] attrsData = new CustomAttributeData [count]; + count = 0; + + if ((info.iattrs & MethodImplAttributes.PreserveSig) != 0) + attrsData [count++] = new CustomAttributeData ((typeof (PreserveSigAttribute)).GetConstructor (Type.EmptyTypes)); + if ((info.attrs & MethodAttributes.PinvokeImpl) != 0) { + this.GetPInvoke (out PInvokeAttributes flags, out string entryPoint, out string dllName); + var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument(typeof(string), dllName) }; + attrsData [count++] = new CustomAttributeData ( + (typeof (FieldOffsetAttribute)).GetConstructor (new[] { typeof (string) }), + ctorArgs, + EmptyArray.Value); //FIXME Get named params + } + + return attrsData; + } + public override MethodInfo MakeGenericMethod (Type [] methodInstantiation) { if (methodInstantiation == null) diff --git a/mcs/class/corlib/System.Reflection/ParameterInfo.cs b/mcs/class/corlib/System.Reflection/ParameterInfo.cs index aabc0c0d06..24674d04bb 100644 --- a/mcs/class/corlib/System.Reflection/ParameterInfo.cs +++ b/mcs/class/corlib/System.Reflection/ParameterInfo.cs @@ -1,4 +1,4 @@ -// System.Reflection.ParameterInfo +// System.Reflection.ParameterInfo // // Authors: // Sean MacIsaac (macisaac@ximian.com) @@ -175,6 +175,41 @@ namespace System.Reflection return attrs; } + internal CustomAttributeData[] GetPseudoCustomAttributesData () + { + int count = 0; + + if (IsIn) + count++; + if (IsOut) + count++; + if (IsOptional) + count++; + if (marshalAs != null) + count++; + + if (count == 0) + return null; + CustomAttributeData[] attrsData = new CustomAttributeData [count]; + count = 0; + + if (IsIn) + attrsData [count++] = new CustomAttributeData ((typeof (InAttribute)).GetConstructor (Type.EmptyTypes)); + if (IsOptional) + attrsData [count++] = new CustomAttributeData ((typeof (OptionalAttribute)).GetConstructor (Type.EmptyTypes)); + if (IsOut) + attrsData [count++] = new CustomAttributeData ((typeof (OutAttribute)).GetConstructor (Type.EmptyTypes)); + if (marshalAs != null) { + var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (UnmanagedType), marshalAs.Value) }; + attrsData [count++] = new CustomAttributeData ( + (typeof (MarshalAsAttribute)).GetConstructor (new[] { typeof( UnmanagedType) }), + ctorArgs, + EmptyArray.Value);//FIXME Get named params + } + + return attrsData; + } + [MethodImplAttribute (MethodImplOptions.InternalCall)] internal extern Type[] GetTypeModifiers (bool optional); diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs b/mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs index aa37ecc424..3d7f47a4c4 100644 --- a/mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs +++ b/mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs @@ -227,7 +227,6 @@ namespace System.Runtime.CompilerServices if (k == key) { data [idx].key = GC.EPHEMERON_TOMBSTONE; data [idx].value = null; - --size; return true; } if (k == null) @@ -327,7 +326,7 @@ namespace System.Runtime.CompilerServices { for (int i = 0; i < data.Length; i++) { - data[i].key = GC.EPHEMERON_TOMBSTONE; + data[i].key = null; data[i].value = null; } @@ -415,6 +414,9 @@ namespace System.Runtime.CompilerServices public Enumerator(ConditionalWeakTable table) { + Debug.Assert(table != null, "Must provide a valid table"); + Debug.Assert(Monitor.IsEntered(table._lock), "Must hold the _lock lock to construct the enumerator"); + // Store a reference to the parent table and increase its active enumerator count. _table = table; _currentIndex = -1; diff --git a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs index abbe07a747..7eb79408ed 100644 --- a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs +++ b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs @@ -110,92 +110,176 @@ namespace System.Runtime.InteropServices throw new NotImplementedException (); } - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal extern static void copy_to_unmanaged (Array source, int startIndex, - IntPtr destination, int length); + unsafe internal static void copy_to_unmanaged (Array source, int startIndex, + IntPtr destination, int length) + { + copy_to_unmanaged_fixed (source, startIndex, destination, length, null); + } [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal extern static void copy_from_unmanaged (IntPtr source, int startIndex, - Array destination, int length); + unsafe private extern static void copy_to_unmanaged_fixed (Array source, int startIndex, + IntPtr destination, int length, void* fixed_source_element); - public static void Copy (byte[] source, int startIndex, IntPtr destination, int length) + static private bool skip_fixed (System.Array array, int startIndex) { - copy_to_unmanaged (source, startIndex, destination, length); + // In particular, we see length == 0 && startIndex == array.Length, and fixed fails. + return startIndex < 0 || startIndex >= array.Length; } - public static void Copy (char[] source, int startIndex, IntPtr destination, int length) + unsafe internal static void copy_to_unmanaged (byte[] source, int startIndex, IntPtr destination, int length) { - copy_to_unmanaged (source, startIndex, destination, length); + // This function is inconsistent with its surroundings. + if (skip_fixed (source, startIndex)) + copy_to_unmanaged_fixed (source, startIndex, destination, length, null); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (short[] source, int startIndex, IntPtr destination, int length) + unsafe internal static void copy_to_unmanaged (char[] source, int startIndex, + IntPtr destination, int length) { - copy_to_unmanaged (source, startIndex, destination, length); + // This function is inconsistent with its surroundings. + if (skip_fixed (source, startIndex)) + copy_to_unmanaged_fixed (source, startIndex, destination, length, null); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (int[] source, int startIndex, IntPtr destination, int length) + public unsafe static void Copy (byte[] source, int startIndex, IntPtr destination, int length) { - copy_to_unmanaged (source, startIndex, destination, length); + if (skip_fixed (source, startIndex)) + copy_to_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (long[] source, int startIndex, IntPtr destination, int length) + public unsafe static void Copy (char[] source, int startIndex, IntPtr destination, int length) { - copy_to_unmanaged (source, startIndex, destination, length); + if (skip_fixed (source, startIndex)) + copy_to_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (float[] source, int startIndex, IntPtr destination, int length) + public unsafe static void Copy (short[] source, int startIndex, IntPtr destination, int length) { - copy_to_unmanaged (source, startIndex, destination, length); + if (skip_fixed (source, startIndex)) + copy_to_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (double[] source, int startIndex, IntPtr destination, int length) + public unsafe static void Copy (int[] source, int startIndex, IntPtr destination, int length) { - copy_to_unmanaged (source, startIndex, destination, length); + if (skip_fixed (source, startIndex)) + copy_to_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (IntPtr[] source, int startIndex, IntPtr destination, int length) + public unsafe static void Copy (long[] source, int startIndex, IntPtr destination, int length) { - copy_to_unmanaged (source, startIndex, destination, length); + if (skip_fixed (source, startIndex)) + copy_to_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (IntPtr source, byte[] destination, int startIndex, int length) + public unsafe static void Copy (float[] source, int startIndex, IntPtr destination, int length) { - copy_from_unmanaged (source, startIndex, destination, length); + if (skip_fixed (source, startIndex)) + copy_to_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (IntPtr source, char[] destination, int startIndex, int length) + public unsafe static void Copy (double[] source, int startIndex, IntPtr destination, int length) { - copy_from_unmanaged (source, startIndex, destination, length); + if (skip_fixed (source, startIndex)) + copy_to_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (IntPtr source, short[] destination, int startIndex, int length) + public unsafe static void Copy (IntPtr[] source, int startIndex, IntPtr destination, int length) { - copy_from_unmanaged (source, startIndex, destination, length); + if (skip_fixed (source, startIndex)) + copy_to_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_source = &source [startIndex]) + copy_to_unmanaged_fixed (source, startIndex, destination, length, fixed_source); } - public static void Copy (IntPtr source, int[] destination, int startIndex, int length) + unsafe internal static void copy_from_unmanaged (IntPtr source, int startIndex, Array destination, int length) { - copy_from_unmanaged (source, startIndex, destination, length); + copy_from_unmanaged_fixed (source, startIndex, destination, length, null); } - public static void Copy (IntPtr source, long[] destination, int startIndex, int length) + [MethodImplAttribute(MethodImplOptions.InternalCall)] + unsafe private extern static void copy_from_unmanaged_fixed (IntPtr source, int startIndex, + Array destination, int length, void* fixed_destination_element); + + public unsafe static void Copy (IntPtr source, byte[] destination, int startIndex, int length) { - copy_from_unmanaged (source, startIndex, destination, length); + if (skip_fixed (destination, startIndex)) + copy_from_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_destination = &destination [startIndex]) + copy_from_unmanaged_fixed (source, startIndex, destination, length, fixed_destination); } - public static void Copy (IntPtr source, float[] destination, int startIndex, int length) + public unsafe static void Copy (IntPtr source, char[] destination, int startIndex, int length) { - copy_from_unmanaged (source, startIndex, destination, length); + if (skip_fixed (destination, startIndex)) + copy_from_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_destination = &destination [startIndex]) + copy_from_unmanaged_fixed (source, startIndex, destination, length, fixed_destination); } - public static void Copy (IntPtr source, double[] destination, int startIndex, int length) + public unsafe static void Copy (IntPtr source, short[] destination, int startIndex, int length) { - copy_from_unmanaged (source, startIndex, destination, length); + if (skip_fixed (destination, startIndex)) + copy_from_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_destination = &destination [startIndex]) + copy_from_unmanaged_fixed (source, startIndex, destination, length, fixed_destination); } - public static void Copy (IntPtr source, IntPtr[] destination, int startIndex, int length) + public unsafe static void Copy (IntPtr source, int[] destination, int startIndex, int length) { - copy_from_unmanaged (source, startIndex, destination, length); + if (skip_fixed (destination, startIndex)) + copy_from_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_destination = &destination [startIndex]) + copy_from_unmanaged_fixed (source, startIndex, destination, length, fixed_destination); + } + + public unsafe static void Copy (IntPtr source, long[] destination, int startIndex, int length) + { + if (skip_fixed (destination, startIndex)) + copy_from_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_destination = &destination [startIndex]) + copy_from_unmanaged_fixed (source, startIndex, destination, length, fixed_destination); + } + + public unsafe static void Copy (IntPtr source, float[] destination, int startIndex, int length) + { + if (skip_fixed (destination, startIndex)) + copy_from_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_destination = &destination [startIndex]) + copy_from_unmanaged_fixed (source, startIndex, destination, length, fixed_destination); + } + + public unsafe static void Copy (IntPtr source, double[] destination, int startIndex, int length) + { + if (skip_fixed (destination, startIndex)) + copy_from_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_destination = &destination [startIndex]) + copy_from_unmanaged_fixed (source, startIndex, destination, length, fixed_destination); + } + + public unsafe static void Copy (IntPtr source, IntPtr[] destination, int startIndex, int length) + { + if (skip_fixed (destination, startIndex)) + copy_from_unmanaged (source, startIndex, destination, length); + else fixed (void* fixed_destination = &destination [startIndex]) + copy_from_unmanaged_fixed (source, startIndex, destination, length, fixed_destination); } public static IntPtr CreateAggregatedObject (IntPtr pOuter, @@ -1070,8 +1154,13 @@ namespace System.Runtime.InteropServices return (size + 3) & (~((uint)3)); } - [MethodImplAttribute(MethodImplOptions.InternalCall)] - public extern static IntPtr StringToBSTR (string s); + public unsafe static IntPtr StringToBSTR (string s) + { + if (s == null) + return IntPtr.Zero; + fixed (char* fixed_s = s) + return BufferToBSTR (fixed_s, s.Length); + } public static IntPtr StringToCoTaskMemAnsi (string s) { @@ -1098,7 +1187,13 @@ namespace System.Runtime.InteropServices } [MethodImplAttribute(MethodImplOptions.InternalCall)] - public extern static IntPtr StringToHGlobalAnsi (string s); + unsafe extern static IntPtr StringToHGlobalAnsi (char* s, int length); + + public unsafe static IntPtr StringToHGlobalAnsi (string s) + { + fixed (char* fixed_s = s) + return StringToHGlobalAnsi (fixed_s, (s != null) ? s.Length : 0); + } unsafe public static IntPtr StringToAllocatedMemoryUTF8(String s) { @@ -1134,9 +1229,15 @@ namespace System.Runtime.InteropServices } [MethodImplAttribute(MethodImplOptions.InternalCall)] - public extern static IntPtr StringToHGlobalUni (string s); + unsafe extern static IntPtr StringToHGlobalUni (char* s, int length); - public static IntPtr SecureStringToBSTR (SecureString s) + public unsafe static IntPtr StringToHGlobalUni (string s) + { + fixed (char* fixed_s = s) + return StringToHGlobalUni (fixed_s, (s != null) ? s.Length : 0); + } + + public unsafe static IntPtr SecureStringToBSTR (SecureString s) { if (s == null) throw new ArgumentNullException ("s"); @@ -1153,8 +1254,9 @@ namespace System.Runtime.InteropServices buffer[i + 1] = b; } } - return BufferToBSTR (buffer, len); - } + fixed (byte* fixed_buffer = buffer) + return BufferToBSTR ((char*)fixed_buffer, len); + } public static IntPtr SecureStringToCoTaskMemAnsi (SecureString s) { @@ -1243,7 +1345,7 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern static IntPtr BufferToBSTR (Array ptr, int slen); + extern unsafe static IntPtr BufferToBSTR (char* ptr, int slen); [MethodImplAttribute(MethodImplOptions.InternalCall)] public extern static IntPtr UnsafeAddrOfPinnedArrayElement (Array arr, int index); diff --git a/mcs/class/corlib/System.Runtime.InteropServices/RegistrationConnectionType.cs b/mcs/class/corlib/System.Runtime.InteropServices/RegistrationConnectionType.cs deleted file mode 100644 index 3c5b42500c..0000000000 --- a/mcs/class/corlib/System.Runtime.InteropServices/RegistrationConnectionType.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -// System.Runtime.InteropServices.RegistrationConnectionType -// -// Author: -// Kazuki Oikawa (kazuki@panicode.com) -// - -using System; - -namespace System.Runtime.InteropServices -{ - [Flags] - public enum RegistrationConnectionType - { - MultipleUse = 1, - MultiSeparate = 2, - SingleUse = 0, - Suspended = 4, - Surrogate = 8 - } -} diff --git a/mcs/class/corlib/System.Runtime.InteropServices/SafeBuffer.cs b/mcs/class/corlib/System.Runtime.InteropServices/SafeBuffer.cs index 0039497624..bc93defd5f 100644 --- a/mcs/class/corlib/System.Runtime.InteropServices/SafeBuffer.cs +++ b/mcs/class/corlib/System.Runtime.InteropServices/SafeBuffer.cs @@ -155,10 +155,9 @@ namespace System.Runtime.InteropServices int size = Marshal.SizeOf (typeof (T)) * count; if (target >= last_byte || target + size > last_byte) throw new ArgumentException ("would overrite"); - + Marshal.copy_to_unmanaged (array, index, (IntPtr) target, count); } } } } - diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs index 1e768ca5d4..d434167b58 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs @@ -28,100 +28,655 @@ // using System.IO; +using System.Globalization; using System.Runtime.InteropServices; +using System.Runtime.Serialization; using System.Security.Permissions; +using System.Diagnostics; using System.Text; +using Internal.Cryptography; +using Microsoft.Win32.SafeHandles; using Mono.Security; -using Mono.Security.X509; - -using System.Runtime.Serialization; using Mono.Security.Authenticode; -namespace System.Security.Cryptography.X509Certificates { - +namespace System.Security.Cryptography.X509Certificates +{ // References: // a. Internet X.509 Public Key Infrastructure Certificate and CRL Profile // http://www.ietf.org/rfc/rfc3280.txt - + // LAMESPEC: the MSDN docs always talks about X509v3 certificates // and/or Authenticode certs. However this class works with older // X509v1 certificates and non-authenticode (code signing) certs. [Serializable] -#if MOBILE - public partial class X509Certificate { -#else - public partial class X509Certificate : IDeserializationCallback, ISerializable { -#endif + public partial class X509Certificate : IDisposable, IDeserializationCallback, ISerializable + { +#region CoreFX Implementation + X509CertificateImpl impl; + volatile byte[] lazyCertHash; + volatile byte[] lazySerialNumber; + volatile string lazyIssuer; + volatile string lazySubject; + volatile string lazyKeyAlgorithm; + volatile byte[] lazyKeyAlgorithmParameters; + volatile byte[] lazyPublicKey; + DateTime lazyNotBefore = DateTime.MinValue; + DateTime lazyNotAfter = DateTime.MinValue; - private bool hideDates; - - // static methods - - public static X509Certificate CreateFromCertFile (string filename) + public virtual void Reset () { - byte[] data = File.ReadAllBytes (filename); - return new X509Certificate (data); + if (impl != null) { + impl.Dispose (); + impl = null; + } + + lazyCertHash = null; + lazyIssuer = null; + lazySubject = null; + lazySerialNumber = null; + lazyKeyAlgorithm = null; + lazyKeyAlgorithmParameters = null; + lazyPublicKey = null; + lazyNotBefore = DateTime.MinValue; + lazyNotAfter = DateTime.MinValue; } - [MonoTODO ("Incomplete - minimal validation in this version")] - public static X509Certificate CreateFromSignedFile (string filename) - { - try { - AuthenticodeDeformatter a = new AuthenticodeDeformatter (filename); - if (a.SigningCertificate != null) { - return new X509Certificate (a.SigningCertificate.RawData); - } - } - catch (SecurityException) { - // don't wrap SecurityException into a COMException - throw; - } - catch (Exception e) { - string msg = Locale.GetText ("Couldn't extract digital signature from {0}.", filename); - throw new COMException (msg, e); - } - throw new CryptographicException (Locale.GetText ("{0} isn't signed.", filename)); - } +#endregion - // constructors - - // special constructor for Publisher (and related classes). - // Dates strings are null - internal X509Certificate (byte[] data, bool dates) - { - if (data != null) { - Import (data, (string)null, X509KeyStorageFlags.DefaultKeySet); - hideDates = !dates; - } - } - - public X509Certificate (byte[] data) : this (data, true) +#region CoreFX Implementation - with X509Helper + + public X509Certificate () { } - public X509Certificate (IntPtr handle) + public X509Certificate (byte[] data) { - if (handle == IntPtr.Zero) - throw new ArgumentException ("Invalid handle."); + if (data != null && data.Length != 0) + impl = X509Helper.Import (data); + } - impl = X509Helper.InitFromHandle (handle); + public X509Certificate (byte[] rawData, string password) + : this (rawData, password, X509KeyStorageFlags.DefaultKeySet) + { + } + + [CLSCompliantAttribute (false)] + public X509Certificate (byte[] rawData, SecureString password) + : this (rawData, password, X509KeyStorageFlags.DefaultKeySet) + { + } + + public X509Certificate (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags) + { + if (rawData == null || rawData.Length == 0) + throw new ArgumentException (SR.Arg_EmptyOrNullArray, nameof (rawData)); + + ValidateKeyStorageFlags (keyStorageFlags); + + using (var safePasswordHandle = new SafePasswordHandle (password)) + impl = X509Helper.Import (rawData, safePasswordHandle, keyStorageFlags); + } + + [CLSCompliantAttribute (false)] + public X509Certificate (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags) + { + if (rawData == null || rawData.Length == 0) + throw new ArgumentException (SR.Arg_EmptyOrNullArray, nameof (rawData)); + + ValidateKeyStorageFlags (keyStorageFlags); + + using (var safePasswordHandle = new SafePasswordHandle (password)) + impl = X509Helper.Import (rawData, safePasswordHandle, keyStorageFlags); + } + + public X509Certificate (IntPtr handle) + { + throw new PlatformNotSupportedException ("Initializing `X509Certificate` from native handle is not supported."); } internal X509Certificate (X509CertificateImpl impl) { + Debug.Assert (impl != null); this.impl = X509Helper.InitFromCertificate (impl); } - public X509Certificate (X509Certificate cert) + public X509Certificate (string fileName) + : this (fileName, (string)null, X509KeyStorageFlags.DefaultKeySet) + { + } + + public X509Certificate (string fileName, string password) + : this (fileName, password, X509KeyStorageFlags.DefaultKeySet) + { + } + + [CLSCompliantAttribute(false)] + public X509Certificate (string fileName, SecureString password) + : this (fileName, password, X509KeyStorageFlags.DefaultKeySet) + { + } + + public X509Certificate (string fileName, string password, X509KeyStorageFlags keyStorageFlags) + { + if (fileName == null) + throw new ArgumentNullException (nameof (fileName)); + + ValidateKeyStorageFlags (keyStorageFlags); + + var rawData = File.ReadAllBytes (fileName); + using (var safePasswordHandle = new SafePasswordHandle (password)) + impl = X509Helper.Import (rawData, safePasswordHandle, keyStorageFlags); + } + + [CLSCompliantAttribute (false)] + public X509Certificate (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags) : this () + { + if (fileName == null) + throw new ArgumentNullException (nameof (fileName)); + + ValidateKeyStorageFlags (keyStorageFlags); + + var rawData = File.ReadAllBytes (fileName); + using (var safePasswordHandle = new SafePasswordHandle (password)) + impl = X509Helper.Import (rawData, safePasswordHandle, keyStorageFlags); + } + + public X509Certificate (X509Certificate cert) { if (cert == null) - throw new ArgumentNullException ("cert"); + throw new ArgumentNullException (nameof (cert)); impl = X509Helper.InitFromCertificate (cert); } +#endregion + +#region CoreFX Implementation + + [System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Usage", "CA2229", Justification = "Public API has already shipped.")] + public X509Certificate (SerializationInfo info, StreamingContext context) : this () + { + byte[] raw = (byte[]) info.GetValue ("RawData", typeof (byte[])); + Import (raw, (string)null, X509KeyStorageFlags.DefaultKeySet); + } + + public static X509Certificate CreateFromCertFile (string filename) + { + return new X509Certificate (filename); + } + + public static X509Certificate CreateFromSignedFile (string filename) + { + return new X509Certificate (filename); + } + + void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context) + { + if (!X509Helper.IsValid (impl)) + throw new NullReferenceException (); + // will throw a NRE if info is null (just like MS implementation) + info.AddValue ("RawData", impl.RawData); + } + + void IDeserializationCallback.OnDeserialization (object sender) + { + } + + public IntPtr Handle { + get { + if (X509Helper.IsValid (impl)) + return impl.Handle; + return IntPtr.Zero; + } + } + + public string Issuer { + get { + ThrowIfInvalid (); + + string issuer = lazyIssuer; + if (issuer == null) + issuer = lazyIssuer = Impl.Issuer; + return issuer; + } + } + + public string Subject { + get { + ThrowIfInvalid (); + + string subject = lazySubject; + if (subject == null) + subject = lazySubject = Impl.Subject; + return subject; + } + } + + public void Dispose () + { + Dispose (true); + } + + protected virtual void Dispose (bool disposing) + { + if (disposing) + Reset (); + } + + public override bool Equals (object obj) + { + X509Certificate other = obj as X509Certificate; + if (other == null) + return false; + return Equals (other); + } + + public virtual bool Equals (X509Certificate other) + { + if (other == null) + return false; + + if (Impl == null) + return other.Impl == null; + + if (!Issuer.Equals (other.Issuer)) + return false; + + byte[] thisSerialNumber = GetRawSerialNumber (); + byte[] otherSerialNumber = other.GetRawSerialNumber (); + + if (thisSerialNumber.Length != otherSerialNumber.Length) + return false; + for (int i = 0; i < thisSerialNumber.Length; i++) { + if (thisSerialNumber[i] != otherSerialNumber[i]) + return false; + } + + return true; + } + +#endregion + +#region CoreFX Implementation - With X509Helper + + public virtual byte[] Export (X509ContentType contentType) + { + return Export (contentType, (string)null); + } + + public virtual byte[] Export (X509ContentType contentType, string password) + { + VerifyContentType (contentType); + + if (Impl == null) + throw new CryptographicException (ErrorCode.E_POINTER); // Not the greatest error, but needed for backward compat. + + using (var safePasswordHandle = new SafePasswordHandle (password)) + return Impl.Export (contentType, safePasswordHandle); + } + + [System.CLSCompliantAttribute (false)] + public virtual byte[] Export (X509ContentType contentType, SecureString password) + { + VerifyContentType (contentType); + + if (Impl == null) + throw new CryptographicException (ErrorCode.E_POINTER); // Not the greatest error, but needed for backward compat. + + using (var safePasswordHandle = new SafePasswordHandle (password)) + return Impl.Export (contentType, safePasswordHandle); + } + +#endregion + +#region CoreFX Implementation + + public virtual string GetRawCertDataString () + { + ThrowIfInvalid (); + return GetRawCertData ().ToHexStringUpper (); + } + + public virtual byte[] GetCertHash () + { + ThrowIfInvalid (); + return GetRawCertHash ().CloneByteArray (); + } + + public virtual byte[] GetCertHash (HashAlgorithmName hashAlgorithm) + { + throw new PlatformNotSupportedException (); + } + + public virtual bool TryGetCertHash (HashAlgorithmName hashAlgorithm, Span destination, out int bytesWritten) + { + throw new PlatformNotSupportedException (); + } + + public virtual string GetCertHashString () + { + ThrowIfInvalid (); + return GetRawCertHash ().ToHexStringUpper (); + } + + public virtual string GetCertHashString (HashAlgorithmName hashAlgorithm) + { + ThrowIfInvalid (); + + return GetCertHash (hashAlgorithm).ToHexStringUpper (); + } + + // Only use for internal purposes when the returned byte[] will not be mutated + byte[] GetRawCertHash () + { + return lazyCertHash ?? (lazyCertHash = Impl.Thumbprint); + } + + public virtual string GetEffectiveDateString () + { + return GetNotBefore ().ToString (); + } + + public virtual string GetExpirationDateString () + { + return GetNotAfter ().ToString (); + } + + public virtual string GetFormat () + { + return "X509"; + } + + public virtual string GetPublicKeyString () + { + return GetPublicKey ().ToHexStringUpper (); + } + + public virtual byte[] GetRawCertData () + { + ThrowIfInvalid (); + + return Impl.RawData.CloneByteArray (); + } + + public override int GetHashCode () + { + if (Impl == null) + return 0; + + byte[] thumbPrint = GetRawCertHash (); + int value = 0; + for (int i = 0; i < thumbPrint.Length && i < 4; ++i) { + value = value << 8 | thumbPrint[i]; + } + return value; + } + + public virtual string GetKeyAlgorithm () + { + ThrowIfInvalid (); + + string keyAlgorithm = lazyKeyAlgorithm; + if (keyAlgorithm == null) + keyAlgorithm = lazyKeyAlgorithm = Impl.KeyAlgorithm; + return keyAlgorithm; + } + + public virtual byte[] GetKeyAlgorithmParameters () + { + ThrowIfInvalid (); + + byte[] keyAlgorithmParameters = lazyKeyAlgorithmParameters; + if (keyAlgorithmParameters == null) + keyAlgorithmParameters = lazyKeyAlgorithmParameters = Impl.KeyAlgorithmParameters; + return keyAlgorithmParameters.CloneByteArray (); + } + + public virtual string GetKeyAlgorithmParametersString () + { + ThrowIfInvalid (); + + byte[] keyAlgorithmParameters = GetKeyAlgorithmParameters (); + return keyAlgorithmParameters.ToHexStringUpper (); + } + + public virtual byte[] GetPublicKey () + { + ThrowIfInvalid (); + + byte[] publicKey = lazyPublicKey; + if (publicKey == null) + publicKey = lazyPublicKey = Impl.PublicKeyValue; + return publicKey.CloneByteArray (); + } + + public virtual byte[] GetSerialNumber () + { + ThrowIfInvalid (); + byte[] serialNumber = GetRawSerialNumber ().CloneByteArray (); + // PAL always returns big-endian, GetSerialNumber returns little-endian + Array.Reverse (serialNumber); + return serialNumber; + } + + public virtual string GetSerialNumberString () + { + ThrowIfInvalid (); + // PAL always returns big-endian, GetSerialNumberString returns big-endian too + return GetRawSerialNumber ().ToHexStringUpper (); + } + + // Only use for internal purposes when the returned byte[] will not be mutated + byte[] GetRawSerialNumber () + { + return lazySerialNumber ?? (lazySerialNumber = Impl.SerialNumber); + } + + // See https://github.com/dotnet/corefx/issues/30544 + [Obsolete ("This method has been deprecated. Please use the Subject property instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public virtual string GetName () + { + ThrowIfInvalid (); + return Impl.LegacySubject; + } + + // See https://github.com/dotnet/corefx/issues/30544 + [Obsolete ("This method has been deprecated. Please use the Issuer property instead. http://go.microsoft.com/fwlink/?linkid=14202")] + public virtual string GetIssuerName () + { + ThrowIfInvalid (); + return Impl.LegacyIssuer; + } + + public override string ToString () + { + return ToString (fVerbose: false); + } + + public virtual string ToString (bool fVerbose) + { + if (!fVerbose || !X509Helper.IsValid (impl)) + return base.ToString (); + + StringBuilder sb = new StringBuilder (); + + // Subject + sb.AppendLine ("[Subject]"); + sb.Append (" "); + sb.AppendLine (Subject); + + // Issuer + sb.AppendLine (); + sb.AppendLine ("[Issuer]"); + sb.Append (" "); + sb.AppendLine (Issuer); + + // Serial Number + sb.AppendLine (); + sb.AppendLine ("[Serial Number]"); + sb.Append (" "); + byte[] serialNumber = GetSerialNumber (); + Array.Reverse (serialNumber); + sb.Append (serialNumber.ToHexArrayUpper ()); + sb.AppendLine (); + + // NotBefore + sb.AppendLine (); + sb.AppendLine ("[Not Before]"); + sb.Append (" "); + sb.AppendLine (FormatDate (GetNotBefore ())); + + // NotAfter + sb.AppendLine (); + sb.AppendLine ("[Not After]"); + sb.Append (" "); + sb.AppendLine (FormatDate (GetNotAfter ())); + + // Thumbprint + sb.AppendLine (); + sb.AppendLine ("[Thumbprint]"); + sb.Append (" "); + sb.Append (GetRawCertHash ().ToHexArrayUpper ()); + sb.AppendLine (); + + return sb.ToString (); + } + +#endregion + +#region Mono Implementation + + /* + /* CoreFX throws + /* throw new PlatformNotSupportedException(SR.NotSupported_ImmutableX509Certificate); + /* everywhere. + */ + + [ComVisible (false)] + public virtual void Import (byte[] rawData) + { + Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet); + } + + [ComVisible (false)] + public virtual void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags) + { + Reset (); + using (var safePasswordHandle = new SafePasswordHandle (password)) + impl = X509Helper.Import (rawData, safePasswordHandle, keyStorageFlags); + } + + public virtual void Import (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags) + { + using (var safePasswordHandle = new SafePasswordHandle (password)) + impl = X509Helper.Import (rawData, safePasswordHandle, keyStorageFlags); + } + + [ComVisible (false)] + public virtual void Import (string fileName) + { + Import (fileName, (string)null, X509KeyStorageFlags.DefaultKeySet); + } + + [ComVisible (false)] + public virtual void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags) + { + byte[] rawData = File.ReadAllBytes (fileName); + using (var safePasswordHandle = new SafePasswordHandle (password)) + impl = X509Helper.Import (rawData, safePasswordHandle, keyStorageFlags); + } + + public virtual void Import (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags) + { + byte[] rawData = File.ReadAllBytes (fileName); + using (var safePasswordHandle = new SafePasswordHandle (password)) + impl = X509Helper.Import (rawData, safePasswordHandle, keyStorageFlags); + } + +#endregion + +#region CoreFX Implementation + + internal DateTime GetNotAfter () + { + ThrowIfInvalid (); + + DateTime notAfter = lazyNotAfter; + if (notAfter == DateTime.MinValue) + notAfter = lazyNotAfter = impl.NotAfter; + return notAfter; + } + + internal DateTime GetNotBefore () + { + ThrowIfInvalid (); + + DateTime notBefore = lazyNotBefore; + if (notBefore == DateTime.MinValue) + notBefore = lazyNotBefore = impl.NotBefore; + return notBefore; + } + + /// + /// Convert a date to a string. + /// + /// Some cultures, specifically using the Um-AlQura calendar cannot convert dates far into + /// the future into strings. If the expiration date of an X.509 certificate is beyond the range + /// of one of these cases, we need to fall back to a calendar which can express the dates + /// + protected static string FormatDate (DateTime date) + { + CultureInfo culture = CultureInfo.CurrentCulture; + + if (!culture.DateTimeFormat.Calendar.IsValidDay (date.Year, date.Month, date.Day, 0)) { + // The most common case of culture failing to work is in the Um-AlQuara calendar. In this case, + // we can fall back to the Hijri calendar, otherwise fall back to the invariant culture. + if (culture.DateTimeFormat.Calendar is UmAlQuraCalendar) { + culture = culture.Clone () as CultureInfo; + culture.DateTimeFormat.Calendar = new HijriCalendar (); + } else { + culture = CultureInfo.InvariantCulture; + } + } + + return date.ToString (culture); + } + + internal static void ValidateKeyStorageFlags (X509KeyStorageFlags keyStorageFlags) + { + if ((keyStorageFlags & ~KeyStorageFlagsAll) != 0) + throw new ArgumentException (SR.Argument_InvalidFlag, nameof (keyStorageFlags)); + + const X509KeyStorageFlags EphemeralPersist = + X509KeyStorageFlags.EphemeralKeySet | X509KeyStorageFlags.PersistKeySet; + + X509KeyStorageFlags persistenceFlags = keyStorageFlags & EphemeralPersist; + + if (persistenceFlags == EphemeralPersist) { + throw new ArgumentException ( + SR.Format (SR.Cryptography_X509_InvalidFlagCombination, persistenceFlags), + nameof (keyStorageFlags)); + } + } + + void VerifyContentType (X509ContentType contentType) + { + if (!(contentType == X509ContentType.Cert || contentType == X509ContentType.SerializedCert || contentType == X509ContentType.Pkcs12)) + throw new CryptographicException (SR.Cryptography_X509_InvalidContentType); + } + + internal const X509KeyStorageFlags KeyStorageFlagsAll = + X509KeyStorageFlags.UserKeySet | + X509KeyStorageFlags.MachineKeySet | + X509KeyStorageFlags.Exportable | + X509KeyStorageFlags.UserProtected | + X509KeyStorageFlags.PersistKeySet | + X509KeyStorageFlags.EphemeralKeySet; + +#endregion // CoreFX Implementation + internal void ImportHandle (X509CertificateImpl impl) { Reset (); @@ -138,166 +693,9 @@ namespace System.Security.Cryptography.X509Certificates { get { return X509Helper.IsValid (impl); } } - internal void ThrowIfContextInvalid () + internal void ThrowIfInvalid () { X509Helper.ThrowIfContextInvalid (impl); } - - // public methods - - public virtual bool Equals (System.Security.Cryptography.X509Certificates.X509Certificate other) - { - if (other == null) { - return false; - } else { - if (!X509Helper.IsValid (other.impl)) { - if (!X509Helper.IsValid (impl)) - return true; - throw new CryptographicException (Locale.GetText ("Certificate instance is empty.")); - } - - return X509CertificateImpl.Equals (impl, other.impl); - } - } - - // LAMESPEC: This is the equivalent of the "thumbprint" that can be seen - // in the certificate viewer of Windows. This is ALWAYS the SHA1 hash of - // the certificate (i.e. it has nothing to do with the actual hash - // algorithm used to sign the certificate). - public virtual byte[] GetCertHash () - { - X509Helper.ThrowIfContextInvalid (impl); - return impl.GetCertHash (); - } - - public virtual string GetCertHashString () - { - // must call GetCertHash (not variable) or optimization wont work - return X509Helper.ToHexString (GetCertHash ()); - } - - // strangly there are no DateTime returning function - public virtual string GetEffectiveDateString () - { - if (hideDates) - return null; - X509Helper.ThrowIfContextInvalid (impl); - - return impl.GetValidFrom ().ToLocalTime ().ToString (); - } - - // strangly there are no DateTime returning function - public virtual string GetExpirationDateString () - { - if (hideDates) - return null; - X509Helper.ThrowIfContextInvalid (impl); - - return impl.GetValidUntil ().ToLocalTime ().ToString (); - } - - // well maybe someday there'll be support for PGP or SPKI ? - public virtual string GetFormat () - { - return "X509"; // DO NOT TRANSLATE - } - - public override int GetHashCode () - { - if (!X509Helper.IsValid (impl)) - return 0; - return impl.GetHashCode (); - } - - [Obsolete ("Use the Issuer property.")] - public virtual string GetIssuerName () - { - X509Helper.ThrowIfContextInvalid (impl); - return impl.GetIssuerName (true); - } - - public virtual string GetKeyAlgorithm () - { - X509Helper.ThrowIfContextInvalid (impl); - return impl.GetKeyAlgorithm (); - } - - public virtual byte[] GetKeyAlgorithmParameters () - { - X509Helper.ThrowIfContextInvalid (impl); - - byte[] kap = impl.GetKeyAlgorithmParameters (); - if (kap == null) - throw new CryptographicException (Locale.GetText ("Parameters not part of the certificate")); - - return kap; - } - - public virtual string GetKeyAlgorithmParametersString () - { - return X509Helper.ToHexString (GetKeyAlgorithmParameters ()); - } - - [Obsolete ("Use the Subject property.")] - public virtual string GetName () - { - X509Helper.ThrowIfContextInvalid (impl); - return impl.GetSubjectName (true); - } - - public virtual byte[] GetPublicKey () - { - X509Helper.ThrowIfContextInvalid (impl); - return impl.GetPublicKey (); - } - - public virtual string GetPublicKeyString () - { - return X509Helper.ToHexString (GetPublicKey ()); - } - - public virtual byte[] GetRawCertData () - { - X509Helper.ThrowIfContextInvalid (impl); - return impl.GetRawCertData (); - } - - public virtual string GetRawCertDataString () - { - X509Helper.ThrowIfContextInvalid (impl); - return X509Helper.ToHexString (impl.GetRawCertData ()); - } - - public virtual byte[] GetSerialNumber () - { - X509Helper.ThrowIfContextInvalid (impl); - return impl.GetSerialNumber (); - } - - public virtual string GetSerialNumberString () - { - byte[] sn = GetSerialNumber (); - Array.Reverse (sn); - return X509Helper.ToHexString (sn); - } - - // to please corcompare ;-) - public override string ToString () - { - return base.ToString (); - } - - public virtual string ToString (bool fVerbose) - { - if (!fVerbose || !X509Helper.IsValid (impl)) - return base.ToString (); - - return impl.ToString (true); - } - - protected static string FormatDate (DateTime date) - { - throw new NotImplementedException (); - } } } diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate20.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate20.cs deleted file mode 100644 index 78a71adbd5..0000000000 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate20.cs +++ /dev/null @@ -1,262 +0,0 @@ -// -// X509Certificate20.cs: Partial class to handle new 2.0-only stuff -// -// Author: -// Sebastien Pouliot -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2006,2008 Novell, Inc (http://www.novell.com) -// Copyright 2013 Xamarin Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.IO; -using System.Runtime.InteropServices; -using System.Security.Permissions; -using System.Text; - -using Mono.Security; -using Mono.Security.X509; - -using System.Runtime.Serialization; - -namespace System.Security.Cryptography.X509Certificates { - - [ComVisible (true)] - [MonoTODO ("X509ContentType.SerializedCert isn't supported (anywhere in the class)")] - public partial class X509Certificate : IDeserializationCallback, ISerializable, IDisposable { - private string issuer_name; - private string subject_name; - - - public X509Certificate () - { - // this allows an empty certificate to exists - } - - public X509Certificate (byte[] rawData, string password) - { - Import (rawData, password, X509KeyStorageFlags.DefaultKeySet); - } - - [MonoTODO ("SecureString support is incomplete")] - public X509Certificate (byte[] rawData, SecureString password) - { - Import (rawData, password, X509KeyStorageFlags.DefaultKeySet); - } - - public X509Certificate (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags) - { - Import (rawData, password, keyStorageFlags); - } - - [MonoTODO ("SecureString support is incomplete")] - public X509Certificate (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags) - { - Import (rawData, password, keyStorageFlags); - } - - public X509Certificate (string fileName) - { - Import (fileName, (string)null, X509KeyStorageFlags.DefaultKeySet); - } - - public X509Certificate (string fileName, string password) - { - Import (fileName, password, X509KeyStorageFlags.DefaultKeySet); - } - - [MonoTODO ("SecureString support is incomplete")] - public X509Certificate (string fileName, SecureString password) - { - Import (fileName, password, X509KeyStorageFlags.DefaultKeySet); - } - - public X509Certificate (string fileName, string password, X509KeyStorageFlags keyStorageFlags) - { - Import (fileName, password, keyStorageFlags); - } - - [MonoTODO ("SecureString support is incomplete")] - public X509Certificate (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags) - { - Import (fileName, password, keyStorageFlags); - } - - public X509Certificate (SerializationInfo info, StreamingContext context) - { - byte[] raw = (byte[]) info.GetValue ("RawData", typeof (byte[])); - Import (raw, (string)null, X509KeyStorageFlags.DefaultKeySet); - } - - - public string Issuer { - get { - X509Helper.ThrowIfContextInvalid (impl); - - if (issuer_name == null) - issuer_name = impl.GetIssuerName (false); - return issuer_name; - } - } - - public string Subject { - get { - X509Helper.ThrowIfContextInvalid (impl); - - if (subject_name == null) - subject_name = impl.GetSubjectName (false); - return subject_name; - } - } - - [ComVisible (false)] - public IntPtr Handle { - get { - if (X509Helper.IsValid (impl)) - return impl.Handle; - return IntPtr.Zero; - } - } - - - [ComVisible (false)] - public override bool Equals (object obj) - { - X509Certificate x = (obj as X509Certificate); - if (x != null) - return this.Equals (x); - return false; - } - - [MonoTODO ("X509ContentType.Pfx/Pkcs12 and SerializedCert are not supported")] - [ComVisible (false)] - public virtual byte[] Export (X509ContentType contentType) - { - return Export (contentType, (byte[])null); - } - - [MonoTODO ("X509ContentType.Pfx/Pkcs12 and SerializedCert are not supported")] - [ComVisible (false)] - public virtual byte[] Export (X509ContentType contentType, string password) - { - byte[] pwd = (password == null) ? null : Encoding.UTF8.GetBytes (password); - return Export (contentType, pwd); - } - - [MonoTODO ("X509ContentType.Pfx/Pkcs12 and SerializedCert are not supported. SecureString support is incomplete.")] - public virtual byte[] Export (X509ContentType contentType, SecureString password) - { - byte[] pwd = (password == null) ? null : password.GetBuffer (); - return Export (contentType, pwd); - } - - internal byte[] Export (X509ContentType contentType, byte[] password) - { - try { - X509Helper.ThrowIfContextInvalid (impl); - return impl.Export (contentType, password); - } finally { - // protect password - if (password != null) - Array.Clear (password, 0, password.Length); - } - } - - [ComVisible (false)] - public virtual void Import (byte[] rawData) - { - Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet); - } - - [MonoTODO ("missing KeyStorageFlags support")] - [ComVisible (false)] - public virtual void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags) - { - Reset (); - impl = X509Helper.Import (rawData, password, keyStorageFlags); - } - - [MonoTODO ("SecureString support is incomplete")] - public virtual void Import (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags) - { - Import (rawData, (string)null, keyStorageFlags); - } - - [ComVisible (false)] - public virtual void Import (string fileName) - { - byte[] rawData = File.ReadAllBytes (fileName); - Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet); - } - - [MonoTODO ("missing KeyStorageFlags support")] - [ComVisible (false)] - public virtual void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags) - { - byte[] rawData = File.ReadAllBytes (fileName); - Import (rawData, password, keyStorageFlags); - } - - [MonoTODO ("SecureString support is incomplete, missing KeyStorageFlags support")] - public virtual void Import (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags) - { - byte[] rawData = File.ReadAllBytes (fileName); - Import (rawData, (string)null, keyStorageFlags); - } - - void IDeserializationCallback.OnDeserialization (object sender) - { - } - - void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context) - { - if (!X509Helper.IsValid (impl)) - throw new NullReferenceException (); - // will throw a NRE if info is null (just like MS implementation) - info.AddValue ("RawData", impl.GetRawCertData ()); - } - - public void Dispose () - { - Dispose (true); - } - - protected virtual void Dispose (bool disposing) - { - if (disposing) - Reset (); - } - - [ComVisible (false)] - public virtual void Reset () - { - if (impl != null) { - impl.Dispose (); - impl = null; - } - - issuer_name = null; - subject_name = null; - hideDates = false; - } - } -} diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImpl.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImpl.cs index 548bc5d93c..d3a2e73a9b 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImpl.cs +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImpl.cs @@ -25,6 +25,7 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +using Microsoft.Win32.SafeHandles; namespace System.Security.Cryptography.X509Certificates { internal abstract class X509CertificateImpl : IDisposable @@ -50,57 +51,71 @@ namespace System.Security.Cryptography.X509Certificates public abstract X509CertificateImpl Clone (); - public abstract string GetIssuerName (bool legacyV1Mode); - - public abstract string GetSubjectName (bool legacyV1Mode); - - public abstract byte[] GetRawCertData (); - - public abstract DateTime GetValidFrom (); - - public abstract DateTime GetValidUntil (); - - byte[] cachedCertificateHash; - - public byte[] GetCertHash () - { - ThrowIfContextInvalid (); - if (cachedCertificateHash == null) - cachedCertificateHash = GetCertHash (false); - return cachedCertificateHash; + public abstract string Issuer { + get; } - protected abstract byte[] GetCertHash (bool lazy); + public abstract string Subject { + get; + } - public override int GetHashCode () + public abstract string LegacyIssuer { + get; + } + + public abstract string LegacySubject { + get; + } + + public abstract byte[] RawData { + get; + } + + public abstract DateTime NotAfter { + get; + } + + public abstract DateTime NotBefore { + get; + } + + public abstract byte[] Thumbprint { + get; + } + + public sealed override int GetHashCode () { if (!IsValid) return 0; - if (cachedCertificateHash == null) - cachedCertificateHash = GetCertHash (true); - // return the integer of the first 4 bytes of the cert hash - if ((cachedCertificateHash != null) && (cachedCertificateHash.Length >= 4)) - return ((cachedCertificateHash [0] << 24) | (cachedCertificateHash [1] << 16) | - (cachedCertificateHash [2] << 8) | cachedCertificateHash [3]); - else - return 0; + byte[] thumbPrint = Thumbprint; + int value = 0; + for (int i = 0; i < thumbPrint.Length && i < 4; ++i) { + value = value << 8 | thumbPrint[i]; + } + return value; } public abstract bool Equals (X509CertificateImpl other, out bool result); - public abstract string GetKeyAlgorithm (); + public abstract string KeyAlgorithm { + get; + } - public abstract byte[] GetKeyAlgorithmParameters (); + public abstract byte[] KeyAlgorithmParameters { + get; + } - public abstract byte[] GetPublicKey (); + public abstract byte[] PublicKeyValue { + get; + } - public abstract byte[] GetSerialNumber (); + public abstract byte[] SerialNumber { + get; + } - public abstract byte[] Export (X509ContentType contentType, byte[] password); + public abstract byte[] Export (X509ContentType contentType, SafePasswordHandle password); - public abstract string ToString (bool full); - - public override bool Equals (object obj) + public sealed override bool Equals (object obj) { var other = obj as X509CertificateImpl; if (other == null) @@ -109,23 +124,16 @@ namespace System.Security.Cryptography.X509Certificates if (!IsValid || !other.IsValid) return false; - bool result; - if (Equals (other, out result)) - return result; - - var ourRaw = GetRawCertData (); - var theirRaw = other.GetRawCertData (); - - if (ourRaw == null) - return theirRaw == null; - else if (theirRaw == null) + if (!Issuer.Equals (other.Issuer)) return false; - if (ourRaw.Length != theirRaw.Length) - return false; + byte[] thisSerialNumber = SerialNumber; + byte[] otherSerialNumber = other.SerialNumber; - for (int i = 0; i < ourRaw.Length; i++) { - if (ourRaw [i] != theirRaw [i]) + if (thisSerialNumber.Length != otherSerialNumber.Length) + return false; + for (int i = 0; i < thisSerialNumber.Length; i++) { + if (thisSerialNumber[i] != otherSerialNumber[i]) return false; } @@ -140,7 +148,6 @@ namespace System.Security.Cryptography.X509Certificates protected virtual void Dispose (bool disposing) { - cachedCertificateHash = null; } ~X509CertificateImpl () diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplMono.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplMono.cs deleted file mode 100644 index fa152e97f9..0000000000 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplMono.cs +++ /dev/null @@ -1,178 +0,0 @@ -// -// X509CertificateImplMono.cs: X.509 implementation using Mono.Security.X509. -// -// Authors: -// Sebastien Pouliot -// Martin Baulig -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com) -// Copyright (C) 2015 Xamarin, Inc. (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; -using System.Text; -using MX = Mono.Security.X509; - -namespace System.Security.Cryptography.X509Certificates -{ - sealed class X509CertificateImplMono : X509CertificateImpl - { - MX.X509Certificate x509; - - public X509CertificateImplMono (MX.X509Certificate x509) - { - this.x509 = x509; - } - - public override bool IsValid { - get { return x509 != null; } - } - - public override IntPtr Handle { - get { return IntPtr.Zero; } - } - - public override IntPtr GetNativeAppleCertificate () - { - return IntPtr.Zero; - } - - public override X509CertificateImpl Clone () - { - ThrowIfContextInvalid (); - return new X509CertificateImplMono (x509); - } - - public override string GetIssuerName (bool legacyV1Mode) - { - ThrowIfContextInvalid (); - if (legacyV1Mode) - return x509.IssuerName; - else - return MX.X501.ToString (x509.GetIssuerName (), true, ", ", true); - } - - public override string GetSubjectName (bool legacyV1Mode) - { - ThrowIfContextInvalid (); - if (legacyV1Mode) - return x509.SubjectName; - else - return MX.X501.ToString (x509.GetSubjectName (), true, ", ", true); - } - - public override byte[] GetRawCertData () - { - ThrowIfContextInvalid (); - return x509.RawData; - } - - protected override byte[] GetCertHash (bool lazy) - { - ThrowIfContextInvalid (); - SHA1 sha = SHA1.Create (); - return sha.ComputeHash (x509.RawData); - } - - public override DateTime GetValidFrom () - { - ThrowIfContextInvalid (); - return x509.ValidFrom; - } - - public override DateTime GetValidUntil () - { - ThrowIfContextInvalid (); - return x509.ValidUntil; - } - - public override bool Equals (X509CertificateImpl other, out bool result) - { - // Use default implementation - result = false; - return false; - } - - public override string GetKeyAlgorithm () - { - ThrowIfContextInvalid (); - return x509.KeyAlgorithm; - } - - public override byte[] GetKeyAlgorithmParameters () - { - ThrowIfContextInvalid (); - return x509.KeyAlgorithmParameters; - } - - public override byte[] GetPublicKey () - { - ThrowIfContextInvalid (); - return x509.PublicKey; - } - - public override byte[] GetSerialNumber () - { - ThrowIfContextInvalid (); - return x509.SerialNumber; - } - - public override byte[] Export (X509ContentType contentType, byte[] password) - { - ThrowIfContextInvalid (); - - switch (contentType) { - case X509ContentType.Cert: - return GetRawCertData (); - case X509ContentType.Pfx: // this includes Pkcs12 - // TODO - throw new NotSupportedException (); - case X509ContentType.SerializedCert: - // TODO - throw new NotSupportedException (); - default: - string msg = Locale.GetText ("This certificate format '{0}' cannot be exported.", contentType); - throw new CryptographicException (msg); - } - } - - public override string ToString (bool full) - { - ThrowIfContextInvalid (); - - string nl = Environment.NewLine; - StringBuilder sb = new StringBuilder (); - sb.AppendFormat ("[Subject]{0} {1}{0}{0}", nl, GetSubjectName (false)); - sb.AppendFormat ("[Issuer]{0} {1}{0}{0}", nl, GetIssuerName (false)); - sb.AppendFormat ("[Not Before]{0} {1}{0}{0}", nl, GetValidFrom ().ToLocalTime ()); - sb.AppendFormat ("[Not After]{0} {1}{0}{0}", nl, GetValidUntil ().ToLocalTime ()); - sb.AppendFormat ("[Thumbprint]{0} {1}{0}", nl, X509Helper.ToHexString (GetCertHash ())); - sb.Append (nl); - return sb.ToString (); - } - - protected override void Dispose (bool disposing) - { - x509 = null; - } - } -} diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs deleted file mode 100644 index 410f946744..0000000000 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs +++ /dev/null @@ -1,39 +0,0 @@ -#if MONO_FEATURE_APPLETLS || MONO_FEATURE_APPLE_X509 -using System; -using System.Runtime.InteropServices; -using MX = Mono.Security.X509; -using XamMac.CoreFoundation; - -namespace System.Security.Cryptography.X509Certificates -{ - static partial class X509Helper - { - public static X509CertificateImpl InitFromHandleApple (IntPtr handle) - { - return new X509CertificateImplApple (handle, false); - } - - static X509CertificateImpl ImportApple (byte[] rawData) - { - var handle = CFHelpers.CreateCertificateFromData (rawData); - if (handle != IntPtr.Zero) - return new X509CertificateImplApple (handle, true); - - MX.X509Certificate x509; - try { - x509 = new MX.X509Certificate (rawData); - } catch (Exception e) { - try { - x509 = ImportPkcs12 (rawData, null); - } catch { - string msg = Locale.GetText ("Unable to decode certificate."); - // inner exception is the original (not second) exception - throw new CryptographicException (msg, e); - } - } - - return new X509CertificateImplMono (x509); - } - } -} -#endif diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs index b4e0988134..74911cce0f 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs @@ -32,123 +32,26 @@ using System; using System.Text; using System.Threading; using System.Runtime.InteropServices; +using Microsoft.Win32.SafeHandles; #if !MOBILE using System.Security.Permissions; #endif -using MX = Mono.Security.X509; +using Mono; namespace System.Security.Cryptography.X509Certificates { static partial class X509Helper { - static INativeCertificateHelper nativeHelper; - - internal static void InstallNativeHelper (INativeCertificateHelper helper) - { - if (nativeHelper == null) - Interlocked.CompareExchange (ref nativeHelper, helper, null); - } - -#if MONO_FEATURE_APPLETLS - static bool ShouldUseAppleTls - { - get - { - if (!System.Environment.IsMacOS) - return false; - // MONO_TLS_PROVIDER values default or apple (not legacy or btls) and must be on MacOS - var variable = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER"); - return string.IsNullOrEmpty (variable) || variable == "default" || variable == "apple"; // On Platform.IsMacOS default is AppleTlsProvider - } - } -#endif - - public static X509CertificateImpl InitFromHandle (IntPtr handle) - { -#if (MONO_FEATURE_APPLETLS && ONLY_APPLETLS) || MONO_FEATURE_APPLE_X509 // ONLY_APPLETLS should not support any other option - return InitFromHandleApple (handle); -#else - -#if MONO_FEATURE_APPLETLS // If we support AppleTls, which is the default, and not overriding to legacy - if (ShouldUseAppleTls) - return InitFromHandleApple (handle); -#endif -#if !MOBILE - return InitFromHandleCore (handle); -#elif !MONOTOUCH && !XAMMAC - throw new NotSupportedException (); -#endif -#endif - } - - static X509CertificateImpl Import (byte[] rawData) - { -#if (MONO_FEATURE_APPLETLS && ONLY_APPLETLS) || MONO_FEATURE_APPLE_X509 // ONLY_APPLETLS should not support any other option - return ImportApple (rawData); -#else -#if MONO_FEATURE_APPLETLS - if (ShouldUseAppleTls) - return ImportApple (rawData); -#endif - return ImportCore (rawData); -#endif - } - -#if !MOBILE - // typedef struct _CERT_CONTEXT { - // DWORD dwCertEncodingType; - // BYTE *pbCertEncoded; - // DWORD cbCertEncoded; - // PCERT_INFO pCertInfo; - // HCERTSTORE hCertStore; - // } CERT_CONTEXT, *PCERT_CONTEXT; - // typedef const CERT_CONTEXT *PCCERT_CONTEXT; - [StructLayout (LayoutKind.Sequential)] - internal struct CertificateContext { - public UInt32 dwCertEncodingType; - public IntPtr pbCertEncoded; - public UInt32 cbCertEncoded; - public IntPtr pCertInfo; - public IntPtr hCertStore; - } - // NOTE: We only define the CryptoAPI structure (from WINCRYPT.H) - // so we don't create any dependencies on Windows DLL in corlib - - [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)] - public static X509CertificateImpl InitFromHandleCore (IntPtr handle) - { - // both Marshal.PtrToStructure and Marshal.Copy use LinkDemand (so they will always success from here) - CertificateContext cc = (CertificateContext) Marshal.PtrToStructure (handle, typeof (CertificateContext)); - byte[] data = new byte [cc.cbCertEncoded]; - Marshal.Copy (cc.pbCertEncoded, data, 0, (int)cc.cbCertEncoded); - var x509 = new MX.X509Certificate (data); - return new X509CertificateImplMono (x509); - } -#endif + static ISystemCertificateProvider CertificateProvider => DependencyInjector.SystemProvider.CertificateProvider; public static X509CertificateImpl InitFromCertificate (X509Certificate cert) { - if (nativeHelper != null) - return nativeHelper.Import (cert); - - return InitFromCertificate (cert.Impl); + return CertificateProvider.Import (cert, CertificateImportFlags.None); } public static X509CertificateImpl InitFromCertificate (X509CertificateImpl impl) { - if (impl == null) - return null; - - var copy = impl.Clone (); - if (copy != null) - return copy; - - var data = impl.GetRawCertData (); - if (data == null) - return null; - - var x509 = new MX.X509Certificate (data); - return new X509CertificateImplMono (x509); + return impl?.Clone (); } public static bool IsValid (X509CertificateImpl impl) @@ -167,95 +70,17 @@ namespace System.Security.Cryptography.X509Certificates return new CryptographicException (Locale.GetText ("Certificate instance is empty.")); } - internal static MX.X509Certificate ImportPkcs12 (byte[] rawData, string password) + public static X509CertificateImpl Import (byte[] rawData) { - var pfx = (password == null) ? new MX.PKCS12 (rawData) : new MX.PKCS12 (rawData, password); - if (pfx.Certificates.Count == 0) { - // no certificate was found - return null; - } else if (pfx.Keys.Count == 0) { - // no key were found - pick the first certificate - return pfx.Certificates [0]; - } else { - // find the certificate that match the first key - var keypair = (pfx.Keys [0] as AsymmetricAlgorithm); - string pubkey = keypair.ToXmlString (false); - foreach (var c in pfx.Certificates) { - if ((c.RSA != null) && (pubkey == c.RSA.ToXmlString (false))) - return c; - if ((c.DSA != null) && (pubkey == c.DSA.ToXmlString (false))) - return c; - } - return pfx.Certificates [0]; // no match, pick first certificate without keys - } + return CertificateProvider.Import (rawData); } - static byte[] PEM (string type, byte[] data) + public static X509CertificateImpl Import (byte[] rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags) { - string pem = Encoding.ASCII.GetString (data); - string header = String.Format ("-----BEGIN {0}-----", type); - string footer = String.Format ("-----END {0}-----", type); - int start = pem.IndexOf (header) + header.Length; - int end = pem.IndexOf (footer, start); - string base64 = pem.Substring (start, (end - start)); - return Convert.FromBase64String (base64); + return CertificateProvider.Import (rawData, password, keyStorageFlags); } - static byte[] ConvertData (byte[] data) - { - if (data == null || data.Length == 0) - return data; - - // does it looks like PEM ? - if (data [0] != 0x30) { - try { - return PEM ("CERTIFICATE", data); - } catch { - // let the implementation take care of it. - } - } - return data; - } - - static X509CertificateImpl ImportCore (byte[] rawData) - { - MX.X509Certificate x509; - try { - x509 = new MX.X509Certificate (rawData); - } catch (Exception e) { - try { - x509 = ImportPkcs12 (rawData, null); - } catch { - string msg = Locale.GetText ("Unable to decode certificate."); - // inner exception is the original (not second) exception - throw new CryptographicException (msg, e); - } - } - - return new X509CertificateImplMono (x509); - } - - public static X509CertificateImpl Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags) - { - if (password == null) { - rawData = ConvertData (rawData); - return Import (rawData); - } - - MX.X509Certificate x509; - // try PKCS#12 - try { - x509 = ImportPkcs12 (rawData, password); - } catch { - // it's possible to supply a (unrequired/unusued) password - // fix bug #79028 - x509 = new MX.X509Certificate (rawData); - } - - return new X509CertificateImplMono (x509); - } - - public static byte[] Export (X509CertificateImpl impl, X509ContentType contentType, byte[] password) + public static byte[] Export (X509CertificateImpl impl, X509ContentType contentType, SafePasswordHandle password) { ThrowIfContextInvalid (impl); return impl.Export (contentType, password); @@ -270,8 +95,8 @@ namespace System.Security.Cryptography.X509Certificates if (first.Equals (second, out result)) return result; - var firstRaw = first.GetRawCertData (); - var secondRaw = second.GetRawCertData (); + var firstRaw = first.RawData; + var secondRaw = second.RawData; if (firstRaw == null) return secondRaw == null; diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs index 5bb37008de..39b927e785 100755 --- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs +++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs @@ -62,6 +62,8 @@ namespace System.Security.Cryptography { if (name == null) throw new ArgumentNullException ("name"); + Type algoClass = null; + // TODO: These ignore args switch (name.ToLowerInvariant ()) { case "system.security.cryptography.dsacryptoserviceprovider": @@ -190,48 +192,51 @@ namespace System.Security.Cryptography { case "3des": return new TripleDESCryptoServiceProvider (); - // These are not yet linker friendly + // Use Type.GetType to be linker friendly + // TODO: This does not work when the assembly is not referenced by the project case "x509chain": - name = "System.Security.Cryptography.X509Certificates.X509Chain, System"; + algoClass = Type.GetType ("System.Security.Cryptography.X509Certificates.X509Chain, System"); break; case "2.5.29.15": - name = "System.Security.Cryptography.X509Certificates.X509KeyUsageExtension, System"; + algoClass = Type.GetType ("System.Security.Cryptography.X509Certificates.X509KeyUsageExtension, System"); break; case "2.5.29.19": - name = "System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension, System"; + algoClass = Type.GetType ("System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension, System"); break; case "2.5.29.14": - name = "System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension, System"; + algoClass = Type.GetType ("System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension, System"); break; case "2.5.29.37": - name = "System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension, System"; + algoClass = Type.GetType ("System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension, System"); break; case "aes": #if MONOTOUCH || XAMMAC - name = "System.Security.Cryptography.AesManaged, System.Core"; + algoClass = Type.GetType ("System.Security.Cryptography.AesManaged, System.Core"); #else - name = "System.Security.Cryptography.AesCryptoServiceProvider, System.Core"; + algoClass = Type.GetType ("System.Security.Cryptography.AesCryptoServiceProvider, System.Core"); #endif break; } - lock (lockObject) { - Type algoClass = null; - if (algorithms?.TryGetValue (name, out algoClass) == true) { - try { - return Activator.CreateInstance (algoClass, args); - } catch { + if (algoClass == null) { + lock (lockObject) { + if (algorithms?.TryGetValue (name, out algoClass) == true) { + try { + return Activator.CreateInstance (algoClass, args); + } catch { + } } } + + algoClass = Type.GetType (name); } try { // last resort, the request type might be available (if care is taken for the type not to be linked // away) and that can allow some 3rd party code to work (e.g. extra algorithms) and make a few more // unit tests happy - return Activator.CreateInstance (Type.GetType (name), args); - } - catch { + return Activator.CreateInstance (algoClass, args); + } catch { // method doesn't throw any exception return null; } diff --git a/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs index 7abdbecd11..45074ce02f 100644 --- a/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs +++ b/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs @@ -53,36 +53,40 @@ namespace System.Security.Cryptography { _lock = new object (); } - public RNGCryptoServiceProvider () + unsafe public RNGCryptoServiceProvider () { - _handle = RngInitialize (null); + _handle = RngInitialize (null, IntPtr.Zero); Check (); } - public RNGCryptoServiceProvider (byte[] rgb) + unsafe public RNGCryptoServiceProvider (byte[] rgb) { - _handle = RngInitialize (rgb); + fixed (byte* fixed_rgb = rgb) + _handle = RngInitialize (fixed_rgb, (rgb != null) ? (IntPtr)rgb.Length : IntPtr.Zero); Check (); } - public RNGCryptoServiceProvider (CspParameters cspParams) + unsafe public RNGCryptoServiceProvider (CspParameters cspParams) { // CSP selection isn't supported but we still return // random data (no exception) for compatibility - _handle = RngInitialize (null); + _handle = RngInitialize (null, IntPtr.Zero); Check (); } - public RNGCryptoServiceProvider (string str) + unsafe public RNGCryptoServiceProvider (string str) { if (str == null) - _handle = RngInitialize (null); - else - _handle = RngInitialize (Encoding.UTF8.GetBytes (str)); + _handle = RngInitialize (null, IntPtr.Zero); + else { + byte[] bytes = Encoding.UTF8.GetBytes (str); + fixed (byte* fixed_bytes = bytes) + _handle = RngInitialize (fixed_bytes, (IntPtr)bytes.Length); + } Check (); } - private void Check () + private void Check () { if (_handle == IntPtr.Zero) { throw new CryptographicException ( @@ -94,51 +98,67 @@ namespace System.Security.Cryptography { private static extern bool RngOpen (); [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern IntPtr RngInitialize (byte[] seed); + unsafe private static extern IntPtr RngInitialize (byte* seed, IntPtr seed_length); [MethodImplAttribute(MethodImplOptions.InternalCall)] - private static extern IntPtr RngGetBytes (IntPtr handle, byte[] data); + unsafe private static extern IntPtr RngGetBytes (IntPtr handle, byte* data, IntPtr data_length); [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern void RngClose (IntPtr handle); - public override void GetBytes (byte[] data) + unsafe public override void GetBytes (byte[] data) { if (data == null) throw new ArgumentNullException ("data"); - if (_lock == null) { - _handle = RngGetBytes (_handle, data); - } else { - // using a global handle for randomness - lock (_lock) { - _handle = RngGetBytes (_handle, data); + fixed (byte* fixed_data = data) { + if (_lock == null) { + _handle = RngGetBytes (_handle, fixed_data, (IntPtr)data.LongLength); + } else { + // using a global handle for randomness + lock (_lock) { + _handle = RngGetBytes (_handle, fixed_data, (IntPtr)data.LongLength); + } } } Check (); } - - public override void GetNonZeroBytes (byte[] data) + + unsafe internal void GetBytes (byte* data, IntPtr data_length) + { + if (_lock == null) { + _handle = RngGetBytes (_handle, data, data_length); + } else { + // using a global handle for randomness + lock (_lock) { + _handle = RngGetBytes (_handle, data, data_length); + } + } + Check (); + } + + unsafe public override void GetNonZeroBytes (byte[] data) { if (data == null) throw new ArgumentNullException ("data"); - byte[] random = new byte [data.Length * 2]; - int i = 0; - // one pass should be enough but hey this is random ;-) - while (i < data.Length) { - _handle = RngGetBytes (_handle, random); + byte[] random = new byte [data.LongLength * 2]; + long i = 0; + // one pass should be enough but hey this is random ;-) + while (i < data.LongLength) { + fixed (byte* fixed_random = random) + _handle = RngGetBytes (_handle, fixed_random, (IntPtr)random.LongLength); Check (); - for (int j=0; j < random.Length; j++) { - if (i == data.Length) - break; - if (random [j] != 0) - data [i++] = random [j]; + for (long j = 0; j < random.LongLength; j++) { + if (i == data.LongLength) + break; + if (random [j] != 0) + data [i++] = random [j]; } } } - ~RNGCryptoServiceProvider () + ~RNGCryptoServiceProvider () { if (_handle != IntPtr.Zero) { RngClose (_handle); diff --git a/mcs/class/corlib/System.Security.Policy/Publisher.cs b/mcs/class/corlib/System.Security.Policy/Publisher.cs deleted file mode 100644 index 827505d455..0000000000 --- a/mcs/class/corlib/System.Security.Policy/Publisher.cs +++ /dev/null @@ -1,116 +0,0 @@ -// -// Publisher.cs: Publisher Policy using X509 Certificate -// -// Author: -// Sebastien Pouliot -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Security.Cryptography.X509Certificates; -using System.Security.Permissions; -using System.Runtime.InteropServices; - -namespace System.Security.Policy { - - [Serializable] - [ComVisible (true)] - public sealed class Publisher : - EvidenceBase, - IIdentityPermissionFactory, IBuiltInEvidence { - - private X509Certificate m_cert; - - public Publisher (X509Certificate cert) - { - if (cert == null) - throw new ArgumentNullException ("cert"); - if (cert.GetHashCode () == 0) - throw new ArgumentException ("cert"); - m_cert = cert; - } - - public X509Certificate Certificate { - get { - if (m_cert.GetHashCode () == 0) { - throw new ArgumentException ("m_cert"); - } - return m_cert; - } - } - - public object Copy () - { - return new Publisher (m_cert); - } - - public IPermission CreateIdentityPermission (Evidence evidence) - { - return new PublisherIdentityPermission (m_cert); - } - - public override bool Equals (object o) - { - Publisher p = (o as Publisher); - if (p == null) - throw new ArgumentException ("o", Locale.GetText ("not a Publisher instance.")); - return m_cert.Equals (p.Certificate); - } - - public override int GetHashCode () - { - return m_cert.GetHashCode (); - } - - public override string ToString () - { - SecurityElement se = new SecurityElement ("System.Security.Policy.Publisher"); - se.AddAttribute ("version", "1"); - SecurityElement cert = new SecurityElement ("X509v3Certificate"); - string data = m_cert.GetRawCertDataString (); - if (data != null) - cert.Text = data; - se.AddChild (cert); - return se.ToString (); - } - - // interface IBuiltInEvidence - - int IBuiltInEvidence.GetRequiredSize (bool verbose) - { - return (verbose ? 3 : 1) + m_cert.GetRawCertData ().Length; - } - - [MonoTODO ("IBuiltInEvidence")] - int IBuiltInEvidence.InitFromBuffer (char [] buffer, int position) - { - return 0; - } - - [MonoTODO ("IBuiltInEvidence")] - int IBuiltInEvidence.OutputToBuffer (char [] buffer, int position, bool verbose) - { - return 0; - } - } -} diff --git a/mcs/class/corlib/System.Security.Policy/PublisherMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/PublisherMembershipCondition.cs deleted file mode 100644 index 4fbc64aa10..0000000000 --- a/mcs/class/corlib/System.Security.Policy/PublisherMembershipCondition.cs +++ /dev/null @@ -1,138 +0,0 @@ -// -// PublisherMembershipCondition.cs: Publisher Membership Condition -// -// Author: -// Sebastien Pouliot -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Collections; -using System.Security.Cryptography.X509Certificates; -using System.Runtime.InteropServices; - -using Mono.Security.Cryptography; - -namespace System.Security.Policy { - - [Serializable] - [ComVisible (true)] - public sealed class PublisherMembershipCondition : IConstantMembershipCondition, IMembershipCondition { - - private readonly int version = 1; - - private X509Certificate x509; - - // so System.Activator.CreateInstance can create an instance... - internal PublisherMembershipCondition () - { - } - - public PublisherMembershipCondition (X509Certificate certificate) - { - if (certificate == null) - throw new ArgumentNullException ("certificate"); - // needed to match MS implementation - if (certificate.GetHashCode () == 0) { - throw new ArgumentException ("certificate"); - } - x509 = certificate; - } - - public X509Certificate Certificate { - get { return x509; } - set { - if (value == null) - throw new ArgumentNullException ("value"); - x509 = value; - } - } - - public bool Check (Evidence evidence) - { - if (evidence == null) - return false; - - IEnumerator e = evidence.GetHostEnumerator (); - while (e.MoveNext ()) { - if (e.Current is Publisher) { - if (x509.Equals ((e.Current as Publisher).Certificate)) - return true; - } - } - return false; - } - - public IMembershipCondition Copy () - { - return new PublisherMembershipCondition (x509); - } - - public override bool Equals (object o) - { - PublisherMembershipCondition pmc = (o as PublisherMembershipCondition); - if (pmc == null) - return false; - return x509.Equals (pmc.Certificate); - } - - public void FromXml (SecurityElement e) - { - FromXml (e, null); - } - - public void FromXml (SecurityElement e, PolicyLevel level) - { - MembershipConditionHelper.CheckSecurityElement (e, "e", version, version); - string cert = e.Attribute ("X509Certificate"); - if (cert != null) { - byte[] rawcert = CryptoConvert.FromHex (cert); - x509 = new X509Certificate (rawcert); - } - // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references - } - - public override int GetHashCode () - { - return x509.GetHashCode (); - } - - public override string ToString () - { - return "Publisher - " + x509.GetPublicKeyString (); - } - - public SecurityElement ToXml () - { - return ToXml (null); - } - - public SecurityElement ToXml (PolicyLevel level) - { - // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references - SecurityElement se = MembershipConditionHelper.Element (typeof (PublisherMembershipCondition), version); - se.AddAttribute ("X509Certificate", x509.GetRawCertDataString ()); - return se; - } - } -} diff --git a/mcs/class/corlib/System.Security.Principal/WindowsPrincipal.cs b/mcs/class/corlib/System.Security.Principal/WindowsPrincipal.cs index 76af9ec5a1..d1ed9b4df3 100644 --- a/mcs/class/corlib/System.Security.Principal/WindowsPrincipal.cs +++ b/mcs/class/corlib/System.Security.Principal/WindowsPrincipal.cs @@ -112,7 +112,8 @@ namespace System.Security.Principal { if (Environment.IsUnix) { // note: Posix is always case-sensitive - return IsMemberOfGroupName (Token, role); + using (var rolePtr = new Mono.SafeStringMarshal (role)) + return IsMemberOfGroupName (Token, rolePtr.Value); } else { // Windows specific code that @@ -168,6 +169,6 @@ namespace System.Security.Principal { // note: never called by Win32 code (i.e. always return false) [MethodImplAttribute (MethodImplOptions.InternalCall)] - private extern static bool IsMemberOfGroupName (IntPtr user, string group); + private extern static bool IsMemberOfGroupName (IntPtr user, IntPtr group); } } diff --git a/mcs/class/corlib/System/AssemblyLoadEventHandler.cs b/mcs/class/corlib/System/AssemblyLoadEventHandler.cs deleted file mode 100644 index d82e2104c9..0000000000 --- a/mcs/class/corlib/System/AssemblyLoadEventHandler.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -// System.AssemblyLoadEventHandler.cs -// -// Paolo Molaro -// -// (C) 2002 Ximian, Inc. -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -namespace System -{ - [Serializable] - [System.Runtime.InteropServices.ComVisible (true)] - public delegate void AssemblyLoadEventHandler (object sender, AssemblyLoadEventArgs args); -} diff --git a/mcs/class/corlib/System/Environment.cs b/mcs/class/corlib/System/Environment.cs index bc7c3deae8..ef06e2ec29 100644 --- a/mcs/class/corlib/System/Environment.cs +++ b/mcs/class/corlib/System/Environment.cs @@ -48,11 +48,11 @@ namespace System { public static partial class Environment { /* - * This is the version number of the corlib-runtime interface. + * This is the version of the corlib-runtime interface. * It is defined in configure.ac. */ #pragma warning disable 169 - private const int mono_corlib_version = Consts.MonoCorlibVersion; + private const string mono_corlib_version = Consts.MonoCorlibVersion; #pragma warning restore 169 [ComVisible (true)] diff --git a/mcs/class/corlib/System/MonoCustomAttrs.cs b/mcs/class/corlib/System/MonoCustomAttrs.cs index 8894ec98c9..7a6c06c268 100644 --- a/mcs/class/corlib/System/MonoCustomAttrs.cs +++ b/mcs/class/corlib/System/MonoCustomAttrs.cs @@ -295,13 +295,219 @@ namespace System [MethodImplAttribute (MethodImplOptions.InternalCall)] static extern CustomAttributeData [] GetCustomAttributesDataInternal (ICustomAttributeProvider obj); - internal static IList GetCustomAttributesData (ICustomAttributeProvider obj) + internal static IList GetCustomAttributesData (ICustomAttributeProvider obj, bool inherit = false) { if (obj == null) - throw new ArgumentNullException ("obj"); + throw new ArgumentNullException (nameof (obj)); - CustomAttributeData [] attrs = GetCustomAttributesDataInternal (obj); - return Array.AsReadOnly (attrs); + if (!inherit) + return GetCustomAttributesDataBase (obj, null, false); + + return GetCustomAttributesData (obj, typeof (MonoCustomAttrs), inherit); + } + + internal static IList GetCustomAttributesData (ICustomAttributeProvider obj, Type attributeType, bool inherit) + { + if (obj == null) + throw new ArgumentNullException (nameof (obj)); + if (attributeType == null) + throw new ArgumentNullException (nameof (attributeType)); + + if (attributeType == typeof (MonoCustomAttrs)) + attributeType = null; + + const string Message = "Invalid custom attribute data format"; + IList r; + IList res = GetCustomAttributesDataBase (obj, attributeType, false); + // shortcut + if (!inherit && res.Count == 1) { + if (res [0] == null) + throw new CustomAttributeFormatException (Message); + if (attributeType != null) { + if (attributeType.IsAssignableFrom (res [0].AttributeType)) + r = new CustomAttributeData[] { res [0] }; + else + r = Array.Empty (); + } else { + r = new CustomAttributeData[] { res [0] }; + } + + return r; + } + + if (inherit && GetBase (obj) == null) + inherit = false; + + // if AttributeType is sealed, and Inherited is set to false, then + // there's no use in scanning base types + if ((attributeType != null && attributeType.IsSealed) && inherit) { + var usageAttribute = RetrieveAttributeUsage (attributeType); + if (!usageAttribute.Inherited) + inherit = false; + } + + var initialSize = Math.Max (res.Count, 16); + List a = null; + ICustomAttributeProvider btype = obj; + + /* Non-inherit case */ + if (!inherit) { + if (attributeType == null) { + foreach (CustomAttributeData attrData in res) { + if (attrData == null) + throw new CustomAttributeFormatException (Message); + } + + var result = new CustomAttributeData [res.Count]; + res.CopyTo (result, 0); + return result; + } else { + a = new List (initialSize); + foreach (CustomAttributeData attrData in res) { + if (attrData == null) + throw new CustomAttributeFormatException (Message); + if (!attributeType.IsAssignableFrom (attrData.AttributeType)) + continue; + a.Add (attrData); + } + + return a.ToArray (); + } + } + + /* Inherit case */ + var attributeInfos = new Dictionary (initialSize); + int inheritanceLevel = 0; + a = new List (initialSize); + + do { + foreach (CustomAttributeData attrData in res) { + AttributeUsageAttribute usage; + if (attrData == null) + throw new CustomAttributeFormatException (Message); + + Type attrType = attrData.AttributeType; + if (attributeType != null) { + if (!attributeType.IsAssignableFrom (attrType)) + continue; + } + + AttributeInfo firstAttribute; + if (attributeInfos.TryGetValue (attrType, out firstAttribute)) + usage = firstAttribute.Usage; + else + usage = RetrieveAttributeUsage (attrType); + + // The same as for CustomAttributes. + // + // Only add attribute to the list of attributes if + // - we are on the first inheritance level, or the attribute can be inherited anyway + // and ( + // - multiple attributes of the type are allowed + // or ( + // - this is the first attribute we've discovered + // or + // - the attribute is on same inheritance level than the first + // attribute that was discovered for this attribute type )) + if ((inheritanceLevel == 0 || usage.Inherited) && (usage.AllowMultiple || + (firstAttribute == null || (firstAttribute != null + && firstAttribute.InheritanceLevel == inheritanceLevel)))) + a.Add(attrData); + + if (firstAttribute == null) + attributeInfos.Add (attrType, new AttributeInfo (usage, inheritanceLevel)); + } + + if ((btype = GetBase (btype)) != null) { + inheritanceLevel++; + res = GetCustomAttributesDataBase (btype, attributeType, true); + } + } while (inherit && btype != null); + + return a.ToArray (); + } + + internal static IList GetCustomAttributesDataBase (ICustomAttributeProvider obj, Type attributeType, bool inheritedOnly) + { + CustomAttributeData[] attrsData; + if (IsUserCattrProvider (obj)) { + //FIXME resolve this case if it makes sense. Assign empty array for now. + //attrsData = obj.GetCustomAttributesData(attributeType, true); + attrsData = Array.Empty (); + } else + attrsData = GetCustomAttributesDataInternal (obj); + + // + // All pseudo custom attributes are Inherited = false hence we can avoid + // building attributes data array which would be discarded by inherited checks + // + if (!inheritedOnly) { + CustomAttributeData[] pseudoAttrsData = GetPseudoCustomAttributesData (obj, attributeType); + if (pseudoAttrsData != null) { + if (attrsData.Length == 0) + return Array.AsReadOnly (pseudoAttrsData); + CustomAttributeData[] res = new CustomAttributeData [attrsData.Length + pseudoAttrsData.Length]; + Array.Copy (attrsData, res, attrsData.Length); + Array.Copy (pseudoAttrsData, 0, res, attrsData.Length, pseudoAttrsData.Length); + return Array.AsReadOnly (res); + } + } + + return Array.AsReadOnly (attrsData); + } + + internal static CustomAttributeData[] GetPseudoCustomAttributesData (ICustomAttributeProvider obj, Type attributeType) + { + CustomAttributeData[] pseudoAttrsData = null; + + /* FIXME: Add other types */ + if (obj is MonoMethod) + pseudoAttrsData = ((MonoMethod)obj).GetPseudoCustomAttributesData (); + else if (obj is FieldInfo) + pseudoAttrsData = ((FieldInfo)obj).GetPseudoCustomAttributesData (); + else if (obj is ParameterInfo) + pseudoAttrsData = ((ParameterInfo)obj).GetPseudoCustomAttributesData (); + else if (obj is Type) + pseudoAttrsData = GetPseudoCustomAttributesData (((Type)obj)); + + if ((attributeType != null) && (pseudoAttrsData != null)) { + for (int i = 0; i < pseudoAttrsData.Length; ++i) { + if (attributeType.IsAssignableFrom (pseudoAttrsData [i].AttributeType)) { + if (pseudoAttrsData.Length == 1) + return pseudoAttrsData; + else + return new CustomAttributeData[] { pseudoAttrsData[i] }; + } + } + + return Array.Empty (); + } + + return pseudoAttrsData; + } + + static CustomAttributeData[] GetPseudoCustomAttributesData (Type type) + { + int count = 0; + var Attributes = type.Attributes; + + /* IsSerializable returns true for delegates/enums as well */ + if ((Attributes & TypeAttributes.Serializable) != 0) + count++; + if ((Attributes & TypeAttributes.Import) != 0) + count++; + + if (count == 0) + return null; + CustomAttributeData[] attrsData = new CustomAttributeData [count]; + count = 0; + + if ((Attributes & TypeAttributes.Serializable) != 0) + attrsData [count++] = new CustomAttributeData ((typeof (SerializableAttribute)).GetConstructor (Type.EmptyTypes)); + if ((Attributes & TypeAttributes.Import) != 0) + attrsData [count++] = new CustomAttributeData ((typeof (ComImportAttribute)).GetConstructor (Type.EmptyTypes)); + + return attrsData; } internal static bool IsDefined (ICustomAttributeProvider obj, Type attributeType, bool inherit) diff --git a/mcs/class/corlib/System/Nullable.cs b/mcs/class/corlib/System/Nullable.cs index 2d8a297e4c..88077dad02 100644 --- a/mcs/class/corlib/System/Nullable.cs +++ b/mcs/class/corlib/System/Nullable.cs @@ -38,133 +38,8 @@ using System.Diagnostics; namespace System { - [ComVisible (true)] - public static class Nullable { - -#if MOBILE - [ComVisible (false)] -#endif - public static int Compare (T? n1, T? n2) where T: struct - { - if (n1.has_value) { - if (!n2.has_value) - return 1; - - return Comparer.Default.Compare (n1.value, n2.value); - } - - return n2.has_value ? -1 : 0; - } - -#if MOBILE - [ComVisible (false)] -#endif - public static bool Equals (T? n1, T? n2) where T: struct - { - if (n1.has_value != n2.has_value) - return false; - - if (!n1.has_value) - return true; - - return EqualityComparer.Default.Equals (n1.value, n2.value); - } - - public static Type GetUnderlyingType (Type nullableType) - { - if (nullableType == null) - throw new ArgumentNullException ("nullableType"); - - return nullableType.IsGenericType && !nullableType.IsGenericTypeDefinition && nullableType.GetGenericTypeDefinition () == typeof(Nullable<>) ? - nullableType.GetGenericArguments () [0] : null; - } - } - - [Serializable] - [DebuggerStepThrough] - public struct Nullable where T: struct + public partial struct Nullable where T: struct { - #region Sync with runtime code - internal T value; - internal bool has_value; - #endregion - - public Nullable (T value) - { - this.has_value = true; - this.value = value; - } - - public bool HasValue { - get { return has_value; } - } - - public T Value { - get { - if (!has_value) - throw new InvalidOperationException ("Nullable object must have a value."); - - return value; - } - } - - public override bool Equals (object other) - { - if (other == null) - return has_value == false; - if (!(other is Nullable)) - return false; - - return Equals ((Nullable ) other); - } - - bool Equals (Nullable other) - { - if (other.has_value != has_value) - return false; - - if (has_value == false) - return true; - - return other.value.Equals (value); - } - - public override int GetHashCode () - { - if (!has_value) - return 0; - - return value.GetHashCode (); - } - - public T GetValueOrDefault () - { - return value; - } - - public T GetValueOrDefault (T defaultValue) - { - return has_value ? value : defaultValue; - } - - public override string ToString () - { - if (has_value) - return value.ToString (); - else - return String.Empty; - } - - public static implicit operator Nullable (T value) - { - return new Nullable (value); - } - - public static explicit operator T (Nullable value) - { - return value.Value; - } - // // These are called by the JIT // @@ -174,7 +49,7 @@ namespace System // static object Box (T? o) { - if (!o.has_value) + if (!o.hasValue) return null; return o.value; diff --git a/mcs/class/corlib/System/OperatingSystem.cs b/mcs/class/corlib/System/OperatingSystem.cs deleted file mode 100644 index 8d5a8ed6c1..0000000000 --- a/mcs/class/corlib/System/OperatingSystem.cs +++ /dev/null @@ -1,141 +0,0 @@ -// -// System.OperatingSystem.cs -// -// Author: -// Jim Richardson (develop@wtfo-guru.com) -// -// (C) 2001 Moonlight Enterprises, All Rights Reserved -// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Runtime.InteropServices; -using System.Runtime.Serialization; - -namespace System { - - [ComVisible (true)] - [Serializable] - public sealed class OperatingSystem : ICloneable, ISerializable - { - private System.PlatformID _platform; - private Version _version; - private string _servicePack = String.Empty; - - public OperatingSystem (PlatformID platform, Version version) - { - if (version == null) { - throw new ArgumentNullException ("version"); - } - - _platform = platform; - _version = version; - - if (platform == PlatformID.Win32NT) { - // The service pack is encoded in the upper bits of the revision - if (version.Revision != 0) - _servicePack = "Service Pack " + (version.Revision >> 16); - } - } - - private OperatingSystem (SerializationInfo information, StreamingContext context) - { - _platform = (System.PlatformID)information.GetValue("_platform", typeof(System.PlatformID)); - _version = (Version)information.GetValue("_version", typeof(Version)); - _servicePack = information.GetString("_servicePack"); - } - - public PlatformID Platform { - get { - return _platform; - } - } - - public Version Version { - get { - return _version; - } - } - - public string ServicePack { - get { return _servicePack; } - } - - public string VersionString { - get { return ToString (); } - } - - public object Clone () - { - return new OperatingSystem (_platform, _version); - } - - public void GetObjectData (SerializationInfo info, StreamingContext context) - { - info.AddValue ("_platform", _platform); - info.AddValue ("_version", _version); - info.AddValue ("_servicePack", _servicePack); - } - - public override string ToString () - { - string str; - - switch ((int) _platform) { - case (int) System.PlatformID.Win32NT: - str = "Microsoft Windows NT"; - break; - case (int) System.PlatformID.Win32S: - str = "Microsoft Win32S"; - break; - case (int) System.PlatformID.Win32Windows: - str = "Microsoft Windows 98"; - break; - - case (int) System.PlatformID.WinCE: - str = "Microsoft Windows CE"; - break; - - case 4: - /* PlatformID.Unix */ - case 128: - /* reported for 1.1 mono */ - str = "Unix"; - break; - case 5: - str = "XBox"; - break; - case 6: - str = "OSX"; - break; - default: - str = Locale.GetText (""); - break; - } - - string sstr = ""; - if (ServicePack != String.Empty) - sstr = " " + ServicePack; - - return str + " " + _version.ToString() + sstr; - } - } -} diff --git a/mcs/class/corlib/System/ResolveEventHandler.cs b/mcs/class/corlib/System/ResolveEventHandler.cs deleted file mode 100644 index bfdf0a1a5f..0000000000 --- a/mcs/class/corlib/System/ResolveEventHandler.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// System.ResolveEventHandler.cs -// -// Author: -// Sean MacIsaac -// -// (C) 2001 Ximian, Inc. -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -namespace System -{ - [System.Runtime.InteropServices.ComVisible (true)] - [Serializable] - public delegate Reflection.Assembly ResolveEventHandler (object sender, ResolveEventArgs args); -} diff --git a/mcs/class/corlib/System/StringComparison.cs b/mcs/class/corlib/System/StringComparison.cs deleted file mode 100644 index 50ea7a584e..0000000000 --- a/mcs/class/corlib/System/StringComparison.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -// System.StringComparison enumeration -// -// Author: -// Sebastien Pouliot -// -// Copyright (C) 2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Runtime.InteropServices; - -namespace System { - - [ComVisible (true)] - [Serializable] - public enum StringComparison { - - CurrentCulture, - CurrentCultureIgnoreCase, - InvariantCulture, - InvariantCultureIgnoreCase, - Ordinal, - OrdinalIgnoreCase - } -} diff --git a/mcs/class/corlib/System/TypeCode.cs b/mcs/class/corlib/System/TypeCode.cs deleted file mode 100644 index 2fea3e3839..0000000000 --- a/mcs/class/corlib/System/TypeCode.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// System.TypeCode.cs -// -// This code was automatically generated from -// ECMA CLI XML Library Specification. -// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)] -// Created: Wed, 5 Sep 2001 06:34:09 UTC -// Source file: all.xml -// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml -// -// (C) 2001 Ximian, Inc. http://www.ximian.com -// - -// -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.Runtime.InteropServices; - -namespace System { - - [ComVisible (true)] - [Serializable] - public enum TypeCode { - - Empty = 0, - Object = 1, - DBNull = 2, - Boolean = 3, - Char = 4, - SByte = 5, - Byte = 6, - Int16 = 7, - UInt16 = 8, - Int32 = 9, - UInt32 = 10, - Int64 = 11, - UInt64 = 12, - Single = 13, - Double = 14, - Decimal = 15, - DateTime = 16, - String = 18 - } -} - diff --git a/mcs/class/corlib/System/Void.cs b/mcs/class/corlib/System/Void.cs deleted file mode 100644 index c2550027f8..0000000000 --- a/mcs/class/corlib/System/Void.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// System.Void.cs -// -// Author: -// Miguel de Icaza (miguel@ximian.com) -// -// (C) Ximian, Inc. http://www.ximian.com -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -namespace System -{ - [Serializable] - [System.Runtime.InteropServices.ComVisible (true)] - public struct Void - { - } -} diff --git a/mcs/class/corlib/Test/System.IO/FileTest.cs b/mcs/class/corlib/Test/System.IO/FileTest.cs index cae81469ae..943ad91c6b 100644 --- a/mcs/class/corlib/Test/System.IO/FileTest.cs +++ b/mcs/class/corlib/Test/System.IO/FileTest.cs @@ -146,9 +146,26 @@ namespace MonoTests.System.IO } } + internal const string LIBC = "libc"; + // geteuid(2) + // uid_t geteuid(void); + [DllImport (LIBC, SetLastError=true)] + static extern uint geteuid (); + + static bool RunningAsRoot // FIXME? + { + get { + //return RunningOnUnix && System.Security.WindowsIdentity.GetCurrentToken () == IntPtr.Zero; + return RunningOnUnix && geteuid () == 0; + } + } + [Test] public void Create_Path_ReadOnly () { + if (RunningAsRoot) // FIXME? + Assert.Ignore ("Setting readonly in Mono does not block root writes."); + string path = Path.Combine (tmpFolder, "foo"); File.Create (path).Close (); File.SetAttributes (path, FileAttributes.ReadOnly); @@ -169,6 +186,8 @@ namespace MonoTests.System.IO [Test] public void Create_Path_Whitespace () { + // FIXME? This is valid on Unix and can work on Windows. + // This test and Mono have in mind an incorrect low common denominator. try { File.Create (" "); Assert.Fail ("#1"); @@ -619,6 +638,9 @@ namespace MonoTests.System.IO [Test] public void GetAttributes_ReadOnly () { + if (RunningAsRoot) // FIXME? + Assert.Ignore ("Setting readonly in Mono does not block root writes."); + FileAttributes attrs; string path = Path.Combine (tmpFolder, "GetAttributes.tmp"); diff --git a/mcs/class/corlib/Test/System.Reflection/CustomAttributeDataTest.cs b/mcs/class/corlib/Test/System.Reflection/CustomAttributeDataTest.cs index f4928a9d03..925b31e3cd 100644 --- a/mcs/class/corlib/Test/System.Reflection/CustomAttributeDataTest.cs +++ b/mcs/class/corlib/Test/System.Reflection/CustomAttributeDataTest.cs @@ -31,6 +31,7 @@ using NUnit.Framework; using System; using System.Reflection; using System.Collections.Generic; +using System.Runtime.InteropServices; namespace MonoTests.System.Reflection { @@ -42,10 +43,24 @@ namespace MonoTests.System.Reflection [TestFixture] public class CustomAttributeDataTest { + [MarshalAs (UnmanagedType.LPStr)] + [NonSerialized] + public string fieldDecoratedWithPseudoCustomAttributes = "test"; + [Attr (new byte [] { 1, 2 })] public void MethodWithAttr () { } + public void MethodWithParamDecoratedWithPseudoCustomAttributes ([Optional, In, Out, MarshalAs (UnmanagedType.LPStr)] String s) + { + } + + [return: MarshalAs (UnmanagedType.LPStr)] + public string MethodWithReturnValueDecoratedWithMarshalAs () + { + return "test"; + } + [Test] [Category ("MobileNotWorking")] // #10263 public void Arrays () { @@ -60,5 +75,63 @@ namespace MonoTests.System.Reflection Assert.AreEqual (typeof (byte), arr [1].ArgumentType); Assert.AreEqual (2, arr [1].Value); } + + [Test] + public void ParameterIncludesPseudoCustomAttributesData () + { + var methodInfo = typeof (CustomAttributeDataTest).GetMethod ("MethodWithParamDecoratedWithPseudoCustomAttributes"); + var paramInfo = methodInfo.GetParameters () [0]; + var customAttributesData = CustomAttributeData.GetCustomAttributes (paramInfo); + + Assert.AreEqual (4, customAttributesData.Count); + + var inAttributeData = customAttributesData [0]; + var optionalAttributeData = customAttributesData [1]; + var outAttributeData = customAttributesData [2]; + var marshalAsAttributeData = customAttributesData [3]; + + var marshalAsAttributeCtorArg = marshalAsAttributeData.ConstructorArguments [0]; + + Assert.AreEqual (typeof (InAttribute), inAttributeData.AttributeType); + Assert.AreEqual (typeof (OptionalAttribute), optionalAttributeData.AttributeType); + Assert.AreEqual (typeof (OutAttribute), outAttributeData.AttributeType); + + Assert.AreEqual (typeof (MarshalAsAttribute), marshalAsAttributeData.AttributeType); + Assert.AreEqual (typeof (UnmanagedType), marshalAsAttributeCtorArg.ArgumentType); + Assert.AreEqual (UnmanagedType.LPStr, marshalAsAttributeCtorArg.Value); + } + + [Test] + public void FieldIncludesPseudoCustomAttributesData () + { + var fieldInfo = typeof (CustomAttributeDataTest).GetField ("fieldDecoratedWithPseudoCustomAttributes"); + var customAttributesData = CustomAttributeData.GetCustomAttributes (fieldInfo); + + Assert.AreEqual (2, customAttributesData.Count); + + var nonSerializedAttributeData = customAttributesData [0]; + var marshalAsAttributeData = customAttributesData [1]; + var marshalAsAttributeDataCtorArg = marshalAsAttributeData.ConstructorArguments [0]; + + Assert.AreEqual (typeof (NonSerializedAttribute), nonSerializedAttributeData.AttributeType); + Assert.AreEqual (typeof (MarshalAsAttribute), marshalAsAttributeData.AttributeType); + Assert.AreEqual (typeof (UnmanagedType), marshalAsAttributeDataCtorArg.ArgumentType); + Assert.AreEqual (UnmanagedType.LPStr, marshalAsAttributeDataCtorArg.Value); + } + + [Test] + public void MethodIncludesMarshalAsAttributeData () + { + var methodInfo = typeof (CustomAttributeDataTest).GetMethod ("MethodWithReturnValueDecoratedWithMarshalAs"); + var paramInfo = (ParameterInfo)methodInfo.ReturnTypeCustomAttributes; + var customAttributesData = CustomAttributeData.GetCustomAttributes (paramInfo); + var marshalAsAttributeData = customAttributesData [0]; + var ctorArg = marshalAsAttributeData.ConstructorArguments [0]; + + Assert.AreEqual (1, customAttributesData.Count); + Assert.AreEqual (typeof (MarshalAsAttribute), marshalAsAttributeData.AttributeType); + Assert.AreEqual (typeof (UnmanagedType), ctorArg.ArgumentType); + Assert.AreEqual (UnmanagedType.LPStr, ctorArg.Value); + } } } diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs index 63c3ce1e3a..3094b15f99 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CapiTest.cs @@ -29,6 +29,9 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates { // is similar to the one provided by CAPI. [TestFixture] + // We are throwing `PlatformNotSupportedException`. + // See https://github.com/mono/mono/pull/9472#issuecomment-404006558 for details. + [Category ("NotWorking")] public class X509CAPI { // copied from X509Certificate for test uses only diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateCas.cs b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateCas.cs index b2cef56746..cef6d1c32f 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateCas.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateCas.cs @@ -42,6 +42,7 @@ namespace MonoCasTests.System.Security.Cryptography.X509Certificates { [TestFixture] [Category ("CAS")] + [Category ("X509Certificates")] public class X509CertificateCas { private static readonly byte[] cert = { 0x30,0x82,0x01,0xFF,0x30,0x82,0x01,0x6C,0x02,0x05,0x02,0x72,0x00,0x06,0xE8,0x30,0x0D,0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,0x05,0x00,0x30,0x5F,0x31,0x0B,0x30,0x09,0x06,0x03,0x55,0x04,0x06,0x13,0x02,0x55,0x53,0x31,0x20,0x30,0x1E,0x06,0x03,0x55,0x04,0x0A,0x13,0x17,0x52,0x53,0x41,0x20,0x44,0x61,0x74,0x61,0x20,0x53,0x65,0x63,0x75,0x72,0x69,0x74,0x79,0x2C,0x20,0x49,0x6E,0x63,0x2E,0x31,0x2E,0x30,0x2C,0x06,0x03,0x55,0x04,0x0B,0x13,0x25,0x53,0x65,0x63,0x75,0x72,0x65,0x20,0x53,0x65,0x72,0x76, diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateTest.cs.REMOVED.git-id b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateTest.cs.REMOVED.git-id index 1bf84f5188..0b1be1514b 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateTest.cs.REMOVED.git-id +++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509CertificateTest.cs.REMOVED.git-id @@ -1 +1 @@ -634dda0599c90556f1d6a23661203f22d01cbfa3 \ No newline at end of file +aa0f9e9a5afdd4397e18bae68a24eb10da0d5cd0 \ No newline at end of file diff --git a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509SpcTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509SpcTest.cs index 1bdc4ae2b8..c1f17901f5 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509SpcTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509SpcTest.cs @@ -1016,6 +1016,7 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates { } [Test] + [Category ("NotWorking")] // we are now throwing due to the invalid signature public void InvalidSignature () { string filename = Path.Combine (Path.GetTempPath (), "smallspc-invalid.exe"); diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTestBase.cs b/mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTestBase.cs index fdcb608833..884724a16b 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTestBase.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTestBase.cs @@ -467,6 +467,43 @@ public abstract class HashAlgorithmTestBase { hash.TransformFinalBlock (input, 0, input.Length); Assert.IsNotNull (hash.Hash); } + + [Test] + public void Hash_NoExternalChanges () + { + byte[] input = new byte [512]; + for (int i = 0; i < input.Length; i++) + input[i] = (byte)(i % 0xFF); + hash.TransformFinalBlock (input, 0, input.Length); + + byte[] brokenHash = hash.Hash; + Array.Clear (brokenHash, 0, brokenHash.Length); + + // if the byte array is returned as a ref, both instance will be cleared. + Assert.AreNotEqual (hash.Hash, brokenHash, "ExternalChanges"); + } + + [Test] + [ExpectedException (typeof (ObjectDisposedException))] + public void Hash_DisposedException () + { + hash.Dispose (); + // should fail since the hash object is disposed. + Assert.IsNull (hash.Hash); + } + + [Test] + [ExpectedException (typeof (CryptographicUnexpectedOperationException))] + public void Hash_StateExeception () + { + hash.Initialize (); + byte[] input = new byte [8]; + byte[] output = new byte [8]; + hash.TransformBlock (input, 0, input.Length, output, 0); + + // should fail with CryptographicUnexpectedOperationException as TransformFinalBlock was not called. + Assert.IsNull (hash.Hash); + } } } diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs index c2996d455a..943227ac64 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography/RSAPKCS1SignatureDeformatterTest.cs @@ -363,14 +363,14 @@ namespace MonoTests.System.Security.Cryptography { badSignature[0] = (byte) ~md5Signature [0]; HashAlgorithm hash = MD5.Create (); try { - fmt.VerifySignature (hash, md5Signature); + fmt.VerifySignature (hash, badSignature); Assert.Fail ("VerifyBadSignatureMD5Hash - Expected CryptographicUnexpectedOperationException but none"); } catch (CryptographicUnexpectedOperationException) { // this was expected } catch (NullReferenceException) { - // this wasn't expected - but that's the result from framework 1.1 + // this wasn't expected - but that's the result from .NET Framework } catch (Exception e) { Assert.Fail ("VerifyBadSignatureMD5Hash - Expected CryptographicUnexpectedOperationException but got: " + e.ToString ()); @@ -385,14 +385,14 @@ namespace MonoTests.System.Security.Cryptography { byte[] badSignature = new byte [md5Signature.Length-1]; HashAlgorithm hash = MD5.Create (); try { - fmt.VerifySignature (hash, md5Signature); + fmt.VerifySignature (hash, badSignature); Assert.Fail ("VerifySignatureMD5HashBadSignatureLength - Expected CryptographicUnexpectedOperationException but none"); } catch (CryptographicUnexpectedOperationException) { // this was expected } catch (NullReferenceException) { - // this wasn't expected - but that's the result from framework 1.1 + // this wasn't expected - but that's the result from .NET Framework } catch (Exception e) { Assert.Fail ("VerifySignatureMD5HashBadSignatureLength - Expected CryptographicUnexpectedOperationException but got: " + e.ToString ()); diff --git a/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs b/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs deleted file mode 100644 index 12e5025f01..0000000000 --- a/mcs/class/corlib/Test/System.Security.Policy/PublisherMembershipConditionTest.cs +++ /dev/null @@ -1,312 +0,0 @@ -// -// PublisherMembershipConditionTest.cs - -// NUnit Test Cases for PublisherMembershipCondition -// -// Author: -// Sebastien Pouliot -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using NUnit.Framework; -using System; -using System.Collections; -using System.Security; -using System.Security.Cryptography.X509Certificates; -using System.Security.Policy; - -namespace MonoTests.System.Security.Policy { - - [TestFixture] - public class PublisherMembershipConditionTest { - - static byte[] msSpCert = { 0x30, 0x82, 0x05, 0x0F, 0x30, 0x82, 0x03, 0xF7, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x0A, 0x61, 0x07, 0x11, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81, 0xA6, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x30, 0x20, 0x4D, 0x69, 0x63, 0x72, - 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x23, 0x30, 0x21, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1A, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x53, 0x69, 0x67, 0x6E, 0x69, 0x6E, 0x67, 0x20, 0x50, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x32, 0x30, 0x35, 0x32, 0x35, 0x30, 0x30, 0x35, 0x35, 0x34, 0x38, 0x5A, 0x17, 0x0D, 0x30, 0x33, 0x31, 0x31, 0x32, 0x35, 0x30, 0x31, 0x30, 0x35, 0x34, 0x38, 0x5A, 0x30, 0x81, 0xA1, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, - 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x32, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xAA, 0x99, 0xBD, 0x39, 0xA8, 0x18, 0x27, 0xF4, 0x2B, 0x3D, 0x0B, 0x4C, 0x3F, 0x7C, 0x77, 0x2E, 0xA7, 0xCB, 0xB5, 0xD1, 0x8C, 0x0D, 0xC2, 0x3A, 0x74, 0xD7, 0x93, 0xB5, 0xE0, 0xA0, 0x4B, 0x3F, 0x59, 0x5E, 0xCE, 0x45, 0x4F, 0x9A, 0x79, 0x29, 0xF1, 0x49, 0xCC, 0x1A, 0x47, 0xEE, 0x55, 0xC2, 0x08, - 0x3E, 0x12, 0x20, 0xF8, 0x55, 0xF2, 0xEE, 0x5F, 0xD3, 0xE0, 0xCA, 0x96, 0xBC, 0x30, 0xDE, 0xFE, 0x58, 0xC8, 0x27, 0x32, 0xD0, 0x85, 0x54, 0xE8, 0xF0, 0x91, 0x10, 0xBB, 0xF3, 0x2B, 0xBE, 0x19, 0xE5, 0x03, 0x9B, 0x0B, 0x86, 0x1D, 0xF3, 0xB0, 0x39, 0x8C, 0xB8, 0xFD, 0x0B, 0x1D, 0x3C, 0x73, 0x26, 0xAC, 0x57, 0x2B, 0xCA, 0x29, 0xA2, 0x15, 0x90, 0x82, 0x15, 0xE2, 0x77, 0xA3, 0x40, 0x52, 0x03, 0x8B, 0x9D, 0xC2, 0x70, 0xBA, 0x1F, 0xE9, 0x34, 0xF6, 0xF3, 0x35, 0x92, 0x4E, 0x55, 0x83, 0xF8, 0xDA, 0x30, 0xB6, 0x20, 0xDE, 0x57, 0x06, 0xB5, 0x5A, 0x42, 0x06, 0xDE, 0x59, 0xCB, 0xF2, 0xDF, 0xA6, 0xBD, 0x15, 0x47, 0x71, 0x19, 0x25, 0x23, 0xD2, 0xCB, 0x6F, 0x9B, 0x19, 0x79, 0xDF, 0x6A, 0x5B, 0xF1, 0x76, 0x05, 0x79, 0x29, 0xFC, 0xC3, 0x56, 0xCA, 0x8F, 0x44, 0x08, 0x85, 0x55, 0x8A, 0xCB, 0xC8, 0x0F, 0x46, 0x4B, 0x55, 0xCB, 0x8C, 0x96, 0x77, 0x4A, 0x87, 0xE8, 0xA9, 0x41, 0x06, 0xC7, 0xFF, 0x0D, 0xE9, 0x68, 0x57, 0x63, 0x72, 0xC3, 0x69, 0x57, 0xB4, 0x43, 0xCF, 0x32, 0x3A, 0x30, 0xDC, - 0x1B, 0xE9, 0xD5, 0x43, 0x26, 0x2A, 0x79, 0xFE, 0x95, 0xDB, 0x22, 0x67, 0x24, 0xC9, 0x2F, 0xD0, 0x34, 0xE3, 0xE6, 0xFB, 0x51, 0x49, 0x86, 0xB8, 0x3C, 0xD0, 0x25, 0x5F, 0xD6, 0xEC, 0x9E, 0x03, 0x61, 0x87, 0xA9, 0x68, 0x40, 0xC7, 0xF8, 0xE2, 0x03, 0xE6, 0xCF, 0x05, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x40, 0x30, 0x82, 0x01, 0x3C, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x06, 0xC0, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x6B, 0xC8, 0xC6, 0x51, 0x20, 0xF0, 0xB4, 0x2F, 0xD3, 0xA0, 0xB6, 0xAE, 0x7F, 0x5E, 0x26, 0xB2, 0xB8, 0x87, 0x52, 0x29, 0x30, 0x81, 0xA9, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x81, 0xA1, 0x30, 0x81, 0x9E, 0x80, 0x14, 0x29, 0x5C, 0xB9, 0x1B, 0xB6, 0xCD, 0x33, 0xEE, 0xBB, 0x9E, 0x59, 0x7D, 0xF7, 0xE5, 0xCA, 0x2E, 0xC4, 0x0D, 0x34, 0x28, 0xA1, 0x74, - 0xA4, 0x72, 0x30, 0x70, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x82, 0x10, 0x6A, 0x0B, 0x99, 0x4F, 0xC0, 0x00, 0xDE, 0xAA, 0x11, 0xD4, 0xD8, 0x40, 0x9A, 0xA8, 0xBE, 0xE6, 0x30, 0x4A, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x43, 0x30, 0x41, 0x30, 0x3F, 0xA0, 0x3D, 0xA0, 0x3B, 0x86, 0x39, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x63, 0x72, 0x6C, - 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x2F, 0x63, 0x72, 0x6C, 0x2F, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, 0x43, 0x6F, 0x64, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x50, 0x43, 0x41, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x35, 0x23, 0xFD, 0x13, 0x54, 0xFC, 0xE9, 0xDC, 0xF0, 0xDD, 0x0C, 0x14, 0x7A, 0xFA, 0xA7, 0xB3, 0xCE, 0xFD, 0xA7, 0x3A, 0xC8, 0xBA, 0xE5, 0xE7, 0xF6, 0x03, 0xFB, 0x53, 0xDB, 0xA7, 0x99, 0xA9, 0xA0, 0x9B, 0x36, 0x9C, 0x03, 0xEB, 0x82, 0x47, 0x1C, 0x21, 0xBD, 0x14, 0xCB, 0xE7, 0x67, 0x40, 0x09, 0xC7, 0x16, 0x91, 0x02, 0x55, 0xCE, 0x43, 0x42, 0xB4, 0xCD, 0x1B, 0x5D, 0xB0, 0xF3, 0x32, 0x04, 0x3D, 0x12, 0xE5, 0x1D, 0xA7, 0x07, 0xA7, 0x8F, 0xA3, 0x7E, 0x45, 0x55, 0x76, 0x1B, 0x96, 0x95, 0x91, 0x69, 0xF0, 0xDD, 0x38, 0xF3, 0x48, 0x89, 0xEF, 0x70, 0x40, 0xB7, 0xDB, 0xB5, 0x55, - 0x80, 0xC0, 0x03, 0xC4, 0x2E, 0xB6, 0x28, 0xDC, 0x0A, 0x82, 0x0E, 0xC7, 0x43, 0xE3, 0x7A, 0x48, 0x5D, 0xB8, 0x06, 0x89, 0x92, 0x40, 0x6C, 0x6E, 0xC5, 0xDC, 0xF8, 0x9A, 0xEF, 0x0B, 0xBE, 0x21, 0x0A, 0x8C, 0x2F, 0x3A, 0xB5, 0xED, 0xA7, 0xCE, 0x71, 0x87, 0x68, 0x23, 0xE1, 0xB3, 0xE4, 0x18, 0x7D, 0xB8, 0x47, 0x01, 0xA5, 0x2B, 0xC4, 0x58, 0xCB, 0xB2, 0x89, 0x6C, 0x5F, 0xFD, 0xD3, 0x2C, 0xC4, 0x6F, 0xB8, 0x23, 0xB2, 0x0D, 0xFF, 0x3C, 0xF2, 0x11, 0x45, 0x74, 0xF2, 0x09, 0x06, 0x99, 0x18, 0xDD, 0x6F, 0xC0, 0x86, 0x01, 0x18, 0x12, 0x1D, 0x2B, 0x16, 0xAF, 0x56, 0xEF, 0x65, 0x33, 0xA1, 0xEA, 0x67, 0x4E, 0xF4, 0x4B, 0x82, 0xAB, 0xE9, 0x0F, 0xDC, 0x01, 0xFA, 0xDF, 0x60, 0x7F, 0x66, 0x47, 0x5D, 0xCB, 0x2C, 0x70, 0xCC, 0x7B, 0x4E, 0xD9, 0x06, 0xB8, 0x6E, 0x8C, 0x0C, 0xFE, 0x62, 0x1E, 0x42, 0xF9, 0x93, 0x7C, 0xA2, 0xAB, 0x0A, 0x9E, 0xD0, 0x23, 0x10, 0xAE, 0x4D, 0x7B, 0x27, 0x91, 0x6F, 0x26, 0xBE, 0x68, 0xFA, 0xA6, 0x3F, 0x9F, 0x23, 0xEB, 0xC8, 0x9D, 0xBB, 0x87 }; - - static X509Certificate x509; - - [TestFixtureSetUp] - public void FixtureSetUp () - { - x509 = new X509Certificate (msSpCert); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void NullConstructor () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (null); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void NullCertificate () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - pmc.Certificate = null; - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void InvalidConstructor () - { - byte[] n = null; - // having an empty certificate always break down things - X509Certificate x509 = new X509Certificate (n); - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - } - - [Test] - public void Constructor () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - Assert.IsTrue (pmc.Certificate.Equals (x509), "Certificate"); - } - - [Test] - public void Check () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - Publisher p = new Publisher (x509); - - Evidence e = null; - Assert.IsFalse (pmc.Check (e), "Check (null)"); - e = new Evidence (); - Assert.IsFalse (pmc.Check (e), "Check (empty)"); - e.AddHost (new Zone (SecurityZone.MyComputer)); - Assert.IsFalse (pmc.Check (e), "Check (zone)"); - e.AddAssembly (p); - Assert.IsFalse (pmc.Check (e), "Check (x509-assembly)"); - - e = new Evidence (); - e.AddHost (p); - Assert.IsTrue (pmc.Check (e), "Check (x509-host)"); - } - - [Test] - public void Copy () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - PublisherMembershipCondition pmcCopy = (PublisherMembershipCondition) pmc.Copy (); - - Assert.IsNotNull (pmcCopy.Certificate, "Copy-Cert"); - Assert.IsTrue (pmc.Equals (pmcCopy), "Copy-Equals"); - Assert.AreEqual (pmc.GetHashCode (), pmcCopy.GetHashCode (), "Copy-GetHashCode"); - Assert.AreEqual (pmc.ToString (), pmcCopy.ToString (), "Copy-ToString"); - } - - [Test] - public void Equals () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - Assert.IsFalse (pmc.Equals (null), "Equals(null)"); - Assert.IsFalse (pmc.Equals (new object ()), "Equals (object)"); - - PublisherMembershipCondition p2 = new PublisherMembershipCondition (x509); - Assert.IsTrue (pmc.Equals (p2), "Equals(p2)"); - Assert.IsTrue (p2.Equals (pmc), "Equals(hash)"); - } - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void FromXml_Null () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - pmc.FromXml (null); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void FromXml_Invalid () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - SecurityElement se = pmc.ToXml (); - se.Tag = "IMonoship"; - pmc.FromXml (se); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void FromXml_InvalidTag () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - SecurityElement se = pmc.ToXml (); - se.Tag = "IMonoship"; - pmc.FromXml (se); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void FromXml_WrongTagCase () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - SecurityElement se = pmc.ToXml (); - se.Tag = "IMEMBERSHIPCONDITION"; // instehash of IMembershipCondition - pmc.FromXml (se); - } - - [Test] - public void FromXml_InvalidClass () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - SecurityElement se = pmc.ToXml (); - se.Attributes ["class"] = "Hello world"; - pmc.FromXml (se); - } - - [Test] - public void FromXml_NoClass () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - SecurityElement se = pmc.ToXml (); - - SecurityElement w = new SecurityElement (se.Tag); - w.AddAttribute ("version", se.Attribute ("version")); - pmc.FromXml (w); - // doesn't even care of the class attribute presence - } - - [Test] - public void FromXml_InvalidVersion () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - SecurityElement se = pmc.ToXml (); - - SecurityElement w = new SecurityElement (se.Tag); - w.AddAttribute ("class", se.Attribute ("class")); - w.AddAttribute ("version", "2"); - pmc.FromXml (w); - // doesn't seems to care about the version number! - } - - [Test] - public void FromXml_NoVersion () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - SecurityElement se = pmc.ToXml (); - - SecurityElement w = new SecurityElement (se.Tag); - w.AddAttribute ("class", se.Attribute ("class")); - pmc.FromXml (w); - } - - [Test] -#if MOBILE - [Ignore] -#endif - [ExpectedException (typeof (ArgumentNullException))] - public void FromXml_SecurityElementNull () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - pmc.FromXml (null, PolicyLevel.CreateAppDomainLevel ()); - } - - [Test] -#if MOBILE - [ExpectedException (typeof (NotSupportedException))] -#endif - public void FromXml_PolicyLevel () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - SecurityElement se = pmc.ToXml (); - // is it accepted for all policy levels ? - IEnumerator e = SecurityManager.PolicyHierarchy (); - while (e.MoveNext ()) - { - PolicyLevel pl = e.Current as PolicyLevel; - pmc.FromXml (se, pl); - Assert.IsTrue (x509.Equals (pmc.Certificate), "FromXml(PolicyLevel='" + pl.Label + "')"); - } - // yes! - } - - [Test] - public void GetHashCode_ () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - PublisherMembershipCondition copy = (PublisherMembershipCondition)pmc.Copy (); - Assert.AreEqual (pmc.GetHashCode (), copy.GetHashCode (), "GetHashCode"); - Assert.AreEqual (x509.GetHashCode (), pmc.GetHashCode (), "GetHashCode-X509Certificate"); - } - - [Test] - public void ToString_ () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - string s = "Publisher - 3082010A0282010100AA99BD39A81827F42B3D0B4C3F7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203010001"; - Assert.AreEqual (s, pmc.ToString (), "ToString"); - } - - [Test] - public void ToXml_Null () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - // no ArgumentNullException here - SecurityElement se = pmc.ToXml (null); - Assert.IsNotNull (se, "ToXml(null)"); - } - - [Test] -#if MOBILE - [ExpectedException (typeof (NotSupportedException))] -#endif - public void ToXmlPolicyLevel () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - string s = pmc.ToXml ().ToString (); - // are they all the same ? - IEnumerator e = SecurityManager.PolicyHierarchy (); - while (e.MoveNext ()) { - PolicyLevel pl = e.Current as PolicyLevel; - Assert.AreEqual (s, pmc.ToXml (pl).ToString (), "ToXml(PolicyLevel='" + pl.Label + "')"); - } - // yes! - } - - [Test] - public void ToFromXmlRoundTrip () - { - PublisherMembershipCondition pmc = new PublisherMembershipCondition (x509); - SecurityElement se = pmc.ToXml (); - - string expectedXmlFragment = "X509Certificate=\"3082050F308203F7A003020102020A61071143000000000034300D06092A864886F70D01010505003081A6310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F7079726967687420"; - expectedXmlFragment += "2863292032303030204D6963726F736F667420436F72702E312330210603550403131A4D6963726F736F667420436F6465205369676E696E6720504341301E170D3032303532353030353534385A170D3033313132353031303534385A3081A1310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303032204D6963726F736F667420436F72702E311E301C060355040313154D6963726F736F667420436F72706F726174696F6E30820122300D06092A864886F70D010101"; - expectedXmlFragment += "05000382010F003082010A0282010100AA99BD39A81827F42B3D0B4C3F7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203"; - expectedXmlFragment += "010001A38201403082013C300E0603551D0F0101FF0404030206C030130603551D25040C300A06082B06010505070303301D0603551D0E041604146BC8C65120F0B42FD3A0B6AE7F5E26B2B88752293081A90603551D230481A130819E8014295CB91BB6CD33EEBB9E597DF7E5CA2EC40D3428A174A4723070312B3029060355040B1322436F70797269676874202863292031393937204D6963726F736F667420436F72702E311E301C060355040B13154D6963726F736F667420436F72706F726174696F6E3121301F060355040313184D6963726F736F667420526F6F7420417574686F7269747982106A0B994FC000DEAA11D4D8409AA8BEE6304A0603551D1F04433041303FA03DA03B863968747470"; - expectedXmlFragment += "3A2F2F63726C2E6D6963726F736F66742E636F6D2F706B692F63726C2F70726F64756374732F436F64655369676E5043412E63726C300D06092A864886F70D010105050003820101003523FD1354FCE9DCF0DD0C147AFAA7B3CEFDA73AC8BAE5E7F603FB53DBA799A9A09B369C03EB82471C21BD14CBE7674009C716910255CE4342B4CD1B5DB0F332043D12E51DA707A78FA37E4555761B96959169F0DD38F34889EF7040B7DBB55580C003C42EB628DC0A820EC743E37A485DB8068992406C6EC5DCF89AEF0BBE210A8C2F3AB5EDA7CE71876823E1B3E4187DB84701A52BC458CBB2896C5FFDD32CC46FB823B20DFF3CF2114574F209069918DD6FC0860118121D2B16AF56EF6533A1EA674EF44B82ABE9"; - expectedXmlFragment += "0FDC01FADF607F66475DCB2C70CC7B4ED906B86E8C0CFE621E42F9937CA2AB0A9ED02310AE4D7B27916F26BE68FAA63F9F23EBC89DBB87\"/>{0}"; - expectedXmlFragment = String.Format (expectedXmlFragment, Environment.NewLine); - Assert.AreEqual ("IMembershipCondition", se.Tag, "ToXml().Tag"); - Assert.IsTrue (se.ToString ().EndsWith (expectedXmlFragment), "ToXml().ToString()"); - - pmc.FromXml (se); - Assert.AreEqual (x509.GetHashCode (), pmc.Certificate.GetHashCode (), "XmlCertificate"); - } - } -} diff --git a/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs b/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs deleted file mode 100644 index 35608e5929..0000000000 --- a/mcs/class/corlib/Test/System.Security.Policy/PublisherTest.cs +++ /dev/null @@ -1,111 +0,0 @@ -// -// PublisherTest.cs - NUnit Test Cases for Publisher -// -// Author: -// Sebastien Pouliot -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using NUnit.Framework; -using System; -using System.Security; -using System.Security.Cryptography.X509Certificates; -using System.Security.Permissions; -using System.Security.Policy; - -namespace MonoTests.System.Security.Policy { - - [TestFixture] - public class PublisherTest { - - static byte[] msSpCert = { 0x30, 0x82, 0x05, 0x0F, 0x30, 0x82, 0x03, 0xF7, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x0A, 0x61, 0x07, 0x11, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81, 0xA6, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x30, 0x20, 0x4D, 0x69, 0x63, 0x72, - 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x23, 0x30, 0x21, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1A, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x64, 0x65, 0x20, 0x53, 0x69, 0x67, 0x6E, 0x69, 0x6E, 0x67, 0x20, 0x50, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x32, 0x30, 0x35, 0x32, 0x35, 0x30, 0x30, 0x35, 0x35, 0x34, 0x38, 0x5A, 0x17, 0x0D, 0x30, 0x33, 0x31, 0x31, 0x32, 0x35, 0x30, 0x31, 0x30, 0x35, 0x34, 0x38, 0x5A, 0x30, 0x81, 0xA1, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0A, 0x57, 0x61, 0x73, 0x68, 0x69, 0x6E, 0x67, 0x74, 0x6F, 0x6E, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x52, 0x65, 0x64, 0x6D, 0x6F, 0x6E, 0x64, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, - 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x32, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xAA, 0x99, 0xBD, 0x39, 0xA8, 0x18, 0x27, 0xF4, 0x2B, 0x3D, 0x0B, 0x4C, 0x3F, 0x7C, 0x77, 0x2E, 0xA7, 0xCB, 0xB5, 0xD1, 0x8C, 0x0D, 0xC2, 0x3A, 0x74, 0xD7, 0x93, 0xB5, 0xE0, 0xA0, 0x4B, 0x3F, 0x59, 0x5E, 0xCE, 0x45, 0x4F, 0x9A, 0x79, 0x29, 0xF1, 0x49, 0xCC, 0x1A, 0x47, 0xEE, 0x55, 0xC2, 0x08, - 0x3E, 0x12, 0x20, 0xF8, 0x55, 0xF2, 0xEE, 0x5F, 0xD3, 0xE0, 0xCA, 0x96, 0xBC, 0x30, 0xDE, 0xFE, 0x58, 0xC8, 0x27, 0x32, 0xD0, 0x85, 0x54, 0xE8, 0xF0, 0x91, 0x10, 0xBB, 0xF3, 0x2B, 0xBE, 0x19, 0xE5, 0x03, 0x9B, 0x0B, 0x86, 0x1D, 0xF3, 0xB0, 0x39, 0x8C, 0xB8, 0xFD, 0x0B, 0x1D, 0x3C, 0x73, 0x26, 0xAC, 0x57, 0x2B, 0xCA, 0x29, 0xA2, 0x15, 0x90, 0x82, 0x15, 0xE2, 0x77, 0xA3, 0x40, 0x52, 0x03, 0x8B, 0x9D, 0xC2, 0x70, 0xBA, 0x1F, 0xE9, 0x34, 0xF6, 0xF3, 0x35, 0x92, 0x4E, 0x55, 0x83, 0xF8, 0xDA, 0x30, 0xB6, 0x20, 0xDE, 0x57, 0x06, 0xB5, 0x5A, 0x42, 0x06, 0xDE, 0x59, 0xCB, 0xF2, 0xDF, 0xA6, 0xBD, 0x15, 0x47, 0x71, 0x19, 0x25, 0x23, 0xD2, 0xCB, 0x6F, 0x9B, 0x19, 0x79, 0xDF, 0x6A, 0x5B, 0xF1, 0x76, 0x05, 0x79, 0x29, 0xFC, 0xC3, 0x56, 0xCA, 0x8F, 0x44, 0x08, 0x85, 0x55, 0x8A, 0xCB, 0xC8, 0x0F, 0x46, 0x4B, 0x55, 0xCB, 0x8C, 0x96, 0x77, 0x4A, 0x87, 0xE8, 0xA9, 0x41, 0x06, 0xC7, 0xFF, 0x0D, 0xE9, 0x68, 0x57, 0x63, 0x72, 0xC3, 0x69, 0x57, 0xB4, 0x43, 0xCF, 0x32, 0x3A, 0x30, 0xDC, - 0x1B, 0xE9, 0xD5, 0x43, 0x26, 0x2A, 0x79, 0xFE, 0x95, 0xDB, 0x22, 0x67, 0x24, 0xC9, 0x2F, 0xD0, 0x34, 0xE3, 0xE6, 0xFB, 0x51, 0x49, 0x86, 0xB8, 0x3C, 0xD0, 0x25, 0x5F, 0xD6, 0xEC, 0x9E, 0x03, 0x61, 0x87, 0xA9, 0x68, 0x40, 0xC7, 0xF8, 0xE2, 0x03, 0xE6, 0xCF, 0x05, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x40, 0x30, 0x82, 0x01, 0x3C, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x06, 0xC0, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x6B, 0xC8, 0xC6, 0x51, 0x20, 0xF0, 0xB4, 0x2F, 0xD3, 0xA0, 0xB6, 0xAE, 0x7F, 0x5E, 0x26, 0xB2, 0xB8, 0x87, 0x52, 0x29, 0x30, 0x81, 0xA9, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x81, 0xA1, 0x30, 0x81, 0x9E, 0x80, 0x14, 0x29, 0x5C, 0xB9, 0x1B, 0xB6, 0xCD, 0x33, 0xEE, 0xBB, 0x9E, 0x59, 0x7D, 0xF7, 0xE5, 0xCA, 0x2E, 0xC4, 0x0D, 0x34, 0x28, 0xA1, 0x74, - 0xA4, 0x72, 0x30, 0x70, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x82, 0x10, 0x6A, 0x0B, 0x99, 0x4F, 0xC0, 0x00, 0xDE, 0xAA, 0x11, 0xD4, 0xD8, 0x40, 0x9A, 0xA8, 0xBE, 0xE6, 0x30, 0x4A, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x43, 0x30, 0x41, 0x30, 0x3F, 0xA0, 0x3D, 0xA0, 0x3B, 0x86, 0x39, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x63, 0x72, 0x6C, - 0x2E, 0x6D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x70, 0x6B, 0x69, 0x2F, 0x63, 0x72, 0x6C, 0x2F, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, 0x43, 0x6F, 0x64, 0x65, 0x53, 0x69, 0x67, 0x6E, 0x50, 0x43, 0x41, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x35, 0x23, 0xFD, 0x13, 0x54, 0xFC, 0xE9, 0xDC, 0xF0, 0xDD, 0x0C, 0x14, 0x7A, 0xFA, 0xA7, 0xB3, 0xCE, 0xFD, 0xA7, 0x3A, 0xC8, 0xBA, 0xE5, 0xE7, 0xF6, 0x03, 0xFB, 0x53, 0xDB, 0xA7, 0x99, 0xA9, 0xA0, 0x9B, 0x36, 0x9C, 0x03, 0xEB, 0x82, 0x47, 0x1C, 0x21, 0xBD, 0x14, 0xCB, 0xE7, 0x67, 0x40, 0x09, 0xC7, 0x16, 0x91, 0x02, 0x55, 0xCE, 0x43, 0x42, 0xB4, 0xCD, 0x1B, 0x5D, 0xB0, 0xF3, 0x32, 0x04, 0x3D, 0x12, 0xE5, 0x1D, 0xA7, 0x07, 0xA7, 0x8F, 0xA3, 0x7E, 0x45, 0x55, 0x76, 0x1B, 0x96, 0x95, 0x91, 0x69, 0xF0, 0xDD, 0x38, 0xF3, 0x48, 0x89, 0xEF, 0x70, 0x40, 0xB7, 0xDB, 0xB5, 0x55, - 0x80, 0xC0, 0x03, 0xC4, 0x2E, 0xB6, 0x28, 0xDC, 0x0A, 0x82, 0x0E, 0xC7, 0x43, 0xE3, 0x7A, 0x48, 0x5D, 0xB8, 0x06, 0x89, 0x92, 0x40, 0x6C, 0x6E, 0xC5, 0xDC, 0xF8, 0x9A, 0xEF, 0x0B, 0xBE, 0x21, 0x0A, 0x8C, 0x2F, 0x3A, 0xB5, 0xED, 0xA7, 0xCE, 0x71, 0x87, 0x68, 0x23, 0xE1, 0xB3, 0xE4, 0x18, 0x7D, 0xB8, 0x47, 0x01, 0xA5, 0x2B, 0xC4, 0x58, 0xCB, 0xB2, 0x89, 0x6C, 0x5F, 0xFD, 0xD3, 0x2C, 0xC4, 0x6F, 0xB8, 0x23, 0xB2, 0x0D, 0xFF, 0x3C, 0xF2, 0x11, 0x45, 0x74, 0xF2, 0x09, 0x06, 0x99, 0x18, 0xDD, 0x6F, 0xC0, 0x86, 0x01, 0x18, 0x12, 0x1D, 0x2B, 0x16, 0xAF, 0x56, 0xEF, 0x65, 0x33, 0xA1, 0xEA, 0x67, 0x4E, 0xF4, 0x4B, 0x82, 0xAB, 0xE9, 0x0F, 0xDC, 0x01, 0xFA, 0xDF, 0x60, 0x7F, 0x66, 0x47, 0x5D, 0xCB, 0x2C, 0x70, 0xCC, 0x7B, 0x4E, 0xD9, 0x06, 0xB8, 0x6E, 0x8C, 0x0C, 0xFE, 0x62, 0x1E, 0x42, 0xF9, 0x93, 0x7C, 0xA2, 0xAB, 0x0A, 0x9E, 0xD0, 0x23, 0x10, 0xAE, 0x4D, 0x7B, 0x27, 0x91, 0x6F, 0x26, 0xBE, 0x68, 0xFA, 0xA6, 0x3F, 0x9F, 0x23, 0xEB, 0xC8, 0x9D, 0xBB, 0x87 }; - - [Test] - [ExpectedException (typeof (ArgumentNullException))] - public void NullConstructor () - { - Publisher p = new Publisher (null); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void EmptyCertificateConstructor () - { - byte[] n = null; - X509Certificate x509 = new X509Certificate (n); - Publisher p = new Publisher (x509); - - Assert.AreEqual (x509.GetHashCode (), p.GetHashCode (), "GetHashCode"); - Assert.AreEqual ("" + Environment.NewLine + " " + Environment.NewLine + "" + Environment.NewLine, p.ToString (), "ToString"); - } - - [Test] - [ExpectedException (typeof (ArgumentException))] - public void EmptyCertificateConstructor2 () - { - byte[] n = null; - X509Certificate x509 = new X509Certificate (n); - Publisher p = new Publisher (x509); - x509 = p.Certificate; - } - - [Test] - public void Constructor () - { - X509Certificate x509 = new X509Certificate (msSpCert); - Publisher p = new Publisher (x509); - - Assert.AreEqual (x509.GetHashCode (), p.GetHashCode (), "GetHashCode"); - - IPermission ip = p.CreateIdentityPermission (null); - Assert.IsTrue ((ip is PublisherIdentityPermission), "CreateIdentityPermission"); - - string s = "" + Environment.NewLine; - s += "3082050F308203F7A003020102020A61071143000000000034300D06092A864886F70D01010505003081A6310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303030204D6963726F736F667420436F72702E312330210603550403131A4D6963726F736F667420436F6465205369676E696E6720504341301E170D3032303532353030353534385A170D3033313132353031303534385A3081A1310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303032204D6963726F736F667420436F72702E311E301C060355040313154D6963726F736F667420436F72706F726174696F6E30820122300D06092A864886F70D01010105000382010F003082010A0282010100AA99BD39A81827F42B3D0B4C3F"; - s += "7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203010001A38201403082013C300E0603551D0F0101FF0404030206C030130603551D25040C300A06082B06010505070303301D0603551D0E041604146BC8C65120F0B42FD3A0B6AE7F5E26B2B88752293081A90603551D230481A130819E8014295CB91BB6CD33EEBB9E597DF7E5CA2EC40D3428A174A4723070312B3029060355040B1322436F70797269676874202863292031393937204D6963726F736F667420436F72702E311E301C060355040B13154D6963726F736F667420436F72706F726174696F6E3121301F060355040313184D6963726F736F667420526F6F7420417574686F7269747982106A0B994FC000DEAA11D4D8"; - s += "409AA8BEE6304A0603551D1F04433041303FA03DA03B8639687474703A2F2F63726C2E6D6963726F736F66742E636F6D2F706B692F63726C2F70726F64756374732F436F64655369676E5043412E63726C300D06092A864886F70D010105050003820101003523FD1354FCE9DCF0DD0C147AFAA7B3CEFDA73AC8BAE5E7F603FB53DBA799A9A09B369C03EB82471C21BD14CBE7674009C716910255CE4342B4CD1B5DB0F332043D12E51DA707A78FA37E4555761B96959169F0DD38F34889EF7040B7DBB55580C003C42EB628DC0A820EC743E37A485DB8068992406C6EC5DCF89AEF0BBE210A8C2F3AB5EDA7CE71876823E1B3E4187DB84701A52BC458CBB2896C5FFDD32CC46FB823B20DFF3CF2114574F209069918DD6FC0860118121D2B16AF56EF6533A1EA674EF44B82ABE90FDC01FADF607F66475DCB2C70CC7B4ED906B86E8C0CFE621E42F9937CA2AB0A9ED02310AE4D7B27916F26BE68FAA63F9F23EBC89DBB87" + Environment.NewLine + "" + Environment.NewLine; - Assert.AreEqual (s, p.ToString (), "ToString"); - } - - [Test] - public void Copy () - { - X509Certificate x509 = new X509Certificate (msSpCert); - Publisher p = new Publisher (x509); - Publisher pCopy = (Publisher) p.Copy (); - - Assert.IsNotNull (pCopy.Certificate, "Copy-Cert"); - Assert.IsTrue (p.Equals (pCopy), "Copy-Equals"); - Assert.AreEqual (p.GetHashCode (), pCopy.GetHashCode (), "Copy-GetHashCode"); - Assert.AreEqual (p.ToString (), pCopy.ToString (), "Copy-ToString"); - } - } -} diff --git a/mcs/class/corlib/Test/System/ExceptionTest.cs b/mcs/class/corlib/Test/System/ExceptionTest.cs index 36f37e9c66..3563d9a403 100644 --- a/mcs/class/corlib/Test/System/ExceptionTest.cs +++ b/mcs/class/corlib/Test/System/ExceptionTest.cs @@ -13,6 +13,8 @@ using System; using System.Collections; using System.Runtime.Serialization; +using System.Reflection; + using NUnit.Framework; namespace MonoTests.System @@ -400,6 +402,79 @@ namespace MonoTests.System Assert.IsNull (a.InnerException.Source); } +#if !MOBILE + // Ensure that we can convert a stacktrace to a + // telemetry message + // + [Test] + [Category("NotOnWindows")] + public void StacktraceToState () + { + try { + throw new Exception ("#0"); + } catch (Exception exc) { + var monoType = Type.GetType ("Mono.Runtime", false); + var convert = monoType.GetMethod("ExceptionToState", BindingFlags.NonPublic | BindingFlags.Static); + object [] convert_params = new object[] {exc}; + var output = (Tuple) convert.Invoke(null, convert_params); + + var dump = output.Item1; + var portable_hash = output.Item2; + var unportable_hash = output.Item3; + + Assert.IsTrue (portable_hash != 0, "#1"); + Assert.IsTrue (unportable_hash != 0, "#2"); + Assert.IsTrue (dump.Length > 0, "#3"); + + // Console.WriteLine (dump); + // dump should look something like: + // { + // "protocol_version" : "0.0.1", + // "configuration" : { + // "version" : "5.19.0 (managed_telemetry_pipeline/d342c73e320 Wed Aug 15 14:40:40 EDT 2018)", + // "tlc" : "normal", + // "sigsgev" : "altstack", + // "notifications" : "kqueue", + // "architecture" : "amd64", + // "disabled_features" : "none", + // "smallconfig" : "disabled", + // "bigarrays" : "disabled", + // "softdebug" : "enabled", + // "interpreter" : "enabled", + // "llvm_support" : "disabled", + // "suspend" : "hybrid" + // }, + // "memory" : { + // "Resident Size" : "40693760", + // "Virtual Size" : "4521312256", + // "minor_gc_time" : "216992", + // "major_gc_time" : "0", + // "minor_gc_count" : "6", + // "major_gc_count" : "0", + // "major_gc_time_concurrent" : "0" + // }, + // "threads" : [ + // { + // "is_managed" : false, + // "managed_thread_ptr" : "0x0", + // "thread_info_addr" : "0x0", + // "native_thread_id" : "0x0", + // "managed_frames" : [ + // { + // "is_managed" : "true", + // "guid" : "43A03618-E657-44B0-B9FA-F63314A3C1B2", + // "token" : "0x60008da", + // "native_offset" : "0xb2", + // "il_offset" : "0x00000" + // } + // ] + // } + // ] + // } + } + } +#endif + [Test] public void StackTrace () { diff --git a/mcs/class/corlib/Test/System/NullableTest.cs b/mcs/class/corlib/Test/System/NullableTest.cs index 1ec8201e72..0f08f5fa94 100644 --- a/mcs/class/corlib/Test/System/NullableTest.cs +++ b/mcs/class/corlib/Test/System/NullableTest.cs @@ -40,5 +40,19 @@ namespace MonoTests.System Assert.AreSame (typeof (int), Nullable.GetUnderlyingType (typeof (Nullable)), "#1"); Assert.IsNull (Nullable.GetUnderlyingType (typeof (Nullable<>)), "#2"); } + + private struct MutatingStruct + { + public int Value; + public override bool Equals(object obj) => Value++.Equals(null); + } + + [Test] + public void EqualsImpl () + { + MutatingStruct? ms = new MutatingStruct () { Value = 1 }; + ms.Equals (new object ()); + Assert.AreEqual (ms.Value.Value, 2, "#1"); + } } } diff --git a/mcs/class/corlib/Test/System/NumberFormatterTest.cs.REMOVED.git-id b/mcs/class/corlib/Test/System/NumberFormatterTest.cs.REMOVED.git-id index fa269f58ac..213705dc62 100644 --- a/mcs/class/corlib/Test/System/NumberFormatterTest.cs.REMOVED.git-id +++ b/mcs/class/corlib/Test/System/NumberFormatterTest.cs.REMOVED.git-id @@ -1 +1 @@ -be7c06e492f19830004719e43e6448e4ebe66d81 \ No newline at end of file +4b8b335a56693c36d68d47bcb0c31e1e03288a4a \ No newline at end of file diff --git a/mcs/class/corlib/Test/System/StringTest.cs.REMOVED.git-id b/mcs/class/corlib/Test/System/StringTest.cs.REMOVED.git-id index f3840e2db8..7e97d4a91d 100644 --- a/mcs/class/corlib/Test/System/StringTest.cs.REMOVED.git-id +++ b/mcs/class/corlib/Test/System/StringTest.cs.REMOVED.git-id @@ -1 +1 @@ -0be02f7a0bafa90f444ffe344ae9d4564513f5f1 \ No newline at end of file +29cd9e998c4364233a67531eea5afb4eae336256 \ No newline at end of file diff --git a/mcs/class/corlib/Test/System/TimeSpanTest.cs b/mcs/class/corlib/Test/System/TimeSpanTest.cs index feb0224fbd..e82ecf886f 100644 --- a/mcs/class/corlib/Test/System/TimeSpanTest.cs +++ b/mcs/class/corlib/Test/System/TimeSpanTest.cs @@ -1158,13 +1158,13 @@ public class TimeSpanTest { try { TimeSpan.ParseExact (null, "g", null); Assert.Fail ("#A1"); - } catch (ArgumentNullException) { + } catch (FormatException) { } try { TimeSpan.ParseExact ("10:12", (string)null, null); Assert.Fail ("#A2"); - } catch (ArgumentNullException) { + } catch (FormatException) { } try { diff --git a/mcs/class/corlib/corefx/Interop.GetRandomBytes.Mono.cs b/mcs/class/corlib/corefx/Interop.GetRandomBytes.Mono.cs new file mode 100644 index 0000000000..81c4d7a210 --- /dev/null +++ b/mcs/class/corlib/corefx/Interop.GetRandomBytes.Mono.cs @@ -0,0 +1,36 @@ +using System; +using System.Diagnostics; +using System.Security.Cryptography; +using System.Runtime.InteropServices; + +internal partial class Interop +{ + static class MonoGetRandomBytesFallback + { + static object _rngAccess = new object (); + static RNGCryptoServiceProvider _rng; + + internal static void GetRandomBytes (byte[] buffer) + { + lock (_rngAccess) { + if (_rng == null) + _rng = new RNGCryptoServiceProvider (); + _rng.GetBytes (buffer); + } + } + + internal static unsafe void GetRandomBytes (byte* buffer, int length) + { + lock (_rngAccess) { + if (_rng == null) + _rng = new RNGCryptoServiceProvider (); + _rng.GetBytes (buffer, (IntPtr)length); + } + } + } + + internal static unsafe void GetRandomBytes (byte* buffer, int length) + { + MonoGetRandomBytesFallback.GetRandomBytes (buffer, length); + } +} diff --git a/mcs/class/corlib/corefx/Mono.SafePasswordHandle.Unix.cs b/mcs/class/corlib/corefx/Mono.SafePasswordHandle.Unix.cs new file mode 100644 index 0000000000..b1e0263319 --- /dev/null +++ b/mcs/class/corlib/corefx/Mono.SafePasswordHandle.Unix.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace Microsoft.Win32.SafeHandles +{ + partial class SafePasswordHandle + { + internal string Mono_DangerousGetString () + { + return Marshal.PtrToStringAnsi (DangerousGetHandle ()); + } + } +} diff --git a/mcs/class/corlib/corefx/Mono.SafePasswordHandle.Windows.cs b/mcs/class/corlib/corefx/Mono.SafePasswordHandle.Windows.cs new file mode 100644 index 0000000000..95320d3ca6 --- /dev/null +++ b/mcs/class/corlib/corefx/Mono.SafePasswordHandle.Windows.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; +using System.Security; + +namespace Microsoft.Win32.SafeHandles +{ + partial class SafePasswordHandle + { + internal string Mono_DangerousGetString () + { + return Marshal.PtrToStringUni (DangerousGetHandle ()); + } + } +} diff --git a/mcs/class/corlib/corefx/RuntimeImports.cs b/mcs/class/corlib/corefx/RuntimeImports.cs index 33588d3b77..ec5ebb0a11 100644 --- a/mcs/class/corlib/corefx/RuntimeImports.cs +++ b/mcs/class/corlib/corefx/RuntimeImports.cs @@ -36,7 +36,7 @@ using nuint = System.UInt32; namespace System.Runtime { - static class RuntimeImports + static partial class RuntimeImports { internal static unsafe void RhZeroMemory (ref byte b, nuint byteLength) { diff --git a/mcs/class/corlib/corefx/SR.cs.REMOVED.git-id b/mcs/class/corlib/corefx/SR.cs.REMOVED.git-id index 67ab5f8e3c..1f876cd065 100644 --- a/mcs/class/corlib/corefx/SR.cs.REMOVED.git-id +++ b/mcs/class/corlib/corefx/SR.cs.REMOVED.git-id @@ -1 +1 @@ -8ece558dd28f5a3fe538b92be0dd6563dea791da \ No newline at end of file +7d6c3d757b2553412e786d3044d3e3d62c801369 \ No newline at end of file diff --git a/mcs/class/corlib/corefx/SR.missing.cs b/mcs/class/corlib/corefx/SR.missing.cs new file mode 100644 index 0000000000..b51991c2ac --- /dev/null +++ b/mcs/class/corlib/corefx/SR.missing.cs @@ -0,0 +1,6 @@ +partial class SR +{ + public const string ArgumentOutOfRange_ConsoleKey = "Console key values must be between 0 and 255 inclusive."; + public const string Arg_InvalidComObjectException = "Attempt has been made to use a COM object that does not have a backing class factory."; + public const string Arg_MustBeNullTerminatedString = "The string must be null-terminated."; +} \ No newline at end of file diff --git a/mcs/class/corlib/corefx/TimeSpanParse.cs b/mcs/class/corlib/corefx/TimeSpanParse.cs new file mode 100644 index 0000000000..7d6e767088 --- /dev/null +++ b/mcs/class/corlib/corefx/TimeSpanParse.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; +using System.Text; + +namespace System.Globalization +{ + partial class TimeSpanParse + { + internal static void ValidateStyles (TimeSpanStyles style, String parameterName) + { + if (style != TimeSpanStyles.None && style != TimeSpanStyles.AssumeNegative) + throw new ArgumentException (Environment.GetResourceString ("Argument_InvalidTimeSpanStyles"), parameterName); + } + } +} \ No newline at end of file diff --git a/mcs/class/corlib/corert/Debug.cs b/mcs/class/corlib/corert/Debug.cs deleted file mode 100644 index 4a3f984f73..0000000000 --- a/mcs/class/corlib/corert/Debug.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace System.Diagnostics.Private -{ - static partial class Debug - { - static void ShowDialog (string stackTrace, string message, string detailMessage, string errorSource) - { - // FIXME should we g_error in this case? - } - - static void WriteCore (string message) - { - // FIXME should we g_debug in this case? - } - } -} diff --git a/mcs/class/corlib/corert/Decimal.DecCalc.cs.REMOVED.git-id b/mcs/class/corlib/corert/Decimal.DecCalc.cs.REMOVED.git-id new file mode 100644 index 0000000000..04f74cc7fa --- /dev/null +++ b/mcs/class/corlib/corert/Decimal.DecCalc.cs.REMOVED.git-id @@ -0,0 +1 @@ +d401155ef021a7c184607b19fe3c53d7ab9bccfe \ No newline at end of file diff --git a/mcs/class/corlib/corert/Decimal.cs.REMOVED.git-id b/mcs/class/corlib/corert/Decimal.cs.REMOVED.git-id new file mode 100644 index 0000000000..822b717cc0 --- /dev/null +++ b/mcs/class/corlib/corert/Decimal.cs.REMOVED.git-id @@ -0,0 +1 @@ +185ecfe95a4f99dcc1009272f8eda1cb0952ea95 \ No newline at end of file diff --git a/mcs/class/corlib/corert/RuntimeImports.cs b/mcs/class/corlib/corert/RuntimeImports.cs new file mode 100644 index 0000000000..03d6e08912 --- /dev/null +++ b/mcs/class/corlib/corert/RuntimeImports.cs @@ -0,0 +1,18 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +namespace System.Runtime +{ + public static partial class RuntimeImports + { + [MethodImplAttribute(MethodImplOptions.InternalCall)] + internal static extern unsafe void _ecvt_s(byte* buffer, int sizeInBytes, double value, int count, int* dec, int* sign); + } +} diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources deleted file mode 100644 index 452d5d7f86..0000000000 --- a/mcs/class/corlib/corlib.dll.sources +++ /dev/null @@ -1,1777 +0,0 @@ -Assembly/AssemblyInfo.cs -../../build/common/Consts.cs -../../build/common/Locale.cs -../../build/common/AssemblyRef.cs -../../build/common/SR.cs -Microsoft.Win32/IRegistryApi.cs -Microsoft.Win32/RegistryKey.cs -Microsoft.Win32/RegistryKeyPermissionCheck.cs -Microsoft.Win32/Registry.cs -Microsoft.Win32/RegistryHive.cs -Microsoft.Win32/RegistryOptions.cs -Microsoft.Win32/RegistryValueKind.cs -Microsoft.Win32/RegistryValueOptions.cs -Microsoft.Win32/RegistryView.cs -Microsoft.Win32/UnixRegistryApi.cs -Microsoft.Win32/Win32RegistryApi.cs -Microsoft.Win32/Win32ResultCode.cs -Mono.Globalization.Unicode/CodePointIndexer.cs -Mono.Globalization.Unicode/MSCompatUnicodeTable.cs -Mono.Globalization.Unicode/MSCompatUnicodeTableUtil.cs -Mono.Globalization.Unicode/SimpleCollator.cs -Mono.Globalization.Unicode/SortKey.cs -Mono.Globalization.Unicode/SortKeyBuffer.cs -Mono.Globalization.Unicode/Normalization.cs -Mono.Globalization.Unicode/NormalizationTableUtil.cs -Mono/Runtime.cs -Mono/RuntimeHandles.cs -Mono/RuntimeMarshal.cs -Mono/RuntimeStructs.cs -Mono/SafeGPtrArrayHandle.cs -Mono/SafeStringMarshal.cs -Mono/DataConverter.cs -Mono.Interop/ComInteropProxy.cs -Mono.Interop/IDispatch.cs -Mono.Interop/IUnknown.cs -../Mono.Security/Mono.Math/BigInteger.cs -../Mono.Security/Mono.Math.Prime/ConfidenceFactor.cs -../Mono.Security/Mono.Math.Prime/PrimalityTests.cs -../Mono.Security/Mono.Math.Prime.Generator/NextPrimeFinder.cs -../Mono.Security/Mono.Math.Prime.Generator/PrimeGeneratorBase.cs -../Mono.Security/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs -../Mono.Security/Mono.Security/ASN1.cs -../Mono.Security/Mono.Security/ASN1Convert.cs -../Mono.Security/Mono.Security/BitConverterLE.cs -../Mono.Security/Mono.Security/PKCS7.cs -../Mono.Security/Mono.Security/StrongName.cs -Mono.Security/StrongNameManager.cs -Mono.Security/Uri.cs -../Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs -../Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs -../Mono.Security/Mono.Security.Cryptography/ARC4Managed.cs -../Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs -../Mono.Security/Mono.Security.Cryptography/CryptoTools.cs -Mono.Security.Cryptography/DSAManaged.cs -Mono.Security.Cryptography/HMACAlgorithm.cs -../Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs -Mono.Security.Cryptography/MACAlgorithm.cs -../Mono.Security/Mono.Security.Cryptography/MD2.cs -../Mono.Security/Mono.Security.Cryptography/MD2Managed.cs -../Mono.Security/Mono.Security.Cryptography/MD4.cs -../Mono.Security/Mono.Security.Cryptography/MD4Managed.cs -../Mono.Security/Mono.Security.Cryptography/PKCS1.cs -../Mono.Security/Mono.Security.Cryptography/PKCS8.cs -../Mono.Security/Mono.Security.Cryptography/RC4.cs -../Mono.Security/Mono.Security.Cryptography/RSAManaged.cs -../Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs -../Mono.Security/Mono.Security.X509/PKCS12.cs -../Mono.Security/Mono.Security.X509/X501Name.cs -../Mono.Security/Mono.Security.X509/X509Certificate.cs -../Mono.Security/Mono.Security.X509/X509CertificateCollection.cs -../Mono.Security/Mono.Security.X509/X509Chain.cs -../Mono.Security/Mono.Security.X509/X509ChainStatusFlags.cs -../Mono.Security/Mono.Security.X509/X509CRL.cs -../Mono.Security/Mono.Security.X509/X509Extension.cs -../Mono.Security/Mono.Security.X509/X509Extensions.cs -../Mono.Security/Mono.Security.X509/X509Store.cs -../Mono.Security/Mono.Security.X509/X509Stores.cs -../Mono.Security/Mono.Security.X509/X509StoreManager.cs -../Mono.Security/Mono.Security.X509/X520Attributes.cs -../Mono.Security/Mono.Security.X509.Extensions/BasicConstraintsExtension.cs -../Mono.Security/Mono.Security.X509.Extensions/KeyUsageExtension.cs -../Mono.Security/Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs -Mono.Xml/SmallXmlParser.cs -Mono.Xml/SecurityParser.cs -System/ActivationContext.cs -System/AndroidPlatform.cs -System/AppDomain.cs -System/AppDomainInitializer.cs -System/AppDomainManager.cs -System/AppDomainSetup.cs -System/ApplicationIdentity.cs -System/ArgIterator.cs -System/Array.cs -System/AssemblyLoadEventArgs.cs -System/AssemblyLoadEventHandler.cs -System/CStreamReader.cs -System/CStreamWriter.cs -System/Console.cs -System/Console.iOS.cs -System/ConsoleDriver.cs -System/ControlCharacters.cs -System/CrossAppDomainDelegate.cs -System/Delegate.cs -System/DelegateSerializationHolder.cs -System/DomainManagerInitializationFlags.cs -System/EmptyArray.cs -System/Environment.cs -System/EnvironmentVariableTarget.cs -System/Guid.cs -System/IConsoleDriver.cs -System/IntPtr.cs -System/KnownTerminals.cs -System/MathF.mono.cs -System/MarshalByRefObject.cs -System/MonoAsyncCall.cs -System/MonoCQItem.cs -System/MonoCustomAttrs.cs -System/MonoListItem.cs -System/MonoType.cs -System/MonoTouchAOTHelper.cs -System/MulticastDelegate.cs -System/NullConsoleDriver.cs -System/Nullable.cs -System/NumberFormatter.cs -System/Object.cs -System/OperatingSystem.cs -System/PlatformID.cs -System/ResolveEventArgs.cs -System/ResolveEventHandler.cs -System/RuntimeArgumentHandle.cs -System/RuntimeFieldHandle.cs -System/RuntimeMethodHandle.cs -System/RuntimeTypeHandle.cs -System/ModuleHandle.cs -System/StringComparison.cs -System/TermInfoBooleans.cs -System/TermInfoDriver.cs -System/TermInfoNumbers.cs -System/TermInfoReader.cs -System/TermInfoStrings.cs -System/TimeZone.cs -System/TimeZoneInfo.cs -System/TimeZoneInfo.Android.cs -System/TimeZoneInfo.MonoTouch.cs -System/TimeZoneInfo.Serialization.cs -System/TimeZoneInfo.WinRT.cs -../../build/common/MonoTODOAttribute.cs -System/TypeIdentifier.cs -System/TypeSpec.cs -System/TypeCode.cs -System/UIntPtr.cs -System/ValueType.cs -System/Variant.cs -System/Void.cs -System/WeakAttribute.cs -System/WeakReference.cs -System/WeakReference_T.cs -System/WindowsConsoleDriver.cs -System/__ComObject.cs -System.Configuration.Assemblies/AssemblyHash.cs -System.Configuration.Assemblies/AssemblyHashAlgorithm.cs -System.Configuration.Assemblies/AssemblyVersionCompatibility.cs -System.Configuration.Assemblies/ProcessorID.cs -System.Deployment.Internal/InternalActivationContextHelper.cs -System.Deployment.Internal/InternalApplicationIdentityHelper.cs -System.Diagnostics/Debugger.cs -System.Diagnostics/StackFrame.cs -System.Diagnostics/StackTrace.cs -System.Diagnostics.Tracing/EventAttribute.cs -System.Diagnostics.Tracing/EventCommand.cs -System.Diagnostics.Tracing/EventCounter.cs -System.Diagnostics.Tracing/EventSource.cs -System.Diagnostics.Tracing/EventSourceAttribute.cs -System.Diagnostics.Tracing/EventSourceSettings.cs -System.Diagnostics.Tracing/EventCommandEventArgs.cs -System.Diagnostics.Tracing/EventListener.cs -System.Diagnostics.Tracing/EventWrittenEventArgs.cs -System.Diagnostics.Tracing/NonEventAttribute.cs -System.Diagnostics.Tracing/EventDataAttribute.cs -System.Diagnostics.Tracing/EventFieldAttribute.cs -System.Diagnostics.Tracing/EventFieldFormat.cs -System.Diagnostics.Tracing/EventFieldTags.cs -System.Diagnostics.Tracing/EventIgnoreAttribute.cs -System.Diagnostics.Tracing/EventManifestOptions.cs -System.Diagnostics.SymbolStore/ISymbolBinder.cs -System.Diagnostics.SymbolStore/ISymbolBinder1.cs -System.Diagnostics.SymbolStore/ISymbolDocument.cs -System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs -System.Diagnostics.SymbolStore/ISymbolMethod.cs -System.Diagnostics.SymbolStore/ISymbolNamespace.cs -System.Diagnostics.SymbolStore/ISymbolReader.cs -System.Diagnostics.SymbolStore/ISymbolScope.cs -System.Diagnostics.SymbolStore/ISymbolVariable.cs -System.Diagnostics.SymbolStore/ISymbolWriter.cs -System.Diagnostics.SymbolStore/SymAddressKind.cs -System.Diagnostics.SymbolStore/SymbolToken.cs -System.Diagnostics.SymbolStore/SymDocumentType.cs -System.Diagnostics.SymbolStore/SymLanguageType.cs -System.Diagnostics.SymbolStore/SymLanguageVendor.cs -System.Globalization/CultureInfo.cs -System.Globalization/IdnMapping.cs -System.Globalization/RegionInfo.cs -System.Globalization/RegionInfo.MonoTouch.cs -System.IO/Directory.cs -System.IO/DirectoryInfo.cs -System.IO/DriveInfo.cs -System.IO/DriveType.cs -System.IO/File.cs -System.IO/FileAccess.cs -System.IO/FileAttributes.cs -System.IO/FileMode.cs -System.IO/FileOptions.cs -System.IO/FileShare.cs -System.IO/FileStream.cs -System.IO/FileStreamAsyncResult.cs -System.IO/HGlobalUnmanagedMemoryStream.cs -System.IO/LogcatTextWriter.cs -System.IO/MonoIO.cs -System.IO/MonoIOError.cs -System.IO/MonoFileType.cs -System.IO/MonoIOStat.cs -System.IO/Path.cs -System.IO/SearchOption.cs -System.IO/SearchPattern.cs -System.IO/SeekOrigin.cs -System.IO/UnexceptionalStreamReader.cs -System.IO/UnexceptionalStreamWriter.cs -System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs -System.IO.IsolatedStorage/IsolatedStorage.cs -System.IO.IsolatedStorage/IsolatedStorageException.cs -System.IO.IsolatedStorage/IsolatedStorageFile.cs -System.IO.IsolatedStorage/IsolatedStorageFileEnumerator.cs -System.IO.IsolatedStorage/IsolatedStorageFileStream.cs -System.IO.IsolatedStorage/IsolatedStorageScope.cs -System.IO.IsolatedStorage/IsolatedStorageSecurityOptions.cs -System.IO.IsolatedStorage/IsolatedStorageSecurityState.cs -System.Reflection/Assembly.cs -System.Reflection/AssemblyName.cs -System.Reflection/ConstructorInfo.cs -System.Reflection/CustomAttributeData.cs -System.Reflection/CustomAttributeFormatException.cs -System.Reflection/CustomAttributeNamedArgument.cs -System.Reflection/CustomAttributeTypedArgument.cs -System.Reflection/EventInfo.cs -System.Reflection/ExceptionHandlingClause.cs -System.Reflection/FieldInfo.cs -System.Reflection/ImageFileMachine.cs -System.Reflection/LocalVariableInfo.cs -System.Reflection/MethodBody.cs -System.Reflection/Module.cs -System.Reflection/ModuleResolveEventHandler.cs -System.Reflection/MonoAssembly.cs -System.Reflection/MonoEvent.cs -System.Reflection/MonoField.cs -System.Reflection/MonoMethod.cs -System.Reflection/MonoModule.cs -System.Reflection/MonoParameterInfo.cs -System.Reflection/MonoProperty.cs -System.Reflection/ParameterInfo.cs -System.Reflection/PortableExecutableKinds.cs -System.Reflection/PropertyInfo.cs -System.Reflection/StrongNameKeyPair.cs -System.Reflection.Emit/AssemblyBuilder.cs -System.Reflection.Emit/AssemblyBuilderAccess.cs -System.Reflection.Emit/ConstructorBuilder.cs -System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs -System.Reflection.Emit/CustomAttributeBuilder.cs -System.Reflection.Emit/DerivedTypes.cs -System.Reflection.Emit/DynamicILInfo.cs -System.Reflection.Emit/DynamicMethod.cs -System.Reflection.Emit/DynamicMethod.notsupported.cs -System.Reflection.Emit/EnumBuilder.cs -System.Reflection.Emit/EventBuilder.cs -System.Reflection.Emit/EventOnTypeBuilderInst.cs -System.Reflection.Emit/EventToken.cs -System.Reflection.Emit/FieldBuilder.cs -System.Reflection.Emit/FieldOnTypeBuilderInst.cs -System.Reflection.Emit/FieldToken.cs -System.Reflection.Emit/FlowControl.cs -System.Reflection.Emit/GenericTypeParameterBuilder.cs -System.Reflection.Emit/ILGenerator.cs -System.Reflection.Emit/Label.cs -System.Reflection.Emit/LocalBuilder.cs -System.Reflection.Emit/MethodBuilder.cs -System.Reflection.Emit/MethodOnTypeBuilderInst.cs -System.Reflection.Emit/MethodToken.cs -System.Reflection.Emit/MethodRental.cs -System.Reflection.Emit/ModuleBuilder.cs -System.Reflection.Emit/MonoArrayMethod.cs -System.Reflection.Emit/OpCodeNames.cs -System.Reflection.Emit/OpCode.cs -System.Reflection.Emit/OpCodes.cs -System.Reflection.Emit/OpCodeType.cs -System.Reflection.Emit/OperandType.cs -System.Reflection.Emit/PackingSize.cs -System.Reflection.Emit/ParameterBuilder.cs -System.Reflection.Emit/ParameterToken.cs -System.Reflection.Emit/PEFileKinds.cs -System.Reflection.Emit/PropertyBuilder.cs -System.Reflection.Emit/PropertyOnTypeBuilderInst.cs -System.Reflection.Emit/PropertyToken.cs -System.Reflection.Emit/SignatureHelper.cs -System.Reflection.Emit/SignatureToken.cs -System.Reflection.Emit/StackBehaviour.cs -System.Reflection.Emit/StringToken.cs -System.Reflection.Emit/TypeBuilder.cs -System.Reflection.Emit/TypeBuilderInstantiation.cs -System.Reflection.Emit/TypeToken.cs -System.Reflection.Emit/UnmanagedMarshal.cs -System.Reflection.Emit/AssemblyBuilder.pns.cs -System.Reflection.Emit/ConstructorBuilder.pns.cs -System.Reflection.Emit/CustomAttributeBuilder.pns.cs -System.Reflection.Emit/EnumBuilder.pns.cs -System.Reflection.Emit/EventBuilder.pns.cs -System.Reflection.Emit/FieldBuilder.pns.cs -System.Reflection.Emit/GenericTypeParameterBuilder.pns.cs -System.Reflection.Emit/ILGenerator.pns.cs -System.Reflection.Emit/MethodBuilder.pns.cs -System.Reflection.Emit/ModuleBuilder.pns.cs -System.Reflection.Emit/ParameterBuilder.pns.cs -System.Reflection.Emit/PropertyBuilder.pns.cs -System.Reflection.Emit/SignatureHelper.pns.cs -System.Reflection.Emit/TypeBuilder.pns.cs -System.Reflection.Metadata/AssemblyExtensions.cs -System.Resources/Win32Resources.cs -System.Runtime/GCLargeObjectHeapCompactionMode.cs -System.Runtime/GCLatencyMode.cs -System.Runtime/GCSettings.cs -System.Runtime/MemoryFailPoint.cs -System.Runtime.CompilerServices/ConditionalWeakTable.cs -System.Runtime.CompilerServices/RuntimeHelpers.cs -System.Runtime.CompilerServices/Unsafe.cs -System.Runtime.CompilerServices/PreserveDependencyAttribute.cs -System.Runtime.Hosting/ActivationArguments.cs -System.Runtime.Hosting/ApplicationActivator.cs -System.Runtime.InteropServices/_Activator.cs -System.Runtime.InteropServices/_Assembly.cs -System.Runtime.InteropServices/_AssemblyBuilder.cs -System.Runtime.InteropServices/_AssemblyName.cs -System.Runtime.InteropServices/_Attribute.cs -System.Runtime.InteropServices/_ConstructorBuilder.cs -System.Runtime.InteropServices/_ConstructorInfo.cs -System.Runtime.InteropServices/_CustomAttributeBuilder.cs -System.Runtime.InteropServices/_EnumBuilder.cs -System.Runtime.InteropServices/_EventBuilder.cs -System.Runtime.InteropServices/_EventInfo.cs -System.Runtime.InteropServices/_Exception.cs -System.Runtime.InteropServices/_FieldBuilder.cs -System.Runtime.InteropServices/_FieldInfo.cs -System.Runtime.InteropServices/_ILGenerator.cs -System.Runtime.InteropServices/_LocalBuilder.cs -System.Runtime.InteropServices/_MemberInfo.cs -System.Runtime.InteropServices/_MethodBase.cs -System.Runtime.InteropServices/_MethodBuilder.cs -System.Runtime.InteropServices/_MethodInfo.cs -System.Runtime.InteropServices/_MethodRental.cs -System.Runtime.InteropServices/_Module.cs -System.Runtime.InteropServices/_ModuleBuilder.cs -System.Runtime.InteropServices/_ParameterBuilder.cs -System.Runtime.InteropServices/_ParameterInfo.cs -System.Runtime.InteropServices/_PropertyBuilder.cs -System.Runtime.InteropServices/_PropertyInfo.cs -System.Runtime.InteropServices/_SignatureHelper.cs -System.Runtime.InteropServices/_Thread.cs -System.Runtime.InteropServices/_Type.cs -System.Runtime.InteropServices/_TypeBuilder.cs -System.Runtime.InteropServices/BIND_OPTS.cs -System.Runtime.InteropServices/BINDPTR.cs -System.Runtime.InteropServices/DESCKIND.cs -System.Runtime.InteropServices/ExporterEventKind.cs -System.Runtime.InteropServices/ExtensibleClassFactory.cs -System.Runtime.InteropServices/FILETIME.cs -System.Runtime.InteropServices/GCHandle.cs -System.Runtime.InteropServices/GCHandleType.cs -System.Runtime.InteropServices/IErrorInfo.cs -System.Runtime.InteropServices/ITypeLibConverter.cs -System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs -System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs -System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs -System.Runtime.InteropServices/ImporterEventKind.cs -System.Runtime.InteropServices/LIBFLAGS.cs -System.Runtime.InteropServices/ManagedErrorInfo.cs -System.Runtime.InteropServices/Marshal.cs -System.Runtime.InteropServices/MarshalAsAttribute.cs -System.Runtime.InteropServices/RegistrationClassContext.cs -System.Runtime.InteropServices/RegistrationConnectionType.cs -System.Runtime.InteropServices/STATSTG.cs -System.Runtime.InteropServices/RegistrationServices.cs -System.Runtime.InteropServices/SafeBuffer.cs -System.Runtime.InteropServices/SafeHandle.cs -System.Runtime.InteropServices/SYSKIND.cs -System.Runtime.InteropServices/TYPELIBATTR.cs -System.Runtime.InteropServices/TypeLibConverter.cs -System.Runtime.InteropServices/TypeLibExporterFlags.cs -System.Runtime.InteropServices/TypeLibImporterFlags.cs -System.Runtime.InteropServices/UCOMIBindCtx.cs -System.Runtime.InteropServices/UCOMIConnectionPoint.cs -System.Runtime.InteropServices/UCOMIConnectionPointContainer.cs -System.Runtime.InteropServices/UCOMIEnumConnectionPoints.cs -System.Runtime.InteropServices/UCOMIEnumMoniker.cs -System.Runtime.InteropServices/UCOMIEnumString.cs -System.Runtime.InteropServices/UCOMIEnumVARIANT.cs -System.Runtime.InteropServices/UCOMIMoniker.cs -System.Runtime.InteropServices/UCOMIPersistFile.cs -System.Runtime.InteropServices/UCOMIRunningObjectTable.cs -System.Runtime.InteropServices/UCOMIStream.cs -System.Runtime.InteropServices/UCOMITypeComp.cs -System.Runtime.InteropServices/UCOMITypeLib.cs -System.Runtime.InteropServices/CustomQueryInterfaceMode.cs -System.Runtime.InteropServices/ComEventsHelper.cs - -System.Runtime.InteropServices.WindowsRuntime/DesignerNamespaceResolveEventArgs.cs -System.Runtime.InteropServices.WindowsRuntime/NamespaceResolveEventArgs.cs -System.Runtime.InteropServices.WindowsRuntime/UnsafeNativeMethods.cs -System.Runtime.InteropServices.WindowsRuntime/WindowsRuntimeMetadata.cs - -System.Runtime.InteropServices.RuntimeInformation/RuntimeInformation.cs - -System.Runtime.Remoting/ActivatedClientTypeEntry.cs -System.Runtime.Remoting/ActivatedServiceTypeEntry.cs -System.Runtime.Remoting/CustomErrorsModes.cs -System.Runtime.Remoting/EnvoyInfo.cs -System.Runtime.Remoting/IObjectHandle.cs -System.Runtime.Remoting/IChannelInfo.cs -System.Runtime.Remoting/Identity.cs -System.Runtime.Remoting/InternalRemotingServices.cs -System.Runtime.Remoting/IEnvoyInfo.cs -System.Runtime.Remoting/IRemotingTypeInfo.cs -System.Runtime.Remoting/ObjectHandle.cs -System.Runtime.Remoting/ObjRef.cs -System.Runtime.Remoting/RemotingConfiguration.cs -System.Runtime.Remoting/RemotingException.cs -System.Runtime.Remoting/RemotingTimeoutException.cs -System.Runtime.Remoting/RemotingServices.cs -System.Runtime.Remoting/ServerException.cs -System.Runtime.Remoting/ServerIdentity.cs -System.Runtime.Remoting/SoapServices.cs -System.Runtime.Remoting/TypeEntry.cs -System.Runtime.Remoting/TypeInfo.cs -System.Runtime.Remoting/WellKnownObjectMode.cs -System.Runtime.Remoting/WellKnownClientTypeEntry.cs -System.Runtime.Remoting/WellKnownServiceTypeEntry.cs -System.Runtime.Remoting.Activation/ActivationServices.cs -System.Runtime.Remoting.Activation/ActivatorLevel.cs -System.Runtime.Remoting.Activation/AppDomainLevelActivator.cs -System.Runtime.Remoting.Activation/ConstructionLevelActivator.cs -System.Runtime.Remoting.Activation/ContextLevelActivator.cs -System.Runtime.Remoting.Activation/IActivator.cs -System.Runtime.Remoting.Activation/IConstructionCallMessage.cs -System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs -System.Runtime.Remoting.Activation/RemoteActivator.cs -System.Runtime.Remoting.Activation/RemoteActivationAttribute.cs -System.Runtime.Remoting.Activation/UrlAttribute.cs -System.Runtime.Remoting.Channels/AggregateDictionary.cs -System.Runtime.Remoting.Channels/BaseChannelObjectWithProperties.cs -System.Runtime.Remoting.Channels/BaseChannelSinkWithProperties.cs -System.Runtime.Remoting.Channels/BaseChannelWithProperties.cs -System.Runtime.Remoting.Channels/ChannelDataStore.cs -System.Runtime.Remoting.Channels/ChannelServices.cs -System.Runtime.Remoting.Channels/ChannelSinkStackEntry.cs -System.Runtime.Remoting.Channels/ClientChannelSinkStack.cs -System.Runtime.Remoting.Channels/IChannel.cs -System.Runtime.Remoting.Channels/IChannelDataStore.cs -System.Runtime.Remoting.Channels/IChannelReceiver.cs -System.Runtime.Remoting.Channels/IChannelReceiverHook.cs -System.Runtime.Remoting.Channels/IChannelSender.cs -System.Runtime.Remoting.Channels/IChannelSinkBase.cs -System.Runtime.Remoting.Channels/IClientChannelSink.cs -System.Runtime.Remoting.Channels/IClientChannelSinkProvider.cs -System.Runtime.Remoting.Channels/IClientChannelSinkStack.cs -System.Runtime.Remoting.Channels/IClientFormatterSink.cs -System.Runtime.Remoting.Channels/IClientFormatterSinkProvider.cs -System.Runtime.Remoting.Channels/IClientResponseChannelSinkStack.cs -System.Runtime.Remoting.Channels/ISecurableChannel.cs -System.Runtime.Remoting.Channels/IServerResponseChannelSinkStack.cs -System.Runtime.Remoting.Channels/ServerDispatchSink.cs -System.Runtime.Remoting.Channels/ServerDispatchSinkProvider.cs -System.Runtime.Remoting.Channels/IServerChannelSink.cs -System.Runtime.Remoting.Channels/IServerChannelSinkProvider.cs -System.Runtime.Remoting.Channels/IServerChannelSinkStack.cs -System.Runtime.Remoting.Channels/IServerFormatterSinkProvider.cs -System.Runtime.Remoting.Channels/ITransportHeaders.cs -System.Runtime.Remoting.Channels/ServerChannelSinkStack.cs -System.Runtime.Remoting.Channels/ServerProcessing.cs -System.Runtime.Remoting.Channels/SinkProviderData.cs -System.Runtime.Remoting.Channels/TransportHeaders.cs -System.Runtime.Remoting.Channels/CrossAppDomainChannel.cs -System.Runtime.Remoting.Contexts/Context.cs -System.Runtime.Remoting.Contexts/ContextAttribute.cs -System.Runtime.Remoting.Contexts/ContextProperty.cs -System.Runtime.Remoting.Contexts/CrossContextChannel.cs -System.Runtime.Remoting.Contexts/CrossContextDelegate.cs -System.Runtime.Remoting.Contexts/IContextAttribute.cs -System.Runtime.Remoting.Contexts/IContextProperty.cs -System.Runtime.Remoting.Contexts/IContextPropertyActivator.cs -System.Runtime.Remoting.Contexts/IContributeClientContextSink.cs -System.Runtime.Remoting.Contexts/IContributeDynamicSink.cs -System.Runtime.Remoting.Contexts/IContributeEnvoySink.cs -System.Runtime.Remoting.Contexts/IContributeObjectSink.cs -System.Runtime.Remoting.Contexts/IContributeServerContextSink.cs -System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs -System.Runtime.Remoting.Contexts/IDynamicProperty.cs -System.Runtime.Remoting.Contexts/SynchronizationAttribute.cs -System.Runtime.Remoting.Lifetime/ClientSponsor.cs -System.Runtime.Remoting.Lifetime/ILease.cs -System.Runtime.Remoting.Lifetime/ISponsor.cs -System.Runtime.Remoting.Lifetime/Lease.cs -System.Runtime.Remoting.Lifetime/LeaseManager.cs -System.Runtime.Remoting.Lifetime/LeaseSink.cs -System.Runtime.Remoting.Lifetime/LeaseState.cs -System.Runtime.Remoting.Lifetime/LifetimeServices.cs -System.Runtime.Remoting.Messaging/ArgInfo.cs -System.Runtime.Remoting.Messaging/AsyncResult.cs -System.Runtime.Remoting.Messaging/ClientContextTerminatorSink.cs -System.Runtime.Remoting.Messaging/ConstructionCall.cs -System.Runtime.Remoting.Messaging/ConstructionCallDictionary.cs -System.Runtime.Remoting.Messaging/ConstructionResponse.cs -System.Runtime.Remoting.Messaging/EnvoyTerminatorSink.cs -System.Runtime.Remoting.Messaging/Header.cs -System.Runtime.Remoting.Messaging/HeaderHandler.cs -System.Runtime.Remoting.Messaging/ErrorMessage.cs -System.Runtime.Remoting.Messaging/IInternalMessage.cs -System.Runtime.Remoting.Messaging/IMessage.cs -System.Runtime.Remoting.Messaging/IMessageCtrl.cs -System.Runtime.Remoting.Messaging/IMessageSink.cs -System.Runtime.Remoting.Messaging/IMethodCallMessage.cs -System.Runtime.Remoting.Messaging/IMethodMessage.cs -System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs -System.Runtime.Remoting.Messaging/IRemotingFormatter.cs -System.Runtime.Remoting.Messaging/InternalMessageWrapper.cs -System.Runtime.Remoting.Messaging/ISerializationRootObject.cs -System.Runtime.Remoting.Messaging/MessageSurrogateFilter.cs -System.Runtime.Remoting.Messaging/MethodCall.cs -System.Runtime.Remoting.Messaging/MethodCallMessageWrapper.cs -System.Runtime.Remoting.Messaging/MethodResponse.cs -System.Runtime.Remoting.Messaging/MethodCallDictionary.cs -System.Runtime.Remoting.Messaging/MethodDictionary.cs -System.Runtime.Remoting.Messaging/MethodReturnDictionary.cs -System.Runtime.Remoting.Messaging/MethodReturnMessageWrapper.cs -System.Runtime.Remoting.Messaging/MonoMethodMessage.cs -System.Runtime.Remoting.Messaging/OneWayAttribute.cs -System.Runtime.Remoting.Messaging/RemotingSurrogateSelector.cs -System.Runtime.Remoting.Messaging/RemotingSurrogate.cs -System.Runtime.Remoting.Messaging/ReturnMessage.cs -System.Runtime.Remoting.Messaging/ServerContextTerminatorSink.cs -System.Runtime.Remoting.Messaging/ServerObjectTerminatorSink.cs -System.Runtime.Remoting.Messaging/StackBuilderSink.cs -System.Runtime.Remoting.Messaging/CADMessages.cs -System.Runtime.Remoting.Metadata/SoapAttribute.cs -System.Runtime.Remoting.Metadata/SoapFieldAttribute.cs -System.Runtime.Remoting.Metadata/SoapMethodAttribute.cs -System.Runtime.Remoting.Metadata/SoapOption.cs -System.Runtime.Remoting.Metadata/SoapParameterAttribute.cs -System.Runtime.Remoting.Metadata/SoapTypeAttribute.cs -System.Runtime.Remoting.Metadata/XmlFieldOrderOption.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/ISoapXsd.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapAnyUri.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapEntity.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapMonth.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNonNegativeInteger.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapToken.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapBase64Binary.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinary.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapMonthDay.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNonPositiveInteger.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapYear.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDate.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHelper.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapId.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapName.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNormalizedString.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapYearMonth.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDateTime.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapIdref.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNcName.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNotation.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDay.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapIdrefs.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNegativeInteger.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapPositiveInteger.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapDuration.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapInteger.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNmtoken.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapQName.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapEntities.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapLanguage.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapNmtokens.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapTime.cs -System.Runtime.Remoting.Proxies/RealProxy.cs -System.Runtime.Remoting.Proxies/RemotingProxy.cs -System.Runtime.Remoting.Proxies/ProxyAttribute.cs -System.Runtime.Remoting.Services/EnterpriseServicesHelper.cs -System.Runtime.Remoting.Services/ITrackingHandler.cs -System.Runtime.Remoting.Services/TrackingServices.cs -System.Runtime.Versioning/CompatibilitySwitch.cs -System.Security/CodeAccessPermission.cs -System.Security/HostProtectionException.cs -System.Security/HostSecurityManager.cs -System.Security/HostSecurityManagerFlags.cs -System.Security/IEvidenceFactory.cs -System.Security/IPermission.cs -System.Security/ISecurityEncodable.cs -System.Security/ISecurityPolicyEncodable.cs -System.Security/IStackWalk.cs -System.Security/NamedPermissionSet.cs -System.Security/PermissionBuilder.cs -System.Security/PermissionSet.cs -System.Security/PolicyLevelType.cs -System.Security/SecureString.cs -System.Security/SecurityElement.cs -System.Security/SecurityFrame.cs -System.Security/SecurityException.cs -System.Security/SecurityManager.cs -System.Security/SecurityManager_mobile.cs -System.Security/SecurityState.cs -System.Security/SecurityZone.cs -System.Security/VerificationException.cs -System.Security/XmlSyntaxException.cs -System.Security.AccessControl/AccessControlActions.cs -System.Security.AccessControl/AccessControlModification.cs -System.Security.AccessControl/AccessControlSections.cs -System.Security.AccessControl/AccessControlType.cs -System.Security.AccessControl/AccessRule.cs -System.Security.AccessControl/AccessRule_T.cs -System.Security.AccessControl/AceEnumerator.cs -System.Security.AccessControl/AceFlags.cs -System.Security.AccessControl/AceQualifier.cs -System.Security.AccessControl/AceType.cs -System.Security.AccessControl/AuditFlags.cs -System.Security.AccessControl/AuditRule.cs -System.Security.AccessControl/AuditRule_T.cs -System.Security.AccessControl/AuthorizationRule.cs -System.Security.AccessControl/AuthorizationRuleCollection.cs -System.Security.AccessControl/CommonAce.cs -System.Security.AccessControl/CommonAcl.cs -System.Security.AccessControl/CommonObjectSecurity.cs -System.Security.AccessControl/CommonSecurityDescriptor.cs -System.Security.AccessControl/CompoundAce.cs -System.Security.AccessControl/CompoundAceType.cs -System.Security.AccessControl/ControlFlags.cs -System.Security.AccessControl/CryptoKeyAccessRule.cs -System.Security.AccessControl/CryptoKeyAuditRule.cs -System.Security.AccessControl/CryptoKeyRights.cs -System.Security.AccessControl/CryptoKeySecurity.cs -System.Security.AccessControl/CustomAce.cs -System.Security.AccessControl/DirectoryObjectSecurity.cs -System.Security.AccessControl/DirectorySecurity.cs -System.Security.AccessControl/DiscretionaryAcl.cs -System.Security.AccessControl/EventWaitHandleAccessRule.cs -System.Security.AccessControl/EventWaitHandleAuditRule.cs -System.Security.AccessControl/EventWaitHandleRights.cs -System.Security.AccessControl/EventWaitHandleSecurity.cs -System.Security.AccessControl/FileSecurity.cs -System.Security.AccessControl/FileSystemAccessRule.cs -System.Security.AccessControl/FileSystemAuditRule.cs -System.Security.AccessControl/FileSystemRights.cs -System.Security.AccessControl/FileSystemSecurity.cs -System.Security.AccessControl/GenericAce.cs -System.Security.AccessControl/GenericAcl.cs -System.Security.AccessControl/GenericSecurityDescriptor.cs -System.Security.AccessControl/InheritanceFlags.cs -System.Security.AccessControl/KnownAce.cs -System.Security.AccessControl/MutexAccessRule.cs -System.Security.AccessControl/MutexAuditRule.cs -System.Security.AccessControl/MutexRights.cs -System.Security.AccessControl/MutexSecurity.cs -System.Security.AccessControl/NativeObjectSecurity.cs -System.Security.AccessControl/ObjectAccessRule.cs -System.Security.AccessControl/ObjectAce.cs -System.Security.AccessControl/ObjectAceFlags.cs -System.Security.AccessControl/ObjectAuditRule.cs -System.Security.AccessControl/ObjectSecurity.cs -System.Security.AccessControl/ObjectSecurity_T.cs -System.Security.AccessControl/PrivilegeNotHeldException.cs -System.Security.AccessControl/PropagationFlags.cs -System.Security.AccessControl/QualifiedAce.cs -System.Security.AccessControl/RawAcl.cs -System.Security.AccessControl/RawSecurityDescriptor.cs -System.Security.AccessControl/RegistryAccessRule.cs -System.Security.AccessControl/RegistryAuditRule.cs -System.Security.AccessControl/RegistryRights.cs -System.Security.AccessControl/RegistrySecurity.cs -System.Security.AccessControl/ResourceType.cs -System.Security.AccessControl/SddlAccessRight.cs -System.Security.AccessControl/SecurityInfos.cs -System.Security.AccessControl/SystemAcl.cs -System.Security.Cryptography/CryptoAPITransform.cs -System.Security.Cryptography/CryptoConfig.cs -System.Security.Cryptography/CryptoConfig.common.cs -System.Security.Cryptography/CryptoConfig.Mobile.cs -System.Security.Cryptography/CspKeyContainerInfo.cs -System.Security.Cryptography/DESCryptoServiceProvider.cs -System.Security.Cryptography/DSACryptoServiceProvider.cs -System.Security.Cryptography/ICspAsymmetricAlgorithm.cs -System.Security.Cryptography/KeyNumber.cs -System.Security.Cryptography/MD5CryptoServiceProvider.cs -System.Security.Cryptography/RC2CryptoServiceProvider.cs -System.Security.Cryptography/RNGCryptoServiceProvider.cs -System.Security.Cryptography/RSACryptoServiceProvider.cs -System.Security.Cryptography/RSAPKCS1SignatureDeformatter.cs -System.Security.Cryptography/RSAPKCS1SignatureFormatter.cs -System.Security.Cryptography/SHA1CryptoServiceProvider.cs -System.Security.Cryptography/TripleDESCryptoServiceProvider.cs -System.Security.Cryptography.X509Certificates/INativeCertificateHelper.cs -System.Security.Cryptography.X509Certificates/X509Certificate.cs -System.Security.Cryptography.X509Certificates/X509Certificate20.cs -System.Security.Cryptography.X509Certificates/X509CertificateImpl.cs -System.Security.Cryptography.X509Certificates/X509CertificateImplMono.cs -System.Security.Cryptography.X509Certificates/X509Helper.cs -System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs -System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs -System.Security.Permissions/CodeAccessSecurityAttribute.cs -System.Security.Permissions/EnvironmentPermission.cs -System.Security.Permissions/EnvironmentPermissionAccess.cs -System.Security.Permissions/EnvironmentPermissionAttribute.cs -System.Security.Permissions/FileDialogPermission.cs -System.Security.Permissions/FileDialogPermissionAccess.cs -System.Security.Permissions/FileDialogPermissionAttribute.cs -System.Security.Permissions/FileIOPermission.cs -System.Security.Permissions/FileIOPermissionAccess.cs -System.Security.Permissions/FileIOPermissionAttribute.cs -System.Security.Permissions/GacIdentityPermission.cs -System.Security.Permissions/GacIdentityPermissionAttribute.cs -System.Security.Permissions/HostProtectionAttribute.cs -System.Security.Permissions/HostProtectionPermission.cs -System.Security.Permissions/HostProtectionResource.cs -System.Security.Permissions/IBuiltInPermission.cs -System.Security.Permissions/IsolatedStorageContainment.cs -System.Security.Permissions/IsolatedStorageFilePermission.cs -System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs -System.Security.Permissions/IsolatedStoragePermission.cs -System.Security.Permissions/IsolatedStoragePermissionAttribute.cs -System.Security.Permissions/IUnrestrictedPermission.cs -System.Security.Permissions/KeyContainerPermission.cs -System.Security.Permissions/KeyContainerPermissionAccessEntry.cs -System.Security.Permissions/KeyContainerPermissionAccessEntryCollection.cs -System.Security.Permissions/KeyContainerPermissionAccessEntryEnumerator.cs -System.Security.Permissions/KeyContainerPermissionAttribute.cs -System.Security.Permissions/KeyContainerPermissionFlags.cs -System.Security.Permissions/PermissionSetAttribute.cs -System.Security.Permissions/PermissionState.cs -System.Security.Permissions/PrincipalPermission.cs -System.Security.Permissions/PrincipalPermissionAttribute.cs -System.Security.Permissions/PublisherIdentityPermission.cs -System.Security.Permissions/PublisherIdentityPermissionAttribute.cs -System.Security.Permissions/ReflectionPermission.cs -System.Security.Permissions/ReflectionPermissionAttribute.cs -System.Security.Permissions/ReflectionPermissionFlag.cs -System.Security.Permissions/RegistryPermission.cs -System.Security.Permissions/RegistryPermissionAccess.cs -System.Security.Permissions/RegistryPermissionAttribute.cs -System.Security.Permissions/SecurityAction.cs -System.Security.Permissions/SecurityAttribute.cs -System.Security.Permissions/SecurityPermission.cs -System.Security.Permissions/SecurityPermissionAttribute.cs -System.Security.Permissions/SecurityPermissionFlag.cs -System.Security.Permissions/SiteIdentityPermission.cs -System.Security.Permissions/SiteIdentityPermissionAttribute.cs -System.Security.Permissions/StrongNameIdentityPermission.cs -System.Security.Permissions/StrongNamePermissionAttribute.cs -System.Security.Permissions/StrongNamePublicKeyBlob.cs -System.Security.Permissions/UIPermission.cs -System.Security.Permissions/UIPermissionAttribute.cs -System.Security.Permissions/UIPermissionClipboard.cs -System.Security.Permissions/UIPermissionWindow.cs -System.Security.Permissions/UrlIdentityPermission.cs -System.Security.Permissions/UrlIdentityPermissionAttribute.cs -System.Security.Permissions/ZoneIdentityPermission.cs -System.Security.Permissions/ZoneIdentityPermissionAttribute.cs -System.Security.Policy/AllMembershipCondition.cs -System.Security.Policy/ApplicationDirectory.cs -System.Security.Policy/ApplicationDirectoryMembershipCondition.cs -System.Security.Policy/ApplicationSecurityInfo.cs -System.Security.Policy/ApplicationSecurityManager.cs -System.Security.Policy/ApplicationTrust.cs -System.Security.Policy/ApplicationTrustCollection.cs -System.Security.Policy/ApplicationTrustEnumerator.cs -System.Security.Policy/ApplicationVersionMatch.cs -System.Security.Policy/CodeConnectAccess.cs -System.Security.Policy/CodeGroup.cs -System.Security.Policy/DefaultPolicies.cs -System.Security.Policy/Evidence.cs -System.Security.Policy/EvidenceBase.cs -System.Security.Policy/FileCodeGroup.cs -System.Security.Policy/FirstMatchCodeGroup.cs -System.Security.Policy/Gac.cs -System.Security.Policy/GacMembershipCondition.cs -System.Security.Policy/Hash.cs -System.Security.Policy/HashMembershipCondition.cs -System.Security.Policy/IApplicationTrustManager.cs -System.Security.Policy/IBuiltInEvidence.cs -System.Security.Policy/IConstantMembershipCondition.cs -System.Security.Policy/IIdentityPermissionFactory.cs -System.Security.Policy/IMembershipCondition.cs -System.Security.Policy/MembershipConditionHelper.cs -System.Security.Policy/MonoTrustManager.cs -System.Security.Policy/NetCodeGroup.cs -System.Security.Policy/PermissionRequestEvidence.cs -System.Security.Policy/PolicyException.cs -System.Security.Policy/PolicyLevel.cs -System.Security.Policy/PolicyStatement.cs -System.Security.Policy/PolicyStatementAttribute.cs -System.Security.Policy/Publisher.cs -System.Security.Policy/PublisherMembershipCondition.cs -System.Security.Policy/Site.cs -System.Security.Policy/SiteMembershipCondition.cs -System.Security.Policy/StrongName.cs -System.Security.Policy/StrongNameMembershipCondition.cs -System.Security.Policy/TrustManagerContext.cs -System.Security.Policy/TrustManagerUIContext.cs -System.Security.Policy/UnionCodeGroup.cs -System.Security.Policy/Url.cs -System.Security.Policy/UrlMembershipCondition.cs -System.Security.Policy/Zone.cs -System.Security.Policy/ZoneMembershipCondition.cs -System.Security.Principal/GenericPrincipal.cs -System.Security.Principal/IdentityNotMappedException.cs -System.Security.Principal/IdentityReferenceCollection.cs -System.Security.Principal/IdentityReference.cs -System.Security.Principal/IIdentity.cs -System.Security.Principal/IPrincipal.cs -System.Security.Principal/NTAccount.cs -System.Security.Principal/PrincipalPolicy.cs -System.Security.Principal/SecurityIdentifier.cs -System.Security.Principal/TokenAccessLevels.cs -System.Security.Principal/TokenImpersonationLevel.cs -System.Security.Principal/WellKnownAccount.cs -System.Security.Principal/WellKnownSidType.cs -System.Security.Principal/WindowsAccountType.cs -System.Security.Principal/WindowsBuiltInRole.cs -System.Security.Principal/WindowsIdentity.cs -System.Security.Principal/WindowsImpersonationContext.cs -System.Security.Principal/WindowsPrincipal.cs -System.Text/EncodingHelper.cs -System.Threading/CompressedStack.cs -System.Threading/HostExecutionContext.cs -System.Threading/HostExecutionContextManager.cs -System.Threading/Interlocked.cs -System.Threading/LockCookie.cs -System.Threading/LockQueue.cs -System.Threading/Monitor.cs -System.Threading/Mutex.cs -System.Threading/NativeEventCalls.cs -System.Threading/NativeOverlapped.cs -System.Threading/Overlapped.cs -System.Threading/ReaderWriterLock.cs -System.Threading/RegisteredWaitHandle.cs -System.Threading/Thread.cs -System.Threading/Timer.cs -System.Threading/TimerCallback.cs -System.Threading/Volatile.cs -System.Threading/WaitHandle.cs - -System.Threading.Tasks/DecoupledTask.cs -../Mono.Parallel/Mono.Threading/AtomicBoolean.cs - -CoreFoundation/CFHelpers.cs - -ReferenceSources/__ConsoleStream.cs -ReferenceSources/Array.cs -ReferenceSources/BCLDebug.cs -ReferenceSources/CalendarData.cs -ReferenceSources/CompatibilitySwitches.cs -ReferenceSources/CultureData.cs -ReferenceSources/DefaultBinder.cs -ReferenceSources/Environment.cs -ReferenceSources/ParseNumbers.cs -ReferenceSources/AppDomain.cs -ReferenceSources/CLRConfig.cs -ReferenceSources/JitHelpers.cs -ReferenceSources/EncodingDataItem.cs -ReferenceSources/EncodingTable.cs -ReferenceSources/TypeNameParser.cs -ReferenceSources/RuntimeType.cs -ReferenceSources/RemotingFieldCachedData.cs -ReferenceSources/MethodBase.cs -ReferenceSources/NativeMethods.cs -ReferenceSources/RuntimeHandles.cs -ReferenceSources/CompareInfo.cs -ReferenceSources/Buffer.cs -ReferenceSources/TextInfo.cs -ReferenceSources/win32native.cs -ReferenceSources/SecurityContext.cs -ReferenceSources/PathInternal.cs -ReferenceSources/BinaryCompatibility.cs -ReferenceSources/String.cs -ReferenceSources/Type.cs - -../referencesource/mscorlib/system/__filters.cs -../referencesource/mscorlib/system/__hresults.cs -../referencesource/mscorlib/system/_localdatastore.cs -../referencesource/mscorlib/system/_localdatastoremgr.cs -../referencesource/mscorlib/system/accessviolationexception.cs -../referencesource/mscorlib/system/action.cs -../referencesource/mscorlib/system/activator.cs -../referencesource/mscorlib/system/AggregateException.cs -../referencesource/mscorlib/system/appdomainattributes.cs -../referencesource/mscorlib/system/appdomainunloadedexception.cs -../referencesource/mscorlib/system/applicationexception.cs -../referencesource/mscorlib/system/applicationid.cs -../referencesource/mscorlib/system/argumentexception.cs -../referencesource/mscorlib/system/argumentnullexception.cs -../referencesource/mscorlib/system/argumentoutofrangeexception.cs -../referencesource/mscorlib/system/arithmeticexception.cs -../referencesource/mscorlib/system/arraytypemismatchexception.cs -../referencesource/mscorlib/system/asynccallback.cs -../referencesource/mscorlib/system/attribute.cs -../referencesource/mscorlib/system/attributetargets.cs -../referencesource/mscorlib/system/attributeusageattribute.cs -../referencesource/mscorlib/system/badimageformatexception.cs -../referencesource/mscorlib/system/bitconverter.cs -../referencesource/mscorlib/system/boolean.cs -../referencesource/mscorlib/system/buffer.cs -../referencesource/mscorlib/system/byte.cs -../referencesource/mscorlib/system/cannotunloadappdomainexception.cs -../referencesource/mscorlib/system/char.cs -../referencesource/mscorlib/system/charenumerator.cs -../referencesource/mscorlib/system/consolecanceleventargs.cs -../referencesource/mscorlib/system/consolecolor.cs -../referencesource/mscorlib/system/consolekey.cs -../referencesource/mscorlib/system/consolekeyinfo.cs -../referencesource/mscorlib/system/consolemodifiers.cs -../referencesource/mscorlib/system/consolespecialkey.cs -../referencesource/mscorlib/system/contextboundobject.cs -../referencesource/mscorlib/system/contextstaticattribute.cs -../referencesource/mscorlib/system/clscompliantattribute.cs -../referencesource/mscorlib/system/contextmarshalexception.cs -../referencesource/mscorlib/system/convert.cs -../referencesource/mscorlib/system/datamisalignedexception.cs -../referencesource/mscorlib/system/datetime.cs -../referencesource/mscorlib/system/datetimekind.cs -../referencesource/mscorlib/system/datetimeoffset.cs -../referencesource/mscorlib/system/dayofweek.cs -../referencesource/mscorlib/system/decimal.cs -../referencesource/mscorlib/system/defaultbinder.cs -../referencesource/mscorlib/system/dbnull.cs -../referencesource/mscorlib/system/dividebyzeroexception.cs -../referencesource/mscorlib/system/dllnotfoundexception.cs -../referencesource/mscorlib/system/double.cs -../referencesource/mscorlib/system/duplicatewaitobjectexception.cs -../referencesource/mscorlib/system/empty.cs -../referencesource/mscorlib/system/enum.cs -../referencesource/mscorlib/system/entrypointnotfoundexception.cs -../referencesource/mscorlib/system/eventargs.cs -../referencesource/mscorlib/system/eventhandler.cs -../referencesource/mscorlib/system/exception.cs -../referencesource/mscorlib/system/executionengineexception.cs -../referencesource/mscorlib/system/fieldaccessexception.cs -../referencesource/mscorlib/system/flagsattribute.cs -../referencesource/mscorlib/system/formatexception.cs -../referencesource/mscorlib/system/FormattableString.cs -../referencesource/mscorlib/system/gc.cs -../referencesource/mscorlib/system/guid.cs -../referencesource/mscorlib/system/iappdomain.cs -../referencesource/mscorlib/system/iappdomainsetup.cs -../referencesource/mscorlib/system/iasyncresult.cs -../referencesource/mscorlib/system/icloneable.cs -../referencesource/mscorlib/system/icomparable.cs -../referencesource/mscorlib/system/iconvertible.cs -../referencesource/mscorlib/system/icustomformatter.cs -../referencesource/mscorlib/system/idisposable.cs -../referencesource/mscorlib/system/iequatable.cs -../referencesource/mscorlib/system/iformatprovider.cs -../referencesource/mscorlib/system/iformattable.cs -../referencesource/mscorlib/system/invalidcastexception.cs -../referencesource/mscorlib/system/indexoutofrangeexception.cs -../referencesource/mscorlib/system/invalidoperationexception.cs -../referencesource/mscorlib/system/invalidprogramexception.cs -../referencesource/mscorlib/system/insufficientexecutionstackexception.cs -../referencesource/mscorlib/system/insufficientmemoryexception.cs -../referencesource/mscorlib/system/int16.cs -../referencesource/mscorlib/system/int32.cs -../referencesource/mscorlib/system/int64.cs -../referencesource/mscorlib/system/iobservable.cs -../referencesource/mscorlib/system/iobserver.cs -../referencesource/mscorlib/system/iprogress.cs -../referencesource/mscorlib/system/iserviceobjectprovider.cs -../referencesource/mscorlib/system/invalidtimezoneexception.cs -../referencesource/mscorlib/system/Lazy.cs -../referencesource/mscorlib/system/math.cs -../referencesource/mscorlib/system/memberaccessexception.cs -../referencesource/mscorlib/system/methodaccessexception.cs -../referencesource/mscorlib/system/midpointrounding.cs -../referencesource/mscorlib/system/missingfieldexception.cs -../referencesource/mscorlib/system/missingmemberexception.cs -../referencesource/mscorlib/system/missingmethodexception.cs -../referencesource/mscorlib/system/multicastnotsupportedexception.cs -../referencesource/mscorlib/system/nonserializedattribute.cs -../referencesource/mscorlib/system/notfinitenumberexception.cs -../referencesource/mscorlib/system/notimplementedexception.cs -../referencesource/mscorlib/system/notsupportedexception.cs -../referencesource/mscorlib/system/nullreferenceexception.cs -../referencesource/mscorlib/system/number.cs -../referencesource/mscorlib/system/objectdisposedexception.cs -../referencesource/mscorlib/system/obsoleteattribute.cs -../referencesource/mscorlib/system/operationcanceledexception.cs -../referencesource/mscorlib/system/outofmemoryexception.cs -../referencesource/mscorlib/system/overflowexception.cs -../referencesource/mscorlib/system/paramarrayattribute.cs -../referencesource/mscorlib/system/paramsarray.cs -../referencesource/mscorlib/system/platformnotsupportedexception.cs -../referencesource/mscorlib/system/progress.cs -../referencesource/mscorlib/system/random.cs -../referencesource/mscorlib/system/rankexception.cs -../referencesource/mscorlib/system/resid.cs -../referencesource/mscorlib/system/rttype.cs -../referencesource/mscorlib/system/sbyte.cs -../referencesource/mscorlib/system/serializableattribute.cs -../referencesource/mscorlib/system/sharedstatics.cs -../referencesource/mscorlib/system/stackoverflowexception.cs -../referencesource/mscorlib/system/single.cs -../referencesource/mscorlib/system/stringcomparer.cs -../referencesource/mscorlib/system/stringfreezingattribute.cs -../referencesource/mscorlib/system/systemexception.cs -../referencesource/mscorlib/system/timeoutexception.cs -../referencesource/mscorlib/system/timespan.cs -../referencesource/mscorlib/system/threadattributes.cs -../referencesource/mscorlib/system/threadstaticattribute.cs -../referencesource/mscorlib/system/throwhelper.cs -../referencesource/mscorlib/system/timezoneinfo.cs -../referencesource/mscorlib/system/timezonenotfoundexception.cs -../referencesource/mscorlib/system/type.cs -../referencesource/mscorlib/system/typeaccessexception.cs -../referencesource/mscorlib/system/typeinitializationexception.cs -../referencesource/mscorlib/system/typeloadexception.cs -../referencesource/mscorlib/system/typedreference.cs -../referencesource/mscorlib/system/typeunloadedexception.cs -../referencesource/mscorlib/system/uint16.cs -../referencesource/mscorlib/system/uint32.cs -../referencesource/mscorlib/system/uint64.cs -../referencesource/mscorlib/system/unauthorizedaccessexception.cs -../referencesource/mscorlib/system/unhandledexceptioneventargs.cs -../referencesource/mscorlib/system/unhandledexceptioneventhandler.cs -../referencesource/mscorlib/system/unityserializationholder.cs -../referencesource/mscorlib/system/unsafecharbuffer.cs -../referencesource/mscorlib/system/version.cs - -../referencesource/mscorlib/system/AppContext/AppContext.cs -../referencesource/mscorlib/system/AppContext/AppContextSwitches.cs -ReferenceSources/AppContextDefaultValues.cs - -../referencesource/mscorlib/system/collections/generic/comparer.cs -../referencesource/mscorlib/system/collections/generic/equalitycomparer.cs -../referencesource/mscorlib/system/collections/emptyreadonlydictionaryinternal.cs - -../referencesource/mscorlib/system/diagnostics/assert.cs -../referencesource/mscorlib/system/diagnostics/assertfilter.cs -../referencesource/mscorlib/system/diagnostics/assertfilters.cs -../referencesource/mscorlib/system/diagnostics/conditionalattribute.cs -../referencesource/mscorlib/system/diagnostics/debuggerattributes.cs - -../referencesource/mscorlib/system/diagnostics/codeanalysis/suppressmessageattribute.cs - -../referencesource/mscorlib/system/diagnostics/contracts/contracts.cs -../referencesource/mscorlib/system/diagnostics/contracts/contractsbcl.cs - -../referencesource/mscorlib/system/diagnostics/eventing/eventactivityoptions.cs -../referencesource/mscorlib/system/diagnostics/eventing/eventsourceexception.cs -../referencesource/mscorlib/system/diagnostics/eventing/winmeta.cs - -../referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/EventSourceOptions.cs -../referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/TraceLoggingEventTraits.cs - -../referencesource/mscorlib/system/globalization/bidicategory.cs -../referencesource/mscorlib/system/globalization/calendar.cs -../referencesource/mscorlib/system/globalization/calendaralgorithmtype.cs -../referencesource/mscorlib/system/globalization/CalendricalCalculationsHelper.cs -../referencesource/mscorlib/system/globalization/calendardata.cs -../referencesource/mscorlib/system/globalization/calendarweekrule.cs -../referencesource/mscorlib/system/globalization/charunicodeinfo.cs -../referencesource/mscorlib/system/globalization/chineselunisolarcalendar.cs -#../referencesource/mscorlib/system/globalization/compareinfo.cs -../referencesource/mscorlib/system/globalization/culturenotfoundexception.cs -../referencesource/mscorlib/system/globalization/culturetypes.cs -../referencesource/mscorlib/system/globalization/daylighttime.cs -../referencesource/mscorlib/system/globalization/datetimeformat.cs -../referencesource/mscorlib/system/globalization/datetimeformatinfo.cs -../referencesource/mscorlib/system/globalization/datetimeformatinfoscanner.cs -../referencesource/mscorlib/system/globalization/datetimeparse.cs -../referencesource/mscorlib/system/globalization/datetimestyles.cs -../referencesource/mscorlib/system/globalization/digitshapes.cs -../referencesource/mscorlib/system/globalization/eastasianlunisolarcalendar.cs -../referencesource/mscorlib/system/globalization/globalizationassembly.cs -../referencesource/mscorlib/system/globalization/gregoriancalendar.cs -../referencesource/mscorlib/system/globalization/gregoriancalendarhelper.cs -../referencesource/mscorlib/system/globalization/gregoriancalendartypes.cs -../referencesource/mscorlib/system/globalization/hebrewcalendar.cs -../referencesource/mscorlib/system/globalization/hebrewnumber.cs -../referencesource/mscorlib/system/globalization/hijricalendar.cs -../referencesource/mscorlib/system/globalization/japanesecalendar.cs -../referencesource/mscorlib/system/globalization/japaneselunisolarcalendar.cs -../referencesource/mscorlib/system/globalization/juliancalendar.cs -../referencesource/mscorlib/system/globalization/koreancalendar.cs -../referencesource/mscorlib/system/globalization/koreanlunisolarcalendar.cs -../referencesource/mscorlib/system/globalization/numberstyles.cs -../referencesource/mscorlib/system/globalization/numberformatinfo.cs -../referencesource/mscorlib/system/globalization/Persiancalendar.cs -../referencesource/mscorlib/system/globalization/sortversion.cs -../referencesource/mscorlib/system/globalization/stringinfo.cs -../referencesource/mscorlib/system/globalization/taiwancalendar.cs -../referencesource/mscorlib/system/globalization/taiwanlunisolarcalendar.cs -../referencesource/mscorlib/system/globalization/textelementenumerator.cs -../referencesource/mscorlib/system/globalization/timespanformat.cs -../referencesource/mscorlib/system/globalization/timespanparse.cs -../referencesource/mscorlib/system/globalization/textinfo.cs -../referencesource/mscorlib/system/globalization/thaibuddhistcalendar.cs -../referencesource/mscorlib/system/globalization/umalquracalendar.cs -../referencesource/mscorlib/system/globalization/unicodecategory.cs - -../referencesource/mscorlib/system/io/__error.cs -../referencesource/mscorlib/system/io/__hresults.cs -../referencesource/mscorlib/system/io/binaryreader.cs -../referencesource/mscorlib/system/io/binarywriter.cs -../referencesource/mscorlib/system/io/bufferedstream.cs -../referencesource/mscorlib/system/io/directory.cs -../referencesource/mscorlib/system/io/directorynotfoundexception.cs -../referencesource/mscorlib/system/io/drivenotfoundexception.cs -../referencesource/mscorlib/system/io/endofstreamexception.cs -../referencesource/mscorlib/system/io/ioexception.cs -../referencesource/mscorlib/system/io/fileinfo.cs -../referencesource/mscorlib/system/io/fileloadexception.cs -../referencesource/mscorlib/system/io/filenotfoundexception.cs -../referencesource/mscorlib/system/io/filesysteminfo.cs -../referencesource/mscorlib/system/io/filesystemenumerable.cs -../referencesource/mscorlib/system/io/memorystream.cs -../referencesource/mscorlib/system/io/pathtoolongexception.cs -../referencesource/mscorlib/system/io/pinnedbuffermemorystream.cs -../referencesource/mscorlib/system/io/stream.cs -../referencesource/mscorlib/system/io/streamreader.cs -../referencesource/mscorlib/system/io/streamwriter.cs -../referencesource/mscorlib/system/io/stringreader.cs -../referencesource/mscorlib/system/io/stringwriter.cs -../referencesource/mscorlib/system/io/textreader.cs -../referencesource/mscorlib/system/io/textwriter.cs -../referencesource/mscorlib/system/io/unmanagedmemoryaccessor.cs -../referencesource/mscorlib/system/io/unmanagedmemorystream.cs -../referencesource/mscorlib/system/io/unmanagedmemorystreamwrapper.cs - -../referencesource/mscorlib/system/reflection/ambiguousmatchexception.cs -../referencesource/mscorlib/system/reflection/assemblyattributes.cs -../referencesource/mscorlib/system/reflection/assemblynameflags.cs -../referencesource/mscorlib/system/reflection/assemblynameproxy.cs -../referencesource/mscorlib/system/reflection/binder.cs -../referencesource/mscorlib/system/reflection/callingconventions.cs -../referencesource/mscorlib/system/reflection/CustomAttributeExtensions.cs -../referencesource/mscorlib/system/reflection/defaultmemberattribute.cs -../referencesource/mscorlib/system/reflection/eventattributes.cs -../referencesource/mscorlib/system/reflection/fieldattributes.cs -../referencesource/mscorlib/system/reflection/genericparameterattributes.cs -../referencesource/mscorlib/system/reflection/icustomattributeprovider.cs -../referencesource/mscorlib/system/reflection/interfacemapping.cs -../referencesource/mscorlib/system/reflection/invalidfiltercriteriaexception.cs -../referencesource/mscorlib/system/reflection/introspectionextensions.cs -../referencesource/mscorlib/system/reflection/ireflect.cs -../referencesource/mscorlib/system/reflection/ireflectabletype.cs -../referencesource/mscorlib/system/reflection/manifestresourceinfo.cs -../referencesource/mscorlib/system/reflection/mdimport.cs -../referencesource/mscorlib/system/reflection/memberfilter.cs -../referencesource/mscorlib/system/reflection/memberinfo.cs -../referencesource/mscorlib/system/reflection/memberinfoserializationholder.cs -../referencesource/mscorlib/system/reflection/membertypes.cs -../referencesource/mscorlib/system/reflection/methodattributes.cs -../referencesource/mscorlib/system/reflection/methodbase.cs -../referencesource/mscorlib/system/reflection/methodbody.cs -../referencesource/mscorlib/system/reflection/methodimplattributes.cs -../referencesource/mscorlib/system/reflection/methodinfo.cs -../referencesource/mscorlib/system/reflection/missing.cs -../referencesource/mscorlib/system/reflection/obfuscateassemblyattribute.cs -../referencesource/mscorlib/system/reflection/obfuscationattribute.cs -../referencesource/mscorlib/system/reflection/parameterattributes.cs -../referencesource/mscorlib/system/reflection/parametermodifier.cs -../referencesource/mscorlib/system/reflection/pointer.cs -../referencesource/mscorlib/system/reflection/propertyattributes.cs -../referencesource/mscorlib/system/reflection/reflectioncontext.cs -../referencesource/mscorlib/system/reflection/reflectiontypeloadexception.cs -../referencesource/mscorlib/system/reflection/resourceattributes.cs -../referencesource/mscorlib/system/reflection/RuntimeReflectionExtensions.cs -../referencesource/mscorlib/system/reflection/targetexception.cs -../referencesource/mscorlib/system/reflection/targetinvocationexception.cs -../referencesource/mscorlib/system/reflection/targetparametercountexception.cs -../referencesource/mscorlib/system/reflection/typeattributes.cs -../referencesource/mscorlib/system/reflection/typedelegator.cs -../referencesource/mscorlib/system/reflection/typefilter.cs -../referencesource/mscorlib/system/reflection/typeinfo.cs - -../referencesource/mscorlib/system/reflection/emit/methodbuilder.cs -../referencesource/mscorlib/system/reflection/emit/symboltype.cs - -../referencesource/mscorlib/system/resources/__fastresourcecomparer.cs -../referencesource/mscorlib/system/resources/__hresults.cs -../referencesource/mscorlib/system/resources/filebasedresourcegroveler.cs -../referencesource/mscorlib/system/resources/iresourcegroveler.cs -../referencesource/mscorlib/system/resources/iresourcereader.cs -../referencesource/mscorlib/system/resources/iresourcewriter.cs -../referencesource/mscorlib/system/resources/looselylinkedresourcereference.cs -../referencesource/mscorlib/system/resources/manifestbasedresourcegroveler.cs -../referencesource/mscorlib/system/resources/missingmanifestresourceexception.cs -../referencesource/mscorlib/system/resources/missingsatelliteassemblyexception.cs -../referencesource/mscorlib/system/resources/neutralresourceslanguageattribute.cs -../referencesource/mscorlib/system/resources/resourcefallbackmanager.cs -../referencesource/mscorlib/system/resources/resourcemanager.cs -../referencesource/mscorlib/system/resources/resourcereader.cs -../referencesource/mscorlib/system/resources/resourceset.cs -../referencesource/mscorlib/system/resources/resourcetypecode.cs -../referencesource/mscorlib/system/resources/resourcewriter.cs -../referencesource/mscorlib/system/resources/runtimeresourceset.cs -../referencesource/mscorlib/system/resources/satellitecontractversionattribute.cs -../referencesource/mscorlib/system/resources/ultimateresourcefallbacklocation.cs - -../referencesource/mscorlib/system/runtime/NgenServicingAttributes.cs -../referencesource/mscorlib/system/runtime/ProfileOptimization.cs - -../referencesource/mscorlib/system/runtime/exceptionservices/corruptingexceptioncommon.cs -../referencesource/mscorlib/system/runtime/exceptionservices/exceptionnotification.cs -../referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs - -../referencesource/mscorlib/system/runtime/interopservices/arraywithoffset.cs -../referencesource/mscorlib/system/runtime/interopservices/attributes.cs -../referencesource/mscorlib/system/runtime/interopservices/bstrwrapper.cs -../referencesource/mscorlib/system/runtime/interopservices/callingconvention.cs -../referencesource/mscorlib/system/runtime/interopservices/charset.cs -../referencesource/mscorlib/system/runtime/interopservices/comexception.cs -../referencesource/mscorlib/system/runtime/interopservices/commembertype.cs -../referencesource/mscorlib/system/runtime/interopservices/criticalhandle.cs -../referencesource/mscorlib/system/runtime/interopservices/currencywrapper.cs -../referencesource/mscorlib/system/runtime/interopservices/dispatchwrapper.cs -../referencesource/mscorlib/system/runtime/interopservices/errorwrapper.cs -../referencesource/mscorlib/system/runtime/interopservices/externalexception.cs -../referencesource/mscorlib/system/runtime/interopservices/handleref.cs -../referencesource/mscorlib/system/runtime/interopservices/icustomadapter.cs -../referencesource/mscorlib/system/runtime/interopservices/icustomfactory.cs -../referencesource/mscorlib/system/runtime/interopservices/icustommarshaler.cs -../referencesource/mscorlib/system/runtime/interopservices/icustomqueryinterface.cs -../referencesource/mscorlib/system/runtime/interopservices/invalidcomobjectexception.cs -../referencesource/mscorlib/system/runtime/interopservices/invalidolevarianttypeexception.cs -../referencesource/mscorlib/system/runtime/interopservices/iregistrationservices.cs -../referencesource/mscorlib/system/runtime/interopservices/layoutkind.cs -../referencesource/mscorlib/system/runtime/interopservices/marshaldirectiveexception.cs -../referencesource/mscorlib/system/runtime/interopservices/objectcreationdelegate.cs -../referencesource/mscorlib/system/runtime/interopservices/runtimeenvironment.cs -../referencesource/mscorlib/system/runtime/interopservices/safearrayrankmismatchexception.cs -../referencesource/mscorlib/system/runtime/interopservices/safearraytypemismatchexception.cs -../referencesource/mscorlib/system/runtime/interopservices/safehandle.cs -../referencesource/mscorlib/system/runtime/interopservices/sehexception.cs -../referencesource/mscorlib/system/runtime/interopservices/ucomitypeinfo.cs -../referencesource/mscorlib/system/runtime/interopservices/ucomienumconnections.cs -../referencesource/mscorlib/system/runtime/interopservices/unknownwrapper.cs -../referencesource/mscorlib/system/runtime/interopservices/variantWrapper.cs - -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ibindctx.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/iconnectionpoint.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/iconnectionpointcontainer.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ienumconnectionpoints.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ienumconnections.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ienumerable.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ienumerator.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ienummoniker.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ienumstring.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ienumvariant.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/iexpando.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/imoniker.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ipersistfile.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/ireflect.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/irunningobjecttable.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/istream.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/itypecomp.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/itypeinfo.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/itypeinfo2.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/itypelib.cs -../referencesource/mscorlib/system/runtime/interopservices/ComTypes/itypelib2.cs - -../referencesource/mscorlib/system/runtime/interopservices/expando/iexpando.cs - -../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/attributes.cs -../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/eventregistrationtoken.cs -../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/eventregistrationtokentable.cs -../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/iactivationfactory.cs -../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/irestrictederrorinfo.cs -../referencesource/mscorlib/system/runtime/interopservices/windowsruntime/windowsruntimemarshal.cs - -../referencesource/mscorlib/system/runtime/reliability/criticalfinalizerobject.cs -../referencesource/mscorlib/system/runtime/reliability/prepreparemethodattribute.cs -../referencesource/mscorlib/system/runtime/reliability/reliabilitycontractattribute.cs - -../referencesource/mscorlib/system/runtime/compilerservices/assemblyattributesgohere.cs -../referencesource/mscorlib/system/runtime/compilerservices/assemblysettingattributes.cs -../referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs -../referencesource/mscorlib/system/runtime/compilerservices/callingconvention.cs -../referencesource/mscorlib/system/runtime/compilerservices/compilationrelaxations.cs -../referencesource/mscorlib/system/runtime/compilerservices/compilermarshaloverride.cs -../referencesource/mscorlib/system/runtime/compilerservices/decoratednameattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/hascopysemanticsattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/idispatchconstantattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/internalsvisibletoattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/isboxed.cs -../referencesource/mscorlib/system/runtime/compilerservices/isbyvalue.cs -../referencesource/mscorlib/system/runtime/compilerservices/iscopyconstructed.cs -../referencesource/mscorlib/system/runtime/compilerservices/isexplicitlydereferenced.cs -../referencesource/mscorlib/system/runtime/compilerservices/isimplicitlydereferenced.cs -../referencesource/mscorlib/system/runtime/compilerservices/isjitintrinsic.cs -../referencesource/mscorlib/system/runtime/compilerservices/islong.cs -../referencesource/mscorlib/system/runtime/compilerservices/ispinned.cs -../referencesource/mscorlib/system/runtime/compilerservices/issignunspecifiedbyte.cs -../referencesource/mscorlib/system/runtime/compilerservices/isudtreturn.cs -../referencesource/mscorlib/system/runtime/compilerservices/iunknownconstantattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/methodimplattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/nativecppclassattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/requiredattributeattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/scopelessenumattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/suppressmergecheckattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/typedependencyattribute.cs -../referencesource/mscorlib/system/runtime/compilerservices/YieldAwaitable.cs - -../referencesource/mscorlib/system/security/attributes.cs -../referencesource/mscorlib/system/security/securitycontext.cs -../referencesource/mscorlib/system/security/securitydocument.cs -../referencesource/mscorlib/system/security/safesecurityhandles.cs - -../referencesource/mscorlib/system/security/claims/Claim.cs -../referencesource/mscorlib/system/security/claims/ClaimsIdentity.cs -../referencesource/mscorlib/system/security/claims/ClaimsPrincipal.cs -../referencesource/mscorlib/system/security/claims/ClaimTypes.cs -../referencesource/mscorlib/system/security/claims/ClaimValueTypes.cs -../referencesource/mscorlib/system/security/claims/RoleClaimProvider.cs - -../referencesource/mscorlib/system/security/cryptography/aes.cs -../referencesource/mscorlib/system/security/cryptography/asymmetricalgorithm.cs -../referencesource/mscorlib/system/security/cryptography/asymmetrickeyexchangedeformatter.cs -../referencesource/mscorlib/system/security/cryptography/asymmetrickeyexchangeformatter.cs -../referencesource/mscorlib/system/security/cryptography/asymmetricsignaturedeformatter.cs -../referencesource/mscorlib/system/security/cryptography/asymmetricsignatureformatter.cs -../referencesource/mscorlib/system/security/cryptography/base64transforms.cs -../referencesource/mscorlib/system/security/cryptography/crypto.cs -../referencesource/mscorlib/system/security/cryptography/cryptoapitransform.cs -../referencesource/mscorlib/system/security/cryptography/cryptostream.cs -../referencesource/mscorlib/system/security/cryptography/derivebytes.cs -../referencesource/mscorlib/system/security/cryptography/des.cs -../referencesource/mscorlib/system/security/cryptography/descryptoserviceprovider.cs -../referencesource/mscorlib/system/security/cryptography/dsa.cs -../referencesource/mscorlib/system/security/cryptography/dsasignaturedeformatter.cs -../referencesource/mscorlib/system/security/cryptography/dsasignatureformatter.cs -../referencesource/mscorlib/system/security/cryptography/hashalgorithm.cs -../referencesource/mscorlib/system/security/cryptography/HashAlgorithmName.cs -../referencesource/mscorlib/system/security/cryptography/hmac.cs -../referencesource/mscorlib/system/security/cryptography/hmacmd5.cs -../referencesource/mscorlib/system/security/cryptography/hmacripemd160.cs -../referencesource/mscorlib/system/security/cryptography/hmacsha1.cs -../referencesource/mscorlib/system/security/cryptography/hmacsha256.cs -../referencesource/mscorlib/system/security/cryptography/hmacsha384.cs -../referencesource/mscorlib/system/security/cryptography/hmacsha512.cs -../referencesource/mscorlib/system/security/cryptography/icryptotransform.cs -../referencesource/mscorlib/system/security/cryptography/keyedhashalgorithm.cs -../referencesource/mscorlib/system/security/cryptography/mactripledes.cs -../referencesource/mscorlib/system/security/cryptography/maskgenerationmethod.cs -../referencesource/mscorlib/system/security/cryptography/md5.cs -../referencesource/mscorlib/system/security/cryptography/passwordderivebytes.cs -../referencesource/mscorlib/system/security/cryptography/pkcs1maskgenerationmethod.cs -../referencesource/mscorlib/system/security/cryptography/randomnumbergenerator.cs -../referencesource/mscorlib/system/security/cryptography/rc2.cs -../referencesource/mscorlib/system/security/cryptography/rc2cryptoserviceprovider.cs -../referencesource/mscorlib/system/security/cryptography/rfc2898derivebytes.cs -../referencesource/mscorlib/system/security/cryptography/rijndael.cs -../referencesource/mscorlib/system/security/cryptography/rijndaelmanaged.cs -../referencesource/mscorlib/system/security/cryptography/rijndaelmanagedtransform.cs -../referencesource/mscorlib/system/security/cryptography/ripemd160.cs -../referencesource/mscorlib/system/security/cryptography/ripemd160managed.cs -../referencesource/mscorlib/system/security/cryptography/rsa.cs -../referencesource/mscorlib/system/security/cryptography/rsacryptoserviceprovider.cs -../referencesource/mscorlib/system/security/cryptography/rsaoaepkeyexchangedeformatter.cs -../referencesource/mscorlib/system/security/cryptography/rsaoaepkeyexchangeformatter.cs -../referencesource/mscorlib/system/security/cryptography/rsapkcs1keyexchangedeformatter.cs -../referencesource/mscorlib/system/security/cryptography/rsapkcs1keyexchangeformatter.cs -../referencesource/mscorlib/system/security/cryptography/RSAEncryptionPadding.cs -../referencesource/mscorlib/system/security/cryptography/RSAEncryptionPaddingMode.cs -../referencesource/mscorlib/system/security/cryptography/RSASignaturePadding.cs -../referencesource/mscorlib/system/security/cryptography/RSASignaturePaddingMode.cs -../referencesource/mscorlib/system/security/cryptography/sha1.cs -../referencesource/mscorlib/system/security/cryptography/sha1managed.cs -../referencesource/mscorlib/system/security/cryptography/sha256.cs -../referencesource/mscorlib/system/security/cryptography/sha256managed.cs -../referencesource/mscorlib/system/security/cryptography/sha384.cs -../referencesource/mscorlib/system/security/cryptography/sha384managed.cs -../referencesource/mscorlib/system/security/cryptography/sha512.cs -../referencesource/mscorlib/system/security/cryptography/sha512managed.cs -../referencesource/mscorlib/system/security/cryptography/signaturedescription.cs -../referencesource/mscorlib/system/security/cryptography/symmetricalgorithm.cs -../referencesource/mscorlib/system/security/cryptography/tripledes.cs -../referencesource/mscorlib/system/security/cryptography/tripledescryptoserviceprovider.cs -../referencesource/mscorlib/system/security/cryptography/utils.cs - -../referencesource/mscorlib/system/security/cryptography/x509certificates/x509utils.cs - -../referencesource/mscorlib/system/security/principal/genericidentity.cs - -../referencesource/mscorlib/system/security/util/hex.cs -../referencesource/mscorlib/system/security/util/parser.cs -../referencesource/mscorlib/system/security/util/tokenizer.cs - -../../../external/corefx/src/Common/src/CoreLib/System/ISpanFormattable.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/ASCIIEncoding.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/Decoder.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/DecoderBestFitFallback.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/DecoderExceptionFallback.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/DecoderFallback.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/DecoderNLS.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/DecoderReplacementFallback.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/Encoder.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/EncoderBestFitFallback.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/EncoderExceptionFallback.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/EncoderFallback.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/EncoderNLS.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/EncoderReplacementFallback.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/EncodingInfo.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/EncodingNLS.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/EncodingProvider.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/Latin1Encoding.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/NormalizationForm.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/UnicodeEncoding.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/UTF32Encoding.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/UTF7Encoding.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/UTF8Encoding.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/ValueStringBuilder.cs -../referencesource/mscorlib/system/text/codepageencoding.cs -../referencesource/mscorlib/system/text/encoding.cs -../referencesource/mscorlib/system/text/mlangcodepageencoding.cs -../referencesource/mscorlib/system/text/surrogateencoder.cs - -../../../external/corefx/src/Common/src/CoreLib/System/ISpanFormattable.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs -../../../external/corefx/src/Common/src/CoreLib/System/Text/StringBuilderCache.cs - -../referencesource/mscorlib/system/runtime/remoting/callcontext.cs - -../referencesource/mscorlib/system/runtime/serialization/deserializationeventhandler.cs -../referencesource/mscorlib/system/runtime/serialization/formatter.cs -../referencesource/mscorlib/system/runtime/serialization/formatterconverter.cs -../referencesource/mscorlib/system/runtime/serialization/formatterservices.cs -../referencesource/mscorlib/system/runtime/serialization/ideserializationcallback.cs -../referencesource/mscorlib/system/runtime/serialization/iformatter.cs -../referencesource/mscorlib/system/runtime/serialization/iformatterconverter.cs -../referencesource/mscorlib/system/runtime/serialization/iobjectreference.cs -../referencesource/mscorlib/system/runtime/serialization/iserializable.cs -../referencesource/mscorlib/system/runtime/serialization/iserializationsurrogate.cs -../referencesource/mscorlib/system/runtime/serialization/isurrogateselector.cs -../referencesource/mscorlib/system/runtime/serialization/memberholder.cs -../referencesource/mscorlib/system/runtime/serialization/objectclonehelper.cs -../referencesource/mscorlib/system/runtime/serialization/objectidgenerator.cs -../referencesource/mscorlib/system/runtime/serialization/objectmanager.cs -../referencesource/mscorlib/system/runtime/serialization/safeserializationmanager.cs -../referencesource/mscorlib/system/runtime/serialization/serializationattributes.cs -../referencesource/mscorlib/system/runtime/serialization/serializationbinder.cs -../referencesource/mscorlib/system/runtime/serialization/serializationeventscache.cs -../referencesource/mscorlib/system/runtime/serialization/serializationexception.cs -../referencesource/mscorlib/system/runtime/serialization/serializationfieldinfo.cs -../referencesource/mscorlib/system/runtime/serialization/serializationinfo.cs -../referencesource/mscorlib/system/runtime/serialization/serializationinfoenumerator.cs -../referencesource/mscorlib/system/runtime/serialization/serializationobjectmanager.cs -../referencesource/mscorlib/system/runtime/serialization/streamingcontext.cs -../referencesource/mscorlib/system/runtime/serialization/surrogateselector.cs -../referencesource/mscorlib/system/runtime/serialization/valuetypefixupinfo.cs - -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binarycommonclasses.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryconverter.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryenums.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatterwriter.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binarymethodmessage.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectinfo.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectreader.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectwriter.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryparser.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryutilclasses.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/commonenums.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/ifieldinfo.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/isoapmessage.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/sertrace.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/soapfault.cs -../referencesource/mscorlib/system/runtime/serialization/formatters/soapmessage.cs - -../referencesource/mscorlib/system/runtime/versioning/componentguaranteesattribute.cs -../referencesource/mscorlib/system/runtime/versioning/multitargetinghelpers.cs -../referencesource/mscorlib/system/runtime/versioning/NonVersionableAttribute.cs -../referencesource/mscorlib/system/runtime/versioning/resourceattributes.cs -../referencesource/mscorlib/system/runtime/versioning/targetframeworkattribute.cs -../referencesource/mscorlib/system/runtime/versioning/targetframeworkid.cs - -../referencesource/mscorlib/system/threading/abandonedmutexexception.cs -../referencesource/mscorlib/system/threading/apartmentstate.cs -../referencesource/mscorlib/system/threading/asynclocal.cs -../referencesource/mscorlib/system/threading/autoresetevent.cs -../referencesource/mscorlib/system/threading/CancellationToken.cs -../referencesource/mscorlib/system/threading/CancellationTokenSource.cs -../referencesource/mscorlib/system/threading/CountdownEvent.cs -../referencesource/mscorlib/system/threading/eventresetmode.cs -../referencesource/mscorlib/system/threading/eventwaithandle.cs -../referencesource/mscorlib/system/threading/executioncontext.cs -../referencesource/mscorlib/system/threading/LazyInitializer.cs -../referencesource/mscorlib/system/threading/lockrecursionexception.cs -../referencesource/mscorlib/system/threading/manualresetevent.cs -../referencesource/mscorlib/system/threading/ManualResetEventSlim.cs -../referencesource/mscorlib/system/threading/monitor.cs -../referencesource/mscorlib/system/threading/parameterizedthreadstart.cs -../referencesource/mscorlib/system/threading/semaphorefullexception.cs -../referencesource/mscorlib/system/threading/SemaphoreSlim.cs -../referencesource/mscorlib/system/threading/sendorpostcallback.cs -../referencesource/mscorlib/system/threading/SpinLock.cs -../referencesource/mscorlib/system/threading/SpinWait.cs -../referencesource/mscorlib/system/threading/synchronizationcontext.cs -../referencesource/mscorlib/system/threading/synchronizationlockexception.cs -../referencesource/mscorlib/system/threading/thread.cs -../referencesource/mscorlib/system/threading/threadabortexception.cs -../referencesource/mscorlib/system/threading/threadinterruptedexception.cs -../referencesource/mscorlib/system/threading/ThreadLocal.cs -../referencesource/mscorlib/system/threading/threadpriority.cs -../referencesource/mscorlib/system/threading/threadstart.cs -../referencesource/mscorlib/system/threading/threadstartexception.cs -../referencesource/mscorlib/system/threading/threadstate.cs -../referencesource/mscorlib/system/threading/threadstateexception.cs -../referencesource/mscorlib/system/threading/timeout.cs -../referencesource/mscorlib/system/threading/waithandlecannotbeopenedexception.cs -../referencesource/mscorlib/system/threading/threadpool.cs -../referencesource/mscorlib/system/threading/waithandle.cs -../referencesource/mscorlib/system/threading/waithandleExtensions.cs - -../referencesource/mscorlib/system/threading/Tasks/AsyncCausalityTracer.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/CancellationTokenRegistration.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskExceptionHolder.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ProducerConsumerQueues.cs -../../../external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/TaskToApm.cs - -../referencesource/mscorlib/microsoft/win32/safehandles/safefilehandle.cs -../referencesource/mscorlib/microsoft/win32/safehandles/safefindhandle.cs -../referencesource/mscorlib/microsoft/win32/safehandles/saferegistryhandle.cs -../referencesource/mscorlib/microsoft/win32/safehandles/safewaithandle.cs -../referencesource/mscorlib/microsoft/win32/safehandles/win32safehandles.cs - -coreclr/SorterArray.cs - -corefx/AwaitTaskContinuation.cs -corefx/SynchronizationContext.cs -corefx/SR.cs -corefx/CompareInfo.cs -corefx/GlobalizationMode.cs -corefx/RuntimeImports.cs - -corert/DependencyReductionRootAttribute.cs -corert/AddrofIntrinsics.cs -corert/Debug.cs -corert/EnvironmentAugments.cs -corert/RelocatedTypeAttribute.cs -corert/RuntimeThread.cs -corert/Stream.cs -corert/Task.cs -corert/ThreadPool.cs -corert/ThreadPoolBoundHandle.platformnotsupported.cs -corert/PreAllocatedOverlapped.platformnotsupported.cs -corert/RuntimeAugments.cs - -../../../external/corert/src/Common/src/System/Collections/Generic/LowLevelList.cs - -../../../external/corert/src/Common/src/System/Numerics/Hashing/HashHelpers.cs - -../../../external/corert/src/System.Private.CoreLib/shared/System/Diagnostics/Debug.cs - -../../../external/corert/src/System.Private.CoreLib/src/Internal/Runtime/Augments/AsyncCausalityTracer.cs -../../../external/corert/src/System.Private.CoreLib/src/Internal/Runtime/Augments/TaskTraceCallbacks.cs - -../../../external/corert/src/System.Private.CoreLib/src/System/Array.cs -../../../external/corert/src/System.Private.CoreLib/src/System/ByReference.cs -# TODO: Should all come from shared -../../../external/corert/src/System.Private.CoreLib/src/System/String.cs - -../../../external/corert/src/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.cs - -../../../external/corert/src/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.cs - -../../../external/corert/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ReflectionBlockedAttribute.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/TaskAwaiter.cs - -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/LockHolder.cs - -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/DebuggerSupport.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/DebuggerSupport.Dummy.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskFactory.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs -../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/ThreadPoolTaskScheduler.cs - -../../../external/corert/src/System.Private.CoreLib/src/Internal/Threading/Tasks/Tracing/TaskTrace.cs - -../../../external/corert/src/System.Private.Interop/src/InteropExtensions/Lock.cs - - -../../../external/corefx/src/System.Runtime.Extensions/src/System/Collections/ArrayList.cs -../../../external/corefx/src/System.Collections.NonGeneric/src/System/Collections/*.cs -../../../external/corefx/src/System.Collections/src/System/Collections/BitArray.cs -../../../external/corefx/src/System.Collections/src/System/Collections/StructuralComparisons.cs -../../../external/corefx/src/Common/src/System/Collections/CompatibleComparer.cs - -../../../external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs -../../../external/corefx/src/System.Runtime.Extensions/src/System/Collections/IHashCodeProvider.cs -../../../external/corefx/src/System.ObjectModel/src/System/Collections/Generic/DebugView.cs -../../../external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/KeyedCollection.cs -../../../external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs - -../../../external/corefx/src/Common/src/CoreLib/System/ArraySegment.cs -../../../external/corefx/src/Common/src/CoreLib/System/Gen2GcCallback.cs -../../../external/corefx/src/Common/src/CoreLib/System/HResults.cs -../../../external/corefx/src/Common/src/CoreLib/System/MathF.cs -../../../external/corefx/src/Common/src/CoreLib/System/Marvin.cs -../../../external/corefx/src/Common/src/CoreLib/System/Memory.cs -../../../external/corefx/src/Common/src/CoreLib/System/MemoryDebugView.cs -../../../external/corefx/src/Common/src/CoreLib/System/MemoryExtensions.cs -../../../external/corefx/src/Common/src/CoreLib/System/MemoryExtensions.Fast.cs -../../../external/corefx/src/Common/src/CoreLib/System/ReadOnlyMemory.cs -../../../external/corefx/src/Common/src/CoreLib/System/ReadOnlySpan.cs -../../../external/corefx/src/Common/src/CoreLib/System/ReadOnlySpan.Fast.cs -../../../external/corefx/src/Common/src/CoreLib/System/Span.cs -../../../external/corefx/src/Common/src/CoreLib/System/Span.Fast.cs -../../../external/corefx/src/Common/src/CoreLib/System/SpanDebugView.cs -../../../external/corefx/src/Common/src/CoreLib/System/SpanHelpers*.cs -../../../external/corefx/src/Common/src/CoreLib/System/String.Comparison.cs -../../../external/corefx/src/Common/src/CoreLib/System/String.Manipulation.cs -../../../external/corefx/src/Common/src/CoreLib/System/String.Searching.cs -../../../external/corefx/src/Common/src/CoreLib/System/StringSplitOptions.cs -../../../external/corefx/src/Common/src/CoreLib/System/Tuple.cs -../../../external/corefx/src/Common/src/CoreLib/System/TupleExtensions.cs -../../../external/corefx/src/Common/src/CoreLib/System/ValueTuple.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/ArrayPool.cs -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/ArrayPoolEventSource.cs -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/ConfigurableArrayPool.cs -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/IMemoryOwner.cs -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/IPinnable.cs -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/MemoryHandle.cs -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/MemoryManager.cs -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/Utilities.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Collections/HashHelpers.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/Comparer.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/DictionaryEntry.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/ICollection.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/IComparer.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/IDictionary.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/IDictionaryEnumerator.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/IEnumerable.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/IEnumerator.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/IEqualityComparer.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/IList.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/IStructuralComparable.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/IStructuralEquatable.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/ListDictionaryInternal.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/DictionaryEntry.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Collections/Generic/*.cs:NonRandomizedStringEqualityComparer.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/ReadOnlyCollection.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/Generic/IDictionaryDebugView.cs -../../../external/corefx/src/Common/src/CoreLib/System/Collections/Generic/KeyValuePair.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Diagnostics/StackTraceHiddenAttribute.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.cs -../../../external/corefx/src/Common/src/CoreLib/System/Globalization/CompareInfo.Invariant.cs -../../../external/corefx/src/Common/src/CoreLib/System/Globalization/GlobalizationExtensions.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Numerics/ConstantHelper.cs -../../../external/corefx/src/Common/src/CoreLib/System/Numerics/Register.cs -../../../external/corefx/src/Common/src/CoreLib/System/Numerics/Vector.cs -../../../external/corefx/src/Common/src/CoreLib/System/Numerics/Vector_Operations.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Reflection/BindingFlags.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/AsyncMethodBuilderAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/AsyncValueTaskMethodBuilder.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ConfiguredValueTaskAwaitable.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IntrinsicAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IsReadOnlyAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IsByRefLikeAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ITuple.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeFeature.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ValueTaskAwaiter.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CallerFilePathAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CustomConstantAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DecimalConstantAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DiscardableAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ExtensionAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/FixedBufferAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/FormattableStringFactory.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IAsyncStateMachine.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IndexerNameAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/INotifyCompletion.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IsConst.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IsVolatile.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeWrappedException.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/SpecialNameAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/StateMachineAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs - - -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/InteropServices/MemoryMarshal.cs -../../../external/corefx/src/Common/src/CoreLib/System/Runtime/InteropServices/MemoryMarshal.Fast.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/TaskCanceledException.cs -../../../external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/TaskCompletionSource.cs -../../../external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/TaskSchedulerException.cs -../../../external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs -../../../external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/Sources/IValueTaskSource.cs - -../../../external/corefx/src/Common/src/System/Collections/Concurrent/ConcurrentQueue_Segment.cs - -../../../external/corefx/src/Common/src/System/Collections/Generic/LowLevelDictionary.cs -../../../external/corefx/src/Common/src/System/Collections/Generic/ReferenceEqualityComparer.cs - -../../../external/corefx/src/Common/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs -../../../external/corefx/src/Common/src/System/Threading/Tasks/RendezvousAwaitable.cs - -../../../external/corefx/src/System.Collections/src/System/Collections/Generic/CollectionExtensions.cs - -../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/CDSCollectionETWBCLProvider.cs -../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs -../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs -../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs -../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/IProducerConsumerCollection.cs -../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/OrderablePartitioner.cs -../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/Partitioner.cs -../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs - -../../../external/corefx/src/System.Memory/src/System/Pinnable.cs -../../../external/corefx/src/System.Memory/src/System/SequencePosition.cs -../../../external/corefx/src/System.Memory/src/System/SpanHelpers.cs -../../../external/corefx/src/System.Memory/src/System/ThrowHelper.cs -../../../external/corefx/src/System.Memory/src/System/Buffers/*.cs -../../../external/corefx/src/System.Memory/src/System/Buffers/Binary/*.cs -../../../external/corefx/src/System.Memory/src/System/Runtime/InteropServices/*.cs:MemoryMarshal.Portable.cs - -../../../external/corefx/src/Common/src/CoreLib/System/Buffers/Text/FormattingHelpers.CountDigits.cs -../../../external/corefx/src/System.Memory/src/System/Buffers/StandardFormat.cs -../../../external/corefx/src/System.Memory/src/System/Buffers/OperationStatus.cs -../../../external/corefx/src/System.Memory/src/System/Buffers/Text/*.cs -../../../external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Formatter/*.cs -../../../external/corefx/src/System.Memory/src/System/Buffers/Text/Utf8Parser/*.cs -# This implementation is another "part" of the partial class "Number". Long term, we want to switch our referencesource implementation over to corefx. -# Once that's done, we still need these parts here - but their namespace should be changed back to System, to make them become part of the "Number" class. -../../../external/corefx/src/System.Memory/src/System/Number/*.cs - -../../../external/corefx/src/Common/src/System/MutableDecimal.cs - -../../../external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/OSPlatform.cs -../../../external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/Architecture.cs - -../../../external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509ContentType.cs -../../../external/corefx/src/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509KeyStorageFlags.cs - -../../../external/corefx/src/System.Threading.Tasks.Parallel/src/System/Threading/Tasks/*.cs diff --git a/mcs/class/corlib/corlib.dll.sources.REMOVED.git-id b/mcs/class/corlib/corlib.dll.sources.REMOVED.git-id new file mode 100644 index 0000000000..1889e6f3f5 --- /dev/null +++ b/mcs/class/corlib/corlib.dll.sources.REMOVED.git-id @@ -0,0 +1 @@ +5439c357b0eb3e4725244cf6381795c327001dc8 \ No newline at end of file diff --git a/mcs/class/corlib/corlib_test.dll.sources b/mcs/class/corlib/corlib_test.dll.sources index aca4e90237..c4ae45c780 100644 --- a/mcs/class/corlib/corlib_test.dll.sources +++ b/mcs/class/corlib/corlib_test.dll.sources @@ -395,8 +395,6 @@ System.Security.Policy/NetCodeGroupTest.cs System.Security.Policy/PermissionRequestEvidenceTest.cs System.Security.Policy/PolicyLevelTest.cs System.Security.Policy/PolicyStatementTest.cs -System.Security.Policy/PublisherMembershipConditionTest.cs -System.Security.Policy/PublisherTest.cs System.Security.Policy/SiteMembershipConditionTest.cs System.Security.Policy/SiteTest.cs System.Security.Policy/StrongNameTest.cs diff --git a/mcs/class/corlib/corlib_xtest.dll.sources b/mcs/class/corlib/corlib_xtest.dll.sources new file mode 100644 index 0000000000..459507c64f --- /dev/null +++ b/mcs/class/corlib/corlib_xtest.dll.sources @@ -0,0 +1,307 @@ +../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs + +../../../external/corefx/src/Common/tests/System/RandomExtensions.cs +../../../external/corefx/src/Common/tests/System/RandomDataGenerator.cs + +../../../external/corefx/src/Common/tests/System/Buffers/NativeMemoryManager.cs +../../../external/corefx/src/Common/tests/System/Diagnostics/Tracing/TestEventListener.cs +../../../external/corefx/src/Common/tests/System/Threading/ThreadTestHelpers.cs +../../../external/corefx/src/Common/tests/System/Threading/ThreadPoolHelpers.cs +../../../external/corefx/src/Common/tests/System/Runtime/Serialization/Formatters/BinaryFormatterHelpers.cs + +#../../../external/corefx/src/System.Globalization/tests/CompareInfo/*.cs: + +../../../external/corefx/src/System.Reflection.Emit/tests/Utilities.cs + +#TODO: audit the commented out tests and fix or disable + +#../../../external/corefx/src/System.Reflection.Emit/tests/AssemblyBuilderTests.cs +# ../../../external/corefx/src/System.Reflection.Emit/tests/ + +../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderDefineParameter.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderGetILGenerator.cs +../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderInitLocals.cs +../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderSetCustomAttribute.cs +../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderSetImplementationFlags.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/ConstructorBuilder/ConstructorBuilderToString.cs + +#../../../external/corefx/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Methods.Tests.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/EnumBuilder/EnumBuilder.Properties.Tests.cs + +../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderAddOtherMethod.cs +../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderSetAddOnMethod.cs +../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderSetCustomAttribute.cs +../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderSetRaiseMethod.cs +../../../external/corefx/src/System.Reflection.Emit/tests/EventBuilder/EventBuilderSetRemoveOnMethod.cs + +../../../external/corefx/src/System.Reflection.Emit/tests/FieldBuilder/FieldBuilderGetValue.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/FieldBuilder/FieldBuilderSetConstant.cs +../../../external/corefx/src/System.Reflection.Emit/tests/FieldBuilder/FieldBuilderSetCustomAttribute.cs +../../../external/corefx/src/System.Reflection.Emit/tests/FieldBuilder/FieldBuilderSetOffset.cs + +../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTyepParameterBuilderSetBaseTypeConstraint.cs +../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderGUID.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderMakeArrayType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderMakeByRefType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderMakeGenericType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderMakePointerType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderSetCustomAttribute.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderSetGenericParameterAttributes.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTypeParameterBuilderSetInterfaceConstraints.cs + +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderContainsGenericParameters.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderDefineGenericParameters.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderDefineParameter.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderEquals.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderGetGenericArguments.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderGetGenericMethodDefinition.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderGetHashCode.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderGetILGenerator.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderInitLocals.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderIsGenericMethod.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderMakeGenericMethod.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderReturnParameter.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetCustomAttribute.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetImplementationFlags.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetParameters.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetReturnType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderSetSignature.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/MethodBuilder/MethodBuilderToString.cs + +../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderCreateGlobalFunctions.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs +../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineInitializedData.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineUninitializedData.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderGetArrayMethod.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderSetCustomAttribute.cs + +#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderAddOtherMethod.cs +../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderAttributes.cs +../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderCanRead.cs +../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderCanWrite.cs +../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderDeclaringType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderGetIndexParameters.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderGetValue.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetConstant.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetCustomAttribute.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetGetMethod.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetSetMethod.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/PropertyBuilder/PropertyBuilderSetValue.cs + +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAddInterfaceImplementaion.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderAssemblyQualifiedName.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderCreateType.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderCreateTypeInfo.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDeclaringMethod.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineConstructor.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineDefaultConstructor.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineField.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineGenericParameters.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineMethod.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineMethodOverride.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineProperty.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineTypeInitializer.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGUID.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGenericParameterAttributes.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGenericParameterPosition.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetConstructor.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetElementType.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetField.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetGenericTypeDefinition.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderGetMethod.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderIsGenericParameter.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderIsGenericType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderIsGenericTypeDefinition.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeArrayType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeByRefType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakeGenericType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderMakePointerType.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderName.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderNamespace.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderPackingSize.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSetCustomAttribute.cs +#../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSetParent.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderSize.cs +../../../external/corefx/src/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderToString.cs + +../../../external/corefx/src/System.Text.Encoding/tests/ASCIIEncoding/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/Decoder/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/DecoderFallbackException/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/Encoder/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/EncoderFallbackException/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/Encoding/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/Fallback/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/Latin1Encoding/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/UnicodeEncoding/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/UTF7Encoding/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/UTF8Encoding/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/UTF32Encoding/*.cs +../../../external/corefx/src/System.Text.Encoding/tests/*.cs:EncodingTestHelpers.netcoreapp.cs,NegativeEncodingTests.netcoreapp.cs +../../../external/corefx/src/System.Text.Encoding.Extensions/tests/*.cs + +../../../external/corefx/src/System.ValueTuple/tests/*.cs + +# System.Runtime +# TODO: Many more to be included +../../../external/corefx/src/System.Runtime/tests/System/String.SplitTests.cs +../../../external/corefx/src/System.Runtime/tests/System/NullableTests.cs +../../../external/corefx/src/System.Runtime/tests/System/Reflection/BindingFlagsDoNotWrap.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/Text/*.cs +../../../external/corefx/src/System.Runtime/tests/System/Runtime/CompilerServices/*.cs:RuntimeHelpersTests.netcoreapp.cs,ConditionalWeakTableTests.netcoreapp.cs,ConditionalWeakTableTests.cs + +# System.Threading.Tasks +../../../external/corefx/src/System.Threading.Tasks/tests/System.Runtime.CompilerServices/*.cs +../../../external/corefx/src/System.Threading.Tasks/tests/Task/*.cs:*.netcoreapp.cs,TaskContinueWithTests.cs,ExecutionContextFlowTest.cs +../../../external/corefx/src/System.Threading.Tasks/tests/TaskFactory/*.cs +../../../external/corefx/src/System.Threading.Tasks/tests/TaskScheduler/*.cs +../../../external/corefx/src/System.Threading.Tasks/tests/*.cs:UnwrapTests.cs,CancellationTokenTests.netcoreapp.cs + +# System.Threading.Tasks.Parallel +../../../external/corefx/src/System.Threading.Tasks.Parallel/tests/*.cs:XunitAssemblyAttributes.cs,EtwTests.cs + +# System.Threading.Timer +../../../external/corefx/src/System.Threading.Timer/tests/*.cs:TimerFiringTests.cs,TimerChangeTests.cs + +# System.Threading.Thread +../../../external/corefx/src/System.Threading.Thread/tests/*.cs:CompressedStackTests.cs,ThreadTests.cs,ExceptionTests.cs,ThreadTests.netcoreapp.cs + +# System.Threading +../../../external/corefx/src/System.Threading/tests/*.cs:MutexTests.cs,SemaphoreTests.cs,InterlockedTests.netcoreapp.cs,EventWaitHandleTests.cs,XunitAssemblyAttributes.cs,ReaderWriterLockTests.cs,SynchronizationContextTests.cs,ExecutionContextTests.cs,HostExecutionContextManagerTests.cs,EtwTests.cs + +# System.Memory +../../../external/corefx/src/System.Memory/tests/*.cs +../../../external/corefx/src/System.Memory/tests/Base64/*.cs +../../../external/corefx/src/System.Memory/tests/Binary/*.cs +../../../external/corefx/src/System.Memory/tests/Memory/*.cs +../../../external/corefx/src/System.Memory/tests/MemoryMarshal/*.cs:CreateReadOnlySpan.cs,CreateSpan.cs +../../../external/corefx/src/System.Memory/tests/MemoryPool/*.cs +../../../external/corefx/src/System.Memory/tests/ParsersAndFormatters/*.cs +../../../external/corefx/src/System.Memory/tests/ParsersAndFormatters/Formatter/*.cs +../../../external/corefx/src/System.Memory/tests/ParsersAndFormatters/Parser/*.cs +../../../external/corefx/src/System.Memory/tests/ReadOnlyBuffer/*.cs +../../../external/corefx/src/System.Memory/tests/ReadOnlyMemory/*.cs +../../../external/corefx/src/System.Memory/tests/ReadOnlySpan/*.cs:GetPinnableReference.cs +../../../external/corefx/src/System.Memory/tests/Span/*.cs:Reflection.cs,GetPinnableReference.cs + +# FIXME: this is internal in corlib +../../../external/corefx/src/Common/src/System/MutableDecimal.cs + +# System.Collections +../../../external/corefx/src/Common/tests/System/Collections/CollectionAsserts.cs +../../../external/corefx/src/Common/tests/System/Collections/TestBase.NonGeneric.cs +../../../external/corefx/src/Common/tests/System/Collections/TestBase.Generic.cs +../../../external/corefx/src/Common/tests/System/Collections/TestingTypes.cs +../../../external/corefx/src/Common/tests/System/Collections/IList.NonGeneric.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/IList.Generic.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/ICollection.NonGeneric.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/ICollection.Generic.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/IDictionary.NonGeneric.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/IDictionary.Generic.Tests.cs +#../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.NonGeneric.Serialization.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.NonGeneric.Tests.cs +#../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.Generic.Serialization.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/IEnumerable.Generic.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/ISet.Generic.Tests.cs +../../../external/corefx/src/Common/tests/System/Collections/IGenericSharedAPI.Tests.cs +../../../external/corefx/src/Common/tests/System/EnumTypes.cs +../../../external/corefx/src/Common/tests/System/ObjectCloner.cs +../../../external/corefx/src/Common/tests/System/Diagnostics/DebuggerAttributes.cs +../../../external/corefx/src/System.Collections/tests/Generic/SortedSet/*.cs:SortedSet.TreeSubSet.Tests.cs +../../../external/corefx/src/System.Collections/tests/Generic/HashSet/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/Stack/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/SortedList/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/SortedDictionary/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/Queue/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/List/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/LinkedList/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/HashSet/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/Dictionary/HashCollisionScenarios/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/Dictionary/*.cs +../../../external/corefx/src/System.Collections/tests/Generic/Comparers/*.cs:EqualityComparer.Tests.cs +../../../external/corefx/src/System.Collections/tests/BitArray/*.cs:BitArray_GetSetTests.cs +../../../external/corefx/src/System.Collections/tests/*.cs + +# System.Collections.NonGeneric +#../../../external/corefx/src/System.Collections.NonGeneric/tests/ArrayList/*.cs +../../../external/corefx/src/System.Collections.NonGeneric/tests/Hashtable/*.cs +../../../external/corefx/src/System.Collections.NonGeneric/tests/*.cs:SortedListTests.cs,CollectionBaseTests.cs,DictionaryBaseTests.cs,ArrayListTests.cs,ReadOnlyCollectionBaseTests.cs + +# System.Collections.Concurrent +../../../external/corefx/src/System.Collections.Concurrent/tests/ConcurrentDictionary/*.cs +../../../external/corefx/src/System.Collections.Concurrent/tests/*.cs:ProducerConsumerCollectionTests.cs,EtwTests.cs,ConcurrentBagTests.cs,ConcurrentQueueTests.cs,ConcurrentStackTests.cs + +# System.Collections.Specialized +../../../external/corefx/src/System.Collections.Specialized/tests/StringDictionary/*.cs +../../../external/corefx/src/System.Collections.Specialized/tests/NameObjectCollectionBase/*.cs:NameObjectCollectionBase.KeysTests.cs,NameObjectCollectionBase.CopyToTests.cs +#../../../external/corefx/src/System.Collections.Specialized/tests/NameValueCollection/*.cs +../../../external/corefx/src/System.Collections.Specialized/tests/ListDictionary/*.cs +../../../external/corefx/src/System.Collections.Specialized/tests/HybridDictionary/*.cs +../../../external/corefx/src/System.Collections.Specialized/tests/OrderedDictionary/*.cs +../../../external/corefx/src/System.Collections.Specialized/tests/*.cs:StringCollectionTests.cs + +#../../../external/corefx/src/System.Runtime.Extensions/tests/System/MathTests.netcoreapp.cs + + +# System.Runtime +../../../external/corefx/src/System.Runtime/tests/System/AccessViolationExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/ApplicationExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/ArraySegmentTests.cs +../../../external/corefx/src/System.Runtime/tests/System/ArraySegmentTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/BooleanTests.cs +../../../external/corefx/src/System.Runtime/tests/System/BooleanTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/ByteTests.cs +../../../external/corefx/src/System.Runtime/tests/System/ByteTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/CharTests.cs +../../../external/corefx/src/System.Runtime/tests/System/DBNullTests.cs +../../../external/corefx/src/System.Runtime/tests/System/DecimalTests.cs +#../../../external/corefx/src/System.Runtime/tests/System/DecimalTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/DoubleTests.cs +#../../../external/corefx/src/System.Runtime/tests/System/DoubleTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/DuplicateWaitObjectExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/EntryPointNotFoundExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/ExecutionEngineExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/ExternalExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/FieldAccessExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/GuidTests.cs +../../../external/corefx/src/System.Runtime/tests/System/GuidTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/HandleTests.cs +../../../external/corefx/src/System.Runtime/tests/System/HashCodeTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/Int16Tests.cs +../../../external/corefx/src/System.Runtime/tests/System/Int16Tests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/Int32Tests.cs +../../../external/corefx/src/System.Runtime/tests/System/Int32Tests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/Int64Tests.cs +../../../external/corefx/src/System.Runtime/tests/System/Int64Tests.netcoreapp.cs +#../../../external/corefx/src/System.Runtime/tests/System/IntPtrTests.cs +#../../../external/corefx/src/System.Runtime/tests/System/IntPtrTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/LazyTests.cs +../../../external/corefx/src/System.Runtime/tests/System/LazyTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/MarshalByRefObjectTests.cs +../../../external/corefx/src/System.Runtime/tests/System/MethodAccessExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/MissingFieldExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/MissingMemberExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/MissingMethodExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/NotFiniteNumberExceptionTests.cs +#../../../external/corefx/src/System.Runtime/tests/System/NullableTests.cs +../../../external/corefx/src/System.Runtime/tests/System/NullReferenceExceptionTests.cs +../../../external/corefx/src/System.Runtime/tests/System/ObjectTests.cs +#../../../external/corefx/src/System.Runtime/tests/System/PseudoCustomAttributeTests.cs +../../../external/corefx/src/System.Runtime/tests/System/SByteTests.cs +../../../external/corefx/src/System.Runtime/tests/System/SByteTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/SingleTests.cs +#../../../external/corefx/src/System.Runtime/tests/System/SingleTests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/UInt16Tests.cs +../../../external/corefx/src/System.Runtime/tests/System/UInt16Tests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/UInt32Tests.cs +../../../external/corefx/src/System.Runtime/tests/System/UInt32Tests.netcoreapp.cs +../../../external/corefx/src/System.Runtime/tests/System/UInt64Tests.cs +../../../external/corefx/src/System.Runtime/tests/System/UInt64Tests.netcoreapp.cs +#../../../external/corefx/src/System.Runtime/tests/System/UIntPtrTests.cs +#../../../external/corefx/src/System.Runtime/tests/System/UIntPtrTests.netcoreapp.cs +#../../../external/corefx/src/System.Runtime/tests/System/ValueTypeTests.cs +../../../external/corefx/src/System.Runtime/tests/System/IO/*.cs:FileLoadException.InteropTests.cs,DirectoryNotFoundException.InteropTests.cs,FileNotFoundException.InteropTests.cs +../../../external/corefx/src/System.Runtime/tests/System/Text/*.cs +../../../external/corefx/src/System.Runtime/tests/System/Threading/*.cs:WaitHandleTests.cs diff --git a/mcs/class/corlib/linux_net_4_x_corlib.dll.exclude.sources b/mcs/class/corlib/linux_net_4_x_corlib.dll.exclude.sources new file mode 100644 index 0000000000..f9d577f4c9 --- /dev/null +++ b/mcs/class/corlib/linux_net_4_x_corlib.dll.exclude.sources @@ -0,0 +1 @@ +#include unix_net_4_x_corlib.dll.exclude.sources diff --git a/mcs/class/corlib/linux_net_4_x_corlib.dll.sources b/mcs/class/corlib/linux_net_4_x_corlib.dll.sources index e3568844a2..5c50b156f3 100644 --- a/mcs/class/corlib/linux_net_4_x_corlib.dll.sources +++ b/mcs/class/corlib/linux_net_4_x_corlib.dll.sources @@ -1,4 +1 @@ -#include net_4_x_corlib.dll.sources - -../../../external/corefx/src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.GetRandomBytes.cs -../../../external/corefx/src/Common/src/CoreLib/Interop/Unix/Interop.Libraries.cs +#include unix_net_4_x_corlib.dll.sources diff --git a/mcs/class/corlib/macos_net_4_x_corlib.dll.exclude.sources b/mcs/class/corlib/macos_net_4_x_corlib.dll.exclude.sources new file mode 100644 index 0000000000..f9d577f4c9 --- /dev/null +++ b/mcs/class/corlib/macos_net_4_x_corlib.dll.exclude.sources @@ -0,0 +1 @@ +#include unix_net_4_x_corlib.dll.exclude.sources diff --git a/mcs/class/corlib/macos_net_4_x_corlib.dll.sources b/mcs/class/corlib/macos_net_4_x_corlib.dll.sources new file mode 100644 index 0000000000..5c50b156f3 --- /dev/null +++ b/mcs/class/corlib/macos_net_4_x_corlib.dll.sources @@ -0,0 +1 @@ +#include unix_net_4_x_corlib.dll.sources diff --git a/mcs/class/corlib/monodroid_corlib_test.dll.exclude.sources b/mcs/class/corlib/monodroid_corlib_test.dll.exclude.sources new file mode 100644 index 0000000000..1f55fd9018 --- /dev/null +++ b/mcs/class/corlib/monodroid_corlib_test.dll.exclude.sources @@ -0,0 +1,52 @@ +Microsoft.Win32/RegistryKeyTest.cs +System/ActivatorCas.cs +System/AppDomainCas.cs +System/BadImageFormatExceptionCas.cs +System/ConsoleCas.cs +System.Diagnostics/StackFrameCas.cs +System.Diagnostics/StackTraceCas.cs +System/EnvironmentCas.cs +System/ExceptionCas.cs +System.IO/DirectoryCas.cs +System.IO/FileLoadExceptionCas.cs +System.IO/FileNotFoundExceptionCas.cs +System.IO/FileStreamCas.cs +System.IO.IsolatedStorage/IsolatedStorageFileCas.cs +System.IO.IsolatedStorage/IsolatedStorageFileStreamCas.cs +System.IO/PathCas.cs +System.IO/StreamCas.cs +System/MarshalByRefObjectCas.cs +System.Reflection/AssemblyCas.cs +System.Reflection/AssemblyNameCas.cs +System.Reflection.Emit/MethodRentalCas.cs +System.Reflection/ModuleCas.cs +System.Reflection/StrongNameKeyPairCas.cs +System.Reflection/VisibilityTest.cs +System.Resources/ResourceReaderCas.cs +System.Resources/ResourceSetCas.cs +System.Runtime.CompilerServices/RuntimeWrappedExceptionCas.cs +System.Runtime.InteropServices/RuntimeEnvironmentCas.cs +System/RuntimeMethodHandleCas.cs +System.Runtime.Serialization.Formatters.Binary/BinaryFormatterCas.cs +System.Runtime.Versioning/ResourceConsumptionAttributeCas.cs +System.Runtime.Versioning/ResourceExposureAttributeCas.cs +System.Runtime.Versioning/VersioningHelperCas.cs +System.Security.AccessControl/DirectorySecurityTest.cs +System.Security.AccessControl/EventWaitHandleSecurityTest.cs +System.Security.AccessControl/FileSecurityTest.cs +System.Security/CodeAccessPermissionCas.cs +System.Security.Cryptography/CryptoAPITransformCas.cs +System.Security.Cryptography/CryptoConfigCas.cs +System.Security.Cryptography.X509Certificates/X509CertificateCas.cs +System.Security/PermissionSetCas.cs +System.Security.Policy/ApplicationSecurityManagerCas.cs +System.Security/SecureStringCas.cs +System.Security/SecurityContextCas.cs +System.Security/SecurityExceptionCas.cs +System.Security/SecurityManagerCas.cs +System.Threading/CompressedStackCas.cs +System.Threading/ExecutionContextCas.cs +System.Threading/MutexCas.cs +System.Threading/ThreadCas.cs +System.Threading/WaitHandleCas.cs +System/TypedReferenceCas.cs diff --git a/mcs/class/corlib/monodroid_corlib_test.dll.sources b/mcs/class/corlib/monodroid_corlib_test.dll.sources new file mode 100644 index 0000000000..011effe162 --- /dev/null +++ b/mcs/class/corlib/monodroid_corlib_test.dll.sources @@ -0,0 +1 @@ +#include corlib_test.dll.sources diff --git a/mcs/class/corlib/monotouch_corlib.dll.sources b/mcs/class/corlib/monotouch_corlib.dll.sources index f9bbccf55c..285ae7f20e 100644 --- a/mcs/class/corlib/monotouch_corlib.dll.sources +++ b/mcs/class/corlib/monotouch_corlib.dll.sources @@ -7,8 +7,6 @@ CommonCrypto/RijndaelManaged.cs CommonCrypto/RNGCryptoServiceProvider.cryptor.cs CommonCrypto/RC4CommonCrypto.cs CoreFoundation/CFHelpers.cs -System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs -System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs System.Text/EncodingHelper.MonoTouch.cs System/Environment.iOS.cs System/Guid.MonoTouch.cs diff --git a/mcs/class/corlib/monotouch_corlib_test.dll.exclude.sources b/mcs/class/corlib/monotouch_corlib_test.dll.exclude.sources new file mode 100644 index 0000000000..a083f2a4fd --- /dev/null +++ b/mcs/class/corlib/monotouch_corlib_test.dll.exclude.sources @@ -0,0 +1,155 @@ +Microsoft.Win32/RegistryKeyTest.cs +System.Security.Policy/AllMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryTest.cs +System.Security.Policy/ApplicationMembershipConditionTest.cs +System.Security.Policy/ApplicationSecurityManagerCas.cs +System.Security.Policy/ApplicationSecurityManagerTest.cs +System.Security.Policy/ApplicationTrustTest.cs +System.Security.Policy/CodeGroupTest.cs +System.Security.Policy/DomainApplicationMembershipConditionTest.cs +System.Security.Policy/EvidenceTest.cs +System.Security.Policy/FileCodeGroupTest.cs +System.Security.Policy/FirstMatchCodeGroupTest.cs +System.Security.Policy/GacMembershipConditionTest.cs +System.Security.Policy/GacTest.cs +System.Security.Policy/HashMembershipConditionTest.cs +System.Security.Policy/HashTest.cs +System.Security.Policy/IBuiltInEvidenceTest.cs +System.Security.Policy/NetCodeGroupTest.cs +System.Security.Policy/PermissionRequestEvidenceTest.cs +System.Security.Policy/PolicyLevelTest.cs +System.Security.Policy/PolicyStatementTest.cs +System.Security.Policy/SiteMembershipConditionTest.cs +System.Security.Policy/SiteTest.cs +System.Security.Policy/StrongNameMembershipConditionTest.cs +System.Security.Policy/StrongNameTest.cs +System.Security.Policy/UnionCodeGroupTest.cs +System.Security.Policy/UrlMembershipConditionTest.cs +System.Security.Policy/UrlTest.cs +System.Security.Policy/ZoneMembershipConditionTest.cs +System.Security.Policy/ZoneTest.cs +System.Diagnostics.Contracts/ContractAssertTest.cs +System.Diagnostics.Contracts/ContractAssumeTest.cs +System.Diagnostics.Contracts/ContractCollectionMethodsTest.cs +System.Diagnostics.Contracts/ContractHelperTest.cs +System.Diagnostics.Contracts/ContractMarkerMethodsTest.cs +System.Diagnostics.Contracts/ContractMustUseRewriterTest.cs +System.Runtime.Remoting/ContextTest.cs +System.Runtime.Remoting/RemotingConfigurationTest.cs +System.Runtime.Remoting/SoapServicesTest.cs +System.Runtime.Remoting/SynchronizationAttributeTest.cs +System.Runtime.Remoting/RemotingServicesTest.cs +System.Security.AccessControl/AuthorizationRuleTest.cs +System.Security.AccessControl/CommonAceTest.cs +System.Security.AccessControl/CommonAclTest.cs +System.Security.AccessControl/CommonObjectSecurityTest.cs +System.Security.AccessControl/CommonSecurityDescriptorTest.cs +System.Security.AccessControl/CryptoKeyAccessRuleTest.cs +System.Security.AccessControl/DirectoryObjectSecurityTest.cs +System.Security.AccessControl/DirectorySecurityTest.cs +System.Security.AccessControl/DiscretionaryAclTest.cs +System.Security.AccessControl/EventWaitHandleSecurityTest.cs +System.Security.AccessControl/FileSecurityTest.cs +System.Security.AccessControl/MutexAccessRuleTest.cs +System.Security.AccessControl/MutexSecurityTest.cs +System.Security.AccessControl/ObjectAceTest.cs +System.Security.AccessControl/ObjectSecurityTest.cs +System.Security.AccessControl/ObjectSecurity_TTest.cs +System.Security.AccessControl/RawAclTest.cs +System.Security.AccessControl/RawSecurityDescriptorTest.cs +System.Security.AccessControl/RegistrySecurityTest.cs +System.Security.AccessControl/SystemAclTest.cs +System.Security.Permissions/CodeAccessSecurityAttributeTest.cs +System.Security.Permissions/EnvironmentPermissionAttributeTest.cs +System.Security.Permissions/EnvironmentPermissionTest.cs +System.Security.Permissions/FileDialogPermissionAttributeTest.cs +System.Security.Permissions/FileDialogPermissionTest.cs +System.Security.Permissions/FileIOPermissionAttributeTest.cs +System.Security.Permissions/FileIOPermissionTest.cs +System.Security.Permissions/GacIdentityPermissionAttributeTest.cs +System.Security.Permissions/GacIdentityPermissionTest.cs +System.Security.Permissions/HostProtectionAttributeTest.cs +System.Security.Permissions/IBuiltInPermissionTest.cs +System.Security.Permissions/IsolatedStorageFilePermissionAttributeTest.cs +System.Security.Permissions/IsolatedStorageFilePermissionTest.cs +System.Security.Permissions/IsolatedStoragePermissionAttributeTest.cs +System.Security.Permissions/KeyContainerPermissionAttributeTest.cs +System.Security.Permissions/PermissionSetAttributeTest.cs +System.Security.Permissions/PrincipalPermissionAttributeTest.cs +System.Security.Permissions/PrincipalPermissionTest.cs +System.Security.Permissions/PublisherIdentityPermissionAttributeTest.cs +System.Security.Permissions/PublisherIdentityPermissionTest.cs +System.Security.Permissions/ReflectionPermissionAttributeTest.cs +System.Security.Permissions/ReflectionPermissionTest.cs +System.Security.Permissions/RegistryPermissionAttributeTest.cs +System.Security.Permissions/RegistryPermissionTest.cs +System.Security.Permissions/SecurityAttributeTest.cs +System.Security.Permissions/SecurityPermissionAttributeTest.cs +System.Security.Permissions/SecurityPermissionTest.cs +System.Security.Permissions/SiteIdentityPermissionAttributeTest.cs +System.Security.Permissions/SiteIdentityPermissionTest.cs +System.Security.Permissions/StrongNameIdentityPermissionAttributeTest.cs +System.Security.Permissions/StrongNameIdentityPermissionTest.cs +System.Security.Permissions/StrongNamePublicKeyBlobTest.cs +System.Security.Permissions/UIPermissionAttributeTest.cs +System.Security.Permissions/UIPermissionTest.cs +System.Security.Permissions/UrlIdentityPermissionAttributeTest.cs +System.Security.Permissions/UrlIdentityPermissionTest.cs +System.Security.Permissions/ZoneIdentityPermissionAttributeTest.cs +System.Security.Permissions/ZoneIdentityPermissionTest.cs +System.Security.Policy/AllMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryTest.cs +System.Security.Policy/ApplicationMembershipConditionTest.cs +System.Security.Policy/ApplicationSecurityManagerCas.cs +System.Security.Policy/ApplicationSecurityManagerTest.cs +System.Security.Policy/ApplicationTrustTest.cs +System.Security.Policy/CodeGroupTest.cs +System.Security.Policy/DomainApplicationMembershipConditionTest.cs +System.Security.Policy/EvidenceTest.cs +System.Security.Policy/FileCodeGroupTest.cs +System.Security.Policy/FirstMatchCodeGroupTest.cs +System.Security.Policy/GacMembershipConditionTest.cs +System.Security.Policy/GacTest.cs +System.Security.Policy/HashMembershipConditionTest.cs +System.Security.Policy/HashTest.cs +System.Security.Policy/IBuiltInEvidenceTest.cs +System.Security.Policy/NetCodeGroupTest.cs +System.Security.Policy/PermissionRequestEvidenceTest.cs +System.Security.Policy/PolicyLevelTest.cs +System.Security.Policy/PolicyStatementTest.cs +System.Security.Policy/SiteMembershipConditionTest.cs +System.Security.Policy/SiteTest.cs +System.Security.Policy/StrongNameMembershipConditionTest.cs +System.Security.Policy/StrongNameTest.cs +System.Security.Policy/UnionCodeGroupTest.cs +System.Security.Policy/UrlMembershipConditionTest.cs +System.Security.Policy/UrlTest.cs +System.Security.Policy/ZoneMembershipConditionTest.cs +System.Security.Policy/ZoneTest.cs +System.Reflection.Emit/AssemblyBuilderAccessTest.cs +System.Reflection.Emit/AssemblyBuilderTest.cs +System.Reflection.Emit/ConstructorBuilderTest.cs +System.Reflection.Emit/ConstructorOnTypeBuilderInstTest.cs +System.Reflection.Emit/CustomAttributeBuilderTest.cs +System.Reflection.Emit/DerivedTypesTest.cs +System.Reflection.Emit/DynamicILInfoTest.cs +System.Reflection.Emit/DynamicMethodTest.cs +System.Reflection.Emit/EnumBuilderTest.cs +System.Reflection.Emit/EventBuilderTest.cs +System.Reflection.Emit/FieldBuilderTest.cs +System.Reflection.Emit/GenericTypeParameterBuilderTest.cs +System.Reflection.Emit/ILGeneratorTest.cs +System.Reflection.Emit/MethodBuilderTest.cs +System.Reflection.Emit/MethodBuilderTestIL.cs +System.Reflection.Emit/MethodOnTypeBuilderInstTest.cs +System.Reflection.Emit/MethodRentalCas.cs +System.Reflection.Emit/MethodRentalTest.cs +System.Reflection.Emit/ModuleBuilderTest.cs +System.Reflection.Emit/ParameterBuilderTest.cs +System.Reflection.Emit/PropertyBuilderTest.cs +System.Reflection.Emit/SaveTest.cs +System.Reflection.Emit/SignatureHelperTest.cs +System.Reflection.Emit/TypeBuilderTest.cs +System.Runtime.Remoting.Proxies/RealProxyTest.cs diff --git a/mcs/class/corlib/net_4_x_corlib.dll.sources b/mcs/class/corlib/net_4_x_corlib.dll.sources index 843200f7f5..b02407487a 100644 --- a/mcs/class/corlib/net_4_x_corlib.dll.sources +++ b/mcs/class/corlib/net_4_x_corlib.dll.sources @@ -1,4 +1,2 @@ #include corlib.dll.sources -../../../external/corefx/src/Common/src/CoreLib/System/HashCode.cs - diff --git a/mcs/class/corlib/orbis_corlib_test.dll.exclude.sources b/mcs/class/corlib/orbis_corlib_test.dll.exclude.sources new file mode 100644 index 0000000000..b4f123c094 --- /dev/null +++ b/mcs/class/corlib/orbis_corlib_test.dll.exclude.sources @@ -0,0 +1 @@ +#include testing_aot_full_corlib_test.dll.exclude.sources diff --git a/mcs/class/corlib/orbis_corlib_test.dll.sources b/mcs/class/corlib/orbis_corlib_test.dll.sources new file mode 100644 index 0000000000..011effe162 --- /dev/null +++ b/mcs/class/corlib/orbis_corlib_test.dll.sources @@ -0,0 +1 @@ +#include corlib_test.dll.sources diff --git a/mcs/class/corlib/testing_aot_full_corlib_test.dll.exclude.sources b/mcs/class/corlib/testing_aot_full_corlib_test.dll.exclude.sources new file mode 100644 index 0000000000..e17ad01699 --- /dev/null +++ b/mcs/class/corlib/testing_aot_full_corlib_test.dll.exclude.sources @@ -0,0 +1,131 @@ +Microsoft.Win32/RegistryKeyTest.cs +System.Diagnostics.Contracts/ContractAssertTest.cs +System.Diagnostics.Contracts/ContractAssumeTest.cs +System.Diagnostics.Contracts/ContractCollectionMethodsTest.cs +System.Diagnostics.Contracts/ContractHelperTest.cs +System.Diagnostics.Contracts/ContractMarkerMethodsTest.cs +System.Diagnostics.Contracts/ContractMustUseRewriterTest.cs +System.Diagnostics.Contracts/Helpers/RunAgainstReferenceAttribute.cs +System.Diagnostics.Contracts/Helpers/TestContractBase.cs +System.Reflection.Emit/AssemblyBuilderAccessTest.cs +System.Reflection.Emit/AssemblyBuilderTest.cs +System.Reflection.Emit/ConstructorBuilderTest.cs +System.Reflection.Emit/ConstructorOnTypeBuilderInstTest.cs +System.Reflection.Emit/CustomAttributeBuilderTest.cs +System.Reflection.Emit/DerivedTypesTest.cs +System.Reflection.Emit/DynamicILInfoTest.cs +System.Reflection.Emit/DynamicMethodTest.cs +System.Reflection.Emit/EnumBuilderTest.cs +System.Reflection.Emit/EventBuilderTest.cs +System.Reflection.Emit/FieldBuilderTest.cs +System.Reflection.Emit/GenericTypeParameterBuilderTest.cs +System.Reflection.Emit/ILGeneratorTest.cs +System.Reflection.Emit/MethodBuilderTest.cs +System.Reflection.Emit/MethodBuilderTestIL.cs +System.Reflection.Emit/MethodOnTypeBuilderInstTest.cs +System.Reflection.Emit/MethodRentalCas.cs +System.Reflection.Emit/MethodRentalTest.cs +System.Reflection.Emit/ModuleBuilderTest.cs +System.Reflection.Emit/ParameterBuilderTest.cs +System.Reflection.Emit/PropertyBuilderTest.cs +System.Reflection.Emit/SignatureHelperTest.cs +System.Reflection.Emit/TypeBuilderTest.cs +System.Reflection.Emit/SaveTest.cs +System.Runtime.Remoting/ContextTest.cs +System.Runtime.Remoting/RemotingConfigurationTest.cs +System.Runtime.Remoting/SoapServicesTest.cs +System.Runtime.Remoting/SynchronizationAttributeTest.cs +System.Runtime.Remoting/RemotingServicesTest.cs +System.Runtime.Remoting.Channels/ChannelServicesTest.cs +System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs +System.Runtime.Remoting.Messaging/CallContextTest.cs +System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs +System.Runtime.Remoting.Proxies/RealProxyTest.cs +System.Security.AccessControl/AuthorizationRuleTest.cs +System.Security.AccessControl/CommonAceTest.cs +System.Security.AccessControl/CommonAclTest.cs +System.Security.AccessControl/CommonObjectSecurityTest.cs +System.Security.AccessControl/CommonSecurityDescriptorTest.cs +System.Security.AccessControl/CryptoKeyAccessRuleTest.cs +System.Security.AccessControl/DirectoryObjectSecurityTest.cs +System.Security.AccessControl/DirectorySecurityTest.cs +System.Security.AccessControl/DiscretionaryAclTest.cs +System.Security.AccessControl/EventWaitHandleSecurityTest.cs +System.Security.AccessControl/FileSecurityTest.cs +System.Security.AccessControl/MutexAccessRuleTest.cs +System.Security.AccessControl/MutexSecurityTest.cs +System.Security.AccessControl/ObjectAceTest.cs +System.Security.AccessControl/ObjectSecurity_TTest.cs +System.Security.AccessControl/ObjectSecurityTest.cs +System.Security.AccessControl/RawAclTest.cs +System.Security.AccessControl/RawSecurityDescriptorTest.cs +System.Security.AccessControl/RegistrySecurityTest.cs +System.Security.AccessControl/SystemAclTest.cs +System.Security.Permissions/CodeAccessSecurityAttributeTest.cs +System.Security.Permissions/EnvironmentPermissionAttributeTest.cs +System.Security.Permissions/EnvironmentPermissionTest.cs +System.Security.Permissions/FileDialogPermissionAttributeTest.cs +System.Security.Permissions/FileDialogPermissionTest.cs +System.Security.Permissions/FileIOPermissionAttributeTest.cs +System.Security.Permissions/FileIOPermissionTest.cs +System.Security.Permissions/GacIdentityPermissionAttributeTest.cs +System.Security.Permissions/GacIdentityPermissionTest.cs +System.Security.Permissions/HostProtectionAttributeTest.cs +System.Security.Permissions/IBuiltInPermissionTest.cs +System.Security.Permissions/IsolatedStorageFilePermissionAttributeTest.cs +System.Security.Permissions/IsolatedStorageFilePermissionTest.cs +System.Security.Permissions/IsolatedStoragePermissionAttributeTest.cs +System.Security.Permissions/KeyContainerPermissionAttributeTest.cs +System.Security.Permissions/PermissionSetAttributeTest.cs +System.Security.Permissions/PrincipalPermissionAttributeTest.cs +System.Security.Permissions/PrincipalPermissionTest.cs +System.Security.Permissions/PublisherIdentityPermissionAttributeTest.cs +System.Security.Permissions/PublisherIdentityPermissionTest.cs +System.Security.Permissions/ReflectionPermissionAttributeTest.cs +System.Security.Permissions/ReflectionPermissionTest.cs +System.Security.Permissions/RegistryPermissionAttributeTest.cs +System.Security.Permissions/RegistryPermissionTest.cs +System.Security.Permissions/SecurityAttributeTest.cs +System.Security.Permissions/SecurityPermissionAttributeTest.cs +System.Security.Permissions/SecurityPermissionTest.cs +System.Security.Permissions/SiteIdentityPermissionAttributeTest.cs +System.Security.Permissions/SiteIdentityPermissionTest.cs +System.Security.Permissions/StrongNameIdentityPermissionAttributeTest.cs +System.Security.Permissions/StrongNameIdentityPermissionTest.cs +System.Security.Permissions/StrongNamePublicKeyBlobTest.cs +System.Security.Permissions/UIPermissionAttributeTest.cs +System.Security.Permissions/UIPermissionTest.cs +System.Security.Permissions/UrlIdentityPermissionAttributeTest.cs +System.Security.Permissions/UrlIdentityPermissionTest.cs +System.Security.Permissions/ZoneIdentityPermissionAttributeTest.cs +System.Security.Permissions/ZoneIdentityPermissionTest.cs +System.Security.Policy/AllMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryTest.cs +System.Security.Policy/ApplicationMembershipConditionTest.cs +System.Security.Policy/ApplicationSecurityManagerCas.cs +System.Security.Policy/ApplicationSecurityManagerTest.cs +System.Security.Policy/ApplicationTrustTest.cs +System.Security.Policy/CodeGroupTest.cs +System.Security.Policy/DomainApplicationMembershipConditionTest.cs +System.Security.Policy/EvidenceTest.cs +System.Security.Policy/FileCodeGroupTest.cs +System.Security.Policy/FirstMatchCodeGroupTest.cs +System.Security.Policy/GacMembershipConditionTest.cs +System.Security.Policy/GacTest.cs +System.Security.Policy/HashMembershipConditionTest.cs +System.Security.Policy/HashTest.cs +System.Security.Policy/IBuiltInEvidenceTest.cs +System.Security.Policy/NetCodeGroupTest.cs +System.Security.Policy/PermissionRequestEvidenceTest.cs +System.Security.Policy/PolicyLevelTest.cs +System.Security.Policy/PolicyStatementTest.cs +System.Security.Policy/SiteMembershipConditionTest.cs +System.Security.Policy/SiteTest.cs +System.Security.Policy/StrongNameMembershipConditionTest.cs +System.Security.Policy/StrongNameTest.cs +System.Security.Policy/UnionCodeGroupTest.cs +System.Security.Policy/UrlMembershipConditionTest.cs +System.Security.Policy/UrlTest.cs +System.Security.Policy/ZoneMembershipConditionTest.cs +System.Security.Policy/ZoneTest.cs diff --git a/mcs/class/corlib/testing_aot_full_corlib_test.dll.sources b/mcs/class/corlib/testing_aot_full_corlib_test.dll.sources new file mode 100644 index 0000000000..011effe162 --- /dev/null +++ b/mcs/class/corlib/testing_aot_full_corlib_test.dll.sources @@ -0,0 +1 @@ +#include corlib_test.dll.sources diff --git a/mcs/class/corlib/testing_aot_hybrid_corlib_test.dll.exclude.sources b/mcs/class/corlib/testing_aot_hybrid_corlib_test.dll.exclude.sources new file mode 100644 index 0000000000..9b651e6fc9 --- /dev/null +++ b/mcs/class/corlib/testing_aot_hybrid_corlib_test.dll.exclude.sources @@ -0,0 +1,22 @@ +Microsoft.Win32/RegistryKeyTest.cs +System.Reflection/VisibilityTest.cs +System.Security.AccessControl/AuthorizationRuleTest.cs +System.Security.AccessControl/CommonAceTest.cs +System.Security.AccessControl/CommonAclTest.cs +System.Security.AccessControl/CommonObjectSecurityTest.cs +System.Security.AccessControl/CommonSecurityDescriptorTest.cs +System.Security.AccessControl/CryptoKeyAccessRuleTest.cs +System.Security.AccessControl/DirectoryObjectSecurityTest.cs +System.Security.AccessControl/DirectorySecurityTest.cs +System.Security.AccessControl/DiscretionaryAclTest.cs +System.Security.AccessControl/EventWaitHandleSecurityTest.cs +System.Security.AccessControl/FileSecurityTest.cs +System.Security.AccessControl/MutexAccessRuleTest.cs +System.Security.AccessControl/MutexSecurityTest.cs +System.Security.AccessControl/ObjectAceTest.cs +System.Security.AccessControl/ObjectSecurity_TTest.cs +System.Security.AccessControl/ObjectSecurityTest.cs +System.Security.AccessControl/RawAclTest.cs +System.Security.AccessControl/RawSecurityDescriptorTest.cs +System.Security.AccessControl/RegistrySecurityTest.cs +System.Security.AccessControl/SystemAclTest.cs diff --git a/mcs/class/corlib/unix_net_4_x_corlib.dll.exclude.sources b/mcs/class/corlib/unix_net_4_x_corlib.dll.exclude.sources new file mode 100644 index 0000000000..81c6cf1205 --- /dev/null +++ b/mcs/class/corlib/unix_net_4_x_corlib.dll.exclude.sources @@ -0,0 +1 @@ +corefx/Interop.GetRandomBytes.Mono.cs diff --git a/mcs/class/corlib/darwin_net_4_x_corlib.dll.sources b/mcs/class/corlib/unix_net_4_x_corlib.dll.sources similarity index 100% rename from mcs/class/corlib/darwin_net_4_x_corlib.dll.sources rename to mcs/class/corlib/unix_net_4_x_corlib.dll.sources diff --git a/mcs/class/corlib/wasm_corlib_test.dll.exclude.sources b/mcs/class/corlib/wasm_corlib_test.dll.exclude.sources new file mode 100644 index 0000000000..e17ad01699 --- /dev/null +++ b/mcs/class/corlib/wasm_corlib_test.dll.exclude.sources @@ -0,0 +1,131 @@ +Microsoft.Win32/RegistryKeyTest.cs +System.Diagnostics.Contracts/ContractAssertTest.cs +System.Diagnostics.Contracts/ContractAssumeTest.cs +System.Diagnostics.Contracts/ContractCollectionMethodsTest.cs +System.Diagnostics.Contracts/ContractHelperTest.cs +System.Diagnostics.Contracts/ContractMarkerMethodsTest.cs +System.Diagnostics.Contracts/ContractMustUseRewriterTest.cs +System.Diagnostics.Contracts/Helpers/RunAgainstReferenceAttribute.cs +System.Diagnostics.Contracts/Helpers/TestContractBase.cs +System.Reflection.Emit/AssemblyBuilderAccessTest.cs +System.Reflection.Emit/AssemblyBuilderTest.cs +System.Reflection.Emit/ConstructorBuilderTest.cs +System.Reflection.Emit/ConstructorOnTypeBuilderInstTest.cs +System.Reflection.Emit/CustomAttributeBuilderTest.cs +System.Reflection.Emit/DerivedTypesTest.cs +System.Reflection.Emit/DynamicILInfoTest.cs +System.Reflection.Emit/DynamicMethodTest.cs +System.Reflection.Emit/EnumBuilderTest.cs +System.Reflection.Emit/EventBuilderTest.cs +System.Reflection.Emit/FieldBuilderTest.cs +System.Reflection.Emit/GenericTypeParameterBuilderTest.cs +System.Reflection.Emit/ILGeneratorTest.cs +System.Reflection.Emit/MethodBuilderTest.cs +System.Reflection.Emit/MethodBuilderTestIL.cs +System.Reflection.Emit/MethodOnTypeBuilderInstTest.cs +System.Reflection.Emit/MethodRentalCas.cs +System.Reflection.Emit/MethodRentalTest.cs +System.Reflection.Emit/ModuleBuilderTest.cs +System.Reflection.Emit/ParameterBuilderTest.cs +System.Reflection.Emit/PropertyBuilderTest.cs +System.Reflection.Emit/SignatureHelperTest.cs +System.Reflection.Emit/TypeBuilderTest.cs +System.Reflection.Emit/SaveTest.cs +System.Runtime.Remoting/ContextTest.cs +System.Runtime.Remoting/RemotingConfigurationTest.cs +System.Runtime.Remoting/SoapServicesTest.cs +System.Runtime.Remoting/SynchronizationAttributeTest.cs +System.Runtime.Remoting/RemotingServicesTest.cs +System.Runtime.Remoting.Channels/ChannelServicesTest.cs +System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs +System.Runtime.Remoting.Messaging/CallContextTest.cs +System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs +System.Runtime.Remoting.Proxies/RealProxyTest.cs +System.Security.AccessControl/AuthorizationRuleTest.cs +System.Security.AccessControl/CommonAceTest.cs +System.Security.AccessControl/CommonAclTest.cs +System.Security.AccessControl/CommonObjectSecurityTest.cs +System.Security.AccessControl/CommonSecurityDescriptorTest.cs +System.Security.AccessControl/CryptoKeyAccessRuleTest.cs +System.Security.AccessControl/DirectoryObjectSecurityTest.cs +System.Security.AccessControl/DirectorySecurityTest.cs +System.Security.AccessControl/DiscretionaryAclTest.cs +System.Security.AccessControl/EventWaitHandleSecurityTest.cs +System.Security.AccessControl/FileSecurityTest.cs +System.Security.AccessControl/MutexAccessRuleTest.cs +System.Security.AccessControl/MutexSecurityTest.cs +System.Security.AccessControl/ObjectAceTest.cs +System.Security.AccessControl/ObjectSecurity_TTest.cs +System.Security.AccessControl/ObjectSecurityTest.cs +System.Security.AccessControl/RawAclTest.cs +System.Security.AccessControl/RawSecurityDescriptorTest.cs +System.Security.AccessControl/RegistrySecurityTest.cs +System.Security.AccessControl/SystemAclTest.cs +System.Security.Permissions/CodeAccessSecurityAttributeTest.cs +System.Security.Permissions/EnvironmentPermissionAttributeTest.cs +System.Security.Permissions/EnvironmentPermissionTest.cs +System.Security.Permissions/FileDialogPermissionAttributeTest.cs +System.Security.Permissions/FileDialogPermissionTest.cs +System.Security.Permissions/FileIOPermissionAttributeTest.cs +System.Security.Permissions/FileIOPermissionTest.cs +System.Security.Permissions/GacIdentityPermissionAttributeTest.cs +System.Security.Permissions/GacIdentityPermissionTest.cs +System.Security.Permissions/HostProtectionAttributeTest.cs +System.Security.Permissions/IBuiltInPermissionTest.cs +System.Security.Permissions/IsolatedStorageFilePermissionAttributeTest.cs +System.Security.Permissions/IsolatedStorageFilePermissionTest.cs +System.Security.Permissions/IsolatedStoragePermissionAttributeTest.cs +System.Security.Permissions/KeyContainerPermissionAttributeTest.cs +System.Security.Permissions/PermissionSetAttributeTest.cs +System.Security.Permissions/PrincipalPermissionAttributeTest.cs +System.Security.Permissions/PrincipalPermissionTest.cs +System.Security.Permissions/PublisherIdentityPermissionAttributeTest.cs +System.Security.Permissions/PublisherIdentityPermissionTest.cs +System.Security.Permissions/ReflectionPermissionAttributeTest.cs +System.Security.Permissions/ReflectionPermissionTest.cs +System.Security.Permissions/RegistryPermissionAttributeTest.cs +System.Security.Permissions/RegistryPermissionTest.cs +System.Security.Permissions/SecurityAttributeTest.cs +System.Security.Permissions/SecurityPermissionAttributeTest.cs +System.Security.Permissions/SecurityPermissionTest.cs +System.Security.Permissions/SiteIdentityPermissionAttributeTest.cs +System.Security.Permissions/SiteIdentityPermissionTest.cs +System.Security.Permissions/StrongNameIdentityPermissionAttributeTest.cs +System.Security.Permissions/StrongNameIdentityPermissionTest.cs +System.Security.Permissions/StrongNamePublicKeyBlobTest.cs +System.Security.Permissions/UIPermissionAttributeTest.cs +System.Security.Permissions/UIPermissionTest.cs +System.Security.Permissions/UrlIdentityPermissionAttributeTest.cs +System.Security.Permissions/UrlIdentityPermissionTest.cs +System.Security.Permissions/ZoneIdentityPermissionAttributeTest.cs +System.Security.Permissions/ZoneIdentityPermissionTest.cs +System.Security.Policy/AllMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryTest.cs +System.Security.Policy/ApplicationMembershipConditionTest.cs +System.Security.Policy/ApplicationSecurityManagerCas.cs +System.Security.Policy/ApplicationSecurityManagerTest.cs +System.Security.Policy/ApplicationTrustTest.cs +System.Security.Policy/CodeGroupTest.cs +System.Security.Policy/DomainApplicationMembershipConditionTest.cs +System.Security.Policy/EvidenceTest.cs +System.Security.Policy/FileCodeGroupTest.cs +System.Security.Policy/FirstMatchCodeGroupTest.cs +System.Security.Policy/GacMembershipConditionTest.cs +System.Security.Policy/GacTest.cs +System.Security.Policy/HashMembershipConditionTest.cs +System.Security.Policy/HashTest.cs +System.Security.Policy/IBuiltInEvidenceTest.cs +System.Security.Policy/NetCodeGroupTest.cs +System.Security.Policy/PermissionRequestEvidenceTest.cs +System.Security.Policy/PolicyLevelTest.cs +System.Security.Policy/PolicyStatementTest.cs +System.Security.Policy/SiteMembershipConditionTest.cs +System.Security.Policy/SiteTest.cs +System.Security.Policy/StrongNameMembershipConditionTest.cs +System.Security.Policy/StrongNameTest.cs +System.Security.Policy/UnionCodeGroupTest.cs +System.Security.Policy/UrlMembershipConditionTest.cs +System.Security.Policy/UrlTest.cs +System.Security.Policy/ZoneMembershipConditionTest.cs +System.Security.Policy/ZoneTest.cs diff --git a/mcs/class/corlib/wasm_corlib_test.dll.sources b/mcs/class/corlib/wasm_corlib_test.dll.sources new file mode 100644 index 0000000000..011effe162 --- /dev/null +++ b/mcs/class/corlib/wasm_corlib_test.dll.sources @@ -0,0 +1 @@ +#include corlib_test.dll.sources diff --git a/mcs/class/corlib/win32_net_4_x_corlib.dll.exclude.sources b/mcs/class/corlib/win32_net_4_x_corlib.dll.exclude.sources index 22a3ac76ba..4f014765c2 100644 --- a/mcs/class/corlib/win32_net_4_x_corlib.dll.exclude.sources +++ b/mcs/class/corlib/win32_net_4_x_corlib.dll.exclude.sources @@ -1,2 +1,9 @@ corert/PreAllocatedOverlapped.platformnotsupported.cs corert/ThreadPoolBoundHandle.platformnotsupported.cs +../../../external/corert/src/System.Private.CoreLib/src/System/Number.Unix.cs +../../../external/corert/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.Number.cs + +corefx/Interop.GetRandomBytes.Mono.cs +corefx/Mono.SafePasswordHandle.Unix.cs +../../../external/corefx/src/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafePasswordHandle.Unix.cs + diff --git a/mcs/class/corlib/win32_net_4_x_corlib.dll.sources b/mcs/class/corlib/win32_net_4_x_corlib.dll.sources index e2410df771..54b200a948 100644 --- a/mcs/class/corlib/win32_net_4_x_corlib.dll.sources +++ b/mcs/class/corlib/win32_net_4_x_corlib.dll.sources @@ -28,4 +28,10 @@ ../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.OverlappedData.cs ../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolPreAllocatedOverlapped.cs +corert/RuntimeImports.cs +../../../external/corert/src/System.Private.CoreLib/src/System/Number.Windows.cs ../../../external/corert/src/Runtime.Base/src/System/Runtime/InteropServices/NativeCallableAttribute.cs + +../../../external/corefx/src/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafePasswordHandle.Windows.cs +corefx/Mono.SafePasswordHandle.Windows.cs + diff --git a/mcs/class/corlib/winaot_corlib.dll.exclude.sources b/mcs/class/corlib/winaot_corlib.dll.exclude.sources index 9d79b04203..1e4ccd09cd 100644 --- a/mcs/class/corlib/winaot_corlib.dll.exclude.sources +++ b/mcs/class/corlib/winaot_corlib.dll.exclude.sources @@ -1,3 +1,10 @@ corert/Interop.MemAllocFree.cs corert/PreAllocatedOverlapped.platformnotsupported.cs corert/ThreadPoolBoundHandle.platformnotsupported.cs +../../../external/corert/src/System.Private.CoreLib/src/System/Number.Unix.cs +../../../external/corert/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.Number.cs + +corefx/Interop.GetRandomBytes.Mono.cs +corefx/Mono.SafePasswordHandle.Unix.cs +../../../external/corefx/src/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafePasswordHandle.Unix.cs + diff --git a/mcs/class/corlib/winaot_corlib_test.dll.exclude.sources b/mcs/class/corlib/winaot_corlib_test.dll.exclude.sources new file mode 100644 index 0000000000..b4f123c094 --- /dev/null +++ b/mcs/class/corlib/winaot_corlib_test.dll.exclude.sources @@ -0,0 +1 @@ +#include testing_aot_full_corlib_test.dll.exclude.sources diff --git a/mcs/class/corlib/winaot_corlib_test.dll.sources b/mcs/class/corlib/winaot_corlib_test.dll.sources new file mode 100755 index 0000000000..011effe162 --- /dev/null +++ b/mcs/class/corlib/winaot_corlib_test.dll.sources @@ -0,0 +1 @@ +#include corlib_test.dll.sources diff --git a/mcs/class/corlib/darwin_xammac_net_4_5_corlib.dll.exclude.sources b/mcs/class/corlib/xammac_net_4_5_corlib.dll.exclude.sources similarity index 100% rename from mcs/class/corlib/darwin_xammac_net_4_5_corlib.dll.exclude.sources rename to mcs/class/corlib/xammac_net_4_5_corlib.dll.exclude.sources diff --git a/mcs/class/lib/monolite-darwin/1051600011/Mono.Cecil.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/Mono.Cecil.dll.REMOVED.git-id deleted file mode 100644 index 3721365abf..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/Mono.Cecil.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -3559a3e02c5dc456d54813f73b2fe6f3af0bb4d6 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/Mono.Security.dll.REMOVED.git-id deleted file mode 100644 index 56e524a8d9..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/Mono.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -2e51e39aab9b64601e1a0b19399f140eb83e7ac6 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/System.Configuration.dll.REMOVED.git-id deleted file mode 100644 index 5e95129056..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/System.Configuration.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -1804a5c84c5f147785a0ceed802469c78b2fd4b6 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/System.Core.dll.REMOVED.git-id deleted file mode 100644 index 81bd6b30e7..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/System.Core.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b2c9d30106cb8abade09ea4a6d2d655f17ea8ccf \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/System.Numerics.dll.REMOVED.git-id deleted file mode 100644 index add9ae3c13..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/System.Numerics.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -9d8d7bb14a75f64d3a64d643783be576bb5e43c6 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/System.Security.dll.REMOVED.git-id deleted file mode 100644 index f795b6f705..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/System.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4991481149546f46b8b61e0127b87157a3cfbd6b \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/System.Xml.dll.REMOVED.git-id deleted file mode 100644 index 2404547f80..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/System.Xml.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -d0b9b2e27397649e7f31b46fdc04ab3f485eeefc \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/System.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/System.dll.REMOVED.git-id deleted file mode 100644 index b7d37fe62f..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/System.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -def7d9161d84c9665094d302656ebe6161ea6f8e \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/mcs.exe.REMOVED.git-id deleted file mode 100644 index 620d77a18c..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/mcs.exe.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4c7a7604c0a8bab68cb2618e62c636c053befdef \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051600011/mscorlib.dll.REMOVED.git-id deleted file mode 100644 index 66aea8583c..0000000000 --- a/mcs/class/lib/monolite-darwin/1051600011/mscorlib.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -6e86982da5093fbaa11aa4e693d449cff655d0b5 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/Mono.Cecil.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/Mono.Cecil.dll.REMOVED.git-id deleted file mode 100644 index 3721365abf..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/Mono.Cecil.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -3559a3e02c5dc456d54813f73b2fe6f3af0bb4d6 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/Mono.Security.dll.REMOVED.git-id deleted file mode 100644 index 56e524a8d9..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/Mono.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -2e51e39aab9b64601e1a0b19399f140eb83e7ac6 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/System.Configuration.dll.REMOVED.git-id deleted file mode 100644 index 5e95129056..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/System.Configuration.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -1804a5c84c5f147785a0ceed802469c78b2fd4b6 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/System.Core.dll.REMOVED.git-id deleted file mode 100644 index 81bd6b30e7..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/System.Core.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -b2c9d30106cb8abade09ea4a6d2d655f17ea8ccf \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/System.Numerics.dll.REMOVED.git-id deleted file mode 100644 index add9ae3c13..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/System.Numerics.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -9d8d7bb14a75f64d3a64d643783be576bb5e43c6 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/System.Security.dll.REMOVED.git-id deleted file mode 100644 index f795b6f705..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/System.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4991481149546f46b8b61e0127b87157a3cfbd6b \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/System.Xml.dll.REMOVED.git-id deleted file mode 100644 index 2404547f80..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/System.Xml.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -d0b9b2e27397649e7f31b46fdc04ab3f485eeefc \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/System.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/System.dll.REMOVED.git-id deleted file mode 100644 index b7d37fe62f..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/System.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -def7d9161d84c9665094d302656ebe6161ea6f8e \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/mcs.exe.REMOVED.git-id deleted file mode 100644 index 620d77a18c..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/mcs.exe.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4c7a7604c0a8bab68cb2618e62c636c053befdef \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051600011/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051600011/mscorlib.dll.REMOVED.git-id deleted file mode 100644 index 66aea8583c..0000000000 --- a/mcs/class/lib/monolite-linux/1051600011/mscorlib.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -6e86982da5093fbaa11aa4e693d449cff655d0b5 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Collections.Concurrent.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Collections.Concurrent.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Collections.Concurrent.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Collections.Concurrent.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Collections.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Collections.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Collections.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Collections.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Diagnostics.Debug.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Debug.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Diagnostics.Debug.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Debug.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Diagnostics.FileVersionInfo.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.FileVersionInfo.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Diagnostics.FileVersionInfo.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.FileVersionInfo.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Diagnostics.Tools.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Tools.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Diagnostics.Tools.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Tools.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Dynamic.Runtime.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Dynamic.Runtime.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Dynamic.Runtime.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Dynamic.Runtime.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Globalization.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Globalization.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Globalization.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Globalization.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.IO.FileSystem.Primitives.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.IO.FileSystem.Primitives.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.Primitives.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.IO.FileSystem.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.IO.FileSystem.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.IO.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.IO.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Linq.Expressions.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Linq.Expressions.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Linq.Expressions.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Linq.Expressions.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Linq.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Linq.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Linq.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Linq.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Reflection.Extensions.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Reflection.Extensions.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Extensions.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Reflection.Primitives.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Reflection.Primitives.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Primitives.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Reflection.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Reflection.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Resources.ResourceManager.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Resources.ResourceManager.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Resources.ResourceManager.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Resources.ResourceManager.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Runtime.Extensions.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Runtime.Extensions.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.Extensions.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Runtime.InteropServices.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.InteropServices.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Runtime.InteropServices.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.InteropServices.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Runtime.Numerics.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.Numerics.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Runtime.Numerics.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.Numerics.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Runtime.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Runtime.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Security.Cryptography.Algorithms.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Algorithms.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Security.Cryptography.Algorithms.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Algorithms.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Security.Cryptography.Primitives.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Security.Cryptography.Primitives.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Primitives.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Text.Encoding.CodePages.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.CodePages.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Text.Encoding.CodePages.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.CodePages.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Text.Encoding.Extensions.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Text.Encoding.Extensions.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.Extensions.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Text.Encoding.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Text.Encoding.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Threading.Tasks.Parallel.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.Parallel.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Threading.Tasks.Parallel.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.Parallel.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Threading.Tasks.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Threading.Tasks.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Threading.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Threading.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.ValueTuple.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.ValueTuple.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.ValueTuple.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.ValueTuple.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Xml.ReaderWriter.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Xml.ReaderWriter.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Xml.ReaderWriter.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Xml.ReaderWriter.dll diff --git a/mcs/class/lib/monolite-darwin/1051600011/Facades/System.Xml.XDocument.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Xml.XDocument.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051600011/Facades/System.Xml.XDocument.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Xml.XDocument.dll diff --git a/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id new file mode 100644 index 0000000000..610d2262de --- /dev/null +++ b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id @@ -0,0 +1 @@ +eb0997901e75ba5504d1b7755a7fa64f1d9209b9 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id new file mode 100644 index 0000000000..26c6d3fb89 --- /dev/null +++ b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id @@ -0,0 +1 @@ +409fdf3ca6ce6639a2a9e055114afb62e104b8dc \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id new file mode 100644 index 0000000000..f82af5fdd7 --- /dev/null +++ b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id @@ -0,0 +1 @@ +b3da2d3903548b23f6b0c021fe1642efd01cf2b2 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id new file mode 100644 index 0000000000..9e222038e4 --- /dev/null +++ b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id @@ -0,0 +1 @@ +1b165af598037e6a4228ebdf2950ca338534b9dc \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051600011/System.IO.Compression.dll b/mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.IO.Compression.dll similarity index 75% rename from mcs/class/lib/monolite-win32/1051600011/System.IO.Compression.dll rename to mcs/class/lib/monolite-linux/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.IO.Compression.dll index ea1c601182fe8b4d1560ef9962542c2a4268d59d..5e2f99fd33e832cd69034621df550d6fc6d5fbe2 100644 GIT binary patch delta 7791 zcmb`MeOy%4*2mXA^9tgb;hh{97!Y|IkO2e+=FAMJWkm^Mz9bkvnVMozp^|B55JXgb zp<_zMbp^XRUok>ht{l%;)3xtl!#e@4fb3 z`(+ivdc`0jOTy#4!dt`xFOD=qMGUr?KXa>C+?ia#-OgU!{k5x05Io5Z5OY zf9BlB`8DTh&UcYzzQairbIeG*SV-KTMw9}H5t+n6cH(?DaZeHPB9E`)F&zWKWORiF zP(uYDIy0N>yjY@}d)lmIZ{nSo=8>JsJ8#V;+X=)MwZz;AVh#8Fhuhn@e>?Yl!fhY7 zALOYgA>~oNrejUal~Lg<*B}8ui^gPoW3CPgz(9(N0Qy)AkG^= zoX*pIlke_XzNBD2!l(>tb%Y>gU$}w9Ju$={3-L3)R>4JfmPlL@Osvl#{twUH8BTUY zDDjq;=;hN_s+-K?*Yn99 zbKDN%X;tw-tvtEKe42;&I0yLx-she$9#h75=nCK6h!h%U1y5osk3S{zZ9K+1{K7+T z^19~Z*6HVkzcx7wZ4f@t zg_H(*kyE81$i31q>~$)#1bM_uo=|rg^5fWt&~q!zS(pvo0aoNcIM=3)MZ2DJQ~X#N z#a;Q-d@|39xrgS_3d*vH6FINMRHEHlNS@*hvOBo#;`UqIo|_a|=zt14tts72Je^Am z>u06~eCs5h;(N9vp6r+TlD45Om-&9NPU(Pi;uPdwq6{gxdIwyLs7CHf zA>N0zaX?8Zb=WJ_Ag4;TIPukxDaak1#Zh%=Z_c2S%}JoOCPehZ$oagk-(u1X3UC<= zoR}PgPcbb9k2r|qanBg!a?1DeOFKU@_h6_Ej<{&zXX1!STAJV^KIP7gIlV{nwe&hX zjN=lBzl9TD&nE8TY~h^2IXQy-pJfu$?8IwvM4gQ|OAe;XE-NurAl~HMs3E&SOFS1u zoaG?S;atS|Jx+Y*B){pRHN|7S8FUV;M7}YQ>^>$Ras)45JZFKav3D88{be5xx+j)6 z3(4SFzJZtc@zGmpprg1$Wxm(=k?F+x+5AULooq%BdDNRNGIasQA4#MeZ%pPQWK+gc zWLt=WEXi4gd?956a+T)|B;=&Zcv0_8#YLU}9z+`s2{duv9P$YKKGqk~sh)4`z*NGW zJCS2~$-c0>htqGiq#}pm9@u~-?Ze1nDf^M>PNLoV3GzAf5u_&QIC5MxjeGzpGYH5a zaeu%m#@x;) z%2(s5!+G8`zCXe#fa-PA|Rlgn<7U8ji^c12xbObI* z59`gupZm}(4Y<2{D8X&l!w$~47Vb`#O>9? zPq@{05>nUw0j8*jtMSz9dk@i`K(u;^m0oIXv=e{95o{2RrL;kxM41lGnjoVK@AV=& zv2*}!FmwQ&i3}u$a*pN4@M<8P1~o<<;?-$}u|nm(epu-;-*i0H<-VtriG$qqu)OL>a?zV`C$6}-U_Ww? zm-uibF-A+wLQ+g4+86ToA${(B*f)WVMK0vrFOa=bL!7B4UPj6ekaZ-sBC}bT(eBD- z_Zo;pG{mvYfqX!li;UJ6A}!n>XCV8ej$)SaUZZqgw9|DI|Al5K@@d0;NQt+0>8W*+ zaX50ihDOU|BVE}t`%Z6nCBSKX$RxlNT(KV9QAFdwv3LMKjh}$b$(@4Som7oHjV}@; zzSH#ZFaGeJ$7;}jr&nEX{Qr$qM_@3I&E-2vhgbIXEy0UPAb!dDM*!IiZNxu9iQl6q z0qB{S0Q5{u;LpT6RsZkAc`gQOjn#V3gO1?k z;YebPmKd%fzNbG@me9fJUbPjYr=fa44Q+QB;0b@@FZruo0Z`woI$eEWS+9EE z)fd+Fs{JlAyzN&{E;s=+vF;92Dl zd4lOHmlY1GKKL~9g7T!#V*SAt3;pA1j0V_|`3nx$=vNkpMpCx;J`@5ZrMkXfL4f3d z(f!rgEFlaWFd3B*TH%LOYI}ya9e^8w;erEN{OU|#UrFhz?896M^g688zDF)#oW+Oc1siBhCebZz8IA`UG4XH!2Qxhu=v&C^m1tu zB>2_Kj&f--*tx2Qr=((O3TQLbte=v~rD?FouU-lrD^05_8st|3BrQ1G;|c9nznw+R>pT%ug}xl9oeh zE`_W#t_#_vjGJ$HXtvY}Q}W2y3QOWhE$6Bp{wsJds*(BBRu7Xx8Ah}?Ni{)9|BtXO zx`33rwim#~RRbQzPn1vRPcU^$FT+GPMbyJ>Teni!ltO1~Qd2TJsVr-ps{vh{aGEwd`5HS3Xvbn#6OjQ}LXQ#W*!5F`449-JU zr7GxCVk8Z^F=V)YfF2Z+SsEx_E+VmHT%Ht5AI} zg|AgSElWt%<+rYN@)wgj@?n?VB6CkueXSM- zCRW8&E4-h-)n#HE{HoTy)n#TUxKdzG*uUMu?1tK=-dL$ilZTykg)&Dq4b}vK@tr~_ ztKe!S9JT%G4r7P>YNM$0M6#&q6uA&!xB_NxPSmq!U))-P?S$I3FFq>xs4 zSSEpqr6+}DKCLQu?sR4NGK*a2$z)reQGJ2&^E_Fs+pmt=7J716RqdTN z#gogr{OX6SHJ$?IouRfR#=qeyWQYCgsIA@OVx@I=`t9*}SdU*FwH@>fVbh+aHoBKT zi}u{jW^q}M^0a3d+t}OqouXU*J-eY?TYgLcuX3QZTaNM0W~XH8tw4470PkE@;ZxPt z@O1Cm zEn+zhGzxzX-6Jh!VT~kL!h+-ny-V3dzp|Rgcw5<~UNzqP0=vjnE41ZI@+!>EpQ*HH zja#WuhL~!+FSEpE8jN1Cvy^v~k75F(H<@eE9Up@?*$}Q8;0*oRRPFv7+oJlg z*V2w%D>j>C5yHS^5FrZ2AfsV2GLEx9G@+dgFCy*mIx-UuB6DE0QG|S80V23y2hs~q z1&S~PY<)!hP4Yct35*UBp%iW+N5VUOMHmD3h$2+L8DteaYZ3w9oMusmDRA5@LN&|^ z7NG`GLPV&AW5_y~6)M6UNC^|c2OlFFVMe$J%@7bFLJMq;2!SPV(ka4n7#eB7Gb>6Hz*mDC!FtaXX7`uv$V*Qh_9PANf9P38* zXO3hn2Rn$gvn4554wjgTRqb zbs<|=Ob!-;jYqCv$B}KUbP$$+y@A}o%(++swh6g~4amb1uz;ff1$%!36*3c?jG}L*yrUJP_GXdGAu^`uICLuRyrXe?JYLHtrGmzUfvytr@N`1RV zM()%!BKK%$vM$X+@X3!xw7>vkG+_S~d2kmVJ5!r4CF3f;FaK@Pdp%7D)0Tvj5On{-tGT29!?O*j^p%l zR&joD{!eOLH`~_>M35{$S*zEFtFHb zAeYy$8rc=p0W*qwRQ4r5h{O*#zv5&j?hhfxae6tcIDMQOIJ-D|I6sJ__^&u2!$Q*( z#gc0RXFcaDoLzQWnKy$H@)0}O);uP!^a30&T#c-B6E6g=Cp(HbHJ+Gl+lUlXiRZl( zlP+yWUP#-9oEiG3=eC*bFGAXpuW~Mw$a5u+STu;3AGHH1rjng)TP@?Iy#H>bBbmE+ z(3*jN+G;m7Ej1xEIW-}xL@8czQG8!MnVRm9oW1B77jg($m+?&pJp{Qungd}Jt2f7wlY=ITq-7KKF? zb>zQ&PLNCRFQHpm$%%kv zI$nA=X`I>i^T>+b!`2n=PMZ4KiqE6MI=h3|c)ckfGVmKy2L3*g16h!|YQtQXx@vML ztGjnt9y&5155GhW1t;V}I))UXc5rJj48|{0>DZbL#b~D^^YA*D_sBmX(#+@0{m5Qm^0NKVC22b3W%e&-0w; zoM*l>LZH^FHLR|je7e0Y0d?(vzY{xE#0=xw*$4^ir;I|EIvz7HPi;gc=K?wT zX9WGzff2%109eigXkIZS5JhnT)s1OgmAZskSkX0mcC1P1DH|J@?uX(?;bMicxjgEQAS!`qGmGJg%(D*WF>zL%#CE=wxiXyDSjha3$h|b0 z?U+dBH9ylYwx6UGS;RjnHoIMHTr47o**UU2f%$jQZly>pdR-*(mf%;SXU~eDwm1&G z5XD?1>@bm5jaW2EB)39rbB9>xEpdR?geOYGREY|GDXJTj#p|pUNz4@SClyh~_r!!B zMCgyAuO(DElc`?_U&GJC-X}g8%3MsW3S3J#PP8N*FGHxaohCNh*nW&y9cUH)?Snod zPe;Ug;`NMP;^Dl{h}-in5w8s4S%-@ho;Jk&U*d`!4q7?1mzH+Y5>P zUS}$hMW=Ve#h6TT?aN}`M!j*v$Vi^>y6mDQX3BXUgv$}>#9e~J;tI*$n#(O)oW^HO zi+P{omx{jjQql-zbPR-2N)F*|N(f&9iBmv;-cdtMCnWI7hlmP7NG^*%gsdel)A7bhLpKsvhdf0*9LEXm6kI4y)|k&R z-_bJ>p>imv^+x_P8JiM3Q*#9$VQD4FT(r*-1x;mCQl31k#I&!#A zHzhUD5+5Zp(?d_wldhY(RTbze`^|qSfm56yc&L=^keofV&{Jgth%dw(FEhb&<^diP zJZ3&XoL@A6>cpc}f!sv)9JVt%ybZ+bB~0aVDo?l|rbVRjaI@efKieyaV*~4Bcmr*l z@l@oofd;`dl)C0O!Lo9?R*;j$)RvB+BbneyJM;T~yh{^R*90S}>?YVHcu+~<;c~$w zC)*{ovvVF9WCtS+m33<_{$^Q|R*98BiQr}2OJNE%f(FB)MdDbN#)0M_d@-rv- zd9>NZ{DD?*LISnY3H=5td~r609rVz9y_|0>UqC0^Jc#c^E|Ee7$BS!tIh1dM7Nafk zb2{I4?dDI<7(nqMu^cm9+!*aTr)09{{VZOMcX5Iv_8sC+Lysx+D790Essr)V>8ikN zy4BTzd+F;}bzrEMAC{NhAB*eLKqnqn79j5RGw+IJCK{OeM1C~+$^Nut5i#IhL>Dj( zqlwD|59-)nr)SPLFux!wZcvOYwi635%5sr-tC?A$XO729#6KFoAtso9AUcFU#mx5m zMvhq}W{ovoBRj{)@gL|>D!_ZqCZa4x_nUZhx}_g^X6t#iJhV#%3Vvp~=t+Z9^pHt| zS~{@_ym3s+kZ8#SZ>J^_3yac;uViErPtgYnkv`K*a9TXPA4C`VZ_Fy}i~qlo+6o8{ zVySfFL9PV)Tc}(%9rGi>Uqjel=4AdF$-G3KG~j1q8t^kQO*|8Cbp780y%K`fW3Auw z#ZB66xp5D8Gj89E{H4SlQA_(8I#~%@POiIRnTZBww4V8@X}PBeR+(;+V&FYE=81tA zc!xL=4$}7LQb$Nm7#25@c(bpUDiLswqI1tLtClKL_}jh;pC#Q%X-)1^lO;XW_Nf^Z zJ&V*Iwa_}r4EF>Fe<-t*w>P}_rcM+?+*44)u#> zM`DLW|34K!hm7$#bL8JtoqLX&wlvFjpS&6>i#TMR<%x*<)Co%+cNEF(P+QEtc37Fh zYPC>}@aOP_q{fu+SR+i2M2cuDWz_;B(-j&^C}X9aZ4F35HPK~Us=mE+imgrF0Moo2 z(FoU_ZK|gwi|^L-mP}luu4-}E*2|AW^l%Pnfr^ri>YkPU$4W+g_4)!8^B!5xUL0)q>V6`#!lFTqD`n0&fg@Q|_v3eHzCekx#)dw+k;N zb3#4?A){`nf6E_1o~A5U3OVo4*!-^ji#Vq`BhR&`qXtE)W$$ChVJ?eF~*s)Vo6GAAjLRI8>Sq&(hx5q{C)Vavcw@8?ih#j_jXTYska3z#ER z6BOiSdcTCZLA8e>FTui~Dk;xYGgcJqPRMG_ilWk7?>BIDoJfIASLnS0$#>mQviEx^ z=~KhKKf=uuc&x>;)N#9dbj1`~wf7f@nyC36jUKQ1+U6wIc(22@$?R*ijIvKB)frTG z+w0V~+Z;Gg{j{w(dy!X%hN&VB{^@S?8n8a7&bU{4&A20|o(Ny7-nud?af3Gmf4N(W z&x&+G7{*Q4)WDpl)m1C2M{M<4(K}1?wL1`OSR+(ByjC(pvf-wnYVgjG?07;b74}9w z?+wSR+L-pn8vJnPhz=mqTYQ0w5R^JQ-o9uBI_)&t&HjGN7o>p)I? z#~X+BK~-6F(yMNGIDYIWUI!i*&K64`;VV+-gUXWdi8ld14=M+ZCE$-iHKX(sZzAG7 zA_>cq(yvI_gX)m$s#gtN6`zg1B+Q$`A?wFScF1RsofzO9$gX*ZW$yb51{>o$gUVb>icMIMxWFyH(d?Rpk-{9X=}<5PbxfHg}UhTz9l#@psDTApZOlZ&Y*fA=4+pVQH|Qzr&(TKBi0Dj z4u?X2@HJtNrbL5Vuve&cutbOc7Q7OStS7Y`3!8Wq@f;d1J&aM!EZ4z9nW6rNaavF% z*`xgJxTR0U``6$_q1vINFx9W3OFUEg(EDU{qFP~d`8VLeR$h!hVhhw4)PE$tDLsqQ z@*6&cXR$)4CO89d+n!ZkQe1YDDD1p^ufTEU{= z3-l6(#e=M1$Hl}b+)j+cv%~~+WKcV>jhK#?h?&@wN$tQ}v#1?-j#!BCgQ*?ZPL%L_ zq94n%sU5hDI0DTsY6mVPR^mD07%a)5cHnyAL{z?^ml~XsOZ~tfiM2Rp2(<%WAlBpX zJZcASBQC&UZfXZM5(79ppW1=u0%`{?Cbr=z;%ba9q!!>RVh4r|r551b#7%gFxCLv9 zs0DbQxC85psRj5Sg5@q#5KgjxSn_fHxhgBDdGuyhIj$D6YaWA zVw7$dF;4eNX@5x2?W5a}sN*k#HDYv{?l6tk>fR|0fjZqWvg>spklmo;^%v+qELB2a zv5vP1kg!0r?i{g0*Gt@}`+~Sh_cd{gjAlD z59&h5)1$KzPYBORk_Nb)Su^Y)ANbT9=1da<#dw`|q(Dckfsd9^-{xK^J??9hKe z{*C%nvN!27h+Fh7;x@gTxIt2Ll(`VBl2Z43lXf!7#PV3=M`_vKJU;5x+KY)>jN1e^ta^GjP&j#@x?UCwBERy*kI&CE>Mizo5jXQX!wY6 z1G##PezGe~Ptx{dOk2n^&cx-NXxd7wG3_9KovD^sZ+eka6kK51N%mq>cbO5IO|KAJ zO?xSRq?wbhG;`8p%zVgkWv6~toJlIrT0gGtSErJ!u_I_+4o)rWg+bM#6!5YDj^()A~*}w_iWaOBsM)oubdzo<_ zNW(S@`(xn;lM2t2rmNE62^o5jmn8u+5zZ)TU@{1|b6SQog5oz>W%{a|Gt5IiS{ zHsOz8rU?24YXk#=n*{d@o)tV0%kk#~A=km%lqa)mieRJQQ-b?ld@_G7Clp|I;r3!w zM*9Jdd+sDo@-jaSoxpY+b7m^D!1*VlbujaSpJQ_5sl-pSYl-tCfAd_ov;9Ft9r0WhXRm97wYl-ucI*3OdPx$FeOp}gXc`1B86x*MP+D!K2 z(OZeya@o=Bc}i4ebO=YT4|$IGq`iw6k+g?+IFXqg$`zG`y({50vPTN;EM@yg*CFEX zDyjqv{`-^tZutLs^nuu;wEY)eu9?)IX(*36?(Zsj{=81H+(UofLCd{JpD3332+yHq zA;R;RNqhlE5IeDx_#$>bfbbH=(QkjdFs_Myzl(7X(VrHugZMJ;CU)ah;%>CJBJ4qX z8^SBNn)oVqtVQ}@+D&{7^BzHX9Ss3W1EA~C7c(ZMbp^XRUok>ht{l%;)3xtl!#e@4fb3 z`(+ivdc`0jOTy#4!dt`xFOD=qMGUr?KXa>C+?ia#-OgU!{k5x05Io5Z5OY zf9BlB`8DTh&UcYzzQairbIeG*SV-KTMw9}H5t+n6cH(?DaZeHPB9E`)F&zWKWORiF zP(uYDIy0N>yjY@}d)lmIZ{nSo=8>JsJ8#V;+X=)MwZz;AVh#8Fhuhn@e>?Yl!fhY7 zALOYgA>~oNrejUal~Lg<*B}8ui^gPoW3CPgz(9(N0Qy)AkG^= zoX*pIlke_XzNBD2!l(>tb%Y>gU$}w9Ju$={3-L3)R>4JfmPlL@Osvl#{twUH8BTUY zDDjq;=;hN_s+-K?*Yn99 zbKDN%X;tw-tvtEKe42;&I0yLx-she$9#h75=nCK6h!h%U1y5osk3S{zZ9K+1{K7+T z^19~Z*6HVkzcx7wZ4f@t zg_H(*kyE81$i31q>~$)#1bM_uo=|rg^5fWt&~q!zS(pvo0aoNcIM=3)MZ2DJQ~X#N z#a;Q-d@|39xrgS_3d*vH6FINMRHEHlNS@*hvOBo#;`UqIo|_a|=zt14tts72Je^Am z>u06~eCs5h;(N9vp6r+TlD45Om-&9NPU(Pi;uPdwq6{gxdIwyLs7CHf zA>N0zaX?8Zb=WJ_Ag4;TIPukxDaak1#Zh%=Z_c2S%}JoOCPehZ$oagk-(u1X3UC<= zoR}PgPcbb9k2r|qanBg!a?1DeOFKU@_h6_Ej<{&zXX1!STAJV^KIP7gIlV{nwe&hX zjN=lBzl9TD&nE8TY~h^2IXQy-pJfu$?8IwvM4gQ|OAe;XE-NurAl~HMs3E&SOFS1u zoaG?S;atS|Jx+Y*B){pRHN|7S8FUV;M7}YQ>^>$Ras)45JZFKav3D88{be5xx+j)6 z3(4SFzJZtc@zGmpprg1$Wxm(=k?F+x+5AULooq%BdDNRNGIasQA4#MeZ%pPQWK+gc zWLt=WEXi4gd?956a+T)|B;=&Zcv0_8#YLU}9z+`s2{duv9P$YKKGqk~sh)4`z*NGW zJCS2~$-c0>htqGiq#}pm9@u~-?Ze1nDf^M>PNLoV3GzAf5u_&QIC5MxjeGzpGYH5a zaeu%m#@x;) z%2(s5!+G8`zCXe#fa-PA|Rlgn<7U8ji^c12xbObI* z59`gupZm}(4Y<2{D8X&l!w$~47Vb`#O>9? zPq@{05>nUw0j8*jtMSz9dk@i`K(u;^m0oIXv=e{95o{2RrL;kxM41lGnjoVK@AV=& zv2*}!FmwQ&i3}u$a*pN4@M<8P1~o<<;?-$}u|nm(epu-;-*i0H<-VtriG$qqu)OL>a?zV`C$6}-U_Ww? zm-uibF-A+wLQ+g4+86ToA${(B*f)WVMK0vrFOa=bL!7B4UPj6ekaZ-sBC}bT(eBD- z_Zo;pG{mvYfqX!li;UJ6A}!n>XCV8ej$)SaUZZqgw9|DI|Al5K@@d0;NQt+0>8W*+ zaX50ihDOU|BVE}t`%Z6nCBSKX$RxlNT(KV9QAFdwv3LMKjh}$b$(@4Som7oHjV}@; zzSH#ZFaGeJ$7;}jr&nEX{Qr$qM_@3I&E-2vhgbIXEy0UPAb!dDM*!IiZNxu9iQl6q z0qB{S0Q5{u;LpT6RsZkAc`gQOjn#V3gO1?k z;YebPmKd%fzNbG@me9fJUbPjYr=fa44Q+QB;0b@@FZruo0Z`woI$eEWS+9EE z)fd+Fs{JlAyzN&{E;s=+vF;92Dl zd4lOHmlY1GKKL~9g7T!#V*SAt3;pA1j0V_|`3nx$=vNkpMpCx;J`@5ZrMkXfL4f3d z(f!rgEFlaWFd3B*TH%LOYI}ya9e^8w;erEN{OU|#UrFhz?896M^g688zDF)#oW+Oc1siBhCebZz8IA`UG4XH!2Qxhu=v&C^m1tu zB>2_Kj&f--*tx2Qr=((O3TQLbte=v~rD?FouU-lrD^05_8st|3BrQ1G;|c9nznw+R>pT%ug}xl9oeh zE`_W#t_#_vjGJ$HXtvY}Q}W2y3QOWhE$6Bp{wsJds*(BBRu7Xx8Ah}?Ni{)9|BtXO zx`33rwim#~RRbQzPn1vRPcU^$FT+GPMbyJ>Teni!ltO1~Qd2TJsVr-ps{vh{aGEwd`5HS3Xvbn#6OjQ}LXQ#W*!5F`449-JU zr7GxCVk8Z^F=V)YfF2Z+SsEx_E+VmHT%Ht5AI} zg|AgSElWt%<+rYN@)wgj@?n?VB6CkueXSM- zCRW8&E4-h-)n#HE{HoTy)n#TUxKdzG*uUMu?1tK=-dL$ilZTykg)&Dq4b}vK@tr~_ ztKe!S9JT%G4r7P>YNM$0M6#&q6uA&!xB_NxPSmq!U))-P?S$I3FFq>xs4 zSSEpqr6+}DKCLQu?sR4NGK*a2$z)reQGJ2&^E_Fs+pmt=7J716RqdTN z#gogr{OX6SHJ$?IouRfR#=qeyWQYCgsIA@OVx@I=`t9*}SdU*FwH@>fVbh+aHoBKT zi}u{jW^q}M^0a3d+t}OqouXU*J-eY?TYgLcuX3QZTaNM0W~XH8tw4470PkE@;ZxPt z@O1Cm zEn+zhGzxzX-6Jh!VT~kL!h+-ny-V3dzp|Rgcw5<~UNzqP0=vjnE41ZI@+!>EpQ*HH zja#WuhL~!+FSEpE8jN1Cvy^v~k75F(H<@eE9Up@?*$}Q8;0*oRRPFv7+oJlg z*V2w%D>j>C5yHS^5FrZ2AfsV2GLEx9G@+dgFCy*mIx-UuB6DE0QG|S80V23y2hs~q z1&S~PY<)!hP4Yct35*UBp%iW+N5VUOMHmD3h$2+L8DteaYZ3w9oMusmDRA5@LN&|^ z7NG`GLPV&AW5_y~6)M6UNC^|c2OlFFVMe$J%@7bFLJMq;2!SPV(ka4n7#eB7Gb>6Hz*mDC!FtaXX7`uv$V*Qh_9PANf9P38* zXO3hn2Rn$gvn4554wjgTRqb zbs<|=Ob!-;jYqCv$B}KUbP$$+y@A}o%(++swh6g~4amb1uz;ff1$%!36*3c?jG}L*yrUJP_GXdGAu^`uICLuRyrXe?JYLHtrGmzUfvytr@N`1RV zM()%!BKK%$vM$X+@X3!xw7>vkG+_S~d2kmVJ5!r4CF3f;FaK@Pdp%7D)0Tvj5On{-tGT29!?O*j^p%l zR&joD{!eOLH`~_>M35{$S*zEFtFHb zAeYy$8rc=p0W*qwRQ4r5h{O*#zv5&j?hhfxae6tcIDMQOIJ-D|I6sJ__^&u2!$Q*( z#gc0RXFcaDoLzQWnKy$H@)0}O);uP!^a30&T#c-B6E6g=Cp(HbHJ+Gl+lUlXiRZl( zlP+yWUP#-9oEiG3=eC*bFGAXpuW~Mw$a5u+STu;3AGHH1rjng)TP@?Iy#H>bBbmE+ z(3*jN+G;m7Ej1xEIW-}xL@8czQG8!MnVRm9oW1B77jg($m+?&pJp{Qungd}Jt2f7wlY=ITq-7KKF? zb>zQ&PLNCRFQHpm$%%kv zI$nA=X`I>i^T>+b!`2n=PMZ4KiqE6MI=h3|c)ckfGVmKy2L3*g16h!|YQtQXx@vML ztGjnt9y&5155GhW1t;V}I))UXc5rJj48|{0>DZbL#b~D^^YA*D_sBmX(#+@0{m5Qm^0NKVC22b3W%e&-0w; zoM*l>LZH^FHLR|je7e0Y0d?(vzY{xE#0=xw*$4^ir;I|EIvz7HPi;gc=K?wT zX9WGzff2%109eigXkIZS5JhnT)s1OgmAZskSkX0mcC1P1DH|J@?uX(?;bMicxjgEQAS!`qGmGJg%(D*WF>zL%#CE=wxiXyDSjha3$h|b0 z?U+dBH9ylYwx6UGS;RjnHoIMHTr47o**UU2f%$jQZly>pdR-*(mf%;SXU~eDwm1&G z5XD?1>@bm5jaW2EB)39rbB9>xEpdR?geOYGREY|GDXJTj#p|pUNz4@SClyh~_r!!B zMCgyAuO(DElc`?_U&GJC-X}g8%3MsW3S3J#PP8N*FGHxaohCNh*nW&y9cUH)?Snod zPe;Ug;`NMP;^Dl{h}-in5w8s4S%-@ho;Jk&U*d`!4q7?1mzH+Y5>P zUS}$hMW=Ve#h6TT?aN}`M!j*v$Vi^>y6mDQX3BXUgv$}>#9e~J;tI*$n#(O)oW^HO zi+P{omx{jjQql-zbPR-2N)F*|N(f&9iBmv;-cdtMCnWI7hlmP7NG^*%gsdel)A7bhLpKsvhdf0*9LEXm6kI4y)|k&R z-_bJ>p>imv^+x_P8JiM3Q*#9$VQD4FT(r*-1x;mCQl31k#I&!#A zHzhUD5+5Zp(?d_wldhY(RTbze`^|qSfm56yc&L=^keofV&{Jgth%dw(FEhb&<^diP zJZ3&XoL@A6>cpc}f!sv)9JVt%ybZ+bB~0aVDo?l|rbVRjaI@efKieyaV*~4Bcmr*l z@l@oofd;`dl)C0O!Lo9?R*;j$)RvB+BbneyJM;T~yh{^R*90S}>?YVHcu+~<;c~$w zC)*{ovvVF9WCtS+m33<_{$^Q|R*98BiQr}2OJNE%f(FB)MdDbN#)0M_d@-rv- zd9>NZ{DD?*LISnY3H=5td~r609rVz9y_|0>UqC0^Jc#c^E|Ee7$BS!tIh1dM7Nafk zb2{I4?dDI<7(nqMu^cm9+!*aTr)09{{VZOMcX5Iv_8sC+Lysx+D790Essr)V>8ikN zy4BTzd+F;}bzrEMAC{NhAB*eLKqnqn79j5RGw+IJCK{OeM1C~+$^Nut5i#IhL>Dj( zqlwD|59-)nr)SPLFux!wZcvOYwi635%5sr-tC?A$XO729#6KFoAtso9AUcFU#mx5m zMvhq}W{ovoBRj{)@gL|>D!_ZqCZa4x_nUZhx}_g^X6t#iJhV#%3Vvp~=t+Z9^pHt| zS~{@_ym3s+kZ8#SZ>J^_3yac;uViErPtgYnkv`K*a9TXPA4C`VZ_Fy}i~qlo+6o8{ zVySfFL9PV)Tc}(%9rGi>Uqjel=4AdF$-G3KG~j1q8t^kQO*|8Cbp780y%K`fW3Auw z#ZB66xp5D8Gj89E{H4SlQA_(8I#~%@POiIRnTZBww4V8@X}PBeR+(;+V&FYE=81tA zc!xL=4$}7LQb$Nm7#25@c(bpUDiLswqI1tLtClKL_}jh;pC#Q%X-)1^lO;XW_Nf^Z zJ&V*Iwa_}r4EF>Fe<-t*w>P}_rcM+?+*44)u#> zM`DLW|34K!hm7$#bL8JtoqLX&wlvFjpS&6>i#TMR<%x*<)Co%+cNEF(P+QEtc37Fh zYPC>}@aOP_q{fu+SR+i2M2cuDWz_;B(-j&^C}X9aZ4F35HPK~Us=mE+imgrF0Moo2 z(FoU_ZK|gwi|^L-mP}luu4-}E*2|AW^l%Pnfr^ri>YkPU$4W+g_4)!8^B!5xUL0)q>V6`#!lFTqD`n0&fg@Q|_v3eHzCekx#)dw+k;N zb3#4?A){`nf6E_1o~A5U3OVo4*!-^ji#Vq`BhR&`qXtE)W$$ChVJ?eF~*s)Vo6GAAjLRI8>Sq&(hx5q{C)Vavcw@8?ih#j_jXTYska3z#ER z6BOiSdcTCZLA8e>FTui~Dk;xYGgcJqPRMG_ilWk7?>BIDoJfIASLnS0$#>mQviEx^ z=~KhKKf=uuc&x>;)N#9dbj1`~wf7f@nyC36jUKQ1+U6wIc(22@$?R*ijIvKB)frTG z+w0V~+Z;Gg{j{w(dy!X%hN&VB{^@S?8n8a7&bU{4&A20|o(Ny7-nud?af3Gmf4N(W z&x&+G7{*Q4)WDpl)m1C2M{M<4(K}1?wL1`OSR+(ByjC(pvf-wnYVgjG?07;b74}9w z?+wSR+L-pn8vJnPhz=mqTYQ0w5R^JQ-o9uBI_)&t&HjGN7o>p)I? z#~X+BK~-6F(yMNGIDYIWUI!i*&K64`;VV+-gUXWdi8ld14=M+ZCE$-iHKX(sZzAG7 zA_>cq(yvI_gX)m$s#gtN6`zg1B+Q$`A?wFScF1RsofzO9$gX*ZW$yb51{>o$gUVb>icMIMxWFyH(d?Rpk-{9X=}<5PbxfHg}UhTz9l#@psDTApZOlZ&Y*fA=4+pVQH|Qzr&(TKBi0Dj z4u?X2@HJtNrbL5Vuve&cutbOc7Q7OStS7Y`3!8Wq@f;d1J&aM!EZ4z9nW6rNaavF% z*`xgJxTR0U``6$_q1vINFx9W3OFUEg(EDU{qFP~d`8VLeR$h!hVhhw4)PE$tDLsqQ z@*6&cXR$)4CO89d+n!ZkQe1YDDD1p^ufTEU{= z3-l6(#e=M1$Hl}b+)j+cv%~~+WKcV>jhK#?h?&@wN$tQ}v#1?-j#!BCgQ*?ZPL%L_ zq94n%sU5hDI0DTsY6mVPR^mD07%a)5cHnyAL{z?^ml~XsOZ~tfiM2Rp2(<%WAlBpX zJZcASBQC&UZfXZM5(79ppW1=u0%`{?Cbr=z;%ba9q!!>RVh4r|r551b#7%gFxCLv9 zs0DbQxC85psRj5Sg5@q#5KgjxSn_fHxhgBDdGuyhIj$D6YaWA zVw7$dF;4eNX@5x2?W5a}sN*k#HDYv{?l6tk>fR|0fjZqWvg>spklmo;^%v+qELB2a zv5vP1kg!0r?i{g0*Gt@}`+~Sh_cd{gjAlD z59&h5)1$KzPYBORk_Nb)Su^Y)ANbT9=1da<#dw`|q(Dckfsd9^-{xK^J??9hKe z{*C%nvN!27h+Fh7;x@gTxIt2Ll(`VBl2Z43lXf!7#PV3=M`_vKJU;5x+KY)>jN1e^ta^GjP&j#@x?UCwBERy*kI&CE>Mizo5jXQX!wY6 z1G##PezGe~Ptx{dOk2n^&cx-NXxd7wG3_9KovD^sZ+eka6kK51N%mq>cbO5IO|KAJ zO?xSRq?wbhG;`8p%zVgkWv6~toJlIrT0gGtSErJ!u_I_+4o)rWg+bM#6!5YDj^()A~*}w_iWaOBsM)oubdzo<_ zNW(S@`(xn;lM2t2rmNE62^o5jmn8u+5zZ)TU@{1|b6SQog5oz>W%{a|Gt5IiS{ zHsOz8rU?24YXk#=n*{d@o)tV0%kk#~A=km%lqa)mieRJQQ-b?ld@_G7Clp|I;r3!w zM*9Jdd+sDo@-jaSoxpY+b7m^D!1*VlbujaSpJQ_5sl-pSYl-tCfAd_ov;9Ft9r0WhXRm97wYl-ucI*3OdPx$FeOp}gXc`1B86x*MP+D!K2 z(OZeya@o=Bc}i4ebO=YT4|$IGq`iw6k+g?+IFXqg$`zG`y({50vPTN;EM@yg*CFEX zDyjqv{`-^tZutLs^nuu;wEY)eu9?)IX(*36?(Zsj{=81H+(UofLCd{JpD3332+yHq zA;R;RNqhlE5IeDx_#$>bfbbH=(QkjdFs_Myzl(7X(VrHugZMJ;CU)ah;%>CJBJ4qX z8^SBNn)oVqtVQ}@+D&{7^BzHX9Ss3W1EA~C7c(ZMbp^XRUok>ht{l%;)3xtl!#e@4fb3 z`(+ivdc`0jOTy#4!dt`xFOD=qMGUr?KXa>C+?ia#-OgU!{k5x05Io5Z5OY zf9BlB`8DTh&UcYzzQairbIeG*SV-KTMw9}H5t+n6cH(?DaZeHPB9E`)F&zWKWORiF zP(uYDIy0N>yjY@}d)lmIZ{nSo=8>JsJ8#V;+X=)MwZz;AVh#8Fhuhn@e>?Yl!fhY7 zALOYgA>~oNrejUal~Lg<*B}8ui^gPoW3CPgz(9(N0Qy)AkG^= zoX*pIlke_XzNBD2!l(>tb%Y>gU$}w9Ju$={3-L3)R>4JfmPlL@Osvl#{twUH8BTUY zDDjq;=;hN_s+-K?*Yn99 zbKDN%X;tw-tvtEKe42;&I0yLx-she$9#h75=nCK6h!h%U1y5osk3S{zZ9K+1{K7+T z^19~Z*6HVkzcx7wZ4f@t zg_H(*kyE81$i31q>~$)#1bM_uo=|rg^5fWt&~q!zS(pvo0aoNcIM=3)MZ2DJQ~X#N z#a;Q-d@|39xrgS_3d*vH6FINMRHEHlNS@*hvOBo#;`UqIo|_a|=zt14tts72Je^Am z>u06~eCs5h;(N9vp6r+TlD45Om-&9NPU(Pi;uPdwq6{gxdIwyLs7CHf zA>N0zaX?8Zb=WJ_Ag4;TIPukxDaak1#Zh%=Z_c2S%}JoOCPehZ$oagk-(u1X3UC<= zoR}PgPcbb9k2r|qanBg!a?1DeOFKU@_h6_Ej<{&zXX1!STAJV^KIP7gIlV{nwe&hX zjN=lBzl9TD&nE8TY~h^2IXQy-pJfu$?8IwvM4gQ|OAe;XE-NurAl~HMs3E&SOFS1u zoaG?S;atS|Jx+Y*B){pRHN|7S8FUV;M7}YQ>^>$Ras)45JZFKav3D88{be5xx+j)6 z3(4SFzJZtc@zGmpprg1$Wxm(=k?F+x+5AULooq%BdDNRNGIasQA4#MeZ%pPQWK+gc zWLt=WEXi4gd?956a+T)|B;=&Zcv0_8#YLU}9z+`s2{duv9P$YKKGqk~sh)4`z*NGW zJCS2~$-c0>htqGiq#}pm9@u~-?Ze1nDf^M>PNLoV3GzAf5u_&QIC5MxjeGzpGYH5a zaeu%m#@x;) z%2(s5!+G8`zCXe#fa-PA|Rlgn<7U8ji^c12xbObI* z59`gupZm}(4Y<2{D8X&l!w$~47Vb`#O>9? zPq@{05>nUw0j8*jtMSz9dk@i`K(u;^m0oIXv=e{95o{2RrL;kxM41lGnjoVK@AV=& zv2*}!FmwQ&i3}u$a*pN4@M<8P1~o<<;?-$}u|nm(epu-;-*i0H<-VtriG$qqu)OL>a?zV`C$6}-U_Ww? zm-uibF-A+wLQ+g4+86ToA${(B*f)WVMK0vrFOa=bL!7B4UPj6ekaZ-sBC}bT(eBD- z_Zo;pG{mvYfqX!li;UJ6A}!n>XCV8ej$)SaUZZqgw9|DI|Al5K@@d0;NQt+0>8W*+ zaX50ihDOU|BVE}t`%Z6nCBSKX$RxlNT(KV9QAFdwv3LMKjh}$b$(@4Som7oHjV}@; zzSH#ZFaGeJ$7;}jr&nEX{Qr$qM_@3I&E-2vhgbIXEy0UPAb!dDM*!IiZNxu9iQl6q z0qB{S0Q5{u;LpT6RsZkAc`gQOjn#V3gO1?k z;YebPmKd%fzNbG@me9fJUbPjYr=fa44Q+QB;0b@@FZruo0Z`woI$eEWS+9EE z)fd+Fs{JlAyzN&{E;s=+vF;92Dl zd4lOHmlY1GKKL~9g7T!#V*SAt3;pA1j0V_|`3nx$=vNkpMpCx;J`@5ZrMkXfL4f3d z(f!rgEFlaWFd3B*TH%LOYI}ya9e^8w;erEN{OU|#UrFhz?896M^g688zDF)#oW+Oc1siBhCebZz8IA`UG4XH!2Qxhu=v&C^m1tu zB>2_Kj&f--*tx2Qr=((O3TQLbte=v~rD?FouU-lrD^05_8st|3BrQ1G;|c9nznw+R>pT%ug}xl9oeh zE`_W#t_#_vjGJ$HXtvY}Q}W2y3QOWhE$6Bp{wsJds*(BBRu7Xx8Ah}?Ni{)9|BtXO zx`33rwim#~RRbQzPn1vRPcU^$FT+GPMbyJ>Teni!ltO1~Qd2TJsVr-ps{vh{aGEwd`5HS3Xvbn#6OjQ}LXQ#W*!5F`449-JU zr7GxCVk8Z^F=V)YfF2Z+SsEx_E+VmHT%Ht5AI} zg|AgSElWt%<+rYN@)wgj@?n?VB6CkueXSM- zCRW8&E4-h-)n#HE{HoTy)n#TUxKdzG*uUMu?1tK=-dL$ilZTykg)&Dq4b}vK@tr~_ ztKe!S9JT%G4r7P>YNM$0M6#&q6uA&!xB_NxPSmq!U))-P?S$I3FFq>xs4 zSSEpqr6+}DKCLQu?sR4NGK*a2$z)reQGJ2&^E_Fs+pmt=7J716RqdTN z#gogr{OX6SHJ$?IouRfR#=qeyWQYCgsIA@OVx@I=`t9*}SdU*FwH@>fVbh+aHoBKT zi}u{jW^q}M^0a3d+t}OqouXU*J-eY?TYgLcuX3QZTaNM0W~XH8tw4470PkE@;ZxPt z@O1Cm zEn+zhGzxzX-6Jh!VT~kL!h+-ny-V3dzp|Rgcw5<~UNzqP0=vjnE41ZI@+!>EpQ*HH zja#WuhL~!+FSEpE8jN1Cvy^v~k75F(H<@eE9Up@?*$}Q8;0*oRRPFv7+oJlg z*V2w%D>j>C5yHS^5FrZ2AfsV2GLEx9G@+dgFCy*mIx-UuB6DE0QG|S80V23y2hs~q z1&S~PY<)!hP4Yct35*UBp%iW+N5VUOMHmD3h$2+L8DteaYZ3w9oMusmDRA5@LN&|^ z7NG`GLPV&AW5_y~6)M6UNC^|c2OlFFVMe$J%@7bFLJMq;2!SPV(ka4n7#eB7Gb>6Hz*mDC!FtaXX7`uv$V*Qh_9PANf9P38* zXO3hn2Rn$gvn4554wjgTRqb zbs<|=Ob!-;jYqCv$B}KUbP$$+y@A}o%(++swh6g~4amb1uz;ff1$%!36*3c?jG}L*yrUJP_GXdGAu^`uICLuRyrXe?JYLHtrGmzUfvytr@N`1RV zM()%!BKK%$vM$X+@X3!xw7>vkG+_S~d2kmVJ5!r4CF3f;FaK@Pdp%7D)0Tvj5On{-tGT29!?O*j^p%l zR&joD{!eOLH`~_>M35{$S*zEFtFHb zAeYy$8rc=p0W*qwRQ4r5h{O*#zv5&j?hhfxae6tcIDMQOIJ-D|I6sJ__^&u2!$Q*( z#gc0RXFcaDoLzQWnKy$H@)0}O);uP!^a30&T#c-B6E6g=Cp(HbHJ+Gl+lUlXiRZl( zlP+yWUP#-9oEiG3=eC*bFGAXpuW~Mw$a5u+STu;3AGHH1rjng)TP@?Iy#H>bBbmE+ z(3*jN+G;m7Ej1xEIW-}xL@8czQG8!MnVRm9oW1B77jg($m+?&pJp{Qungd}Jt2f7wlY=ITq-7KKF? zb>zQ&PLNCRFQHpm$%%kv zI$nA=X`I>i^T>+b!`2n=PMZ4KiqE6MI=h3|c)ckfGVmKy2L3*g16h!|YQtQXx@vML ztGjnt9y&5155GhW1t;V}I))UXc5rJj48|{0>DZbL#b~D^^YA*D_sBmX(#+@0{m5Qm^0NKVC22b3W%e&-0w; zoM*l>LZH^FHLR|je7e0Y0d?(vzY{xE#0=xw*$4^ir;I|EIvz7HPi;gc=K?wT zX9WGzff2%109eigXkIZS5JhnT)s1OgmAZskSkX0mcC1P1DH|J@?uX(?;bMicxjgEQAS!`qGmGJg%(D*WF>zL%#CE=wxiXyDSjha3$h|b0 z?U+dBH9ylYwx6UGS;RjnHoIMHTr47o**UU2f%$jQZly>pdR-*(mf%;SXU~eDwm1&G z5XD?1>@bm5jaW2EB)39rbB9>xEpdR?geOYGREY|GDXJTj#p|pUNz4@SClyh~_r!!B zMCgyAuO(DElc`?_U&GJC-X}g8%3MsW3S3J#PP8N*FGHxaohCNh*nW&y9cUH)?Snod zPe;Ug;`NMP;^Dl{h}-in5w8s4S%-@ho;Jk&U*d`!4q7?1mzH+Y5>P zUS}$hMW=Ve#h6TT?aN}`M!j*v$Vi^>y6mDQX3BXUgv$}>#9e~J;tI*$n#(O)oW^HO zi+P{omx{jjQql-zbPR-2N)F*|N(f&9iBmv;-cdtMCnWI7hlmP7NG^*%gsdel)A7bhLpKsvhdf0*9LEXm6kI4y)|k&R z-_bJ>p>imv^+x_P8JiM3Q*#9$VQD4FT(r*-1x;mCQl31k#I&!#A zHzhUD5+5Zp(?d_wldhY(RTbze`^|qSfm56yc&L=^keofV&{Jgth%dw(FEhb&<^diP zJZ3&XoL@A6>cpc}f!sv)9JVt%ybZ+bB~0aVDo?l|rbVRjaI@efKieyaV*~4Bcmr*l z@l@oofd;`dl)C0O!Lo9?R*;j$)RvB+BbneyJM;T~yh{^R*90S}>?YVHcu+~<;c~$w zC)*{ovvVF9WCtS+m33<_{$^Q|R*98BiQr}2OJNE%f(FB)MdDbN#)0M_d@-rv- zd9>NZ{DD?*LISnY3H=5td~r609rVz9y_|0>UqC0^Jc#c^E|Ee7$BS!tIh1dM7Nafk zb2{I4?dDI<7(nqMu^cm9+!*aTr)09{{VZOMcX5Iv_8sC+Lysx+D790Essr)V>8ikN zy4BTzd+F;}bzrEMAC{NhAB*eLKqnqn79j5RGw+IJCK{OeM1C~+$^Nut5i#IhL>Dj( zqlwD|59-)nr)SPLFux!wZcvOYwi635%5sr-tC?A$XO729#6KFoAtso9AUcFU#mx5m zMvhq}W{ovoBRj{)@gL|>D!_ZqCZa4x_nUZhx}_g^X6t#iJhV#%3Vvp~=t+Z9^pHt| zS~{@_ym3s+kZ8#SZ>J^_3yac;uViErPtgYnkv`K*a9TXPA4C`VZ_Fy}i~qlo+6o8{ zVySfFL9PV)Tc}(%9rGi>Uqjel=4AdF$-G3KG~j1q8t^kQO*|8Cbp780y%K`fW3Auw z#ZB66xp5D8Gj89E{H4SlQA_(8I#~%@POiIRnTZBww4V8@X}PBeR+(;+V&FYE=81tA zc!xL=4$}7LQb$Nm7#25@c(bpUDiLswqI1tLtClKL_}jh;pC#Q%X-)1^lO;XW_Nf^Z zJ&V*Iwa_}r4EF>Fe<-t*w>P}_rcM+?+*44)u#> zM`DLW|34K!hm7$#bL8JtoqLX&wlvFjpS&6>i#TMR<%x*<)Co%+cNEF(P+QEtc37Fh zYPC>}@aOP_q{fu+SR+i2M2cuDWz_;B(-j&^C}X9aZ4F35HPK~Us=mE+imgrF0Moo2 z(FoU_ZK|gwi|^L-mP}luu4-}E*2|AW^l%Pnfr^ri>YkPU$4W+g_4)!8^B!5xUL0)q>V6`#!lFTqD`n0&fg@Q|_v3eHzCekx#)dw+k;N zb3#4?A){`nf6E_1o~A5U3OVo4*!-^ji#Vq`BhR&`qXtE)W$$ChVJ?eF~*s)Vo6GAAjLRI8>Sq&(hx5q{C)Vavcw@8?ih#j_jXTYska3z#ER z6BOiSdcTCZLA8e>FTui~Dk;xYGgcJqPRMG_ilWk7?>BIDoJfIASLnS0$#>mQviEx^ z=~KhKKf=uuc&x>;)N#9dbj1`~wf7f@nyC36jUKQ1+U6wIc(22@$?R*ijIvKB)frTG z+w0V~+Z;Gg{j{w(dy!X%hN&VB{^@S?8n8a7&bU{4&A20|o(Ny7-nud?af3Gmf4N(W z&x&+G7{*Q4)WDpl)m1C2M{M<4(K}1?wL1`OSR+(ByjC(pvf-wnYVgjG?07;b74}9w z?+wSR+L-pn8vJnPhz=mqTYQ0w5R^JQ-o9uBI_)&t&HjGN7o>p)I? z#~X+BK~-6F(yMNGIDYIWUI!i*&K64`;VV+-gUXWdi8ld14=M+ZCE$-iHKX(sZzAG7 zA_>cq(yvI_gX)m$s#gtN6`zg1B+Q$`A?wFScF1RsofzO9$gX*ZW$yb51{>o$gUVb>icMIMxWFyH(d?Rpk-{9X=}<5PbxfHg}UhTz9l#@psDTApZOlZ&Y*fA=4+pVQH|Qzr&(TKBi0Dj z4u?X2@HJtNrbL5Vuve&cutbOc7Q7OStS7Y`3!8Wq@f;d1J&aM!EZ4z9nW6rNaavF% z*`xgJxTR0U``6$_q1vINFx9W3OFUEg(EDU{qFP~d`8VLeR$h!hVhhw4)PE$tDLsqQ z@*6&cXR$)4CO89d+n!ZkQe1YDDD1p^ufTEU{= z3-l6(#e=M1$Hl}b+)j+cv%~~+WKcV>jhK#?h?&@wN$tQ}v#1?-j#!BCgQ*?ZPL%L_ zq94n%sU5hDI0DTsY6mVPR^mD07%a)5cHnyAL{z?^ml~XsOZ~tfiM2Rp2(<%WAlBpX zJZcASBQC&UZfXZM5(79ppW1=u0%`{?Cbr=z;%ba9q!!>RVh4r|r551b#7%gFxCLv9 zs0DbQxC85psRj5Sg5@q#5KgjxSn_fHxhgBDdGuyhIj$D6YaWA zVw7$dF;4eNX@5x2?W5a}sN*k#HDYv{?l6tk>fR|0fjZqWvg>spklmo;^%v+qELB2a zv5vP1kg!0r?i{g0*Gt@}`+~Sh_cd{gjAlD z59&h5)1$KzPYBORk_Nb)Su^Y)ANbT9=1da<#dw`|q(Dckfsd9^-{xK^J??9hKe z{*C%nvN!27h+Fh7;x@gTxIt2Ll(`VBl2Z43lXf!7#PV3=M`_vKJU;5x+KY)>jN1e^ta^GjP&j#@x?UCwBERy*kI&CE>Mizo5jXQX!wY6 z1G##PezGe~Ptx{dOk2n^&cx-NXxd7wG3_9KovD^sZ+eka6kK51N%mq>cbO5IO|KAJ zO?xSRq?wbhG;`8p%zVgkWv6~toJlIrT0gGtSErJ!u_I_+4o)rWg+bM#6!5YDj^()A~*}w_iWaOBsM)oubdzo<_ zNW(S@`(xn;lM2t2rmNE62^o5jmn8u+5zZ)TU@{1|b6SQog5oz>W%{a|Gt5IiS{ zHsOz8rU?24YXk#=n*{d@o)tV0%kk#~A=km%lqa)mieRJQQ-b?ld@_G7Clp|I;r3!w zM*9Jdd+sDo@-jaSoxpY+b7m^D!1*VlbujaSpJQ_5sl-pSYl-tCfAd_ov;9Ft9r0WhXRm97wYl-ucI*3OdPx$FeOp}gXc`1B86x*MP+D!K2 z(OZeya@o=Bc}i4ebO=YT4|$IGq`iw6k+g?+IFXqg$`zG`y({50vPTN;EM@yg*CFEX zDyjqv{`-^tZutLs^nuu;wEY)eu9?)IX(*36?(Zsj{=81H+(UofLCd{JpD3332+yHq zA;R;RNqhlE5IeDx_#$>bfbbH=(QkjdFs_Myzl(7X(VrHugZMJ;CU)ah;%>CJBJ4qX z8^SBNn)oVqtVQ}@+D&{7^BzHX9Ss3W1EA~C7c(ZH*5ECo!w0v ze`r8O+CMF=iuR9!2%?}Of<;s+6u}=NDvE-F1;r=@+kaYZ>vv{%bN8lI#3B^wqm}(G zrQztN;ksU+7lbZDSGQa}*PquNZ&YL&8s@EyT@S1$>eZ_0qwD{8Hi`Bft9CEQs3( z(E-q*|7!E5)keuUHp1##TkOG@uiGg%}zOQ>_JdQz`zhhF$rM zU0OVwu}pMiS~Kmf?QPfbj9RimmjYY!Bk+g*0FU#5wA`Z47TMaUmd$tODTgtauKCtG zdvfT9z&{RP&0V%vU}H2)*XArG+QG~*t(}%d*f}<@VSfDZ7`D`ahv*wET3;P)(l%7p z(ff+NOzl+*X$)p{^e!!ge3{0yUD1~meMr%riXKrmpM$c`XP6+SMsw+kDvcI{*3k;k zd9)665w$6LouZwJ_9(hZ(YqBj6wLtl0m{%4`Uvzwng(sAqo9{5+OFsgv{cJbH(d#O zJ8cHd(*)?fpfyub9{C9IT36FPpiFP@^XYlWXUk4Ri6LF-uEwmn7)9KYm{TgMg+KNl z=^lj+<%u~h<|4~IutZtnwjbOD80(5}u9z2ArM+yd(2ZAcO%;|8mE(1Lt{F-x++b5E zLNU@tWl5J&tl;y3VQz&4`^nsj9oX&JwlD+Bb0O>*kltu$3W@oC=y0FX_RCQrje;!( z3>jEFMaT-@IZHV*Hzqz$kDl_j$Dae$4sHHq_kvQUe|NEAk9BDK z%~YdnT79)nS}g{P7c<*f|MtW84X^0buCM{_Kkobbi*G*ocHd{$ENQCR zJzw7V+tkyK9z3*d(XJ2YZ0lb)eO2S0pKA|)KizcTrC+9xj^5Y1VDAU7KG(9PaQQ3Z z@>R#ayeZh?UGc-wNA7=p;lXEax@6_f^SZ@y-8rzgqwk*2_SS3hS9~?28LC=#mo!Ru zc<%b`rcg;58kgQSUxOW^Ct9P?s=qBZ-XI#C-{-lWJ}M^gZ0R%x`n#ayQk8`APZUssciFc|kFzC{a=IR1FyPk}mn zh`P?C;2e&>;Vi04?nxy;0-hM~?L9lQQ5Ro^4CEHjByXeZA!zv%OeMW0}wm#zVI!iN1*yowxZN)3S9Ag+UB%+ja+<}$0&OD514eYr}oF9qazzWJM z{P$Qg@XdMV-L?WTdf~sQymJLgs0pvUNaKi%j{`EX4q1$L591AiTTkWJfFyvmr&h#y zvK99J*bna(#-8MtIo<_llF#xQ#_{piXaKQ1tSbcCAeE)`K1lW-?`j>Z=Dl9T31H30??2C6DW9?A&tBfJQ&`!=t#}0Lwbua?J8`_mq!be0-MwB9o}F3l z%sAfu2yUUONF@lQ58zj%3aLsZT9v9rNR5INp$3&7Mf4G=NJN6xASB37f*^e7&SQ6D zgYpYif@9{~^SbApd(NHN6GrbnN=-!6jOXG-q8G3-^lSY2XaVYuZ@kz+e_Z+MmKThX zSGP>eSe{u?Zb^x)3kTWz<|4-PI|EsML%Ob!|_}$Ay zKhfsI2@4{aB3c8|gx%&?b~&q=q^_;oz~5Q7FYU{DANb9Pb+D=Fx09kDB0HrJay1dG*HKCvVwClaBeATp)r$a3^g}cSO>?q z5iQj5pG6Mj?iw(n-JHu@U%Dr~qi09&&Ag+9Y~UGOxUR!QuVeiHd3NP|WjQ5}El%Tn z+=i~ZbM#lx+`6ti?jFu!{Wth|B-S-xyLs>o*lw)&8quT7TrhUfRblQNo6oR1dYDEy z+KPwhT_ZeSD;+c*OtsSAH2xDENUfzO;Ifrop*G038jLd!utuS^K9 zW8e0ep>qu!M_`?)^}DgJJ+WlnEs4&EbfM+GC|+pHmb((m4NJW2Npy0FZZdQM%xAB0 z?DIgPrD+_*z!oCdp_zk zjabgCERI;7zXzZ1sb1O_$bi?JFAB3*haL=sZTZzfw_FiQDptA5m&Kg)LEkC7nUJb^ zN=(@8)QypS)++dx>j+haXy>R~3~YHjmA!(iY%5Q>s^`mcdeF6PsSUmK9nz7?DiCK@ z(<@0?nGZ@Ok+)^W$M+>4_>wZ7C(C)eI$`;JwFx`cc!I{qV@sPj>#{*8e?o_85XSz z`|cH6Qb$*-ogXgz;-S;$4y}9qb(HX;mPn#&4cfS^&}~i%Wx0W8>P;f>XIzCLU=6CpQv?2V zCjU1`kCAoR6rV*>>+Og1>hM`%W9ryPWo#X*4f|E^spe8Yq90VSsaZtmUwD*7?2Hq7;-Sn5{ z_df|I6uc-J!u5M~TzDZP0hTNt16~Cw_^~ikO89hWnp|zPRnIvS&cRu<%?WjtL#V1s&+zdp)?Cb}JSnSr^>r852`cKe7z@K(j@LsG`1#(G=l zR!E}j5tl|V`NaDxI>#z1BD62gZ&YXM;wlv3YYvYMNhOJ8>KJTK*vGlVRmj5Dqk=wD zC5g&DFE_Uyd?srCCgD%PW36_5I9X5faQv%b&(-I1E35+9)=qOdanm>_SBha06SIK| zNpyrgaTP15D|e|xGl+uk3{KdM>V!9da|@88Sywj!i4SX6XCM0IJoiR^xZ~_St{ZdQ z$;+!#eZDjJ&>J)czb;M@ATz)2^!2@r?+f2T6DQ=mS;7thEFlSRFyC3eLn`tWfa1LR zbYB|dT-u#WdvgmWWrH&C=fOuAx7S7`xo(YJjra9No#lFc1z(a1nBo63II91B{v|o{ JSI0~$@F~IJy($0z literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Debug.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Debug.dll new file mode 100644 index 0000000000000000000000000000000000000000..50018c8250453db105af63b7ca2264c179bc9578 GIT binary patch literal 4608 zcmeHKYitx%6h5^3OJ?6OWd?lH3;ao-2%lvuv-cO6=t`$+tJyXb!N6uW3-8{ zU}8W(6No=ZjDKoGV@xCj4H!Z+fgchzA;E|V#%c)2Pf^70+?m;(7BHfJB;joDx%WKo zx!*na%-m_qhMiPIM8#-VuM!|v|KeQR6A#?x~az75^Bck7SVCzM$hp>uW2M|R*GoeE1$g)tag@Wt7DXEqH<`s zfey_BQ_*5*L=)vW;^AfmA2%dPD$$mx?bsbuSQ(-dbBP8*@{NY|iPiOr zKbx`i)kdqMi>nvcEa4d?WPqPR@T%vrCNS;g(X*&35S^z$g zY9wDGd7b1rW&@h)m(g(D19C4!s&tzi>56d1JgF5@NnYBBY!##_!=yb* z*fu!Kws4sA`Y`F7KM#v6Yq7d>hIoWBPRgn&UrmJTJg8_h~ zZs=~v8pP}9&kEq!7BVIJ9am(caa~KBmgDLvCn~+^Muup&Vfe{0MkUp)4Uv`l6xc>-D)6jfcCAJ$+)WNK>(@DCI>e zDJ2+8n#AJx@=u=K)H%KO?Dm2EGzU-M0MQ=IF6HM8a(kk#h966QZC?NcWujtQ@hI*|F)gQXgVU(*4bJXk5%Kgl#s>8wZGL- z;OD(1W-3&1qXQwjQ=zFXmT9Toq7Ro-HX}?|b%mB8ny*lmG$GF!%T${+Go91YLdEl7 zYmRH9By+YP;uYqn7O0(?ty?)qm6Nob+iTf4gt5pO-!J$foBt~sarM$p|DI)#gFIGw zbS(w;b)QKBuGk7DlW7LE%tyaiQ;48eZF8Z|i;-B6Pg@-_r*FPGP{42@V z5XCW45LF`^addoB2*fn0hb-wcN8WQCuxijcuxsSP&w}L9hsCYHssNJDUI;GIFULZ~m7N%x= zumrKP5^q1Uqsh2zZ;_}i9CbJ5^`RNiWb^B)ay|AZ+8}WS8R2yttjYV!%JqZ&{~Mgu zcr_^b9CaeLjp&7()?#PX`Nmjg!kc8W-M{+zH1`O3ZD39Igt+9ORQFKJA-7=P>qO zyz~`XgEcJdCEvGSqYf3=lRXo=?SC{R_%3;J9Yvp+jUuWd0 zjXbl5@#U&e9pX8NkwHETWR-I`{Ir94HU5cn?rzg9ngP}OpYiZRwVsA{sJ_h BnBxEd literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.FileVersionInfo.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.FileVersionInfo.dll new file mode 100644 index 0000000000000000000000000000000000000000..503771a6f1d394b1523f654aa7a0d9a1664158a9 GIT binary patch literal 4608 zcmeHKeQXp}5TETA<-3RwP{1was{uE~UI>JO*Y*IbEv>y$l+W&6U$3isyXWp+X_ep^ zHGuy>KnW0Ij7DS7ATdUW(F7tfF%hFA8i|--)L0D(lE@!o5P$Rbw!MCUCKAFQ%ys9@ zn>TOXZ|2S0w{2LroAQaM0MFH{M90uFg(bf}%V2oiJs*yv_eY*8J*L#3DsAaBTs7s` z2}e(=aow_PPmKxHNn5I6sgcI0nzY-6Hg@c&Sy|UjD~Rfqe3~DLeh{p7j%KQ(l?tL_ zX!rrWIR{L|6UIYSBIP_EH!B#wqzpLpO!*Xko=y3$zs+`81!{rcMi#@*B1>&V zV<0Yu-LydWUs|;fy0k7v|ACx&nkTwF^xr80!C|(OgPH^Ni%LNM53_=B$)2Nxok4<>2ho_sFr2q(ksO0lbK&f{&td z@Df@m`4Y*iC9jkGVaXqrT$fw}?&G8Z(P!XyQ!jWKT?C&md8On_X{w@8Erq}zqK)8D zdJ23!ctNKBOfa$;v>i=ufltbo(LkN$he0al5FJ#GC?lmrRSkA~+7!zv>BeoxG-4DH zv2-G#$4pV}VFP1nPf)e%ie${}X)(Ov)GG~BvkMa>5zV+D(&uvuvX^iw;x7 zIpRQbo%y82J=+<^Fi>RyYJOIP6BSOE5f^TDKXDMT)9Cv28nu0~byfGu{f}Sjed5Z| z@2Egkl;V7qltKs-CUAFL@zEzYv`!73+nITlW}(V5L@#1`5g$18o1@hWx%BvKjQHyE z+LMRR{QkQ3+@bM@uZ;b*_sV1EcWwVGzsr2K{=l9Y?=Ai1;F+(_p7{RY=|vMu^LCGR zs{YKp^z_Lewv_Dpbi|g%^4|N#?fI?n{7=25$KSZnd$D~({g}Nc-aasIV{E}8v0(b; zZ@dyAFqjWUDLwB$`*>*%S~wzZ-= zE@V-)bUOAHSAiX)Cz`9!%zxiCqPrBD)L>h-+Ag~ADo!PZ<*A;~lSK0rDw9J)jS6g+*u+y$8C+TUg({`{QV~{<5o8l*t-7;*@ zHA7pocM1dC$Fj=OPzvrIe`Is5?L3?<6#|0Pu z_V3PMvftjHb;LdYAO@a^A`lgL)yaV$1K$(^J}v4XTN=%h_go7`b!c6T>*T@CM$e}s z1ux@ULIEZZRtEHmVLWw9n+ghkA&NmJ+Jw7U!M$r!5p|;5lf+FOfnObd zE!eTvpg3BsZ=F`yInemHa`D&WBPQ^lk}>okW4c_6@i)jwY#fPp_~^o8LX+ylqDl;G zPgtF?23d;0)&&lZIVCX#Ik{2TEAV>lUvFTHj6H-5RP;TJZ!YXPdd{1JR!21b(cTDL z8uDb~$JB~1GKK1~Rzj}CyO_ehaYho<2^4r=BSYoLu3uriKWSu5&B?nCjR$L6?jZZ^ zl5sR<{cuHb96{c>$CYwpY9u$FPF%1GHDO&FQKo_1%gJ7DtpxSTJFX%Fd^Qr8!8IzN z@hgze3|Fg@^_7OixI=PZ2d*=CcL(q7VmYT8{#^J-;`ErvH0L$9@`u(0=kqq*qztJ3 R|BP=fx=HKZUgnm{z(4BwYPkRa literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Tools.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Diagnostics.Tools.dll new file mode 100644 index 0000000000000000000000000000000000000000..ea4452fcb5fcffaf112c4327bdfa775a636ab68f GIT binary patch literal 4608 zcmeHKU2GLq5T5Nn&_WR*pnwYn(ju(IHYx%1w!H<4Eydna1VPw)dwRQMf3CZG`{M&P zQDW2>2%r&sF;QO-@h2t{6B9_##28E@YC@t06AZ;PB9CGyesgxWy_8}^UnDZOXU>^9 zbLMXw?)ZQJqHq)^?gts1r(Z%wF{(V7{8#fj)!(so+I43w$C~ftS-V z$(KuBCwY_Pk4e5+a$Rx_xQ~-Y)94HEyJ---f-ZsID|wCND`<+M0rg_=M=1fGpr^o} z052FAeI^*$Tw03oIkOQ>56kFU-GLwsQl;56dRLi%Q6Md*vOJUq(aIL5Gi!>6$?{T; zYZ^&fBW&U7zUXYg^IhlTJd;^pP$HYjxWe;V(DZc9L|i1Z>9n3Sb98l{C#UtM((WPfizs@vtZ*;c7u`-4! z9k&Tn?~|jP`3S%U7b!{kqYI;n1}D?+8tLwFr>u-__m8e=%i6wS3EmU?Bn{K>b7m9$ zo-ZsdZs=*-@q8oYY3+_3#W8?hQow1jPJG85B9jT`R zRZ&XvRZ8qN$$$u z2VQyRe9HzO?Jf_okeDb=9KTFW%80W~$cl{k1JyPVX;K!W(NYqiN5ZvB}jl>m9qXFC}E* zwRgKtucyF{(G$&4Xy!OM40CjsLepCu+fh434_@#YOW3~Z3*92BRH#Bu;YcmVR-1J@ zoy9|@;#qKY&v#LdSyu!*RHmxb4&61Jtf$IFde-lDT)c8iku!cr<0tX_huE0wi@pi( zDu(zgk5wLBPiJ%Nh_*L4Zrn6mbi)qbS3<}qhSyzP2p?m&x!&RbMx)4N%)~W&ZOFlm zjsm$(&vyLn@OX@9h(9Dl8p^N5r~^0BcJM}O!>9>gTI(S_-;8iCVehhq52>7(AiyUdRK;CohnAM^6Ft3vjI|oug?-w)!s{%|u ztPJSW<9Mo+Hq{jUYAJ~^(K_7f3hrHpEc^sk``CrxtslJ)jfI;!4!=75+OT7-K`Hba zwL^A*Nq+87Gd@@%Um1zFAKB5RU&h)3TlSz*C;axHnUFFg`>Jw3wkO&maYY%4!`8!| z9A8H6AI1Mqa8~2Bri|pM1HN5&AI)hkBC8&0jAah&`BXR`E_xlvMxA$@nh@6@TmVR};rcNRuW_6E<20&fDzA zF}vs32n8dGAoPz^32kZN52T8JS`;b-qCx_tl7*B%ibMrSm7oezX$`6rB1K3ID&hBL zcYV8diU@x}m3N*u^FHRy`3CI{UA1b(j>z=E{X`>1hT5N8 zcPd`(0&O=}8hu1v;Bg zmw-R6@g9xurd39kaT9y zirSg7`OB2-NQ!#P_)eyomwlNeRU<1QGg8!nmZWSxlcc(!*`~A3=%*-}i{4~{>X8); zbHcWZRv;()Dd)LWE3iCQ*oUP!HX+KkoZL-&N4;vpmiLh3S3G4~Wh&14fpoI@Sywn# zWeJ%bZ@7Ww$e5k;lw4eeqB%nWj%c|NNXpA{qgLakn!F+3mrmK9ov?yyvG28PS(3_! zr_1LQ+@qdyL>R^gYUQP0QC6L`mYc}SqoQF4L$)RSrZnd{b<5U<$E7W1^e7>Zoj$0L zu1e6H7z=VlO$G3lG#e&spW|+S-!=B_<&fV=6Zf$Rs5J06*e30 zCaH>2OqEu1!xk%bY<{bIIRIG@-%D2+=W2S}IBUp!p*OB=a{sqkDjD;RUa zdJ^mjx9UZdejv~-FI+r6b9#O5rSEmmKl#q>+o{zwjLwWnMjHle*D~4N`Li!QQra|d z;pE)+X$PMEb41_9^mcv`f*vmp_46x%-&q~MxpH{^>>Gc3A^XIOtIxi_>MslLKmP8i zZ~P-OZGUa#xzk&JeD^!gzwx_2y!yxIU;os)Z7ol&RD0i>d-^N$e>%SA)UP^@kM%C> z?mqq3ws+rJ*mmv*7Z)y79~tR7^Xf~_?L1Q6^`hLh<;w5(1xLJ3{Q1&}M}M?>{+WHZ z-}bGKU~yMLx4^|7CrQr>ajfF65KwAr8y zaoNKB#b=15T4o%-YUllSj)T zz6XYq$M6!!+xDoi-0&?TrG7H8^y4c_4VA7;SNh26O9svq9yvDN3&LE(}D z;BSY|4-&nJn{y0rW(F`U;YRux@O~P{sDLl61E34Q_l93x^o!Pu{|s-aco1m_`_Cq* z@W4k5ba^xbRs|{8vG7eHVbi6fl6U;Hv?j0%%#_ z*REmdR;|-V@o#|27!x#a!Q33|IrvG;4zLQr+AR7290xb`JSZ0{JFs5?Jx&d+Y3Vua z#RxuDVmo#1>nt+EGw}QYjB1ZP9JeYs(`Yt0buH&LO}!TDbEes+I2(EB`dF1?t3#_9 z`}O+RhsSc$ZV7f3EH~{9AhN#2#(r#uK39YDpmYZ8L{!(aeim`t_%W35C1oIE5|t9* zarW!TFh^LUDXfNPJ0k8yR>GaZJ~rU1naHC6CxEu6qhPy_YJbNfJG>LvdYs3weq4?J z*6%62Xbn0D`yQfcz{4Psjbx4E{lvS}M5MfTYnUN`B{<;@=RM7POhvXD7_ol?x=!hJ zmR4(Nt?t6Nok2se=fj4B-EAYIoWFFH<9Yp2r8#dm;6suDGyI>?z+E4bcy5GoT^aZn DmT@Q) literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Globalization.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Globalization.dll new file mode 100644 index 0000000000000000000000000000000000000000..0a9a402bf05a924cc0bca30f0c30e2c24bb38744 GIT binary patch literal 5120 zcmeHLeQZ=!7C&$LLHR0QVn7jJDQb!Aq%4i!x-ByWt1ZP&DTs*NnYo=leIMg}?-fdn zJISsZ{lgDXBmSi^#zdo_G0~WqKtfDR7PFFQLZS(qu-R%f$bT-oiobK;dz~4m2LCgJ zJKS^6*FE=~bI-f?mVs^0QUeh+qMtoW^dUxW-5UNjs6gC$^+&Dr{>-Co9~%8f+lI$1 z-z+Pyq=aJ@gzI{NnU|&tUDI;S>|oAxyrN9cojYq~YKzp_N^O8 zGdep|)4Jh(T1nf3q89ChkZmnQuW8*x>uN}iHgaCk*tZll(I%7VB-SvPS<|`@f2D^0 zHFRC>u60H{n|&GYN_VE$cCKA>GtX!u8?XbuwLePqJjO$e=K^K9C7(5ho1(pJ-<+eZ zzh^TuHgqJbD}^o9QNc+-Rn~8XnNF&0x;=8gJIPt?@xXwiQ|A*k{r}%Af^+ z&9oG77OeuDPir*1S;HO;`!u{q!+SLp8m8g*AxhIC`V{a=ngnd8(}34&xK_hkX||E3 z3|$L&Hw^;j$N{_$u(1;5kv}2!Y&kuQp|-#m>ym?rOa`JETcR}h@P-aZ1&8}6zUBP)Iy}pX^Xp-hf z=Y~dyWCU_r;1>BOnJL}1A6Q|(Ncpho3^g#3WF98 zc&=v_`vBKRuWtId@zl@J3k3(0ZqfLc8Y(&fVg`mRx&f<#6zo`d zQ%cx$X_P#zv{Juwh9MQ;`j86>pyz>#+QG&&d^O-x04)pr(lnN4X`N0=eqEFY&X4HD zn45t;2S16~0ahVco4^==Kc6j&M*Cc;T@vdI@e%AUthKtsqO|b1Dk`UenHCd?L*Q9>9 zDoyIgs$7L3#u8RHUd)}{BSew}l7>D)cK1%H_s)B}4yY&fV*8`qBF%sq{hz_gn=aD$E`{}*8TbXPbfCik literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.Primitives.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.Primitives.dll new file mode 100644 index 0000000000000000000000000000000000000000..8c89ff45e8a34dea0e6e69fc235cd0654e964628 GIT binary patch literal 4608 zcmeHKeTWrR6hE_Hu3xLGDO#(It;$L|?B*hgTKn-dw|3oa-@2L~>Abgh-;T`3V`kpE z8=(&>%7_%LK>sMA`bWW{f}{u(79qkvGKz!(6T>Y86M|4N`<**8@4emCJ`ln`yz4#p zoO{nb=XcIM_ua8=(>^LDq7w9*H;Im8hOoK(Hp`3~@t}O(oi{xt^PZB(XJsVf_i{ z1+4+-HCLDp6d5aRM`v3yZj51TAZm*EXdFUZ+!$LCl~RXF^j;~E!jlE<_XR}R0{M1q zQ~b#$CEU$e`s=k?ZE5Y&y5+p1luXbpj92d>x`eR`IIH8nYuG7|HOg@Yd<@m=<1`5j zhfw{*`j!~RD#)+!-X_yYK<0++%DDT8_ONhGSxPel?ChIkm>72ExwCDe9))>M=2`k! zDWf$C(^@*LOrdYER7Np)Dx{o)8(QMEO zvD{Yw4 zaHlZ!0m&7tN1!`g#Gmx@8>5A0Cq3vIslHn-S!vxK%of@OZtu*&BqKqWjmg4B)w=V^r;1b3O6p?ej_Qo z@Q833`RF`(b~&WE-7W361{0_!VMktNdgu5bukAkCx%TxL*E2gRFP@?jRZ+@|RZ>d9 zR93QBQU2+3Te@f0pWBl?O!HBpS)w-xHxL(_<<59x9hWWNt8rgn+c0$O>~HUCFCLk4 z?8f9@hHvb+wD;xf#r@_Btq1qd{bpJ<+b07un!;eo$>+KrIjGHb#x)=Md|I3*7o(0S@=@Ly9u1i>@yC@n8-7~hBPBiX zX{B*KeA+3X@S#&fNqm{9VI?u<46v&OdDb!GL)(#2VGC?9{`SxgR}SNk^2`!f#GTec zK8_$?TrUn{%K))okgdX+i0Y9~Rz>7o`zh?uK?P=l8^U*jYt#*GWxz4sdU=i`{fs`% z(P#On+|vkq9&A{+9VRl&`5ajV(Y`ua2b{%w?XJmy8vLK}!m_&t(LEslV+Q^Lu%~fm literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.FileSystem.dll new file mode 100644 index 0000000000000000000000000000000000000000..19738baf033ee8d26bc978da591a7c62c2222422 GIT binary patch literal 4608 zcmeHKYit!&5T5OuH^?KPfLn{uMqCSRcm&XvUXW@_Yi}uty!PIn-mcll&Dp($8iGyK zDExr{n&>YRW1?u#7^B2T0tuof5Cc&Y5>3!ZtcHjr{sDvd&Dq`FTR$KLtDSbBHFiONG-%ZbX)Udz|B(#uHG z(bJ~udV!u2y3Dz{e%qL6AgUg6!h#645RC>| z0ln$5>}F6ZKv+}fjN%5TKquN_NMEMGsn{Aolwpj-D1Zh; zZ%AQ#P~=!?3kLgA=f)gC1JUxBj^}lpR{+OWM5WZO6D`6X8Vd{Hx!FVm1^i!;%aac+ z*CK0?`!hXCFbo!2bl`GMWZFl4^j* z(>#S2E8M7Xv%-%k{HVgF!Up0#Oa@J)&w=ltLEtL70DOt zJ{z{y5qSyib`D!RIgI--;%I5B*PXM){gmwY1K}9WZIl$IO!p?tz$C{{d(yU2lr($9 zO3N0jOt;$>#3Us|DwoNaDO)rK=%`dK5Y*`V!b#cvomOx?G23+s>06$AtxdDr<4MO1 zuxQ$Usg)3ZT3T7wy4FQP^q4t2XtXWU&#yLlPS&!O;|^h)+Z0u>9tYhnk&ASYH;fmW zyllU;GQHPbay z9$TdO@KKrCR3?-;=P&f5N~zd{C86%ge#IF~#;y{UnQ=Wou+n}kiefjygbA4xvd>Bj zKPoj|8t4|VtyWrkzSk2NYc02KzQNrQc80G42!n!Iyt``b2d~VX?A-N9)2^vwzQ1^1 zEglbD(<+K}(n>*0n857Viua$`&^4|8%+7(AX%y{qULNz);N{29?SA(6;y(MSmKXQVd}qmzFP;ACnz%?B1VC&;2l1dHB`ygBQ9tw2a<&Tzu5OZf- z`g&Qg(YyETg&mvT8h7-CWwWR6x~)k})t$rp>RZ>J+E<}Px8+QZrn6|uT4`oid+v&D zX`!mp*(<%Rz6L#xo@kmzldjhQM7L`+xz%$$y<7C*V#zwf4fKGUfvPpCQcEa`1J|fM(C)hH2pxLV{=jv&CqCSb-G6HGNt9^d|ertxuDmRc-4dLRVdz z)Dqp19AXdCI#bs|e3ynRo0~kDuLh_5C%V33|H=kkE^!{&Hh!asi3A_bJd48 zItn!~JUm<}0RDDZ*FbcfKO`eKUR)2V3pdhc;1$#Xsu^EetHCz|uMEGs=;M;}e}p#_ z9wG(d{6GO0Hftonl)%v7)g%c&7QQJ2e7e*_o>H2n?zv8^nvnWfHz|Og2QGxSOXeb0 z4KW4KvLMe~$5VyUsipW=Pbtv+5j7dMP4MU7Ctw|57lOBb%mE}0ZfZWQG32#yjbmuR zhf3@ttK#fOR&c?=nxR!i>!D4$A?d@gA;}Kyr>lKfAMYR)Pn?MabbU&zb7i5GKX+ja ze-~dZUM1R4^j+{N;Wh889%ri^8XUtk=yMhL{1UT?i1R19*}V;%*T#>bOZjYpzl`$6 z8P6ieT(J!GVkf+faMBuNDeMN0FNZkwg8Z3~1km=>3E1y?<+m;J!`0_l1*=!`Gw4e%;tPjlJ_(D6DJTKiri%`hj~j0}B&aKoWK|_b~UAjC|!lafj5a`V8Oa z>MC7bqeaT55&nGmaL~;*vdOs{UftMko~kcr>=yiQGoXk6Gj3b>zdhltgWVtle*zf{ Bc5MIv literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.IO.dll new file mode 100644 index 0000000000000000000000000000000000000000..328b62142def8fce2f97d61e5355c7cfaaba012e GIT binary patch literal 4608 zcmeHKdx#ZP82@HpuCH}14K*KQYqgeL)^-U+t$kcK*LGdqyRJPnoqO-uyJPdXoSD0N z3v{6u7NKNC8bXkQ7+6FP2?_&=qWYttKqye?u|-h+6J@0RzB4oTvAgw$|5VVqJKs6q z^ZdT=oH=v0=iUQUNkmn6E?*`(g`QihqJK|Dpsri=b{)Mw`IE(`wC+z9_Yaw#o|SG! z8n&J?9LM$bq|jx~(M?B>_a=1PO^ev{=~I@3p*OB2>eedh$gyolquI{Ub^27TiD(KW zHGy=n5xtJ56%SFp8dn6kS-|*J8v%u!TP3wV%BK8R>_e7CXtNNvmj|sxA8;YYwjD&% zAp7-3qWNQWf5+=YwI%vm@aszWm@jtw;4Lr0qujBPIM_4cimz z+qKY}u?)AwnqtjO&C6G^M>ScXKCm_HAv%Zt4387OG@Xpc7Duat6dN`t=s3olLc^V# zyW;3ifzJY1L%ZcB*%%G(+N4=T`NDjhAqJqZIc${S3~d9LlrgD ztTA0cLlraV1(?;)a(Z5?p(hnRuIN0CCEu#?WkrRe>p(eX5Rr4AOvwt3W`fqxT+k`B z6to^OnXXi{P0=nzHz|6LqK2X|;66<;x|%)&y_QBn8|VV)&5AZFx(buVsDrKry^G?Y z2}*+A2U<14b&N0(EmRw<@Rk7Y?64N)vd01!(qTcg2-s2dklS3w?bJ$j=gYW{%D6Yd zO)f+^QKrk6aZib&ln~;9UcfM&Xf^u8pe0gV3hL@zyE`RR zS*XhyHY_t8H+-WgIwEPP%t6n5HNMj{~Yt7-=CXP(};@_v0uJ*>=-0 zWIoaW+??0uVcaJ?Y=mH^6FswM`et)|yzPxcJD0@UDLV7@QWww%95eCAF1^x~E?C(r);QtXivGfw_7 z{rk~BcK*2k@!u94qEi!`zuT&J*x{iww*PlFw!$HfKb zbYbri&C_Uh4~nIy#W234Sz9>1?(;sRMvWSj3Kh3qNAEVAOwPy%9j~V}JYV7s$w@)9 zK%+U0sipdWAx%_WS58LGA95wWZPQRB{utt?0Q`H%m}>&94(|kvaDc};kH)v??ht6U zcepZcSv>~cMs*?zpq#pDJ`LJ`r1?|#3vqQ7kL_{wQ1eC^$6@PHO5xAKs+iwIIGS)gYK0sJ;49%>^l1U&rozK> z)xn;t%K1q229OnzkDnuk3@rS3)#t*u8-5w(#g)pUHeBfp4Iv^9RUluAtbLHM3svJ9m9G~2 bEiYLsuFVxUJ@}t-XvGyr_}}qAT!B9USG0*X literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Linq.Expressions.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Linq.Expressions.dll new file mode 100644 index 0000000000000000000000000000000000000000..3abe599c5dc0590fc729159e5b5ac46a3f9bf6a4 GIT binary patch literal 6656 zcmeHLe~cVe9skbV-t|h`YfGiH($*;R1^Pb3`kWBL_`f$F?fmpP{sQBzBhaO z-rZI0A0~$IHuIhL{rSGX-psxky!~NnC889r3m1r}nX4L#JXF9p4XPyCCea=G(4sXLk?Vm7pZjOO{-=Au+vYfGBUZ(%H@5 z|3_oB*Xe3|k=0GK43rKw212s)2e>N_lrupKrg?=v?h zQXlN@mJ^~aGe#s!fia@Rm~DXE8jbuPr}m8NQnUm3&6-j=7LzgXN0$PCCw)u&1}2A1 zG?osdun0{0)`v+uuFG+0qYq)EL*WGwWM63v7u#BeOB;Pe+ci{9W5mUSeQTjM+G7)q zbP`!i)W$c{L{l1mvFY~VPj9ypZT4lNH{G4y+`YNyde&$o4=~?G)O85GhI_{X%!lL9 z^~(`UoP-jWp=<9joyMF?)^*d~To(72fltA)uI*k>0L}wpS_?iv^Z+C0t-YDP5IPPx(Ca*(+PT`wVkfC81_o|goL4lUy^WI z%DfB+!=w_)u`i_Flts${+i5l6WwZ%!8TCkby@dS|<|MpD!rLTtBuvBSla!_v^i#mA z=p0}dO#^;J!p#zHrA{kN8QKK66Op88n5uxE1x!tG9#xbK*U^KBi!<98SI`zYHEBl@ zwk_{3wmz6zh?&Cnwdh!@fdvM3m!bE9!Mn}iJ)6>P{xado#c3M7eyy4UUWIOHV!wgg zO|0ACRSdmj25;2hJ!$YBHF$R$yqyO2wz2w+hTbVd@~nYvFeJwe-jfFJuz~&AkVIQ) zvH#5QrOlB1u_5^v1N&8isoGwR{%BVEJ_GxtQKO$5)$BJUR~V984aqMXbw6(K4jb4L zhLsN+yd8#>Hw@m7487l3dPD~dKc@}79>eCeq4%1BJ!0s6)zCX+U@Zo=(!joE__E8e z`8PxIX#+cBU?&W0A1%=8*J)rQ24)%9H7TV>xm#)?tUCoyjP+1%cUTgkDCx9;$!aK~ z$PIi5Y#R(pHBa0~m8ckmo?D=sf;ec3>~#H-W^%4U8Wfd+2)9EHkN%N*RZvq~qQmtl z7L{}+2n7uvbmQW9#)$-FMWI$Mv!DGjUK@p4ET}(KbVz)Umz3W8l1hP*szd)O1Mf z_e7CXk1AIRftL-6wTkfJ_x?aHJmvbsvgDvcCtN%ak_|nBri*b9YTI_yja;TAD`j1$ z><3Zo7NZ6!$tN~7?+p~F=H+xLn-r}-6m?ha6NV;d;ati3QJH)}&Ey0I%1Y1YfI%OJooPB-+Ji& zzqd|!_vIfuvhLZfZ$AFY*;h}!_V`PmSh2q4;YH!Lccvb>=k#w6E_>)F3l8qybnfGw zNB-3I*6+`)Kl!b<&rO%^$S*#6>N}5Zyt8oKadF++^S`(uzBBmfAEpm|?&+nczjDL1 zYrc4SMy#?cCy(|H-u}|j4l6lDuVZgUT2|f~I@Mi)KQLJo@|89+9tH;^3v%o|4!Ray zd9f`>AGGL-!N3pfl9<4mv&#F;j)hYp+GtUiWMO|-0^iO%e!1q9g^g!R=tOad_goFH zb6RWBs*S}>Ha}Q{T4YNlr-r9}h*RKVq>PV^_(^yEpFr{nVaBELOv<{Z~s%B&aqkKQ1?%1m}<&|fLj)q z1*;B)u;b#Jf`Cn*_ER8*Hpp}C2)GWY5%>xC4R7c9v>?jcB<0X zIx^!(o9ySH^f*8}l%P9-%LAo4v!*TAVtM3W`qaoqR<2c)u~i|}jQvu5?8c+Rn#s*5 z?1nQju#dfnuY2ZVKh{8=tHF5)ad+T#Gpb8lKaI#e{J4`=!)_in%hDoezlwZw^~yAk z)$sVCBEGcPNoR1(HTY_4d2~RDAsxsl*#9x<@9xA7cLMv{$RlH1;Y+P;)9-P-3@q9M z`vGF9!NXX~hF;@FKXI4Zh?IM`3=IcRfTB8_dzyPJOl;LKWB+<(oy>J+S8H~ywn&|R t*o$DJg6{T^QO=)PW!CG_YRq|if4oOBV5@J&#~KgZ_efaphw-9icC zCSnZ!fq)p{hcPk!!2}E;N=!^3Ax0AUA&CYOOfZpH4G~FvL=570=I*lF76?BLaklf# zoHOT~Ip@r|b8p+%@27GiszASeo9GlqZefM@ha8q`AOEbDPL4c3^OP1lKeMaX^z@8$ z)6%f@q~SQOuP1~qvyN^$dZZ(++ipsP#*7&?D{p#DD^W}ty4j*I92!M{xvF828Of{XTCnP`Y*@k?m1F@=!+70pqIvLfB6?lim!^~USR#!0IK;ZOaf)EV zM_0FUZ8UkjPy{9qF#Wg{@ zs#Q@=;a0k!jipM6Rncxb2L45bzbi~@%xP2@Q+Pu04*}U$GXwV2Xe50F`{RLCG!;0C z<^so2gTf^Wn-xYCzM$|Wg@(cq{60+~nn34(kI?|Ij&1;-R@kU;DV1p<_(&C)LJ6z3u^W}VJEEqF4Mmo zyUnyjw~(IcI>U9M&K6hNhL1(Vx~Eh`cu8qySZcV5h}dFeEx*|^4X?P`;@TP0QieN) zW$aM1lJ$bqYa}91`bEXULW`T}mu9;6u1j{taQcfnoms~>ZNYnDpM+_de#vS+e=*b9 z7D`!GA)lRMizSjAQ-Q-06iVWt3Y>^(q#f7u&7@ag<@dsIaDYO_h3qqv!pk2GP8Meg zlH0=6yq&+b{n`4)tmC`R?WuW{Ds)Y&F4sw`#AN(5oS)eRKKDcSkNPoG`O&|7f}FuiT;6&VIjr+`cbHZ10#mu%Pz9&z0AH7?^qb!|MY# zQX6752hV(Tc+SSeyrW{?^qb!<_cyxpuin_b>G;^Q?<}7^?X5>z#1!2=eXyy0{e^?o zn!4Tb5VAL2Ws}!QBeU9dT6ZLcs*bK+>2CKl$g%gh^fVe>l76B`HJa4!I$}9E%lUT}v;N?@&a>gI@NNrMHsdCUSXR4XI>CJ*gsN*^ zz5OI?4Bck9!H1rssU%Dx$_)-Rc%!2-hVfaBza3r-6YVPbe%e*u1a3FpNSlGJ)QMRX zUs|g{M}cj@R~LO=as8j*O^t_DwP1XP`d0-yYkFM38tXihi-wBxno;bHd!9uM{4gv z)Dg&flvFWfAXSX}^M2zX&)Ma;Bt`??6}`XvJ|RS6 z;l~v)75Xvgrj;gVErUF9*3;ArtGL1t!CXWioGAN}g-?1(UJP)2NW02gsG#Q9ua3MO zK0)@YkQb)-WbSn)MgMy7ve0M^?6~kb3s3x#=t|F~aNb-+IwIoQN<+f{3UGo749)(~+%Hx-&9LXehK=g8kU7rN;8SD0hLSVm{5){egZ~+-7d^1X K|AG%u2L1)&@=WRg literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Extensions.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Extensions.dll new file mode 100644 index 0000000000000000000000000000000000000000..cd88bb393534b8edb0b2b04f8e2f185c92974dfc GIT binary patch literal 4608 zcmeHKYitx%6h6}zrIb=c2x!5n<<*FjVjCjiVINzd+S1yVf;@!T?d^8RJT^14rS%8a zh%u-M2x(2onjRJ2+&qEad61h`qj_$3X3L(h~;wa>9B|7H5rkX4|U;J1~9TB6>x6IP^X z2T?J^1nkN}-M{J8G<0cQi1E6tb($~weT>f+fMHI?nZk{cB$a4~=6Y@nBZ;jR0^1j% zWl=5AYpyUI7&2DcfyTaM+~`wOOH?1qVLybpm>63Q2h9?PbRnz=M}q&M$j(?&WaA-HSD;@7KJziK8A`79aIc~ zL#SB0p(%pC4C6h#w%&B27&BqHGU;xjy*#+0RMV^gJMYagOi4ACxpA!%ZBkg~WPVC- zDFsxiFrPs$E7NEgQw6k$2B3LH@;4+eRakRY%D+p#Me^0)>?`odu}`KK;eR@K0nGs~ zqDt^mS}OT+$?GI zO(RMX5lzP9dejtkJ`OUP^aa&X|j79*V27V>gElt zBEpNgMuM#-x`>D#J!$%NrlEV8*#^f-7^ZaGE=;{&N?G$E=r$K2#{A5}aH7FU47f(T z_qtP7LbnGpYub~xZ&-rD5OH2kdDCfgToj~){(dLn_^r;Y*77nas8dQ1`HptQz* zU)Y=>PwO_#i3X&_e8&y-5krsLj^`UOFI1%vXhGP*?GSFC5ffhOz_2Th62qHqO$|xU zcdT?+8BmmRpFx~8Cku+sfBeq5^#fIn?|swr$Eii1e?fVwq7>$;q~t@GKAndpg&#e& zwQEkz$lk#tG#?c@Nc0Mp7vRC>aeGJIQZ8G5t|onZW#jO%Gnd}f_8gsd?CR8CN3ZU@ zuoCklty!*-brwzZhYGK(6 zcQuIFsx@@5re*W#gM~`!Hk!w1I&)@iboIn~$8PM830a7py{@y%Q((vFiOLl!yJ>dm z9))JMIJTp9i$1)-6PB=j)fc*jH={xoath~XIkwuY+wr6x7b>0)SND7uC7N^v(OiXQ zFOF5JUAk*HNl%rF^rYYGxOk-&BX9f;#!q6pjo7&BiH@i4B8K=i%PLC~X(-E%XnTX> zMohCsH|*e@B!qlmc-^%H@G*Xyi4N~*QW;QWvSv@X>Vq2{1vEG|Rk%_>{Oz!*7Nv&g zG^FCZ8i-xEk+y?3Qahw3d}*!6xCwks@YO}1cy_@)r>X;Tk5(rCWC=Q=T~L+fE)Cm(hWMge`0XW~OZ0VW?-2K4dkcv>fIswn)` zP!uxWNi-L08{p5vPhho=T?pO=(EHF>xT)LG_egB9^zIrm(Jw6+SAa-<_E0lETtc4- ziF*K9(xrdK+#=CCDCchY?L#x6Nu>8zrB}8mpk#buW+JflC??}fq>-@C|AMy)ufoh8 zUD(4-N5sBskb$anV@&0+=TqYRxaf66kcseCv1rJLi62uJzP1!(Qs6Y%JD*SjXTm2O zr(W!gw<(2Gk? zp*HO0AhIOT`dL}Zu7j}txT;k|&9xrK3LRWP6Fd?83~)`lDPKuQjI~Cd-`IV|pW^s4 td|0ljgFg>GES#x{>~b#0p8oiCoWnbGn`S@_{%0IncAMh61M7dyz(4m?b4CCF literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Primitives.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.Primitives.dll new file mode 100644 index 0000000000000000000000000000000000000000..1b319d3cddc3afcd86398a05e1102891f3fa5969 GIT binary patch literal 5120 zcmeHLU2IfE6h62ALTSMY0W5fH0gFF3#WqIcU)$XlDy^;EQv3no?smGpdVkircU$U% zG!bL)K@6ygJfI2j0aP%?s4<#=K@%T*&_p9f6HPQ$W1=KJXpQ1`=I(aywuKmt2@lM2 z&zy7S%$aY_ocSre_dZ3XL{x_F>{+6>P;+Th^!#KJ%{5oNT|=*5@=?QETF*xfgQJ$O zXQY>wrlY4!*YyHDDRh~2b<5S`eF@$1hJ~?c(SkKO*ZrMDJz6Pku6g-%ezdRYN`0Z$ zOtb)+s!-e2gj&bfhL32m;!8r@tYG}AOoBqsrIgwpV^jWDsB0CEq{4{d6$Ioyy`(TR2%(w8Yn3R@eP z3VaMGQrdvtkizz0sG4@7k$qi?FH+iwIwGQCn>em0jID&qsb2@~N+OMwk#aZYKN*qF z#daj_=+JV#8OvC!(QLFdw`{nHdz6z6+5~Kkj}SeL`b*{$fwbJT&lZ{Ta4j3RBq#vS zOV_w@OLrXg9>{wDtg*xPl5C8E?poz#M0;77)>>#;h@HpgIV{Y5%=4#GfgaMB=U{$8 zpKBGgQDeG+-q&iC%L?kGL(n|0=sSuU8f&H%U#Iv9#cu;;U!g~y`z7=${4W8mpcSAC zXg%m+_-A^PqV0-yD|(lr_b6&AY5?~MGN_I|1ihT5KpW`{=rxMAD0(y1X$Hl}0NqSm zK@*e(y$`f(valx@*=pL4P(>4bsY*FCk(tSnJ?jordVA%5TO#% zbcY8gGR(6|v2l^irqgE97VQC2GnowpwfnwslJ>-)70jpZvTQLVq;Gld+&jC>Ct(coQ&yC6#5Kg-N14LkBM=TmTd)*)_ybfAU1KrdRS0m!ViRF42Th1qMl#z!!y(JsaFJ}UR1$3FsHrS$=DI)M&Sx+rTR_W zbRrNk($qO7+(JBkLhzAhkysUw&lezynYInEhz~nL^yahgL^##91u0#*cE?ciaQsNm zlULVtA9;n!bWN)&)k!M{vt$X2HC1muylrSj>(_fHU!XNO2_|v=qHhIG1(pXA?Hl-b z;Pb2U{V?_C13&G1{EyNx`_Z1~_OE{J=I;-l{`AX}Umg79 zhPsB5rxwavexH11_o;8j7w`L^a=dT-)b%y{e=Ps$+o^^VFaA7rW_Vjq^?{QwJ=e57 zdF@eg?W*a|ZVk43*L`>9k^7I=o_hAyb@fkN8WYQP=fr{5-g`eeP^IN={nda* zX=d*9+|FGop|;21sPx8t4R(y4s6nIp^W_}TN{yEGdakDri!of383&Qo17SM2jWlXh zO~@a|bM+q6O=r!t(6MW!=?4-UCo2WfDvg#mrPk|1rbI^iy6R+RkvtMtS2g0scO8BT z(*;DrJFft!K6mG{<_6|<=H{0C+aPS&5%Xl+wtG#>4bM>_)L!P+vuojF_AqlDUesLR z5zy2kE}!$%3tx0d?8)K@XiDU_=0fgJ3u>W09-d-+IK?k2JH%8 z-SlqR&wqt)r+nwIzCGuNrErtyJrl*jYVc~3gdYoUN&%lPjgY5|)~I*RAX-gmeYBet zz|MmdmRHMc{L!NUQvfRq`t&@WHYuBC%Kus^2_9!9twP@z{5kju^bRlz!P^At02&7` zwE@&43R`Msbc6cUcn-#7L}Rc~&tB@m!!_?Sqi|0kN~ZG9n0pm^58G@QeYl?uO=f0% zU5(531eA;~ADOrsBc;a8%phT({{?R|j_AS|Ll{G1CWRQcA_C1bA7g5OJ+BhSN1`?{ zgTf5|Efxduu<_$Egx9u)ND8bbd*>C(U`=?1(=>{aaoSS~uW>z>J&ZRC+H%oa<@y zFhK=0;f~-vz&R;%zOvvLYpYs6&c?zxvsZEU8s4b-w8Nhd9}d>kMszur#j8KNAII=w Xxj-YJhyQ1=>Bb8b-$hveYXtrV@!r89 literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Reflection.dll new file mode 100644 index 0000000000000000000000000000000000000000..49d7afe51ab9a9d8cbaae44fae6299285b01af15 GIT binary patch literal 5632 zcmeHLeQX>@6@Tlq9p}qQS`sDDhD{wHCgJ1|3sLG4pYLpHI48z-+%#=y=I+Mlt#)@# zvwMyYiRMs1s0Gogp;U>GsDzMEh(d)xttyaGDNrF41eHLlfD)vlx~NhciGLa>;rC|u zKGsg5h<}jMInSGUAM?KE&F-uxjyy^!BI-oHc8%y6jNFC|{P&;^cJKS2?WG^BzO>^R zD}QOn%)ArW6|Krzcy>|vz6$Mvv~|_D9pBC!oVGnxlIiv9*X)c{PmU7htrWRGJAATX z?K0hFueAn<)`8L!QO|xDqm4d{PPEa?J0icC!2X+72Lzp4iiW?;qWsqyW0Xl~hoSc% zPljQtse}n}I~KVy1i4!pw0APvP1lWd5AeI%)}=$a7y^H44FGs1*4S@grrAWt(mK#Z zV8*v$OuEr~(c9WEyiaTCDhP7Q=omWddJlSA8zvfQL(TMSoL4mVt%JH~(k60O6Io1b zYd`5Hs<+{9HyxS&^oSL&W?vQt(*x;!1N-*g&MUge1sqNh^*u;*4&xwl-Zvd;$1evg zad}m=mwkt(>1E7$>-s)*Xgr7UZ@?GfSl@`N3M`CaT0E~Cm^V-w_)Eh*56HSA zjU4-GnoC)<39y^C0j{Bbz>T!mz}pSX7&va=XAQi^Kw)4SeqW$8-Aum#d><_V_Q9Jp z?KW_qfp<`km8LB90e%LjC{5G!0N}lVopsJ*!zZHc#!Do-**1d~HQNlkJ6^K7FpIIy z2s13|M^3m^9kN!Lg(WN$^8l5?-RVCgqBnS+ZJcuHp$+QSa&HA z(a{7io4~vTb|7Kl`ItvT6RK2o$1Fx@N2C#Q&m57Jjpg; zr{K6w*v6f%1)=oPai$SNy5zbvB?DE}MVVJc;~T9Iqj7&hxK0TP45iL$2hb6ti$!TN z0S#vBppbVduSBWE%XkH+TvgRzLWITn7JWwOvJ9a(wz{0N9G?`p8Avv-5Mzrw=18~1 zn@3S`L{s5Ab211Up&25_=gtavj-oLX_BLMX6{I%PrX7Q!_<~SlTU5jyT|g;Da#~fS z4r>M(Uv>&X0wgm$T_0ys~~iW zL4y=;b~>sssi&o0aEdaB&jwzMFab1D%2omzar_b(W3IqkbKDQL3Mx2t*t*e095X%} z!SX}R=d+a2<*J9^mor&yi`l9Kb8K-@X;iU!CcW~-?|tD{NAAshYyZIJ(cND^L7lc` z^`vaFx-i+aiP7Gkr$2w+?6$$n57nRKmu_dB=o?twjTbiKQ`4Efd}-tN<*MIYz5C+% z7vK0!`b%dwoPTTmt4nV^@Y*9^`Fm=?J()lK*!CaZ@yeMOfBT2${&?nvkKMeZUqjg9YU#Rdij{N@sbH#3Rryk!c znRJHdHqTbJ#{Dzm+@DoC=eiTZ@uT;Tl;+{a+-o0zj^$=nDtwpnKV-l%3EsNmsvq6x zQFHaA^5}la-wua|qx*b=e=aqM=`3!f_XCd76lUZ2(mDWq9B?f9>Y|@^zW&eX?u>_l zY0DFQUP#8qqn literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Resources.ResourceManager.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Resources.ResourceManager.dll new file mode 100644 index 0000000000000000000000000000000000000000..fea5e3f0e9993e56d7656433783a4a1b35388ae2 GIT binary patch literal 4608 zcmeHKYitx%6h6}z1PzjCLZT#^U^MX=t1(d$|A;~S&YhXvrA1?+3I6bI@0oMX zJ?Gr>x^t(g^*gDOh^jEpog+GoCy!I(mKdiTcAv`-%FlK07e;($7iD zHM5rI`O3@)Qx-ha_RQq!wCVaiA~Amam|2nOj^#w{MkOtIbNUDIZeP&V=2)YVs1_Wa z81fnb6SEnUXrjg|Lcf{8{_8Oa2tJQWYJQAG`LFbhNM>P}u)CU(W}* zs~|T$=KY} z8s0!lD<;rGFj+%wbjYZo_cZ)U!!Cn4riP0&d_eOz0 zdix_iT9Wd63XZsi+#u^q$Ij3yQBcxyIz`|YWL5<2mX|A7Inkm}{!Bp$N{UP&m$NcX z8LuS>gqv{&x@>hJ_6pk(-9iSo@0IMtI&EIBFI`Jv(Q-yer7a~K$5x`%_uyDojgW}# zBt?*wcAo8w+$1S_t%9Rk9NP*?tF6A9w;jE8r*Nz-8Y^3mO?OD7DXU6~@j|PgACPvg z?}AHi-tq=YI-Lbi*)HM$U)dQOL6xnh2LdJBL^1D0EM<8}zfANv4i$xZ9g*cgDP;!% zP9=owUJZmy`8H~`!@`qe^D-+KJTYbLE*@$k4KQ$PH4 z$6Hio8b)oUNk%o0Nt2kYt9|4Cd%CAJeX)J;1)7BuGf4Cd;f;VUXSy@pvVe~fpYu^4 zomqSA;HjVYCmua8;o#Zv-w&PL^y7}lf2-_w9%eELHdV*L{0>>wT|IIQHDqIn$rGq*Y8c-J`pkQtMCdt~H|DaRz(SRdLx`Y2{b> zUa>@7ebV0?7?5M{iDnyQ77P7nRii5mnv(K8-|P|nxK#44@RX^9fG!+v)hukUkFUCWEE7OFHwte$Q|Dc_-ViXLtxmINh_oK zkzLF%ZZbA<#P?{pvZ2+NNykZ9wimwtgwUsqSI^Ccjp5sjGM4Bm8t_R$ z$_77o0ZV;arV(+6zb49X4ro2qL$?+7T>J#I6?P%MeeqP_xVWi1@eCkSzz$iBkL0Da zhZc4hkmAvf5180?Uat-yTbAC3*HbzQA1%}aoqkLQoP5y_Q}566M4PmqafXuGhpdh_ z52;c<{tdqy@hUQkIqcT)1Z8_PAtQ~&$-d2oJXekLCGoTnNh#8Q>Qe&waq#2Ojju2R znH9)0@4}VKqgGt`9QDBiyxCBrdB|$mRh*jws%Mtv+X6>H+J|0vpGY0U>c|dv5nGS* z%@lXXKktk3So&}Y8PtJ2eMDG**QzXQ<^2)&CwIMx==m(VP8J!qDBiyqxvc=uX zJ~!!lp1;rVst&K|&041g_5#>&aatT?nRCh&E_K6jJ#6>?xL6r5!~Yr8O&807|M$I^ G8TbR^)}9*x literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.Extensions.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.Extensions.dll new file mode 100644 index 0000000000000000000000000000000000000000..c0956d188753b2cec4c19dcc88ce6ca50357c526 GIT binary patch literal 5120 zcmeHKZ)_Y#6@PR76X$=@CQ*{MW>cqNt7T;qD{54?ob9uTTRS#B$AOa4?A=Yy3%fg~ z***W^LpVeclrOECf@t}IR8^`{DXA(%Dj}gL=!ye!PW#xc=h4 z*Twk7eKT`zXjQZ-Ysa^WP7tWbDo9IL1IrDp++^PJRY}^LH*eUVxSkpz8W%0}qf0w} zQD5yHy4%_)dWkkb(h*A^>PBzj$>Jf}X2zKqHwzfQX*E#DxwTOC8*IvdjXq&ngm(E8 zM3X$o5*=P~!h)ooAliiCFJX6QUG|^!)(UiE-2wh^YMvd*#Rzv1O=@rYsEB5eanZ zHih_WX~7M~L-~h?L^7MP%=g>9_JQ65eTR5L8+o7uz}9t&=q2>9 zb{)-A1!FE<*JqB7<0O%4w9~X;Isjx_Nx`h0rs#K~oz58gGeZvvmb4k#Y3LJ1UIvBZq$nKwdODa9 zv>mja_JD4n9?)&nXXqhA2MrxF^s|P3-cZL-8@SJtO}Ep}LGPet&@Q?Hdat1e41IvM z37dxLUeHHq1~g9^^b4S^HO^xkCDTqig}Blid?(!l`D)q4cnVoY*OR#@ko1H**Tj8a z3}n`?=w3*4W*Tk6T8+*3SNLSkGRiaJ4(x+E_o7Izu#?hUrAhZ%=6k92M3d#Onk;Sl znrI-~+k{$xV;xQLDJ8@3L>~=Is8ZFF57C4Z&5criDU76Vk4=&v7M1qg0*&H4lM70J z`3QQ-$wIYUb_$*xjIeVH)kxA{7)rn3EzP*m^~9sDCugM&T@|dIGZvgw+IJ!-9q)!# zIT;qUTVboUE^_juQ}v=j&vn9vc3Alp*E5c%rROY~QA%G2ja-zf#i%i{t{7I8CGD2y zuB-AZPO#LNGhGcL*O$B|)+xB28>O@pZmFW&AevUypoEvbp5QE|@H zgQifF)z%}6kqkJQp8N&xsxAwf z)f68_CJYVbkQ)uFU|#A7j9rWr?BflRbDeUa!pJR#bx}Qw2cf_Yb~z?VTp2?RPO3r8c9TJtUueV`|IoqzM};a4yH_Tb-t`rfyw z)e@qk#Ujy$!S?OUZs~aKE5~Q|^uP0D?FY0UZ+wmDS^20pviUAlVg z!r8a~_JaMynXP9(-2CU|55IKzsc-(HW#0Sx_;b&6zWTs>&%gca-@oyP=ifSb`@YQ6 z8}+~kweNiO!XFp5J@w|gg~^`fPi=YTFKw6qw7l>9i|;RADIFi*boz~#pX+|CaNiku z-(6RK^I-It`sBM;PJQv*)(hW#@Z)!W`?g`Z+w#w!?w@${tA48z06vNwiukodT%O;goq zTw`M+2a86>h+-@}XB-#Sy041CyM*jGW)5SWFsKz?vl9HyerX5m|}#KAcG5pnOz!&o|D&sE`kX!H({HzND*G1$m} zhac~%J@7pazh&c{y$ZZmDxVG{5v-MogkvZf%#(>9 z-W80wo=@hu+8?FP4eWFH;0pYAp|NfW2#Uba$V$52_5H=W)9nX85 z_nc0ARWV|W{ia^c>#VNY>YCke<_yAL2p>LnyN9fD4x6jZ^ZHV?=G@(CH)#f}_&?X| O{WmH8Td@D94Ezhr46!u; literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.InteropServices.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.InteropServices.dll new file mode 100644 index 0000000000000000000000000000000000000000..35cf183d70162622f8e47d5fd1d3d0139fb93607 GIT binary patch literal 7680 zcmeHMe~cVe9slnAhW-RBDO%bo2jnWaUfYvMp!D{3_u7%&+vRre+Cup;xBG5)xY?P_ z%yU$w$BGPhA6eRxjC6C0z*KIsa}fgRtNh?ZjX`=Mi{FN`HZYtChUBsrYiI=prBg>2DF7U2E;M1$88t;O0th-a|myQW?9 zSmQTXD_(}dsS-UCF5TdcDLn(;3!ra6VuNFrGsDUlm}a6MeR2~MM-p4PHk>=h=J&Gj zVVwKi#Y6O+UZ%O2U+sCLzmG2IW%yLrBmJvr1v2WR7rPGi_R+)L4A1Iecup_FpGo{> z32%|o79jfy7KP`265Z3Epi=<*=nTM_+JrWucCXx4Jl%&(> zDZo$BVZcFp8}K{{w@P>stw|&)O~Zhf(jLGPEdX8t*t5iS3}(r2Jsm{V;|;!s_DiwK zD{$W&qxXcIACbl)THW_VFEcbIXh@;zs8J-F8#ve>QQN!Y)Leg@dbu}FEq2AJjSBVs zp1AA}eFytbLKYgQLf=v}A5f^zD)G8u7iD&;5`DE|mr|%vCHkYZZeRuCY8;%(iFE^! z&n|`X6>11}k>(M_%Z-XmSM06=6~)^fYRcgB3SRSgG)catczH;nY*3Mx5k)qn#JgUR z-OwAi`_Vvr4!0}Rn*O+KT=DWNg_=_AG74ovGs<&7@wpedL=~(lSs(3-%eE-814{IF z71=Kp>JcTvYl_c<3bjn}`DMjRLXmAyWD|<)X@%MVDw_N66xj=k?0!YIPm!Ij#M`E5 zUZBXntH@4PWJV~HjV1f++(f(2MitGw6)&$O;(Khrvj6T;WY;O@#52ksyHcT+;S7oD zvR(0cg|btRDt1j}hhL@G9a3@`QM}A4)P1mvqTjA~xmodIDren0ikF9!vuB$^9Z>RI zrOaWkqPa_n@M(p*P0^fJsCN|Vk4n~mQ=&ho_$(;1eM6CTDf4?;@v;!wkzQVGikvyK zCBSrh*4aWA=bdWH5|>b^oGNEh=TJHVy0EAaRnmvl;(g#+cQWz%|+L&)nlSgYLOS-0W#Z&6**`$4SO*XVEg%IL+})k_KazneoQJieefHK z@}}pZL#Pulss-t(>b&WpvFtet7l6Wz6b4Aj>N?F58qll=FIlxL(&1VdjZl@Q4VMp@ zj-{Bja3)}pDQ#F5Vy7LO_YQMP*`3*a6(QROM|(aZGKOy;SHm)Ewy4JVmNnt{<4((t zF?D+$iq!(T*l zIQJq$`C-NzhtILpg5iqrxBy4Wc%|gQIM$k-6)x#{$2R8};o5Zwl*$f@CwB-)-!N^c z!Crdwb_%Nrn$I}SeV2<90Q8hSXFCgao6Ned(wUHE!P!xWwA|%9|NhX z(Zu$oWW{$}3J&kIWAVCz4qGH+8a3PTaK3wO*86nLv0^R;P9SWSpsOf2L(wYy;qsrn z;gE0e@_9k+qLLlQkTvv3F8D6fuNP)#J>j45Q*BasIQj80s4f8MW2RkA`}^dV-Rrhr z_U``rd6^%++V{Dk<*)phdbC7hpj)FvFOXACVRGfb&%d~L`izm6Zd$sF&c-k2C8BS` zx{rTHgPtszR*Lq)n`S8Za z?s@a@+tt0f<+nb5-yK6&&YXX*IRDHezu)Fx>3rrdZ(o1aPgXs7`?hn}edE-$SgSQ2 zyLBXg`Jr0}65(yydd{ZYbvn1fgkyL5x?Fdi1up?Tc?&>;30nWb2L#b46SM~X>}XXn zk1MEV16yD7`MjW^1Pw|NR(Eqs8}nF(4uRN16)w>m9P zlSW3%uRAU-g_fgoe2auX)bt}Xa2=%#KfFt0<~JGF7(0Hn@7w~()%X&F(>jlhAACO( zLLR#;J$ep&92@3%hyOE9LIzt)w4}NWZuC(8Q;52YkH%ToiF{MsYX2>!ZcKB?N*gRrafU!01qH%}V_S=-XFQQV0 zv}bu<&cH!SRADoZ$CAFl13hIku~lkufTAu1#n~wfL|(593IQ;!Gosi`hi} zM^K63&ck^PLZ4SFsD+LBS+QAun0%6`i-kWP)3|v}prQgR%Mp0BnphuR?Hbh)9p@8j zzX{b0I*D^`A$KiSX9FA`+K!wR`?Y2Mh0qUo4tsCcnJHe457!IvdDQVClAt2uIhb7w z8T+wn#e1UNkKE-NX3o7|gM|SozzKE;?+NZvH}us4#`%uObyVXVyPC(Y<>#eM3jRF! tXkd3(s4&-4?E<#j9P0tD1i$6h1>2%2qbPB8!6sqyZ;I8UkVQwS6qrme#fuWs%N%y}XW@9Mt7cepybZCY)P%T4_ADu)W*x)U4}d zT-{RBx@|kYni8rT*s5Wx$>uiIa=L^zWy-`wk?WR?M2$)j{WSOLckyl)=_z%RQcY9_ z2@k-)5+D^Lfk8A)(&NIoS-|m2$N@vnP(+Eh*p&bBbHuU;unT^hnMe?=9&y5g2s()- zgG|6~UM%}JvpN#Gv@Qd`rC^=ri(Vi6sZt>5WS&vn;3TL-oto>pX>c;O1PHdDh*1Cu zgr~W}bYRG_QYQxcl6hl}AVE|Y)A4)=c`W{6Q9>qgFPvBIC%TOJcc$BX*RV4lTMVHY`4}pU1 zZ4F7xH^ArEzRq+~;2DsnGX625cbU1Rtfbjt?7TNjX;L(p=92Ir+N?0o#r%rSD5X@T zFrG;R%2c`pRVh79X-M9XxL@LF3QLA0{hP!)CEftczCw?j`vgR(&~)HZngcwMs(`1_ z3W?W9Tq|*d#4k$xvc$T?8sZ)#4H10{JeP)nE9oZiGKp78yq3xpjp`A-MlVn+a2sWT zcLEpZ^3McEwt(KoRM_CNqBgo))*q%pD%KDMO20Azv&szJh&Wo;+0VW%jij{=LMT3{!Ln*E1Y@?3xC9uj5*}52bG2*D5Kz zv}$3eHaNHOi_7siTuC)?*5neKb4 ztgLSL<=3WJdd7Ao z16?;}B(LP=Zuv0LynESEJfX#^qLdY>q?CY|KAqX}vM*lS)iI~$;=8$zXc4+DNAx~c zm-530zO}7(1-BwUE91Yvwf*eCg&QAh2Tn{KxIN|9;oGlXJNV9@MLp)5jmHiz_q#{e0pr@?$q)VV)^`AKd$$8JI`FXx&M{Vrk?#^{gQd_&8Qa@sx^3|rfJ9dBV|f- z!z|!v+Q-e_?&{gCj=ixrEo5W0ce~C$Pk~+d>X@g{gZFXP z61K1ULbr&PDpV;|sHWxEYNKvv0zD&Cw7RQ%zKd=PTtPHnp^ByHDz!s*4JYtaxkwNE zZpXzNaxzNBuT=a{%>NgRx^Cz|bhmJn{YtMxG{3J<8OzT65-v=Ji|~?4R8l;q&>hJsTEWM zzO=T2ZvfsDes$5;#n=A|?@qiBB!u&G1zh;xMFLDo3%t()1{VeLu8D^*(yWtg!jH^(UuroNu0I{kCb<`p8 zVeQB)u!K5gyv>mx?gWlEt|N1N!Vh}3`MA4r;VIMt{|<5q5TRdCjlwgI`-!_$MW)=l z8LZHO1tejIb5C=Rxsk5`6vtO1&*|=cMxWN`vsx|J)WV+!9~QdXL`AuNcc1d;bzHYc X@Q_qM4gY66x#}Uw=TRCDRDr(%pqx~X literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Runtime.dll new file mode 100644 index 0000000000000000000000000000000000000000..bc6b42e594277fb39d8fd673e3fab82e23d79391 GIT binary patch literal 12800 zcmeHNeUKc*b??=ENvG4t>5MIbMOFv}WQ#4`=_Eu9Mt8e+(wf`5%kAm}GD4c$ox2+} zJG0Epo^*o9s$d(FqWBChaEyb?AvnYl4wYc+DkmbPP)QkVtO_-s^t-`n}h$dqz{*d#7j-LbT%d)>}e6fjeD0WclvJF|e2a z*4LJczgqIlx+gLt&#bG=I$^dE_%nf3&sHtZ^P}vPoei2^*7351v2wQV*X-P~Wt|ts zqQ{4X7|FDV>0iG5i)6GH#0A-3a-`gzJ@^LX1)6fDr#lhFEwV6QT>WXVLEc3wiH`vqCI3_=|yQ3dxm= z?86a2;bIh7{AjMR-l)kd3$1cN7*v6zZU<1IiEhHrxOTu@xxjXPG$dWcG5kmtOlV#^ zgcvk2)w8iubXz3a#CR5!i-gGFW?ti%|1p#B4)wwEM+P%-Z_;J1KesuzW%HKa%cw(} za8cgYEyVhxm=o^DdQdM%f#c1D)Z*|4HO2M2%i<=~$#v^@?k*OnA8-W4)(^V=6g9?$ zX=Xa!BgCx)-pFhb?^U|f*ffWw@sH|cx(#w-N4w+=!S(u*uXMMIJC;&eYOiZ{GX z?c(9~Q(f(1(-JCA%5rWg)vxTNvM$RnEvEV%C?QxZm(fFWUm_;EGol-1yI6y=Q*1=J zQuNC5GFcADvM9^nmE|?Ev}Bos-X}y(^oV~%d7e0fa=myBsFfRhs#ZrW9a;4CapP=yb;9?Pk0+jQ2X@RT=Nk81FwA?;t}Zpk=8ApIv5-{vFox#V&IWZ>}`ab~e9l z-6ro~tBF3qcpVJ2F)6!Qznd9)OcaeMe}tjGW$W+ej@d3fKdaqDkG7fUk~Y(0cOvGs zkN$zh%cU$P1{nHNCS~p7TDO)$8J3W`DAR63q-Q0(nnm4Xt>)I5#C}kzk!XHVcD&Rq1#!mTZ#Olv*PbC zbdaHY8G4GLhgs&k06cB$GDE+|&~b*o$XieDtI4$BofjSDEPNj5o)m ze3yB%$Ykzh)_sWa*03ymi1Dhd-#3{5?qe-K!ZPNU82Tcc`{$XhON_UV>9U25cL9s6 zpRp0D44qzMz*Fu$)tRejs7ef zoz8@M#r+#jf*R2oQKPFnOhhM2&9hiPI&*3soh~){SH`3Br{>*`6RSo)Vd!L=$?INa zB0ACPepj#=(J5H-{*uk%6dV00)9e;D-e2H!t);YgnCO0n?!{?bxBQ!S6VXXs^Uh_w z;~B+MnSDLZrtQe?DzksP)9m*-hMr)klZ|lGVzb|)j92I}dCxOlrdZ3RtmQ>OI_ocM zGo`F!mgr-nU$x3?`B7$1dUnxvX~Zp+C0>LTCgdrf@bfWJcG<|ryAc-Dnhmqji)=<$ zvVLD)dB_<3m6oA4t;^b06Rlrmq7$p`Gx{BAH__FdCi-fti7IU-dc4I%?MqG6!_dMLxu%@%#qouSgHqo(_COX|=qL)~|t`#P)on^%ib`tMo=bpP+ z&f3Q^-}hIZXK41p)_*c)+tXvBU&XvQLU1Pf_jIlNkm<6EjrS1KGMs81GtkX7~h?*$rFkGy9$Jv__v}XgU0#c^2lN(Q#<4(G6^V$763Q z|2+Ud{C?`cUm_+5DX-kX=Kdr@n_?e9%5c-G9_ZaH2C9+cdsI`D-jvcCQ^X$IIyhlZ z+kx#>?E}4HwCTFmluOlO-mf>TAVEW3vuDv?f zcGdo}1YagDFZs2mYkyem%!~3h<;qa0QY;OL!Zo7+6~{z9toniLOeG{8s$p)Y?b(4-6_dVG6FZwIh7MQl2062Y=&@$(s~oQ; z3Rnacr>?-b6@>P%<+#m25q1ZTY&Bxd`^`vJ*`gGc`G%dxt9p@lZOdymWW5p~$U)ng zAF+ZNdu-}@tg2nM1ujBgMh50he64Uy7=b!obzUNhkjiX;WmvYR?MM-m9AIVutb-_M zR-Qq^cI0hjIa!)Vm1+Y-xlDQj`u`Q&S@=j9byHrYC|Cf;GEt1qU^&LaRF( z#{c2jhkTP!wyVtmTOF<2JSvDOS9eReXLF40MmJZhs#tFrA}F4*U=LYA&8`gxeqA?D z^hF3`Q*>rL%^Et4oN_4$+QtPJH&zEfVDlc32G@nYuNTnV{lpMsjKh<7hW|vFlX;>n_UoBZ$M%CWW@< z3_FMI+F)}UhcHdlddWZ*}UGX_~LZ)t-GxaP2|8TpU?+9d26vbW!ynT63C*cFWi<-vJm{di+hIUYM( zLWuXLT)Z-fW9+h+Hc_x&VM9SWBwtTi)q^6BEk9B@E~OQ$`LXFewtWyeUpgWgL!ThR zoH}UG*}>K9dc*f%dqzzZtGP)-L1zUq=p$8Ho}dsY!%!mDJdw5&|DTLA{1F+u@hL9h z=>=>)NF-b`u+}3dq1wtm&K{*ZlaH)Ff zSTi0T1)OS_kdnlg&c2LyBMy@M!UpmX;WyriP1Zs>2vWW}i6d!Ho(1F}3a;Bf}8H6q9gmGux2seVSf7y4j0CeKD_Bwbm?t{x?%c*eVI7wah$ z>E5Q!t|4tdX>OKCIY8{+KVgRuSEbAt1b(1WtRT-ry>y1^$RUaYw1uGy4%Pxo*Bd&F zmoS(^Oo}&>7|Ay@c>0s425B9Ha^ivteegw3wCZJzdb?vrz}cJVFdnKADP{4_vng~ zpT6R^-~R`z^7iU%{lq=}rM;)_S)7SKp*x?nsVsW$p1^91`tU*g!h_B)hr$fnk@iCL zWW@5=HgS9iac)MOQ}R7OTeIiziClxWoor-Vbs;X!i1m_%NU8f?b_5$y6WJ__To52D zsdo>y5Nk7H^~KeV*-0yK{AQSyom8sDM{D?&tb@LC!=KdRe@!7jdo;9pkMRLwj_O&1 zX;hPM0u^aLUMv(`w`4h`dCsm$e6>=1*MUWk(IKkJ^s5z>X7JMK-*AM z9iRsHj~bM5^@4a(*64}lg;Um#_d6SvNp{#z}7I`+Bcz5WXx6=x+L*HQI^HbDE4O1!$N6;q9T-Hl42x? zWi?SFefp&z_&5u_vCtRWWuF1a3n8P9=yYL0vKRLv_3Jf!NOnrE9qOC$9otjNZz}(f GEb!lLN->uJ literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Algorithms.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Algorithms.dll new file mode 100644 index 0000000000000000000000000000000000000000..2035789f6c8e57a0c78b87a2d2ff40a7197b1b8e GIT binary patch literal 6144 zcmeHLdu$v>8UNO=IB%zEqJ$=4gHy0o_wXylp-s5+ol_e>>vP>wk~VvH=t*9tfk&0?iM2SEu1cmVX=5FtH z9H;O{kN|bg^UZvZ`JOYoJDz;tBsCLJ3;NZoL}xK_i%a;ypaS-WkN$WAy|DU~-DkCl zS9Z@8OkXd0Zr(F&J!?3Q8|WFKdnHFV9X&Oj)@?T@V(Zth*;7+JGeR_>HPbD>UVJyS z_BMS?U#s;(IVkN_>ekya>gaKFq7FH4s`||Y_FuLNAn4qhDgIR!<-f*QLz#qjzK3X< zCvn7HSHgr^J3_P$)9*oUM@aj3M!oL3lx_z;8d(<$#IXSQj`aZG$yjTC1CvcBIui4I zFAGfi7RRIwUB-j4*5dF!<_XJ%Ap1&3&{@}3^hk>n4M$Kp{VU?)#=bRCE6wOczgkPA zF)`A*AXkat*P9NfKRc||RsE7NCVZcOHiwjE7n=PY0gq|MRuNZ zN`}yh&NMO3$^5Byyrqq9Yht)X%eQQ#XW&&Eb!!)z+UPL}&q#Pv6I0%j^Yg|}0|_9&id3f7}w+ZAk$f<0dIv+B!>3a?AS zo>#DOCH5@}?*|I+DJ9oWDUvA#^AyQ<6y8}SyB!MFguFB=c3R>6S<(5v!W&nx2NlT+ ziuG0nGZd^>!A>aHP6hj-f^ASRTfyE^d>O6rXmm1>Ophk|!pYvgewt18hv>l2pqx&o z_J*YXy?4-ElWwkLi35~MCukOZ&NGXaNR6avB$@IJvi+>wCW2ld?g%cRosNokVtbbURw8)k`*o#%w<2$TaD8~|3-UYQ_ z`>~v5g|f3^!4g?cBh`&Za?1|LJv1)LBge7@!^w+-vOIzCm^qyonOTvS@XNL>upzQ5 zvO~RfqYbS%B`Z)H`c`0u+9IZ~2R^{hD7T^c`pabw>V~7Mquxg84XrCKn>C!AYfqKz zjPPn_)AcBp4FGGWD`gsa$Mpj<>l2Q2NUrTH96sL8!b=Np(aeHhJ&3h)?9=Q*wtr~f zP)c~_q8Kg*keD)Tk&~ymuI*p#6@F&T82FMGC^(cV*hn(M0^*uZz>hR@VZjum!m@0` znJHx~xd%f3SF|W!#I!&2+A}}<<6`{FFTMH6&0~-5pcY-z+M9LKS~1zQiO~)1FFtZ; ze*56tCn{%X558t9L|@19Hvaws4iEeI6NkUSR{iqwednKh<4@m?edXDW&s|yn`=u)n zUwq>6zc(*hk4>C@a@X^BzWekWuf6&5Z=Qbjj?KH9POkOt`dj52kDmYS(T*p6zUt_7 z_fr3cC;!lT@tvjJ=f3ma(xu#?iFK!5{{HE%!xbgfq z_kVoH*KSIRZMuE#)ZpX;ubyhxYB!f%?9E)$*86Z2r(6doNytanT)}gX`Wocq*CX|4 z^od&aS4>mn5EFewqb-xJ zLSzi@I#tp`c!i}byg5y$`W6;KJ{_5R^;Uc!E;kd=^#3~5WYF7)Dr$t)8y$ASHFTEa zyW{P;q%!vxrg|$iOv+)yH9l#1fTNz^jijA9E8e^79Qhxvr-_$&eMM$`? z$KDm8i#ZASmL$Dmfv?L6#yu-vdWi0FIko&D^AJXe$R=wUPvRU_&f z>t76+v+(1cx*c{WU^6c*a&?QS4QD8iitztxx{$GMWV^caIEE5p(Ia&*K;imvCFQ>} zs3PN;uIb^O#_@!8V60lr|5RKBycji_fqfUTmJmS@$!2s9h5MOLiH=P0*~w#t0VqJJ zo-p3EyvMzoF5cg~8wX{bRXfY8y}Z^#a!msIeCV)ox-4Xz^Q-O>UN?Z=C-(`Aeb{bX V2K4Ix%C_ylaVkI5^uLpVe*##?)rSB8 literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Primitives.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Security.Cryptography.Primitives.dll new file mode 100644 index 0000000000000000000000000000000000000000..46bac7da3aec6fb1783a701a763322cc4c95363f GIT binary patch literal 5120 zcmeHLTWl278~s3q1(vDH9C-O@#=ZfWh-`u`&;v%81gF>~3RnJrz7 zx{0^oizsT8Cllj~8Z~O7G5>$W1dS&0Ac-a~L?8N~hO^9f z&Ue3@@64PsvSk;w5K$|hBS(ndz|149;E6#U?5^|P?4s9B*}w7)ExUi^MA`E7iu6j- zbo7Ghx?Z5?g)XbEZn=79G^aaWQ5XvscCLy{k8LE%YAv+CYx=#|+h=sXK40r2>I9`D zq@LY_S;v#cL$p|}Q(@dp;P}<31A@+@h0^!4DF18B5y~Wt_bwtDu zlS2BI=N_vw>~8m@V+LTF_8&@RgkO+Wg{6))krCU?svQj4mgzURL!MKyY-M;{*ygla zCHQgBV-giA1P#TQG2~Th(khjY%W^8FTWjcySKYvJ1p9=ayk%QKf}5-PfpCnRC{$6% znh{nUUw}%vW{gS8u>xyK_(svTn|6b8HOCRCa$$B4Q0rr9*Nd7cHfH1t? zm{Ku}i|w{3a2+F0DhjKxak?N>dC4dQo{YsamRWK=Kd=gZOo~!9!ukrC6LQKb2tVqK zsHi7Y;r=NA-FBcvdedL38F5dF$@Ih+THLasXC#?;OB}*9X z>UjN*t&__JKHFJ;npWXN*NGm3Zacq&fRE<}*YGjt_t3l#58t%!#e+XSW8C-Lq8EQ% z_|43(w}1cegFm-S+4p9jdUVArSA4za;76al{pp?qm!GyWwQIgy|5N?(d-i?4WAVf9 z&f77%dgjuuN55_R{)?HFd!PMb=1_5KcERqqpMR?7mVEDXqW9dxA72^V;$8CPp}TK= zY0J3W0 z8eMdvLM7UX=xmM781Yj_2xG(=AoalF)G;rRfI} zN1`eP(YYEe?J2C*CrxR2RbN+1W;G~#5?`YQC?S8o@I!I`UPE1J5+VH z{CF9E??e2yAx~y(d&IQd@bxK#I;YG%asfUCN4ts5oSgra70}d%FFod}7vAV_3hK>i z^UWf>JN_q4v=#52cx-JQz;Y5dlG^|`;%=3rVcfJg10M#wCcJgi|670fExbF$%He!< zWQeiwg6ad1=1VJ=Wr*$=?so0`O2 zfrJNt99;#rm@}rN97Mu#PC=9HWpSB}{Zv#gHB`=2J~@vOm63;IT7(8`*`QQrW71VD zEKfA8VvehoQ637)E63BQ&0OcuhfjbuTiZ$amB_8(Zvff%%|0AwFXVYQxsDREiL4q~ z&ux4LDre)zow^Kuv+!9`9(i{w*caa5uys$WsS%>u@+N*)w)E|nC2kyZJx)P^jJP*%b23hu;-hDMFBAS`Q% zCZf9tdb5kN|I%us(3N%+{DWol^gs>;;P;OM!I)ZSh#QHgHYaWfK5v*t`XoO~h)<8A_&&`T1RJ2vm z4n-eU^if3(MNQBM>4@2PpwsCm(CaB8bZVr@ptmX7qUgQU0!ce92VI6(>XfAIppS!A z01wf1bR2jqfU+vjdt8hMQ9aE-gs{1zWk%^3Eb4OmbC$f1Y(MRKmYJfA4AyiweqcCh zNoKK=#^sYWGLjs_mXwgGTqa|rEZG_$xl*}6QmgMvJ7o>`n!%;SOHE7mNzXT3XY8B~ zXPxWWMu0)X`dh7p^wXZ1Wv#I$5^|l9vw~L3H2l(NyK84nOBwEwmNBGyW#dKA-5$b_ z4oVY?1MO~h*fTQ&mmIRQhBI86)01-o)0XTLep04o24$lU$Y6b{;?W&5>_+etFmQhKkJ-yhXp~w{JZ9{rV}J zM#imQG4IqJwOf9vK7I03!{Oa$PW{%ux^v>zBX7Sx_leYkJ#xVfXTM$?JmKE{!*3g& zd}s2}9gA<7{mQgUG6$dhSE}{X77OKuJ;A>)V)NFg6jVzqBKj;j4s!4wSGB>$0%z{C(r_E*hF&$ zHL4-(n(aDTr{QFB$Px`_#xwlDL)zv%Npypty1D6jTA$&WZqC=#BqJ9LxE`+liHIw| z75E|IS5&#^sil1Qt}@7-+}F4_wiMsr!pNF-*GpJdmti`EyG%-Tj(GI^&9HH?o3REj zOCpqmI->lAW;jcT5cDx}*5hx7RdIYDA>oQ;c2x}BKHTtYK$lPtdL8)ES`NMgbZOzM zi$1D4^CzE}(%oJ#a(`%uxk3tt0yGI!0jmaiuw&wTLBgg(>&R6~bJRQ0i%|noAL9lE z&~w2R%KoZn`78ia04)>p%q1+XQaVjoci|VK6vqIbZ^Ybo*t7A&YXU3$VUna_v;ibG zUcp|pL*R6*-k~(K`$JFs1~Mn98^|(f)n^TL;=`n9H>Pje%D5V#&%4EO z^3WPsMQN3ngGWbPEd03i;d@3Pq7w0C4;=9<_J?;nLj&-RTM4@|578`S5@XH*yH*xw z1CjvRu38n_brk*;p&iZ~wqA@gbDR;EmkZ_V7{J3KkS886^aD*AcuLVK&xv9_a+YgY zIp=-`GYT1|g(rm11m~z1+RCBFcw=fGFZ6TqZeF~X_oz9ou;;^ujniQv!W_>Fvw-I{ dm*oJ*@oKq3BA^xiXWV=D6@up~jQ=$Pe*sICjhX-e literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.Extensions.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.Extensions.dll new file mode 100644 index 0000000000000000000000000000000000000000..86122741377b57cf400f4e28188ba3b4c7740647 GIT binary patch literal 4608 zcmeHKYit!o6h7M*BOV zeY`;lW;2%FTCGZ}sj8`7#xsh^1pNrc%eE2C0>*CCvZ&`6R?20KKI{Q+Ls@53`phnr zJ=)nELHim8Ug5b7rX2^*1=E!=(}{L6b4974nLc)2n|&A`RPJ--a1$L-xX;1-jS34& zs9j;YoGvPpsSGAdXbt_Sl+Xu~el6)zg(ZcO&Xx29DHot@%eTnBkEL_4KNYluW`mBS zO3*1(E$K2z>m_ZL^hrsdl2n&e1MXv_(KPxN^llmiEu%}I_e)wM=?a>uXw*p6pij_x z&?xnRJ`Gwl;Kz|ug^|stCGd+Q8o9KT zFe}qwWezIJ%2qp>HO0e}b`!Q^8gc53t$wJYvAKDKEF$9BR7#JV zqTWNE#Iv5Dde;@{xY-{wyz7Zq8>Z+Ij%(P~=sC^SX4^^Y9tL&uhFTHfCLANfTBA)w z#AZEfdiAEEyF;Umb~DcPO3Ft^T1o z9a+mW(t_8-I&s4^yu49_wq{8fM*_DrpUFjic)Y38GO!yWryA{dJ(1R8_)=-1P;2V* zgvF6{wWMiMpwl5XnvzqIX{!;??!TeWEJt9LbuS!(*& z-rCmnr}maA!RO9+{nu^z|X;wsQ%^uVvsf}4en<|s6y)wXOk zDSB~dWYWU&R8Qz>q6&q|l^sLuoJNSxEKEYfBQF7IN5I>2@EmkCwFL>D1xp6t2#NbW8h68VAG<_ zWJ{%TdC$c#szd5xTqh5DHaNe0T(k|3UImyuXc>^Fu48Gv)TyHIS4(m9@n*vYE4X)U zO5-Om+rugZYyD_FNYc2eV`%%pY4F~n1hkXEN-W_Kp6Ld-czz2WFQMIx#NLlc>2eLm z-6}n>v3e47dr?hDGC2&Yw8{EJJrZLWod|SYU|?S}&>D)xtzxdiCrZi1t_$lpIiDDF zE&Q*_RmN2gecmnh-$ARxiy<#>4UdM%nD}w#&Bi({SR*A@;N8k#e>egupy0Q61tL<3 zIQf~xG06hEnipps5)az8^osq-Nc?Sq9nKuaAI6zE&WKyhg&{xuc(r3a&Yvt0dwJ2y z&xtS}Im=ae&bgn$3>{QJ;-3&c6P%+?U@MCrb&D&x-N@ literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Text.Encoding.dll new file mode 100644 index 0000000000000000000000000000000000000000..e6a5e4e96dcc6dfda33ce461a7a8a6c7adc09c72 GIT binary patch literal 5120 zcmeHLeP~r>7=O;bTvIo-j9F>NX1b9bW)A7o_Hn1JwzhWH%&+v^d*9uiIvCKt-Y;gM!uj=M}+U)`@GNB z`@FyBdEayHd)KvQJCzbq8Ty3_M29ePYnJr#WEAG=n?J0k_pdoV|B%voe16}c;i);- z$-26wrghtPd^IIhH*c$kttPsYs^w&aHhp^4f-rPXJ5i@nO4Tp_b~;+^d%8uPsx%T+ zK~ouMchzH5(VNkUW=Osyz|9KAFWV?6^xR6R`FVEbzwt2?S%sEB+-_!?i53@vup(?5 ziKc2-DaYL7;AC(>XN=|*jbM~J}nRSvhL9&eGZIVi^pB69B6(9sfwW`b7G z9MCFi0G&ZgB)v=07D+oKeMHjLlIoIbzjSMj8XHqqCs5NxD?hduXbnQ5!7; zeTce2lVpLe1uYv5>d21}Bb!GnF~kq}Y^nlC~6i))Yzm zi#!L5Z22PF-Xdvtk!O98^jVQ-GL$4}(y?310v5ElNIFm?97YJ*V26$ zb@P&53E`z(BgbA7LnOq2o;Up#)6l(fYnx-`3{wW~6{bEcxtKiy-Qyy~v_C#EGPF6l z5!c8LPHM7px;-*Jr#El=h9!7StdlZK!;e{$Bc3lTtq(6Xt=&#L89dJ@BpBhg52uC9 zYlUu_DLwrpNsq}4;f#wN3vy`h6**H+3rpC3!4$@v%rqG|En}J#8hXWmDbif|2yzs) z06l_y2?Mf4k%tUqix6_JLa31#!VBWSy>-MFt@(igIYE{w3LR?036p6ty=_o;Lq{#` zJ8qOp!qBs}ltbBL9 z=*pbSd`D%fqEwcuq?Ci1Ig`ce$`77e*FUG}`>msI(gM6;Mu}d<{0cm6EcYf`mhfwb z--}beJh$rD{*%AGr9HQ=X8-x=KaZV%;>@-e|12Fcw{-5_G4H*5e%f>Lt5Zk5-E(5u zwew51Pj&D8WAwFWj{UG{#rZAz; zw;WsT)a`6u&k7aq0ay2Y7ms4z6-09ts;y5qsQtQYIC)Q%lk~hl=(zYQoQ8VwcPBm) z%YTT->r@Pn8QvjS^#b!Ma}!&1*9a^d+8j4wnq9hK2k%}XWZcYv-4 zZr${8*{^>EHx#@iWDCaoV^Z)ih6)S`bOlj$auLVCol+pCO#|derv>t!(+8^#tp~eK zKKvX=K|5Hc0jmN`KD-R*vy()sl0J6E6D%W9uykjMv zs1gbIdRUM1%E4&2mZVZoWF}v2jcOJu5@h; z`I`7}>z6S*5icvFam90}F=v*gL9B$gEi!FDm4eg2`0~K1#_Fd-UwR7lAU5xJ9_aj772^9EogY4xD$WC+)huS{paPoUMDrQu zGv$V{^57U-liZ);buQkei}&bm{4!Cf1@Sz@uyC49RFi90yt~o7CE*Tp&91ipX$92a Re+IAL`9IC?YFd}Az~9O?$MOIG literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.Parallel.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.Parallel.dll new file mode 100644 index 0000000000000000000000000000000000000000..463e74e826be61079f439ba5e76ec4fc44c92f28 GIT binary patch literal 4608 zcmeHKeTWrR6hE`yeyy4*TDs16m24ze??nnzjNo!zUS^*fe}L9xA)w0 z&OP^>-#z!t+}XBG`>BwKiqLP|AUcJSTZ5#3O){7+pZ{Swy*uGtvMnNA!sH!N35?XK@}eVR0yL7#!%PeY(pbPe6SN65 zM*W~qffi-Ly#~lCXd?gyyJxgSGe^oum2yh?MZv*SAXOCPOEV~6D$mZ*iZ-VwZHh<8 z@)C|~8gc5-UEMT=+3Gl{n6LYSq9UG7CiS=}8hspdJPlo==Lsur4s;p*c>YQ?O6m4MZcS&}_6b z8CsX_?eMfPx%4;lT90XlHl1R-DH5Cq(h|PohWe(5--_u_AbedY_ThYnP{v;2p{7rwf9=9|Okm(Hjx*gwf#@oVPb^Jl-^ zIc?u3r90behaM_FaJl%(cSDt@-@H0>t!H!VLPb7xHVDKxXqu^qKX^x@r}vV`rczR)eA8ilIl6pqSrY_(OllW9FER6HE6 z?)fh2GwlkZc?!+0Nz|&{x@$OTPnC=GwBPHvc-u}!>iG4HpM-TMkx^F{eUZJV7~^H; zRp!RF@IDJ>wl+I%)HK_4!w%k2Ldb`MXKyTokI`YqI{aU06q%6OM46kn9o*=sk}-O= z<8Oxz4fsC7^BA_dMG>&wxRJJkuA)wGE%?$}3%Lb!b@0_i9~WKyBe@My>k=aVaM4&t;T zMp8!L(@G(qeA-E%;LE568L35{f=Xh{X<%3L@~lJS!`hL%!V>sk{OwskTse$C%ri^D zY5iOK2=di|cn_}G zoYAK_`Ya!oYZ~FtgAWT&hlvbxK5wpq(d#&mciSD30X6ua@%N>72%ftz{?iQn2^42~ Ay8r+H literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.Tasks.dll new file mode 100644 index 0000000000000000000000000000000000000000..9df009105ab81bda6bd10f6217a286bf86f6f711 GIT binary patch literal 5632 zcmeHLeQX>@6@PnYJI8%fnrcmi4cDfDB<^J z_xAR3F(Q8;p{jG9xAQ*ceedq9M~|MSBoVb?UcE~600|0 z7qpR=w@sE!SFcK^B#nw*Fl^iL^t{leZ|kP54~^yYic=J+wQE;x4^@v36OCv|au%Na zUESIRx?Nwb^%AWCr8A(Ox)WC&a{!a5Tdfm;-%Mct)tCnaokx-ezQCgV*SLl#lQ4Ee z?-(xzi1tNFm=KQXz>O`C+ft|fH&;D!T}gKW|9EU)$`dC&;HOsufTv;&{RXCnPBfj8 zt}Fmkz71f}f!T!_8w2n@C57cckW)s}n5^rAn6WWHG#EqG(&D^gux|-!r*R$iSVg2U zF*d&X5u*7RzT9#!_rRbQ?q*+R`%}HCUA?>d_VA8&vH+`SxSq#|-o*6+a^92kq-mF2 zmiP(k&1L90oTEjoxpY1EAI=Wp`b*%Sfnz;`mXin017T__5a;8JT+w#XhQN2W%`tF# zdGeZ5at9_Vo(SUWpmW;m$qw3_VA!rLCfCtl;Z+CSs(mBTL9T+Q6-*?U@`_qtQgBqk zUO?7qGk_h9R?>?}jn)G~58x`=3D`}23hq%btzcHcLkd2qprK$2J}**=ZlYfRZl)!` z9=Z&8r-Hi_+)Hb<6lG`!;3w!1V2&KXPXV^g2YEy(RqR`7H`2`?OcWP`Vd;@G`SydQ-;rIHqq-%XLujV-*}Bi<`bI)8>5HSGPM z345~1-bB;BZ#7w%h4uZBg-<8;#Nu0M!saQ?JDc3y#@2)J6c0pK{!Nw<@ z6C(70#-&pbu8T(qwg`IA6jm|vVma?9tGvp2h9^diLfNzhf;Par;5RPt7B()6xJK44m6N=O%Ox9-W>GmfmNm<(%K zsUhJOq*>+2TU88+8N;`{v}GD@gUbP!L9!-zdV*I+(2(0KAyvD{lBjZ$S(kzv) z%c@ijyVlq<;oF{B5o{B7@}^~aF>aXG$+8qi5oJ<+QO|ZnO>u{~siI|ttk#0JQYJ*n zbUmqpt81JPGnOcDt|)uZ@ywZ8qiHFdk)~%B46B91=7Sa!#o?0$p|VY5RS{@!Wu;3c zDN5*{hBWKQ70QA;S2oCLz5%8jv)FV4EOTF|>_kdp?JVT=nmM2rd?|(P!KCH8=B$YJ zj~k|>6yH?!^bDCs$#z^M!L5_R@}cv&XN1fNIcwsc3cEeLvs^as0f8ZO4HDy-kU4BS zc^4ak+dm3=cot%5iP!qIZG+}v3@CI=m>b)_Sqc|=kI!6+;!WP zU*G3F?A-l_%a0xV?z;0|zVD7Lr#_Go8}-WKnf}qEubt`C!V~mX_GU7%;fOS<2OT>q z6Efw@xf!6PZ`p5d{Vr==Wa@uhVTcoy(L@YO{>ZF}cm!3h;N zj2gl9V=*jf%#eV~5T*vL21)2K@l7G1)2116l+bo{&Yc9;0M!NGAP;g*ct$7sUfX{7 zs=+4@QYPr7>uB1fWO}Lo>&MxR+wuV2g1s5&tKcWF+k+K?wi>P;C>5O4C#ekG0=A2x z1*RF0IH9ERorRB;x}K`?wT8?XN+$<0syuek7Decp#k4@FMmBY2i{&}f>{C4(Ly&c; zpkk{+suBB*`q+!dM?>!v^h#)M=<7$Mz0qVpHbb7P!FiCl8t}Ri)s5IsA#Mvl9#i;| z(vUHMO0h=HeiixV>Xndb4>CIt@lIqb=nVGJhp&1pj|M0nq#YFn>piCY9SikvC$RQ< z9vR~b-&k$qewXn=&}ba`9Yo{9Lob$%c#Z4*#9gW*QtsUnb{K#Hl%T`8r@6;usLRKS z{p(kCYPNH2wXUtzz4%hqC=GosbX3sY7Bb5DYp!yAUtd^h&fELrJ(2-E_@B`ed*37R KydTC5W#Hc{jgylA literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Threading.dll new file mode 100644 index 0000000000000000000000000000000000000000..e18cc47e1e5efc463fb340cd2979591680e31804 GIT binary patch literal 5632 zcmeHLU2Ggz6+YwjU*g1ZT2iHL8YXstxP+D6Scs-+vAydMH|yGXUAv?|>D}Gy-669x zt2?v)duUezR8mk|CA3oW)CwU%ib7R^s1Qhr6e{JRLKJ~0YNa3*;g+Hj!2<+^@SQue zJ3Dboka$5#uQTV~bME;+XYbs}#Gz*>K}4;1E?*{k6*G@v4gWK!VY~a|Kk23)u6upQ zt48Ma9Wy1%Gb_q1Dp5A`!f{;R%t=#K9n*5m^kmj7y9JrtxN-f?Q1#RpQN~EnYk#`q zYjtbqsn_f>28cF*(iu=s-j3PCGmM9*N3UA~znQ@P>rn#)okxO(p|eN-i{=mwSm*)h zo#gc}%r%sRn>;-lxUmm>+nUJNT$&BnHESpE15H9nUoQE;UtSM@JsoT4H!wX+SWhZX z<$-D6hOubJ(~YNT48!}RlC}#*P8s{GbMP@nqA^S~8ezfeo19k+_N|55Xv!qA*AW>^ zY#Kl9C#p5!AGRFL-aBf9((KE^P;wx-XJF6Zoh;EtHee<})b|*A4f8JKyf5o3%PD%y zalRv{W#9c-dIxJ%kNUoF|9Ben-+(W{vA$8;%`r0uQf71@&ZCT6H1^OhU}$Q1Ov6VsT-5Mw&2t)% zb?N|N)1Y;9d%~d2fbDcM;Cku@?4dyo@6>Qa!*LD2sNt716dESs_i0MfjdTw1R$2w@ zqYHqa)^Lx8cTtCtq!jf69;AbSS+W2h1Z=GZdF1xuShv$TOwA3xC2WQ`?N%L2oc1{6 zd6*jhwdI`A*1!ztjj(Mo?3G0G-VMOeSfQ4upe4foY&3Hoi^C1&BRSVWs!&lwvb6Ue<7;~a}|4#f7lAQxp~0GyGQZ@_vK?ayOc zdSlq{Vwt!UVmbtR7ZEuP&yL2dpNV1Ljp^);#l8^3?2wa2yk#e!ar44{bdY9BN{T`q zi?(KkU6rYlaEh`pqKY0^_f5Eksx9xKvX^(2ZRKd(@uk9HbVL?tY(YBywDhD8HW{FE z!txIYr(jE(b#38WSY($yUzU?8S79y7qEg~jTIQ<7qR82D#K#eltNIdtda|6emuD>h zYUKUUHY=59xz1XdacACDWmt3_VSgxBT6%e9RhVn7inN>;Rofr2E#XDGDYsm)I26~J zmbO^ZtETLi zsfu(ug-JE#dVWgSc24AvP|8J#mLfb`u^bfpNWBaV;bg(KLt<2xtZkKP8vP;FoU%}B z7S+TF;Z%jK%dHEqiJ?Q&a^9AC&JaZnkkVI#Q8`(Wjx3BV<)uzLjS8hKshyrG2~S2l zS#)VhxsJ7>bIhijHtU_UziQhNnVF_#zN)(-B9G+Igf8q(ps$u9dJtOO2g-<*<#EUI zEn!E3Z zMbhb@Skk6k+sZEorx4NKAME|rFP{3;fgio_^$UGdyPu#|(=a*{CK+v5Y~IXhcju2+ z9-6&*=={;z3$zn&o*L1&prD=KFTkg>BZK@p;`e38FE7rWJ@w{azMcH)$xWv&ZG3n2 z(wE};bb>{68Z+!N~9WBpvseS*bJ^T3C-!Jw&{aVN3 zWdG_N-N)W*d;gu)9jCwZ!Rm#=LzxZ7&%E^fu7`8GPs-i5UHr}6{=@EP{&3;3M}DyB z>~nX2a@&(Pq~un!eERs%#GyBicN*a>b31!8({j_C5|#U0r_mC~mb>T~;L~qM+G0@8 zn%^1SV$c?}g=-e%0xn~fGLAmem!gbYjzN8T3(Zh=9W#Ryv?_|y#EGPY=PMiv=mDbJ z4BEOY-*3(eWw}+))Iy@_<2c0iXajP^_bL1#i~m=H?`h4W7TznFc7oR?uhx$G{WI7( zj2A%KwkL$;1n(0m^%2Comp=g=SDIO?@FU9qkOA~Hq_?iQ>hte{2u)XuD`#r(?eM@b z(J9f=;m2+LXANDl*!(KJ@$_|m!$_&DJH;H!&%*80J}f*UFh13iNI^G#UrqYDX` z(s&GL6{MiY!Z(G4PKV~n)l56}J$DAX0#pzCf_(6~`u4;uFSmBXR|7uz;Icq3UPaS; zFl->|`ri=cI0v*BcY6c(ZkNjVlaTgdg`jO2vkyuc_s|(CLAQkMLTG_4XYheim#t|3 zmXQsi_3-|L_R>YG7a+TU#|EX+uw!cd%ujT$_M@JGGv$^QisJom{2IU!Xf$## z3tbA@A{|4BXrS@1?JeNvtaH2yvw){jB-gT;M0_^>c+BD}$v|c#s=!(}vlZl$D^o-k zeemo;Wc|oWP<8gJ3jfTed#j9DD8w@MTx%y~arx`GV|1pbj#1C~TS$N&HU literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.ValueTuple.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.ValueTuple.dll new file mode 100644 index 0000000000000000000000000000000000000000..f30fc4503eafd81b4103bf9ee408a29d9aebe6d3 GIT binary patch literal 4608 zcmeHKYitx%6h6}ztciQ&&E-EIX64dM0i3ZVfsh9ZoFo5og*@r6V;K&nm29?$ma}vF}qh@U@ zZEG1drJ1JXs!5^RIaAe5HP#+iGggm?j2%0w+IQX2Ow_6r(}vgEUkz3}OLNuHN-a@2 zEL>5x-3L%n>rsiuOS#D7%?9Q#%K#8|F2z*8orm&YzV%f$q1+F@?JU$|sUat9@Jlz* z7>MIBZbo3comL&9E=QL`Ulp1caYdgC{e=+#^vO7V-q2)GiMk`UW2c}=ZuJn#P)DJL zNc!rY3elsZ&6!x{=3LuJ>!L<1rHR$^oP zkw(Rz&0MxdBejvb+PVcxc}6K2z#rkfY8z1pIQF1c#a&xB(+-a~h&|wKs9G1NK?oc| z)yj1(F|=Pp@8h|RhLwcQ1=E!g6Nz@Paz&}5$sTuJn`0R5SC#{v=#0WLCv&Y*T~tO# zB<`fjqHz?1%QAYC{!q&3s>CS@%ljm5k@%9t?_}>FkbUV4SVN(aG`dKkN?;jH1&*Q` z;CNafajC=xi7gV>N?b2dlNbT-FDOD2=qPYHT?AIqFTnW{>m)9tawS4dR0Uj(rzk>k z+6;UGSTf+{k)Lg*H;bMDa%O`viELj~WxEJDD23!{@uFXqy!IT0HKjnSDA1-CX!8oR zg#}t;f!1E2ZSXbF>C%jxNaV7H=w1+39tbOSVI>+?7KW8YVP$bxSwhR(te%`99-@qs zvTQ?7QoP@BMJAFbKrxZbrPEr{5DhMlY%=ExYH%EpNgDkL-MyK4g>Hy0VLQ5I4xiIv zZnEr*=Au(GZaFF@oRqC+dDL(hF|kR@8E%82Yfipb=BwEd8DY9>w2TOKHCdUgZpbw| zg`xFHDbydt(_teYDL3yk=xDOC{kER&y=hk_tC{`zIh{Gv)iZ+E#5zgc(A`k)umneX z48u=*ko``v$q*@yogyjMvIBce*V3ltxO&P7O#WgKFG69*g}qfz3CG_yykW4#P`%{z zxx(aKk#8NMANEEsUoF4Txc!V#^7;Fx&QXb~DCNZ}DWwo9D_N~5|K#ZnT~niHcMR;I zYCKH?M6ck8mf?-TdS|?00Y75=4p{x-m&f`NuSE}iJZ;$&I=AfFM<4#Yl-!a@i}s&C zcKX?kB`3#i-?HwV-7mje^V6S|CqI2}+5U=a`w#D(Yi!=RcvS1R#lKHn^`!aP-1Xbv zUb1qQd3nq6-EV2jY4D2pe#SRvk6rjJReN;L?1typy)pe#_3@g!zdAkP{Jw^|2WOU^ zK5}aQl4IqHe{;@aHi@FikJ?&xjb%3XrGz|6iC)`!%26yr}xUC9hhmQ|L9m*7tIdNwv$cFZu^G~M*x zEkek1&b`;~fsY%P8Se03vnZ0xlwnuBccWu}1`4V0&EkDKJXTM1fG-=r94L-L>cWk* z5!g(fkXrDiwFY_%aE15PMTbi+UGr`zJUFs=?ZY9>JD|P+O$=3mR}DAV3f#K}3HUT= z6IpUlwY=vN=+$6#(65n;aTYYMd{8n5TorI~F-nI$eG^X?v9Ln5L%%2`Armd9yI^mE zzYKl?vt6u0@Yavkg(ZWVn)w-&gO&hhB};tk;sYg^o0a_fkqu4yVQy`brG;bBgPB`V z4Op^6>!{K{k7r-ZBgjAuV;xG#c(NFkkN0+X)#7!L_tgboHoWD1L=jQ#Pz~bXtaH3J zT8=g!$v>|dL4*c=d`hNb?N<0nOD~++EON;^lcrv*fR_y-t3g)0U1wf7@KZzi(qM5h z+LFvM1$pOOxBGs0mziUbFV=YXZfD=}Tzm1NSEvI%E%48Ql^cpWynn&@;8Uj}IzEeO z%+P=W7VpIJ8Rau$`@V9Jm{U~lN8vg*?#hjOvP8~lfIkO5GB~XUvdB3r+|6KKo!n2( W)c@s<&4B9t&p5F7j?KUw9r$09?sb9y literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Xml.ReaderWriter.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Facades/System.Xml.ReaderWriter.dll new file mode 100644 index 0000000000000000000000000000000000000000..b3bdee8b71081f173f8b63170fc9aea6bc23162e GIT binary patch literal 5120 zcmeHLYit}>6+W};IL^ySTG~3)2@{-FwkU%`tSVI#@MDw4Wu3UYjuT2ka(DK6J!l@w zomnR?P*!RYDnhhsXhqAP3Ivr3DhNesRDqO85du{eq7sNoK@?QLsftSeAP6eqJ9l<= zXOa{(|4`MtnKSo1?m6E%_sq<7rtW`?@+)ry)41~()%1UpCe*zjda;*Iu6TL# zX`}e^=9zgXH0vs;DdCy6@cke%E7DXA-*kMlu&-=-K~-97)~wvpay`9^sA%NrMgP!+ zB-(5AVRMx+Otcb`o>+Qn2zL|LC@!LPdY+4Mvw-pI(FBE@N1jH%!lwMMb8oRM!l=UU zKAwycZErhaL2Dc(T8-%**!3r}cXKz}(6x0B_&uq0RwR!{;D5RT1Uj8-3pY4DOroQf z3Y85`V;jY!8y5pgjZvVtlyn0aYSmFF+1CxYQe%{8JjLqiw~!YP#+IXHG;Irgv#Nrs<@n_i6fRO@*cwaGxQIZlqs=-bzcL z19TDeBbsj0^ls`kESjJp&`(hbv`lr-&wzF{xsC}YqD^!GDANso6Wz|RuaMa~7a~*Z z?#$V_q(O-WGu+7xXXMkC-5K3MO6&SEy6xNl@4gc;r0jL#z(%a3I&|B$i#e9IDr-!T?HB`;Jxx8QRLJbDkX+oSv@Nv+R2va3*TJ1))(~H^-!nI8lB{}CxTT4*nUB_*yORqbM!SSZC%Q#}D zji!VzYErQ*Mw0l1z)B<3&f4jhWEi*$SZCQ$pprEON7Vcvj2t^mM6GgK@g7PA{0k1M zLvdrGM*JXz9duR1ma2+IU2l@A}KVr*=+Eo_eGDw`T|c z@g?dq4WlP-lCcbv_3N4K?RnvWL$e!3UVEhZ3~j-iwn_9&tnKD^EcjA+Y%9Nh`J1u) z*Ov~Qd;ZnGf7g2WxwX%~z2?Hw+n;;$(XakHzu-PpeCqK{Ke_v_Prv$`^Jjnm^ecDX zxHMyBq6-T7(f4_7^6cu7oW)|zk%>SRTz5)1KIwP8l={(S?d99x-HM2|O6CEmjm7MMP?09gL=sZqN$vB@M!E_cUk|UtIsD#-hPTG6HPlE1_Pu=vh zuDAXZpPld^=n>yPnc`YUl9mMLM$8O&6{O(D!I=_YH1cVV0&TNJpJ`^G6_AF|3yNSD zfQ!eEyLJGp0Zb9B9LQ_e@YJVmhAH`tPz7_&w-0M4;LpQPVs(Tl1aFJDN04|psT~A$ zaW8=vR0UOZKu2Q>1^XfntBIew#=3~g2g0aC7>Ds%Fxs`5)yTt?zY%0O+`bq`KkRuo;w*jSr#II?OT>U!g&AV5lc|^mj1sM;aT5)G^&J9$-Ox00962UsaI{oJc9o2aEwft}= zFy5q&%<&Fi@7{KB&*MdJ&@}u9$fW^osHW7s7{!?sid8t{?YjXP0^1*3=#&-23CbQUNpmKZDcy P@ALOcQt#*SZY%I#wmLZGbUHN|wDO>M_)!z*{!H|s(3SnkX^ zF{;24v^<1FO4=e&D@8*5C`bVzq#)F)K?(?vKmw^qyriIjFl|(tKL~;#{mz}4^-LTP z^jC#)H}}jvk9+QS&OLMII)mHyPzw>YqMtZH^gN#2@|u1(nSy%Jg)c0k=jOfM`Mgnl zy>n#T4$QjpYf89gRd}8sniXlPhG*KIStt#gu0JNNg$p}Y#jdyZ6BUgX+H_?3Bgtxq z=_lrVqnoG$lJ-dY?ixHz^gKGz55G}yaf!+Cu?E5^;CUkAx4*t5-JS&vDL-2>&L7>yI#<;=hW)khNRG_Nh zG`2hjZRiXr)$%}ZDe3qy)T$j&vad7HQ!P)lImPPXUlA8K#+IWwwACc~(_A8hg{gM* zVxp-O|82v~!`E*%;@OO4qQ~mCHgs=TzmaFmAqR9Huyx%DtXz2LUBjWWy;{H)3lJY~ zL)W%pT7ofeUDwaI4HWP+!T%b-x;8t01w1#nGUlE|bU!o4jSX~mgq_#s80N>F$FQYy z(1{*2qWId#F!H%J@-!{eWx2()17>Z&`K-}KFKc>4(`^PzIyJpg(|uZgHz@mzJaX*w z=;E9~OF`Rc1!xDY1zkexHQlIbuciZ<{!-IlX(}|efcqd>bSAwDdLB)KcF{4=OEuk~ z=_Z5F=YjM-W%Kz?T6bx2){FC=4>S?zg%3jCmME z-0w2nUozaEGu$Ah=XGSbcQcm%GSZe$WVnB4EU(FU`FlpUF{3*-!(Ei&KF_SMG~?w! zhPyN~&(G)%WxTwS(R~qfNZVC|{#e72KcjMAL4<4hVcb#T2Q-jYfqlvI$FMy)0)j+~M827z=d&g6(4o=SYJ z?Z{E70^9dy&l&J``pOj{l*0K|tAY%w%C583Y!?N&Q#72g*Re$~qwVwEy6tGkL(&nu z^(duJKyOvZQ#G8Km?--E`lPaJU6U%o%EUq3udu6YErL#|~54;mIJBu2ps& ztC?48%yE!qS#^Zc&?vSVk~^Pk79d!Agp|LcXHPJeyd z(TDE+s%65tyZGqCE1%u;$z$*Qur184Nf<)(XZZ_nWNxAwLh@r`69qZ!GaeS;G9Exy;kyDD{NN5+-ED==Wk=!sSs zbk-@eMCTf`Y|!_7b4*U)<6Y;3njsQRw8o$=t>QfUo>|1P&=56g;#E~5D#M17L>Cye zd`)$&IVzOxHv&^n5{+=&SNNPRK)(3Xa%GJ^nyaz`QW1VOsfT~1~7%NvLUaX!c&K~>89k@ zLlunq61@y_`{2*TPhxh6RS4cD@eCnxaZ@XUI{I0FWtAFDTgFhtMK$qJ*ElDU6!XCnAelgSAgMQfn0g(y$N8x7B$+6{Ho$ruR~=R}asLo}-8klqW==-oQ^D(u zuO39!-Rz8E1?+hjIDUnv0OFa5zVF%=;&t%jHmZFV;jgB>amMS&F-KOTajb-s5|OS& zmZEB4d=20)jEpsn!jBa#Ntg{ds0 z_cf^>u1XX2z_nV#3;`-3i7J|Fm}^SKz8V;Dh4kqC$*yzqE}gtbSK==dgL>gFfDaed n>>!(*yX@{J^VY{Z%sD&Vexw;NqyIB_|B4@Je5b?u&J6q)pa{u6 literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id new file mode 100644 index 0000000000..610d2262de --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Cecil.dll.REMOVED.git-id @@ -0,0 +1 @@ +eb0997901e75ba5504d1b7755a7fa64f1d9209b9 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id new file mode 100644 index 0000000000..26c6d3fb89 --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/Mono.Security.dll.REMOVED.git-id @@ -0,0 +1 @@ +409fdf3ca6ce6639a2a9e055114afb62e104b8dc \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id new file mode 100644 index 0000000000..f82af5fdd7 --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Configuration.dll.REMOVED.git-id @@ -0,0 +1 @@ +b3da2d3903548b23f6b0c021fe1642efd01cf2b2 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id new file mode 100644 index 0000000000..9e222038e4 --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Core.dll.REMOVED.git-id @@ -0,0 +1 @@ +1b165af598037e6a4228ebdf2950ca338534b9dc \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.IO.Compression.dll b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.IO.Compression.dll new file mode 100644 index 0000000000000000000000000000000000000000..5e2f99fd33e832cd69034621df550d6fc6d5fbe2 GIT binary patch literal 99328 zcmb@v31C#!^*?^!doypgBxJJ8WPvO|!jPGSEPw%$5KvsP1#wAGWDyk*8B9=-VK9jM zj=1lw`%fZLNDNcUx zsgX4yt68ZvmQsFA+kFMnHAr8Jt5SuMwzb|QP=EQohkVfab5!>!Waa;ZSA&v--{(hL z>ibMUZckPS3Fh~>rSgz`6MVxnwEyN>lT}@~{lNFkDc7{>@YSn;uQ~zxB2R2JdS}=` zUeMIn-**@Yq8oHnE|9gj=KQ+RTupt4FHeGzx+>@_J~(M7zUeu|BpIV$@uP0G@~XVE z&>p{5YG_H+5Bmqm_#b`~WAIYYc4Dx_ZK$^$PizDT4MDph=rru@B=R#1Lbe;S1**t4 z+2nd+)kM28s5e$)q*U3lS|*`KakEF!htM?~2|9_fP7*EcdXiTFR`z<5Kg6{+HWKVX zx8^HEcZqhQW3vvyRvr^th62fTp9UX_cKi4guOQ(st640O9xyK@uRW&JZMV zoNdQgpVJdV1uife=JdwGxHRmoQO(l7(gNuS+etlUDUUE9jR^2a(X1BR>=^o7&}j_y z!Cx!;>wv6rlJ&SW7WNGTNz=!WZaa|@Ppq7k89(ojD}Ucv!du{}4m3HDxE1Y(4Q@IO zi(v5@ULxrfFP`*TUTRd0Qs?ZAhD)CayrIcS_`tcI>67dfOElV%20O(fRXK>1uhNkQaK<369U7#MKS@+@6r%?alKi4$?VE80a?ctu3-sbVfv9 z&Rv>pME&`JNJ~7BA+?11HqopmOp3;GOJ5xMVq|zBlGI)Ox_~#R2$fm;{ggh1>V?l262@WLukeuDw|#PBy`7cobhdH zfE9)M&dEyI!QI0=(tHVjfrmp+yun_}BC(06p}r(&TEgR%mI(P00bdMF7thU5LE**5q zE-(f$L>3Q;UpLu-N;M;sZsOUD9L}?tzQW!}v(;cn(;HBuonp6d1fDvHiBX!6TteYm zup4pF9Ykt0O(xAkU6+EZL3I2fWcwi75m7RPKqifW6h>*ZiFL5b#Kc^awJ}9jaw==| z?P!iqDs~gE#G|>!7dgU@uKbDCCNV}Ekf=5WEQ7dWs7h7Bo=DhZY=AQ=(f%u-FMpUR z(Fxpbifm=1Sz zB8EE&F<237$QfSXo}t4F7BLvZ82ae1%x(Cco}}&m-JoRpbh@iQpUE>M8D;WJN#4LD zR!5x8&c>wyLojn>&Cxi_PO)$jK64}6Elfjt9NrK124Jt|b&?o1&|)m-O>#2VX-|^V zyf@M^)?34_Hm=rAv5ugd@VgaFd2VIfFuPn=YY*2~-8Xl)VTH)2YEJSpk*UkhK!@NU zqyB_HKg7O{zZ;Q00M|d_uboR5V?`+nBH$<`c^%T2yu=%tvX6+>1S)SB_a@m`z9-VL zZh*$=TBI+D2!nwX=}%rSY4NIKk$M7aBQ5bU3HpF>O)QF4OE8R@MuoeiL?u^n^ z{AucThux*s*iUCR?5A6xL{}M=5NU85j>~k_UNEJx_(E5`l*#juqy&WN`Vt0%>MnefE0WON%EFgTRPNa1pXEL^wiJl=0S54}U^Z=NJg2}VM8 zj9p&edGzGztEv4^WV9j%L@y$7!&mHjqpf*i*Xz@FC&g|U^Ju;1%)Q?TyUF>Kj%x|7 zzA#ph(DZvq<1!1EL$^v=^t#ohTHZRC?r~xVLf4CMLs&g*zFVbp+=|7(uy82!_?>kZfz5xB zmH-_*GAS2ibg(Z9I#e{PC2ij2aH_a-W4b zjpW5gNAlzOuCFeN+mKhT3`BeK1JQMtP=k%AWKrvH{L!8~e|2H&8@>^Th2qVTVo$u( z6^BWo9+V1uqCLe}&}0gZ=#`>x>7rGw&$$gN*8LDNZ7J6pl8Zg!u%5VOZ{%9dQB}~7 zHb#Q39i6`*=tdU>?dak{Su&fdy3mmC&yv|R)gw%;KhBa7^c1qU$i5>> zrW<1ipg9I;d;^x47~v3?^FZQF)D588DNKT%-i9sxTvpWCDa;EVSrH)3ELjC0ox?1P z1m47pAU!@~rj?&v<4()mNK=$uW7h&lhqTf^5u8gcjo+>D8l}>#3G)pvY1Y&*u|{>X z(-Y}!IM;!qB2EZij&DKmGuPXrOXxVe16mZK9W(5dDEIal4JaTYh?I{6;|V)OCEQJ# zCFF}VW4$4y$W?Ky(k1EJdX*dP!FCN*Z+#x+FrU#Fchd?fxD5Btk!36@R9#e({%lcL z+4_tv>^oaq;Z!X0EJS!A7F~rNDzWI;&OW(zl=W+DsyPgGbthHY#X=!T-_wZ1_cBkmwEYRm{mu%2TJY889Sn>~?Gyu-%*B5TYKB%16% zkzHL=T@yPT1h|(neLcEVOVNiAi?YE%N#*TAix+pgLSUQC!%QQ3#8J9CI*GIT)?N9$(9zPWjF{ zMSHbYPS~5=M1?Vbqkr$9W!MvfF22}d$cfK#%CsE6F5!~`zG!b~s2zhPs=l>EHeXvH zU9Al(-UX;6s_$JNgdd8~o)Io5#7^Bs&}4%xxiLR}yv7~3XJepkKaS40TOQi73&^F12t5vdyE(KEsr`4cJXJ%LMQz&vg{P$xl3zmpj2BB zvsd~75aK?2gd}X-XOqBbCEA;Qghg^l=j_kX4IcB@Sg31Jb2ag&-$s0h#MrTLww`;E z&`0J*R-c(0<9^pyb)^sUqOayWFtq%s1}hzv7Z14p>cEvUx79F&TRy8%D3^}{ff0HJ zt%-tw0%f?MMM7@aQ3^ zUsUYDZ3LUXc~&&Q=7&izwl&ljaj@6cglTAviG+ZxI*Q#0j6)bO9Ks&|lB>wi<%uyb z?6&^89sOMy!M(-)oKS*&o*XpVJHHruQdV&&90~_7D9#J#H5M`HJABDi_$$tX;3c7O zUIbgQgG!;+!2Cv(Wds(ZQSB7N4pQ+(x^!L2Kr&uv6?3%jUm!0cOx~%{d0-`wkDePy}NL74cmV z;?^-WK@v*j`y#FH=o)<+F^M+k+ThnUwV)=)pTw=N>uXpS>%+DG7=QtG?pS{ol}^rm z%*D``Kf6LYQ~Cw)W$x2(PvNGYBB39>%1v)!vZfoYuX*1jUR|t_w}^Pszr@8!6yR~d zJ0wKY&+-yG0p%OMhmn_Pqf-{QBI#$4Y`{h{#d0$ccP?(jp>~S&>ar%dK~hoNUPgIG zNKKNrk_q~9d|HWX6uyq2>6l3&w;>;nZ5gerf+i^{;&^M6*}HT zp&d(s+~~Js>v+8{Q)wH*GFu^=gi?|#z{BT8j>5`Ol}X*ag`|vx&6{l6m%#dosyE_3 zO1vN@CXZqTd@fQZrpMb%U8POXUrdd(VfQho#PUpu>ZlZ91!OF18>`(GO`e)z$q>!} zA^jYfu-`;pU81~uJsVjRDbs}lh5-s?=u#H5Itme%wFR(`Lm~0qH6_|sW5+NAyXmLN z6+;WS>7O%M9n_2?G$VRb^)O8d^*xvE{u#M&48>Ll#|7*dG;>4oPA($`B#E|W_0cv? z=Z1z7q@g81I#Jki1-prnc8XRfDoh(dfl{r2->%jk_aSf?H)GItu_(QV}`MVK#`=H0sqG)`&o#N=zSmLW5-Zo4YP1(G9jGaN> zy2p`^DR#(nI3fBriVWMAehDmgiUK1obM5L-PBUw=v^CeNrnOlh(u)0KCf02R*r^5* zb^e7|+36~(^NeJMby-_E+DJOmpo7vcBL}-Jx;-nUUZL43=0sYH>~&9yWTG2$vm_3y z^GyxRE^q08Ag0QCqlal@rK((`umlmK);*CGdm$#|e9l8GiXDech|$wta~2UXxOUnNm!n14+j4+!7Vq+rN+!gqaddSM;PMBa(iF z`6HxYe4?(aTuNeDq{jkIi|c+ywiKB+1~44xBZ@= zq#_Iv_A7`XhfMG3w^@Vsf}Nr{J?Ym;GAdSyitWEeztK*wYO4jilo|}Ux?*qo4U{rb zV5f*w55tXa>P-sMdUK&_bPszq&ns89ZxGQ^ps;%*T2Fh!%r$bGz+sA~0%&!k+rK;4 zgGRE@aFbW;%M{~)THaHP;37NrP3;s7YBA-w(#6fwcc~TjU5N#oEN!ude53uhqL648 zZo?963q+OcX>f>Yn*JZ_4#Y=(cim_zY|U};jjG>_AFXQ}@g22|kZ`FE{X0{G|Dn1d zstbmLtj^Xgt-YpQHZ_Q~X*{=2>N|$L(J_PORtD=Ex-#M-?AU$uo{@I15PZmBSV;!@ zG+KLOwhi?XQ!fd8Iv#V^1X0{y${ex^t-xP)SMK5L_S@r-4e|ldsqW=RvSbdNP*IbA znk931GV9K|mmkQI+0C+Bd-r9@93%PM;Geu6YN!5ztDX8gAl7LlRvp}fHJz(&fNn4h z;}WS($0fk+*jb3g1m|@-^@WuD8=)3}t=HzLRF@qZ-G zjHRw}pzxs1RUKDQXE9D2IWztdeZ?X zCY;!*Xf}P{C9UDaP6uJWQJ;*9bDPQOm1bg`detegGm1FC=H+2U1RN>q7! zc!M<91h^H#b;Z6`rLZ$}@PfSqStk#qd*OUlP%w6rA9 zmA=XlBmu(L8Gu=AgI_#Azbz7d7kzuDiD1=bP?uF^5B)}&mI6Y}zOm1Q8q2D1{OZm=< zb#~Qa2^6WQuvZJ#In{-W)2vn7mo~b^r~Iedv|flaQ8H7Dh%#B@uykN%qy_te-|CdC z>JeQoBElM8*X0^V@v(svlqSfABVCOUlV*}LN7tesQGbW`13Xj9eiC*(*wqZ#zSs|t zEl&Wvt-r_lQ9OjbiUpdCo(D&J5W-T0R!GzPkLAgZi*fStm#9x_L;7u|rIno2J51BU z?1@N;k;$3%P2qq9TQh)*#0V3v!_^j3c+%&n`DrFW3F3m0n-{q!bk#2*X9UN7or!p0 zrY`I0)un?q2x{f@hFo9g_2AdJzK%~ zZE~q@ZwR~cjTo&4t@0($1Z&XswTMAEoknB;+1I zT>~GG=v~&6=G9KI40o+MuoiAO^SiQn!ZNuBStgny$vuhnnF7(F@^~O6DAU2WR)#~6 zyOIIBEUZ3>b>JYf50PvwGjp@{9g_9E+^o(aS>Mminnk3`;aNDTt&4cBQ~s+o&ND|! zVpvpiAaOjoX|JJQu6Hemo{zS1Obp9beM|)Rly1Y-cB&9oV{fUi#*3|#vCwCY9mAav zp6R?xm?}a(+mC#**B4fb&%DF7Q>3<+V#A}-js1ecCPSD0*^r=7o(pURZ#8%wJdjJ_ z(SoP3UQ5DJusm#QMC*Dp9f~LCfU#Z<&D22f|;$EuLF@kwa6BT7y@9LCxvKy=C-BIf*W~A*He!oH5G+kx z-1gi->2r;)%+P)u2VHB~rl~M!PV!)IILY6O_!M2{CJ&(!kS3UuoCg$lG9z&+Q^cH< zDS9X}(8%Ivk-#%Q!TN?}Isg)QhOz*J8|4!3z4F>$j+i=rzCft&rX12@avg{cdtl5|d-lQ((#mq3t^?0&>#FwG`L9xwgNNMIMY`;TIh&4%SD z9c6pdYzRBDEFIBQ_Dp25gP@X1T(sLl#%;xPTiEzHKHrYL$DljNw8?VFM-=N;h)>hG znNfzy@R39?6fY>UVk?k}M3dW59$1nkKiP(i?GYE_O>!j&?`+GfcN2Jrh4HYxqCrg? zuN!X@+O`s!+<~hM97yxWhJ6^cNAZ`3G=>+8v4C3DD2aV~%TCc)(^`>bIP>x>lqlP7 z<;9C^+t>dAFx}rU&zLy$L&qkp*c!KCyevm?>`Y(HCTxOgYqk~T_nj3`D+4j;?rIuB zUhy0~e{<)mq6tP94yU8Dx>WyhS(y$S?ZTQ_`*_{h;jAgt_cTPBt#2Lk$DlH!5cFvV zSG_NF9JKMJj@LSk3ucSx9Nm<@R0{bkq?LUsybysBtG}fLb5^8jpB}@@@T!V0wHCO< zf)$w8Nj;7g#O! z^!Yn+VyN$otSLGV0~1>>kd-OL@fL-4*2qxS@~|hhKUHQFBYn^gf-lcNC94D^- zATDV_KgW`6am3tzRoul%7zE(2!45}TGL}@SF*EcK!jt~x{h9PFs{Dye`eRjYSu)IU zUCyxt!+Y2%T`?}|0Vpy?t%7~h30hlB`x~A0m?N5#XBplwj3Z_>lN%eGP3H&#lbz!5 z8ykmg#s%*`L6BeedCrlU7}Iq+y%?7m zc6xA3H-+KH6GNuke=PJ(`W(_Mu+s+Yhj{id#Mit zHRwl>o*=y>-KZ}ZO*zxRJYF!CF|UOe@UO%*hD{qc_9;~=Nl#>kC)I~bdV)?L!}Kmp zuWbj^>(mBJ(w-O>QMOkWs%hqF|JjO<(fAwczliowQzF_QKzH&*ts)!o+xGt8nGU7Qp*zU$Z#Y^n6l5o5;e(#nL~9K*o)Q*hX?2 z$+9Pbxm;n1D{J&i@*w~N5d`q|A@(KeOH)OZWCIt})7W469H+Vf%sTYwIfdq%7~<)?c-4~PUC zXBmaJieBss*~y!FC0_albj!iwJ_X-kO7`G%aup8^>X?n^JJo?Ugm9^ZFuH{B zuwAB$B-)Yf8}q3gU6H_EkGSMjxTLNzzn%v|f_R;dmtfr0SG=n+pdG`xV&AMhk$_kA zvJ!YkD2oK+rA`bpgxlzgt}|x`-af3HaodI<;J8W(?kJgz zVY%qysbrWtiRj)HL;1JjQEiFLJ#lZ?1?FO{ZrMEU#)#rX@d`H-gRaaVI%%gkaqvkf zdDyTf9m6o^n)F(ZVlwK)FblgGi5!@9+OIExOpYG#x9Z|yUq(FVLfQlCnLKx?;fQDk zbJ4@O7KMeMQJ*4tfG-G#715*FMvOr_<1B`uOh!4mxK}_f>%(r3PKX?g2_A)xC3~;7 z?t$1K%8J!3lo<|8hKvWW+tu^E3@(!~UgBPXU3k)aOzL>3c^Y>K%MQjJ+H2=vFs_tk z1@`5kA{Q90*5A|} z)vMPS9#^`9_d9~x>;5!Um(!`sIid@5`mq$!{=uN2FztoCC9_SGmxAKpiwolF#P{{J zs%dwffXh2{3Wxaen!IjxLEA`g-vG2UWbD~Su!6Ib3sIfyNX(A=ynR@Vt(?u{D7B~` z3qI+JuR!$`O#!dm+)6G7&K#%en^-V#einxB=)zi_^kA9MbBg4&F;2B)%kL=KlfazG zH7CYj^zD|yb(4TJLeQmJ^(YTBkfC%1U#H=8P`W~1p+lT-&U*=-8z=FStz?HeD9^#} zWJDJ55u6_Pv?Jazx(NHT@I|yOk*lHX+f_J?QL{X)(#zFIo)nJHG85W_C}uM=6;Z!` zH=$)_qj)jja3MFRG@07)(um8$mO)wd$i0Jq=#<6VATwn#X{IckPtsFX`4IN4I83B( z8!%&efpNxivP1s=#mr=;q@nXjcH+THpl0UFPA~p%pIvASXBS>`{2$}&;%~q@&!adE zU@Xb3^U(er=O_I{+K(%^1ebnHNL=X~u^d^^66ycC^J61|oP(WKP*;|OJFf?~9hWGV5 zrTIi8?111!+r)&SF`i?Bo~ws1>oId6&a7pZGCQ$V7i9VTjU&LCUB~!zwD?T4#7lh< zS$+(?I0?MLmbFAzU0t;d1BYJrEbFPrRsiX=AbB484ASgOlFkv3nYX`%Fv+#A=zb`4 z=MNi7mFRtr&DZGkh}>JTjAvXucJgA7(yT3$W{pEwJt>k_Xnu|GHN#+2Fk-dDEEo^ zehA<8$CH*4-0fU}RGtelw7H_E2X|z#D?w}gKtFHEgEASZXg3*i0;(3bwe$n;u@MX0 zXGT0wYA{}i6)C0SgCI)-YQ$(Q4`bg9xS*nED_d-LB>7Z1 z&4e8r30WlXks&iNNZvC;W@3=M7s(tOv2!CoY$&o0do88PRzzYLMmN%`dbXN8ivF%V z%KxrB*2W_~!K_T!A~NMWP}E@;`pUFsu^;Ch3b=+xhjbGjH-FpQ9a{F?+?M4Ncit}J z6EW0KZ=nLADOrU2Wf3a0y)++9+Orc7Me>Ung=cIZ^#)v^n`IkJHa$_6qh z8_1ySVM_W>vt#b)Hk;zqf0b@TS-o@&pZr$C(w|27RvFe2cEkRe?f_Ut{Ift8-K@v_IM7R-zj?@ z^htjHFJgpxd z4UQK+8Da9{MHz`+8*e~g4>|RjGQZui48}rs7`2b;JU#Qw<|U zY%I@=jTjm^HALGoBX4Ga+_uvIX^Iw_qWN~fC})OL4uE)sJ!p{8Enn5QWpvw9jW}GV zd2fwbjb~`WdX~aLzRa4Lqm`s{hq170Fm8eBwT^UUJyT}Eb&lvA)k_`OU%=W)eyFc%NPVuUPwJSh>yWv3znt`(oVxeVNgtroQue@{^g%gk z^qi~>y+}u89@*dMlVgJ3maD5yEKA-3gX^jr^-3ahHMR{g(O6pN6@&HCRL-U>g#0OJ zbG^2xu2>c|X8>ej5z^}m^e(PEd@Hhh&sTs`miOS5HHYKmPtF5byxKG zR^*h%i>R66dJTj<9t>8U&;?UiO>Wy;HdVs<>Q;zPFGSm9(hGE2;s85t*)`Zb@)PY=7usWxTQIzagUXidX$u4WqBFaqjk0jUm@8{=JNq1rRa6uN~C-ao8~^=}ED|6?lb46L-#%hAzezV@G?!L22%EAByM)qI`!u zjQ8bZb!hWq|F(KhiR9u1nM@AW{>;e>2NS+=S1j(ZV|?KSex4?ym~y8TGPkEAPm3K4KUGX)5qteSLdWp z&}oU@q)8zN0@t&&(r%lr*^6E_w z@DfR{$A#r0I8`j=@W2yyXSmm8F}a`NGte9oI{>~0tVyxXEUzPR#uI*&$&c!agnF_^ zb|NqSb~0{6$&I^S3c(IjYyl`qjK9IY`?$!$P6|#Z?q}=I3Wxg2Nf%5b98!9rtDyz zd^%L`*YAe-;m^U>X|(%V@YPUwK+acU%YdzwydC=C6QOhrNa9^|0({s?S`lv)O{D=Z znuhnJPXZ?zeuG@_hQ!HCIO$V(iKb8GC6Yc37x*)_k60rtDHiM3}}I-s!tt`?6+#p9XAf{k2L;-QcHvVHb+ltI&-!3$2MoGI7zS-g1DXY&$GpQDNA z%4J#ld|uJNH_FwUzCf;SdK0d+XztKv!}r5T!8ahkJzuvUZtYnOJ0$D*&UVbmAMB19 z%3!z4PzHSn+r9EmBaP>I@h|A!I<(0eyv|%G-;wTfqoA!J4X=I|%EzR0XxT4H&mg#(7Y>u?!7NPwHKI@l!O-9MI`f1VRk!0DOCuv=n{M*ua8|p+W!feF*Ur zhC=N%GU*P?XL~8#eCWR`wWAuB;ERJ`Y2=CD9qLZ8{rJHSks&=e#YU38J{Dh(MA{Zz zwR&2Bosx!4v00NpqH58!G`;Ee5=R&a6$XK@%`g9yVee@p81dPIb&=>8WJu&TQ%~riPRDlPv9Sq{{G;E#y$<0l1bng-Hi)EKBvta#Vhe1eig!vwBo2{;)5_&4S~eVxNxQJ<}Rbf=V&LMAqiti z!11g%7;ko~yRnFIm*Tr*-Ed&HJlT%;zO5}>|1wn7_yXq-NA|j9tQ1k`6U$l~ZCnn| z)M`7xWvcxxSdZ1pMh9=XZLC_f!13UFc-4hW zlp|5LXaUM#)3MNAcPsmYd>m{3MeA-MQiacAqWt`e79!jV7l+(+H-qfU5ZB#AY>)|` zef)P7<>_i}L?Nv9Mee#Ahzv>y;+vI=aTs;o^+W2pZfHHwIP;yXK-IxhN8qVwq}Yv* zTt_|_EAQ!UTxjZm6)b=qc^+X2d+=&J{lrg-N}F!QmA@L!g67+icR`T;G$lpm=G>jl zp^CXVKg#CNsN9^}vpKXqH|N1@4qcg>gOmD31G+pn=eBGP+bB2Zo@@@AGGiZNLt)*6 zd+K`;MTt@ykM%K9;)_&?M*RC1_kkE6Z71)?)zg$`dm@q>^2HrH-Hzg-;2%_#VIm5VyunK8Q;mwvm2{D->dR>;dD+ zT~7G|pOilqyXuu9L=rhd9x_5679s41*t5k~__1$=kr{6vI_b}$fa^*B4Hr9-d<2Zx zf{#6_3%c7~%n@$?V?bk%QwZNaevG`H^y9e5{xnSFzny~TSerq@y5~t;LT)|wrgyVb zKLZj;Zbo73lzL-NFu_f|pCQpW&5qOs<@5b^*pq$+thRi$zX*HrE>3^F8-Z+mZUY$@ znAh^Uy|f7C+NGu(Bs~R5`9ArVECP{cUnK9{=V4{QmpT#8T+UrO^q-7a`xIovwxEbl z{$&cy7195CgeKu@6I3Miw7{POCUJX+4@5TZr5W_USb@o<_#DlA&Zj z-{M11WcF*ruogG63LzqAEP=`o(V*Hun})w~q;c;>``4<*N51kvo7R;hJYW?WRDe(+;eZhZ0_>T+T)k#jC0{Fgux;cxTeO}~Q+{{@NB z$mUx2U6P&jHeMp>U+K$xym->@YwXv&MAIMO!j&!VgmQ04u(Bn^PEpdgDrc6>$NRi(^w8ah>z?PofApA$WM!dQgmU? zLYD5}LY7zF(^HZyOy*9MI@{T2a!%rC?V85J4VPZ3O11cy6swC$b@lNH8XbJnE-%m} zaC0UtmZCmMKkDPzO_GuURvwWigay*PW+B_ue+u#j{y;4=UuAf)!0VNB_yu158bbkg zWAs|5S5ER5xQT)Sx4^sZWkgXDQz!RjYF>)n-)Q+fH%t$0sz%$Jq>B zZ~C0Qr&|gG27cVkI&OSZb5mP$TgxO;ylOe1ACuUqb@+F?aQ)LXr01;aTe{*%-VUq9 zrzth7473C0sC%x_|IXN`Jr3B5`v*?~KOGCoQPYIYYkn9%gM-zVRvSP3 z$l4FaA6ipEH-#xk-HSgjaIQJt!{1c=1@VV*OU^YOi0je#^WzWmgU~1k^5x$}E5VgG zh8+BgMl%f`tNY3e+wcYC3PP)rFjoHK)?)QS8*@9#2gbT8uYz!_z>ftUC-6Lh9}3Si z0B))a#Fsa((?ae^9j-DR90&a{feD z-8^Q`Dp#Eo+va!Gev`?wxR&rCi@7aQYL4jto<(VYZX(9zvWNKLY%kMKK$@${Cla33KsZ-)`%5!* z{-@Y-QVDJUXBBhbZzA;75Z)yG?c&K}B|T4In@9-fvDDaIDCgBK@;8+bUT726OYLI> zUL%wuAL%|=8dS6E==tMXNy)3B<|mAO2z!G{ZNf@~(Sv{e%_>y)VXmH*#ry$cIFkU5 zLKQ-5?2B(|A~HcJkEpS;frWq-s+MtT>@@saZ5r$9Bz7Dh+97YrXf<}BI)SHefxQr7 z-pPEP1FTNUor{&|0I(}tnYWSmf584GQm(`9%(bXL(86P}_oyX;UDTwpqlD8gX1RM* zQm}WWhQ~RQLeIJ~>iI6ey9$|4NPT}Z*z46S_oX^tI6sM!bGy1sIDaXewxzL}E^@lo zjgog#Gc5{PKSBkC>fuV}?Jd}@ zR)yq6Vf#F_w-poYtwLhow;BYS+(>M$l@RP`!RA{{f=wC8ynbsOny^r%#n)-8MXGHV0}Zdy)cXp=5atB#J&-&Gv&S*lJ~%nya$}zayMjU9ystq ztYpf81M{X5?mmgoo=kX+(El#*F@YZld`sY6fU^glA4ATqe!`EZ5Iz|v>xc z*FwVVfwBbQW0L-0*rX}7s&rfjVCT4Qz-67g0Y2KfCrZ5;oeB72Hz~zkvjLx~J^+-j zaC+Hl zq;G0sd#xSC7916+0Ou*vrXNCQOHGCqmYM|JEcG0;vef(*!b9OPOHCBGm%uwETJ`{E zt$MM8_4d~gj`2|b&!ol&n$~8c@rK6Lh{Jh{`WsP|Z zoO_Oa60mU+VWR38z*OOjfKJ}4fCmq!WS9h0lq2lcaur^Y}8*7y^n?)(4&7*|5(=BOGBIB=Q&Zr znSiqgE^TBR?OOE!;I(D*NK{$TPvz#m7V zQ(W~U-#ox8d|rHs=(vgVAc48F2bxBZ^7BH%OS>Kb&-Ql0&qk8}H&Uu-6mw4&IIo-O zvj7hqxFkaPx|Uve_`rcx0^f$_n(nGIrXiwK<5)s1IRcAZbxk4R-$Sfr1AObMnee%* z?iKiC4Rfantg2U6xMBryZ zMuO(i622PEIM*?M#F%;D4@AjxghY#u5k~qhZwe<%CGboPk2L&YXb? zwDRnMqY=+@2Kr)z6S_D;e%3OkgLB^luy^|8CjlSsCY&239N{5s1tibONPpD+7~nwH zV<IFPQ;FC7f7dwQ^5*8mBsGt@TnCB`$zi~9RamIi{0N5Qs-r{M>_J=)miMxjzV>Z!CtJot)oQU zCD^HD2eexF5ZA*RQ>`PP?_A)I-5$ zdyJ|!SbF3mc1*<$R#H30X;AG3TN*kOPv>6~Y`vPhOTcPUHKQqIy?P?g!kcB|fcdd! zF})$s*`hj3-kwFw+sEWRB6$ayyh_PC(&YV7^7+vSM{X9hVN2}=WMIS zkn>43I$DY+W@UI#K)>7>oMi2(mJ7CC^+YCFGu105Z)I7jJxl%GV6)0A;b|&zpphFC{urpxIRSz5Nvd;R>d8#lW<yP(rlW45dPcAf{`a~Q_Coc#!Nzt@ z>RhNk(3si>URtRBWb!_UcOmZ!lh-}Ptw|i+*{AL>Sb52+&QK+X>Za(z{j8hZy1{7zAO80@l9w|Abx4E(lumo>f9ak@r; z)rA7qAa+a3I~`|b^C}we?i|FHx7^)%b~caY&dFlCAhOO^dr5s4`(G`3u=9L1%V1Xv z)*~4Gd4_Yo`c$xu>Xw={og38>KGMd>aE@T-3$|V@3O|ax{o9$hULAqWsg3GvdH!&! znmPJs$QzD*ER>TLyFhga#$NSI=LPC^!Pcw&CRyr2^|)ZCD)y=i)yoF^LnxsxQ6Fo} ze@bV=}BU(01oe7sA-zEU+CtaAdfJvF9IDSo~4O7*qD9@*s)&s8e4 z2g|KjKN$IT=T)jyuv67;?eBG7t!5c)P5exCje6f;98rF#{%kPX{zDbqQ)*XJ+IgZa zZm^T5TKMO%=W0yGr5n{E!8Z7pMSt6QqgrOLRngx8>o?d9V-xmGDrK;rjPXxB z+te0=jf2l_Q*Rp1TJOouZEE;lv~Pp*w*RT~cJ+Y4hM|w$p{DJv^G-tlyF;xOY`yBt z3s`rls}0tWH^#n4-K;tNmyS!=_o{nLIjijNo%gC24E9{~YhZsBOly6g`dVX{WyaX| zsonO`z8)TSy6#trnHqbdKG5}`dO>4;+VGHi+hB}>htzKjCtLF&wPar@C#~|R8pvYz z+mEXA1k)>l$J7M|IT8|%)C|ItMmL^>Aa#g8&0lRUQsU? zj4PJc)LRDQiscvTw}P?#?zi7mf6iisU2my>WwElZw-w%V!H=A^UE5T%#{8eRHFo`4 z^%(5r@Gig>XiSBsbpT6evFTkOsIvuo5_55>`mK6LFg-JWs6I8EN2A<_s$~}I+u&c- zv`^PZYLdY&sQc9UNKG@???*o3`AF?$u->ZK;G8YkdVjL&AYi9!Oa-PL+V!#em*!O0 z*Dde*ofE?OxvXdzBPygKBGD-u0WRei_tP@xgouqcSli^XuFq8S{yOhXj5dE!4;yUPZek?|>AZ7Fh^_6>SZ8Hl z*I(2Zf^lSD-SxSup36L9>%0E0+OybMUH?=w_`n!r>nW8NbbY1vHP{jMBc89+0R~GT zLcUTf4ff&q1hCZx``37{`bwQMoFRiS_OHO6g8YydPREfbZ zE4>QXbp~S$ZdZ>Q>^extlm`9sbk_Scfdu<$fgC^9H-Gcw1M%`q$w)Z)|Zw&B*^CLBOEMh6&`g)1Rs+vlHty-qBMY!WDuzq8(^AUpumJbg*8P|-+0&BRz?&|n` zSAo@Ku#J_L8fGmJY@>Rl{kD!_*0ly()pc7(q4k&~p!Pcuk565n#b){eztDn@)Kwfi_ zFK6@4m^$8Cuu4k_j@&eLqV>4J{@8lu)X7%&u{y7AP+j$f^CtRed`wnobG#K75wtu3-&Z{G5GfStAU_*>{#TUa<9wBjzk?e}nCcxSnM# zHQ28(GR(5p8LV$4u}y+)QJkx0SwA)yXSF%jvj*d=c7XLegYo|MK+8>uE{d~guT>+M zo+*2+m4a~|`(o-`>w3*8*3PpYG#IU&XT4}JT075r&tSCnQ0pHCqqT=xUmA?o9%}td zFm3Ij)`+##Wxb-chg#zW(-s|S-EA;hw9tCWV6^Bk>kWg^qQ%xH2BSqsT3-pKEjrSw zNwWr8q`H?_rwFFoZ-sSjs0-q7~Nt2BSqu>!${zMM>)sgVCa-^^{=RqNMd( zohPl5wEkf*+R$eO)=`%&iZ-mWh8v7F9BaK`Fxs%%dQUKI!)j~Ei7dBConDl-Pq3~v zSjmJD-D|8j4Ys_rzB_FlGN3tcD{bsvXWePAb&>JiCt4-zb>2r~Pnx>kS|Hd)wIw*E zdxQ0|#$*IL)%sAdi&fg5(S54*x#3(1>`ZI?21?QQE9Y7zClk9^ofi9E_qo<$gH;vw zbZ@k-&tivmUtoPK*hY2f_#?VES&36vjy=xly4dOv?0sts?vgLHK0TFr?^`dI)&l$5 zV9diI{nH2YF0%>*qm-51ms@p$v89jizRH>}m~QE7tYZwumcGV1(O_)pYpjh1V@qFa zU1%`2^tIL{24hQKYh5FlZs}{S$8?^w^tIMjgR!Nrvpz5wTlxm;3xlzxZ?rBxgEnkY zZ0TF9+Xd4teT&t6CiAp+Z?!rEqeYgw)!I$44eD(*(0!}5+F&(mf_tZRjlm97%e#JJ z-K;T`JGc98>nXwB4_p1)7%Vb10qhqBJ0zdjuMKv1Ni(p|1k<(OXZ=I44eIX- z&lxNQIKGr;=SJaf-BRyGm?p(B6sB|OSn;(F^6T{OHhBiqjw*A$jp9-F3O(J*+@m@v z=P^J>tr|tj+hZ~mOPyFrN-kU$CuP?%!rQTbXREsk2h-n-DJ*oAYVn%f|EBg}HRWiyBY&or@1p-Vn(xe`HGfg8UMiYv&wK=mr9K*G!=gzcrm9GPgBK{nnL-ASfQ+}rbW809?0>?vkXghAgb~2%Q%dyf?|=76A7!cmS*(N^`y>? ziH5Y=LS#}}%)|5#Corv}PHTSu5DLCEu6jojZWKMW|8pTdFjPWr?OLYpFS$J^H?4iB zDde=(O!RB)pzIX?J5#hjbx+i3)`%~ChABa}vesc|J=t?J{W@1?ZQYI(51u};ubH}} zuW6lk=G1YUYon%^zOz%`-%)}dRWf7CWr(ZXw4=U}w$LLFb2Y`IPOTzmy^NEDw)&Hd zX1ZQY*IMP~9zTtxz60pbrsP$CI0b;Q(N-&@59%}}JEq=2O2*H*KGEqT5O36( zk^eoH>D#d*Ypb70RO3+*(gBQL;nphs;&%X-x>Wh}b8;Jb2d zoMe6yv1F-#VfOiM3Cztz!Y`ZXA2&&Mjj71B5y5nc|X5Z^a%(L zOBJexQg*2+^_S8Mz{zLXEOoy+#(r(`&yYT8@-s+3i*%lv6a5(Q`i{Q=WzPF#)jkw~}L?@deFCF+RE1o-!>JjuRG{4iP_6WRx*e$}-J@R-nL_GtA*CDVlK zRa4{#fZQRamkQNVd78ah@g8oo(R@w(erUzJv!$Ti4+*p=0r))RXzRE)J6i40`nEk@ zMW&ntxCPer8fm7P08qtw05{z7@n`gHWCx-7Kf)3z4-vx#9(i><07o@eZDDl0u( z?MbcGo~6RM)QWgVB3&|}-gAg};}G%rA>xh2;*G`Pjpbqs^*_T|YVGQI1OB|iPT0$h zb?uW+LYnXpX`SU_FZK7LUCzgD`%&&*A^Y8Ya4Eh`1v%&d^_d=1Gr|R;*M4F}E zQoqf&(2w?whuu7N$>e?PJjMNq*%rr#a*Ld^E!I_Tk*D0cMAGE3?2o54yYE{wiYK@Q z7%vY3^sD87kOWw$wgHx?VZH*4iamhC)scWT0!OP;k&da002As)z-IL{;COYAzX0!Q zTY&;Z*1dq;>X={w-T|r&72sX#hX7})gYpX0EcH*o{nd~23-AvR?om*n4pDCdE>I^7 zE5KJ5DhmtnKG3Ux%hmB={JS!0Y*7JxwiR%-I=;9-tyN=73eyrxbgnvfVhcVKgQov{G(E@d;I<%|+Pq^Lk0(Gsr1MqsaprQazdJ8HG z)a_~x;GODJzMFp;Rb)f~PS#uv_;d9Q;PdM4sscRq`yB8!HKDpd zy{V1^d`I02_?{}NDNw&rHv)dF8fpvFr|PGGe^Q5xEKr}TPXWJB7mO;vQ<|#LSnOG^ z1A45z>d+R}Ujg&1R6W|ldK|FC`V6ql8a)PWVa*4uv0eroZMDSE7S_{%3G1A(XbY>Z z0c~L&3fOM_07a#{Ed{C!8B&_=veP7`#X^CWA%Y=o(l#_rN|I8Fh(%B~g2-^O1OY{M*&rey2+CCU zQbbS?5R@Uv|MT3vZ$?|x@As?z{1@`%?zwyKp1XV2tv7vTCjtA*;vz5>vW0*KS^L%) z3)w6{v+O2dp=?4V#zJ-laH#ARCB{Ow6R=daG74iMdpa6pA=?HxQC2?&qab?@@O9Z? zz*(~HvFLx<62Q5#YH{d)*#f}DvZnFqf7u$q6|zPN=zrNP!1c1K7{|@BuGkaYMKzA~qBc(SqGzXg^#^?2OAk29s~+InUO9ksz48GUcohOJ_9_Bg>NN~-g%?r2 z#_L7E^lG|z%cJc zZ4`pTdnv+0y_W-C_a>Tec~ky7EdPDH!`M%#;?n{-tNE-!Pd4*e2h3AGO%QJ9v$;*6 z(8=dxg!6np12p^WM{1$Z5kQ9zwQ;BqjmvPKFY~< z+u!#Gz=6Kkfj9du1uXRa8PLJtP~STU5BL4GjgK(e_cy??zCv3+Ax%LvcUKV2nF?xS zUj?}yi^ekxIz)qHUf7ePbNkP z)rI=12%NQS3fM@{0=5*o0Y)>}mO-^p0L;_ESilTnCE&Bde!y%7^Mwlt+W|E=VRbTb z0fQPDg}2GD%9?nNK|xO8a0WXuIFP|_ye0tut~b%6_Mtr4K7<*?!sC4GLTS>wEc^|_ z3%=8Y?^TU_ah@YF+n4gc%iuZSTPJl=5T=vjEx>J6RtrT*=Qs=^ybw(AV+PMND67iw zp#;Mj?8M+e21^;7%iuN!&oTIMZOVV1L7^ViqH0JOJ%b||oX6m{r>I?>B8Z++2FaJF z-|&*5@9DkVm{sCC9^c{kh8=?ap?Cbsge-iw!M6k7ZSh@-?{@fx>BBoWagiJh-vOgg zfSu$e!k0pbtd^`HZdZ1Z^_S(y@^RC#NH$&emTaNyL)mH>G?DDI>}%O~vTL%t`1RYW z@_2a<`Lpsd@(<)!<#*(vUQc;xyt;Yy^U`?@_S)pN*Xy{~S+5&j_q}|*@d{{fwRd0d zeD7lKDc*~{Kl483ecJnhcP*bVpJ<o)k!-;UrzjnEjk%_D_wu+AB1 z_0`rhItjwzwr>Fr=s@thfH@SdLvYX&1fw5+7cjU5!3&)zPpkHe0KaRw6mUp&7v{HW z6h0cd0&qTq;Gb!HmWm0hP@dhUIy?wJXe@;#6^ZIBlGs z2JMN$EA1$M5UYz*tBKhP%(J1p0f$C>4!Et!VZduo90RmBI0d-B-q(Pm z?I&w|hwwW!e*omAwX8{)d8|)*`cuxC{x<;URJ#or+Ta1;?)n5922g*tXW_CinM%No z4T5VD3Eq7w0MNZZE4J(JOC3?WI%@x+1NB(DAcCqIwN-K<7&Bg+CIFO!n|u%s0hEKM zh~KIM(i(T)a;*PRhI0V^|3x{!kT?S9D7s3~X zK7ilh4!a!Q-Lrs~al2S1d=DtcZ?xzTz5*y0uHr1RO!yH{juS@NfY${h;4L8+@MpmU z_=}JacpLgh2A{A1;ZT_su)1t8U=5ia@G)5tU_Dte@`M3mTx2B(Hvq)Az)E0T0OeRq zcmXg*_99@cY$Wh;fN~)o)#U1_AcOX*+Rha zvPFOsWJ>@i%02*`gnRZ+317>b1747~#F$@1xRr1T;TWNYmlCj+S2SQ9uUNpxyyAuP zLXv!-e1d$3{9Adv*Q;I&y$*V{_3rL%@E+;&n$JO>uYGR%q*-uVRhDMM8kj6?h)noU zmNpE#0Wve-a@j<{6|!4^D`mGvfIDRUUz7=}W&KCt-kPlc7~GbWodR4dyAQZd)^4l} zerP7(23h7r@Q&;V;3nCr*TFlo`+!?yj_ES|*0y&kGbjT6$?!?WOC4Mo!nXIdV*jQ* zj=!%#fK<^Ry|2O_-{BNtZ`N?d=xq?M|Lwbf?qV9@DeB87Gx5_P)xC>=uSg+@!NrH{?z zFm|;Xj2*JX1eM)xEXXpKWR%z)#sVG7%btpMJ=Lqwpm%$WQu>%I25YfBNpCmmDDGKI zhS4^}l+7wKv*dOivUNI*$zEvIm#EEpyWRbn?lz;{XmRKrCaZ;r*TqoPL_}O7g*qD@ z8ofiWwiXm3r`>8J;(1c4Wr#K3sMed!S^Dh!K6yq+#KpyFBQX;RmCO5MkgjD;7&@1BArg@UW-!bR%A9)g#(p>+G@!$ zSrp95~AaylVTEMlB1N7>bTfAWps=> zHa;pr6C114#HbVFlOmPT+N9`c40W73HYQRTpAZ=p8>3dK6SYZk$(kgsDluBAQDLa# z6SVP((Kt4rtd3VIla*?9LbL{<1XW@Zpf)i!QXLta7?q%kN>(LBySFI10;SPHVf62G zw=yy+Mo7?VVzh~gNr};MNl|gC$V9CM1t)5wqvO=c@v+GWMY&yAtp*2=T1|cB*}3?J65TuQjT}e8~=OsMg2fSB(*X+J{kXLSQC>Hn0WWfOimC?cJ}pXdBv-|9-SDKNZMOy2Rl<_Hg*u&b+?&@ zfd5iSD;G$bUSo9VO=f!sA+29mm7t1>j8`YCpkX7E5;W187)Vg0TC3JZB}XU6s*>Vk zqT&-1R7rwXtBguaj*N*{Mr)Fwu%j?GDrG`+v=*8=ERtufg0<44HY%-{O zs)g9dNTo&@l@OvbSJv2)ne6kg*Twj#cShqJ@r{xCP&vELPk#k zV_sy`>6}?b&xTwGR=zVJ4UFVi7!52*XLrB}F+3s_&PciZWE9|QnJaSHz(`u4lOJ-jC`ieXvEv`in1N>9$1zXy~SWgvoi|d_%IA( z1rLl^LrPIjPJ!OSGU*J|1)iRou8%RxiRx;~wps1g9EYyA$zG&4XE=%sCaXslC~>nX zODM2s^8g$>K~rMU7nri8QF8e$_6V`L0{1DHK4$8Wt79HaHW%6Rcre3g%uj+NSFE=g z>?(_atdpP>znSx)w=kS8TMQ%_G5!oCc{xS{I?Jdp$h0za7F-;=80LNoNgO#oc2_zJ zW#-we#i==Jy~V-eT8kYWu7CGCG4ZfJwR>G394T8#G;EhPLW@ETaW@8G7HQGQm zb#`h_H>1&DGze){y@6%n$y(=NBcqFv7(LEsM0;%$oh;}vX1|?raEQsCM}>n+pk+-t zCPZ}bt6eczI-|{O&CW+kvdvn6W@Q`Ah%lQ(_4NXqnQ|@eD7y=nQD`}j+YnH>?S_TNt@W^~Vk`k4%(X5tXgNtmL-LaU9a(SnIey1|QK zGF?8E*uFfDhN(Qx#i1BVcy#dDdm0B988LG+Fx3W%*f5t*4 zcd3(2g-lxsbRNUvotxSD#7v@CyO@~JCbRI65&jf0l`9$JQMJ2GTOlLlI)=}KIs(T#^@?y zMSEE>0g@&OK*huYHjm{hg{tleDr}HN%rw(;GV@H(&J4lX(E@W^o?*odB#Fsj7``F_ zjg@T_G}f+q6BM9@xJgvgjQJ%F6AU7&VMZi|)UdVCp)4B3}iEJBpf+KQlt@`Jm}>=Hxp#TQZxZc*2&3Z?`w2CHn@d8Q%I z6?iAE(Vl8?%jv}NI^2q5dY#2xC9tSy$D~C7j3&|8%aU)w0)hL$5SnKuUCS3+Xz&To zw6BrR5GKK^zuVQ~`4gK{bXU(^OzgFM^-kQ*X&NG6sV`U}b&H^|CVt6^PX&j0V&YmOvzC zp(5G3kvOnC%$iSbglY)pF|?K=c3zUn;f71K6c#yLS+ett+4;l{?15CfGbrkINT3sy z3IbqGSxy~WEqc@{lAxwyNmZ6#@8QfZIuw|2>#^2n6na8Wp<9^3Va_D_r4l2^3}PRw zRQ*mK>W1?97%P%Xgo&iKpwLmm!jzLtAXty_1|eCT83t#JvL$2Pj3trAaYj;127}SU zT?>{fY96O?6}i+E=N_~xZj{V0W=xQDBE}_0jOuhK40vYg7AAcqDu;^rhw-AsOwcZN zLS|Z>7=y@XEFU>#tSt5^$>jvhQmnygey)Q=}gpEk%M(7 z1w?-%i5BXF-Zc4PAyL4Y0%HhW7MX7r>}+JqdQQh*oFc)w=f$xBWii$eS5&NvB!X0) zJ;|6u&v^Llnbr)+%8&r+HAZ{3%~S{%(uL=0p3z3`xV6aPN~4C6Gh%~Uaj4;p!CVPY zz3kgAYG_(`c9QS57)=@+I+sLyYi7sJl!wc;FmbFs5Z! zN!^N^ffVL^OHQ~`EkRF!P&P=yBZcSD$<#{LuRM#MR_=Ka9w@onJfbVKS+k+dAln?l zOgs;YBg`Y3qJlym;@*jf<;2@~OqxeXF=!?pY}Y}lV@glz2&ggx8+z7UIF&p?(=Hxj z^DZ9bDqEEUzl5w69Z^aIbbZaiZGPPFq#&FDx11ZMP}7KQDe+1%FQK}>Uuz$5oeklo@i-E zM4@y&fyI0STQb+1T}WQE(ZFuuClg;{EwR z32JL$iOrOo=a!^S%b;RWuf+`u8=x;>dk(HbQrQfhWYUFm6{%3v6Z0E#mr>X;UFZZ_nc)Dh4qg;S(bs9ztrD$%D&(ZdeH+6sald7I zTSXPpbVY8PQ>@%%7*lZ_jD~@EK`ep$#4OldZ=eY`3wPBIbuX1!7@lCVxFX$1ddv(@ zt;w`H#F#i-+{cg#%s}C0qo`J?N1aPl;>6u8NfawLj9UxDDGC+AoL$E6tQIw_7JTtS z=m#Xyx&e(ATM1;j?F1ccR+J;Sm54d2gN!ju8mh#C4F6`0(&q|XJDR%}*=Sh?nMl3` zT`ny`>MNifNE0m?O&{4R24g6v10}6qFrKQ2#T2vLGKbSdiynq^#a5vGTJ)>Ot`U?` zu7!}Djj+&mYmqIRRz3*>r-BENB!*HgcB4&-WE5rDc?JWs^7IURC~ljiNr^aI@bAa~ zQ5H#^h~#N(`eH&mo5p4eR$#F9PDo70`q(ILH z1fT`;*x>OlU?V05i91{}E+SnEGa{n1)oKuf-LRK02I0C(!E*C8@&~0yx%28dgDRgU zPU?tz#U#lm7o(yqGN~0&+=Ue*H20luPCs zkzsR55mPd09u^=B@hN%c9OIyLLQ7j=v`_@MK3~vT#62}9M#>_JZ8}!W#JuHFQjt<& zncpot4Fr?|-6zV{( zftXehgP=$Zb#_-$Fh*I_15mnHJdkEX;?9JK>|@gx7E1drZtJ>YvinLnJO>(Ia=

`# zRIM0w?PxH$l`@GIRg89qSW798;ZzHp3M1x$Y!r2H2iW|j92)JgIm+YQp5wbHObb)77a-&@ff;#f3;YL9z2yAfj| zZmU#$y^2&!NuNB-5owz2w&)?S)8l%D#0NZht5S~M!6Wt&kCXjH* zDmY0Ti;0hkcJ8snW7ItZlL;qBV9Npm*@JX8(GmE3N1*L`tS4dXSR6f}HH;A9__axwwHAxLjI(K`5cPSXCmy3IR#xvP1g?1hD!q@Af1cB$mv~3Heux)!*^?4NuHa#F1)*9 zcVR0EPsKDk80o^Ysw>sZ9(JbE2bdr_)%7FtyXi?+A)>{Ec-Yubx>Ddcx*}3@T$l{( zA7@&{ikaTZw7UB|a7frTCg}uPsc}yeyS%vH(+Zc1WrNWq|Bbt3+%uu4-EibCu&i!4 zw>5XhCMUs< z<})7@mdDGq@vl_=7*-mGn5ZfhEtr$5;Bg=t2M--O?0B=&(azJZ;sTPp95S($@UYK? zB~k>(#33H(HmZbL$d_`Mx)y`nClw>?42&~u#(WLdAIB_26e|H6f~gi~p7JpbiD#YIQYZ?^l(w4KegcNA!ZCVK0f}K}dk}QvImY!icq2GjA@QMz({Z*F zW1Q{8NHLrwl*9YByOoX+fM#gDLUz0Z5n@)ZP6eiYC=N8jxaaVv%fkBr|yqIElN`|!XCmru|W`IQ!1sM(*nQJ@E?_q-+m2yd*D`RvbL9H*;vmF&Ie+sS{xd+;{kM4nnll6NSbclmIxQ1=v*#(SlW$0Y! zV=2kGCuC>3xe_!D51Zz=mP`1R7dz`ZIyA(SsaWR`4e<$n2$;Hro!jGBqh}P#2y;QP z5GEhu!^{KVVX!I>aGg#EMwsp4$Sf9zl!{XlerS~KDN#13J?2JE#Ea|rVoYbpswY&k zWZTiDwAcil3kE_@l0ASAYZvqcvYotYhpmj!>1a~{15LX~Oj$5pW#_IEc2C8qIQ4OE z3q+9RwF_*COJXwe&rlz&XMsyBW~el-_|Xztk&z;jQ4&Q@+`QM3eTTg3$*wznav-3H zVOsdangTSXVdFzOx8Oqv}#&WQn!>0*9UE6>bao?r0*{BP;PIYY5XebgUbUO|y97aEqN+ zOjd)&K_{{URt$!SNBYFpF#kwOg^$5@hqzNHP3XDwWLjBm*$ya9w#O~XmJ2UU@?97{ z!)419;$Ajn!fr$nu&;EEhr8O0@7!Ex5sQqvidfRf6|rtAw_+mP3@j0I_gXBQyYsZd zljCr=q+|m!@=QSL*ao|}#3F9DV|?uS(NP#q7Gj*`@|~Ek1U-RNj5*UI={B*mgiJIX z2Lpsu=3$Ew5_i#mb4N2_6|>OVoft%+VhFyM6q3#au`$P{0oM6)ongd{**Gr`H2fSJ zyCnnyr4Vt4$TWg3$1Ngytj;t&-!7NpBrW11B3Bu7K$n>d=F7PbAQG30D3^wGLz>-> z8@lkKwvcoXA2MD}<(srT?U55MjF(6SWY9?u(Tpy|olb|-Z*h6_T{76|DnYFgXKT1} z04Aa?wn z0K^*XG(nd{)+vH2?95>qLx6n*OS3_MB4MLOcAR7olOHyA?r|DnruN)3cpw-L=q*w@ zMSEEaxhghdT^#c%QWSKumq(cHFbR|eoXi98yeW%&o zrHcqgoQSfCIGvTv>zLA`{b50}w-m+^Fyjzbb~kG=*X&#kx~l^b17R~d#4smRjPQ!2 zlwxdBqbz3HVD(AK@g-dSP*xEeDNHMjLs^HrMfvgyPeRk2Y8z)dhq{=PE@#nvaHurQ ze5sX{tAy?|BT&Et&`(*Fgz-Ah_qt6PaYfJ>e%R zm=+bwWEIdp3Xg;F#o~;N0BfO+xxF}Y=E?BHXPEHv(`Zid5FKCKyC}k1Lx~g5mSLS( zz8;=rWCy5)RBTY0&FMBC!y6xh?0A2Y4eu_|;|(Q(D#I-nj(7H1kz&VND=Y{(@NLIi zBMR})if1U!pETfoC)f_cn<@lVCf@O9V$WES&xjm)AGu2&!Hd=)o{KEtvln8;8lgdZ9 zB;73~9Q2xzLhW_sk!UufEG$N_7KP*4JjAI*6e1dk66ynrhogoZmL@$zedVGEt?Z~4 zpO^YVk2KnqYKR#GU`C=ed1dW!b=d&Mz>M}iBLX7 z66+C*QGSBOBB30|nT?o-IoNNPrbST+rdRFi~9=a#NcM#UyP#`~VPm-^EJa!6i^ zKoB3(a1d6+xTruJQ7%tJJQ3>ZvyohQQa?o6J?bA$>|MlMpQzAQ#KQ9|5Jvglwm zg6ILgKwUoTpkhGEOU=#(jz+A6Nn-@U?wk~kuJ}`>>yz9{^W^o4T7r7Q!G?^6ggA#} zg1#l$BEFQep^yts|jtx*ti zT|-XFG8<*(u<}UcUHM4?^Cvi#_mad~e?qA?(z0&0q0Lg=gmEuNXw4ZzDm5E5TJVo6 ze$IF_V8n7IG+={0`zG6?-4g9m-;n5#G;@f}2C#$)s-60X8w!$lN#(l?i$@QZPM4Y? z6nPy)dfWv{K~~&+<_i44E;p z4v-8Jb%R8lyMRj-J%uu)CK>S>D?aWt6x1YAg3U{!B?USiE)AM-(bTzfjmy zp2 z;Bl#me||X2H?g8VBXi3e%?FC>r&M%-gVl;A7jqiI%Te*?JG!SwM@yYcN{N`7I)>^d z*Og?#Y0jUmjPk})tMLz>H|-vCB0MLVXBNhNwd)$l7!9OK5zv?R#*~na=geVC2yJ6 z$X!cvdB844&(0$!m2&gWsW|r87(w#Uc?U_88lsu_;E^L=Oir+?T;3w?Gw?FFBgTCU z($-v&P?^N;M7`&@d%Dq;8+x>^qY6**`2x3(uHK+hiMQOHa>*|883+l}PAwYduA4Xy zJ<189DFQLBi(PrcB)@^Wl{bo}nv#&Y`x34vDMStDUCl*LDxa6?(ovGHN!=t(;H2S3 zGpyxXQ5j1~WpIO6z(keG;8PlR_K{qXM|OMZNQv9akD7a9ia{(_e4aCUPJsI?^Le}_ z^aXSU@gs4^pO_kyPWx*~;G#h4vZA5qjz(pR5+vZnz%*OJIM~aN!=sj8V(_BhB-UWA z^CkOQS>2o?A2}9@o&xTvVBN)?I@UEjp!QjsdXq@Fw~P-?28Li5`%(=S&K^zR%mlj7PK}k3X@S2wC)-( z7b&ETNCwH9B=t%mZb?YL(3G7lPA;Q^uVRpU^@daoO%9~>W)~4;)!n^K5)SU&k+H+^ zH&jA6GG&q)bItNxJ_B`tWas$`H@E$~QzToF3-%?i$3p5fx1x{ZX~El|PEy$w=h9RH zDLiUZ`Jo_MX-SOeVQO1={FluB8&hT{ZG3Xj!q>m7Q$z3y7i8YyGMS$bKuApr1{09` z0)&>15M5K{Pr%VojARDj7>kcFB;3VapbNb^&Kd->J(@$*AcNI_7zcg@fjWDF5f;1wYA z3sQJ7j30x6)nqaXG(cV-LFQM@&xL6q1S;eqr7LQNl#Y}6`SLHkzncZ{p8ZIfOjfOd z;1eK2Cckij$^kmuOU9~K(3iqT?kA_(siZX_rIUO>6(Bvc#v6TL3JCWOHPHhgKmqLf z5QPuH(xoA#n>qAXD5zoh^H#|H{d^Q&{;UuDQ9M2A=jSiTWuYTgAtSX_1Ro0d(T8&S z`32x{-*zBFT^iI5mevbm*pf--`5viibwrXEvs8DS17zg zG)VJTARh}=Qv}ur6)cRRSw24>R%FR@%IBe(3k}%Wa!R4 zX!qxSQh;(+7rfCKdESCd7KTu$0mD`Lu{;=oaJjs?P_4QQJsDcM69vk{kWCI|!w(vO zGlCV!x&e=%9OP7hPpacp{KRmjBT;oQMm1EA$`0~8vQWKmxI7>rWH3Fr1;_vpP&0Jo z06d5M0sa_T%8jzbrven-0U@QO^3c*RLlg=GM~659LWUw5T6&x+3=S=wS3}_w5FnBw zJ{M}B_6LB-01}6g(r<~Y_Q(PlSDXf34hEM82QyCi79=AJHD3<|8jBVM*Y^Re?-LxP z@Cz-y8dB)*?=SaLP`UmDAQv(u)A)iBL-ip>xjzq-elD*Ha_;&D1o(&QLk*#&H%NxU z>L{o`LP~cN;q(BjYYKJ71L`4S%H35I3RaukA52Glt4AM%>g%JL`ab?>DN>Qf9=%HJ z;ss*7`~ZUe@Jri%a$hfWB@u@wf=L81L?PzT(y|aUAFmK|6>ux-s1P$Dsmnvm7%V4_ zca~ouc(9N?8B$n>df_}GEE{?;m~5@AEXhYCzm5v07MGU@&poC^fUf^F*HS?MF9%0P*Z5>fsm0w#1kWf zLb(!a0G2*bGh}24^p`JJV~kmWV9d%A0`YL^k&x1bA*D;ebqJ91?H)QD3c|J@(LKGOLx*(_CM-rEYcTfQ#@I*kQTuyqhS_4^N0ChERP>5XL&kIH) zL&H%U>P4x30nmd8ukrQ`9VsJ@3&XeHx?%l$*Nr(h4nKp+|GdTT8nLiyO8nwM1m-&w z!pp{m7G0Tbruiay>ty_BLR;u&&B@S`$xU`;9BP>0U02qy5W>KSr;25##)ci=HffS8KBpRh9vR;Wt zjOq*Kxp-$q3e}XzAw}prJPSp~qYbfWPb|oy0_Z0?&_q<5D3nf41ug;0Q8WYZ4Lr4m zZz#7%KKH^XhZ?Omqusol+M^4NtRJWw&8&>>h|>lot$IF<)DkT7STRE&ccVROrKTnz zmWA4LP&ZzykC*{?qOWvuSN0?=*wM})tw%)&U9h!D>kTv$cl<+?W`Wjd)E|paJflVO>nECnSpO|FZ~RYaj=+!R&^T4b8J>LiS8&E3_V=>N zY0rRQ(Sj~*b`v++{w?&*l5|A`X5l!u2;Qx%C;ty*>`fPC-I<)3u+jD}p>3{R-~YGYTLhd}>I#xpJxg>v{1H z?ayl&7+EsFbOPa@>8n4a>1}tKBA{Pr0db#h&o1z!^Z&;B{Gk_A zZu~tZsXL^K*8YhH{xwqdrf0uC+Nb%m~KKWNt_jmB$?~muOKFqjC43`9R zWB;A5b4|La>wbTtO=|^Nn6}bnnm_MZMJyK<)#%S4q z9|Pu#68|iF{XKO4AN1#nNA+hi`kC)l6*Ixj|Az$k4|{g0r)u^zbTkFy8~2Y=GoG^Y zcdHqV7Hmqpi{bEUY3+wjJkb#ze!PQL4{4{7Z?(~OA?+}lfuYVP?~=~AM@f@$I&wmb zoU~i$eoB@k!nKJ?`*MSN0!5C%}nT8^TfUpuC_|LjGV zfq(a`=KULsvWp@*fva{&+(N zHPaWaV+5Y}R_M^&s>R~|E(Sp1e$7cTP3M$&mQ2%B)QcfgGWc^++~h#7)bsH zQAnFl?mhOuQCQii5!K{X(()7aJc%sX3R;Syli||gAX<*3v1B8-KFW{5+>amZ6T!9;TEI;!ZYjXk+40?&0tUfNXTBS6CQ`K(kE#EeCeh%yR4}?~u~es8=!yBTM5c>GI#Nz| z^{A^WvpVi<;t)R=N zKA3!fco!2RNbDRT4D_tJB5-J zbWurU{Wmv(x_DON>A_3IOESW_QO#71`Hb)xv%8Zdz6djG1F4^&3COzd^GVrvt zo>Lgo8WF;CT2XS{i{jT-Xj~*EMQX*hJi(=gaMB@WGWV6;*Rx5*OO5{fuY}}KmBe)1 z@%}SlwFqF=cj3p^F*Wxg#SJLSJcb9k^L>RZi zo>LyzH0_VBzExa1@U-IRn%Ch9|SDYGxW(`GVMbVo|c<+?2IPI!dS$+K`z zMIk-hiWSD)InP;3gz%4a2`vNBJ4=Y0>6YGb+GBFyq&NwH^u8~m*5%aveHYjIW?-WB zcf5cjM_ONTsRl9+uD4A6H8;dcUz5bkb1dEcde??n21nELfEOwKVg&%i|yMmFo>#lFZO$SO##`5(R2B`y`hOD06x z*rhcXk_4LGNh{mZ(jKi#5|@HQC#z6}r;KppO6fFps!a2{-akT0St?DMW|2=x4WOZ> zcioW$@tR!=Oq8P{eGvk?hT|>6WgKrg0o+p~oD3kGLP+r*O1QBNamfn-{9W(pT_0cG z4G26z0Cy$@Z`=YCyyVoq0(A(`fA5D6y##rH;Qi^thcBW&@9t0Ijw67t-&4p# ze~2mk0KB}tgLzaYN7Tm`&pv!8fB4XQGm+gE^vG)n@|uFY75YKuCHE8LxabBfZevyv zDK%YFUvrNGA*sCM{9siA%GNkNGkd?(<$yWH1D?i+xZ0k^A4%Ye$mwN-u@k_G5; zqd#HTO-jnNQ|^mmLkCioZxfhBUF{32$>ZX_pxBLQG zD%~5Tyf>;*W$rf)smyN)+#+y}z$pTk2wW#{fxs~WcL-czWz+pzcEOF>9gc<-Ff?wO zQJzTzmQaOL2<$^1liZiOvIL(ZUyOxxxi}R8ux)TKAwyGxaosXFILue@0t{2&)-k@q z*v-kX&`eximdg|vk8pu*UEqHt=pd<9Twq4wsGgNaP##LRXXT-p z3c(9k1Vb}Hyvzp~1XP#_zQ)Ml?lN7D#cmA%Jm6o=pBhk&PvUXgg}5KjMC&DfCEaf}9eo$%#TD)1LsY_M#8EBSl6~j=O-YQ#SKX+00NV zT#izBBlKWE)Py< z03#wspbT7ix+u=>{Q9F6JS3s~aM>L4>41yT1a74!i$9w3S~qfo2s>tC6 z)K799%my@6iqds=sw51zSE;`+hUh%xb(ebF>qjC)0F^`j{qg0GZ%~Yz$Nv6A3R1zE zuodhwI#7@w6I~leQ$vdsxTcTGu0_D(+IVOQgc|kw;f^fEjfTt+g!)|GALJ@6qr7^g`m^XxiVj3H7*Qxj zhCI*0yMa~sp$ImvQh@3Vqg*3v`pHD&*Z_t?$duQjpGN3rwK#twko};cU50$HANWJQ zy5cL{EBQTM;W3#|lV1KDZlE9cwHDHkV}v{C=XQl=GNBPm!mFeUtd{UJy(PCupKA=q zFJ{^BzI25AUtFneg)SaQ2YC$dPBo50(fuWJ1-Lh{%ZO$Y^C^ zgfc!dDpCNKkipl;gpQTdCcdQJ<2Myswxc(av)_Qg?+O?@7<9TA6s463o&J+T_^Y<* zr(T?;#0x@zOz_cYlX`V#w6UK1Hv#8uW|62c3%XDIi=%M36!ZLU=9Uj{$3u%XW^-3P zelE4Zo{dg4vR`GUXC5{|8LXN$fyM7N51BLboyRUIt2a)+wWxJM&o;3KvL|;~v@^Hc zwdljzS<}1e3K!hVRLC8J=6wS9t z)M=*G7h`WN3HI(ZzhwTBL(0th$CH05{bboEF}sf&H~unWZtw$t-)Y~SkAL#YjHz!Y zZrR@~>N8VWvnTq>8uj|^)%riRZCmT*ciyW~uryThSirBvJ@2OvZ_@8j&gc0#1sgxV zlu_TWf8RmNK2CaRPEqR5i9Hu)FTS{}M)31%?swe((S$ctBcJO3^Y~})+0Z1r+hjk9<^OOu&7Nn!_uy6@2*`q zrt6kNkAE_%=tA*WdD8cbHhILkso7%KiT9a1#@7KqVJ6WaOZ!fewkauOy$%b9z zAK!j{?PsN@6K*|OXX3-|TSLBG|LVdY_cu?QJ?8A4>DNn)uhvO9INJK7ZsYEjKdk&{ z(vT1OY~DUM{IQ?DuQfLLyguUOuj3k8um85;{1?v*@3k}H#O|}Zei(jaW!LEo?rwT~ z`Q-YW%W|Ib+ZrDCynJf&WA)yAZbZ8wyRVIX;iJ@=xqXJtGl!pP-E&O6 zx1PDa#aCTt;;IyDi)Ry_JasL)`!HMc^-u45V*k~Yu)JpXYd4&%54!!)m%gQSEr&no zeB#)t^PRWH9JskhJ>-Sk7gq1NKdolw#pfHJyISQX|93QwEi9Y9HGW zSh{T0@TSp=U#~sp-EUUTO)me-$+(&WqU21d+RJ&5U2nA)-ZR}<#c-`DZ=L4)Q`e(Bj-FaP{t z)~22bPpxP&d*%C|FZY?Z(f`W9pC0x-@$xe}w-w|K-uu`W4}abg`1Eg|efZUdC*IDw z)~k)y>yr;|_^k;thxTuGtZvIUdp|i*_w`f1-hDBy`tH5$4VEXmJ~eAb^0OTR`>(G0 zQJ)=4l%{O+%ULx(t26ZeuS@L{2Go9UuGhOC9$naBUB}nQZ%&Ewe(Bon72{_0Xf>^H z;2X0Py9zI*NACD0Va79e4=lR+(;`{+K4HhvPm8mraJK0a@&V``s(7cbtJX$;=h$WoH?VfQod)_rz~&uEn@ zCbCQ1YorN`xtrHd*zN!RkITzK`^?OGHR}4A_*1(4CL0otzH_bFnw{g*{a!Gf+hUcC zksV$C(N|qg9~<;jbn)49y{l#Soztgo_j{2GFV&b+?cU%!OOtkQd;aW)i$2X&``L<` zTEFeqD(I?g^&XUvnA_CJ>Ns(t>_@LenRbROo{VR_WtXLnDoQnge{Grzw6%*$hDe%t=wm{*Kz&b2w+Fa6d19h*fLzf$eO_umxv?HP3J zYNx!9dfb_Jr{(n>b7rQrhFHbDvvRJM7{!>zCYWceZBQ%inE3c&>DWDY*6C=krsFKbc=OXz!;*+}dwt$_t;ovMJ^I;4`h$_C%K6J=yC!ZT8!9JLcd0bkyP6d2t`xs*W$&8$aN} zvhL^mcY2uFt;wuQzu3o4SXS#=e62g3Uh;nD$qt(vH@y6~YG|)FmLEMg;jM(UkzybiDmV;A;Z7=@v|M)uj)S&uyWq{3k_=A99gpX>7%B-)mH@=2OHh>KV(gpZs$2@_SQrdo*0KV&AYYsyJTPZ^*gf>vM+WKYq}5ndQi6 zuV=O<%TF!#SNyPjukWhile}N9mF}~?NA=)W+a9d?)yp%3&R^?Q#c=mA|BPwJ`~q6d z4rt%Ge_-LeO~X3xxlq4B@%)C(>kn+OG_ZBOxAa#Z+kWhAt2HuT}F+tuG| zx-w*Hn!Q?$e(h>Diu|p{u*vIdb-ggG_POM)2}hrLHF5H5d)jWe6WFHRkD88wqhIOJ zv(2`4#_sa=eQQ4#XMN%A__$9_#LAY`i5dM-ALZ&Vr$>IDe>m#2EF^l$xA~11y}G2y zZ^~;=?s>LV)3mNxjh=sU?h{YEaWTB+&Bl*6TQjsp!!sLOCJ(&dd~iUAX1BryxB6tr z>Zjh^{d2^J^W$4@oAhSk?eF>yUiM4_`y0`xY++5N6}L?9F~oMGwnO{YmqkNQjT@1^ z_URXE`31f3c-H>m3ml~-(;6fV{cNuHum_**dVWR3X7d=$h=Mcs60Db}+_RWpDa(KM zO7S3hPi0dn#BFynHof1b=hroccmHz4)*hDs^8hG`>*R3xd9((oj__z;#*wWwh{q^|p-##6G z>R6Thqt|kle6{x2wId@}wffR~LDqrjFXkQ`RCw|5fX5mis`lG+JD+_0?HwapoYYrE;6%zx?d$I~x`Y+Jm%>)ts#U&To6*?l7wD_I8K&W_*xonEBK9PfXugdhYc*pKhMB|HBcpXH-vk zdtS-CcN$yEW>xnoexu7Km@TchA;lY zJLmnomIWUSANs?xr$d`B4_#{gu*t3um)041V^QlLqTd_Rt7w6$}8y=BJYW#n{+8P zH~RjPv0nN1)D3IKpV>U>T-cTq&-MH0YRs&yB>#BPp4Bd?@Ma7RA7@)EP~hwl4VW`4_wV+~w#w$2`B%fz=xyo6@P; zm5;}Me(|*{^-Y}{HUFT+$j^+ujRSIOb=r6Joz1t;Jb!Hq2OHbI)9uOIXCHR#pJR}j zfBB-zi9NF)FMWS^!;T|{H|!`;AP6%e6~#~KgMZxE!~c!CI|>x9-WpUGyDLUawh%GP;FiPpTbuRN*TQ2<{8!2 z(Jvf1@z@U+P8akjJ96vOmk*EXJ!VwByvnY|mjhRh8E$PIl9t!^gZlc9+qcSDJ4JPBi0|N&vd!U#X0@pH z<+X7yuN>U4Y_0FY3m?siKC=GO{5^`HF?WTklNbBXs52}0{HCBmFScr5;5XB3m@4a^ zeeqV0{QNAvIqX=Z@#Stp)=yWb`8#XNCu-gtet4oW?Z~fv^{cvm(W9)5L)iT8*O8l!s1}~>a&-E!_60i*F8KA< zSBD2(HmUC)x5Olm&HeDe`hh3xt-Lkg*7u6mr3JjdXL!)*c7uJozps)%S*=>&)>p!- z>}gV#*Jt(1)^PtLIUD9&(0>tp_sny%_8f2i#H<4=)+|2yY3=r_pBWjnCZcWsE$cos zZ`>9>YW>xN_!g9?Hc z_Zu`UaDVWHcOLprdvci&uyVHI1Mtm3>~F12=7`C4ZuIQ=eX2+iu+1EO5)J*ZQq# z={;z5|3wdvZddL%U&sa^>?0_10E-Yx1Gjg0_D7?Ye8HhChDxWZ;oQhhIth`pAtt zt54@yMxAK*d9AG@pKZF~m-EFdti_$z)w$TuZ*1Y9st-SF>zmU*P!{rVw((WdvaCCY zALi?|`^~k6ejPCP$3sC!Ge>!M+rHW>QQtIo(d}9T4|MHpNCk1+!DXlVeRVu1 z@NB2+ZI8ugEZe+f=j=^qUfjQ`^W}$Skzqe=*)o3n#?K z=6%j&ew2H>QN*yE)$6Allz(B3M3;gv=GdVe}YmF_qG`0mtA+YgSvbnV{WxgA# zlUt3Ny+3T$m>!|qyHsm*JmYZTt)Z`}uIYOnT^3Q}Vp;srvRPp>MvwA&W>&qI>MRl7 zI(e_viZ}PhEg3MN_+psZ{P1i?)sfl3{XU=Hc=YsdYR;J$p1f+2zIe&j_s(Cs@!f%& zml}^c^NDfQ&J*u18!+I9Imw!4`|_=(2ZckHxn)0%KXRfT~;l9z%^a4 z`Bw7h9gi1G4BqZghxWTEZ>0ME<3jVtrK;j%osY)N^u5?>^3F10;poxzHa|9AHTc<0 z{qkmADpnsqZtmA0y;V)!h`1_mx2pH#=`f)~s4#0ohH}*0DOt-V9Ly+tt=7(4r~BNx zw&V3h+pm2&H8Hru=*$zen7t(&(e-x`fVH9@uEo+TDe7-x;UcG&*@eBQJ$H;jtYZYbsw34sMn-D?Qh1 zN#=-c_ey$=+?$owaA(5E=WaEc_0FQ;)u(3Ee7~NM`E5UC`u#VuvW_0hDEXpx`uWt} zBkpyd-sA(+JXC7>8bnW8tE$27a zxPM?#P{&c@n~qpDwd01y2MX`h+-qu^d@*TQ@q=f}@{Ol%^&7D>-aq5VAqgqBS1$8k ze|=8qyy$%$$J-t>o<`orY~lTVFDRNMeWQ4F^1a|LqYc65QpWgOch&XZ8BkX5+rusE zr8nFiwry(fut5XTYcB6|u%^#jQK92&E)5Mo-cq?~c$qR}Men%T9d^gX{B*G6jXUWb zpN(0XaAadt!iXWWTRgX1XmKn1n^wvwe>d6>#^*18laZS$WM2Aoc4kuGm;qyCbqBQi{9eELYC}K2S9hm0>)ku$ zr8mpcgKD%)Uvw-gIqT5U6TaRCbyQHZ1=!?aQ=f`^;P#$r=7j`jn01QlUJ@@GIa^Qc5%m)YiWMtE{>De zzS!uCTj!T{8g$-w;-gwi^lWvu1#tbU^@#%4^^gC;>+Uq}MYWJnVQ|}GDI-}@E`;4Usa=f#m^sgVne%8g+(V` zZkwTbdFq@+FEt2Bd}+<;@Ck#DZk=$l-hhdj(?6N`+cVbLXG(9(cBF;A@$2@9Z}bSB zKIL`qz$qPeUz)ixdC1Iq<8Q1fZEaoC;+u)97Z!xBt~xJp<7XdC-#9RL$d+rDFKy8_ z(JVLKKe2p&Wa8pZTNf?<-nMmK>!IQEUS9LbdjV|*yf^okiQjd7KlHora&DZKm0oI$0y9we;hkE@&4kHMfc@pnqMciJ@M<4w?Fym|Fw7K@mOvD9^V@e zGCgLQGeiy<#kW9ySZl6_Gs<4 z8s6GAI>Rb2rof8tij8T!VT-BShsLG--yD}(>Xz8uxvpvF9UkXlULfPq+^EI zryA`rV{WHI_G_B6Mp(M@u56jjvYc_7%No2Q441GXj_mG?c8!aUp0rD6Zm6O$AM+K2 zd~9WeI7qexy-2eOigI`KzPPf{d*(?^pEQvYALDkf+4tjFvt#UK6vwLL6g~OV)lYEI z)V1$+YE)W8Yl!V>S){+hW>IEFfsvpv!|2*eO>JgNiFWHuN5+q-jf~+RZA61vEuz(W z3=zAE0+F{7B~l7oHKq2IHOg`rIm#A|vFHaiyy(iW;V5=kRyd=NYcdkW!Xh|rMV>Nxcam=$|Qy|ZJ`WUsDmbe30M>e z2hk@e6B!mfP*yT5cwoVUppY=Z%{7CQhsMjn$Ij0tKvE%0ZzXDLjn_I>#oUiMZB>=G zV=O%B)$P+`rb&X&XI-pb7Oow!PLMxqW{HiE&iyEIV7Tr=?V*oeH?%98(^kaArM+6K zdt=AyH?^~*90p8P&2-it9hpg-Ra|#^=*Y6F2j>gvm!Szmp&k>xGUUb|}dES?v6T46@c(^xyv(bpU6d@j7-WZQf% zml3f~Oit(u?WPV#Y2QjC-^1^JYQ1{ceAiWlEQ7;~GdlZTKXbVm+i5A6H~TQQU0Bt{DJ18r6`{1$ZPe{kM6$0Mub$#@ zMMwEP-!`5%dL(kF=lrEds}dge?iPs;Fr44v+-+(u>=vk`WnIdC@?(bg={cP>UB{ZT zpWbZ}G2Gg@kye=T&`i4Y5|cMDxv|`IbU1jvW7#tiy}djM-rU#Dv+D;v%HHtwTaA5# zV#j0*Z+z9c2&F_RH}h+@QM$(`*ErGx z1q;O#Q~JZ=9(q{58C-tirpMPyXS_7-u&HFcS|{D~>cJ=Gor|@_mxSZxPi(kBw{+mE z4Aa#K6FaiGec{M5fxv+}0x{ofj03 z@7h1op>o%(!E)R|+;7Pn6V5HV7I}-}*56`x{E`~m@nHPA-dUF~@v#QCl2?mIDn)Ky zIx5g6V6J*aPf(S!`Luvve|Y4r!m8DIsrO@dDX%@-DOvKsat-lC#k+a^=GR^p;?FOb zTuCRz+wz1O#znI_Qq>}k8-!MuxHzU}s)nmvv9cY%*TrM`E|KA4l)tl6u>Pt+kUwje zIoD0s7FW}*Nyc_YV%q$~q6x0F4UbAy-OF}QC`dF}aYv1aa@PyyDCEzLbmt1H-Qe%q zQe^ecCsFnB<;lcMj+U-7t>$I3e1jgzmI_AwNHdb~7kkHO&AsQ^z3IwCab0HGk!Rgv zJ;BwRTFT2?lX;Jn7D?M3l_~TeQ`jo&?00vbzPnVm?~`+TX>VhObF&+s)SY@td#4ek zu~X=p%WM}OrbX~7=GdMdm!p@BH1tRJ(42og{$$fOwPCTvpZ1n=F3oOTaBSYrU*^cZ zOZez-QDbd4`jbvtUT;l2Dryh(r{t6@9ORhT zU+>dEbv=~*0M)Oc3nQqPJ5>Kd+22vGfhZd}NuU69z+&J9VnH<^N&E&R0wECyi9ks7 zdnEcr5`7_wFU=%O>Bw0CAMr_3uomn9RRl5kh=K#K0Zu>y8ej)p#2`M|_tz7I3a&B8 zfIkNOG2o8@e+>9zz#jwt%Al7)FN0nNy$pI8^fKsW(4(M7L63qS#YqfEQ2QjIf&>pn z(TH9p>N+?l3jU+Ghye*UqSu=s0?=popbzhJCx~A3@BT<%0Qzr#q^$>wX9OU#0uWXJ zy3-z*F9x8`?O6oBj&Kp@ZUU|XKt^^WFM5!Py?XeK{282};2^q@KRw9sZiL;V1{dat zJ;?OljkxYJ?BiN}3n;&AM2``UQ*lDPdzZnTjd-iVh4o^OK0u-Ms#C{EqOY7f2YE3; z68-rIV=J{!Bl^BjF48%Hd_lZbP;UMxKY#qq@<-XJAWhvefI5b>=OGRK`6SUZ7rzll zf27MF@y(-j#A85$B=T@x9**Z>-yd=4hFxVh!t24`$ZjcI8(|JeuoM0MaMLJI4s?_U zopKRJI`W>5@}eVNbi^wOaZG}q1U(6Q67(eKNzjv^+e5d9ZV%lax;=Dz==RXyw(6yi!LobG2480h7G4x{S#n6kPhd~d6 z9tJ%OdKmOD=wZ;qpbtSGf<6R&2>KB8A?QQUhoGaL49Y{7hb|9Y9=beqdFb-cGofcf z&xD={JrjB+^i1fP&^@7hLidF33EdOACv;Efp3vK&w?l7--VVJTdOP%X=C>3*s%*9~B%^LH*0e zem>ejK91$n2|^YAR8jv_QQuTiUjyJT0PQOP?JWRpD-iwz(RKrs0NP$J{PrTSUQ6JI zx(TD-J_FzaHiJ}f1+;;2)O};H9aMlxY9H-sJE#DYNOLgia~}xC?>=gu4K4^q+WS!F zas7UC5D#hqJI*r)@t_8IBaJ*s2h#YRPVFOa(t$McD;-E9ztVv;@;@C&Bj3`2G|C~J zix@_O9QJ1iG(hdo0K9-7(18#T0b)P`NCIgf3*?ERL;{e24X^_aKm(kB3vh!OfCumb zKEMwI0K)Hr1$P%4-~gO}8}I-=AOHk`Fc1aeU?z|PGC+&kPOm6HYfy_Ksl%ZcfmvO40M1#Fbci^E>I2WbAp0)Xa-#T5vQ zVIVNJfgs{RHmCs|fE|3_avyr!<;}WnTeKl%m$=#C^h<{uSIBm(YP+gUlMRV;?7zK| zuIi_ho>enkAGEdVX4FfOQ`f`2c;>fWba|i7*2cc5dGGB**>ZOJ;buDzm|7j1lPvAH z>vdAAlI}yf@f|yd937u1Pb%1+aT^f|e05Va(n83(vd{aukzL7-5d+%KT*+<2_l$FV zY>q`4#?G=b&e)ma<*ME})_hREK*~Ll)%VRQd)5jSM&8(1aENVPXn41{Zn>pTo^eOn z=kfDgF&x}2DouHL7nibc8jLHq=*yH#EpsY)tMovO!IZ4psn+f5vPtQ#^6T8tiHgv+ z`l}l^ioU)2!Y_PLbg9PJdLB3WohKZ%{)LCkZbskR6JvcRr9J(qXG9PAq-FkUVRAQb zM~=Je93HirqT5qAyC`x+D|qp#RHNfo~Js2l*VHJ*fX$V7YizjMU!OHu7mp zj+=Y*_C0!PZ@5qB#NHRLOjgCJA66GTKkwsGzx}tDZ&i~PEJ+MZFi^bqc=AX32X5B$ zvo$M=7FvARzV_g9Ti@iKQ$}u9{pVl4F?lb>IFSGL$eJ%&3pK(Dju*xr)qvhUZ0mgRWE=9&E%MK;%GUTZSESGvdEisP~g7*4*|sMN$Y^YHQU z3bQ(65$%=bS33B^1s-yT6cSE(v<+3WPG@EGU6$(>5^B8sw6b!Rht&FQX=gmP?Bz1F7n(y zZ_ekUfQ~rnCE}{LXTI2TZNIxl;Qd1>t6C4}?A>FT`BAoNzWQR`q2m&tZETk5yfthu zTih4F?bEYeULM>}&yB>`X}A^$cS%Yf5xd^->r3IQKf09#b0*W>*$yx_7`7<8`)z)A5XY;n8MngI+dv4 z82W~%HvHlswwZ-({_f&da%#h^*>AS!za4`+W^==(bZM z=E8{odWk85@R*9%_jFKG)lf@od|#gEkM#d5@iaxvAb-zo7li%Cd~=BA?@KcM{d!Q; zyG<(3s8X69bx6(p@~73t|E0Wh!CM3pIrx2aBUK{d$UiE@{6rDpGO%p0Cs%RqFp*c?Y0&l9(f#nw!oC6S7dFF#o>1zt^wnVeZSP>c)R}oiM76 zQ04X4>-^_Z`##_EKPxjsj26K%@Tf)9kn|AL{^?Qi|16y8xs9nD{P*^MCI{A%1YQLZ O)_A}4@9qCz4*Um!6$=Fb literal 0 HcmV?d00001 diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Numerics.dll.REMOVED.git-id new file mode 100644 index 0000000000..de5266edf4 --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Numerics.dll.REMOVED.git-id @@ -0,0 +1 @@ +46236ad7acc056c1c10a13d7cecdec9233991e41 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Security.dll.REMOVED.git-id new file mode 100644 index 0000000000..05d64a9760 --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Security.dll.REMOVED.git-id @@ -0,0 +1 @@ +8df5821845e0e3dc5e8fbb3b055aa5b226c107f1 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.Linq.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.Linq.dll.REMOVED.git-id new file mode 100644 index 0000000000..2fe148ea05 --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.Linq.dll.REMOVED.git-id @@ -0,0 +1 @@ +2355094984699a01735d427f06c475967f3b7792 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.dll.REMOVED.git-id new file mode 100644 index 0000000000..85ef9ae7ae --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.Xml.dll.REMOVED.git-id @@ -0,0 +1 @@ +b7746223c709fb771b2b185e5f900f657c06ceb8 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.dll.REMOVED.git-id new file mode 100644 index 0000000000..80e49a3255 --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/System.dll.REMOVED.git-id @@ -0,0 +1 @@ +ddcb58dc5602f3a6d6ec499ee1b5d5ad32a4b425 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mcs.exe.REMOVED.git-id new file mode 100644 index 0000000000..722eaf4d9d --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mcs.exe.REMOVED.git-id @@ -0,0 +1 @@ +aeec656d52ce933e620be5c419a560d8ac8323a3 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mscorlib.dll.REMOVED.git-id new file mode 100644 index 0000000000..5af49ac58c --- /dev/null +++ b/mcs/class/lib/monolite-win32/72078E96-4A71-4CCD-83BC-B7CC78873FC0/mscorlib.dll.REMOVED.git-id @@ -0,0 +1 @@ +e3c1398a8ed2d1f8a91ade82741b81f351a1f3fe \ No newline at end of file diff --git a/mcs/class/referencesource/System/System.txt.REMOVED.git-id b/mcs/class/referencesource/System/System.txt.REMOVED.git-id index c0bb7b4c8e..3487af14a9 100644 --- a/mcs/class/referencesource/System/System.txt.REMOVED.git-id +++ b/mcs/class/referencesource/System/System.txt.REMOVED.git-id @@ -1 +1 @@ -29ef0a40a337175e7e5d83936dd8b5ce16fa76bb \ No newline at end of file +c6228c6e7c8d456f66bb2975a5f8fc94355487fc \ No newline at end of file diff --git a/mcs/class/referencesource/System/net/System/Net/NetworkInformation/IPGlobalProperties.cs b/mcs/class/referencesource/System/net/System/Net/NetworkInformation/IPGlobalProperties.cs index 0b5a43448f..9947fb83b6 100644 --- a/mcs/class/referencesource/System/net/System/Net/NetworkInformation/IPGlobalProperties.cs +++ b/mcs/class/referencesource/System/net/System/Net/NetworkInformation/IPGlobalProperties.cs @@ -14,36 +14,7 @@ namespace System.Net.NetworkInformation { public static IPGlobalProperties GetIPGlobalProperties() { -#if MONODROID - return new AndroidIPGlobalProperties (); -#elif MONOTOUCH || XAMMAC - return new UnixIPGlobalProperties (); -#elif MONO - switch (Environment.OSVersion.Platform) { - case PlatformID.Unix: - MibIPGlobalProperties impl = null; - if (Directory.Exists (MibIPGlobalProperties.ProcDir)) { - impl = new MibIPGlobalProperties (MibIPGlobalProperties.ProcDir); - if (File.Exists (impl.StatisticsFile)) - return impl; - } - if (Directory.Exists (MibIPGlobalProperties.CompatProcDir)) { - impl = new MibIPGlobalProperties (MibIPGlobalProperties.CompatProcDir); - if (File.Exists (impl.StatisticsFile)) - return impl; - } - return new UnixIPGlobalProperties (); - default: -#if WIN_PLATFORM - return new Win32IPGlobalProperties (); -#else - return new UnixIPGlobalProperties (); -#endif - } -#else - (new NetworkInformationPermission(NetworkInformationAccess.Read)).Demand(); - return new SystemIPGlobalProperties(); -#endif + return IPGlobalPropertiesFactoryPal.Create (); } internal static IPGlobalProperties InternalGetIPGlobalProperties() diff --git a/mcs/class/referencesource/mscorlib/system/globalization/charunicodeinfo.cs b/mcs/class/referencesource/mscorlib/system/globalization/charunicodeinfo.cs index 77d17717ff..59fb10a152 100644 --- a/mcs/class/referencesource/mscorlib/system/globalization/charunicodeinfo.cs +++ b/mcs/class/referencesource/mscorlib/system/globalization/charunicodeinfo.cs @@ -483,6 +483,10 @@ namespace System.Globalization { return (InternalGetUnicodeCategory(ch)) ; } +#if MONO + public static UnicodeCategory GetUnicodeCategory(int codePoint) => GetUnicodeCategory((char)codePoint); +#endif + public static UnicodeCategory GetUnicodeCategory(String s, int index) { if (s==null) diff --git a/mcs/class/referencesource/mscorlib/system/globalization/datetimeformat.cs b/mcs/class/referencesource/mscorlib/system/globalization/datetimeformat.cs index 4b29fb1f58..ce896a92ed 100644 --- a/mcs/class/referencesource/mscorlib/system/globalization/datetimeformat.cs +++ b/mcs/class/referencesource/mscorlib/system/globalization/datetimeformat.cs @@ -357,6 +357,22 @@ namespace System { return ((int)format[pos+1]); } +#if MONO // internal Span API + internal static int ParseNextChar(ReadOnlySpan format, int pos) + { + return ParseNextChar(new string(format), pos); + } + + internal static int ParseQuoteString(ReadOnlySpan format, int pos, StringBuilder result) + { + return ParseQuoteString(new string(format), pos, result); + } + + internal static int ParseRepeatPattern(ReadOnlySpan format, int pos, char patternChar) + { + return ParseRepeatPattern(new string(format), pos, patternChar); + } +#endif // // IsUseGenitiveForm // diff --git a/mcs/class/referencesource/mscorlib/system/globalization/datetimeparse.cs.REMOVED.git-id b/mcs/class/referencesource/mscorlib/system/globalization/datetimeparse.cs.REMOVED.git-id index 23f5854ec0..32ac53d968 100644 --- a/mcs/class/referencesource/mscorlib/system/globalization/datetimeparse.cs.REMOVED.git-id +++ b/mcs/class/referencesource/mscorlib/system/globalization/datetimeparse.cs.REMOVED.git-id @@ -1 +1 @@ -fae16b956da6410c5b95d3b1965eef390dc1cdeb \ No newline at end of file +6151722b5aa7029cf4a52f32ca44fa3dfa3b334b \ No newline at end of file diff --git a/mcs/class/referencesource/mscorlib/system/io/binaryreader.cs b/mcs/class/referencesource/mscorlib/system/io/binaryreader.cs index bccfd3b510..d51ea5373e 100644 --- a/mcs/class/referencesource/mscorlib/system/io/binaryreader.cs +++ b/mcs/class/referencesource/mscorlib/system/io/binaryreader.cs @@ -241,7 +241,9 @@ namespace System.IO { public virtual decimal ReadDecimal() { FillBuffer(16); try { - return Decimal.ToDecimal(m_buffer); + int[] ints = new int[4]; + Buffer.BlockCopy(m_buffer, 0, ints, 0, 16); + return new decimal(ints); } catch (ArgumentException e) { // ReadDecimal cannot leak out ArgumentException diff --git a/mcs/class/referencesource/mscorlib/system/math.cs b/mcs/class/referencesource/mscorlib/system/math.cs index 0ab222e620..b01c914760 100644 --- a/mcs/class/referencesource/mscorlib/system/math.cs +++ b/mcs/class/referencesource/mscorlib/system/math.cs @@ -559,7 +559,11 @@ namespace System { public static Decimal Abs(Decimal value) { +#if MONO + return Decimal.Abs(ref value); +#else return Decimal.Abs(value); +#endif } /*================================MAX========================================= @@ -641,7 +645,11 @@ namespace System { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static Decimal Max(Decimal val1, Decimal val2) { +#if MONO + return Decimal.Max(ref val1, ref val2); +#else return Decimal.Max(val1,val2); +#endif } /*================================MIN========================================= @@ -723,7 +731,7 @@ namespace System { [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static Decimal Min(Decimal val1, Decimal val2) { - return Decimal.Min(val1,val2); + return Decimal.Min(ref val1, ref val2); } /*=====================================Log====================================== diff --git a/mcs/class/referencesource/mscorlib/system/text/encoding.cs b/mcs/class/referencesource/mscorlib/system/text/encoding.cs index 07966c5248..a25c75a88c 100644 --- a/mcs/class/referencesource/mscorlib/system/text/encoding.cs +++ b/mcs/class/referencesource/mscorlib/system/text/encoding.cs @@ -1370,8 +1370,8 @@ namespace System.Text #if MONO public virtual unsafe int GetChars(ReadOnlySpan bytes, Span chars) { - fixed (byte* bytesPtr = &System.Runtime.InteropServices.MemoryMarshal.GetReference(bytes)) - fixed (char* charsPtr = &System.Runtime.InteropServices.MemoryMarshal.GetReference(chars)) + fixed (byte* bytesPtr = &System.Runtime.InteropServices.MemoryMarshal.GetNonNullPinnableReference(bytes)) + fixed (char* charsPtr = &System.Runtime.InteropServices.MemoryMarshal.GetNonNullPinnableReference(chars)) { return GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length); } @@ -1379,7 +1379,7 @@ namespace System.Text public unsafe string GetString(ReadOnlySpan bytes) { - fixed (byte* bytesPtr = &bytes.GetPinnableReference()) + fixed (byte* bytesPtr = &System.Runtime.InteropServices.MemoryMarshal.GetNonNullPinnableReference(bytes)) { return GetString(bytesPtr, bytes.Length); } diff --git a/mcs/class/referencesource/mscorlib/system/throwhelper.cs b/mcs/class/referencesource/mscorlib/system/throwhelper.cs index 40ed2f5d1a..f03c094006 100644 --- a/mcs/class/referencesource/mscorlib/system/throwhelper.cs +++ b/mcs/class/referencesource/mscorlib/system/throwhelper.cs @@ -148,6 +148,11 @@ namespace System { throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); } + internal static void ThrowInvalidOperationException_InvalidOperation_NoValue() + { + throw new InvalidOperationException(SR.InvalidOperation_NoValue); + } + private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument, string resource) { return new ArgumentOutOfRangeException(GetArgumentName(argument), resource); @@ -622,6 +627,7 @@ namespace System { offset, values, comparisonType, + s #endif } diff --git a/mcs/class/test-helpers/AdminHelper.cs b/mcs/class/test-helpers/AdminHelper.cs new file mode 100644 index 0000000000..c6c3203381 --- /dev/null +++ b/mcs/class/test-helpers/AdminHelper.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace System +{ + public static partial class AdminHelpers + { + public unsafe static bool IsProcessElevated() => true; + } +} \ No newline at end of file diff --git a/mcs/class/test-helpers/Configuration.Http.cs b/mcs/class/test-helpers/Configuration.Http.cs new file mode 100644 index 0000000000..dee6c15474 --- /dev/null +++ b/mcs/class/test-helpers/Configuration.Http.cs @@ -0,0 +1,26 @@ +namespace System.Net.Test.Common +{ + public static partial class Configuration + { + public static partial class Http + { + static Http () + { + var echoServers = new object[] { RemoteEchoServer }; + var secureEchoServers = new object[] { SecureRemoteEchoServer }; + + if (PlatformDetection.IsWindows) { + EchoServers = new object[][] { echoServers }; + } else { + EchoServers = new object[][] { echoServers, secureEchoServers }; + } + } + + public static readonly object[][] EchoServers; + // public static readonly object[][] VerifyUploadServers = { new object[] { RemoteVerifyUploadServer }, new object[] { SecureRemoteVerifyUploadServer } }; + // public static readonly object[][] CompressedServers = { new object[] { RemoteDeflateServer }, new object[] { RemoteGZipServer } }; + // public static readonly object[][] Http2Servers = { new object[] { new Uri ("https://" + Http2Host) } }; + // public static readonly object[][] Http2NoPushServers = { new object[] { new Uri ("https://" + Http2NoPushHost) } }; + } + } +} diff --git a/mcs/class/test-helpers/NunitHelpers.cs b/mcs/class/test-helpers/NunitHelpers.cs new file mode 100644 index 0000000000..93f29727f9 --- /dev/null +++ b/mcs/class/test-helpers/NunitHelpers.cs @@ -0,0 +1,147 @@ +using System.IO; +using System.Collections; +using NUnit.Framework.Constraints; + +namespace NUnit.Framework +{ + static class CollectionAssert + { + public static void DoesNotContain (IEnumerable collection, object val) + { + Assert.That(collection, Has.No.Member(val)); + } + + public static void Contains (IEnumerable collection, object val) + { + Assert.That(collection, Has.Member(val)); + } + + public static void AreEqual (IEnumerable expected, IEnumerable actual, string message = null, params object[] args) + { + Assert.That(actual, Is.EqualTo(expected), message, args); + } + + public static void AreEquivalent (IEnumerable expected, IEnumerable actual, string message = null, params object[] args) + { + Assert.That(actual, Is.EquivalentTo(expected), message, args); + } + + public static void IsEmpty(IEnumerable collection, string message = null, params object[] args) + { + Assert.That(collection, new EmptyCollectionConstraint(), message, args); + } + + public static void IsNotEmpty(IEnumerable collection, string message = null, params object[] args) + { + Assert.That(collection, Is.Not.Empty, message, args); + } + } + + static class FileAssert + { + public static void AreEqual(Stream expected, Stream actual, string message, params object[] args) + { + Assert.That(actual, Is.EqualTo(expected), message, args); + } + + public static void AreEqual(string expected, string actual, string message, params object[] args) + { + using (FileStream exStream = File.OpenRead(expected)) + using (FileStream acStream = File.OpenRead(actual)) + { + AreEqual(exStream, acStream, message, args); + } + } + } + + static class StringAssert + { + public static void Contains(string expected, string actual, string message = null, params object[] args) + { + Assert.That(actual, Is.StringContaining (expected), message, args); + } + + public static void StartsWith(string expected, string actual, string message = null, params object[] args) + { + Assert.IsTrue (actual.StartsWith (expected), message, args); + } + } + + static class AssertHelper + { + public static void IsEmpty (string aString, string message = null, params object[] args ) + { + Assert.That(aString, Is.Empty, message, args); + } + + public static void IsNotEmpty (string aString, string message = null, params object[] args ) + { + Assert.That(aString, Is.Not.Empty, message, args); + } + + public static void Less(int arg1, int arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.LessThan(arg2), message, args); + } + + public static void Greater(int arg1, int arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.GreaterThan(arg2), message, args); + } + + public static void Greater(double arg1, double arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.GreaterThan(arg2), message, args); + } + + public static void Greater(System.DateTime arg1, System.DateTime arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.GreaterThan(arg2), message, args); + } + + public static void GreaterOrEqual(int arg1, int arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); + } + + public static void GreaterOrEqual(long arg1, long arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); + } + + public static void GreaterOrEqual(System.DateTime arg1, System.DateTime arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); + } + + public static void GreaterOrEqual(System.TimeSpan arg1, System.TimeSpan arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args); + } + + public static void LessOrEqual (int arg1, int arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); + } + + public static void LessOrEqual(long arg1, long arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); + } + + public static void LessOrEqual(System.DateTime arg1, System.DateTime arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); + } + + public static void LessOrEqual(System.TimeSpan arg1, System.TimeSpan arg2, string message = null, params object[] args) + { + Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args); + } + + public static void IsNotInstanceOfType(System.Type expected, object actual, string message, params object[] args ) + { + Assert.IsFalse (actual.GetType ().IsInstanceOfType (expected), message, args); + } + } +} diff --git a/mcs/class/test-helpers/PlatformDetection.cs b/mcs/class/test-helpers/PlatformDetection.cs new file mode 100644 index 0000000000..95f51a794f --- /dev/null +++ b/mcs/class/test-helpers/PlatformDetection.cs @@ -0,0 +1,36 @@ +namespace System +{ + static partial class PlatformDetection + { + public static readonly bool IsNetNative = false; + public static readonly bool IsNotWinRT = true; + public static readonly bool IsWinRT = false; + public static readonly bool IsWindowsNanoServer = false; + public static readonly bool IsNotWindowsNanoServer = true; + public static readonly bool IsNotWindowsServerCore = true; + + public static bool IsWindows7 => false; + public static bool IsFullFramework => false; + public static bool IsNonZeroLowerBoundArraySupported => true; + public static bool IsUap => false; + + //TODO: check? + public static bool IsNotWindowsSubsystemForLinux => true; + public static bool IsWindowsSubsystemForLinux => false; + public static bool IsFedora => false; + public static bool IsRedHatFamily => false; + public static bool IsOpenSUSE => false; + public static bool IsUbuntu1404 => false; + public static bool IsNotRedHatFamily6 => true; + + public static bool IsNetfx462OrNewer => false; + + public static bool IsWindows { + get { + PlatformID id = Environment.OSVersion.Platform; + return id == PlatformID.Win32Windows || id == PlatformID.Win32NT; + } + } + public static bool IsInAppContainer => false; + } +} \ No newline at end of file diff --git a/mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs b/mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs new file mode 100644 index 0000000000..c0bfaaf1b0 --- /dev/null +++ b/mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Reflection; +using System.Text; +using System.IO; + +namespace System.Diagnostics +{ + // this file can be used in order to ignore all RemoteInvoke-tests + // should be used instead of /corefx/.../RemoteExecutorTestBase.Process.cs + public abstract partial class RemoteExecutorTestBase : FileCleanupTestBase + { + static RemoteInvokeHandle RemoteInvoke (MethodInfo method, string[] args, + RemoteInvokeOptions options, bool pasteArguments = true) + { + options = options ?? new RemoteInvokeOptions (); + //do nothing. Or we can invoke the method in the same process instead: + //method.Invoke(Activator.CreateInstance(method.DeclaringType), args.OfType().ToArray()); + return new RemoteInvokeHandle (null, null); + } + } +} \ No newline at end of file diff --git a/mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs b/mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs new file mode 100644 index 0000000000..2f840a1b82 --- /dev/null +++ b/mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; +using System.Runtime.InteropServices; + +namespace System.Diagnostics +{ + /// Base class used for all tests that need to spawn a remote process. + public abstract partial class RemoteExecutorTestBase : FileCleanupTestBase + { + // protected static readonly string HostRunnerName = "mono"; + protected static readonly string HostRunner = Process.GetCurrentProcess().MainModule.FileName; + + // Should be ../lib/$(PROFILE)/RemoteExecutorConsoleApp.exe + static readonly string ExtraParameter = "--debug " + Environment.GetEnvironmentVariable ("REMOTE_EXECUTOR"); + } +} diff --git a/mcs/errors/cs0280.cs b/mcs/errors/cs0280.cs new file mode 100644 index 0000000000..62be8e3958 --- /dev/null +++ b/mcs/errors/cs0280.cs @@ -0,0 +1,22 @@ +// CS0280: `C.Fixable.GetPinnableReference(int)' has the wrong signature to be used in extensible fixed statement +// Line: 11 +// Compiler options: -unsafe -langversion:latest -warnaserror + +using System; + +unsafe class C +{ + public static void Main () + { + fixed (int* p = new Fixable ()) { + } + } + + struct Fixable + { + public ref int GetPinnableReference (int i = 1) + { + throw new NotImplementedException (); + } + } +} \ No newline at end of file diff --git a/mcs/errors/cs1611-2.cs b/mcs/errors/cs1611-2.cs new file mode 100644 index 0000000000..882231378f --- /dev/null +++ b/mcs/errors/cs1611-2.cs @@ -0,0 +1,8 @@ +// CS1611: The params parameter cannot be declared as ref, out or in +// Line: 6 +// Compiler options: -langversion:latest + +class Test +{ + public static void Error (params in int args) {} +} \ No newline at end of file diff --git a/mcs/errors/cs1644-63.cs b/mcs/errors/cs1644-63.cs new file mode 100644 index 0000000000..ce61d5ce04 --- /dev/null +++ b/mcs/errors/cs1644-63.cs @@ -0,0 +1,22 @@ +// CS1644: Feature `extensible fixed statement' cannot be used because it is not part of the C# 7.2 language specification +// Line: 11 +// Compiler options: -unsafe -langversion:7.2 + +using System; + +unsafe class C +{ + public static void Main () + { + fixed (int* p = new Fixable ()) { + } + } + + struct Fixable + { + public ref int GetPinnableReference () + { + throw new NotImplementedException (); + } + } +} \ No newline at end of file diff --git a/mcs/errors/cs1644-64.cs b/mcs/errors/cs1644-64.cs new file mode 100644 index 0000000000..88917a0a5d --- /dev/null +++ b/mcs/errors/cs1644-64.cs @@ -0,0 +1,13 @@ +// CS1644: Feature `expression body property accessor' cannot be used because it is not part of the C# 6.0 language specification +// Line: 11 +// Compiler options: -langversion:6 + +using System; + +class C +{ + public int Integer + { + get => 0; + } +} \ No newline at end of file diff --git a/mcs/errors/cs1644-65.cs b/mcs/errors/cs1644-65.cs new file mode 100644 index 0000000000..dea648b784 --- /dev/null +++ b/mcs/errors/cs1644-65.cs @@ -0,0 +1,13 @@ +// CS1644: Feature `expression body property accessor' cannot be used because it is not part of the C# 6.0 language specification +// Line: 11 +// Compiler options: -langversion:6 + +using System; + +class C +{ + public int this[int i] + { + get => i; + } +} \ No newline at end of file diff --git a/mcs/errors/cs1644-66.cs b/mcs/errors/cs1644-66.cs new file mode 100644 index 0000000000..3f393b50d3 --- /dev/null +++ b/mcs/errors/cs1644-66.cs @@ -0,0 +1,17 @@ +// CS1644: Feature `expression body event accessor' cannot be used because it is not part of the C# 6.0 language specification +// Line: 11 +// Compiler options: -langversion:6 + +using System; + +class C +{ + public event EventHandler Event + { + add => Ignore (); + } + + static void Ignore () + { + } +} \ No newline at end of file diff --git a/mcs/errors/cs0428-2.cs b/mcs/errors/cs8385-2.cs similarity index 50% rename from mcs/errors/cs0428-2.cs rename to mcs/errors/cs8385-2.cs index 5f468fd519..cc7860faa6 100644 --- a/mcs/errors/cs0428-2.cs +++ b/mcs/errors/cs8385-2.cs @@ -1,4 +1,4 @@ -// CS0428: Cannot convert method group `Main' to non-delegate type `void*'. Consider using parentheses to invoke the method +// CS8385: The given expression cannot be used in a fixed statement // Line: 9 // Compiler options: -unsafe diff --git a/mcs/errors/cs0213-2.cs b/mcs/errors/cs8385.cs similarity index 54% rename from mcs/errors/cs0213-2.cs rename to mcs/errors/cs8385.cs index ae72e4cd9a..5fa9f794cc 100644 --- a/mcs/errors/cs0213-2.cs +++ b/mcs/errors/cs8385.cs @@ -1,4 +1,4 @@ -// CS0213: You cannot use the fixed statement to take the address of an already fixed expression +// CS8385: The given expression cannot be used in a fixed statement // Line: 9 // Compiler options: -unsafe diff --git a/mcs/mcs/argument.cs b/mcs/mcs/argument.cs index 5b1003dbad..4c75e41a9e 100644 --- a/mcs/mcs/argument.cs +++ b/mcs/mcs/argument.cs @@ -38,6 +38,8 @@ namespace Mono.CSharp // Conditional instance expression inserted as the first argument ExtensionTypeConditionalAccess = 5 | ConditionalAccessFlag, + Readonly = 6, + ConditionalAccessFlag = 1 << 7 } diff --git a/mcs/mcs/cs-parser.jay.REMOVED.git-id b/mcs/mcs/cs-parser.jay.REMOVED.git-id index 414b7080df..3990fd39e8 100644 --- a/mcs/mcs/cs-parser.jay.REMOVED.git-id +++ b/mcs/mcs/cs-parser.jay.REMOVED.git-id @@ -1 +1 @@ -7ccbcd2d97409ccff196f83c413c6f42579df9e3 \ No newline at end of file +4ca3bf74f3d5708238239eaf6aea280d14e88ad2 \ No newline at end of file diff --git a/mcs/mcs/expression.cs.REMOVED.git-id b/mcs/mcs/expression.cs.REMOVED.git-id index c5b5d52662..96c93b34ff 100644 --- a/mcs/mcs/expression.cs.REMOVED.git-id +++ b/mcs/mcs/expression.cs.REMOVED.git-id @@ -1 +1 @@ -23e4b108880464b2667c55b4d1b718af3f25e67a \ No newline at end of file +7c3407f06c501504e47e8717882177b23cc68795 \ No newline at end of file diff --git a/mcs/mcs/mcs.csproj b/mcs/mcs/mcs.csproj index 308a8e3f16..e43ab2a288 100644 --- a/mcs/mcs/mcs.csproj +++ b/mcs/mcs/mcs.csproj @@ -41,25 +41,109 @@ true - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -109,8 +193,15 @@ - + + genconsts + {702AE2C0-71DD-4112-9A06-E4FABCA59986} + false + Never + False + + diff --git a/mcs/mcs/report.cs b/mcs/mcs/report.cs index cc3d82b26e..5d64c8e766 100644 --- a/mcs/mcs/report.cs +++ b/mcs/mcs/report.cs @@ -42,7 +42,7 @@ namespace Mono.CSharp { public static readonly int[] AllWarnings = new int[] { 28, 67, 78, 105, 108, 109, 114, 162, 164, 168, 169, 183, 184, 197, - 219, 251, 252, 253, 278, 282, + 219, 251, 252, 253, 278, 280, 282, 402, 414, 419, 420, 429, 436, 437, 440, 458, 464, 465, 467, 469, 472, 473, 612, 618, 626, 628, 642, 649, 652, 657, 658, 659, 660, 661, 665, 672, 675, 693, 728, @@ -107,6 +107,15 @@ namespace Mono.CSharp { case LanguageVersion.V_7: version = "7.0"; break; + case LanguageVersion.V_7_1: + version = "7.1"; + break; + case LanguageVersion.V_7_2: + version = "7.2"; + break; + case LanguageVersion.V_7_3: + version = "7.3"; + break; default: throw new InternalErrorException ("Invalid feature version", compiler.Settings.Version); } diff --git a/mcs/mcs/settings.cs b/mcs/mcs/settings.cs index 37664187c7..6b763f15e1 100644 --- a/mcs/mcs/settings.cs +++ b/mcs/mcs/settings.cs @@ -32,10 +32,11 @@ namespace Mono.CSharp { V_7 = 7, V_7_1 = 71, V_7_2 = 72, + V_7_3 = 73, Experimental = 100, Default = V_7, - Latest = V_7_2 + Latest = V_7_3 } public enum RuntimeVersion diff --git a/mcs/mcs/statement.cs.REMOVED.git-id b/mcs/mcs/statement.cs.REMOVED.git-id index b2305f36a2..7ce49bcee5 100644 --- a/mcs/mcs/statement.cs.REMOVED.git-id +++ b/mcs/mcs/statement.cs.REMOVED.git-id @@ -1 +1 @@ -6c834a1b868a20e05cf71b90e656297e3cce7faf \ No newline at end of file +c8b77c1adc11d47aabcf6bb0564ca12f3461f35f \ No newline at end of file diff --git a/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.csproj b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.csproj index 6c8ca5adb1..87dd1312a7 100644 --- a/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.csproj +++ b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.csproj @@ -41,8 +41,8 @@ true - - + + @@ -57,6 +57,7 @@ + diff --git a/mcs/tests/test-961.cs b/mcs/tests/test-961.cs index 4456e19b3f..efe1967387 100644 --- a/mcs/tests/test-961.cs +++ b/mcs/tests/test-961.cs @@ -4,6 +4,12 @@ using System; public static class B { public static void Main () + { + int lo = 1; + Bar (in lo); + } + + public static void Bar (in int arg) { } diff --git a/mcs/tests/test-decl-expr-05.cs b/mcs/tests/test-decl-expr-05.cs index 730fd4278c..907cde0b8d 100644 --- a/mcs/tests/test-decl-expr-05.cs +++ b/mcs/tests/test-decl-expr-05.cs @@ -6,6 +6,11 @@ class X { arg = s.ToString (); } + + while (true && Call (out string s2)) + { + arg = s2.ToString (); + } } static bool Call (out string s) diff --git a/mcs/tests/test-fixed-01.cs b/mcs/tests/test-fixed-01.cs new file mode 100644 index 0000000000..4684b0c5a0 --- /dev/null +++ b/mcs/tests/test-fixed-01.cs @@ -0,0 +1,20 @@ +// Compiler options: -unsafe -langversion:latest + +unsafe class C +{ + public static void Main () + { + fixed (int* p = new Fixable ()) { + System.Console.WriteLine (*p); + System.Console.WriteLine (p [2]); + } + } + + struct Fixable + { + public ref int GetPinnableReference () + { + return ref (new int[] { 1, 2, 3 })[0]; + } + } +} \ No newline at end of file diff --git a/mcs/tests/ver-il-net_4_x.xml.REMOVED.git-id b/mcs/tests/ver-il-net_4_x.xml.REMOVED.git-id index c99397f6e6..fabcd342a0 100644 --- a/mcs/tests/ver-il-net_4_x.xml.REMOVED.git-id +++ b/mcs/tests/ver-il-net_4_x.xml.REMOVED.git-id @@ -1 +1 @@ -de627d70ca0c8397bb021d757723e1de33485608 \ No newline at end of file +40c2d585df3aa012f8646c4cc723ef60fa4ca87f \ No newline at end of file diff --git a/mcs/tools/Makefile b/mcs/tools/Makefile index 6753a2457e..b7a4dce3ee 100644 --- a/mcs/tools/Makefile +++ b/mcs/tools/Makefile @@ -14,6 +14,7 @@ net_4_5_dirs := \ xbuild \ csharp \ corcompare \ + mono-api-diff \ mono-api-html \ compiler-tester \ mono-xmltool \ @@ -48,7 +49,7 @@ net_4_5_dirs := \ mono-symbolicate \ linker-analyzer -build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator resx2sr linker cil-strip corcompare mono-api-html +build_SUBDIRS = resgen gacutil security culevel cil-stringreplacer commoncryptogenerator resx2sr linker cil-strip corcompare mono-api-diff mono-api-html monodroid_tools_SUBDIRS = cil-strip linker-analyzer mkbundle mdoc mono-symbolicate monodroid_SUBDIRS = nunit-lite monotouch_SUBDIRS = nunit-lite diff --git a/mcs/tools/cil-stringreplacer/Makefile b/mcs/tools/cil-stringreplacer/Makefile index 2a684b606f..ac4721cafe 100644 --- a/mcs/tools/cil-stringreplacer/Makefile +++ b/mcs/tools/cil-stringreplacer/Makefile @@ -5,7 +5,8 @@ include ../../build/rules.make PROGRAM = cil-stringreplacer.exe NO_INSTALL = yes -ifeq ($(PROFILE),basic) +API = $(filter basic build, $(PROFILE)) +ifdef API # It can be run using system .net during boostrap TARGET_NET_REFERENCE = v4.6 # Trick to make it work during boostrap where it has to run with system diff --git a/mcs/tools/cil-stringreplacer/cil-stringreplacer.cs b/mcs/tools/cil-stringreplacer/cil-stringreplacer.cs index 9892827b2d..090b874d8f 100644 --- a/mcs/tools/cil-stringreplacer/cil-stringreplacer.cs +++ b/mcs/tools/cil-stringreplacer/cil-stringreplacer.cs @@ -41,6 +41,7 @@ public class Program public bool Verbose { get; set; } public List ResourcesStrings { get; } public string ILFile { get; set; } + public bool MonoMscorlib { get; set; } public CmdOptions () { @@ -61,6 +62,8 @@ public class Program v => options.Verbose = v != null }, { "ilreplace=", "File with IL code to be used instead", v => options.ILFile = v }, + { "mscorlib-debug", "IL customizations for Mono's mscorlib", + v => options.MonoMscorlib = v != null }, }; List extra; @@ -130,6 +133,10 @@ public class Program using (var assembly = AssemblyDefinition.ReadAssembly (assemblyLocation, readerParameters)) { foreach (var module in assembly.Modules) { foreach (var type in module.GetTypes ()) { + if (options.MonoMscorlib && type.Name == "Debug" && type.Namespace == "System.Diagnostics") { + type.Name = "DebugPrivate"; + } + foreach (var method in type.Methods) { if (!method.HasBody) continue; diff --git a/mcs/tools/corcompare/AssemblyResolver.cs b/mcs/tools/corcompare/AssemblyResolver.cs index 063a688d47..decd20e9a4 100644 --- a/mcs/tools/corcompare/AssemblyResolver.cs +++ b/mcs/tools/corcompare/AssemblyResolver.cs @@ -32,16 +32,11 @@ using System.IO; using Mono.Cecil; -namespace GuiCompare { +namespace Mono.ApiTools { - public class AssemblyResolver : DefaultAssemblyResolver { + class AssemblyResolver : DefaultAssemblyResolver { public AssemblyDefinition ResolveFile (string file) - { - return ProcessFile (file); - } - - AssemblyDefinition ProcessFile (string file) { AddSearchDirectory (Path.GetDirectoryName (file)); var assembly = AssemblyDefinition.ReadAssembly (file, new ReaderParameters { AssemblyResolver = this, InMemory = true }); @@ -49,5 +44,13 @@ namespace GuiCompare { return assembly; } + + public AssemblyDefinition ResolveStream (Stream stream) + { + var assembly = AssemblyDefinition.ReadAssembly (stream, new ReaderParameters { AssemblyResolver = this, InMemory = true }); + RegisterAssembly (assembly); + + return assembly; + } } } diff --git a/mcs/tools/corcompare/Util.cs b/mcs/tools/corcompare/Util.cs index 660e859ca2..107c721d9e 100644 --- a/mcs/tools/corcompare/Util.cs +++ b/mcs/tools/corcompare/Util.cs @@ -3,32 +3,57 @@ using System.Collections.Generic; using System.Text; using Mono.Cecil; -using GuiCompare; +namespace Mono.ApiTools { -namespace CorCompare { + class TypeHelper { - static class TypeHelper { + public TypeHelper (bool ignoreResolutionErrors, bool ignoreInheritedInterfaces) + { + IgnoreResolutionErrors = ignoreResolutionErrors; + IgnoreInheritedInterfaces = ignoreInheritedInterfaces; + } - public static AssemblyResolver Resolver = new AssemblyResolver (); + public bool IgnoreResolutionErrors { get; } - internal static bool IsPublic (TypeReference typeref) + public bool IgnoreInheritedInterfaces { get; } + + public AssemblyResolver Resolver { get; } = new AssemblyResolver(); + + internal bool TryResolve (CustomAttribute attribute) + { + if (attribute == null) + throw new ArgumentNullException (nameof (attribute)); + + try { + var has = attribute.HasProperties; + return true; + } catch (AssemblyResolutionException) when (IgnoreResolutionErrors) { + return false; + } + } + + internal bool IsPublic (TypeReference typeref) { if (typeref == null) throw new ArgumentNullException ("typeref"); - TypeDefinition td = typeref.Resolve (); - if (td == null) - return false; + try { + var td = typeref.Resolve (); + if (td == null) + return false; - return td.IsPublic; + return td.IsPublic || (td.IsNestedPublic && IsPublic (td.DeclaringType)); + } catch (AssemblyResolutionException) when (IgnoreResolutionErrors) { + return true; + } } - internal static bool IsDelegate (TypeReference typeref) + internal bool IsDelegate (TypeReference typeref) { return IsDerivedFrom (typeref, "System.MulticastDelegate"); } - internal static bool IsDerivedFrom (TypeReference type, string derivedFrom) + internal bool IsDerivedFrom (TypeReference type, string derivedFrom) { bool first = true; foreach (var def in WalkHierarchy (type)) { @@ -44,52 +69,71 @@ namespace CorCompare { return false; } - internal static IEnumerable WalkHierarchy (TypeReference type) + internal IEnumerable WalkHierarchy (TypeReference type) { for (var def = type.Resolve (); def != null; def = GetBaseType (def)) yield return def; } - internal static IEnumerable GetInterfaces (TypeReference type) + internal IEnumerable GetInterfaces (TypeReference type) { var ifaces = new Dictionary (); - foreach (var def in WalkHierarchy (type)) + foreach (var def in WalkHierarchy (type)) { foreach (var iface in def.Interfaces) ifaces [iface.InterfaceType.FullName] = iface.InterfaceType; + if (IgnoreInheritedInterfaces) + break; + } return ifaces.Values; } - internal static TypeDefinition GetBaseType (TypeDefinition child) + internal TypeDefinition GetBaseType (TypeDefinition child) { if (child.BaseType == null) return null; - return child.BaseType.Resolve (); + try { + return child.BaseType.Resolve (); + } catch (AssemblyResolutionException) when (IgnoreResolutionErrors) { + return null; + } } - internal static bool IsPublic (CustomAttribute att) + internal MethodDefinition GetMethod (MethodReference method) + { + if (method == null) + throw new ArgumentNullException (nameof (method)); + + try { + return method.Resolve (); + } catch (AssemblyResolutionException) when (IgnoreResolutionErrors) { + return null; + } + } + + internal bool IsPublic (CustomAttribute att) { return IsPublic (att.AttributeType); } - internal static string GetFullName (CustomAttribute att) + internal string GetFullName (CustomAttribute att) { return att.AttributeType.FullName; } - internal static TypeDefinition GetTypeDefinition (CustomAttribute att) + internal TypeDefinition GetTypeDefinition (CustomAttribute att) { return att.AttributeType.Resolve (); } - static bool IsOverride (MethodDefinition method) + bool IsOverride (MethodDefinition method) { return method.IsVirtual && !method.IsNewSlot; } - public static MethodDefinition GetBaseMethodInTypeHierarchy (MethodDefinition method) + public MethodDefinition GetBaseMethodInTypeHierarchy (MethodDefinition method) { if (!IsOverride (method)) return method; @@ -106,7 +150,7 @@ namespace CorCompare { return method; } - static MethodDefinition TryMatchMethod (TypeDefinition type, MethodDefinition method) + MethodDefinition TryMatchMethod (TypeDefinition type, MethodDefinition method) { if (!type.HasMethods) return null; @@ -118,7 +162,7 @@ namespace CorCompare { return null; } - static bool MethodMatch (MethodDefinition candidate, MethodDefinition method) + bool MethodMatch (MethodDefinition candidate, MethodDefinition method) { if (!candidate.IsVirtual) return false; @@ -139,7 +183,7 @@ namespace CorCompare { return true; } - public static bool TypeMatch (IModifierType a, IModifierType b) + public bool TypeMatch (IModifierType a, IModifierType b) { if (!TypeMatch (a.ModifierType, b.ModifierType)) return false; @@ -147,7 +191,7 @@ namespace CorCompare { return TypeMatch (a.ElementType, b.ElementType); } - public static bool TypeMatch (TypeSpecification a, TypeSpecification b) + public bool TypeMatch (TypeSpecification a, TypeSpecification b) { if (a is GenericInstanceType) return TypeMatch ((GenericInstanceType) a, (GenericInstanceType) b); @@ -158,7 +202,7 @@ namespace CorCompare { return TypeMatch (a.ElementType, b.ElementType); } - public static bool TypeMatch (GenericInstanceType a, GenericInstanceType b) + public bool TypeMatch (GenericInstanceType a, GenericInstanceType b) { if (!TypeMatch (a.ElementType, b.ElementType)) return false; @@ -176,7 +220,7 @@ namespace CorCompare { return true; } - public static bool TypeMatch (TypeReference a, TypeReference b) + public bool TypeMatch (TypeReference a, TypeReference b) { if (a is GenericParameter) return true; diff --git a/mcs/tools/corcompare/WellFormedXmlWriter.cs b/mcs/tools/corcompare/WellFormedXmlWriter.cs index 8f663c657c..dbc5847d21 100644 --- a/mcs/tools/corcompare/WellFormedXmlWriter.cs +++ b/mcs/tools/corcompare/WellFormedXmlWriter.cs @@ -11,9 +11,9 @@ using System.Globalization; using System.Collections; using System.Xml; -namespace CorCompare { +namespace Mono.ApiTools { - public class WellFormedXmlWriter : DefaultXmlWriter + class WellFormedXmlWriter : DefaultXmlWriter { public static bool IsInvalid (int ch) { @@ -110,7 +110,7 @@ namespace CorCompare { } - public class DefaultXmlWriter : XmlWriter + class DefaultXmlWriter : XmlWriter { XmlWriter writer; diff --git a/mcs/tools/corcompare/mono-api-info.cs b/mcs/tools/corcompare/mono-api-info.cs index 0db2fed263..ac0674730b 100644 --- a/mcs/tools/corcompare/mono-api-info.cs +++ b/mcs/tools/corcompare/mono-api-info.cs @@ -22,38 +22,38 @@ using Mono.Cecil; using Mono.Cecil.Cil; using System.IO; -namespace CorCompare -{ - public class Driver +namespace Mono.ApiTools { + +#if !EXCLUDE_DRIVER + class Driver { public static int Main (string [] args) { bool showHelp = false; - AbiMode = false; - FollowForwarders = false; string output = null; - - var acoll = new AssemblyCollection (); + List asms = null; + ApiInfoConfig config = new ApiInfoConfig (); var options = new Mono.Options.OptionSet { - "usage: mono-api-info [OPTIONS+] ASSEMBLY+", - "", - "Expose IL structure of CLR assemblies as XML.", - "", - "Available Options:", { "abi", "Generate ABI, not API; contains only classes with instance fields which are not [NonSerialized].", - v => AbiMode = v != null }, + v => config.AbiMode = v != null }, { "f|follow-forwarders", "Follow type forwarders.", - v => FollowForwarders = v != null }, + v => config.FollowForwarders = v != null }, + { "ignore-inherited-interfaces", + "Ignore interfaces on the base type.", + v => config.IgnoreInheritedInterfaces = v != null }, + { "ignore-resolution-errors", + "Ignore any assemblies that cannot be found.", + v => config.IgnoreResolutionErrors = v != null }, { "d|L|lib|search-directory=", "Check for assembly references in {DIRECTORY}.", - v => TypeHelper.Resolver.AddSearchDirectory (v) }, + v => config.SearchDirectories.Add (v) }, { "r=", "Read and register the file {ASSEMBLY}, and add the directory containing ASSEMBLY to the search path.", - v => TypeHelper.Resolver.ResolveFile (v) }, - { "o=", + v => config.ResolveFiles.Add (v) }, + { "o|out|output=", "The output file. If not specified the output will be written to stdout.", v => output = v }, { "h|?|help", @@ -61,68 +61,210 @@ namespace CorCompare v => showHelp = v != null }, { "contract-api", "Produces contract API with all members at each level of inheritance hierarchy", - v => FullAPISet = v != null }, + v => config.FullApiSet = v != null }, }; - var asms = options.Parse (args); - - if (showHelp || asms.Count == 0) { - options.WriteOptionDescriptions (Console.Out); - Console.WriteLine (); - return showHelp? 0 :1; + try { + asms = options.Parse (args); + } catch (Mono.Options.OptionException e) { + Console.WriteLine ("Option error: {0}", e.Message); + asms = null; } - string windir = Environment.GetFolderPath(Environment.SpecialFolder.Windows); - string pf = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); - TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"assembly\GAC\MSDATASRC\7.0.3300.0__b03f5f7f11d50a3a")); + if (showHelp || asms == null || asms.Count == 0) { + Console.WriteLine ("usage: mono-api-info [OPTIONS+] ASSEMBLY+"); + Console.WriteLine (); + Console.WriteLine ("Expose IL structure of CLR assemblies as XML."); + Console.WriteLine (); + Console.WriteLine ("Available Options:"); + Console.WriteLine (); + options.WriteOptionDescriptions (Console.Out); + Console.WriteLine (); + return showHelp ? 0 : 1; + } - foreach (string arg in asms) { - acoll.Add (arg); + TextWriter outputStream = null; + try { + if (!string.IsNullOrEmpty (output)) + outputStream = new StreamWriter (output); - if (arg.Contains ("v3.0")) { - TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v2.0.50727")); - } else if (arg.Contains ("v3.5")) { - TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v2.0.50727")); - TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v3.0\Windows Communication Foundation")); - } else if (arg.Contains ("v4.0")) { - if (arg.Contains ("Silverlight")) { - TypeHelper.Resolver.AddSearchDirectory (Path.Combine (pf, @"Microsoft Silverlight\4.0.51204.0")); + ApiInfo.Generate (asms, null, outputStream ?? Console.Out, config); + } catch (Exception e) { + Console.Error.WriteLine (e); + return 1; + } finally { + outputStream?.Dispose (); + } + return 0; + } + } +#endif + + class State + { + public bool AbiMode { get; set; } = false; + + public bool FollowForwarders { get; set; } = false; + + public bool FullApiSet { get; set; } = false; + + public bool IgnoreResolutionErrors { get; set; } = false; + + public bool IgnoreInheritedInterfaces { get; set; } = false; + + public List SearchDirectories { get; } = new List (); + + public List ResolveFiles { get; } = new List (); + + public List ResolveStreams { get; } = new List (); + + public TypeHelper TypeHelper { get; private set; } + + public void ResolveTypes () + { + TypeHelper = new TypeHelper (IgnoreResolutionErrors, IgnoreInheritedInterfaces); + + if (SearchDirectories != null) { + foreach (var v in SearchDirectories) + TypeHelper.Resolver.AddSearchDirectory (v); + } + if (ResolveFiles != null) { + foreach (var v in ResolveFiles) + TypeHelper.Resolver.ResolveFile (v); + } + if (ResolveStreams != null) { + foreach (var v in ResolveStreams) + TypeHelper.Resolver.ResolveStream (v); + } + } + } + + public class ApiInfoConfig + { + public bool AbiMode { get; set; } = false; + + public bool FollowForwarders { get; set; } = false; + + public bool FullApiSet { get; set; } = false; + + public bool IgnoreResolutionErrors { get; set; } = false; + + public bool IgnoreInheritedInterfaces { get; set; } = false; + + public List SearchDirectories { get; set; } = new List (); + + public List ResolveFiles { get; set; } = new List (); + + public List ResolveStreams { get; set; } = new List (); + } + + public static class ApiInfo + { + public static void Generate (string assemblyPath, TextWriter outStream, ApiInfoConfig config = null) + { + if (assemblyPath == null) + throw new ArgumentNullException (nameof (assemblyPath)); + + Generate (new [] { assemblyPath }, null, outStream, config); + } + + public static void Generate (Stream assemblyStream, TextWriter outStream, ApiInfoConfig config = null) + { + if (assemblyStream == null) + throw new ArgumentNullException (nameof (assemblyStream)); + + Generate (null, new [] { assemblyStream }, outStream, config); + } + + public static void Generate (IEnumerable assemblyPaths, TextWriter outStream, ApiInfoConfig config = null) + { + Generate (assemblyPaths, null, outStream, config); + } + + public static void Generate (IEnumerable assemblyStreams, TextWriter outStream, ApiInfoConfig config = null) + { + Generate (null, assemblyStreams, outStream, config); + } + + public static void Generate (IEnumerable assemblyPaths, IEnumerable assemblyStreams, TextWriter outStream, ApiInfoConfig config = null) + { + if (outStream == null) + throw new ArgumentNullException (nameof (outStream)); + + if (config == null) + config = new ApiInfoConfig (); + + var state = new State { + AbiMode = config.AbiMode, + FollowForwarders = config.FollowForwarders, + FullApiSet = config.FullApiSet, + IgnoreResolutionErrors = config.IgnoreResolutionErrors, + IgnoreInheritedInterfaces = config.IgnoreInheritedInterfaces, + }; + state.SearchDirectories.AddRange (config.SearchDirectories); + state.ResolveFiles.AddRange (config.ResolveFiles); + state.ResolveStreams.AddRange (config.ResolveStreams); + + Generate (assemblyPaths, assemblyStreams, outStream, state); + } + + internal static void Generate (IEnumerable assemblyFiles, IEnumerable assemblyStreams, TextWriter outStream, State state = null) + { + if (outStream == null) + throw new ArgumentNullException (nameof (outStream)); + + if (state == null) + state = new State (); + + state.ResolveTypes (); + + string windir = Environment.GetFolderPath (Environment.SpecialFolder.Windows); + string pf = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFiles); + state.TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"assembly\GAC\MSDATASRC\7.0.3300.0__b03f5f7f11d50a3a")); + + var acoll = new AssemblyCollection (state); + if (assemblyFiles != null) { + foreach (string arg in assemblyFiles) { + acoll.Add (arg); + + if (arg.Contains ("v3.0")) { + state.TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v2.0.50727")); + } else if (arg.Contains ("v3.5")) { + state.TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v2.0.50727")); + state.TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v3.0\Windows Communication Foundation")); + } else if (arg.Contains ("v4.0")) { + if (arg.Contains ("Silverlight")) { + state.TypeHelper.Resolver.AddSearchDirectory (Path.Combine (pf, @"Microsoft Silverlight\4.0.51204.0")); + } else { + state.TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v4.0.30319")); + state.TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v4.0.30319\WPF")); + } } else { - TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v4.0.30319")); - TypeHelper.Resolver.AddSearchDirectory (Path.Combine (windir, @"Microsoft.NET\Framework\v4.0.30319\WPF")); + state.TypeHelper.Resolver.AddSearchDirectory (Path.GetDirectoryName (arg)); } - } else { - TypeHelper.Resolver.AddSearchDirectory (Path.GetDirectoryName (arg)); + } + } + if (assemblyStreams != null) { + foreach (var arg in assemblyStreams) { + acoll.Add (arg); } } - StreamWriter outputStream = null; - if (!string.IsNullOrEmpty (output)) - outputStream = new StreamWriter (output); - try { - TextWriter outStream = outputStream ?? Console.Out; - var settings = new XmlWriterSettings (); - settings.Indent = true; - var textWriter = XmlWriter.Create (outStream, settings); + var settings = new XmlWriterSettings { + Indent = true, + }; + using (var textWriter = XmlWriter.Create (outStream, settings)) { var writer = new WellFormedXmlWriter (textWriter); writer.WriteStartDocument (); acoll.Writer = writer; acoll.DoOutput (); writer.WriteEndDocument (); writer.Flush (); - } finally { - if (outputStream != null) - outputStream.Dispose (); } - return 0; } - - internal static bool AbiMode { get; private set; } - internal static bool FollowForwarders { get; private set; } - internal static bool FullAPISet { get; set; } } - public class Utils { + class Utils { static char[] CharsToCleanup = new char[] { '<', '>', '/' }; public static string CleanupTypeName (TypeReference type) @@ -160,19 +302,23 @@ namespace CorCompare { XmlWriter writer; List assemblies = new List (); + State state; - public AssemblyCollection () + public AssemblyCollection (State state) { + this.state = state; } public bool Add (string name) { AssemblyDefinition ass = LoadAssembly (name); - if (ass == null) { - Console.Error.WriteLine ("Cannot load assembly file " + name); - return false; - } + assemblies.Add (ass); + return true; + } + public bool Add (Stream stream) + { + AssemblyDefinition ass = LoadAssembly (stream); assemblies.Add (ass); return true; } @@ -184,7 +330,7 @@ namespace CorCompare writer.WriteStartElement ("assemblies"); foreach (AssemblyDefinition a in assemblies) { - AssemblyData data = new AssemblyData (writer, a); + AssemblyData data = new AssemblyData (writer, a, state); data.DoOutput (); } writer.WriteEndElement (); @@ -196,25 +342,27 @@ namespace CorCompare AssemblyDefinition LoadAssembly (string assembly) { - try { - if (File.Exists (assembly)) - return TypeHelper.Resolver.ResolveFile (assembly); + if (File.Exists (assembly)) + return state.TypeHelper.Resolver.ResolveFile (assembly); - return TypeHelper.Resolver.Resolve (AssemblyNameReference.Parse (assembly), new ReaderParameters ()); - } catch (Exception e) { - Console.WriteLine (e); - return null; - } + return state.TypeHelper.Resolver.Resolve (AssemblyNameReference.Parse (assembly), new ReaderParameters ()); + } + + AssemblyDefinition LoadAssembly (Stream assembly) + { + return state.TypeHelper.Resolver.ResolveStream (assembly); } } abstract class BaseData { protected XmlWriter writer; + protected State state; - protected BaseData (XmlWriter writer) + protected BaseData (XmlWriter writer, State state) { this.writer = writer; + this.state = state; } public abstract void DoOutput (); @@ -229,8 +377,8 @@ namespace CorCompare { AssemblyDefinition ass; - public TypeForwardedToData (XmlWriter writer, AssemblyDefinition ass) - : base (writer) + public TypeForwardedToData (XmlWriter writer, AssemblyDefinition ass, State state) + : base (writer, state) { this.ass = ass; } @@ -254,9 +402,9 @@ namespace CorCompare } } - public static void OutputForwarders (XmlWriter writer, AssemblyDefinition ass) + public static void OutputForwarders (XmlWriter writer, AssemblyDefinition ass, State state) { - TypeForwardedToData tftd = new TypeForwardedToData (writer, ass); + TypeForwardedToData tftd = new TypeForwardedToData (writer, ass, state); tftd.DoOutput (); } } @@ -265,8 +413,8 @@ namespace CorCompare { AssemblyDefinition ass; - public AssemblyData (XmlWriter writer, AssemblyDefinition ass) - : base (writer) + public AssemblyData (XmlWriter writer, AssemblyDefinition ass, State state) + : base (writer, state) { this.ass = ass; } @@ -281,14 +429,14 @@ namespace CorCompare AddAttribute ("name", aname.Name); AddAttribute ("version", aname.Version.ToString ()); - AttributeData.OutputAttributes (writer, ass); + AttributeData.OutputAttributes (writer, state, ass); var types = new List (); if (ass.MainModule.Types != null) { types.AddRange (ass.MainModule.Types); } - if (Driver.FollowForwarders && ass.MainModule.ExportedTypes != null) { + if (state.FollowForwarders && ass.MainModule.ExportedTypes != null) { foreach (var t in ass.MainModule.ExportedTypes) { var forwarded = t.Resolve (); if (forwarded == null) { @@ -313,7 +461,7 @@ namespace CorCompare if (string.IsNullOrEmpty (t.Namespace)) continue; - if (!Driver.AbiMode && ((t.Attributes & TypeAttributes.VisibilityMask) != TypeAttributes.Public)) + if (!state.AbiMode && ((t.Attributes & TypeAttributes.VisibilityMask) != TypeAttributes.Public)) continue; if (t.DeclaringType != null) @@ -332,7 +480,7 @@ namespace CorCompare writer.WriteStartElement ("classes"); } - TypeData bd = new TypeData (writer, t); + TypeData bd = new TypeData (writer, t, state); bd.DoOutput (); } @@ -352,8 +500,8 @@ namespace CorCompare { MemberReference [] members; - public MemberData (XmlWriter writer, MemberReference [] members) - : base (writer) + public MemberData (XmlWriter writer, MemberReference [] members, State state) + : base (writer, state) { this.members = members; } @@ -374,7 +522,7 @@ namespace CorCompare AddAttribute ("attrib", GetMemberAttributes (member)); AddExtraAttributes (member); - AttributeData.OutputAttributes (writer, (ICustomAttributeProvider) member, GetAdditionalCustomAttributeProvider (member)); + AttributeData.OutputAttributes (writer, state, (ICustomAttributeProvider) member, GetAdditionalCustomAttributeProvider (member)); AddExtraData (member); writer.WriteEndElement (); // Tag @@ -414,7 +562,7 @@ namespace CorCompare get { return "NoTAG"; } } - public static void OutputGenericParameters (XmlWriter writer, IGenericParameterProvider provider) + public static void OutputGenericParameters (XmlWriter writer, IGenericParameterProvider provider, State state) { if (provider.GenericParameters.Count == 0) return; @@ -428,7 +576,7 @@ namespace CorCompare writer.WriteAttributeString ("name", gp.Name); writer.WriteAttributeString ("attributes", ((int) gp.Attributes).ToString ()); - AttributeData.OutputAttributes (writer, gp); + AttributeData.OutputAttributes (writer, state, gp); var constraints = gp.Constraints; if (constraints.Count == 0) { @@ -457,8 +605,8 @@ namespace CorCompare { TypeDefinition type; - public TypeData (XmlWriter writer, TypeDefinition type) - : base (writer, null) + public TypeData (XmlWriter writer, TypeDefinition type, State state) + : base (writer, null, state) { this.type = type; } @@ -507,10 +655,10 @@ namespace CorCompare AddAttribute ("enumtype", Utils.CleanupTypeName (value_type.FieldType)); } - AttributeData.OutputAttributes (writer, type); + AttributeData.OutputAttributes (writer, state, type); - var ifaces = TypeHelper.GetInterfaces (type). - Where ((iface) => TypeHelper.IsPublic (iface)). // we're only interested in public interfaces + var ifaces = state.TypeHelper.GetInterfaces (type). + Where ((iface) => state.TypeHelper.IsPublic (iface)). // we're only interested in public interfaces OrderBy (s => s.FullName, StringComparer.Ordinal); if (ifaces.Any ()) { @@ -523,41 +671,41 @@ namespace CorCompare writer.WriteEndElement (); // interfaces } - MemberData.OutputGenericParameters (writer, type); + MemberData.OutputGenericParameters (writer, type, state); ArrayList members = new ArrayList (); FieldDefinition [] fields = GetFields (type); if (fields.Length > 0) { Array.Sort (fields, MemberReferenceComparer.Default); - FieldData fd = new FieldData (writer, fields); + FieldData fd = new FieldData (writer, fields, state); members.Add (fd); } - if (!Driver.AbiMode) { + if (!state.AbiMode) { MethodDefinition [] ctors = GetConstructors (type); if (ctors.Length > 0) { Array.Sort (ctors, MethodDefinitionComparer.Default); - members.Add (new ConstructorData (writer, ctors)); + members.Add (new ConstructorData (writer, ctors, state)); } - PropertyDefinition[] properties = GetProperties (type, Driver.FullAPISet); + PropertyDefinition[] properties = GetProperties (type, state.FullApiSet); if (properties.Length > 0) { Array.Sort (properties, PropertyDefinitionComparer.Default); - members.Add (new PropertyData (writer, properties)); + members.Add (new PropertyData (writer, properties, state)); } EventDefinition [] events = GetEvents (type); if (events.Length > 0) { Array.Sort (events, MemberReferenceComparer.Default); - members.Add (new EventData (writer, events)); + members.Add (new EventData (writer, events, state)); } - MethodDefinition [] methods = GetMethods (type, Driver.FullAPISet); + MethodDefinition [] methods = GetMethods (type, state.FullApiSet); if (methods.Length > 0) { Array.Sort (methods, MethodDefinitionComparer.Default); - members.Add (new MethodData (writer, methods)); + members.Add (new MethodData (writer, methods, state)); } } @@ -585,7 +733,7 @@ namespace CorCompare writer.WriteStartElement ("classes"); foreach (TypeDefinition t in nestedArray) { - TypeData td = new TypeData (writer, t); + TypeData td = new TypeData (writer, t, state); td.DoOutput (); } writer.WriteEndElement (); // classes @@ -619,7 +767,7 @@ namespace CorCompare || maskedAccess == MethodAttributes.FamORAssem; } - static string GetClassType (TypeDefinition t) + string GetClassType (TypeDefinition t) { if (t.IsEnum) return "enum"; @@ -630,7 +778,7 @@ namespace CorCompare if (t.IsInterface) return "interface"; - if (TypeHelper.IsDelegate(t)) + if (state.TypeHelper.IsDelegate(t)) return "delegate"; if (t.IsPointer) @@ -677,12 +825,12 @@ namespace CorCompare if (field.IsSpecialName) continue; - if (Driver.AbiMode && field.IsStatic) + if (state.AbiMode && field.IsStatic) continue; // we're only interested in public or protected members FieldAttributes maskedVisibility = (field.Attributes & FieldAttributes.FieldAccessMask); - if (Driver.AbiMode && !field.IsNotSerialized) { + if (state.AbiMode && !field.IsNotSerialized) { list.Add (field); } else { if (maskedVisibility == FieldAttributes.Public @@ -697,7 +845,7 @@ namespace CorCompare } - internal static PropertyDefinition [] GetProperties (TypeDefinition type, bool fullAPI) { + internal PropertyDefinition [] GetProperties (TypeDefinition type, bool fullAPI) { var list = new List (); var t = type; @@ -730,7 +878,7 @@ namespace CorCompare if (t.BaseType == null || t.BaseType.FullName == "System.Object") t = null; else - t = t.BaseType.Resolve (); + t = state.TypeHelper.GetBaseType (t); } while (t != null); @@ -777,7 +925,7 @@ namespace CorCompare if (t.BaseType == null || t.BaseType.FullName == "System.Object") t = null; else - t = t.BaseType.Resolve (); + t = state.TypeHelper.GetBaseType (t); } while (t != null); @@ -847,8 +995,8 @@ namespace CorCompare class FieldData : MemberData { - public FieldData (XmlWriter writer, FieldDefinition [] members) - : base (writer, members) + public FieldData (XmlWriter writer, FieldDefinition [] members, State state) + : base (writer, members, state) { } @@ -900,8 +1048,8 @@ namespace CorCompare class PropertyData : MemberData { - public PropertyData (XmlWriter writer, PropertyDefinition [] members) - : base (writer, members) + public PropertyData (XmlWriter writer, PropertyDefinition [] members, State state) + : base (writer, members, state) { } @@ -962,7 +1110,7 @@ namespace CorCompare if (methods == null) return; - MethodData data = new MethodData (writer, methods); + MethodData data = new MethodData (writer, methods, state); //data.NoMemberAttributes = true; data.DoOutput (); } @@ -984,8 +1132,8 @@ namespace CorCompare class EventData : MemberData { - public EventData (XmlWriter writer, EventDefinition [] members) - : base (writer, members) + public EventData (XmlWriter writer, EventDefinition [] members, State state) + : base (writer, members, state) { } @@ -1022,8 +1170,8 @@ namespace CorCompare { bool noAtts; - public MethodData (XmlWriter writer, MethodDefinition [] members) - : base (writer, members) + public MethodData (XmlWriter writer, MethodDefinition [] members, State state) + : base (writer, members, state) { } @@ -1065,7 +1213,7 @@ namespace CorCompare AddAttribute ("sealed", "true"); if (mbase.IsStatic) AddAttribute ("static", "true"); - var baseMethod = TypeHelper.GetBaseMethodInTypeHierarchy (mbase); + var baseMethod = state.TypeHelper.GetBaseMethodInTypeHierarchy (mbase); if (baseMethod != null && baseMethod != mbase) { // This indicates whether this method is an override of another method. // This information is not necessarily available in the api info for any @@ -1091,13 +1239,13 @@ namespace CorCompare MethodDefinition mbase = (MethodDefinition)memberDefenition; - ParameterData parms = new ParameterData (writer, mbase.Parameters) { + ParameterData parms = new ParameterData (writer, mbase.Parameters, state) { HasExtensionParameter = mbase.CustomAttributes.Any (l => l.AttributeType.FullName == "System.Runtime.CompilerServices.ExtensionAttribute") }; parms.DoOutput (); - MemberData.OutputGenericParameters (writer, mbase); + MemberData.OutputGenericParameters (writer, mbase, state); } public override bool NoMemberAttributes { @@ -1116,8 +1264,8 @@ namespace CorCompare class ConstructorData : MethodData { - public ConstructorData (XmlWriter writer, MethodDefinition [] members) - : base (writer, members) + public ConstructorData (XmlWriter writer, MethodDefinition [] members, State state) + : base (writer, members, state) { } @@ -1134,8 +1282,8 @@ namespace CorCompare { private IList parameters; - public ParameterData (XmlWriter writer, IList parameters) - : base (writer) + public ParameterData (XmlWriter writer, IList parameters, State state) + : base (writer, state) { this.parameters = parameters; } @@ -1173,7 +1321,7 @@ namespace CorCompare if (direction != "in") AddAttribute ("direction", direction); - AttributeData.OutputAttributes (writer, parameter); + AttributeData.OutputAttributes (writer, state, parameter); writer.WriteEndElement (); // parameter } writer.WriteEndElement (); // parameters @@ -1182,7 +1330,14 @@ namespace CorCompare class AttributeData { - public static void DoOutput (XmlWriter writer, IList providers) + State state; + + public AttributeData (State state) + { + this.state = state; + } + + public void DoOutput (XmlWriter writer, IList providers) { if (writer == null) throw new InvalidOperationException ("Document not set"); @@ -1204,8 +1359,8 @@ namespace CorCompare var ass = provider as AssemblyDefinition; - if (ass != null && !Driver.FollowForwarders) - TypeForwardedToData.OutputForwarders (writer, ass); + if (ass != null && !state.FollowForwarders) + TypeForwardedToData.OutputForwarders (writer, ass, state); var attributes = provider.CustomAttributes. Where ((att) => !SkipAttribute (att)). @@ -1251,13 +1406,16 @@ namespace CorCompare writer.WriteEndElement (); // attributes } - static Dictionary CreateAttributeMapping (CustomAttribute attribute) + Dictionary CreateAttributeMapping (CustomAttribute attribute) { Dictionary mapping = null; + if (!state.TypeHelper.TryResolve (attribute)) + return mapping; + PopulateMapping (ref mapping, attribute); - var constructor = attribute.Constructor.Resolve (); + var constructor = state.TypeHelper.GetMethod (attribute.Constructor); if (constructor == null || !constructor.HasParameters) return mapping; @@ -1520,17 +1678,18 @@ namespace CorCompare return value; } - static bool SkipAttribute (CustomAttribute attribute) + bool SkipAttribute (CustomAttribute attribute) { - if (!TypeHelper.IsPublic (attribute)) + if (!state.TypeHelper.IsPublic (attribute)) return true; return attribute.Constructor.DeclaringType.Name.EndsWith ("TODOAttribute", StringComparison.Ordinal); } - public static void OutputAttributes (XmlWriter writer, params ICustomAttributeProvider[] providers) + public static void OutputAttributes (XmlWriter writer, State state, params ICustomAttributeProvider[] providers) { - AttributeData.DoOutput (writer, providers); + var data = new AttributeData (state); + data.DoOutput (writer, providers); } } diff --git a/mcs/tools/linker/Makefile b/mcs/tools/linker/Makefile index d1a63cca8c..75d950fc66 100644 --- a/mcs/tools/linker/Makefile +++ b/mcs/tools/linker/Makefile @@ -8,20 +8,35 @@ LIB_REFS = System System.Core System.Xml Mono.Cecil TEST_CASES := \ mscorlib/test-array.cs \ - mscorlib/test-remoting.cs \ + mscorlib/test-exception-01.cs \ + mscorlib/test-locale-01.cs \ + mscorlib/test-reflection-01.cs \ + mscorlib/test-string-01.cs \ + mscorlib/test-string-02.cs \ + mscorlib/test-string-03.cs \ + mscorlib/test-task-01.cs \ System/test-security.cs +ifdef MOBILE_PROFILE +TEST_CASES += \ +# Requires linker fix +# mscorlib/test-crypto-01.cs +endif + ifndef AOT_FRIENDLY_PROFILE TEST_CASES += \ + mscorlib/test-remoting.cs \ mscorlib/test-reflection.cs endif -TESTS_COMPILER = $(MCS) -nologo -noconfig -debug:portable -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/mscorlib.dll +SIZE_TEST_CASES := + +TESTS_COMPILER = $(MCS) -nologo -noconfig -unsafe -debug:portable -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/mscorlib.dll check: compile-tests $(MAKE) run-tests -compile-tests: $(TEST_CASES) +compile-tests: $(TEST_CASES) $(SIZE_TEST_CASES) mscorlib/test-%.cs: $(TESTS_COMPILER) Tests/$@ /out:Tests/$(@:.cs=.exe) @@ -46,4 +61,40 @@ System/test-%.exe mscorlib/test-%.exe: $(TEST_EXEC) $(LINKER_OUTPUT)/$(@F) @rm -rf $(LINKER_OUTPUT) +BCL_ASSEMBLIES_CORE=mscorlib.dll System.dll System.Core.dll System.Xml.dll +BCL_ASSEMBLIES=$(BCL_ASSEMBLIES_CORE) $(sort $(filter-out $(BCL_ASSEMBLIES_CORE), $(notdir $(wildcard $(PROFILE_PATH)/System.*.dll)) )) + +COMMA=, +REPORT_FILE=$(PROFILE)-linked-size.csv + +bcl-size-current: compile-tests + @echo "App,$$(echo '$(BCL_ASSEMBLIES)' | tr ' ' ',')" > $(REPORT_FILE) + @for app in $(sort $(SIZE_TEST_CASES:.cs=.exe) $(TEST_CASES:.cs=.exe)); do \ + rm -rf $(LINKER_OUTPUT); \ + mkdir $(LINKER_OUTPUT); \ + echo Checking linked BCL size for $$app; \ + $(LINKER) -a Tests/$$app; \ + sizes=""; \ + for asm in $(BCL_ASSEMBLIES); do \ + if [ -f "$(LINKER_OUTPUT)/$$asm" ]; then size=$$(wc -c < "$(LINKER_OUTPUT)/$$asm" | tr -d "[:space:]"); else size="0"; fi; \ + sizes="$$sizes,$$size"; \ + done; \ + echo "$$app$$sizes" >> $(REPORT_FILE); \ + rm -rf $(LINKER_OUTPUT); \ + done; + +bcl-size-diff: + @echo "Regenerating BCL Linked Size diff..." + $(Q) $(MAKE) bcl-size-current PROFILE=net_4_x || true + $(Q) $(MAKE) bcl-size-current PROFILE=monotouch || true + $(Q) $(MAKE) bcl-size-current PROFILE=monodroid || true + @echo "Checking size differences..." + @mkdir -p sizediff + $(Q) git diff HEAD "*.csv" > temp.patch + $(Q) git show HEAD:./net_4_x-linked-size.csv > net_4_x-linked-size.old.csv + $(Q) git show HEAD:./monotouch-linked-size.csv > monotouch-linked-size.old.csv + $(Q) git show HEAD:./monodroid-linked-size.csv > monodroid-linked-size.old.csv + $(Q) sed -e "/@diffdata@/r temp.patch" -e "/@diffdata@/d" -e "/@olddata-net_4_x@/r net_4_x-linked-size.old.csv" -e "/@olddata-net_4_x@/d" -e "/@olddata-monotouch@/r monotouch-linked-size.old.csv" -e "/@olddata-monotouch@/d" -e "/@olddata-monodroid@/r monodroid-linked-size.old.csv" -e "/@olddata-monodroid@/d" -e "/@newdata-net_4_x@/r net_4_x-linked-size.csv" -e "/@newdata-net_4_x@/d" -e "/@newdata-monotouch@/r monotouch-linked-size.csv" -e "/@newdata-monotouch@/d" -e "/@newdata-monodroid@/r monodroid-linked-size.csv" -e "/@newdata-monodroid@/d" linked-size-diff.html.in > sizediff/index.html + $(Q) if [ -s temp.patch ]; then echo "Error: Found BCL Linked Size differences, see mcs/tools/linker/sizediff/index.html."; rm -f temp.patch *.old.csv; exit 1; else echo "No differences found."; rm -f temp.patch *.old.csv; fi + include ../../build/executable.make diff --git a/mcs/tools/mono-api-diff/Makefile b/mcs/tools/mono-api-diff/Makefile new file mode 100644 index 0000000000..f94f634962 --- /dev/null +++ b/mcs/tools/mono-api-diff/Makefile @@ -0,0 +1,10 @@ +thisdir = tools/mono-api-diff +SUBDIRS = +include ../../build/rules.make + +LIB_REFS = System.Xml System.Core System +LOCAL_MCS_FLAGS = + +PROGRAM = mono-api-diff.exe + +include ../../build/executable.make diff --git a/mcs/tools/mono-api-diff/mono-api-diff.cs b/mcs/tools/mono-api-diff/mono-api-diff.cs new file mode 100644 index 0000000000..1c289c4a14 --- /dev/null +++ b/mcs/tools/mono-api-diff/mono-api-diff.cs @@ -0,0 +1,1938 @@ +// +// mono-api-diff.cs - Compares 2 xml files produced by mono-api-info and +// produces a file suitable to build class status pages. +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Marek Safar (marek.safar@gmail.com) +// +// Maintainer: +// C.J. Adams-Collier (cjac@colliertech.org) +// +// (C) 2003 Novell, Inc (http://www.novell.com) +// (C) 2009,2010 Collier Technologies (http://www.colliertech.org) + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text; +using System.Xml; + +namespace Mono.ApiTools +{ +#if !EXCLUDE_DRIVER + class Driver + { + static int Main (string [] args) + { + bool showHelp = false; + string output = null; + List extra = null; + + var options = new Mono.Options.OptionSet { + { "h|?|help", "Show this help", v => showHelp = true }, + { "o|out|output=", "XML diff file output (omit for stdout)", v => output = v }, + }; + + try { + extra = options.Parse (args); + } catch (Mono.Options.OptionException e) { + Console.WriteLine ("Option error: {0}", e.Message); + extra = null; + } + + if (showHelp || extra == null || extra.Count != 2) { + Console.WriteLine (@"Usage: mono-api-diff.exe [options] "); + Console.WriteLine (); + Console.WriteLine ("Available options:"); + options.WriteOptionDescriptions (Console.Out); + Console.WriteLine (); + return showHelp ? 0 : 1; + } + + TextWriter outputStream = null; + try { + if (!string.IsNullOrEmpty (output)) + outputStream = new StreamWriter (output); + + ApiDiff.Generate(extra[0], extra[1], outputStream ?? Console.Out); + } catch (Exception e) { + Console.WriteLine (e); + return 1; + } finally { + outputStream?.Dispose (); + } + return 0; + } + } +#endif + + public static class ApiDiff + { + public static void Generate (string firstInfo, string secondInfo, TextWriter outStream) + { + if (firstInfo == null) + throw new ArgumentNullException (nameof (firstInfo)); + if (secondInfo == null) + throw new ArgumentNullException (nameof (secondInfo)); + + XMLAssembly ms = CreateXMLAssembly (firstInfo); + XMLAssembly mono = CreateXMLAssembly (secondInfo); + + Generate (ms, mono, outStream); + } + + public static void Generate (Stream firstInfo, Stream secondInfo, TextWriter outStream) + { + if (firstInfo == null) + throw new ArgumentNullException (nameof (firstInfo)); + if (secondInfo == null) + throw new ArgumentNullException (nameof (secondInfo)); + + XMLAssembly ms = CreateXMLAssembly (firstInfo); + XMLAssembly mono = CreateXMLAssembly (secondInfo); + + Generate (ms, mono, outStream); + } + + static void Generate (XMLAssembly first, XMLAssembly second, TextWriter outStream) + { + if (first == null) + throw new ArgumentNullException (nameof (first)); + if (second == null) + throw new ArgumentNullException (nameof (second)); + if (outStream == null) + throw new ArgumentNullException (nameof (outStream)); + + XmlDocument doc = first.CompareAndGetDocument (second); + + using (XmlTextWriter writer = new XmlTextWriter (outStream)) { + writer.Formatting = Formatting.Indented; + doc.WriteTo (writer); + } + } + + static XMLAssembly CreateXMLAssembly (string file) + { + using (var stream = File.OpenRead(file)) { + return CreateXMLAssembly (stream); + } + } + + static XMLAssembly CreateXMLAssembly (Stream stream) + { + XmlDocument doc = new XmlDocument (); + doc.Load (stream); + + XmlNode node = doc.SelectSingleNode ("/assemblies/assembly"); + XMLAssembly result = new XMLAssembly (); + result.LoadData (node); + + return result; + } + } + + class Counters + { + public int Present; + public int PresentTotal; + public int Missing; + public int MissingTotal; + public int Todo; + public int TodoTotal; + + public int Extra; + public int ExtraTotal; + public int Warning; + public int WarningTotal; + public int ErrorTotal; + + public Counters () + { + } + + public void AddPartialToPartial (Counters other) + { + Present += other.Present; + Extra += other.Extra; + Missing += other.Missing; + + Todo += other.Todo; + Warning += other.Warning; + AddPartialToTotal (other); + } + + public void AddPartialToTotal (Counters other) + { + PresentTotal += other.Present; + ExtraTotal += other.Extra; + MissingTotal += other.Missing; + + TodoTotal += other.Todo; + WarningTotal += other.Warning; + } + + public void AddTotalToPartial (Counters other) + { + Present += other.PresentTotal; + Extra += other.ExtraTotal; + Missing += other.MissingTotal; + + Todo += other.TodoTotal; + Warning += other.WarningTotal; + AddTotalToTotal (other); + } + + public void AddTotalToTotal (Counters other) + { + PresentTotal += other.PresentTotal; + ExtraTotal += other.ExtraTotal; + MissingTotal += other.MissingTotal; + + TodoTotal += other.TodoTotal; + WarningTotal += other.WarningTotal; + ErrorTotal += other.ErrorTotal; + } + + public int Total { + get { return Present + Missing; } + } + + public int AbsTotal { + get { return PresentTotal + MissingTotal; } + } + + public int Ok { + get { return Present - Todo; } + } + + public int OkTotal { + get { return PresentTotal - TodoTotal - ErrorTotal; } + } + + public override string ToString () + { + StringWriter sw = new StringWriter (); + sw.WriteLine ("Present: {0}", Present); + sw.WriteLine ("PresentTotal: {0}", PresentTotal); + sw.WriteLine ("Missing: {0}", Missing); + sw.WriteLine ("MissingTotal: {0}", MissingTotal); + sw.WriteLine ("Todo: {0}", Todo); + sw.WriteLine ("TodoTotal: {0}", TodoTotal); + sw.WriteLine ("Extra: {0}", Extra); + sw.WriteLine ("ExtraTotal: {0}", ExtraTotal); + sw.WriteLine ("Warning: {0}", Warning); + sw.WriteLine ("WarningTotal: {0}", WarningTotal); + sw.WriteLine ("ErrorTotal: {0}", ErrorTotal); + sw.WriteLine ("--"); + return sw.GetStringBuilder ().ToString (); + } + } + + abstract class XMLData + { + protected XmlDocument document; + protected Counters counters; + bool haveWarnings; + + public XMLData () + { + counters = new Counters (); + } + + public virtual void LoadData (XmlNode node) + { + } + + protected object [] LoadRecursive (XmlNodeList nodeList, Type type) + { + ArrayList list = new ArrayList (); + foreach (XmlNode node in nodeList) { + XMLData data = (XMLData) Activator.CreateInstance (type); + data.LoadData (node); + list.Add (data); + } + + return (object []) list.ToArray (type); + } + + public static bool IsMeaninglessAttribute (string s) + { + if (s == null) + return false; + if (s == "System.Runtime.CompilerServices.CompilerGeneratedAttribute") + return true; + return false; + } + + public static bool IsMonoTODOAttribute (string s) + { + if (s == null) + return false; + if (//s.EndsWith ("MonoTODOAttribute") || + s.EndsWith ("MonoDocumentationNoteAttribute") || + s.EndsWith ("MonoExtensionAttribute") || +// s.EndsWith ("MonoInternalNoteAttribute") || + s.EndsWith ("MonoLimitationAttribute") || + s.EndsWith ("MonoNotSupportedAttribute")) + return true; + return s.EndsWith ("TODOAttribute"); + } + + protected void AddAttribute (XmlNode node, string name, string value) + { + XmlAttribute attr = document.CreateAttribute (name); + attr.Value = value; + node.Attributes.Append (attr); + } + + protected void AddExtra (XmlNode node) + { + //TODO: count all the subnodes? + AddAttribute (node, "presence", "extra"); + AddAttribute (node, "ok", "1"); + AddAttribute (node, "ok_total", "1"); + AddAttribute (node, "extra", "1"); + AddAttribute (node, "extra_total", "1"); + } + + public void AddCountersAttributes (XmlNode node) + { + if (counters.Missing > 0) + AddAttribute (node, "missing", counters.Missing.ToString ()); + + if (counters.Present > 0) + AddAttribute (node, "present", counters.Present.ToString ()); + + if (counters.Extra > 0) + AddAttribute (node, "extra", counters.Extra.ToString ()); + + if (counters.Ok > 0) + AddAttribute (node, "ok", counters.Ok.ToString ()); + + if (counters.Total > 0) { + int percent = (100 * counters.Ok / counters.Total); + AddAttribute (node, "complete", percent.ToString ()); + } + + if (counters.Todo > 0) + AddAttribute (node, "todo", counters.Todo.ToString ()); + + if (counters.Warning > 0) + AddAttribute (node, "warning", counters.Warning.ToString ()); + + if (counters.MissingTotal > 0) + AddAttribute (node, "missing_total", counters.MissingTotal.ToString ()); + + if (counters.PresentTotal > 0) + AddAttribute (node, "present_total", counters.PresentTotal.ToString ()); + + if (counters.ExtraTotal > 0) + AddAttribute (node, "extra_total", counters.ExtraTotal.ToString ()); + + if (counters.OkTotal > 0) + AddAttribute (node, "ok_total", counters.OkTotal.ToString ()); + + if (counters.AbsTotal > 0) { + int percent = (100 * counters.OkTotal / counters.AbsTotal); + AddAttribute (node, "complete_total", percent.ToString ()); + } + + if (counters.TodoTotal > 0) { + AddAttribute (node, "todo_total", counters.TodoTotal.ToString ()); + //TODO: should be different on error. check error cases in corcompare. + AddAttribute (node, "error_total", counters.Todo.ToString ()); + } + + if (counters.WarningTotal > 0) + AddAttribute (node, "warning_total", counters.WarningTotal.ToString ()); + + } + + protected void AddWarning (XmlNode parent, string fmt, params object [] args) + { + counters.Warning++; + haveWarnings = true; + XmlNode warnings = parent.SelectSingleNode ("warnings"); + if (warnings == null) { + warnings = document.CreateElement ("warnings", null); + parent.AppendChild (warnings); + } + + AddAttribute (parent, "error", "warning"); + XmlNode warning = document.CreateElement ("warning", null); + AddAttribute (warning, "text", String.Format (fmt, args)); + warnings.AppendChild (warning); + } + + public bool HaveWarnings { + get { return haveWarnings; } + } + + public Counters Counters { + get { return counters; } + } + + public abstract void CompareTo (XmlDocument doc, XmlNode parent, object other); + } + + abstract class XMLNameGroup : XMLData + { + protected XmlNode group; + protected Hashtable keys; + + public override void LoadData (XmlNode node) + { + if (node == null) + throw new ArgumentNullException ("node"); + + if (node.Name != GroupName) + throw new FormatException (String.Format ("Expecting <{0}>", GroupName)); + + keys = new Hashtable (); + foreach (XmlNode n in node.ChildNodes) { + string name = n.Attributes ["name"].Value; + if (CheckIfAdd (name, n)) { + string key = GetNodeKey (name, n); + //keys.Add (key, name); + keys [key] = name; + LoadExtraData (key, n); + } + } + } + + protected virtual bool CheckIfAdd (string value, XmlNode node) + { + return true; + } + + protected virtual void LoadExtraData (string name, XmlNode node) + { + } + + public override void CompareTo (XmlDocument doc, XmlNode parent, object other) + { + this.document = doc; + if (group == null) + group = doc.CreateElement (GroupName, null); + + Hashtable okeys = null; + if (other != null && ((XMLNameGroup) other).keys != null) { + okeys = ((XMLNameGroup) other).keys; + } + + XmlNode node = null; + bool onull = (okeys == null); + if (keys != null) { + foreach (DictionaryEntry entry in keys) { + node = doc.CreateElement (Name, null); + group.AppendChild (node); + string key = (string) entry.Key; + string name = (string) entry.Value; + AddAttribute (node, "name", name); + + if (!onull && HasKey (key, okeys)) { + CompareToInner (key, node, (XMLNameGroup) other); + okeys.Remove (key); + counters.Present++; + } else { + AddAttribute (node, "presence", "missing"); + counters.Missing++; + } + } + } + + if (!onull && okeys.Count != 0) { + foreach (string value in okeys.Values) { + node = doc.CreateElement (Name, null); + AddAttribute (node, "name", (string) value); + AddAttribute (node, "presence", "extra"); + group.AppendChild (node); + counters.Extra++; + } + } + + if (group.HasChildNodes) + parent.AppendChild (group); + } + + protected virtual void CompareToInner (string name, XmlNode node, XMLNameGroup other) + { + } + + public virtual string GetNodeKey (string name, XmlNode node) + { + return name; + } + + public virtual bool HasKey (string key, Hashtable other) + { + return other.ContainsKey (key); + } + + public abstract string GroupName { get; } + public abstract string Name { get; } + } + + class XMLAssembly : XMLData + { + XMLAttributes attributes; + XMLNamespace [] namespaces; + string name; + string version; + + public override void LoadData (XmlNode node) + { + if (node == null) + throw new ArgumentNullException ("node"); + + name = node.Attributes ["name"].Value; + version = node.Attributes ["version"].Value; + XmlNode atts = node.FirstChild; + attributes = new XMLAttributes (); + if (atts.Name == "attributes") { + attributes.LoadData (atts); + atts = atts.NextSibling; + } + + if (atts == null || atts.Name != "namespaces") { +#if !EXCLUDE_DRIVER + Console.Error.WriteLine (@"Warning: no namespaces found for {name}"); +#endif + return; + } + + namespaces = (XMLNamespace []) LoadRecursive (atts.ChildNodes, typeof (XMLNamespace)); + } + + public override void CompareTo (XmlDocument doc, XmlNode parent, object other) + { + XMLAssembly assembly = (XMLAssembly) other; + + XmlNode childA = doc.CreateElement ("assembly", null); + AddAttribute (childA, "name", name); + AddAttribute (childA, "version", version); + if (name != assembly.name) + AddWarning (childA, "Assembly names not equal: {0}, {1}", name, assembly.name); + + if (version != assembly.version) + AddWarning (childA, "Assembly version not equal: {0}, {1}", version, assembly.version); + + parent.AppendChild (childA); + + attributes.CompareTo (doc, childA, assembly.attributes); + counters.AddPartialToPartial (attributes.Counters); + + CompareNamespaces (childA, assembly.namespaces); + if (assembly.attributes != null && assembly.attributes.IsTodo) { + counters.Todo++; + counters.TodoTotal++; + counters.ErrorTotal++; + AddAttribute (childA, "error", "todo"); + if (assembly.attributes.Comment != null) + AddAttribute (childA, "comment", assembly.attributes.Comment); + } + + AddCountersAttributes (childA); + } + + void CompareNamespaces (XmlNode parent, XMLNamespace [] other) + { + ArrayList newNS = new ArrayList (); + XmlNode group = document.CreateElement ("namespaces", null); + parent.AppendChild (group); + + Hashtable oh = CreateHash (other); + XmlNode node = null; + int count = (namespaces == null) ? 0 : namespaces.Length; + for (int i = 0; i < count; i++) { + XMLNamespace xns = namespaces [i]; + + node = document.CreateElement ("namespace", null); + newNS.Add (node); + AddAttribute (node, "name", xns.Name); + + int idx = -1; + if (oh.ContainsKey (xns.Name)) + idx = (int) oh [xns.Name]; + XMLNamespace ons = idx >= 0 ? (XMLNamespace) other [idx] : null; + xns.CompareTo (document, node, ons); + if (idx >= 0) + other [idx] = null; + xns.AddCountersAttributes (node); + counters.Present++; + counters.PresentTotal++; + counters.AddPartialToTotal (xns.Counters); + } + + if (other != null) { + count = other.Length; + for (int i = 0; i < count; i++) { + XMLNamespace n = other [i]; + if (n == null) + continue; + + node = document.CreateElement ("namespace", null); + newNS.Add (node); + AddAttribute (node, "name", n.Name); + AddExtra (node); + counters.ExtraTotal++; + } + } + + XmlNode [] nodes = (XmlNode []) newNS.ToArray (typeof (XmlNode)); + Array.Sort (nodes, XmlNodeComparer.Default); + foreach (XmlNode nn in nodes) + group.AppendChild (nn); + } + + static Hashtable CreateHash (XMLNamespace [] other) + { + Hashtable result = new Hashtable (); + if (other != null) { + int i = 0; + foreach (XMLNamespace n in other) { + result [n.Name] = i++; + } + } + + return result; + } + + public XmlDocument CompareAndGetDocument (XMLAssembly other) + { + XmlDocument doc = new XmlDocument (); + this.document = doc; + XmlNode parent = doc.CreateElement ("assemblies", null); + doc.AppendChild (parent); + + CompareTo (doc, parent, other); + + XmlNode decl = doc.CreateXmlDeclaration ("1.0", null, null); + doc.InsertBefore (decl, doc.DocumentElement); + + return doc; + } + } + + class XMLNamespace : XMLData + { + string name; + XMLClass [] types; + + public override void LoadData (XmlNode node) + { + if (node == null) + throw new ArgumentNullException ("node"); + + if (node.Name != "namespace") + throw new FormatException ("Expecting "); + + name = node.Attributes ["name"].Value; + XmlNode classes = node.FirstChild; + if (classes == null) { +#if !EXCLUDE_DRIVER + Console.Error.WriteLine ($"Warning: no classes for {name}"); +#endif + return; + } + + if (classes.Name != "classes") + throw new FormatException ($"Expecting . Got <{classes.Name}> (namespace {name})."); + + types = (XMLClass []) LoadRecursive (classes.ChildNodes, typeof (XMLClass)); + } + + public override void CompareTo (XmlDocument doc, XmlNode parent, object other) + { + this.document = doc; + XMLNamespace nspace = (XMLNamespace) other; + + XmlNode childA = doc.CreateElement ("classes", null); + parent.AppendChild (childA); + + CompareTypes (childA, nspace != null ? nspace.types : new XMLClass [0]); + } + + void CompareTypes (XmlNode parent, XMLClass [] other) + { + ArrayList newNodes = new ArrayList (); + Hashtable oh = CreateHash (other); + XmlNode node = null; + int count = (types == null) ? 0 : types.Length; + for (int i = 0; i < count; i++) { + XMLClass xclass = types [i]; + + node = document.CreateElement ("class", null); + newNodes.Add (node); + AddAttribute (node, "name", xclass.Name); + AddAttribute (node, "type", xclass.Type); + + int idx = -1; + if (oh.ContainsKey (xclass.Name)) + idx = (int) oh [xclass.Name]; + xclass.CompareTo (document, node, idx >= 0 ? other [idx] : new XMLClass ()); + if (idx >= 0) + other [idx] = null; + counters.AddPartialToPartial (xclass.Counters); + } + + if (other != null) { + count = other.Length; + for (int i = 0; i < count; i++) { + XMLClass c = other [i]; + if (c == null || IsMonoTODOAttribute (c.Name)) + continue; + + node = document.CreateElement ("class", null); + newNodes.Add (node); + AddAttribute (node, "name", c.Name); + AddAttribute (node, "type", c.Type); + AddExtra (node); + counters.Extra++; + counters.ExtraTotal++; + } + } + + XmlNode [] nodes = (XmlNode []) newNodes.ToArray (typeof (XmlNode)); + Array.Sort (nodes, XmlNodeComparer.Default); + foreach (XmlNode nn in nodes) + parent.AppendChild (nn); + } + + static Hashtable CreateHash (XMLClass [] other) + { + Hashtable result = new Hashtable (); + if (other != null) { + int i = 0; + foreach (XMLClass c in other) { + result [c.Name] = i++; + } + } + + return result; + } + + public string Name { + get { return name; } + } + } + + class XMLClass : XMLData + { + string name; + string type; + string baseName; + bool isSealed; + bool isSerializable; + bool isAbstract; + string charSet; + string layout; + XMLAttributes attributes; + XMLInterfaces interfaces; + XMLGenericTypeConstraints genericConstraints; + XMLFields fields; + XMLConstructors constructors; + XMLProperties properties; + XMLEvents events; + XMLMethods methods; + XMLClass [] nested; + + public override void LoadData (XmlNode node) + { + if (node == null) + throw new ArgumentNullException ("node"); + + name = node.Attributes ["name"].Value; + type = node.Attributes ["type"].Value; + XmlAttribute xatt = node.Attributes ["base"]; + if (xatt != null) + baseName = xatt.Value; + + xatt = node.Attributes ["sealed"]; + isSealed = (xatt != null && xatt.Value == "true"); + + xatt = node.Attributes ["abstract"]; + isAbstract = (xatt != null && xatt.Value == "true"); + + xatt = node.Attributes["serializable"]; + isSerializable = (xatt != null && xatt.Value == "true"); + + xatt = node.Attributes["charset"]; + if (xatt != null) + charSet = xatt.Value; + + xatt = node.Attributes["layout"]; + if (xatt != null) + layout = xatt.Value; + + XmlNode child = node.FirstChild; + if (child == null) { + return; + } + + if (child.Name == "attributes") { + attributes = new XMLAttributes (); + attributes.LoadData (child); + child = child.NextSibling; + } + + if (child != null && child.Name == "interfaces") { + interfaces = new XMLInterfaces (); + interfaces.LoadData (child); + child = child.NextSibling; + } + + if (child != null && child.Name == "generic-type-constraints") { + genericConstraints = new XMLGenericTypeConstraints (); + genericConstraints.LoadData (child); + child = child.NextSibling; + } + + if (child != null && child.Name == "fields") { + fields = new XMLFields (); + fields.LoadData (child); + child = child.NextSibling; + } + + if (child != null && child.Name == "constructors") { + constructors = new XMLConstructors (); + constructors.LoadData (child); + child = child.NextSibling; + } + + if (child != null && child.Name == "properties") { + properties = new XMLProperties (); + properties.LoadData (child); + child = child.NextSibling; + } + + if (child != null && child.Name == "events") { + events = new XMLEvents (); + events.LoadData (child); + child = child.NextSibling; + } + + if (child != null && child.Name == "methods") { + methods = new XMLMethods (); + methods.LoadData (child); + child = child.NextSibling; + } + + if (child != null && child.Name == "generic-parameters") { + // HACK: ignore this tag as it doesn't seem to + // add any value when checking for differences + return; + } + + if (child == null) + return; + + if (child.Name != "classes") { + throw new FormatException ($"Expecting . Got <{child.Name}> ({type} {name})."); + } + + nested = (XMLClass []) LoadRecursive (child.ChildNodes, typeof (XMLClass)); + } + + public override void CompareTo (XmlDocument doc, XmlNode parent, object other) + { + this.document = doc; + XMLClass oclass = (XMLClass) other; + + if (attributes != null || oclass.attributes != null) { + if (attributes == null) + attributes = new XMLAttributes (); + + attributes.CompareTo (doc, parent, oclass.attributes); + counters.AddPartialToPartial (attributes.Counters); + if (oclass.attributes != null && oclass.attributes.IsTodo) { + counters.Todo++; + counters.TodoTotal++; + counters.ErrorTotal++; + AddAttribute (parent, "error", "todo"); + if (oclass.attributes.Comment != null) + AddAttribute (parent, "comment", oclass.attributes.Comment); + } + } + + if (type != oclass.type) + AddWarning (parent, "Class type is wrong: {0} != {1}", type, oclass.type); + + if (baseName != oclass.baseName) + AddWarning (parent, "Base class is wrong: {0} != {1}", baseName, oclass.baseName); + + if (isAbstract != oclass.isAbstract || isSealed != oclass.isSealed) { + if ((isAbstract && isSealed) || (oclass.isAbstract && oclass.isSealed)) + AddWarning (parent, "Should {0}be static", (isAbstract && isSealed) ? "" : "not "); + else if (isAbstract != oclass.isAbstract) + AddWarning (parent, "Should {0}be abstract", isAbstract ? "" : "not "); + else if (isSealed != oclass.isSealed) + AddWarning (parent, "Should {0}be sealed", isSealed ? "" : "not "); + } + + if (isSerializable != oclass.isSerializable) + AddWarning (parent, "Should {0}be serializable", isSerializable ? "" : "not "); + + if (charSet != oclass.charSet) + AddWarning (parent, "CharSet is wrong: {0} != {1}", charSet, oclass.charSet); + + if (layout != oclass.layout) + AddWarning (parent, "Layout is wrong: {0} != {1}", layout, oclass.layout); + + if (interfaces != null || oclass.interfaces != null) { + if (interfaces == null) + interfaces = new XMLInterfaces (); + + interfaces.CompareTo (doc, parent, oclass.interfaces); + counters.AddPartialToPartial (interfaces.Counters); + } + + if (genericConstraints != null || oclass.genericConstraints != null) { + if (genericConstraints == null) + genericConstraints = new XMLGenericTypeConstraints (); + + genericConstraints.CompareTo (doc, parent, oclass.genericConstraints); + counters.AddPartialToPartial (genericConstraints.Counters); + } + + if (fields != null || oclass.fields != null) { + if (fields == null) + fields = new XMLFields (); + + fields.CompareTo (doc, parent, oclass.fields); + counters.AddPartialToPartial (fields.Counters); + } + + if (constructors != null || oclass.constructors != null) { + if (constructors == null) + constructors = new XMLConstructors (); + + constructors.CompareTo (doc, parent, oclass.constructors); + counters.AddPartialToPartial (constructors.Counters); + } + + if (properties != null || oclass.properties != null) { + if (properties == null) + properties = new XMLProperties (); + + properties.CompareTo (doc, parent, oclass.properties); + counters.AddPartialToPartial (properties.Counters); + } + + if (events != null || oclass.events != null) { + if (events == null) + events = new XMLEvents (); + + events.CompareTo (doc, parent, oclass.events); + counters.AddPartialToPartial (events.Counters); + } + + if (methods != null || oclass.methods != null) { + if (methods == null) + methods = new XMLMethods (); + + methods.CompareTo (doc, parent, oclass.methods); + counters.AddPartialToPartial (methods.Counters); + } + + if (nested != null || oclass.nested != null) { + XmlNode n = doc.CreateElement ("classes", null); + parent.AppendChild (n); + CompareTypes (n, oclass.nested); + } + + AddCountersAttributes (parent); + } + + void CompareTypes (XmlNode parent, XMLClass [] other) + { + ArrayList newNodes = new ArrayList (); + Hashtable oh = CreateHash (other); + XmlNode node = null; + int count = (nested == null) ? 0 : nested.Length; + for (int i = 0; i < count; i++) { + XMLClass xclass = nested [i]; + + node = document.CreateElement ("class", null); + newNodes.Add (node); + AddAttribute (node, "name", xclass.Name); + AddAttribute (node, "type", xclass.Type); + + if (oh.ContainsKey (xclass.Name)) { + int idx = (int) oh [xclass.Name]; + xclass.CompareTo (document, node, other [idx]); + other [idx] = null; + counters.AddPartialToPartial (xclass.Counters); + } else { + // TODO: Should I count here? + AddAttribute (node, "presence", "missing"); + counters.Missing++; + counters.MissingTotal++; + } + } + + if (other != null) { + count = other.Length; + for (int i = 0; i < count; i++) { + XMLClass c = other [i]; + if (c == null || IsMonoTODOAttribute (c.Name)) + continue; + + node = document.CreateElement ("class", null); + newNodes.Add (node); + AddAttribute (node, "name", c.Name); + AddAttribute (node, "type", c.Type); + AddExtra (node); + counters.Extra++; + counters.ExtraTotal++; + } + } + + XmlNode [] nodes = (XmlNode []) newNodes.ToArray (typeof (XmlNode)); + Array.Sort (nodes, XmlNodeComparer.Default); + foreach (XmlNode nn in nodes) + parent.AppendChild (nn); + } + + static Hashtable CreateHash (XMLClass [] other) + { + Hashtable result = new Hashtable (); + if (other != null) { + int i = 0; + foreach (XMLClass c in other) { + result [c.Name] = i++; + } + } + + return result; + } + + public string Name { + get { return name; } + } + + public string Type { + get { return type; } + } + } + + class XMLParameter : XMLData + { + string name; + string type; + string attrib; + string direction; + bool isUnsafe; + bool isOptional; + string defaultValue; + XMLAttributes attributes; + + public override void LoadData (XmlNode node) + { + if (node == null) + throw new ArgumentNullException ("node"); + + if (node.Name != "parameter") + throw new ArgumentException ("Expecting "); + + name = node.Attributes["name"].Value; + type = node.Attributes["type"].Value; + attrib = node.Attributes["attrib"].Value; + if (node.Attributes ["direction"] != null) + direction = node.Attributes["direction"].Value; + if (node.Attributes["unsafe"] != null) + isUnsafe = bool.Parse (node.Attributes["unsafe"].Value); + if (node.Attributes["optional"] != null) + isOptional = bool.Parse (node.Attributes["optional"].Value); + if (node.Attributes["defaultValue"] != null) + defaultValue = node.Attributes["defaultValue"].Value; + + XmlNode child = node.FirstChild; + if (child == null) + return; + + if (child.Name == "attributes") { + attributes = new XMLAttributes (); + attributes.LoadData (child); + child = child.NextSibling; + } + } + + public override void CompareTo (XmlDocument doc, XmlNode parent, object other) + { + this.document = doc; + + XMLParameter oparm = (XMLParameter) other; + + if (name != oparm.name) + AddWarning (parent, "Parameter name is wrong: {0} != {1}", name, oparm.name); + + if (type != oparm.type) + AddWarning (parent, "Parameter type is wrong: {0} != {1}", type, oparm.type); + + if (attrib != oparm.attrib) + AddWarning (parent, "Parameter attributes wrong: {0} != {1}", attrib, oparm.attrib); + + if (direction != oparm.direction) + AddWarning (parent, "Parameter direction wrong: {0} != {1}", direction, oparm.direction); + + if (isUnsafe != oparm.isUnsafe) + AddWarning (parent, "Parameter unsafe wrong: {0} != {1}", isUnsafe, oparm.isUnsafe); + + if (isOptional != oparm.isOptional) + AddWarning (parent, "Parameter optional wrong: {0} != {1}", isOptional, oparm.isOptional); + + if (defaultValue != oparm.defaultValue) + AddWarning (parent, "Parameter default value wrong: {0} != {1}", (defaultValue == null) ? "(no default value)" : defaultValue, (oparm.defaultValue == null) ? "(no default value)" : oparm.defaultValue); + + if (attributes != null || oparm.attributes != null) { + if (attributes == null) + attributes = new XMLAttributes (); + + attributes.CompareTo (doc, parent, oparm.attributes); + counters.AddPartialToPartial (attributes.Counters); + if (oparm.attributes != null && oparm.attributes.IsTodo) { + counters.Todo++; + counters.TodoTotal++; + counters.ErrorTotal++; + AddAttribute (parent, "error", "todo"); + if (oparm.attributes.Comment != null) + AddAttribute (parent, "comment", oparm.attributes.Comment); + } + } + } + + public string Name { + get { return name; } + } + } + + class XMLAttributeProperties: XMLNameGroup + { + static Hashtable ignored_properties; + static XMLAttributeProperties () + { + ignored_properties = new Hashtable (); + ignored_properties.Add ("System.Reflection.AssemblyKeyFileAttribute", "KeyFile"); + ignored_properties.Add ("System.Reflection.AssemblyCompanyAttribute", "Company"); + ignored_properties.Add ("System.Reflection.AssemblyConfigurationAttribute", "Configuration"); + ignored_properties.Add ("System.Reflection.AssemblyCopyrightAttribute", "Copyright"); + ignored_properties.Add ("System.Reflection.AssemblyProductAttribute", "Product"); + ignored_properties.Add ("System.Reflection.AssemblyTrademarkAttribute", "Trademark"); + ignored_properties.Add ("System.Reflection.AssemblyInformationalVersionAttribute", "InformationalVersion"); + + ignored_properties.Add ("System.ObsoleteAttribute", "Message"); + ignored_properties.Add ("System.IO.IODescriptionAttribute", "Description"); + ignored_properties.Add ("System.Diagnostics.MonitoringDescriptionAttribute", "Description"); + } + + Hashtable properties = new Hashtable (); + string attribute; + + public XMLAttributeProperties (string attribute) + { + this.attribute = attribute; + } + + public override void LoadData(XmlNode node) + { + if (node == null) + throw new ArgumentNullException ("node"); + + if (node.ChildNodes == null) + return; + + string ignored = ignored_properties [attribute] as string; + + foreach (XmlNode n in node.ChildNodes) { + string name = n.Attributes ["name"].Value; + if (ignored == name) + continue; + + if (n.Attributes ["null"] != null) { + properties.Add (name, null); + continue; + } + string value = n.Attributes ["value"].Value; + properties.Add (name, value); + } + } + + public override void CompareTo (XmlDocument doc, XmlNode parent, object other) + { + this.document = doc; + + Hashtable other_properties = ((XMLAttributeProperties)other).properties; + foreach (DictionaryEntry de in other_properties) { + object other_value = properties [de.Key]; + + if (de.Value == null) { + if (other_value != null) + AddWarning (parent, "Property '{0}' is 'null' and should be '{1}'", de.Key, other_value); + continue; + } + + if (de.Value.Equals (other_value)) + continue; + + AddWarning (parent, "Property '{0}' is '{1}' and should be '{2}'", + de.Key, de.Value, other_value == null ? "null" : other_value); + } + } + + public override string GroupName { + get { + return "properties"; + } + } + + public override string Name { + get { + return ""; + } + } + } + + class XMLAttributes : XMLNameGroup + { + Hashtable properties = new Hashtable (); + + bool isTodo; + string comment; + + protected override bool CheckIfAdd (string value, XmlNode node) + { + if (IsMonoTODOAttribute (value)) { + isTodo = true; + + XmlNode pNode = node.SelectSingleNode ("properties"); + if (pNode != null && pNode.ChildNodes.Count > 0 && pNode.ChildNodes [0].Attributes ["value"] != null) { + comment = pNode.ChildNodes [0].Attributes ["value"].Value; + } + return false; + } + + return !IsMeaninglessAttribute (value); + } + + protected override void CompareToInner (string name, XmlNode node, XMLNameGroup other) + { + XMLAttributeProperties other_prop = ((XMLAttributes)other).properties [name] as XMLAttributeProperties; + XMLAttributeProperties this_prop = properties [name] as XMLAttributeProperties; + if (other_prop == null || this_prop == null) + return; + + this_prop.CompareTo (document, node, other_prop); + counters.AddPartialToPartial (this_prop.Counters); + } + + public override string GetNodeKey (string name, XmlNode node) + { + string key = null; + + // if multiple attributes with the same name (type) exist, then we + // cannot be sure which attributes correspond, so we must use the + // name of the attribute (type) and the name/value of its properties + // as key + + XmlNodeList attributes = node.ParentNode.SelectNodes("attribute[@name='" + name + "']"); + if (attributes.Count > 1) { + ArrayList keyParts = new ArrayList (); + + XmlNodeList properties = node.SelectNodes ("properties/property"); + foreach (XmlNode property in properties) { + XmlAttributeCollection attrs = property.Attributes; + if (attrs["value"] != null) { + keyParts.Add (attrs["name"].Value + "=" + attrs["value"].Value); + } else { + keyParts.Add (attrs["name"].Value + "="); + } + } + + // sort properties by name, as order of properties in XML is + // undefined + keyParts.Sort (); + + // insert name (type) of attribute + keyParts.Insert (0, name); + + StringBuilder sb = new StringBuilder (); + foreach (string value in keyParts) { + sb.Append (value); + sb.Append (';'); + } + key = sb.ToString (); + } else { + key = name; + } + + return key; + } + + protected override void LoadExtraData(string name, XmlNode node) + { + XmlNode pNode = node.SelectSingleNode ("properties"); + + if (IsMonoTODOAttribute (name)) { + isTodo = true; + if (pNode.ChildNodes [0].Attributes ["value"] != null) { + comment = pNode.ChildNodes [0].Attributes ["value"].Value; + } + return; + } + + if (pNode != null) { + XMLAttributeProperties p = new XMLAttributeProperties (name); + p.LoadData (pNode); + + properties[name] = p; + } + } + + public override string GroupName { + get { return "attributes"; } + } + + public override string Name { + get { return "attribute"; } + } + + public bool IsTodo { + get { return isTodo; } + } + + public string Comment { + get { return comment; } + } + } + + class XMLInterfaces : XMLNameGroup + { + public override string GroupName { + get { return "interfaces"; } + } + + public override string Name { + get { return "interface"; } + } + } + + abstract class XMLGenericGroup : XMLNameGroup + { + string attributes; + + protected override void LoadExtraData (string name, XmlNode node) + { + attributes = ((XmlElement) node).GetAttribute ("generic-attribute"); + } + + protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) + { + base.CompareToInner (name, parent, other); + + XMLGenericGroup g = (XMLGenericGroup) other; + if (attributes != g.attributes) + AddWarning (parent, "Incorrect generic attributes: '{0}' != '{1}'", attributes, g.attributes); + } + } + + class XMLGenericTypeConstraints : XMLGenericGroup + { + public override string GroupName { + get { return "generic-type-constraints"; } + } + + public override string Name { + get { return "generic-type-constraint"; } + } + } + + class XMLGenericMethodConstraints : XMLGenericGroup + { + public override string GroupName { + get { return "generic-method-constraints"; } + } + + public override string Name { + get { return "generic-method-constraint"; } + } + } + + abstract class XMLMember : XMLNameGroup + { + Hashtable attributeMap; + Hashtable access = new Hashtable (); + + protected override void LoadExtraData (string name, XmlNode node) + { + XmlAttribute xatt = node.Attributes ["attrib"]; + if (xatt != null) + access [name] = xatt.Value; + + XmlNode orig = node; + + node = node.FirstChild; + while (node != null) { + if (node != null && node.Name == "attributes") { + XMLAttributes a = new XMLAttributes (); + a.LoadData (node); + if (attributeMap == null) + attributeMap = new Hashtable (); + + attributeMap [name] = a; + break; + } + node = node.NextSibling; + } + + base.LoadExtraData (name, orig); + } + + protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) + { + base.CompareToInner (name, parent, other); + XMLMember mb = other as XMLMember; + XMLAttributes att = null; + XMLAttributes oatt = null; + if (attributeMap != null) + att = attributeMap [name] as XMLAttributes; + + if (mb != null && mb.attributeMap != null) + oatt = mb.attributeMap [name] as XMLAttributes; + + if (att != null || oatt != null) { + if (att == null) + att = new XMLAttributes (); + + att.CompareTo (document, parent, oatt); + counters.AddPartialToPartial(att.Counters); + if (oatt != null && oatt.IsTodo) { + counters.Todo++; + counters.ErrorTotal++; + AddAttribute (parent, "error", "todo"); + if (oatt.Comment != null) + AddAttribute (parent, "comment", oatt.Comment); + } + } + + XMLMember member = (XMLMember) other; + string acc = access [name] as string; + if (acc == null) + return; + + string oacc = null; + if (member.access != null) + oacc = member.access [name] as string; + + string accName = ConvertToString (Int32.Parse (acc)); + string oaccName = ""; + if (oacc != null) + oaccName = ConvertToString (Int32.Parse (oacc)); + + if (accName != oaccName) + AddWarning (parent, "Incorrect attributes: '{0}' != '{1}'", accName, oaccName); + } + + protected virtual string ConvertToString (int att) + { + return null; + } + } + + class XMLFields : XMLMember + { + Hashtable fieldTypes; + Hashtable fieldValues; + + protected override void LoadExtraData (string name, XmlNode node) + { + XmlAttribute xatt = node.Attributes ["fieldtype"]; + if (xatt != null) { + if (fieldTypes == null) + fieldTypes = new Hashtable (); + + fieldTypes [name] = xatt.Value; + } + + xatt = node.Attributes ["value"]; + if (xatt != null) { + if (fieldValues == null) + fieldValues = new Hashtable (); + + fieldValues[name] = xatt.Value; + } + + base.LoadExtraData (name, node); + } + + protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) + { + base.CompareToInner (name, parent, other); + XMLFields fields = (XMLFields) other; + if (fieldTypes != null) { + string ftype = fieldTypes [name] as string; + string oftype = null; + if (fields.fieldTypes != null) + oftype = fields.fieldTypes [name] as string; + + if (ftype != oftype) + AddWarning (parent, "Field type is {0} and should be {1}", oftype, ftype); + } + if (fieldValues != null) { + string fvalue = fieldValues [name] as string; + string ofvalue = null; + if (fields.fieldValues != null) + ofvalue = fields.fieldValues [name] as string; + + if (fvalue != ofvalue) + AddWarning (parent, "Field value is {0} and should be {1}", ofvalue, fvalue); + } + } + + protected override string ConvertToString (int att) + { + FieldAttributes fa = (FieldAttributes) att; + return fa.ToString (); + } + + public override string GroupName { + get { return "fields"; } + } + + public override string Name { + get { return "field"; } + } + } + + class XMLParameters : XMLNameGroup + { + public override void LoadData (XmlNode node) + { + if (node == null) + throw new ArgumentNullException ("node"); + + if (node.Name != GroupName) + throw new FormatException (String.Format ("Expecting <{0}>", GroupName)); + + keys = new Hashtable (); + foreach (XmlNode n in node.ChildNodes) { + string name = n.Attributes["name"].Value; + string key = GetNodeKey (name, n); + XMLParameter parm = new XMLParameter (); + parm.LoadData (n); + keys.Add (key, parm); + LoadExtraData (key, n); + } + } + + public override string GroupName { + get { + return "parameters"; + } + } + + public override string Name { + get { + return "parameter"; + } + } + + public override string GetNodeKey (string name, XmlNode node) + { + return node.Attributes["position"].Value; + } + + public override void CompareTo (XmlDocument doc, XmlNode parent, object other) + { + this.document = doc; + if (group == null) + group = doc.CreateElement (GroupName, null); + + Hashtable okeys = null; + if (other != null && ((XMLParameters) other).keys != null) { + okeys = ((XMLParameters) other).keys; + } + + XmlNode node = null; + bool onull = (okeys == null); + if (keys != null) { + foreach (DictionaryEntry entry in keys) { + node = doc.CreateElement (Name, null); + group.AppendChild (node); + string key = (string) entry.Key; + XMLParameter parm = (XMLParameter) entry.Value; + AddAttribute (node, "name", parm.Name); + + if (!onull && HasKey (key, okeys)) { + parm.CompareTo (document, node, okeys[key]); + counters.AddPartialToPartial (parm.Counters); + okeys.Remove (key); + counters.Present++; + } else { + AddAttribute (node, "presence", "missing"); + counters.Missing++; + } + } + } + + if (!onull && okeys.Count != 0) { + foreach (XMLParameter value in okeys.Values) { + node = doc.CreateElement (Name, null); + AddAttribute (node, "name", value.Name); + AddAttribute (node, "presence", "extra"); + group.AppendChild (node); + counters.Extra++; + } + } + + if (group.HasChildNodes) + parent.AppendChild (group); + } + } + + class XMLProperties : XMLMember + { + Hashtable nameToMethod = new Hashtable (); + + protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) + { + Counters copy = counters; + counters = new Counters(); + + XMLProperties oprop = other as XMLProperties; + if (oprop != null) { + XMLMethods m = nameToMethod [name] as XMLMethods; + XMLMethods om = oprop.nameToMethod [name] as XMLMethods; + if (m != null || om != null) { + if (m == null) + m = new XMLMethods (); + + m.CompareTo(document, parent, om); + counters.AddPartialToPartial(m.Counters); + } + } + + base.CompareToInner (name, parent, other); + AddCountersAttributes(parent); + + copy.AddPartialToPartial(counters); + counters = copy; + } + + protected override void LoadExtraData (string name, XmlNode node) + { + XmlNode orig = node; + node = node.FirstChild; + while (node != null) { + if (node != null && node.Name == "methods") { + XMLMethods m = new XMLMethods (); + XmlNode parent = node.ParentNode; + string key = GetNodeKey (name, parent); + m.LoadData (node); + nameToMethod [key] = m; + break; + } + node = node.NextSibling; + } + + base.LoadExtraData (name, orig); + } + + public override string GetNodeKey (string name, XmlNode node) + { + XmlAttributeCollection atts = node.Attributes; + return String.Format ("{0}:{1}:{2}", + (atts["name"] != null ? atts["name"].Value : ""), + (atts["ptype"] != null ? atts["ptype"].Value : ""), + (atts["params"] != null ? atts["params"].Value : "") + ); + } + + public override string GroupName { + get { return "properties"; } + } + + public override string Name { + get { return "property"; } + } + } + + class XMLEvents : XMLMember + { + Hashtable eventTypes; + Hashtable nameToMethod = new Hashtable (); + + protected override void LoadExtraData (string name, XmlNode node) + { + XmlAttribute xatt = node.Attributes ["eventtype"]; + if (xatt != null) { + if (eventTypes == null) + eventTypes = new Hashtable (); + + eventTypes [name] = xatt.Value; + } + + XmlNode child = node.FirstChild; + while (child != null) { + if (child != null && child.Name == "methods") { + XMLMethods m = new XMLMethods (); + XmlNode parent = child.ParentNode; + string key = GetNodeKey (name, parent); + m.LoadData (child); + nameToMethod [key] = m; + break; + } + child = child.NextSibling; + } + + base.LoadExtraData (name, node); + } + + protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) + { + Counters copy = counters; + counters = new Counters (); + + try { + base.CompareToInner (name, parent, other); + AddCountersAttributes (parent); + if (eventTypes == null) + return; + + XMLEvents evt = (XMLEvents) other; + string etype = eventTypes [name] as string; + string oetype = null; + if (evt.eventTypes != null) + oetype = evt.eventTypes [name] as string; + + if (etype != oetype) + AddWarning (parent, "Event type is {0} and should be {1}", oetype, etype); + + XMLMethods m = nameToMethod [name] as XMLMethods; + XMLMethods om = evt.nameToMethod [name] as XMLMethods; + if (m != null || om != null) { + if (m == null) + m = new XMLMethods (); + + m.CompareTo (document, parent, om); + counters.AddPartialToPartial (m.Counters); + } + } finally { + AddCountersAttributes (parent); + copy.AddPartialToPartial (counters); + counters = copy; + } + } + + protected override string ConvertToString (int att) + { + EventAttributes ea = (EventAttributes) att; + return ea.ToString (); + } + + public override string GroupName { + get { return "events"; } + } + + public override string Name { + get { return "event"; } + } + } + + class XMLMethods : XMLMember + { + Hashtable returnTypes; + Hashtable parameters; + Hashtable genericConstraints; + Hashtable signatureFlags; + + [Flags] + enum SignatureFlags + { + None = 0, + Abstract = 1, + Virtual = 2, + Static = 4, + Final = 8, + } + + protected override void LoadExtraData (string name, XmlNode node) + { + XmlAttribute xatt = node.Attributes ["returntype"]; + if (xatt != null) { + if (returnTypes == null) + returnTypes = new Hashtable (); + + returnTypes [name] = xatt.Value; + } + + SignatureFlags flags = SignatureFlags.None; + if (((XmlElement) node).GetAttribute ("abstract") == "true") + flags |= SignatureFlags.Abstract; + if (((XmlElement) node).GetAttribute ("static") == "true") + flags |= SignatureFlags.Static; + if (((XmlElement) node).GetAttribute ("virtual") == "true") + flags |= SignatureFlags.Virtual; + if (((XmlElement) node).GetAttribute ("final") == "true") + flags |= SignatureFlags.Final; + if (flags != SignatureFlags.None) { + if (signatureFlags == null) + signatureFlags = new Hashtable (); + signatureFlags [name] = flags; + } + + XmlNode parametersNode = node.SelectSingleNode ("parameters"); + if (parametersNode != null) { + if (parameters == null) + parameters = new Hashtable (); + + XMLParameters parms = new XMLParameters (); + parms.LoadData (parametersNode); + + parameters[name] = parms; + } + + XmlNode genericNode = node.SelectSingleNode ("generic-method-constraints"); + if (genericNode != null) { + if (genericConstraints == null) + genericConstraints = new Hashtable (); + XMLGenericMethodConstraints csts = new XMLGenericMethodConstraints (); + csts.LoadData (genericNode); + genericConstraints [name] = csts; + } + + base.LoadExtraData (name, node); + } + + public override string GetNodeKey (string name, XmlNode node) + { + // for explicit/implicit operators we need to include the return + // type in the key to allow matching; as a side-effect, differences + // in return types will be reported as extra/missing methods + // + // for regular methods we do not need to take into account the + // return type for matching methods; differences in return types + // will be reported as a warning on the method + if (name.StartsWith ("op_")) { + XmlAttribute xatt = node.Attributes ["returntype"]; + string returnType = xatt != null ? xatt.Value + " " : string.Empty; + return returnType + name; + } + return name; + } + + protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) + { + // create backup of actual counters + Counters copy = counters; + // initialize counters for current method + counters = new Counters(); + + try { + base.CompareToInner(name, parent, other); + XMLMethods methods = (XMLMethods) other; + + SignatureFlags flags = signatureFlags != null && + signatureFlags.ContainsKey (name) ? + (SignatureFlags) signatureFlags [name] : + SignatureFlags.None; + SignatureFlags oflags = methods.signatureFlags != null && + methods.signatureFlags.ContainsKey (name) ? + (SignatureFlags) methods.signatureFlags [name] : + SignatureFlags.None; + + if (flags!= oflags) { + if (flags == SignatureFlags.None) + AddWarning (parent, String.Format ("should not be {0}", oflags)); + else if (oflags == SignatureFlags.None) + AddWarning (parent, String.Format ("should be {0}", flags)); + else + AddWarning (parent, String.Format ("{0} and should be {1}", oflags, flags)); + } + + if (returnTypes != null) { + string rtype = returnTypes[name] as string; + string ortype = null; + if (methods.returnTypes != null) + ortype = methods.returnTypes[name] as string; + + if (rtype != ortype) + AddWarning (parent, "Return type is {0} and should be {1}", ortype, rtype); + } + + if (parameters != null) { + XMLParameters parms = parameters[name] as XMLParameters; + parms.CompareTo (document, parent, methods.parameters[name]); + counters.AddPartialToPartial (parms.Counters); + } + } finally { + // output counter attributes in result document + AddCountersAttributes(parent); + + // add temporary counters to actual counters + copy.AddPartialToPartial(counters); + // restore backup of actual counters + counters = copy; + } + } + + protected override string ConvertToString (int att) + { + MethodAttributes ma = (MethodAttributes) att; + // ignore ReservedMasks + ma &= ~ MethodAttributes.ReservedMask; + ma &= ~ MethodAttributes.VtableLayoutMask; + if ((ma & MethodAttributes.FamORAssem) != 0) + ma = (ma & ~ MethodAttributes.FamORAssem) | MethodAttributes.Family; + + // ignore the HasSecurity attribute for now + if ((ma & MethodAttributes.HasSecurity) != 0) + ma = (MethodAttributes) (att - (int) MethodAttributes.HasSecurity); + + // ignore the RequireSecObject attribute for now + if ((ma & MethodAttributes.RequireSecObject) != 0) + ma = (MethodAttributes) (att - (int) MethodAttributes.RequireSecObject); + + // we don't care if the implementation is forwarded through PInvoke + if ((ma & MethodAttributes.PinvokeImpl) != 0) + ma = (MethodAttributes) (att - (int) MethodAttributes.PinvokeImpl); + + return ma.ToString (); + } + + public override string GroupName { + get { return "methods"; } + } + + public override string Name { + get { return "method"; } + } + } + + class XMLConstructors : XMLMethods + { + public override string GroupName { + get { return "constructors"; } + } + + public override string Name { + get { return "constructor"; } + } + } + + class XmlNodeComparer : IComparer + { + public static XmlNodeComparer Default = new XmlNodeComparer (); + + public int Compare (object a, object b) + { + XmlNode na = (XmlNode) a; + XmlNode nb = (XmlNode) b; + return String.Compare (na.Attributes ["name"].Value, nb.Attributes ["name"].Value); + } + } +} + diff --git a/mcs/tools/mono-api-diff/mono-api-diff.exe.sources b/mcs/tools/mono-api-diff/mono-api-diff.exe.sources new file mode 100644 index 0000000000..4978acfd17 --- /dev/null +++ b/mcs/tools/mono-api-diff/mono-api-diff.exe.sources @@ -0,0 +1,2 @@ +mono-api-diff.cs +../../class/Mono.Options/Mono.Options/Options.cs diff --git a/mcs/tools/mono-api-html/ApiChange.cs b/mcs/tools/mono-api-html/ApiChange.cs index a7e802d85e..c104bfa3b4 100644 --- a/mcs/tools/mono-api-html/ApiChange.cs +++ b/mcs/tools/mono-api-html/ApiChange.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Text; using System.Xml.Linq; -namespace Xamarin.ApiDiff -{ - public class ApiChange +namespace Mono.ApiTools { + + class ApiChange { public string Header; public StringBuilder Member = new StringBuilder (); @@ -14,10 +14,12 @@ namespace Xamarin.ApiDiff public bool AnyChange; public bool HasIgnoredChanges; public string SourceDescription; + public State State; - public ApiChange (string sourceDescription) + public ApiChange (string sourceDescription, State state) { SourceDescription = sourceDescription; + State = state; } public ApiChange Append (string text) @@ -28,7 +30,7 @@ namespace Xamarin.ApiDiff public ApiChange AppendAdded (string text, bool breaking = false) { - Formatter.Current.DiffAddition (Member, text, breaking); + State.Formatter.DiffAddition (Member, text, breaking); Breaking |= breaking; AnyChange = true; return this; @@ -36,7 +38,7 @@ namespace Xamarin.ApiDiff public ApiChange AppendRemoved (string text, bool breaking = true) { - Formatter.Current.DiffRemoval (Member, text, breaking); + State.Formatter.DiffRemoval (Member, text, breaking); Breaking |= breaking; AnyChange = true; return this; @@ -44,14 +46,22 @@ namespace Xamarin.ApiDiff public ApiChange AppendModified (string old, string @new, bool breaking = true) { - Formatter.Current.DiffModification (Member, old, @new, breaking); + State.Formatter.DiffModification (Member, old, @new, breaking); Breaking |= breaking; AnyChange = true; return this; } } - public class ApiChanges : Dictionary> { + class ApiChanges : Dictionary> { + + public State State; + + public ApiChanges (State state) + { + State = state; + } + public void Add (XElement source, XElement target, ApiChange change) { if (!change.AnyChange) { @@ -59,9 +69,9 @@ namespace Xamarin.ApiDiff if (!change.HasIgnoredChanges) { var isField = source.Name.LocalName == "field"; if (isField) { - Console.WriteLine ("Comparison resulting in no changes (src: {2} dst: {3}) :\n{0}\n{1}\n\n", source.ToString (), target.ToString (), source.GetFieldAttributes (), target.GetFieldAttributes ()); + State.LogDebugMessage ($"Comparison resulting in no changes (src: {source.GetFieldAttributes ()} dst: {target.GetFieldAttributes ()}) :\n{source}\n{target}\n\n"); } else { - Console.WriteLine ("Comparison resulting in no changes (src: {2} dst: {3}) :\n{0}\n{1}\n\n", source.ToString (), target.ToString (), source.GetMethodAttributes (), target.GetMethodAttributes ()); + State.LogDebugMessage ($"Comparison resulting in no changes (src: {source.GetMethodAttributes ()} dst: {target.GetMethodAttributes ()}) :\n{source}\n{target}\n\n"); } } return; diff --git a/mcs/tools/mono-api-html/ApiDiff.cs b/mcs/tools/mono-api-html/ApiDiff.cs index a895cfd332..8ca2b728c1 100644 --- a/mcs/tools/mono-api-html/ApiDiff.cs +++ b/mcs/tools/mono-api-html/ApiDiff.cs @@ -37,63 +37,39 @@ using System.IO; using System.Collections.Generic; using System.Text.RegularExpressions; -using Mono.Options; +namespace Mono.ApiTools { -namespace Xamarin.ApiDiff { + class State { + public TextWriter Output { get; set; } + public Formatter Formatter { get; set; } + public string Assembly { get; set; } + public string Namespace { get; set; } + public string Type { get; set; } + public string BaseType { get; set; } + public string Parent { get; set; } + public int Indent { get; set; } + public List IgnoreAdded { get; } = new List (); + public List IgnoreNew { get; } = new List (); + public List IgnoreRemoved { get; } = new List (); + public bool IgnoreParameterNameChanges { get; set; } + public bool IgnoreVirtualChanges { get; set; } + public bool IgnoreAddedPropertySetters { get; set; } + public bool IgnoreNonbreaking { get; set; } + public bool Lax { get; set; } + public bool Colorize { get; set; } = true; + public int Verbosity { get; set; } - public static class State { - static TextWriter output; - - public static TextWriter Output { - get { - if (output == null) - output = Console.Out; - return output; - } - set { output = value; } - } - - public static string Assembly { get; set; } - public static string Namespace { get; set; } - public static string Type { get; set; } - public static string BaseType { get; set; } - public static string Parent { get; set; } - - public static int Indent { get; set; } - - static List ignoreAdded = new List (); - public static List IgnoreAdded { - get { return ignoreAdded; } - } - - static List ignoreNew = new List (); - public static List IgnoreNew { - get { return ignoreNew; } - } - - static List ignoreRemoved = new List (); - public static List IgnoreRemoved { - get { return ignoreRemoved; } - } - - public static bool IgnoreParameterNameChanges { get; set; } - public static bool IgnoreVirtualChanges { get; set; } - public static bool IgnoreAddedPropertySetters { get; set; } - - public static bool IgnoreNonbreaking { get; set; } - - public static bool Lax; - public static bool Colorize = true; - - public static int Verbosity; - - public static void LogDebugMessage (string value) + public void LogDebugMessage (string value) { +#if !EXCLUDE_DRIVER if (Verbosity == 0) return; Console.WriteLine (value); +#endif } } + +#if !EXCLUDE_DRIVER class Program { public static int Main (string[] args) @@ -101,61 +77,51 @@ namespace Xamarin.ApiDiff { var showHelp = false; string diff = null; List extra = null; + var config = new ApiDiffFormattedConfig (); - var options = new OptionSet { + var options = new Mono.Options.OptionSet { { "h|help", "Show this help", v => showHelp = true }, - { "d|diff=", "HTML diff file out output (omit for stdout)", v => diff = v }, + { "d|o|out=|output=|diff=", "HTML diff file out output (omit for stdout)", v => diff = v }, { "i|ignore=", "Ignore new, added, and removed members whose description matches a given C# regular expression (see below).", v => { var r = new Regex (v); - State.IgnoreAdded.Add (r); - State.IgnoreRemoved.Add (r); - State.IgnoreNew.Add (r); + config.IgnoreAdded.Add (r); + config.IgnoreRemoved.Add (r); + config.IgnoreNew.Add (r); } }, { "a|ignore-added=", "Ignore added members whose description matches a given C# regular expression (see below).", - v => State.IgnoreAdded.Add (new Regex (v)) + v => config.IgnoreAdded.Add (new Regex (v)) }, { "r|ignore-removed=", "Ignore removed members whose description matches a given C# regular expression (see below).", - v => State.IgnoreRemoved.Add (new Regex (v)) + v => config.IgnoreRemoved.Add (new Regex (v)) }, { "n|ignore-new=", "Ignore new namespaces and types whose description matches a given C# regular expression (see below).", - v => State.IgnoreNew.Add (new Regex (v)) + v => config.IgnoreNew.Add (new Regex (v)) }, { "ignore-changes-parameter-names", "Ignore changes to parameter names for identically prototyped methods.", - v => State.IgnoreParameterNameChanges = v != null + v => config.IgnoreParameterNameChanges = v != null }, { "ignore-changes-property-setters", "Ignore adding setters to properties.", - v => State.IgnoreAddedPropertySetters = v != null + v => config.IgnoreAddedPropertySetters = v != null }, { "ignore-changes-virtual", "Ignore changing non-`virtual` to `virtual` or adding `override`.", - v => State.IgnoreVirtualChanges = v != null + v => config.IgnoreVirtualChanges = v != null }, - { "c|colorize:", "Colorize HTML output", v => State.Colorize = string.IsNullOrEmpty (v) ? true : bool.Parse (v) }, - { "x|lax", "Ignore duplicate XML entries", v => State.Lax = true }, - { "ignore-nonbreaking", "Ignore all nonbreaking changes", v => State.IgnoreNonbreaking = true }, + { "c|colorize:", "Colorize HTML output", v => config.Colorize = string.IsNullOrEmpty (v) ? true : bool.Parse (v) }, + { "x|lax", "Ignore duplicate XML entries", v => config.IgnoreDuplicateXml = true }, + { "ignore-nonbreaking", "Ignore all nonbreaking changes", v => config.IgnoreNonbreaking = true }, { "v|verbose:", "Verbosity level; when set, will print debug messages", - (int? v) => State.Verbosity = v ?? (State.Verbosity + 1)}, - { "md|markdown", "Output markdown instead of HTML", v => Formatter.Current = new MarkdownFormatter () }, - new ResponseFileSource (), + (int? v) => config.Verbosity = v ?? (config.Verbosity + 1)}, + { "md|markdown", "Output markdown instead of HTML", v => config.Formatter = ApiDiffFormatter.Markdown }, + new Mono.Options.ResponseFileSource (), }; try { extra = options.Parse (args); - } catch (OptionException e) { + } catch (Mono.Options.OptionException e) { Console.WriteLine ("Option error: {0}", e.Message); - showHelp = true; - } - - // unless specified default to HTML - if (Formatter.Current == null) - Formatter.Current = new HtmlFormatter (); - - if (State.IgnoreNonbreaking) { - State.IgnoreAddedPropertySetters = true; - State.IgnoreVirtualChanges = true; - State.IgnoreNew.Add (new Regex (".*")); - State.IgnoreAdded.Add (new Regex (".*")); + extra = null; } if (showHelp || extra == null || extra.Count < 2 || extra.Count > 3) { @@ -177,7 +143,7 @@ namespace Xamarin.ApiDiff { Console.WriteLine (" The regular expressions will match any member description ending with"); Console.WriteLine (" 'INSCopying' or 'INSCoding'."); Console.WriteLine (); - return 1; + return showHelp ? 0 : 1; } var input = extra [0]; @@ -185,37 +151,136 @@ namespace Xamarin.ApiDiff { if (extra.Count == 3 && diff == null) diff = extra [2]; + TextWriter outputStream = null; try { - var ac = new AssemblyComparer (input, output); - if (diff != null) { - string diffHtml = String.Empty; - using (var writer = new StringWriter ()) { - State.Output = writer; - ac.Compare (); - diffHtml = State.Output.ToString (); - } - if (diffHtml.Length > 0) { - using (var file = new StreamWriter (diff)) { - var title = $"{ac.SourceAssembly}.dll"; - if (ac.SourceAssembly != ac.TargetAssembly) - title += $" vs {ac.TargetAssembly}.dll"; - Formatter.Current.BeginDocument (file, $"API diff: {title}"); - Formatter.Current.BeginAssembly (file); - file.Write (diffHtml); - Formatter.Current.EndAssembly (file); - Formatter.Current.EndDocument (file); - } - } - } else { - State.Output = Console.Out; - ac.Compare (); - } - } - catch (Exception e) { + if (!string.IsNullOrEmpty (diff)) + outputStream = new StreamWriter (diff); + + ApiDiffFormatted.Generate (input, output, outputStream ?? Console.Out, config); + } catch (Exception e) { Console.WriteLine (e); return 1; + } finally { + outputStream?.Dispose (); } return 0; } } +#endif + + public enum ApiDiffFormatter { + Html, + Markdown, + } + + public class ApiDiffFormattedConfig { + public ApiDiffFormatter Formatter { get; set; } + public List IgnoreAdded { get; set; } = new List (); + public List IgnoreNew { get; set; } = new List (); + public List IgnoreRemoved { get; set; } = new List (); + public bool IgnoreParameterNameChanges { get; set; } + public bool IgnoreVirtualChanges { get; set; } + public bool IgnoreAddedPropertySetters { get; set; } + public bool IgnoreNonbreaking { get; set; } + public bool IgnoreDuplicateXml { get; set; } + public bool Colorize { get; set; } = true; + + internal int Verbosity { get; set; } + } + + public static class ApiDiffFormatted { + + public static void Generate (Stream firstInfo, Stream secondInfo, TextWriter outStream, ApiDiffFormattedConfig config = null) + { + var state = CreateState (config); + Generate (firstInfo, secondInfo, outStream, state); + } + + public static void Generate (string firstInfo, string secondInfo, TextWriter outStream, ApiDiffFormattedConfig config = null) + { + var state = CreateState (config); + Generate (firstInfo, secondInfo, outStream, state); + } + + internal static void Generate (string firstInfo, string secondInfo, TextWriter outStream, State state) + { + var ac = new AssemblyComparer (firstInfo, secondInfo, state); + Generate (ac, outStream, state); + } + + internal static void Generate (Stream firstInfo, Stream secondInfo, TextWriter outStream, State state) + { + var ac = new AssemblyComparer (firstInfo, secondInfo, state); + Generate (ac, outStream, state); + } + + static void Generate (AssemblyComparer ac, TextWriter outStream, State state) + { + var diffHtml = String.Empty; + using (var writer = new StringWriter ()) { + state.Output = writer; + ac.Compare (); + diffHtml = state.Output.ToString (); + } + + if (diffHtml.Length > 0) { + var title = $"{ac.SourceAssembly}.dll"; + if (ac.SourceAssembly != ac.TargetAssembly) + title += $" vs {ac.TargetAssembly}.dll"; + + state.Formatter.BeginDocument (outStream, $"API diff: {title}"); + state.Formatter.BeginAssembly (outStream); + outStream.Write (diffHtml); + state.Formatter.EndAssembly (outStream); + state.Formatter.EndDocument (outStream); + } + } + + static State CreateState (ApiDiffFormattedConfig config) + { + if (config == null) + config = new ApiDiffFormattedConfig (); + + var state = new State { + Colorize = config.Colorize, + Formatter = null, + IgnoreAddedPropertySetters = config.IgnoreAddedPropertySetters, + IgnoreVirtualChanges = config.IgnoreVirtualChanges, + IgnoreNonbreaking = config.IgnoreNonbreaking, + IgnoreParameterNameChanges = config.IgnoreParameterNameChanges, + Lax = config.IgnoreDuplicateXml, + + Verbosity = config.Verbosity + }; + + state.IgnoreAdded.AddRange (config.IgnoreAdded); + state.IgnoreNew.AddRange (config.IgnoreNew); + state.IgnoreRemoved.AddRange (config.IgnoreRemoved); + + switch (config.Formatter) + { + case ApiDiffFormatter.Html: + state.Formatter = new HtmlFormatter(state); + break; + case ApiDiffFormatter.Markdown: + state.Formatter = new MarkdownFormatter(state); + break; + default: + throw new ArgumentException("Invlid formatter specified."); + } + + // unless specified default to HTML + if (state.Formatter == null) + state.Formatter = new HtmlFormatter (state); + + if (state.IgnoreNonbreaking) { + state.IgnoreAddedPropertySetters = true; + state.IgnoreVirtualChanges = true; + state.IgnoreNew.Add (new Regex (".*")); + state.IgnoreAdded.Add (new Regex (".*")); + } + + return state; + } + } } diff --git a/mcs/tools/mono-api-html/AssemblyComparer.cs b/mcs/tools/mono-api-html/AssemblyComparer.cs index f09ab497ee..908658fffd 100644 --- a/mcs/tools/mono-api-html/AssemblyComparer.cs +++ b/mcs/tools/mono-api-html/AssemblyComparer.cs @@ -26,21 +26,33 @@ using System; using System.Collections.Generic; +using System.IO; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class AssemblyComparer : Comparer { + class AssemblyComparer : Comparer { XDocument source; XDocument target; NamespaceComparer comparer; - public AssemblyComparer (string sourceFile, string targetFile) + public AssemblyComparer (string sourceFile, string targetFile, State state) + : this (XDocument.Load(sourceFile), XDocument.Load(targetFile), state) { - source = XDocument.Load (sourceFile); - target = XDocument.Load (targetFile); - comparer = new NamespaceComparer (); + } + + public AssemblyComparer (Stream sourceFile, Stream targetFile, State state) + : this (XDocument.Load(sourceFile), XDocument.Load(targetFile), state) + { + } + + public AssemblyComparer (XDocument sourceFile, XDocument targetFile, State state) + : base (state) + { + source = sourceFile; + target = targetFile; + comparer = new NamespaceComparer (state); } public string SourceAssembly { get; private set; } diff --git a/mcs/tools/mono-api-html/ClassComparer.cs b/mcs/tools/mono-api-html/ClassComparer.cs index cf05a95049..9550bb4e69 100644 --- a/mcs/tools/mono-api-html/ClassComparer.cs +++ b/mcs/tools/mono-api-html/ClassComparer.cs @@ -30,9 +30,9 @@ using System.IO; using System.Linq; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class ClassComparer : Comparer { + class ClassComparer : Comparer { InterfaceComparer icomparer; ConstructorComparer ccomparer; @@ -42,14 +42,15 @@ namespace Xamarin.ApiDiff { MethodComparer mcomparer; ClassComparer kcomparer; - public ClassComparer () + public ClassComparer (State state) + : base (state) { - icomparer = new InterfaceComparer (); - ccomparer = new ConstructorComparer (); - fcomparer = new FieldComparer (); - pcomparer = new PropertyComparer (); - ecomparer = new EventComparer (); - mcomparer = new MethodComparer (); + icomparer = new InterfaceComparer (state); + ccomparer = new ConstructorComparer (state); + fcomparer = new FieldComparer (state); + pcomparer = new PropertyComparer (state); + ecomparer = new EventComparer (state); + mcomparer = new MethodComparer (state); } public override void SetContext (XElement current) @@ -190,7 +191,7 @@ namespace Xamarin.ApiDiff { Output.WriteLine (); Indent ().WriteLine ("// inner types"); State.Parent = State.Type; - kcomparer = new NestedClassComparer (); + kcomparer = new NestedClassComparer (State); foreach (var inner in t.Elements ("class")) kcomparer.AddedInner (inner); State.Type = State.Parent; @@ -227,7 +228,7 @@ namespace Xamarin.ApiDiff { !State.IgnoreRemoved.Any (re => re.IsMatch (rm)) && !(State.IgnoreNonbreaking && IsBaseChangeCompatible (sb, tb))) { Formatter.BeginMemberModification (Output, "Modified base type"); - var apichange = new ApiChange ($"{State.Namespace}.{State.Type}").AppendModified (sb, tb, true); + var apichange = new ApiChange ($"{State.Namespace}.{State.Type}", State).AppendModified (sb, tb, true); Formatter.Diff (Output, apichange); Formatter.EndMemberModification (Output); } @@ -242,7 +243,7 @@ namespace Xamarin.ApiDiff { var si = source.Element ("classes"); if (si != null) { var ti = target.Element ("classes"); - kcomparer = new NestedClassComparer (); + kcomparer = new NestedClassComparer (State); State.Parent = State.Type; kcomparer.Compare (si.Elements ("class"), ti == null ? null : ti.Elements ("class")); State.Type = State.Parent; @@ -280,7 +281,12 @@ namespace Xamarin.ApiDiff { } } - public class NestedClassComparer : ClassComparer { + class NestedClassComparer : ClassComparer { + + public NestedClassComparer (State state) + : base (state) + { + } public override void SetContext (XElement current) { diff --git a/mcs/tools/mono-api-html/Comparer.cs b/mcs/tools/mono-api-html/Comparer.cs index ddd4a4615e..c333f091a4 100644 --- a/mcs/tools/mono-api-html/Comparer.cs +++ b/mcs/tools/mono-api-html/Comparer.cs @@ -30,19 +30,28 @@ using System.IO; using System.Linq; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public abstract class Comparer { + abstract class Comparer { - protected List removed = new List (); - protected ApiChanges modified = new ApiChanges (); + protected List removed; + protected ApiChanges modified; + + public Comparer (State state) + { + State = state; + removed = new List (); + modified = new ApiChanges (state); + } + + public State State { get; } public TextWriter Output { get { return State.Output; } } public Formatter Formatter { - get { return Formatter.Current; } + get { return State.Formatter; } } protected TextWriter Indent () diff --git a/mcs/tools/mono-api-html/ConstructorComparer.cs b/mcs/tools/mono-api-html/ConstructorComparer.cs index 0fd136af5b..47594091bf 100644 --- a/mcs/tools/mono-api-html/ConstructorComparer.cs +++ b/mcs/tools/mono-api-html/ConstructorComparer.cs @@ -30,10 +30,15 @@ using System.Reflection; using System.Text; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { // MethodComparer inherits from this one - public class ConstructorComparer : MemberComparer { + class ConstructorComparer : MemberComparer { + + public ConstructorComparer (State state) + : base (state) + { + } public override string GroupName { get { return "constructors"; } @@ -50,8 +55,8 @@ namespace Xamarin.ApiDiff { void RenderReturnType (XElement source, XElement target, ApiChange change) { - var srcType = source.GetTypeName ("returntype"); - var tgtType = target.GetTypeName ("returntype"); + var srcType = source.GetTypeName ("returntype", State); + var tgtType = target.GetTypeName ("returntype", State); if (srcType != tgtType) { change.AppendModified (srcType, tgtType, true); @@ -68,7 +73,7 @@ namespace Xamarin.ApiDiff { if (base.Equals (source, target, changes)) return true; - var change = new ApiChange (GetDescription (source)); + var change = new ApiChange (GetDescription (source), State); change.Header = "Modified " + GroupName; RenderMethodAttributes (source, target, change); RenderReturnType (source, target, change); @@ -106,7 +111,7 @@ namespace Xamarin.ApiDiff { string name = e.GetAttribute ("name"); - var r = e.GetTypeName ("returntype"); + var r = e.GetTypeName ("returntype", State); if (r != null) { // ctor dont' have a return type sb.Append (r).Append (' '); @@ -123,7 +128,7 @@ namespace Xamarin.ApiDiff { if (genericp != null) { var list = new List (); foreach (var p in genericp.Elements ("generic-parameter")) { - list.Add (p.GetTypeName ("name")); + list.Add (p.GetTypeName ("name", State)); } sb.Append (Formatter.LesserThan).Append (String.Join (", ", list)).Append (Formatter.GreaterThan); } @@ -133,7 +138,7 @@ namespace Xamarin.ApiDiff { if (parameters != null) { var list = new List (); foreach (var p in parameters.Elements ("parameter")) { - var param = p.GetTypeName ("type"); + var param = p.GetTypeName ("type", State); if (!State.IgnoreParameterNameChanges) param += " " + p.GetAttribute ("name"); diff --git a/mcs/tools/mono-api-html/EventComparer.cs b/mcs/tools/mono-api-html/EventComparer.cs index 8c434037ad..3ef52b075d 100644 --- a/mcs/tools/mono-api-html/EventComparer.cs +++ b/mcs/tools/mono-api-html/EventComparer.cs @@ -28,9 +28,14 @@ using System; using System.Text; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class EventComparer : MemberComparer { + class EventComparer : MemberComparer { + + public EventComparer (State state) + : base (state) + { + } public override string GroupName { get { return "events"; } @@ -45,12 +50,12 @@ namespace Xamarin.ApiDiff { if (base.Equals (source, target, changes)) return true; - var change = new ApiChange (GetDescription (source)); + var change = new ApiChange (GetDescription (source), State); change.Header = "Modified " + GroupName; change.Append ("public event "); - var srcEventType = source.GetTypeName ("eventtype"); - var tgtEventType = target.GetTypeName ("eventtype"); + var srcEventType = source.GetTypeName ("eventtype", State); + var tgtEventType = target.GetTypeName ("eventtype", State); if (srcEventType != tgtEventType) { change.AppendModified (srcEventType, tgtEventType, true); @@ -67,7 +72,7 @@ namespace Xamarin.ApiDiff { StringBuilder sb = new StringBuilder (); // TODO: attribs sb.Append ("public event "); - sb.Append (e.GetTypeName ("eventtype")).Append (' '); + sb.Append (e.GetTypeName ("eventtype", State)).Append (' '); sb.Append (e.GetAttribute ("name")).Append (';'); return sb.ToString (); } diff --git a/mcs/tools/mono-api-html/FieldComparer.cs b/mcs/tools/mono-api-html/FieldComparer.cs index 3c987768c1..125324f5ed 100644 --- a/mcs/tools/mono-api-html/FieldComparer.cs +++ b/mcs/tools/mono-api-html/FieldComparer.cs @@ -31,9 +31,14 @@ using System.Reflection; using System.Text; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class FieldComparer : MemberComparer { + class FieldComparer : MemberComparer { + + public FieldComparer (State state) + : base (state) + { + } public override string GroupName { get { return "fields"; } @@ -109,7 +114,7 @@ namespace Xamarin.ApiDiff { var name = source.GetAttribute ("name"); var srcValue = source.GetAttribute ("value"); var tgtValue = target.GetAttribute ("value"); - var change = new ApiChange (GetDescription (source)); + var change = new ApiChange (GetDescription (source), State); change.Header = "Modified " + GroupName; if (State.BaseType == "System.Enum") { @@ -122,8 +127,8 @@ namespace Xamarin.ApiDiff { } else { RenderFieldAttributes (source.GetFieldAttributes (), target.GetFieldAttributes (), change); - var srcType = source.GetTypeName ("fieldtype"); - var tgtType = target.GetTypeName ("fieldtype"); + var srcType = source.GetTypeName ("fieldtype", State); + var tgtType = target.GetTypeName ("fieldtype", State); if (srcType != tgtType) { change.AppendModified (srcType, tgtType, true); @@ -184,7 +189,7 @@ namespace Xamarin.ApiDiff { sb.Append ("const "); } - string ftype = e.GetTypeName ("fieldtype"); + string ftype = e.GetTypeName ("fieldtype", State); sb.Append (ftype).Append (' '); sb.Append (name); if (ftype == "string" && e.Attribute ("value") != null) { diff --git a/mcs/tools/mono-api-html/Formatter.cs b/mcs/tools/mono-api-html/Formatter.cs index 88318600d8..834ebfc766 100644 --- a/mcs/tools/mono-api-html/Formatter.cs +++ b/mcs/tools/mono-api-html/Formatter.cs @@ -30,11 +30,16 @@ using System.Collections.Generic; using System.Xml.Linq; using System.Text; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public abstract class Formatter { + abstract class Formatter { - public static Formatter Current { get; set; } + public Formatter(State state) + { + State = state; + } + + public State State { get; } public abstract string LesserThan { get; } public abstract string GreaterThan { get; } diff --git a/mcs/tools/mono-api-html/Helpers.cs b/mcs/tools/mono-api-html/Helpers.cs index 854c1b2938..c9e8182c28 100644 --- a/mcs/tools/mono-api-html/Helpers.cs +++ b/mcs/tools/mono-api-html/Helpers.cs @@ -31,9 +31,9 @@ using System.Reflection; using System.Text; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public static class Helper { + static class Helper { public static bool IsTrue (this XElement self, string name) { return (self.GetAttribute (name) == "true"); @@ -92,7 +92,7 @@ namespace Xamarin.ApiDiff { } // make it beautiful (.NET -> C#) - public static string GetTypeName (this XElement self, string name) + public static string GetTypeName (this XElement self, string name, State state) { string type = self.GetAttribute (name); if (type == null) @@ -121,7 +121,7 @@ namespace Xamarin.ApiDiff { if (is_pointer) sb.Remove (sb.Length - 1, 1); - type = GetTypeName (sb.Replace ('+', '.').ToString ()); + type = GetTypeName (sb.Replace ('+', '.').ToString (), state); sb.Length = 0; if (is_ref) sb.Append (self.GetAttribute ("direction")).Append (' '); @@ -137,13 +137,13 @@ namespace Xamarin.ApiDiff { return sb.ToString (); } - static string GetTypeName (string type) + static string GetTypeName (string type, State state) { int pos = type.IndexOf ('`'); if (pos >= 0) { int end = type.LastIndexOf (']'); string subtype = type.Substring (pos + 3, end - pos - 3); - return type.Substring (0, pos) + Formatter.Current.LesserThan + GetTypeName (subtype) + Formatter.Current.GreaterThan; + return type.Substring (0, pos) + state.Formatter.LesserThan + GetTypeName (subtype, state) + state.Formatter.GreaterThan; } switch (type) { @@ -180,14 +180,14 @@ namespace Xamarin.ApiDiff { case "System.nint": return "nint"; case "System.nuint": - return "uint"; + return "nuint"; case "System.nfloat": return "nfloat"; case "System.IntPtr": return "IntPtr"; default: - if (type.StartsWith (State.Namespace, StringComparison.Ordinal)) - type = type.Substring (State.Namespace.Length + 1); + if (type.StartsWith (state.Namespace, StringComparison.Ordinal)) + type = type.Substring (state.Namespace.Length + 1); return type; } } diff --git a/mcs/tools/mono-api-html/HtmlFormatter.cs b/mcs/tools/mono-api-html/HtmlFormatter.cs index 55fd4f4ba6..a72252bd88 100644 --- a/mcs/tools/mono-api-html/HtmlFormatter.cs +++ b/mcs/tools/mono-api-html/HtmlFormatter.cs @@ -32,9 +32,14 @@ using System.Linq; using System.Xml.Linq; using System.Text; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class HtmlFormatter : Formatter { + class HtmlFormatter : Formatter { + + public HtmlFormatter (State state) + : base (state) + { + } public override string LesserThan => "<"; public override string GreaterThan => ">"; diff --git a/mcs/tools/mono-api-html/InterfaceComparer.cs b/mcs/tools/mono-api-html/InterfaceComparer.cs index df52f162e4..aa9911d256 100644 --- a/mcs/tools/mono-api-html/InterfaceComparer.cs +++ b/mcs/tools/mono-api-html/InterfaceComparer.cs @@ -27,9 +27,14 @@ using System; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class InterfaceComparer : MemberComparer { + class InterfaceComparer : MemberComparer { + + public InterfaceComparer (State state) + : base (state) + { + } public override string GroupName { get { return "interfaces"; } @@ -41,7 +46,7 @@ namespace Xamarin.ApiDiff { public override string GetDescription (XElement e) { - return e.GetTypeName ("name"); + return e.GetTypeName ("name", State); } } } \ No newline at end of file diff --git a/mcs/tools/mono-api-html/MarkdownFormatter.cs b/mcs/tools/mono-api-html/MarkdownFormatter.cs index 9b8b65dd10..fd9964c750 100644 --- a/mcs/tools/mono-api-html/MarkdownFormatter.cs +++ b/mcs/tools/mono-api-html/MarkdownFormatter.cs @@ -31,9 +31,14 @@ using System.Linq; using System.Xml.Linq; using System.Text; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class MarkdownFormatter : Formatter { + class MarkdownFormatter : Formatter { + + public MarkdownFormatter (State state) + : base (state) + { + } public override string LesserThan => "<"; public override string GreaterThan => ">"; diff --git a/mcs/tools/mono-api-html/MemberComparer.cs b/mcs/tools/mono-api-html/MemberComparer.cs index 413be610ea..f9c8502a94 100644 --- a/mcs/tools/mono-api-html/MemberComparer.cs +++ b/mcs/tools/mono-api-html/MemberComparer.cs @@ -31,13 +31,18 @@ using System.Reflection; using System.Text; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public abstract class MemberComparer : Comparer { + abstract class MemberComparer : Comparer { // true if this is the first element being added or removed in the group being rendered protected bool first; + public MemberComparer (State state) + : base (state) + { + } + public abstract string GroupName { get; } public abstract string ElementName { get; } @@ -230,7 +235,7 @@ namespace Xamarin.ApiDiff { string RenderGenericParameter (XElement gp) { var sb = new StringBuilder (); - sb.Append (gp.GetTypeName ("name")); + sb.Append (gp.GetTypeName ("name", State)); var constraints = gp.DescendantList ("generic-parameter-constraints", "generic-parameter-constraint"); if (constraints != null && constraints.Count > 0) { @@ -238,7 +243,7 @@ namespace Xamarin.ApiDiff { for (int i = 0; i < constraints.Count; i++) { if (i > 0) sb.Append (", "); - sb.Append (constraints [i].GetTypeName ("name")); + sb.Append (constraints [i].GetTypeName ("name", State)); } } return sb.ToString (); @@ -255,7 +260,7 @@ namespace Xamarin.ApiDiff { return; change.Append (Formatter.LesserThan); - for (int i = 0; i < Math.Max (srcCount, tgtCount); i++) { + for (int i = 0; i < System.Math.Max (srcCount, tgtCount); i++) { if (i > 0) change.Append (", "); if (i >= srcCount) { @@ -305,7 +310,7 @@ namespace Xamarin.ApiDiff { var tgtCount = tgt == null ? 0 : tgt.Count; change.Append (" ("); - for (int i = 0; i < Math.Max (srcCount, tgtCount); i++) { + for (int i = 0; i < System.Math.Max (srcCount, tgtCount); i++) { if (i > 0) change.Append (", "); @@ -319,12 +324,12 @@ namespace Xamarin.ApiDiff { mods_src = mods_src + " "; if (i >= srcCount) { - change.AppendAdded (mods_tgt + tgt [i].GetTypeName ("type") + " " + tgt [i].GetAttribute ("name"), true); + change.AppendAdded (mods_tgt + tgt [i].GetTypeName ("type", State) + " " + tgt [i].GetAttribute ("name"), true); } else if (i >= tgtCount) { - change.AppendRemoved (mods_src + src [i].GetTypeName ("type") + " " + src [i].GetAttribute ("name"), true); + change.AppendRemoved (mods_src + src [i].GetTypeName ("type", State) + " " + src [i].GetAttribute ("name"), true); } else { - var paramSourceType = src [i].GetTypeName ("type"); - var paramTargetType = tgt [i].GetTypeName ("type"); + var paramSourceType = src [i].GetTypeName ("type", State); + var paramTargetType = tgt [i].GetTypeName ("type", State); var paramSourceName = src [i].GetAttribute ("name"); var paramTargetName = tgt [i].GetAttribute ("name"); @@ -564,7 +569,7 @@ namespace Xamarin.ApiDiff { if (srcObsolete == null) { if (tgtObsolete == null) return; // neither is obsolete - var change = new ApiChange (GetDescription (source)); + var change = new ApiChange (GetDescription (source), State); change.Header = "Obsoleted " + GroupName; Formatter.RenderObsoleteMessage (change.Member, this, GetDescription (target), tgtObsolete); change.AnyChange = true; diff --git a/mcs/tools/mono-api-html/MethodComparer.cs b/mcs/tools/mono-api-html/MethodComparer.cs index 4c893e757e..9bfecb3c40 100644 --- a/mcs/tools/mono-api-html/MethodComparer.cs +++ b/mcs/tools/mono-api-html/MethodComparer.cs @@ -29,9 +29,14 @@ using System.Linq; using System.Reflection; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class MethodComparer : ConstructorComparer { + class MethodComparer : ConstructorComparer { + + public MethodComparer (State state) + : base (state) + { + } public override string GroupName { get { return "methods"; } diff --git a/mcs/tools/mono-api-html/NamespaceComparer.cs b/mcs/tools/mono-api-html/NamespaceComparer.cs index b509eb5424..d6f938483e 100644 --- a/mcs/tools/mono-api-html/NamespaceComparer.cs +++ b/mcs/tools/mono-api-html/NamespaceComparer.cs @@ -30,15 +30,16 @@ using System.IO; using System.Linq; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class NamespaceComparer : Comparer { + class NamespaceComparer : Comparer { ClassComparer comparer; - public NamespaceComparer () + public NamespaceComparer (State state) + : base (state) { - comparer = new ClassComparer (); + comparer = new ClassComparer (state); } public void Compare (XElement source, XElement target) diff --git a/mcs/tools/mono-api-html/PropertyComparer.cs b/mcs/tools/mono-api-html/PropertyComparer.cs index 1126205b26..7ecd4bf7f0 100644 --- a/mcs/tools/mono-api-html/PropertyComparer.cs +++ b/mcs/tools/mono-api-html/PropertyComparer.cs @@ -30,9 +30,14 @@ using System.Reflection; using System.Text; using System.Xml.Linq; -namespace Xamarin.ApiDiff { +namespace Mono.ApiTools { - public class PropertyComparer : MemberComparer { + class PropertyComparer : MemberComparer { + + public PropertyComparer (State state) + : base (state) + { + } public override string GroupName { get { return "properties"; } @@ -83,7 +88,7 @@ namespace Xamarin.ApiDiff { var s = sAttr & MethodAttributes.MemberAccessMask; // Visibility is ordered numerically (higher value = more visible). // We want the most visible. - var visibility = (MethodAttributes) Math.Max ((int) g, (int) s); + var visibility = (MethodAttributes) System.Math.Max ((int) g, (int) s); // Do a bitwise or with the rest of the flags var g_no_visibility = gAttr & ~MethodAttributes.MemberAccessMask; var s_no_visibility = sAttr & ~MethodAttributes.MemberAccessMask; @@ -92,8 +97,8 @@ namespace Xamarin.ApiDiff { void RenderPropertyType (XElement source, XElement target, ApiChange change) { - var srcType = source.GetTypeName ("ptype"); - var tgtType = target.GetTypeName ("ptype"); + var srcType = source.GetTypeName ("ptype", State); + var tgtType = target.GetTypeName ("ptype", State); if (srcType == tgtType) { change.Append (tgtType); @@ -146,8 +151,8 @@ namespace Xamarin.ApiDiff { if (i > 0) change.Append (", "); - var srcType = source.GetTypeName ("type"); - var tgtType = target.GetTypeName ("type"); + var srcType = source.GetTypeName ("type", State); + var tgtType = target.GetTypeName ("type", State); if (srcType == tgtType) { change.Append (tgtType); } else { @@ -185,7 +190,7 @@ namespace Xamarin.ApiDiff { isIndexer = srcIndexers != null && srcIndexers.Count > 0; } - var change = new ApiChange (GetDescription (source)); + var change = new ApiChange (GetDescription (source), State); change.Header = "Modified " + GroupName; RenderMethodAttributes (GetMethodAttributes (srcGetter, srcSetter), GetMethodAttributes (tgtGetter, tgtSetter), change); RenderPropertyType (source, target, change); @@ -224,7 +229,7 @@ namespace Xamarin.ApiDiff { public override string GetDescription (XElement e) { string name = e.Attribute ("name").Value; - string ptype = e.GetTypeName ("ptype"); + string ptype = e.GetTypeName ("ptype", State); bool virt = false; bool over = false; diff --git a/mk/Makefile.in b/mk/Makefile.in index 5f724b7c37..fe8ef536df 100644 --- a/mk/Makefile.in +++ b/mk/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/Makefile.in b/mono/Makefile.in index c39a676df9..e6c5fe42cf 100644 --- a/mono/Makefile.in +++ b/mono/Makefile.in @@ -210,6 +210,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -225,6 +227,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -265,11 +268,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/arch/Makefile.in b/mono/arch/Makefile.in index 0ceb17845b..8e57ea5a7c 100644 --- a/mono/arch/Makefile.in +++ b/mono/arch/Makefile.in @@ -210,6 +210,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -225,6 +227,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -265,11 +268,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/arch/amd64/Makefile.in b/mono/arch/amd64/Makefile.in index a5ad8d35ab..4d74b3c15b 100644 --- a/mono/arch/amd64/Makefile.in +++ b/mono/arch/amd64/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/arch/arm/Makefile.in b/mono/arch/arm/Makefile.in index b276290e37..6e26a71886 100644 --- a/mono/arch/arm/Makefile.in +++ b/mono/arch/arm/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/arch/arm64/Makefile.in b/mono/arch/arm64/Makefile.in index 1467d13b53..8db8a5cae1 100644 --- a/mono/arch/arm64/Makefile.in +++ b/mono/arch/arm64/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/arch/mips/Makefile.in b/mono/arch/mips/Makefile.in index 34c3db7bfe..1761ffa636 100644 --- a/mono/arch/mips/Makefile.in +++ b/mono/arch/mips/Makefile.in @@ -203,6 +203,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -218,6 +220,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -258,11 +261,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/arch/ppc/Makefile.in b/mono/arch/ppc/Makefile.in index 16f0922050..50ed4ca57e 100644 --- a/mono/arch/ppc/Makefile.in +++ b/mono/arch/ppc/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/arch/s390x/Makefile.in b/mono/arch/s390x/Makefile.in index c9d5046472..ff3824733c 100644 --- a/mono/arch/s390x/Makefile.in +++ b/mono/arch/s390x/Makefile.in @@ -197,6 +197,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -212,6 +214,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -252,11 +255,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/arch/sparc/Makefile.in b/mono/arch/sparc/Makefile.in index a7a9166971..faa5cb19b0 100644 --- a/mono/arch/sparc/Makefile.in +++ b/mono/arch/sparc/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/arch/x86/Makefile.in b/mono/arch/x86/Makefile.in index 2673b881ab..8a34b8b628 100644 --- a/mono/arch/x86/Makefile.in +++ b/mono/arch/x86/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/benchmark/Makefile.in b/mono/benchmark/Makefile.in index a841578282..f54d65e81f 100644 --- a/mono/benchmark/Makefile.in +++ b/mono/benchmark/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/btls/CMakeLists.txt b/mono/btls/CMakeLists.txt index ad4485b81c..1ded80e784 100644 --- a/mono/btls/CMakeLists.txt +++ b/mono/btls/CMakeLists.txt @@ -29,7 +29,12 @@ if (NOT "${BTLS_ARCH}" STREQUAL "") endif () if (NOT MSVC) - set (C_CXX_FLAGS "-Wall -Wsign-compare -Wmissing-field-initializers -fPIC -ggdb -fvisibility=hidden") + if(${CMAKE_SYSTEM_NAME} MATCHES "AIX" OR ${CMAKE_SYSTEM_NAME} MATCHES "OS400") + # GCC+XCOFF doesn't support -fvisibility=hidden, and we would prefer XCOFF debugging info. + set (C_CXX_FLAGS "-Wall -Wsign-compare -Wmissing-field-initializers -fPIC -gxcoff") + else() + set (C_CXX_FLAGS "-Wall -Wsign-compare -Wmissing-field-initializers -fPIC -ggdb -fvisibility=hidden") + endif() endif () set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_CXX_FLAGS} ${BTLS_CFLAGS}") diff --git a/mono/btls/Makefile.in b/mono/btls/Makefile.in index 37a5294079..b77ebf0c1a 100644 --- a/mono/btls/Makefile.in +++ b/mono/btls/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/btls/btls-pkcs12.c b/mono/btls/btls-pkcs12.c index 709ee819f9..39a5f9b6fa 100644 --- a/mono/btls/btls-pkcs12.c +++ b/mono/btls/btls-pkcs12.c @@ -83,7 +83,18 @@ mono_btls_pkcs12_import (MonoBtlsPkcs12 *pkcs12, const void *data, int len, cons { CBS cbs; CBS_init (&cbs, data, len); - return PKCS12_get_key_and_certs (&pkcs12->private_key, pkcs12->certs, &cbs, password); + int ret; + + ret = PKCS12_get_key_and_certs (&pkcs12->private_key, pkcs12->certs, &cbs, password); + if ((ret == 1) || (password && strlen (password) > 0)) + return ret; + + // When passed an empty password, we try both NULL and the empty string. + CBS_init (&cbs, data, len); + if (password) + return PKCS12_get_key_and_certs (&pkcs12->private_key, pkcs12->certs, &cbs, NULL); + else + return PKCS12_get_key_and_certs (&pkcs12->private_key, pkcs12->certs, &cbs, ""); } MONO_API int diff --git a/mono/btls/btls-x509.c b/mono/btls/btls-x509.c index 3853ce9f66..9f378bf651 100644 --- a/mono/btls/btls-x509.c +++ b/mono/btls/btls-x509.c @@ -116,22 +116,21 @@ mono_btls_x509_get_not_after (X509 *x509) MONO_API int mono_btls_x509_get_public_key (X509 *x509, BIO *bio) { - EVP_PKEY *pkey; - uint8_t *data = NULL; - int ret; + ASN1_BIT_STRING *pkey; + const unsigned char *data; + int ret, data_length; - pkey = X509_get_pubkey (x509); - if (!pkey) + if (!x509 || !x509->cert_info || !x509->cert_info->key) return -1; - ret = i2d_PublicKey (pkey, &data); + pkey = x509->cert_info->key->public_key; + if (!pkey || !pkey->data) + return -1; - if (ret > 0 && data) { - ret = BIO_write (bio, data, ret); - OPENSSL_free (data); - } + ret = BIO_write (bio, pkey->data, pkey->length); + if (ret != pkey->length) + return -1; - EVP_PKEY_free (pkey); return ret; } @@ -163,9 +162,7 @@ mono_btls_x509_get_serial_number (X509 *x509, char *buffer, int size, int mono_s return 0; } - for (idx = 0; idx < len; idx++) { - buffer [idx] = *(--p); - } + memcpy (buffer, temp, len); buffer [len] = 0; OPENSSL_free (temp); diff --git a/mono/cil/Makefile.in b/mono/cil/Makefile.in index e9d8f749df..d572b39b08 100644 --- a/mono/cil/Makefile.in +++ b/mono/cil/Makefile.in @@ -181,6 +181,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -196,6 +198,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -236,11 +239,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/cil/cil-opcodes.xml b/mono/cil/cil-opcodes.xml index 395c6f97a8..c779880212 100644 --- a/mono/cil/cil-opcodes.xml +++ b/mono/cil/cil-opcodes.xml @@ -309,8 +309,8 @@ - - + + diff --git a/mono/cil/opcode.def b/mono/cil/opcode.def index ecf7e26c40..b27d16e621 100644 --- a/mono/cil/opcode.def +++ b/mono/cil/opcode.def @@ -309,8 +309,8 @@ OPDEF(CEE_MONO_TLS, "mono_tls", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x0D, NEXT) OPDEF(CEE_MONO_ICALL_ADDR, "mono_icall_addr", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x0E, NEXT) OPDEF(CEE_MONO_DYN_CALL, "mono_dyn_call", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x0F, NEXT) OPDEF(CEE_MONO_MEMORY_BARRIER, "mono_memory_barrier", Pop0, Push0, InlineI, 0, 2, 0xF0, 0x10, NEXT) -OPDEF(CEE_MONO_JIT_ATTACH, "mono_jit_attach", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x11, NEXT) -OPDEF(CEE_MONO_JIT_DETACH, "mono_jit_detach", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x12, NEXT) +OPDEF(CEE_UNUSED71, "unused71", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x11, NEXT) +OPDEF(CEE_UNUSED72, "unused72", Pop0, Push0, InlineNone, 0, 2, 0xF0, 0x12, NEXT) OPDEF(CEE_MONO_JIT_ICALL_ADDR, "mono_jit_icall_addr", Pop0, PushI, InlineI, 0, 2, 0xF0, 0x13, NEXT) OPDEF(CEE_MONO_LDPTR_INT_REQ_FLAG, "mono_ldptr_int_req_flag", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x14, NEXT) OPDEF(CEE_MONO_LDPTR_CARD_TABLE, "mono_ldptr_card_table", Pop0, PushI, InlineNone, 0, 2, 0xF0, 0x15, NEXT) diff --git a/mono/dis/Makefile.in b/mono/dis/Makefile.in index a1e6aec229..22e3397903 100644 --- a/mono/dis/Makefile.in +++ b/mono/dis/Makefile.in @@ -119,8 +119,7 @@ am__DEPENDENCIES_1 = @SUPPORT_SGEN_TRUE@ $(top_builddir)/mono/sgen/libmonosgen.la am__DEPENDENCIES_3 = $(metadata_lib) $(am__DEPENDENCIES_2) \ $(top_builddir)/mono/utils/libmonoutils.la $(glib_libs) -monodis_DEPENDENCIES = libmonodis.a $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(glib_libs) +monodis_DEPENDENCIES = libmonodis.a $(am__DEPENDENCIES_3) $(glib_libs) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -251,6 +250,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -266,6 +267,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -306,11 +308,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/dis/dump.c b/mono/dis/dump.c index 8a4878d2c7..e33c41a576 100755 --- a/mono/dis/dump.c +++ b/mono/dis/dump.c @@ -898,7 +898,7 @@ handle_enum: break; } case MONO_TYPE_VALUETYPE: - if (mono_class_is_enum (sig->params [i]->data.klass)) { + if (m_class_is_enumtype (sig->params [i]->data.klass)) { type = mono_class_enum_basetype (sig->params [i]->data.klass)->type; goto handle_enum; } else { diff --git a/mono/dis/get.c.REMOVED.git-id b/mono/dis/get.c.REMOVED.git-id index 8f700b4e52..35de80bcd2 100644 --- a/mono/dis/get.c.REMOVED.git-id +++ b/mono/dis/get.c.REMOVED.git-id @@ -1 +1 @@ -39d65d357389d728c24f38edbb5a80e9a865ed7e \ No newline at end of file +f5495454b6b075435d7b75cc325d036da4e958a7 \ No newline at end of file diff --git a/mono/dis/main.c b/mono/dis/main.c index 8b10fc3d9d..927ea71ae7 100644 --- a/mono/dis/main.c +++ b/mono/dis/main.c @@ -1631,7 +1631,8 @@ disassemble_file (const char *file) return 1; } else { /* FIXME: is this call necessary? */ - mono_assembly_load_from_full (img, file, &status, FALSE); + /* FIXME: if it's necessary, can it be refonly instead? */ + mono_assembly_load_from_predicate (img, file, MONO_ASMCTX_DEFAULT, NULL, NULL, &status); } setup_filter (img); diff --git a/mono/eglib/Makefile.in b/mono/eglib/Makefile.in index 224bcff109..e8ad129155 100644 --- a/mono/eglib/Makefile.in +++ b/mono/eglib/Makefile.in @@ -230,6 +230,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -245,6 +247,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -285,11 +288,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/eglib/eglib-remap.h b/mono/eglib/eglib-remap.h index cd0e9087d5..f8409a3e74 100644 --- a/mono/eglib/eglib-remap.h +++ b/mono/eglib/eglib-remap.h @@ -205,12 +205,9 @@ #define g_string_append_unichar monoeg_g_string_append_unichar #define g_string_append_printf monoeg_g_string_append_printf #define g_string_append_vprintf monoeg_g_string_append_vprintf -#define g_string_erase monoeg_g_string_erase #define g_string_free monoeg_g_string_free -#define g_string_insert monoeg_g_string_insert #define g_string_new monoeg_g_string_new #define g_string_new_len monoeg_g_string_new_len -#define g_string_prepend monoeg_g_string_prepend #define g_string_printf monoeg_g_string_printf #define g_string_set_size monoeg_g_string_set_size #define g_string_sized_new monoeg_g_string_sized_new diff --git a/mono/eglib/glib.h b/mono/eglib/glib.h index f6d60ff317..49ead15ad0 100644 --- a/mono/eglib/glib.h +++ b/mono/eglib/glib.h @@ -99,6 +99,12 @@ typedef guint32 gunichar; #define G_MAXUSHORT USHRT_MAX #define G_MAXINT INT_MAX #define G_MININT INT_MIN +#define G_MAXINT8 INT8_MAX +#define G_MAXUINT8 UINT8_MAX +#define G_MININT8 INT8_MIN +#define G_MAXINT16 INT16_MAX +#define G_MAXUINT16 UINT16_MAX +#define G_MININT16 INT16_MIN #define G_MAXINT32 INT32_MAX #define G_MAXUINT32 UINT32_MAX #define G_MININT32 INT32_MIN @@ -304,10 +310,7 @@ GString *g_string_append_c (GString *string, gchar c); GString *g_string_append (GString *string, const gchar *val); GString *g_string_append_len (GString *string, const gchar *val, gssize len); GString *g_string_truncate (GString *string, gsize len); -GString *g_string_prepend (GString *string, const gchar *val); -GString *g_string_insert (GString *string, gssize pos, const gchar *val); GString *g_string_set_size (GString *string, gsize len); -GString *g_string_erase (GString *string, gssize pos, gssize len); #define g_string_sprintfa g_string_append_printf diff --git a/mono/eglib/goutput.c b/mono/eglib/goutput.c index 051b684c97..c93aa7e725 100644 --- a/mono/eglib/goutput.c +++ b/mono/eglib/goutput.c @@ -187,7 +187,7 @@ to_android_priority (GLogLevelFlags log_level) #define LOG_MESSAGE_MAX_LEN 4096 static void -android_log_line (gint log_priority, const gchar *log_domain, gchar *log_message, gint log_len) +android_log_line (gint log_priority, const gchar *log_domain, const gchar *log_message, gint log_len) { gchar log_buf [LOG_MESSAGE_MAX_LEN]; @@ -204,7 +204,7 @@ static void android_log (gint log_priority, const gchar *log_domain, const gchar *log_message) { gint log_message_len, log_message_p_len; - gchar *log_message_p; + const gchar *log_message_p; log_message_len = strlen (log_message); if (log_message_len <= LOG_MESSAGE_MAX_LEN) { @@ -213,7 +213,7 @@ android_log (gint log_priority, const gchar *log_domain, const gchar *log_messag } for (log_message_p = log_message; log_message_p < log_message + log_message_len;) { - gchar *p = strstr (log_message_p, "\n"); + const gchar *p = strstr (log_message_p, "\n"); if (p == NULL) { /* There is no more "\n". */ android_log_line (log_priority, log_domain, log_message_p, LOG_MESSAGE_MAX_LEN - 1); diff --git a/mono/eglib/gspawn.c b/mono/eglib/gspawn.c index e1b0e2968a..1d9d4c5863 100644 --- a/mono/eglib/gspawn.c +++ b/mono/eglib/gspawn.c @@ -80,7 +80,9 @@ * arm-apple-darwin9. We'll manually define the symbol on Apple as it does * in fact exist on all implementations (so far) */ +G_BEGIN_DECLS gchar ***_NSGetEnviron(void); +G_END_DECLS #define environ (*_NSGetEnviron()) #else static char *mono_environ[1] = { NULL }; @@ -89,7 +91,9 @@ static char *mono_environ[1] = { NULL }; #elif defined(_MSC_VER) /* MS defines this in stdlib.h */ #else +G_BEGIN_DECLS extern char **environ; +G_END_DECLS #endif #ifndef G_OS_WIN32 @@ -477,7 +481,8 @@ g_spawn_async_with_pipes (const gchar *working_directory, } execve (arg0, actual_args, envp); - write_all (info_pipe [1], &errno, sizeof (int)); + int const err = errno; + write_all (info_pipe [1], &err, sizeof (int)); exit (0); } } else if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) { diff --git a/mono/eglib/gstring.c b/mono/eglib/gstring.c index ba75789bc8..70a51c8952 100644 --- a/mono/eglib/gstring.c +++ b/mono/eglib/gstring.c @@ -146,41 +146,6 @@ g_string_append_unichar (GString *string, gunichar c) return g_string_append_len (string, utf8, len); } -GString * -g_string_prepend (GString *string, const gchar *val) -{ - gssize len; - - g_return_val_if_fail (string != NULL, string); - g_return_val_if_fail (val != NULL, string); - - len = strlen (val); - - GROW_IF_NECESSARY(string, len); - memmove(string->str + len, string->str, string->len + 1); - memcpy(string->str, val, len); - - return string; -} - -GString * -g_string_insert (GString *string, gssize pos, const gchar *val) -{ - gssize len; - - g_return_val_if_fail (string != NULL, string); - g_return_val_if_fail (val != NULL, string); - g_return_val_if_fail (pos <= string->len, string); - - len = strlen (val); - - GROW_IF_NECESSARY(string, len); - memmove(string->str + pos + len, string->str + pos, string->len - pos - len + 1); - memcpy(string->str + pos, val, len); - - return string; -} - void g_string_append_printf (GString *string, const gchar *format, ...) { @@ -254,23 +219,3 @@ g_string_set_size (GString *string, gsize len) string->str[len] = 0; return string; } - -GString * -g_string_erase (GString *string, gssize pos, gssize len) -{ - g_return_val_if_fail (string != NULL, string); - - /* Silent return */ - if (pos >= string->len) - return string; - - if (len == -1 || (pos + len) >= string->len) { - string->str[pos] = 0; - } - else { - memmove (string->str + pos, string->str + pos + len, string->len - (pos + len) + 1); - string->len -= len; - } - - return string; -} diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am index c5448e7eb4..2e3dcc632f 100644 --- a/mono/metadata/Makefile.am +++ b/mono/metadata/Makefile.am @@ -19,7 +19,8 @@ win32_sources = \ w32process-win32.c \ w32process-win32-internals.h \ w32socket-win32.c \ - w32error-win32.c + w32error-win32.c \ + w32subset.h platform_sources = $(win32_sources) @@ -123,7 +124,8 @@ libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\" if DISABLE_ICALL_TABLES libmono_icall_table_la_SOURCES = \ icall-table.c -libmono_icall_table_la_CFLAGS = $(SGEN_DEFINES) +# Add CXX_ADD_CFLAGS per-library until/unless https://github.com/dotnet/corefx/pull/31342. +libmono_icall_table_la_CFLAGS = $(SGEN_DEFINES) @CXX_ADD_CFLAGS@ libmono_icall_table_la_LDFLAGS = $(libmonoldflags) if BITCODE libmono_icall_table_la_LIBADD = $(glib_libs) ../utils/libmonoutils.la ../sgen/libmonosgen.la libmonoruntimesgen.la @@ -142,7 +144,8 @@ libmono_ilgen_la_SOURCES = \ marshal-ilgen.h \ sgen-mono-ilgen.c \ sgen-mono-ilgen.h -libmono_ilgen_la_CFLAGS = $(SGEN_DEFINES) +# Add CXX_ADD_CFLAGS per-library until/unless https://github.com/dotnet/corefx/pull/31342. +libmono_ilgen_la_CFLAGS = $(SGEN_DEFINES) @CXX_ADD_CFLAGS@ libmono_ilgen_la_LDFLAGS = $(libmonoldflags) if BITCODE libmono_ilgen_la_LIBADD = $(glib_libs) ../utils/libmonoutils.la ../sgen/libmonosgen.la libmonoruntimesgen.la @@ -180,9 +183,12 @@ libmono_system_native_la_SOURCES = \ ../../external/corefx/src/Native/Unix/System.Native/pal_tcpstate.c \ ../../external/corefx/src/Native/Unix/System.Native/pal_tcpstate.h \ ../../external/corefx/src/Native/Unix/System.Native/pal_random.c \ - ../../external/corefx/src/Native/Unix/System.Native/pal_random.h + ../../external/corefx/src/Native/Unix/System.Native/pal_random.h \ + pal-icalls.h \ + pal-icalls.c -libmono_system_native_la_CFLAGS = -I$(abs_top_srcdir)/external/corefx/src/Native/Unix/Common -I$(abs_top_srcdir)/external/corefx/src/Native/Unix/System.Native -Wno-typedef-redefinition +# Add back CXX_REMOVE_CFLAGS to keep this as C until/unless https://github.com/dotnet/corefx/pull/31342. +libmono_system_native_la_CFLAGS = -I$(abs_top_srcdir)/external/corefx/src/Native/Unix/Common -I$(abs_top_srcdir)/external/corefx/src/Native/Unix/System.Native -Wno-typedef-redefinition @CXX_REMOVE_CFLAGS@ CLEANFILES = mono-bundle.stamp @@ -241,11 +247,10 @@ common_sources = \ debug-mono-symfile.c \ debug-mono-ppdb.h \ debug-mono-ppdb.c \ - decimal-ms.c \ - decimal-ms.h \ domain-internals.h \ environment.c \ environment.h \ + environment-internal.h \ exception.c \ exception.h \ exception-internals.h \ @@ -256,6 +261,7 @@ common_sources = \ filewatcher.h \ gc-internals.h \ icall.c \ + icalls.h \ icall-internals.h \ icall-def.h \ icall-table.h \ @@ -302,8 +308,7 @@ common_sources = \ monitor.h \ normalization-tables.h \ number-formatter.h \ - number-ms.c \ - number-ms.h \ + number-ms.h \ object.c \ object-forward.h \ object-internals.h \ @@ -404,17 +409,26 @@ sgen_sources = \ sgen-mono.h \ sgen-client-mono.h +# Per-library to workaround CoreFX/native until/unless https://github.com/dotnet/corefx/pull/31342. +#CFLAGS := $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @CXX_ADD_CFLAGS@ +CFLAGS := $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) + libmonoruntime_la_SOURCES = $(common_sources) $(icall_tables_sources) $(ilgen_sources) $(gc_dependent_sources) $(null_gc_sources) $(boehm_sources) -libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES) +# Add CXX_ADD_CFLAGS per-library until/unless https://github.com/dotnet/corefx/pull/31342. +libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES) @CXX_ADD_CFLAGS@ libmonoruntime_la_LIBADD = libmonoruntime-config.la libmonoruntimesgen_la_SOURCES = $(common_sources) $(icall_tables_sources) $(ilgen_sources) $(gc_dependent_sources) $(sgen_sources) -libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES) +# Add CXX_ADD_CFLAGS per-library until/unless https://github.com/dotnet/corefx/pull/31342. +libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES) @CXX_ADD_CFLAGS@ libmonoruntimesgen_la_LIBADD = libmonoruntime-config.la libmonoruntimeincludedir = $(includedir)/mono-$(API_VER)/mono/metadata # This list is sorted for easier searching. +# These are public headers. +# They may not use G_BEGIN_DECLS, guint, glib.h, etc. +# debug-mono-symfile.h is an exception. It is only semi-public. libmonoruntimeinclude_HEADERS = \ appdomain.h \ assembly.h \ diff --git a/mono/metadata/Makefile.in.REMOVED.git-id b/mono/metadata/Makefile.in.REMOVED.git-id index 7691f35c2a..b4b8117e63 100644 --- a/mono/metadata/Makefile.in.REMOVED.git-id +++ b/mono/metadata/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -92e48808a757a0db1dcc2a57ba2559625168858a \ No newline at end of file +e8fa1f69de3d4ece37b3a872ad6786f90d643373 \ No newline at end of file diff --git a/mono/metadata/abi-details.h b/mono/metadata/abi-details.h index b0cdd52174..6d6bafde3c 100644 --- a/mono/metadata/abi-details.h +++ b/mono/metadata/abi-details.h @@ -61,4 +61,6 @@ enum { #endif #endif +#define MONO_SIZEOF_MonoObject (2 * MONO_SIZEOF_gpointer) + #endif diff --git a/mono/metadata/appdomain-icalls.h b/mono/metadata/appdomain-icalls.h index c197d01811..d67c51a6e1 100644 --- a/mono/metadata/appdomain-icalls.h +++ b/mono/metadata/appdomain-icalls.h @@ -11,23 +11,27 @@ #include #include #include +#include +ICALL_EXPORT MonoAppDomainHandle ves_icall_System_AppDomain_getCurDomain (MonoError *error); +ICALL_EXPORT MonoAppDomainHandle ves_icall_System_AppDomain_getRootDomain (MonoError *error); +ICALL_EXPORT MonoAppDomainHandle ves_icall_System_AppDomain_createDomain (MonoStringHandle friendly_name, MonoAppDomainSetupHandle setup, MonoError *error); - +ICALL_EXPORT MonoObjectHandle ves_icall_System_AppDomain_GetData (MonoAppDomainHandle ad, MonoStringHandle name, MonoError* error); - +ICALL_EXPORT MonoReflectionAssemblyHandle ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad, MonoArrayHandle raw_assembly, @@ -35,90 +39,97 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad, MonoObjectHandle evidence, MonoBoolean refonly, MonoError *error); - +ICALL_EXPORT void ves_icall_System_AppDomain_SetData (MonoAppDomainHandle ad, MonoStringHandle name, MonoObjectHandle data, MonoError *error); - +ICALL_EXPORT MonoAppDomainSetupHandle ves_icall_System_AppDomain_getSetup (MonoAppDomainHandle ad, MonoError *error); - +ICALL_EXPORT MonoStringHandle ves_icall_System_AppDomain_getFriendlyName (MonoAppDomainHandle ad, MonoError *error); - +ICALL_EXPORT MonoArrayHandle ves_icall_System_AppDomain_GetAssemblies (MonoAppDomainHandle ad, MonoBoolean refonly, MonoError *error); - +ICALL_EXPORT MonoReflectionAssemblyHandle ves_icall_System_Reflection_Assembly_LoadFile_internal (MonoStringHandle fname, MonoError *error); - +ICALL_EXPORT MonoReflectionAssemblyHandle ves_icall_System_Reflection_Assembly_LoadFrom (MonoStringHandle fname, MonoBoolean refonly, MonoError *error); - +ICALL_EXPORT MonoReflectionAssemblyHandle ves_icall_System_AppDomain_LoadAssembly (MonoAppDomainHandle ad, MonoStringHandle assRef, MonoObjectHandle evidence, MonoBoolean refonly, MonoError *error); - +ICALL_EXPORT gboolean ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id, MonoError *error); +ICALL_EXPORT void ves_icall_System_AppDomain_InternalUnload (gint32 domain_id, MonoError *error); - +ICALL_EXPORT void ves_icall_System_AppDomain_DoUnhandledException (MonoExceptionHandle exc, MonoError *error); +ICALL_EXPORT gint32 ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomainHandle ad, MonoReflectionAssemblyHandle refass, MonoArrayHandle args, MonoError *error); - +ICALL_EXPORT MonoAppDomainHandle ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomainHandle ad, MonoError *error); +ICALL_EXPORT MonoAppDomainHandle ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid, MonoError *error); +ICALL_EXPORT void ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomainHandle ad, MonoError *error); +ICALL_EXPORT void ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id, MonoError *error); +ICALL_EXPORT void ves_icall_System_AppDomain_InternalPopDomainRef (MonoError *error); +ICALL_EXPORT MonoAppContextHandle ves_icall_System_AppDomain_InternalGetContext (MonoError *error); +ICALL_EXPORT MonoAppContextHandle ves_icall_System_AppDomain_InternalGetDefaultContext (MonoError *error); +ICALL_EXPORT MonoAppContextHandle ves_icall_System_AppDomain_InternalSetContext (MonoAppContextHandle mc, MonoError *error); -gint32 -ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad); - +ICALL_EXPORT MonoStringHandle ves_icall_System_AppDomain_InternalGetProcessGuid (MonoStringHandle newguid, MonoError *error); +ICALL_EXPORT MonoBoolean ves_icall_System_CLRConfig_CheckThrowUnobservedTaskExceptions (MonoError *error); - #endif /*__MONO_METADATA_APPDOMAIN_ICALLS_H__*/ diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index 426155be8b..d1bed3444a 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -90,6 +90,9 @@ static gboolean process_guid_set = FALSE; static gboolean no_exec = FALSE; +static const char * +mono_check_corlib_version_internal (void); + static MonoAssembly * mono_domain_assembly_preload (MonoAssemblyName *aname, gchar **assemblies_path, @@ -178,9 +181,11 @@ mono_runtime_get_no_exec (void) static void create_domain_objects (MonoDomain *domain) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); + MonoDomain *old_domain = mono_domain_get (); - MonoString *arg; + MonoStringHandle arg; MonoVTable *string_vt; MonoClassField *string_empty_fld; @@ -195,7 +200,7 @@ create_domain_objects (MonoDomain *domain) */ string_vt = mono_class_vtable_checked (domain, mono_defaults.string_class, error); mono_error_assert_ok (error); - string_empty_fld = mono_class_get_field_from_name (mono_defaults.string_class, "Empty"); + string_empty_fld = mono_class_get_field_from_name_full (mono_defaults.string_class, "Empty", NULL); g_assert (string_empty_fld); MonoString *empty_str = mono_string_new_checked (domain, "", error); mono_error_assert_ok (error); @@ -207,26 +212,26 @@ create_domain_objects (MonoDomain *domain) /* * Create an instance early since we can't do it when there is no memory. */ - arg = mono_string_new_checked (domain, "Out of memory", error); + arg = mono_string_new_handle (domain, "Out of memory", error); mono_error_assert_ok (error); - domain->out_of_memory_ex = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "OutOfMemoryException", arg, NULL, error); + domain->out_of_memory_ex = MONO_HANDLE_RAW (mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "OutOfMemoryException", arg, NULL_HANDLE_STRING, error)); mono_error_assert_ok (error); /* * These two are needed because the signal handlers might be executing on * an alternate stack, and Boehm GC can't handle that. */ - arg = mono_string_new_checked (domain, "A null value was found where an object instance was required", error); + arg = mono_string_new_handle (domain, "A null value was found where an object instance was required", error); mono_error_assert_ok (error); - domain->null_reference_ex = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "NullReferenceException", arg, NULL, error); + domain->null_reference_ex = MONO_HANDLE_RAW (mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "NullReferenceException", arg, NULL_HANDLE_STRING, error)); mono_error_assert_ok (error); - arg = mono_string_new_checked (domain, "The requested operation caused a stack overflow.", error); + arg = mono_string_new_handle (domain, "The requested operation caused a stack overflow.", error); mono_error_assert_ok (error); - domain->stack_overflow_ex = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "StackOverflowException", arg, NULL, error); + domain->stack_overflow_ex = MONO_HANDLE_RAW (mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "StackOverflowException", arg, NULL_HANDLE_STRING, error)); mono_error_assert_ok (error); /*The ephemeron tombstone i*/ - domain->ephemeron_tombstone = mono_object_new_checked (domain, mono_defaults.object_class, error); + domain->ephemeron_tombstone = MONO_HANDLE_RAW (mono_object_new_handle (domain, mono_defaults.object_class, error)); mono_error_assert_ok (error); if (domain != old_domain) { @@ -239,6 +244,7 @@ create_domain_objects (MonoDomain *domain) * stack overflows while handling stack overflows. */ mono_class_init (mono_class_create_array (mono_defaults.int_class, 1)); + HANDLE_FUNCTION_RETURN (); } /** @@ -264,8 +270,10 @@ mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb, MonoThreadAtt void mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoThreadAttachCB attach_cb, MonoError *error) { - MonoAppDomainSetup *setup; - MonoAppDomain *ad; + HANDLE_FUNCTION_ENTER (); + + MonoAppDomainSetupHandle setup; + MonoAppDomainHandle ad; MonoClass *klass; error_init (error); @@ -288,17 +296,17 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT mono_thread_init (start_cb, attach_cb); klass = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomainSetup"); - setup = (MonoAppDomainSetup *) mono_object_new_pinned (domain, klass, error); - return_if_nok (error); + setup = MONO_HANDLE_CAST (MonoAppDomainSetup, mono_object_new_pinned_handle (domain, klass, error)); + goto_if_nok (error, exit); klass = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomain"); - ad = (MonoAppDomain *) mono_object_new_pinned (domain, klass, error); - return_if_nok (error); + ad = MONO_HANDLE_CAST (MonoAppDomain, mono_object_new_pinned_handle (domain, klass, error)); + goto_if_nok (error, exit); - ad->data = domain; - domain->domain = ad; - domain->setup = setup; + MONO_HANDLE_SETVAL (ad, data, MonoDomain*, domain); + domain->domain = MONO_HANDLE_RAW (ad); + domain->setup = MONO_HANDLE_RAW (setup); mono_thread_attach (domain); @@ -312,7 +320,7 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT /* contexts use GC handles, so they must be initialized after the GC */ mono_context_init_checked (domain, error); - return_if_nok (error); + goto_if_nok (error, exit); mono_context_set_default_context (domain); #ifndef DISABLE_SOCKETS @@ -327,7 +335,8 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT /* mscorlib is loaded before we install the load hook */ mono_domain_fire_assembly_load (mono_defaults.corlib->assembly, NULL); - return; +exit: + HANDLE_FUNCTION_RETURN (); } static void @@ -338,25 +347,39 @@ mono_context_set_default_context (MonoDomain *domain) HANDLE_FUNCTION_RETURN (); } - -static int +static char* mono_get_corlib_version (void) { + // Return NULL for errors, including the old integer form, else + // a string to be passed to g_free (or typically just exit). + + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); + MonoClass *klass; MonoClassField *field; - MonoObject *value; + MonoObjectHandle value; + char *result = NULL; klass = mono_class_load_from_name (mono_defaults.corlib, "System", "Environment"); mono_class_init (klass); - field = mono_class_get_field_from_name (klass, "mono_corlib_version"); + field = mono_class_get_field_from_name_full (klass, "mono_corlib_version", NULL); if (!field) - return -1; + goto exit; + if (! (field->type->attrs & FIELD_ATTRIBUTE_STATIC)) - return -1; - value = mono_field_get_value_object_checked (mono_domain_get (), field, NULL, error); + goto exit; + + value = mono_static_field_get_value_handle (mono_domain_get (), field, error); mono_error_assert_ok (error); - return *(gint32*)((gchar*)value + sizeof (MonoObject)); + klass = mono_handle_class (value); + if (klass != mono_defaults.string_class) + goto exit; + + result = mono_string_handle_to_utf8 (MONO_HANDLE_CAST (MonoString, value), error); + mono_error_assert_ok (error); +exit: + HANDLE_FUNCTION_RETURN_VAL (result); } /** @@ -368,17 +391,45 @@ mono_get_corlib_version (void) const char* mono_check_corlib_version (void) { - int version = mono_get_corlib_version (); - if (version != MONO_CORLIB_VERSION) - return g_strdup_printf ("expected corlib version %d, found %d.", MONO_CORLIB_VERSION, version); + const char* res; + MONO_ENTER_GC_UNSAFE; + res = mono_check_corlib_version_internal (); + MONO_EXIT_GC_UNSAFE; + return res; +} + +static const char * +mono_check_corlib_version_internal (void) +{ +#if defined(MONO_CROSS_COMPILE) && SIZEOF_VOID_P != TARGET_SIZEOF_VOID_P + /* Can't read the corlib version because we only have the target class layouts */ + return NULL; +#endif + + char *result = NULL; + char *version = mono_get_corlib_version (); + if (!version) { + result = g_strdup_printf ("expected corlib string (%s) but not found or not string", MONO_CORLIB_VERSION); + goto exit; + } + if (strcmp (version, MONO_CORLIB_VERSION) != 0) { + result = g_strdup_printf ("The runtime did not find the mscorlib.dll it expected. " + "Expected interface version %s but found %s. Check that " + "your runtime and class libraries are matching.", + MONO_CORLIB_VERSION, version); + goto exit; + } /* Check that the managed and unmanaged layout of MonoInternalThread matches */ - guint32 native_offset = (guint32) MONO_STRUCT_OFFSET (MonoInternalThread, last); - guint32 managed_offset = mono_field_get_offset (mono_class_get_field_from_name (mono_defaults.internal_thread_class, "last")); + guint32 native_offset; + guint32 managed_offset; + native_offset = (guint32) MONO_STRUCT_OFFSET (MonoInternalThread, last); + managed_offset = mono_field_get_offset (mono_class_get_field_from_name_full (mono_defaults.internal_thread_class, "last", NULL)); if (native_offset != managed_offset) - return g_strdup_printf ("expected InternalThread.last field offset %u, found %u. See InternalThread.last comment", native_offset, managed_offset); - - return NULL; + result = g_strdup_printf ("expected InternalThread.last field offset %u, found %u. See InternalThread.last comment", native_offset, managed_offset); +exit: + g_free (version); + return result; } /** @@ -473,9 +524,12 @@ MonoDomain * mono_domain_create_appdomain (char *friendly_name, char *configuration_file) { HANDLE_FUNCTION_ENTER (); + MonoDomain *domain; + MONO_ENTER_GC_UNSAFE; ERROR_DECL (error); - MonoDomain *domain = mono_domain_create_appdomain_checked (friendly_name, configuration_file, error); + domain = mono_domain_create_appdomain_checked (friendly_name, configuration_file, error); mono_error_cleanup (error); + MONO_EXIT_GC_UNSAFE; HANDLE_FUNCTION_RETURN_VAL (domain); } @@ -495,7 +549,7 @@ mono_domain_create_appdomain_checked (char *friendly_name, char *configuration_f MonoDomain *result = NULL; MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomainSetup"); - MonoAppDomainSetupHandle setup = (MonoAppDomainSetupHandle)mono_object_new_handle (mono_domain_get (), klass, error); + MonoAppDomainSetupHandle setup = MONO_HANDLE_CAST (MonoAppDomainSetup, mono_object_new_handle (mono_domain_get (), klass, error)); goto_if_nok (error, leave); MonoStringHandle config_file; if (configuration_file != NULL) { @@ -530,9 +584,11 @@ void mono_domain_set_config (MonoDomain *domain, const char *base_dir, const char *config_file_name) { HANDLE_FUNCTION_ENTER (); + MONO_ENTER_GC_UNSAFE; ERROR_DECL (error); mono_domain_set_config_checked (domain, base_dir, config_file_name, error); mono_error_cleanup (error); + MONO_EXIT_GC_UNSAFE; HANDLE_FUNCTION_RETURN (); } @@ -564,15 +620,15 @@ copy_app_domain_setup (MonoDomain *domain, MonoAppDomainSetupHandle setup, MonoE caller_domain = mono_domain_get (); ads_class = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomainSetup"); - MonoAppDomainSetupHandle copy = (MonoAppDomainSetupHandle)mono_object_new_handle(domain, ads_class, error); + MonoAppDomainSetupHandle copy = MONO_HANDLE_CAST (MonoAppDomainSetup, mono_object_new_handle(domain, ads_class, error)); goto_if_nok (error, leave); mono_domain_set_internal (domain); -#define XCOPY_FIELD(dst,field,src,error) \ +#define XCOPY_FIELD(type, dst, field, src, error) \ do { \ - MonoObjectHandle src_val = MONO_HANDLE_NEW_GET (MonoObject, (src), field); \ - MonoObjectHandle copied_val = mono_marshal_xdomain_copy_value_handle (src_val, error); \ + TYPED_HANDLE_NAME (type) src_val = MONO_HANDLE_NEW_GET (type, (src), field); \ + TYPED_HANDLE_NAME (type) copied_val = MONO_HANDLE_CAST (type, mono_marshal_xdomain_copy_value_handle (MONO_HANDLE_CAST (MonoObject, src_val), error)); \ goto_if_nok (error, leave); \ MONO_HANDLE_SET ((dst),field,copied_val); \ } while (0) @@ -582,26 +638,26 @@ copy_app_domain_setup (MonoDomain *domain, MonoAppDomainSetupHandle setup, MonoE MONO_HANDLE_SETVAL ((dst), field, type, MONO_HANDLE_GETVAL ((src),field)); \ } while (0) - XCOPY_FIELD (copy, application_base, setup, error); - XCOPY_FIELD (copy, application_name, setup, error); - XCOPY_FIELD (copy, cache_path, setup, error); - XCOPY_FIELD (copy, configuration_file, setup, error); - XCOPY_FIELD (copy, dynamic_base, setup, error); - XCOPY_FIELD (copy, license_file, setup, error); - XCOPY_FIELD (copy, private_bin_path, setup, error); - XCOPY_FIELD (copy, private_bin_path_probe, setup, error); - XCOPY_FIELD (copy, shadow_copy_directories, setup, error); - XCOPY_FIELD (copy, shadow_copy_files, setup, error); + XCOPY_FIELD (MonoString, copy, application_base, setup, error); + XCOPY_FIELD (MonoString, copy, application_name, setup, error); + XCOPY_FIELD (MonoString, copy, cache_path, setup, error); + XCOPY_FIELD (MonoString, copy, configuration_file, setup, error); + XCOPY_FIELD (MonoString, copy, dynamic_base, setup, error); + XCOPY_FIELD (MonoString, copy, license_file, setup, error); + XCOPY_FIELD (MonoString, copy, private_bin_path, setup, error); + XCOPY_FIELD (MonoString, copy, private_bin_path_probe, setup, error); + XCOPY_FIELD (MonoString, copy, shadow_copy_directories, setup, error); + XCOPY_FIELD (MonoString, copy, shadow_copy_files, setup, error); COPY_VAL (copy, publisher_policy, MonoBoolean, setup); COPY_VAL (copy, path_changed, MonoBoolean, setup); COPY_VAL (copy, loader_optimization, int, setup); COPY_VAL (copy, disallow_binding_redirects, MonoBoolean, setup); COPY_VAL (copy, disallow_code_downloads, MonoBoolean, setup); - XCOPY_FIELD (copy, domain_initializer_args, setup, error); + XCOPY_FIELD (MonoArray, copy, domain_initializer_args, setup, error); COPY_VAL (copy, disallow_appbase_probe, MonoBoolean, setup); - XCOPY_FIELD (copy, application_trust, setup, error); - XCOPY_FIELD (copy, configuration_bytes, setup, error); - XCOPY_FIELD (copy, serialized_non_primitives, setup, error); + XCOPY_FIELD (MonoObject, copy, application_trust, setup, error); + XCOPY_FIELD (MonoArray, copy, configuration_bytes, setup, error); + XCOPY_FIELD (MonoArray, copy, serialized_non_primitives, setup, error); #undef XCOPY_FIELD #undef COPY_VAL @@ -628,7 +684,7 @@ mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetupHa /* FIXME: pin all those objects */ data = mono_domain_create(); - MonoAppDomainHandle ad = (MonoAppDomainHandle)mono_object_new_handle (data, adclass, error); + MonoAppDomainHandle ad = MONO_HANDLE_CAST (MonoAppDomain, mono_object_new_handle (data, adclass, error)); goto_if_nok (error, leave); MONO_HANDLE_SETVAL (ad, data, MonoDomain*, data); data->domain = MONO_HANDLE_RAW (ad); @@ -698,7 +754,7 @@ mono_domain_has_type_resolve (MonoDomain *domain) MonoObject *o; if (field == NULL) { - field = mono_class_get_field_from_name (mono_defaults.appdomain_class, "TypeResolve"); + field = mono_class_get_field_from_name_full (mono_defaults.appdomain_class, "TypeResolve", NULL); g_assert (field); } @@ -851,8 +907,9 @@ mono_domain_set (MonoDomain *domain, gboolean force) if (!force && domain->state == MONO_APPDOMAIN_UNLOADED) return FALSE; + MONO_ENTER_GC_UNSAFE; mono_domain_set_internal (domain); - + MONO_EXIT_GC_UNSAFE; return TRUE; } @@ -1226,7 +1283,7 @@ mono_try_assembly_resolve_handle (MonoDomain *domain, MonoStringHandle fname, Mo params[1] = requesting ? MONO_HANDLE_RAW (requesting_handle) : NULL; params [2] = &isrefonly; MonoObject *exc = NULL; - MonoReflectionAssemblyHandle result = MONO_HANDLE_NEW (MonoReflectionAssembly, mono_runtime_try_invoke (method, domain->domain, params, &exc, error)); + MonoReflectionAssemblyHandle result = MONO_HANDLE_CAST (MonoReflectionAssembly, MONO_HANDLE_NEW (MonoObject, mono_runtime_try_invoke (method, domain->domain, params, &exc, error))); if (!is_ok (error) || exc != NULL) { if (is_ok (error)) mono_error_set_exception_instance (error, (MonoException*)exc); @@ -1274,6 +1331,8 @@ add_assemblies_to_domain (MonoDomain *domain, MonoAssembly *ass, GHashTable *ht) GSList *tmp; gboolean destroy_ht = FALSE; + g_assert (ass != NULL); + if (!ass->aname.name) return; @@ -1322,6 +1381,8 @@ mono_domain_fire_assembly_load (MonoAssembly *assembly, gpointer user_data) if (!domain->domain) /* This can happen during startup */ goto leave; + if (mono_runtime_get_no_exec ()) + goto leave; #ifdef ASSEMBLY_LOAD_DEBUG fprintf (stderr, "Loading %s into domain %s\n", assembly->aname.name, domain->friendly_name); #endif @@ -1334,7 +1395,7 @@ mono_domain_fire_assembly_load (MonoAssembly *assembly, gpointer user_data) mono_domain_assemblies_unlock (domain); if (assembly_load_field == NULL) { - assembly_load_field = mono_class_get_field_from_name (klass, "AssemblyLoad"); + assembly_load_field = mono_class_get_field_from_name_full (klass, "AssemblyLoad", NULL); g_assert (assembly_load_field); } @@ -1791,7 +1852,7 @@ shadow_copy_create_ini (const char *shadow, const char *filename) guint16 *u16_ini; gboolean result; guint32 n; - HANDLE *handle; + HANDLE handle; gchar *full_path; dir_name = g_path_get_dirname (shadow); @@ -1807,14 +1868,15 @@ shadow_copy_create_ini (const char *shadow, const char *filename) if (!u16_ini) { return FALSE; } - handle = (void **)mono_w32file_create (u16_ini, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, CREATE_NEW, FileAttributes_Normal); + handle = mono_w32file_create (u16_ini, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, CREATE_NEW, FileAttributes_Normal); g_free (u16_ini); if (handle == INVALID_HANDLE_VALUE) { return FALSE; } full_path = mono_path_resolve_symlinks (filename); - result = mono_w32file_write (handle, full_path, strlen (full_path), &n); + gint32 win32error = 0; + result = mono_w32file_write (handle, full_path, strlen (full_path), &n, &win32error); g_free (full_path); mono_w32file_close (handle); return result; @@ -2024,8 +2086,11 @@ MonoDomain * mono_domain_from_appdomain (MonoAppDomain *appdomain_raw) { HANDLE_FUNCTION_ENTER (); + MonoDomain *result; + MONO_ENTER_GC_UNSAFE; MONO_HANDLE_DCL (MonoAppDomain, appdomain); - MonoDomain *result = mono_domain_from_appdomain_handle (appdomain); + result = mono_domain_from_appdomain_handle (appdomain); + MONO_EXIT_GC_UNSAFE; HANDLE_FUNCTION_RETURN_VAL (result); } @@ -2213,6 +2278,7 @@ static MonoAssembly * mono_domain_assembly_search (MonoAssemblyName *aname, gpointer user_data) { + g_assert (aname != NULL); MonoDomain *domain = mono_domain_get (); GSList *tmp; MonoAssembly *ass; @@ -2227,6 +2293,7 @@ mono_domain_assembly_search (MonoAssemblyName *aname, mono_domain_assemblies_lock (domain); for (tmp = domain->domain_assemblies; tmp; tmp = tmp->next) { ass = (MonoAssembly *)tmp->data; + g_assert (ass != NULL); /* Dynamic assemblies can't match here in MS.NET */ gboolean ass_ref_only = mono_asmctx_get_kind (&ass->context) == MONO_ASMCTX_REFONLY; if (assembly_is_dynamic (ass) || refonly != ass_ref_only || !mono_assembly_names_equal_flags (aname, &ass->aname, eq_flags)) @@ -2250,9 +2317,8 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoStringHandle fname, MonoBoole MonoReflectionAssemblyHandle result = MONO_HANDLE_CAST (MonoReflectionAssembly, NULL_HANDLE); name = NULL; - result = NULL; - if (fname == NULL) { + if (MONO_HANDLE_IS_NULL (fname)) { mono_error_set_argument_null (error, "assemblyFile", ""); goto leave; } @@ -2330,7 +2396,6 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad, MonoBoolean refonly, MonoError *error) { - error_init (error); MonoAssembly *ass; MonoReflectionAssemblyHandle refass = MONO_HANDLE_CAST (MonoReflectionAssembly, NULL_HANDLE); MonoDomain *domain = MONO_HANDLE_GETVAL(ad, data); @@ -2349,7 +2414,7 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad, mono_gchandle_free (gchandle); /* unpin */ MONO_HANDLE_ASSIGN (raw_assembly, NULL_HANDLE); /* don't reference the data anymore */ - MonoImage *image = mono_image_open_from_data_full (assembly_data, raw_assembly_len, FALSE, NULL, refonly); + MonoImage *image = mono_image_open_from_data_internal (assembly_data, raw_assembly_len, FALSE, NULL, refonly, FALSE, NULL); if (!image) { mono_error_set_bad_image_by_name (error, "In memory assembly", "0x%p", raw_data); @@ -2385,7 +2450,7 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad, return refass; } - /* Clear the reference added by mono_image_open_from_data_full above */ + /* Clear the reference added by mono_image_open_from_data_internal above */ mono_image_close (image); refass = mono_assembly_get_object_handle (domain, ass, error); @@ -2397,7 +2462,6 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad, MonoReflectionAssemblyHandle ves_icall_System_AppDomain_LoadAssembly (MonoAppDomainHandle ad, MonoStringHandle assRef, MonoObjectHandle evidence, MonoBoolean refOnly, MonoError *error) { - error_init (error); MonoDomain *domain = MONO_HANDLE_GETVAL (ad, data); MonoImageOpenStatus status = MONO_IMAGE_OK; MonoAssembly *ass; @@ -2405,7 +2469,7 @@ ves_icall_System_AppDomain_LoadAssembly (MonoAppDomainHandle ad, MonoStringHandl gchar *name = NULL; gboolean parsed; - g_assert (assRef); + g_assert (!MONO_HANDLE_IS_NULL (assRef)); name = mono_string_handle_to_utf8 (assRef, error); goto_if_nok (error, fail); @@ -2470,7 +2534,6 @@ fail: void ves_icall_System_AppDomain_InternalUnload (gint32 domain_id, MonoError *error) { - error_init (error); MonoDomain * domain = mono_domain_get_by_id (domain_id); if (NULL == domain) { @@ -2499,7 +2562,6 @@ ves_icall_System_AppDomain_InternalUnload (gint32 domain_id, MonoError *error) gboolean ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id, MonoError *error) { - error_init (error); MonoDomain *domain = mono_domain_get_by_id (domain_id); if (!domain) @@ -2511,7 +2573,6 @@ ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id, Mono void ves_icall_System_AppDomain_DoUnhandledException (MonoExceptionHandle exc, MonoError *error) { - error_init (error); mono_unhandled_exception_checked (MONO_HANDLE_CAST (MonoObject, exc), error); mono_error_assert_ok (error); } @@ -2521,7 +2582,6 @@ ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomainHandle ad, MonoReflectionAssemblyHandle refass, MonoArrayHandle args, MonoError *error) { - error_init (error); MonoImage *image; MonoMethod *method; @@ -2545,12 +2605,6 @@ ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomainHandle ad, return res; } -gint32 -ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad) -{ - return ad->data->domain_id; -} - MonoAppDomainHandle ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomainHandle ad, MonoError* error) { @@ -2856,8 +2910,10 @@ failure: void mono_domain_unload (MonoDomain *domain) { + MONO_ENTER_GC_UNSAFE; MonoObject *exc = NULL; mono_domain_try_unload (domain, &exc); + MONO_EXIT_GC_UNSAFE; } static MonoThreadInfoWaitRet diff --git a/mono/metadata/appdomain.h b/mono/metadata/appdomain.h index 99227f0f7e..618f186025 100644 --- a/mono/metadata/appdomain.h +++ b/mono/metadata/appdomain.h @@ -39,8 +39,7 @@ mono_init_version (const char *domain_name, const char *version); MONO_API MonoDomain* mono_get_root_domain (void); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb, MonoThreadAttachCB attach_cb); @@ -65,12 +64,10 @@ mono_check_corlib_version (void); MONO_API MonoDomain * mono_domain_create (void); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoDomain * +MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain * mono_domain_create_appdomain (char *friendly_name, char *configuration_file); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_domain_set_config (MonoDomain *domain, const char *base_dir, const char *config_file_name); MONO_API MonoDomain * @@ -91,8 +88,7 @@ mono_domain_set (MonoDomain *domain, mono_bool force); MONO_API void mono_domain_set_internal (MonoDomain *domain); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_domain_unload (MonoDomain *domain); MONO_API void @@ -101,8 +97,7 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc); MONO_API mono_bool mono_domain_is_unloading (MonoDomain *domain); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoDomain * +MONO_API MONO_RT_EXTERNAL_ONLY MonoDomain * mono_domain_from_appdomain (MonoAppDomain *appdomain); MONO_API void @@ -120,19 +115,16 @@ mono_domain_free (MonoDomain *domain, mono_bool force); MONO_API mono_bool mono_domain_has_type_resolve (MonoDomain *domain); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoReflectionAssembly * +MONO_API MONO_RT_EXTERNAL_ONLY MonoReflectionAssembly * mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb); MONO_API mono_bool mono_domain_owns_vtable_slot (MonoDomain *domain, void* vtable_slot); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_context_init (MonoDomain *domain); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_context_set (MonoAppContext *new_context); MONO_API MonoAppContext * diff --git a/mono/metadata/assembly-internals.h b/mono/metadata/assembly-internals.h index d135ce0057..0d874ca122 100644 --- a/mono/metadata/assembly-internals.h +++ b/mono/metadata/assembly-internals.h @@ -25,6 +25,9 @@ typedef enum { MONO_ANAME_EQ_MASK = 0x7 } MonoAssemblyNameEqFlags; +void +mono_assembly_name_free_internal (MonoAssemblyName *aname); + gboolean mono_assembly_names_equal_flags (MonoAssemblyName *l, MonoAssemblyName *r, MonoAssemblyNameEqFlags flags); @@ -40,6 +43,8 @@ MonoAssembly* mono_assembly_load_full_nosearch (MonoAssemblyName *aname, MonoAssemblyContextKind asmctx, MonoImageOpenStatus *status); +MonoAssembly* mono_assembly_load_with_partial_name_internal (const char *name, MonoImageOpenStatus *status); + typedef gboolean (*MonoAssemblyAsmCtxFromPathFunc) (const char *absfname, MonoAssembly *requesting_assembly, gpointer user_data, MonoAssemblyContextKind *out_asmctx); @@ -76,4 +81,10 @@ mono_assembly_binding_applies_to_image (MonoImage* image, MonoImageOpenStatus *s MonoAssembly* mono_assembly_load_from_assemblies_path (gchar **assemblies_path, MonoAssemblyName *aname, MonoAssemblyContextKind asmctx); +MONO_PROFILER_API MonoAssemblyName* +mono_assembly_get_name_internal (MonoAssembly *assembly); + +MONO_PROFILER_API MonoImage* +mono_assembly_get_image_internal (MonoAssembly *assembly); + #endif /* __MONO_METADATA_ASSEMBLY_INTERNALS_H__ */ diff --git a/mono/metadata/assembly.c.REMOVED.git-id b/mono/metadata/assembly.c.REMOVED.git-id index 85d1d1330a..57efb36e79 100644 --- a/mono/metadata/assembly.c.REMOVED.git-id +++ b/mono/metadata/assembly.c.REMOVED.git-id @@ -1 +1 @@ -becef867c4e00b9271b0c68c840dd1a03396d4c4 \ No newline at end of file +1a14fe3ffc1c2781bbc8d385160e0c05b9414aa8 \ No newline at end of file diff --git a/mono/metadata/assembly.h b/mono/metadata/assembly.h index 1a6f351984..79f566c4aa 100644 --- a/mono/metadata/assembly.h +++ b/mono/metadata/assembly.h @@ -12,34 +12,39 @@ MONO_BEGIN_DECLS MONO_API void mono_assemblies_init (void); MONO_API void mono_assemblies_cleanup (void); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoAssembly *mono_assembly_open (const char *filename, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoAssembly *mono_assembly_open (const char *filename, MonoImageOpenStatus *status); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoAssembly *mono_assembly_open_full (const char *filename, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoAssembly *mono_assembly_open_full (const char *filename, MonoImageOpenStatus *status, mono_bool refonly); MONO_API MonoAssembly* mono_assembly_load (MonoAssemblyName *aname, const char *basedir, MonoImageOpenStatus *status); -MONO_API MonoAssembly* mono_assembly_load_full (MonoAssemblyName *aname, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoAssembly* mono_assembly_load_full (MonoAssemblyName *aname, const char *basedir, MonoImageOpenStatus *status, mono_bool refonly); -MONO_API MonoAssembly* mono_assembly_load_from (MonoImage *image, const char *fname, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoAssembly* mono_assembly_load_from (MonoImage *image, const char *fname, MonoImageOpenStatus *status); -MONO_API MonoAssembly* mono_assembly_load_from_full (MonoImage *image, const char *fname, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoAssembly* mono_assembly_load_from_full (MonoImage *image, const char *fname, MonoImageOpenStatus *status, mono_bool refonly); -MONO_API MonoAssembly* mono_assembly_load_with_partial_name (const char *name, MonoImageOpenStatus *status); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoAssembly* mono_assembly_load_with_partial_name (const char *name, MonoImageOpenStatus *status); -MONO_API MonoAssembly* mono_assembly_loaded (MonoAssemblyName *aname); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoAssembly* mono_assembly_loaded (MonoAssemblyName *aname); MONO_API MonoAssembly* mono_assembly_loaded_full (MonoAssemblyName *aname, mono_bool refonly); MONO_API void mono_assembly_get_assemblyref (MonoImage *image, int index, MonoAssemblyName *aname); MONO_API void mono_assembly_load_reference (MonoImage *image, int index); MONO_API void mono_assembly_load_references (MonoImage *image, MonoImageOpenStatus *status); -MONO_RT_EXTERNAL_ONLY MONO_API MonoImage* mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx); +MONO_API MONO_RT_EXTERNAL_ONLY MonoImage* mono_assembly_load_module (MonoAssembly *assembly, uint32_t idx); MONO_API void mono_assembly_close (MonoAssembly *assembly); MONO_API void mono_assembly_setrootdir (const char *root_dir); MONO_API MONO_CONST_RETURN char *mono_assembly_getrootdir (void); @@ -47,8 +52,10 @@ MONO_API char *mono_native_getrootdir (void); MONO_API void mono_assembly_foreach (MonoFunc func, void* user_data); MONO_API void mono_assembly_set_main (MonoAssembly *assembly); MONO_API MonoAssembly *mono_assembly_get_main (void); -MONO_API MonoImage *mono_assembly_get_image (MonoAssembly *assembly); -MONO_API MonoAssemblyName *mono_assembly_get_name (MonoAssembly *assembly); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoImage *mono_assembly_get_image (MonoAssembly *assembly); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoAssemblyName *mono_assembly_get_name (MonoAssembly *assembly); MONO_API mono_bool mono_assembly_fill_assembly_name (MonoImage *image, MonoAssemblyName *aname); MONO_API mono_bool mono_assembly_names_equal (MonoAssemblyName *l, MonoAssemblyName *r); MONO_API char* mono_stringify_assembly_name (MonoAssemblyName *aname); diff --git a/mono/metadata/attach.c b/mono/metadata/attach.c index ac4cc140ba..1f94d89a18 100644 --- a/mono/metadata/attach.c +++ b/mono/metadata/attach.c @@ -208,7 +208,7 @@ mono_attach_start (void) * by creating it is to enable the attach mechanism if the process receives a * SIGQUIT signal, which can only be sent by the owner/root. */ - snprintf (path, sizeof (path), "/tmp/.mono_attach_pid%"PRIdMAX"", (intmax_t) getpid ()); + snprintf (path, sizeof (path), "/tmp/.mono_attach_pid%" PRIdMAX, (intmax_t) getpid ()); fd = open (path, O_RDONLY); if (fd == -1) return FALSE; @@ -287,7 +287,7 @@ mono_attach_load_agent (MonoDomain *domain, char *agent, char *args, MonoObject * Can't use mono_jit_exec (), as it sets things which might confuse the * real Main method. */ - image = mono_assembly_get_image (agent_assembly); + image = mono_assembly_get_image_internal (agent_assembly); entry = mono_image_get_entry_point (image); if (!entry) { g_print ("Assembly '%s' doesn't have an entry point.\n", mono_image_get_filename (image)); @@ -415,7 +415,7 @@ ipc_connect (void) } } - filename = g_strdup_printf ("%s/.mono-%"PRIdMAX"", directory, (intmax_t) getpid ()); + filename = g_strdup_printf ("%s/.mono-%" PRIdMAX, directory, (intmax_t) getpid ()); unlink (filename); /* Bind a name to the socket. */ @@ -450,7 +450,7 @@ ipc_connect (void) ipc_filename = g_strdup (filename); - server_uri = g_strdup_printf ("unix://%s/.mono-%"PRIdMAX"?/vm", directory, (intmax_t) getpid ()); + server_uri = g_strdup_printf ("unix://%s/.mono-%" PRIdMAX "?/vm", directory, (intmax_t) getpid ()); g_free (filename); g_free (directory); diff --git a/mono/metadata/boehm-gc.c b/mono/metadata/boehm-gc.c index ea4fd7c507..92f55f318c 100644 --- a/mono/metadata/boehm-gc.c +++ b/mono/metadata/boehm-gc.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -726,7 +727,7 @@ mono_gc_alloc_obj (MonoVTable *vtable, size_t size) obj->vtable = vtable; obj->synchronisation = NULL; - memset ((char *) obj + sizeof (MonoObject), 0, size - sizeof (MonoObject)); + memset (mono_object_get_data (obj), 0, size - MONO_ABI_SIZEOF (MonoObject)); } else if (vtable->gc_descr != GC_NO_DESCRIPTOR) { obj = (MonoObject *)GC_GCJ_MALLOC (size, vtable); if (G_UNLIKELY (!obj)) @@ -758,7 +759,7 @@ mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length) obj->obj.vtable = vtable; obj->obj.synchronisation = NULL; - memset ((char *) obj + sizeof (MonoObject), 0, size - sizeof (MonoObject)); + memset (mono_object_get_data ((MonoObject*)obj), 0, size - MONO_ABI_SIZEOF (MonoObject)); } else if (vtable->gc_descr != GC_NO_DESCRIPTOR) { obj = (MonoArray *)GC_GCJ_MALLOC (size, vtable); if (G_UNLIKELY (!obj)) @@ -792,7 +793,7 @@ mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uint obj->obj.vtable = vtable; obj->obj.synchronisation = NULL; - memset ((char *) obj + sizeof (MonoObject), 0, size - sizeof (MonoObject)); + memset (mono_object_get_data ((MonoObject*)obj), 0, size - MONO_ABI_SIZEOF (MonoObject)); } else if (vtable->gc_descr != GC_NO_DESCRIPTOR) { obj = (MonoArray *)GC_GCJ_MALLOC (size, vtable); if (G_UNLIKELY (!obj)) @@ -910,8 +911,8 @@ void mono_gc_wbarrier_object_copy (MonoObject* obj, MonoObject *src) { /* do not copy the sync state */ - mono_gc_memmove_aligned ((char*)obj + sizeof (MonoObject), (char*)src + sizeof (MonoObject), - m_class_get_instance_size (mono_object_class (obj)) - sizeof (MonoObject)); + mono_gc_memmove_aligned (mono_object_get_data (obj), (char*)src + MONO_ABI_SIZEOF (MonoObject), + m_class_get_instance_size (mono_object_class (obj)) - MONO_ABI_SIZEOF (MonoObject)); } void @@ -1413,6 +1414,14 @@ mono_gc_get_card_table (int *shift_bits, gpointer *card_mask) return NULL; } +guint8* +mono_gc_get_target_card_table (int *shift_bits, gpointer *card_mask) +{ + *shift_bits = 0; + *card_mask = NULL; + return NULL; +} + gboolean mono_gc_card_table_nursery_check (void) { @@ -1611,7 +1620,7 @@ test_toggleref_callback (MonoObject *obj) MonoToggleRefStatus status = MONO_TOGGLE_REF_DROP; if (!mono_toggleref_test_field) { - mono_toggleref_test_field = mono_class_get_field_from_name (mono_object_get_class (obj), "__test"); + mono_toggleref_test_field = mono_class_get_field_from_name_full (mono_object_get_class (obj), "__test", NULL); g_assert (mono_toggleref_test_field); } @@ -2042,6 +2051,12 @@ mono_gc_register_obj_with_weak_fields (void *obj) g_error ("Weak fields not supported by boehm gc"); } +gboolean +mono_gc_ephemeron_array_add (MonoObject *obj) +{ + return TRUE; +} + #else MONO_EMPTY_SOURCE_FILE (boehm_gc); diff --git a/mono/metadata/callspec.c b/mono/metadata/callspec.c index 06252acf5f..97069751fc 100644 --- a/mono/metadata/callspec.c +++ b/mono/metadata/callspec.c @@ -15,6 +15,7 @@ #include "metadata.h" #include "callspec.h" #include "assembly.h" +#include "assembly-internals.h" #include "class-internals.h" #include "debug-helpers.h" @@ -74,7 +75,7 @@ gboolean mono_callspec_eval (MonoMethod *method, const MonoCallSpec *spec) case MONO_TRACEOP_PROGRAM: if (prog_assembly && (m_class_get_image (method->klass) == - mono_assembly_get_image (prog_assembly))) + mono_assembly_get_image_internal (prog_assembly))) inc = 1; break; case MONO_TRACEOP_WRAPPER: diff --git a/mono/metadata/class-init.c.REMOVED.git-id b/mono/metadata/class-init.c.REMOVED.git-id index f3ca0fe62f..9937f45ecd 100644 --- a/mono/metadata/class-init.c.REMOVED.git-id +++ b/mono/metadata/class-init.c.REMOVED.git-id @@ -1 +1 @@ -904d0bec29e0a98d1162aefaba98d15172eca80a \ No newline at end of file +d76f2e3f332d39c102a21e2a1254a64d6e1ace4a \ No newline at end of file diff --git a/mono/metadata/class-internals.h b/mono/metadata/class-internals.h index 08238ade9b..54c3be0073 100644 --- a/mono/metadata/class-internals.h +++ b/mono/metadata/class-internals.h @@ -36,16 +36,6 @@ typedef struct _MonoDynamicMethod MonoDynamicMethod; */ #define MONO_PROP_DYNAMIC_CATTR 0x1000 -#ifdef ENABLE_ICALL_EXPORT -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#define ICALL_DECL_EXPORT MONO_API -#define ICALL_EXPORT MONO_API -#else -#define ICALL_DECL_EXPORT -/* Can't be static as icall.c defines icalls referenced by icall-tables.c */ -#define ICALL_EXPORT -#endif - typedef enum { #define WRAPPER(e,n) MONO_WRAPPER_ ## e, #include "wrapper-types.h" @@ -1197,6 +1187,9 @@ mono_class_get_field_from_name_full (MonoClass *klass, const char *name, MonoTyp MonoVTable* mono_class_vtable_checked (MonoDomain *domain, MonoClass *klass, MonoError *error); +void +mono_class_is_assignable_from_checked (MonoClass *klass, MonoClass *oklass, gboolean *result, MonoError *error); + gboolean mono_class_is_assignable_from_slow (MonoClass *target, MonoClass *candidate); @@ -1211,6 +1204,9 @@ gboolean mono_is_corlib_image (MonoImage *image); MonoType* mono_field_get_type_checked (MonoClassField *field, MonoError *error); +MonoClassField* +mono_class_get_fields_internal (MonoClass* klass, gpointer *iter); + MonoClassField* mono_class_get_fields_lazy (MonoClass* klass, gpointer *iter); @@ -1431,6 +1427,9 @@ void mono_class_contextbound_bit_offset (int* byte_offset_out, guint8* mask_out); #endif +gboolean +mono_class_init_checked (MonoClass *klass, MonoError *error); + /*Now that everything has been defined, let's include the inline functions */ #include diff --git a/mono/metadata/class.c.REMOVED.git-id b/mono/metadata/class.c.REMOVED.git-id index 1790455146..66434e46c3 100644 --- a/mono/metadata/class.c.REMOVED.git-id +++ b/mono/metadata/class.c.REMOVED.git-id @@ -1 +1 @@ -d2d33a6b22989fedca8d7d060d173da3e2c6d9f5 \ No newline at end of file +bcea1e4c2a0e9cba38437bfafa521f6d88a548f0 \ No newline at end of file diff --git a/mono/metadata/class.h b/mono/metadata/class.h index 5d7bf80d9c..63915e0f92 100644 --- a/mono/metadata/class.h +++ b/mono/metadata/class.h @@ -18,72 +18,72 @@ typedef struct _MonoClassField MonoClassField; typedef struct _MonoProperty MonoProperty; typedef struct _MonoEvent MonoEvent; -MONO_RT_EXTERNAL_ONLY -MONO_API MonoClass * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClass * mono_class_get (MonoImage *image, uint32_t type_token); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoClass * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClass * mono_class_get_full (MonoImage *image, uint32_t type_token, MonoGenericContext *context); MONO_API mono_bool mono_class_init (MonoClass *klass); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoVTable * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoVTable * mono_class_vtable (MonoDomain *domain, MonoClass *klass); -MONO_RT_EXTERNAL_ONLY MONO_API MonoClass * +MONO_API MONO_RT_EXTERNAL_ONLY MonoClass * mono_class_from_name (MonoImage *image, const char* name_space, const char *name); -MONO_RT_EXTERNAL_ONLY MONO_API MonoClass * +MONO_API MONO_RT_EXTERNAL_ONLY MonoClass * mono_class_from_name_case (MonoImage *image, const char* name_space, const char *name); -MONO_API MonoMethod * +MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod * mono_class_get_method_from_name_flags (MonoClass *klass, const char *name, int param_count, int flags); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoClass * +MONO_API MONO_RT_EXTERNAL_ONLY MonoClass * mono_class_from_typeref (MonoImage *image, uint32_t type_token); MONO_API MonoClass * mono_class_from_typeref_checked (MonoImage *image, uint32_t type_token, MonoError *error); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoClass * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClass * mono_class_from_generic_parameter (MonoGenericParam *param, MonoImage *image, mono_bool is_mvar); -MONO_RT_EXTERNAL_ONLY MONO_API MonoType* +MONO_API MONO_RT_EXTERNAL_ONLY MonoType* mono_class_inflate_generic_type (MonoType *type, MonoGenericContext *context) /* MONO_DEPRECATED */; -MONO_RT_EXTERNAL_ONLY -MONO_API MonoMethod* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoMethod* mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoMethod * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoMethod * mono_get_inflated_method (MonoMethod *method); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoClassField* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClassField* mono_field_from_token (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoClass * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClass * mono_bounded_array_class_get (MonoClass *element_class, uint32_t rank, mono_bool bounded); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoClass * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClass * mono_array_class_get (MonoClass *element_class, uint32_t rank); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoClass * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClass * mono_ptr_class_get (MonoType *type); MONO_API MonoClassField * mono_class_get_field (MonoClass *klass, uint32_t field_token); -MONO_API MonoClassField * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClassField * mono_class_get_field_from_name (MonoClass *klass, const char *name); MONO_API uint32_t @@ -126,8 +126,8 @@ mono_class_is_subclass_of (MonoClass *klass, MonoClass *klassc, MONO_API mono_bool mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass); -MONO_RT_EXTERNAL_ONLY -MONO_API void* +MONO_API MONO_RT_EXTERNAL_ONLY +void* mono_ldtoken (MonoImage *image, uint32_t token, MonoClass **retclass, MonoGenericContext *context); MONO_API char* @@ -140,19 +140,23 @@ mono_type_get_underlying_type (MonoType *type); MONO_API MonoImage* mono_class_get_image (MonoClass *klass); -MONO_API MonoClass* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClass* mono_class_get_element_class (MonoClass *klass); -MONO_API mono_bool +MONO_API MONO_RT_EXTERNAL_ONLY +mono_bool mono_class_is_valuetype (MonoClass *klass); -MONO_API mono_bool +MONO_API MONO_RT_EXTERNAL_ONLY +mono_bool mono_class_is_enum (MonoClass *klass); MONO_API MonoType* mono_class_enum_basetype (MonoClass *klass); -MONO_API MonoClass* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClass* mono_class_get_parent (MonoClass *klass); MONO_API MonoClass* @@ -164,10 +168,12 @@ mono_class_get_rank (MonoClass *klass); MONO_API uint32_t mono_class_get_flags (MonoClass *klass); -MONO_API const char* +MONO_API MONO_RT_EXTERNAL_ONLY +const char* mono_class_get_name (MonoClass *klass); -MONO_API const char* +MONO_API MONO_RT_EXTERNAL_ONLY +const char* mono_class_get_namespace (MonoClass *klass); MONO_API MonoType* @@ -191,7 +197,8 @@ mono_class_num_properties (MonoClass *klass); MONO_API int mono_class_num_events (MonoClass *klass); -MONO_API MonoClassField* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClassField* mono_class_get_fields (MonoClass* klass, void **iter); MONO_API MonoMethod* @@ -209,7 +216,8 @@ mono_class_get_interfaces (MonoClass* klass, void **iter); MONO_API MonoClass* mono_class_get_nested_types (MonoClass* klass, void **iter); -MONO_API mono_bool +MONO_API MONO_RT_EXTERNAL_ONLY +mono_bool mono_class_is_delegate (MonoClass* klass); MONO_API mono_bool @@ -272,7 +280,7 @@ mono_event_get_parent (MonoEvent *event); MONO_API uint32_t mono_event_get_flags (MonoEvent *event); -MONO_API MonoMethod * +MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod * mono_class_get_method_from_name (MonoClass *klass, const char *name, int param_count); MONO_API char * diff --git a/mono/metadata/cominterop.c.REMOVED.git-id b/mono/metadata/cominterop.c.REMOVED.git-id index 0292ba2a02..529aad4e51 100644 --- a/mono/metadata/cominterop.c.REMOVED.git-id +++ b/mono/metadata/cominterop.c.REMOVED.git-id @@ -1 +1 @@ -d1730b7b68d476bd9ee52916d08b7c9191b2a15a \ No newline at end of file +f3ea672e15453de2868058f01c611ae9cae38bed \ No newline at end of file diff --git a/mono/metadata/cominterop.h b/mono/metadata/cominterop.h index 7a1bb17f12..011e5a47bb 100644 --- a/mono/metadata/cominterop.h +++ b/mono/metadata/cominterop.h @@ -55,18 +55,14 @@ mono_cominterop_emit_marshal_safearray (EmitMarshalContext *m, int argnum, int conv_arg, MonoType **conv_arg_type, MarshalAction action); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString * -mono_string_from_bstr (gpointer bstr); +MONO_API MONO_RT_EXTERNAL_ONLY MonoString * +mono_string_from_bstr (/*mono_bstr*/gpointer bstr); MonoString * -mono_string_from_bstr_icall (gpointer bstr); - -MonoString * -mono_string_from_bstr_checked (gpointer bstr, MonoError *error); +mono_string_from_bstr_icall (mono_bstr_const bstr); MONO_API void -mono_free_bstr (gpointer bstr); +mono_free_bstr (/*mono_bstr_const*/gpointer bstr); MonoClass* mono_class_try_get_com_object_class (void); diff --git a/mono/metadata/console-io.h b/mono/metadata/console-io.h index 851b82c96e..ead6f67d58 100644 --- a/mono/metadata/console-io.h +++ b/mono/metadata/console-io.h @@ -17,27 +17,34 @@ #include #include +#include G_BEGIN_DECLS void mono_console_init (void); void mono_console_handle_async_ops (void); +ICALL_EXPORT MonoBoolean ves_icall_System_ConsoleDriver_Isatty (gpointer handle, MonoError* error); +ICALL_EXPORT gint32 ves_icall_System_ConsoleDriver_InternalKeyAvailable (gint32 timeout, MonoError* error); +ICALL_EXPORT MonoBoolean ves_icall_System_ConsoleDriver_SetEcho (MonoBoolean echo, MonoError* error); +ICALL_EXPORT MonoBoolean ves_icall_System_ConsoleDriver_SetBreak (MonoBoolean want_break, MonoError* error); +ICALL_EXPORT MonoBoolean ves_icall_System_ConsoleDriver_TtySetup (MonoStringHandle keypad, MonoStringHandle teardown, MonoArrayHandleOut control_chars, int **size, MonoError* error); +ICALL_EXPORT void ves_icall_System_ConsoleDriver_Suspend (MonoError* error); diff --git a/mono/metadata/console-unix.c b/mono/metadata/console-unix.c index 61d2b152f8..be18bae3f8 100644 --- a/mono/metadata/console-unix.c +++ b/mono/metadata/console-unix.c @@ -224,8 +224,10 @@ do_console_cancel_event (void) if (mono_defaults.console_class == NULL) return; - if (System_Console_DoConsoleCancelEventBackground_method == ((gpointer)-1)) - System_Console_DoConsoleCancelEventBackground_method = mono_class_get_method_from_name (mono_defaults.console_class, "DoConsoleCancelEventInBackground", 0); + if (System_Console_DoConsoleCancelEventBackground_method == ((gpointer)-1)) { + System_Console_DoConsoleCancelEventBackground_method = mono_class_get_method_from_name_checked (mono_defaults.console_class, "DoConsoleCancelEventInBackground", 0, 0, error); + mono_error_assert_ok (error); + } if (System_Console_DoConsoleCancelEventBackground_method == NULL) return; diff --git a/mono/metadata/custom-attrs-internals.h b/mono/metadata/custom-attrs-internals.h index a848c0b0e3..581fbb9bf9 100644 --- a/mono/metadata/custom-attrs-internals.h +++ b/mono/metadata/custom-attrs-internals.h @@ -6,6 +6,7 @@ #define __MONO_METADATA_CUSTOM_ATTRS_INTERNALS_H__ #include +#include #include MonoCustomAttrInfo* @@ -22,4 +23,9 @@ mono_assembly_is_weak_field (MonoImage *image, guint32 field_idx); void mono_assembly_init_weak_fields (MonoImage *image); +void +mono_reflection_create_custom_attr_data_args_noalloc (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, + gpointer **typed_args, gpointer **named_args, int *num_named_args, + CattrNamedArg **named_arg_info, MonoError *error); + #endif /* __MONO_METADATA_REFLECTION_CUSTOM_ATTRS_INTERNALS_H__ */ diff --git a/mono/metadata/custom-attrs.c b/mono/metadata/custom-attrs.c index 8c1b8168b6..c9d7c6b662 100644 --- a/mono/metadata/custom-attrs.c +++ b/mono/metadata/custom-attrs.c @@ -220,51 +220,60 @@ load_cattr_enum_type (MonoImage *image, const char *p, const char *boundp, const return mono_class_from_mono_type (t); } -static MonoReflectionType* -load_cattr_type_object (MonoImage *image, MonoType *t, const char *p, const char *boundp, const char **end, MonoError *error, guint32 *slen) +static MonoType* +load_cattr_type (MonoImage *image, MonoType *t, gboolean header, const char *p, const char *boundp, const char **end, MonoError *error, guint32 *slen) { - MonoReflectionType *rt; + MonoType *res; char *n; + if (header) { + if (!bcheck_blob (p, 0, boundp, error)) + return NULL; + if (*p == (char)0xFF) { + *end = p + 1; + return NULL; + } + } + if (!decode_blob_value_checked (p, boundp, slen, &p, error)) return NULL; if (*slen > 0 && !bcheck_blob (p, *slen - 1, boundp, error)) return NULL; n = (char *)g_memdup (p, *slen + 1); n [*slen] = 0; - t = cattr_type_from_name (n, image, FALSE, error); + res = cattr_type_from_name (n, image, FALSE, error); g_free (n); return_val_if_nok (error, NULL); - rt = mono_type_get_object_checked (mono_domain_get (), t, error); - if (!is_ok (error)) - return NULL; - *end = p + *slen; - return rt; + return res; } static MonoReflectionType* -load_cattr_type_object_with_header (MonoImage *image, MonoType *t, const char *p, const char *boundp, const char **end, MonoError *error, guint32 *slen) +load_cattr_type_object (MonoImage *image, MonoType *t, gboolean header, const char *p, const char *boundp, const char **end, MonoError *error, guint32 *slen) { - if (!bcheck_blob (p, 0, boundp, error)) - return NULL; - if (*p == (char)0xFF) { - *end = p + 1; - return NULL; - } + MonoType *type; - return load_cattr_type_object (image, t, p, boundp, end, error, slen); + type = load_cattr_type (image, t, header, p, boundp, end, error, slen); + if (!type) + return NULL; + return mono_type_get_object_checked (mono_domain_get (), type, error); } +/* + * If OUT_OBJ is non-NULL, created objects are stored into it and NULL is returned. + * If OUT_OBJ is NULL, assert if objects were to be created. + */ static void* -load_cattr_value (MonoImage *image, MonoType *t, const char *p, const char *boundp, const char **end, MonoError *error) +load_cattr_value (MonoImage *image, MonoType *t, MonoObject **out_obj, const char *p, const char *boundp, const char **end, MonoError *error) { int type = t->type; guint32 slen; MonoClass *tklass = t->data.klass; + if (out_obj) + *out_obj = NULL; g_assert (boundp); error_init (error); @@ -374,9 +383,19 @@ handle_enum: // to decode some attributes in assemblies that Windows .NET Framework // and CoreCLR both manage to decode. // See https://simonsapin.github.io/wtf-8/ for a description of wtf-8. - return mono_string_new_wtf8_len_checked (mono_domain_get (), p, slen, error); + g_assert (out_obj); + *out_obj = (MonoObject*)mono_string_new_wtf8_len_checked (mono_domain_get (), p, slen, error); + return NULL; case MONO_TYPE_CLASS: { - return load_cattr_type_object_with_header (image, t, p, boundp, end, error, &slen); + MonoType *type = load_cattr_type (image, t, TRUE, p, boundp, end, error, &slen); + if (out_obj) { + if (!type) + return NULL; + *out_obj = (MonoObject*)mono_type_get_object_checked (mono_domain_get (), type, error); + return NULL; + } else { + return type; + } } case MONO_TYPE_OBJECT: { if (!bcheck_blob (p, 0, boundp, error)) @@ -387,7 +406,15 @@ handle_enum: void *val; if (subt == CATTR_TYPE_SYSTEM_TYPE) { - return load_cattr_type_object (image, t, p, boundp, end, error, &slen); + MonoType *type = load_cattr_type (image, t, FALSE, p, boundp, end, error, &slen); + if (out_obj) { + if (!type) + return NULL; + *out_obj = (MonoObject*)mono_type_get_object_checked (mono_domain_get (), type, error); + return NULL; + } else { + return type; + } } else if (subt == 0x0E) { type = MONO_TYPE_STRING; goto handle_enum; @@ -434,17 +461,18 @@ handle_enum: } else { g_error ("Unknown type 0x%02x for object type encoding in custom attr", subt); } - val = load_cattr_value (image, m_class_get_byval_arg (subc), p, boundp, end, error); - obj = NULL; + val = load_cattr_value (image, m_class_get_byval_arg (subc), NULL, p, boundp, end, error); if (is_ok (error)) { obj = mono_object_new_checked (mono_domain_get (), subc, error); g_assert (!m_class_has_references (subc)); if (is_ok (error)) - mono_gc_memmove_atomic ((char*)obj + sizeof (MonoObject), val, mono_class_value_size (subc, NULL)); + mono_gc_memmove_atomic (mono_object_get_data (obj), val, mono_class_value_size (subc, NULL)); + g_assert (out_obj); + *out_obj = obj; } g_free (val); - return obj; + return NULL; } case MONO_TYPE_SZARRAY: { MonoArray *arr; @@ -473,76 +501,78 @@ handle_enum: } } - switch (basetype) - { - case MONO_TYPE_U1: - case MONO_TYPE_I1: - case MONO_TYPE_BOOLEAN: - for (i = 0; i < alen; i++) { - if (!bcheck_blob (p, 0, boundp, error)) - return NULL; - MonoBoolean val = *p++; - mono_array_set (arr, MonoBoolean, i, val); - } - break; - case MONO_TYPE_CHAR: - case MONO_TYPE_U2: - case MONO_TYPE_I2: - for (i = 0; i < alen; i++) { - if (!bcheck_blob (p, 1, boundp, error)) - return NULL; - guint16 val = read16 (p); - mono_array_set (arr, guint16, i, val); - p += 2; - } - break; - case MONO_TYPE_R4: - case MONO_TYPE_U4: - case MONO_TYPE_I4: - for (i = 0; i < alen; i++) { - if (!bcheck_blob (p, 3, boundp, error)) - return NULL; - guint32 val = read32 (p); - mono_array_set (arr, guint32, i, val); - p += 4; - } - break; - case MONO_TYPE_R8: - for (i = 0; i < alen; i++) { - if (!bcheck_blob (p, 7, boundp, error)) - return NULL; - double val; - readr8 (p, &val); - mono_array_set (arr, double, i, val); - p += 8; - } - break; - case MONO_TYPE_U8: - case MONO_TYPE_I8: - for (i = 0; i < alen; i++) { - if (!bcheck_blob (p, 7, boundp, error)) - return NULL; - guint64 val = read64 (p); - mono_array_set (arr, guint64, i, val); - p += 8; - } - break; - case MONO_TYPE_CLASS: - case MONO_TYPE_OBJECT: - case MONO_TYPE_STRING: - case MONO_TYPE_SZARRAY: - for (i = 0; i < alen; i++) { - MonoObject *item = (MonoObject *)load_cattr_value (image, m_class_get_byval_arg (tklass), p, boundp, &p, error); - if (!is_ok (error)) - return NULL; - mono_array_setref (arr, i, item); - } - break; - default: - g_error ("Type 0x%02x not handled in custom attr array decoding", basetype); + switch (basetype) { + case MONO_TYPE_U1: + case MONO_TYPE_I1: + case MONO_TYPE_BOOLEAN: + for (i = 0; i < alen; i++) { + if (!bcheck_blob (p, 0, boundp, error)) + return NULL; + MonoBoolean val = *p++; + mono_array_set (arr, MonoBoolean, i, val); + } + break; + case MONO_TYPE_CHAR: + case MONO_TYPE_U2: + case MONO_TYPE_I2: + for (i = 0; i < alen; i++) { + if (!bcheck_blob (p, 1, boundp, error)) + return NULL; + guint16 val = read16 (p); + mono_array_set (arr, guint16, i, val); + p += 2; + } + break; + case MONO_TYPE_R4: + case MONO_TYPE_U4: + case MONO_TYPE_I4: + for (i = 0; i < alen; i++) { + if (!bcheck_blob (p, 3, boundp, error)) + return NULL; + guint32 val = read32 (p); + mono_array_set (arr, guint32, i, val); + p += 4; + } + break; + case MONO_TYPE_R8: + for (i = 0; i < alen; i++) { + if (!bcheck_blob (p, 7, boundp, error)) + return NULL; + double val; + readr8 (p, &val); + mono_array_set (arr, double, i, val); + p += 8; + } + break; + case MONO_TYPE_U8: + case MONO_TYPE_I8: + for (i = 0; i < alen; i++) { + if (!bcheck_blob (p, 7, boundp, error)) + return NULL; + guint64 val = read64 (p); + mono_array_set (arr, guint64, i, val); + p += 8; + } + break; + case MONO_TYPE_CLASS: + case MONO_TYPE_OBJECT: + case MONO_TYPE_STRING: + case MONO_TYPE_SZARRAY: + for (i = 0; i < alen; i++) { + MonoObject *item = NULL; + load_cattr_value (image, m_class_get_byval_arg (tklass), &item, p, boundp, &p, error); + if (!is_ok (error)) + return NULL; + mono_array_setref (arr, i, item); + } + break; + default: + g_error ("Type 0x%02x not handled in custom attr array decoding", basetype); } - *end=p; - return arr; + *end = p; + g_assert (out_obj); + *out_obj = (MonoObject*)arr; + return NULL; } default: g_error ("Type 0x%02x not handled in custom attr value decoding", type); @@ -557,19 +587,22 @@ load_cattr_value_boxed (MonoDomain *domain, MonoImage *image, MonoType *t, const gboolean is_ref = type_is_reference (t); - void *val = load_cattr_value (image, t, p, boundp, end, error); - if (!is_ok (error)) { - if (is_ref) - g_free (val); - return NULL; + if (is_ref) { + MonoObject *obj = NULL; + gpointer val = load_cattr_value (image, t, &obj, p, boundp, end, error); + if (!is_ok (error)) + return NULL; + g_assert (!val); + return obj; + } else { + void *val = load_cattr_value (image, t, NULL, p, boundp, end, error); + if (!is_ok (error)) + return NULL; + + MonoObject *boxed = mono_value_box_checked (domain, mono_class_from_mono_type (t), val, error); + g_free (val); + return boxed; } - - if (is_ref) - return (MonoObject*)val; - - MonoObject *boxed = mono_value_box_checked (domain, mono_class_from_mono_type (t), val, error); - g_free (val); - return boxed; } static MonoObject* @@ -581,8 +614,10 @@ create_cattr_typed_arg (MonoType *t, MonoObject *val, MonoError *error) error_init (error); - if (!ctor) - ctor = mono_class_get_method_from_name (mono_class_get_custom_attribute_typed_argument_class (), ".ctor", 2); + if (!ctor) { + ctor = mono_class_get_method_from_name_checked (mono_class_get_custom_attribute_typed_argument_class (), ".ctor", 2, 0, error); + mono_error_assert_ok (error); + } params [0] = mono_type_get_object_checked (mono_domain_get (), t, error); return_val_if_nok (error, NULL); @@ -607,8 +642,10 @@ create_cattr_named_arg (void *minfo, MonoObject *typedarg, MonoError *error) error_init (error); - if (!ctor) - ctor = mono_class_get_method_from_name (mono_class_get_custom_attribute_named_argument_class (), ".ctor", 2); + if (!ctor) { + ctor = mono_class_get_method_from_name_checked (mono_class_get_custom_attribute_named_argument_class (), ".ctor", 2, 0, error); + mono_error_assert_ok (error); + } params [0] = minfo; params [1] = typedarg; @@ -767,38 +804,44 @@ leave: return is_ok (error); } -static MonoObject* +static MonoObjectHandle create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoError *error) { + HANDLE_FUNCTION_ENTER (); + const char *p = (const char*)data; const char *data_end = (const char*)data + len; const char *named; guint32 i, j, num_named; - MonoObject *attr; + MonoObjectHandle attr = NULL_HANDLE; void *params_buf [32]; void **params = NULL; MonoMethodSignature *sig; + MonoClassField *field = NULL; + char *name = NULL; + void *pparams [1] = { NULL }; + MonoType *prop_type = NULL; + void *val = NULL; // FIXMEcoop is this a raw pointer or a value? error_init (error); mono_class_init (method->klass); if (!mono_verifier_verify_cattr_content (image, method, data, len, error)) - return NULL; + goto fail; if (len == 0) { - attr = mono_object_new_checked (mono_domain_get (), method->klass, error); - if (!mono_error_ok (error)) return NULL; + attr = mono_object_new_handle (mono_domain_get (), method->klass, error); + goto_if_nok (error, fail); - mono_runtime_invoke_checked (method, attr, NULL, error); - if (!mono_error_ok (error)) - return NULL; + mono_runtime_invoke_handle (method, attr, NULL, error); + goto_if_nok (error, fail); - return attr; + goto exit; } if (len < 2 || read16 (p) != 0x0001) /* Prolog */ - return NULL; + goto fail; /*g_print ("got attr %s\n", method->klass->name);*/ @@ -814,22 +857,19 @@ create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, gu /* skip prolog */ p += 2; for (i = 0; i < mono_method_signature (method)->param_count; ++i) { - params [i] = load_cattr_value (image, mono_method_signature (method)->params [i], p, data_end, &p, error); + MonoObject *param_obj; + params [i] = load_cattr_value (image, mono_method_signature (method)->params [i], ¶m_obj, p, data_end, &p, error); + if (param_obj) + params [i] = param_obj; goto_if_nok (error, fail); } named = p; - attr = mono_object_new_checked (mono_domain_get (), method->klass, error); - if (!mono_error_ok (error)) goto fail; + attr = mono_object_new_handle (mono_domain_get (), method->klass, error); + goto_if_nok (error, fail); - MonoObject *exc = NULL; - mono_runtime_try_invoke (method, attr, params, &exc, error); - if (!mono_error_ok (error)) - goto fail; - if (exc) { - mono_error_set_exception_instance (error, (MonoException*)exc); - goto fail; - } + (void)mono_runtime_try_invoke_handle (method, attr, params, error); + goto_if_nok (error, fail); if (named + 1 < data_end) { num_named = read16 (named); @@ -845,7 +885,7 @@ create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, gu } for (j = 0; j < num_named; j++) { guint32 name_len; - char *name, named_type, data_type; + char named_type, data_type; if (!bcheck_blob (named, 1, data_end, error)) goto fail; named_type = *named++; @@ -878,44 +918,30 @@ create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, gu name [name_len] = 0; named += name_len; if (named_type == CATTR_TYPE_FIELD) { - MonoClassField *field; - void *val; - /* how this fail is a blackbox */ - field = mono_class_get_field_from_name (mono_object_class (attr), name); + field = mono_class_get_field_from_name_full (mono_handle_class (attr), name, NULL); if (!field) { mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Could not find a field with name %s", name); - g_free (name); goto fail; } - val = load_cattr_value (image, field->type, named, data_end, &named, error); - if (!is_ok (error)) { - g_free (name); - if (!type_is_reference (field->type)) - g_free (val); - goto fail; - } + MonoObject *param_obj; + val = load_cattr_value (image, field->type, ¶m_obj, named, data_end, &named, error); + if (param_obj) + val = param_obj; + goto_if_nok (error, fail); - mono_field_set_value (attr, field, val); - if (!type_is_reference (field->type)) - g_free (val); + mono_field_set_value (MONO_HANDLE_RAW (attr), field, val); // FIXMEcoop } else if (named_type == CATTR_TYPE_PROPERTY) { MonoProperty *prop; - void *pparams [1]; - MonoType *prop_type; - - prop = mono_class_get_property_from_name (mono_object_class (attr), name); - + prop = mono_class_get_property_from_name (mono_handle_class (attr), name); if (!prop) { mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Could not find a property with name %s", name); - g_free (name); goto fail; } if (!prop->set) { mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Could not find the setter for %s", name); - g_free (name); goto fail; } @@ -923,39 +949,46 @@ create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, gu prop_type = prop->get? mono_method_signature (prop->get)->ret : mono_method_signature (prop->set)->params [mono_method_signature (prop->set)->param_count - 1]; - pparams [0] = load_cattr_value (image, prop_type, named, data_end, &named, error); - if (!is_ok (error)) { - g_free (name); - if (!type_is_reference (prop_type)) - g_free (pparams [0]); - goto fail; - } + MonoObject *param_obj; + pparams [0] = load_cattr_value (image, prop_type, ¶m_obj, named, data_end, &named, error); + if (param_obj) + pparams [0] = param_obj; + goto_if_nok (error, fail); - - mono_property_set_value_checked (prop, attr, pparams, error); - if (!type_is_reference (prop_type)) - g_free (pparams [0]); - if (!is_ok (error)) { - g_free (name); - goto fail; - } + mono_property_set_value_handle (prop, attr, pparams, error); + goto_if_nok (error, fail); } - g_free (name); } - free_param_data (method->signature, params); - if (params != params_buf) - mono_gc_free_fixed (params); - - return attr; - + goto exit; fail: - free_param_data (method->signature, params); - if (params != params_buf) - mono_gc_free_fixed (params); - return NULL; + attr = mono_new_null (); +exit: + if (field && !type_is_reference (field->type)) + g_free (val); + g_free (name); + if (prop_type && !type_is_reference (prop_type)) + g_free (pparams [0]); + if (params) { + free_param_data (method->signature, params); + if (params != params_buf) + mono_gc_free_fixed (params); + } + + HANDLE_FUNCTION_RETURN_REF (MonoObject, attr); } - + +static void +create_custom_attr_into_array (MonoImage *image, MonoMethod *method, const guchar *data, + guint32 len, MonoArrayHandle array, int index, MonoError *error) +{ + // This function serves to avoid creating handles in a loop. + HANDLE_FUNCTION_ENTER (); + MonoObjectHandle attr = create_custom_attr (image, method, data, len, error); + MONO_HANDLE_ARRAY_SETREF (array, index, attr); + HANDLE_FUNCTION_RETURN (); +} + /* * mono_reflection_create_custom_attr_data_args: * @@ -1062,7 +1095,7 @@ mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *meth if (named_type == CATTR_TYPE_FIELD) { /* Named arg is a field. */ MonoObject *obj; - MonoClassField *field = mono_class_get_field_from_name (attrklass, name); + MonoClassField *field = mono_class_get_field_from_name_full (attrklass, name, NULL); if (!field) { g_free (name); @@ -1115,6 +1148,155 @@ fail: *named_arg_info = NULL; } +/* + * mono_reflection_create_custom_attr_data_args_noalloc: + * + * Same as mono_reflection_create_custom_attr_data_args_noalloc but allocate no managed objects, return values + * using C arrays. Only usable for cattrs with primitive/type arguments. + * TYPED_ARGS, NAMED_ARGS, and NAMED_ARG_INFO should be freed using g_free (). + */ +void +mono_reflection_create_custom_attr_data_args_noalloc (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, + gpointer **typed_args, gpointer **named_args, int *num_named_args, + CattrNamedArg **named_arg_info, MonoError *error) +{ + gpointer *typedargs, *namedargs; + MonoClass *attrklass; + const char *p = (const char*)data; + const char *data_end = p + len; + const char *named; + guint32 i, j, num_named; + CattrNamedArg *arginfo = NULL; + MonoMethodSignature *sig = mono_method_signature (method); + + *typed_args = NULL; + *named_args = NULL; + *named_arg_info = NULL; + + error_init (error); + + if (!mono_verifier_verify_cattr_content (image, method, data, len, error)) + goto fail; + + mono_class_init (method->klass); + + if (len < 2 || read16 (p) != 0x0001) /* Prolog */ + goto fail; + + /* skip prolog */ + p += 2; + + typedargs = g_new0 (gpointer, sig->param_count); + + for (i = 0; i < sig->param_count; ++i) { + typedargs [i] = load_cattr_value (image, sig->params [i], NULL, p, data_end, &p, error); + return_if_nok (error); + } + + named = p; + + /* Parse mandatory count of named arguments (could be zero) */ + if (!bcheck_blob (named, 1, data_end, error)) + goto fail; + num_named = read16 (named); + namedargs = g_new0 (gpointer, num_named); + return_if_nok (error); + named += 2; + attrklass = method->klass; + + arginfo = g_new0 (CattrNamedArg, num_named); + *named_arg_info = arginfo; + *num_named_args = num_named; + + /* Parse each named arg, and add to arginfo. Each named argument could + * be a field name or a property name followed by a value. */ + for (j = 0; j < num_named; j++) { + guint32 name_len; + char *name, named_type, data_type; + if (!bcheck_blob (named, 1, data_end, error)) + goto fail; + named_type = *named++; /* field or property? */ + data_type = *named++; /* type of data */ + if (data_type == MONO_TYPE_SZARRAY) { + if (!bcheck_blob (named, 0, data_end, error)) + goto fail; + data_type = *named++; + } + if (data_type == MONO_TYPE_ENUM) { + guint32 type_len; + char *type_name; + if (!decode_blob_size_checked (named, data_end, &type_len, &named, error)) + goto fail; + if (ADDP_IS_GREATER_OR_OVF ((const guchar*)named, type_len, data + len)) + goto fail; + + type_name = (char *)g_malloc (type_len + 1); + memcpy (type_name, named, type_len); + type_name [type_len] = 0; + named += type_len; + /* FIXME: lookup the type and check type consistency */ + g_free (type_name); + } + /* named argument name: length, then name */ + if (!decode_blob_size_checked(named, data_end, &name_len, &named, error)) + goto fail; + if (ADDP_IS_GREATER_OR_OVF ((const guchar*)named, name_len, data + len)) + goto fail; + name = (char *)g_malloc (name_len + 1); + memcpy (name, named, name_len); + name [name_len] = 0; + named += name_len; + if (named_type == CATTR_TYPE_FIELD) { + /* Named arg is a field. */ + MonoClassField *field = mono_class_get_field_from_name_full (attrklass, name, NULL); + + if (!field) { + g_free (name); + goto fail; + } + + arginfo [j].type = field->type; + arginfo [j].field = field; + + namedargs [j] = load_cattr_value (image, field->type, NULL, named, data_end, &named, error); + if (!is_ok (error)) { + g_free (name); + return; + } + } else if (named_type == CATTR_TYPE_PROPERTY) { + /* Named arg is a property */ + MonoType *prop_type; + MonoProperty *prop = mono_class_get_property_from_name (attrklass, name); + + if (!prop || !prop->set) { + g_free (name); + goto fail; + } + + prop_type = prop->get? mono_method_signature (prop->get)->ret : + mono_method_signature (prop->set)->params [mono_method_signature (prop->set)->param_count - 1]; + + arginfo [j].type = prop_type; + arginfo [j].prop = prop; + + namedargs [j] = load_cattr_value (image, prop_type, NULL, named, data_end, &named, error); + if (!is_ok (error)) { + g_free (name); + return; + } + } + g_free (name); + } + + *typed_args = typedargs; + *named_args = namedargs; + return; +fail: + mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid."); + g_free (arginfo); + *named_arg_info = NULL; +} + static gboolean reflection_resolve_custom_attribute_data (MonoReflectionMethod *ref_method, MonoReflectionAssembly *assembly, gpointer data, guint32 len, MonoArray **ctor_args, MonoArray **named_args, MonoError *error) { @@ -1195,8 +1377,10 @@ ves_icall_System_Reflection_CustomAttributeData_ResolveArgumentsInternal (MonoRe } static MonoObjectHandle -create_custom_attr_data_handle (MonoImage *image, MonoCustomAttrEntry *cattr, MonoError *error) +create_custom_attr_data (MonoImage *image, MonoCustomAttrEntry *cattr, MonoError *error) { + HANDLE_FUNCTION_ENTER (); + static MonoMethod *ctor; MonoDomain *domain; @@ -1206,42 +1390,48 @@ create_custom_attr_data_handle (MonoImage *image, MonoCustomAttrEntry *cattr, Mo g_assert (image->assembly); - if (!ctor) - ctor = mono_class_get_method_from_name (mono_defaults.customattribute_data_class, ".ctor", 4); + if (!ctor) { + ctor = mono_class_get_method_from_name_checked (mono_defaults.customattribute_data_class, ".ctor", 4, 0, error); + mono_error_assert_ok (error); + } domain = mono_domain_get (); MonoObjectHandle attr = mono_object_new_handle (domain, mono_defaults.customattribute_data_class, error); goto_if_nok (error, fail); - MonoReflectionMethod *ctor_obj = mono_method_get_object_checked (domain, cattr->ctor, NULL, error); + MonoReflectionMethodHandle ctor_obj = mono_method_get_object_handle (domain, cattr->ctor, NULL, error); goto_if_nok (error, fail); MonoReflectionAssemblyHandle assm = mono_assembly_get_object_handle (domain, image->assembly, error); goto_if_nok (error, fail); - params [0] = ctor_obj; + params [0] = MONO_HANDLE_RAW (ctor_obj); params [1] = MONO_HANDLE_RAW (assm); - params [2] = (gpointer)&cattr->data; + params [2] = &cattr->data; params [3] = &cattr->data_size; - mono_runtime_invoke_checked (ctor, MONO_HANDLE_RAW (attr), params, error); - return attr; + mono_runtime_invoke_handle (ctor, attr, params, error); fail: - return MONO_HANDLE_NEW (MonoObject, NULL); + HANDLE_FUNCTION_RETURN_REF (MonoObject, attr); } -static MonoObject * -create_custom_attr_data (MonoImage *image, MonoCustomAttrEntry *cattr, MonoError *error) +static void +create_custom_attr_data_into_array (MonoImage *image, MonoCustomAttrEntry *cattr, MonoArrayHandle result, int index, MonoError *error) { + // This function serves to avoid creating handles in a loop. HANDLE_FUNCTION_ENTER (); - MonoObjectHandle obj = create_custom_attr_data_handle (image, cattr, error); - HANDLE_FUNCTION_RETURN_OBJ (obj); + MonoObjectHandle attr = create_custom_attr_data (image, cattr, error); + goto_if_nok (error, exit); + MONO_HANDLE_ARRAY_SETREF (result, index, attr); +exit: + HANDLE_FUNCTION_RETURN (); } -static MonoArray* +static MonoArrayHandle mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_klass, MonoError *error) { - MonoArray *result; - MonoObject *attr; + HANDLE_FUNCTION_ENTER (); + + MonoArrayHandle result; int i, n; error_init (error); @@ -1252,7 +1442,7 @@ mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_ /* The cattr type is not finished yet */ /* We should include the type name but cinfo doesn't contain it */ mono_error_set_type_load_name (error, NULL, NULL, "Custom attribute constructor is null because the custom attribute type is not finished yet."); - return NULL; + goto return_null; } } @@ -1268,20 +1458,23 @@ mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_ n = cinfo->num_attrs; } - result = mono_array_new_cached (mono_domain_get (), mono_defaults.attribute_class, n, error); - return_val_if_nok (error, NULL); + result = mono_array_new_cached_handle (mono_domain_get (), mono_defaults.attribute_class, n, error); + goto_if_nok (error, return_null); n = 0; for (i = 0; i < cinfo->num_attrs; ++i) { MonoCustomAttrEntry *centry = &cinfo->attrs [i]; if (!attr_klass || mono_class_is_assignable_from (attr_klass, centry->ctor->klass)) { - attr = create_custom_attr (cinfo->image, centry->ctor, centry->data, centry->data_size, error); - if (!mono_error_ok (error)) - return result; - mono_array_setref (result, n, attr); + create_custom_attr_into_array (cinfo->image, centry->ctor, centry->data, + centry->data_size, result, n, error); + goto_if_nok (error, exit); n ++; } } - return result; + goto exit; +return_null: + result = MONO_HANDLE_CAST (MonoArray, mono_new_null ()); +exit: + HANDLE_FUNCTION_RETURN_REF (MonoArray, result); } /** @@ -1290,29 +1483,30 @@ mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_ MonoArray* mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoArray *result = mono_custom_attrs_construct_by_type (cinfo, NULL, error); + MonoArrayHandle result = mono_custom_attrs_construct_by_type (cinfo, NULL, error); mono_error_assert_ok (error); /*FIXME proper error handling*/ - - return result; + HANDLE_FUNCTION_RETURN_OBJ (result); } -static MonoArray* +static MonoArrayHandle mono_custom_attrs_data_construct (MonoCustomAttrInfo *cinfo, MonoError *error) { - MonoArray *result; - MonoObject *attr; - int i; - + HANDLE_FUNCTION_ENTER (); + error_init (error); - result = mono_array_new_checked (mono_domain_get (), mono_defaults.customattribute_data_class, cinfo->num_attrs, error); - return_val_if_nok (error, NULL); - for (i = 0; i < cinfo->num_attrs; ++i) { - attr = create_custom_attr_data (cinfo->image, &cinfo->attrs [i], error); - return_val_if_nok (error, NULL); - mono_array_setref (result, i, attr); + MonoArrayHandle result = mono_array_new_handle (mono_domain_get (), mono_defaults.customattribute_data_class, cinfo->num_attrs, error); + goto_if_nok (error, return_null); + for (int i = 0; i < cinfo->num_attrs; ++i) { + create_custom_attr_data_into_array (cinfo->image, &cinfo->attrs [i], result, i, error); + goto_if_nok (error, return_null); } - return result; + goto exit; +return_null: + result = MONO_HANDLE_CAST (MonoArray, mono_new_null ()); +exit: + HANDLE_FUNCTION_RETURN_REF (MonoArray, result); } /** @@ -1758,7 +1952,9 @@ mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_k if (centry == NULL) return NULL; - return create_custom_attr (ainfo->image, centry->ctor, centry->data, centry->data_size, error); + HANDLE_FUNCTION_ENTER (); + MonoObjectHandle result = create_custom_attr (ainfo->image, centry->ctor, centry->data, centry->data_size, error); + HANDLE_FUNCTION_RETURN_OBJ (result); } /** @@ -1902,7 +2098,7 @@ mono_reflection_get_custom_attrs_info_checked (MonoObjectHandle obj, MonoError * cinfo = mono_custom_attrs_from_builders_handle (NULL, m_class_get_image (mhandle->klass), cattrs); } else if (strcmp ("FieldBuilder", klass_name) == 0) { MonoReflectionFieldBuilderHandle fb = MONO_HANDLE_CAST (MonoReflectionFieldBuilder, obj); - MonoReflectionTypeBuilderHandle tb = MONO_HANDLE_NEW_GET (MonoReflectionTypeBuilder, fb, typeb); + MonoReflectionTypeBuilderHandle tb = MONO_HANDLE_CAST (MonoReflectionTypeBuilder, MONO_HANDLE_NEW_GET (MonoReflectionType, fb, typeb)); MonoReflectionModuleBuilderHandle mb = MONO_HANDLE_NEW_GET (MonoReflectionModuleBuilder, tb, module); MonoDynamicImage *dynamic_image = MONO_HANDLE_GETVAL (mb, dynamic_image); MonoArrayHandle cattrs = MONO_HANDLE_NEW_GET (MonoArray, fb, cattrs); @@ -1948,11 +2144,9 @@ mono_reflection_get_custom_attrs_by_type_handle (MonoObjectHandle obj, MonoClass cinfo = mono_reflection_get_custom_attrs_info_checked (obj, error); goto_if_nok (error, leave); if (cinfo) { - MONO_HANDLE_ASSIGN (result, MONO_HANDLE_NEW (MonoArray, mono_custom_attrs_construct_by_type (cinfo, attr_klass, error))); /* FIXME use coop handles for mono_custom_attrs_construct_by_type */ + MONO_HANDLE_ASSIGN (result, mono_custom_attrs_construct_by_type (cinfo, attr_klass, error)); if (!cinfo->cached) mono_custom_attrs_free (cinfo); - if (!result) - goto leave; } else { MONO_HANDLE_ASSIGN (result, mono_array_new_handle (mono_domain_get (), mono_defaults.attribute_class, 0, error)); } @@ -2017,7 +2211,7 @@ mono_reflection_get_custom_attrs_data_checked (MonoObjectHandle obj, MonoError * cinfo = mono_reflection_get_custom_attrs_info_checked (obj, error); goto_if_nok (error, leave); if (cinfo) { - MONO_HANDLE_ASSIGN (result, MONO_HANDLE_NEW (MonoArray, mono_custom_attrs_data_construct (cinfo, error))); /* FIXME use coop handles in mono_custom_attrs_data_construct */ + MONO_HANDLE_ASSIGN (result, mono_custom_attrs_data_construct (cinfo, error)); if (!cinfo->cached) mono_custom_attrs_free (cinfo); goto_if_nok (error, leave); diff --git a/mono/metadata/debug-helpers.c b/mono/metadata/debug-helpers.c index 7487237950..52902a6b89 100644 --- a/mono/metadata/debug-helpers.c +++ b/mono/metadata/debug-helpers.c @@ -19,6 +19,7 @@ #include "mono/metadata/debug-helpers.h" #include "mono/metadata/tabledefs.h" #include "mono/metadata/appdomain.h" +#include "mono/metadata/abi-details.h" #ifdef MONO_CLASS_DEF_PRIVATE /* Rationale: we want the functions in this file to work even when everything * is broken. They may be called from a debugger session, for example. If @@ -53,7 +54,7 @@ static const struct msgstr_t { #undef WRAPPER }; static const gint16 opidx [] = { -#define WRAPPER(a,b) [MONO_WRAPPER_ ## a] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), +#define WRAPPER(a,b) offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), #include "wrapper-types.h" #undef WRAPPER }; @@ -966,7 +967,11 @@ mono_method_get_name_full (MonoMethod *method, gboolean signature, gboolean ret, char * mono_method_full_name (MonoMethod *method, gboolean signature) { - return mono_method_get_name_full (method, signature, FALSE, MONO_TYPE_NAME_FORMAT_IL); + char *res; + MONO_ENTER_GC_UNSAFE; + res = mono_method_get_name_full (method, signature, FALSE, MONO_TYPE_NAME_FORMAT_IL); + MONO_EXIT_GC_UNSAFE; + return res; } char * @@ -1130,12 +1135,12 @@ objval_describe (MonoClass *klass, const char *addr) gssize type_offset = 0; if (klass->valuetype) - type_offset = -sizeof (MonoObject); + type_offset = - MONO_ABI_SIZEOF (MonoObject); for (p = klass; p != NULL; p = p->parent) { gpointer iter = NULL; int printed_header = FALSE; - while ((field = mono_class_get_fields (p, &iter))) { + while ((field = mono_class_get_fields_internal (p, &iter))) { if (field->type->attrs & (FIELD_ATTRIBUTE_STATIC | FIELD_ATTRIBUTE_HAS_FIELD_RVA)) continue; @@ -1206,7 +1211,7 @@ mono_class_describe_statics (MonoClass* klass) for (p = klass; p != NULL; p = p->parent) { gpointer iter = NULL; - while ((field = mono_class_get_fields (p, &iter))) { + while ((field = mono_class_get_fields_internal (p, &iter))) { if (field->type->attrs & FIELD_ATTRIBUTE_LITERAL) continue; if (!(field->type->attrs & (FIELD_ATTRIBUTE_STATIC | FIELD_ATTRIBUTE_HAS_FIELD_RVA))) diff --git a/mono/metadata/debug-mono-ppdb.c b/mono/metadata/debug-mono-ppdb.c index 6ba2bc2f57..9a5f7ed0fa 100644 --- a/mono/metadata/debug-mono-ppdb.c +++ b/mono/metadata/debug-mono-ppdb.c @@ -376,6 +376,12 @@ mono_ppdb_lookup_location (MonoDebugMethodInfo *minfo, uint32_t offset) return location; } +MonoImage * +mono_ppdb_get_image (MonoPPDBFile *ppdb) +{ + return ppdb->image; +} + void mono_ppdb_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrArray **source_file_list, int **source_files, MonoSymSeqPoint **seq_points, int *n_seq_points) { diff --git a/mono/metadata/debug-mono-ppdb.h b/mono/metadata/debug-mono-ppdb.h index 87033e728c..45d7a95897 100644 --- a/mono/metadata/debug-mono-ppdb.h +++ b/mono/metadata/debug-mono-ppdb.h @@ -38,4 +38,7 @@ mono_ppdb_lookup_locals (MonoDebugMethodInfo *minfo); MonoDebugMethodAsyncInfo* mono_ppdb_lookup_method_async_debug_info (MonoDebugMethodInfo *minfo); +MonoImage * +mono_ppdb_get_image (MonoPPDBFile *ppdb); + #endif diff --git a/mono/metadata/decimal-ms.c b/mono/metadata/decimal-ms.c deleted file mode 100644 index 471393b6e4..0000000000 --- a/mono/metadata/decimal-ms.c +++ /dev/null @@ -1,3135 +0,0 @@ -/** - * \file - * Copyright (c) Microsoft. All rights reserved. - * Licensed under the MIT license. See LICENSE file in the project root for full license information. - * - * Copyright 2015 Xamarin Inc - * - * File: decimal.c - * - * Ported from C++ to C and adjusted to Mono runtime - * - * Pending: - * DoToCurrency (they look like new methods we do not have) - */ -#ifndef DISABLE_DECIMAL -#include "config.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_MEMORY_H -#include -#endif -#ifdef _MSC_VER -#include -#endif -#include "decimal-ms.h" -#include "number-ms.h" - -#define min(a, b) (((a) < (b)) ? (a) : (b)) - -typedef enum { - MONO_DECIMAL_OK, - MONO_DECIMAL_OVERFLOW, - MONO_DECIMAL_INVALID_ARGUMENT, - MONO_DECIMAL_DIVBYZERO, - MONO_DECIMAL_ARGUMENT_OUT_OF_RANGE -} MonoDecimalStatus; - -#ifndef FC_GC_POLL -# define FC_GC_POLL() -#endif - -static const uint32_t ten_to_nine = 1000000000U; -static const uint32_t ten_to_ten_div_4 = 2500000000U; -#define POWER10_MAX 9 -#define DECIMAL_NEG ((uint8_t)0x80) -#define DECMAX 28 -#define DECIMAL_SCALE(dec) ((dec).u.u.scale) -#define DECIMAL_SIGN(dec) ((dec).u.u.sign) -#define DECIMAL_SIGNSCALE(dec) ((dec).u.signscale) -#define DECIMAL_LO32(dec) ((dec).v.v.Lo32) -#define DECIMAL_MID32(dec) ((dec).v.v.Mid32) -#define DECIMAL_HI32(dec) ((dec).Hi32) -#if G_BYTE_ORDER != G_LITTLE_ENDIAN -# define DECIMAL_LO64_GET(dec) (((uint64_t)((dec).v.v.Mid32) << 32) | (dec).v.v.Lo32) -# define DECIMAL_LO64_SET(dec,value) {(dec).v.v.Lo32 = (value); (dec).v.v.Mid32 = ((value) >> 32); } -#else -# define DECIMAL_LO64_GET(dec) ((dec).v.Lo64) -# define DECIMAL_LO64_SET(dec,value) {(dec).v.Lo64 = value; } -#endif - -#define DECIMAL_SETZERO(dec) {DECIMAL_LO32(dec) = 0; DECIMAL_MID32(dec) = 0; DECIMAL_HI32(dec) = 0; DECIMAL_SIGNSCALE(dec) = 0;} -#define COPYDEC(dest, src) {DECIMAL_SIGNSCALE(dest) = DECIMAL_SIGNSCALE(src); DECIMAL_HI32(dest) = DECIMAL_HI32(src); \ - DECIMAL_MID32(dest) = DECIMAL_MID32(src); DECIMAL_LO32(dest) = DECIMAL_LO32(src); } - -#define DEC_SCALE_MAX 28 -#define POWER10_MAX 9 - -#define OVFL_MAX_9_HI 4 -#define OVFL_MAX_9_MID 1266874889 -#define OVFL_MAX_9_LO 3047500985u - -#define OVFL_MAX_5_HI 42949 -#define OVFL_MAX_5_MID 2890341191 - -#define OVFL_MAX_1_HI 429496729 - -typedef union { - uint64_t int64; - struct { -#if BYTE_ORDER == G_BIG_ENDIAN - uint32_t Hi; - uint32_t Lo; -#else - uint32_t Lo; - uint32_t Hi; -#endif - } u; -} SPLIT64; - -static const SPLIT64 ten_to_eighteen = { 1000000000000000000ULL }; - -static const MonoDouble_double ds2to64 = { .s = { .sign = 0, .exp = MONO_DOUBLE_BIAS + 65, .mantHi = 0, .mantLo = 0 } }; - -// -// Data tables -// - -static const uint32_t power10 [POWER10_MAX+1] = { - 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 -}; - - -static const double double_power10[] = { - 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, - 1e20, 1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29, - 1e30, 1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39, - 1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49, - 1e50, 1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59, - 1e60, 1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69, - 1e70, 1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79, - 1e80 }; - -static const SPLIT64 sdl_power10[] = { {10000000000ULL}, // 1E10 - {100000000000ULL}, // 1E11 - {1000000000000ULL}, // 1E12 - {10000000000000ULL}, // 1E13 - {100000000000000ULL} }; // 1E14 - -static const uint64_t long_power10[] = { - 1, - 10ULL, - 100ULL, - 1000ULL, - 10000ULL, - 100000ULL, - 1000000ULL, - 10000000ULL, - 100000000ULL, - 1000000000ULL, - 10000000000ULL, - 100000000000ULL, - 1000000000000ULL, - 10000000000000ULL, - 100000000000000ULL, - 1000000000000000ULL, - 10000000000000000ULL, - 100000000000000000ULL, - 1000000000000000000ULL, - 10000000000000000000ULL}; - -typedef struct { - uint32_t Hi, Mid, Lo; -} DECOVFL; - -static const DECOVFL power_overflow[] = { -// This is a table of the largest values that can be in the upper two -// ULONGs of a 96-bit number that will not overflow when multiplied -// by a given power. For the upper word, this is a table of -// 2^32 / 10^n for 1 <= n <= 9. For the lower word, this is the -// remaining fraction part * 2^32. 2^32 = 4294967296. -// - { 429496729u, 2576980377u, 2576980377u }, // 10^1 remainder 0.6 - { 42949672u, 4123168604u, 687194767u }, // 10^2 remainder 0.16 - { 4294967u, 1271310319u, 2645699854u }, // 10^3 remainder 0.616 - { 429496u, 3133608139u, 694066715u }, // 10^4 remainder 0.1616 - { 42949u, 2890341191u, 2216890319u }, // 10^5 remainder 0.51616 - { 4294u, 4154504685u, 2369172679u }, // 10^6 remainder 0.551616 - { 429u, 2133437386u, 4102387834u }, // 10^7 remainder 0.9551616 - { 42u, 4078814305u, 410238783u }, // 10^8 remainder 0.09991616 - { 4u, 1266874889u, 3047500985u }, // 10^9 remainder 0.709551616 -}; - -#define UInt32x32To64(a, b) ((uint64_t)((uint32_t)(a)) * (uint64_t)((uint32_t)(b))) -#if G_BYTE_ORDER != G_LITTLE_ENDIAN -/* hacky endian swap where losing the other end is OK, since we truncate to 32bit */ -#define Div64by32(num, den) ((uint32_t) (((uint64_t)(num) / (uint32_t)(den)) >> 32) ) -#define Mod64by32(num, den) ((uint32_t) (((uint64_t)(num) % (uint32_t)(den)) >> 32) ) -#else -#define Div64by32(num, den) ((uint32_t)((uint64_t)(num) / (uint32_t)(den))) -#define Mod64by32(num, den) ((uint32_t)((uint64_t)(num) % (uint32_t)(den))) -#endif - -static double -fnDblPower10(int ix) -{ - const int maxIx = (sizeof(double_power10)/sizeof(double_power10[0])); - g_assert(ix >= 0); - if (ix < maxIx) - return double_power10[ix]; - return pow(10.0, ix); -} // double fnDblPower10() - - -static inline int64_t -DivMod32by32(int32_t num, int32_t den) -{ - SPLIT64 sdl; - - sdl.u.Lo = num / den; - sdl.u.Hi = num % den; - return sdl.int64; -} - -static inline int64_t -DivMod64by32(int64_t num, int32_t den) -{ - SPLIT64 sdl; - - sdl.u.Lo = Div64by32(num, den); - sdl.u.Hi = Mod64by32(num, den); - return sdl.int64; -} - -static uint64_t -UInt64x64To128(SPLIT64 op1, SPLIT64 op2, uint64_t *hi) -{ - SPLIT64 tmp1; - SPLIT64 tmp2; - SPLIT64 tmp3; - - tmp1.int64 = UInt32x32To64(op1.u.Lo, op2.u.Lo); // lo partial prod - tmp2.int64 = UInt32x32To64(op1.u.Lo, op2.u.Hi); // mid 1 partial prod - tmp1.u.Hi += tmp2.u.Lo; - if (tmp1.u.Hi < tmp2.u.Lo) // test for carry - tmp2.u.Hi++; - tmp3.int64 = UInt32x32To64(op1.u.Hi, op2.u.Hi) + (uint64_t)tmp2.u.Hi; - tmp2.int64 = UInt32x32To64(op1.u.Hi, op2.u.Lo); - tmp1.u.Hi += tmp2.u.Lo; - if (tmp1.u.Hi < tmp2.u.Lo) // test for carry - tmp2.u.Hi++; - tmp3.int64 += (uint64_t)tmp2.u.Hi; - - *hi = tmp3.int64; - return tmp1.int64; -} - -/** -* FullDiv64By32: -* -* Entry: -* pdlNum - Pointer to 64-bit dividend -* ulDen - 32-bit divisor -* -* Purpose: -* Do full divide, yielding 64-bit result and 32-bit remainder. -* -* Exit: -* Quotient overwrites dividend. -* Returns remainder. -* -* Exceptions: -* None. -*/ -// Was: FullDiv64By32 -static uint32_t -FullDiv64By32 (uint64_t *num, uint32_t den) -{ - SPLIT64 tmp; - SPLIT64 res; - - tmp.int64 = *num; - res.u.Hi = 0; - - if (tmp.u.Hi >= den) { - // DivMod64by32 returns quotient in Lo, remainder in Hi. - // - res.u.Lo = tmp.u.Hi; - res.int64 = DivMod64by32(res.int64, den); - tmp.u.Hi = res.u.Hi; - res.u.Hi = res.u.Lo; - } - - tmp.int64 = DivMod64by32(tmp.int64, den); - res.u.Lo = tmp.u.Lo; - *num = res.int64; - return tmp.u.Hi; -} - -/*** - * SearchScale - * - * Entry: - * res_hi - Top uint32_t of quotient - * res_mid - Middle uint32_t of quotient - * res_lo - Bottom uint32_t of quotient - * scale - Scale factor of quotient, range -DEC_SCALE_MAX to DEC_SCALE_MAX - * - * Purpose: - * Determine the max power of 10, <= 9, that the quotient can be scaled - * up by and still fit in 96 bits. - * - * Exit: - * Returns power of 10 to scale by, -1 if overflow error. - * - ***********************************************************************/ - -static int -SearchScale(uint32_t res_hi, uint32_t res_mid, uint32_t res_lo, int scale) -{ - int cur_scale; - - // Quick check to stop us from trying to scale any more. - // - if (res_hi > OVFL_MAX_1_HI || scale >= DEC_SCALE_MAX) { - cur_scale = 0; - goto HaveScale; - } - - if (scale > DEC_SCALE_MAX - 9) { - // We can't scale by 10^9 without exceeding the max scale factor. - // See if we can scale to the max. If not, we'll fall into - // standard search for scale factor. - // - cur_scale = DEC_SCALE_MAX - scale; - if (res_hi < power_overflow[cur_scale - 1].Hi) - goto HaveScale; - - if (res_hi == power_overflow[cur_scale - 1].Hi) { - UpperEq: - if (res_mid > power_overflow[cur_scale - 1].Mid || - (res_mid == power_overflow[cur_scale - 1].Mid && res_lo > power_overflow[cur_scale - 1].Lo)) { - cur_scale--; - } - goto HaveScale; - } - } else if (res_hi < OVFL_MAX_9_HI || (res_hi == OVFL_MAX_9_HI && res_mid < OVFL_MAX_9_MID) || (res_hi == OVFL_MAX_9_HI && res_mid == OVFL_MAX_9_MID && res_lo <= OVFL_MAX_9_LO)) - return 9; - - // Search for a power to scale by < 9. Do a binary search - // on power_overflow[]. - // - cur_scale = 5; - if (res_hi < OVFL_MAX_5_HI) - cur_scale = 7; - else if (res_hi > OVFL_MAX_5_HI) - cur_scale = 3; - else - goto UpperEq; - - // cur_scale is 3 or 7. - // - if (res_hi < power_overflow[cur_scale - 1].Hi) - cur_scale++; - else if (res_hi > power_overflow[cur_scale - 1].Hi) - cur_scale--; - else - goto UpperEq; - - // cur_scale is 2, 4, 6, or 8. - // - // In all cases, we already found we could not use the power one larger. - // So if we can use this power, it is the biggest, and we're done. If - // we can't use this power, the one below it is correct for all cases - // unless it's 10^1 -- we might have to go to 10^0 (no scaling). - // - if (res_hi > power_overflow[cur_scale - 1].Hi) - cur_scale--; - - if (res_hi == power_overflow[cur_scale - 1].Hi) - goto UpperEq; - -HaveScale: - // cur_scale = largest power of 10 we can scale by without overflow, - // cur_scale < 9. See if this is enough to make scale factor - // positive if it isn't already. - // - if (cur_scale + scale < 0) - cur_scale = -1; - - return cur_scale; -} - - -/** -* Div96By32 -* -* Entry: -* rgulNum - Pointer to 96-bit dividend as array of uint32_ts, least-sig first -* ulDen - 32-bit divisor. -* -* Purpose: -* Do full divide, yielding 96-bit result and 32-bit remainder. -* -* Exit: -* Quotient overwrites dividend. -* Returns remainder. -* -* Exceptions: -* None. -* -*/ -static uint32_t -Div96By32(uint32_t *num, uint32_t den) -{ - SPLIT64 tmp; - - tmp.u.Hi = 0; - - if (num[2] != 0) - goto Div3Word; - - if (num[1] >= den) - goto Div2Word; - - tmp.u.Hi = num[1]; - num[1] = 0; - goto Div1Word; - -Div3Word: - tmp.u.Lo = num[2]; - tmp.int64 = DivMod64by32(tmp.int64, den); - num[2] = tmp.u.Lo; -Div2Word: - tmp.u.Lo = num[1]; - tmp.int64 = DivMod64by32(tmp.int64, den); - num[1] = tmp.u.Lo; -Div1Word: - tmp.u.Lo = num[0]; - tmp.int64 = DivMod64by32(tmp.int64, den); - num[0] = tmp.u.Lo; - return tmp.u.Hi; -} - -/*** - * DecFixInt - * - * Entry: - * pdecRes - Pointer to Decimal result location - * operand - Pointer to Decimal operand - * - * Purpose: - * Chop the value to integer. Return remainder so Int() function - * can round down if non-zero. - * - * Exit: - * Returns remainder. - * - * Exceptions: - * None. - * - ***********************************************************************/ - -static uint32_t -DecFixInt(MonoDecimal * result, MonoDecimal * operand) -{ - uint32_t num[3]; - uint32_t rem; - uint32_t pwr; - int scale; - - if (operand->u.u.scale > 0) { - num[0] = operand->v.v.Lo32; - num[1] = operand->v.v.Mid32; - num[2] = operand->Hi32; - scale = operand->u.u.scale; - result->u.u.sign = operand->u.u.sign; - rem = 0; - - do { - if (scale > POWER10_MAX) - pwr = ten_to_nine; - else - pwr = power10[scale]; - - rem |= Div96By32(num, pwr); - scale -= 9; - }while (scale > 0); - - result->v.v.Lo32 = num[0]; - result->v.v.Mid32 = num[1]; - result->Hi32 = num[2]; - result->u.u.scale = 0; - - return rem; - } - - COPYDEC(*result, *operand); - // Odd, the Microsoft code does not set result->reserved to zero on this case - return 0; -} - -/** - * ScaleResult: - * - * Entry: - * res - Array of uint32_ts with value, least-significant first. - * hi_res - Index of last non-zero value in res. - * scale - Scale factor for this value, range 0 - 2 * DEC_SCALE_MAX - * - * Purpose: - * See if we need to scale the result to fit it in 96 bits. - * Perform needed scaling. Adjust scale factor accordingly. - * - * Exit: - * res updated in place, always 3 uint32_ts. - * New scale factor returned, -1 if overflow error. - * - */ -static int -ScaleResult(uint32_t *res, int hi_res, int scale) -{ - int new_scale; - int cur; - uint32_t pwr; - uint32_t tmp; - uint32_t sticky; - SPLIT64 sdlTmp; - - // See if we need to scale the result. The combined scale must - // be <= DEC_SCALE_MAX and the upper 96 bits must be zero. - // - // Start by figuring a lower bound on the scaling needed to make - // the upper 96 bits zero. hi_res is the index into res[] - // of the highest non-zero uint32_t. - // - new_scale = hi_res * 32 - 64 - 1; - if (new_scale > 0) { - - // Find the MSB. - // - tmp = res[hi_res]; - if (!(tmp & 0xFFFF0000)) { - new_scale -= 16; - tmp <<= 16; - } - if (!(tmp & 0xFF000000)) { - new_scale -= 8; - tmp <<= 8; - } - if (!(tmp & 0xF0000000)) { - new_scale -= 4; - tmp <<= 4; - } - if (!(tmp & 0xC0000000)) { - new_scale -= 2; - tmp <<= 2; - } - if (!(tmp & 0x80000000)) { - new_scale--; - tmp <<= 1; - } - - // Multiply bit position by log10(2) to figure it's power of 10. - // We scale the log by 256. log(2) = .30103, * 256 = 77. Doing this - // with a multiply saves a 96-byte lookup table. The power returned - // is <= the power of the number, so we must add one power of 10 - // to make it's integer part zero after dividing by 256. - // - // Note: the result of this multiplication by an approximation of - // log10(2) have been exhaustively checked to verify it gives the - // correct result. (There were only 95 to check...) - // - new_scale = ((new_scale * 77) >> 8) + 1; - - // new_scale = min scale factor to make high 96 bits zero, 0 - 29. - // This reduces the scale factor of the result. If it exceeds the - // current scale of the result, we'll overflow. - // - if (new_scale > scale) - return -1; - } - else - new_scale = 0; - - // Make sure we scale by enough to bring the current scale factor - // into valid range. - // - if (new_scale < scale - DEC_SCALE_MAX) - new_scale = scale - DEC_SCALE_MAX; - - if (new_scale != 0) { - // Scale by the power of 10 given by new_scale. Note that this is - // NOT guaranteed to bring the number within 96 bits -- it could - // be 1 power of 10 short. - // - scale -= new_scale; - sticky = 0; - sdlTmp.u.Hi = 0; // initialize remainder - - for (;;) { - - sticky |= sdlTmp.u.Hi; // record remainder as sticky bit - - if (new_scale > POWER10_MAX) - pwr = ten_to_nine; - else - pwr = power10[new_scale]; - - // Compute first quotient. - // DivMod64by32 returns quotient in Lo, remainder in Hi. - // - sdlTmp.int64 = DivMod64by32(res[hi_res], pwr); - res[hi_res] = sdlTmp.u.Lo; - cur = hi_res - 1; - - if (cur >= 0) { - // If first quotient was 0, update hi_res. - // - if (sdlTmp.u.Lo == 0) - hi_res--; - - // Compute subsequent quotients. - // - do { - sdlTmp.u.Lo = res[cur]; - sdlTmp.int64 = DivMod64by32(sdlTmp.int64, pwr); - res[cur] = sdlTmp.u.Lo; - cur--; - } while (cur >= 0); - - } - - new_scale -= POWER10_MAX; - if (new_scale > 0) - continue; // scale some more - - // If we scaled enough, hi_res would be 2 or less. If not, - // divide by 10 more. - // - if (hi_res > 2) { - new_scale = 1; - scale--; - continue; // scale by 10 - } - - // Round final result. See if remainder >= 1/2 of divisor. - // If remainder == 1/2 divisor, round up if odd or sticky bit set. - // - pwr >>= 1; // power of 10 always even - if ( pwr <= sdlTmp.u.Hi && (pwr < sdlTmp.u.Hi || - ((res[0] & 1) | sticky)) ) { - cur = -1; - while (++res[++cur] == 0); - - if (cur > 2) { - // The rounding caused us to carry beyond 96 bits. - // Scale by 10 more. - // - hi_res = cur; - sticky = 0; // no sticky bit - sdlTmp.u.Hi = 0; // or remainder - new_scale = 1; - scale--; - continue; // scale by 10 - } - } - - // We may have scaled it more than we planned. Make sure the scale - // factor hasn't gone negative, indicating overflow. - // - if (scale < 0) - return -1; - - return scale; - } // for(;;) - } - return scale; -} - -// Decimal multiply -// Returns: MONO_DECIMAL_OVERFLOW or MONO_DECIMAL_OK -static MonoDecimalStatus -mono_decimal_multiply_result(MonoDecimal * left, MonoDecimal * right, MonoDecimal * result) -{ - SPLIT64 tmp; - SPLIT64 tmp2; - SPLIT64 tmp3; - int scale; - int hi_prod; - uint32_t pwr; - uint32_t rem_lo; - uint32_t rem_hi; - uint32_t prod[6]; - - scale = left->u.u.scale + right->u.u.scale; - - if ((left->Hi32 | left->v.v.Mid32 | right->Hi32 | right->v.v.Mid32) == 0) { - // Upper 64 bits are zero. - // - tmp.int64 = UInt32x32To64(left->v.v.Lo32, right->v.v.Lo32); - if (scale > DEC_SCALE_MAX) - { - // Result scale is too big. Divide result by power of 10 to reduce it. - // If the amount to divide by is > 19 the result is guaranteed - // less than 1/2. [max value in 64 bits = 1.84E19] - // - scale -= DEC_SCALE_MAX; - if (scale > 19) { - ReturnZero: - DECIMAL_SETZERO(*result); - return MONO_DECIMAL_OK; - } - - if (scale > POWER10_MAX) { - // Divide by 1E10 first, to get the power down to a 32-bit quantity. - // 1E10 itself doesn't fit in 32 bits, so we'll divide by 2.5E9 now - // then multiply the next divisor by 4 (which will be a max of 4E9). - // - rem_lo = FullDiv64By32(&tmp.int64, ten_to_ten_div_4); - pwr = power10[scale - 10] << 2; - } else { - pwr = power10[scale]; - rem_lo = 0; - } - - // Power to divide by fits in 32 bits. - // - rem_hi = FullDiv64By32(&tmp.int64, pwr); - - // Round result. See if remainder >= 1/2 of divisor. - // Divisor is a power of 10, so it is always even. - // - pwr >>= 1; - if (rem_hi >= pwr && (rem_hi > pwr || (rem_lo | (tmp.u.Lo & 1)))) - tmp.int64++; - - scale = DEC_SCALE_MAX; - } - DECIMAL_LO32(*result) = tmp.u.Lo; - DECIMAL_MID32(*result) = tmp.u.Hi; - DECIMAL_HI32(*result) = 0; - } else { - // At least one operand has bits set in the upper 64 bits. - // - // Compute and accumulate the 9 partial products into a - // 192-bit (24-byte) result. - // - // [l-h][l-m][l-l] left high, middle, low - // x [r-h][r-m][r-l] right high, middle, low - // ------------------------------ - // - // [0-h][0-l] l-l * r-l - // [1ah][1al] l-l * r-m - // [1bh][1bl] l-m * r-l - // [2ah][2al] l-m * r-m - // [2bh][2bl] l-l * r-h - // [2ch][2cl] l-h * r-l - // [3ah][3al] l-m * r-h - // [3bh][3bl] l-h * r-m - // [4-h][4-l] l-h * r-h - // ------------------------------ - // [p-5][p-4][p-3][p-2][p-1][p-0] prod[] array - // - tmp.int64 = UInt32x32To64(left->v.v.Lo32, right->v.v.Lo32); - prod[0] = tmp.u.Lo; - - tmp2.int64 = UInt32x32To64(left->v.v.Lo32, right->v.v.Mid32) + tmp.u.Hi; - - tmp.int64 = UInt32x32To64(left->v.v.Mid32, right->v.v.Lo32); - tmp.int64 += tmp2.int64; // this could generate carry - prod[1] = tmp.u.Lo; - if (tmp.int64 < tmp2.int64) // detect carry - tmp2.u.Hi = 1; - else - tmp2.u.Hi = 0; - tmp2.u.Lo = tmp.u.Hi; - - tmp.int64 = UInt32x32To64(left->v.v.Mid32, right->v.v.Mid32) + tmp2.int64; - - if (left->Hi32 | right->Hi32) { - // Highest 32 bits is non-zero. Calculate 5 more partial products. - // - tmp2.int64 = UInt32x32To64(left->v.v.Lo32, right->Hi32); - tmp.int64 += tmp2.int64; // this could generate carry - if (tmp.int64 < tmp2.int64) // detect carry - tmp3.u.Hi = 1; - else - tmp3.u.Hi = 0; - - tmp2.int64 = UInt32x32To64(left->Hi32, right->v.v.Lo32); - tmp.int64 += tmp2.int64; // this could generate carry - prod[2] = tmp.u.Lo; - if (tmp.int64 < tmp2.int64) // detect carry - tmp3.u.Hi++; - tmp3.u.Lo = tmp.u.Hi; - - tmp.int64 = UInt32x32To64(left->v.v.Mid32, right->Hi32); - tmp.int64 += tmp3.int64; // this could generate carry - if (tmp.int64 < tmp3.int64) // detect carry - tmp3.u.Hi = 1; - else - tmp3.u.Hi = 0; - - tmp2.int64 = UInt32x32To64(left->Hi32, right->v.v.Mid32); - tmp.int64 += tmp2.int64; // this could generate carry - prod[3] = tmp.u.Lo; - if (tmp.int64 < tmp2.int64) // detect carry - tmp3.u.Hi++; - tmp3.u.Lo = tmp.u.Hi; - - tmp.int64 = UInt32x32To64(left->Hi32, right->Hi32) + tmp3.int64; - prod[4] = tmp.u.Lo; - prod[5] = tmp.u.Hi; - - hi_prod = 5; - } - else { - prod[2] = tmp.u.Lo; - prod[3] = tmp.u.Hi; - hi_prod = 3; - } - - // Check for leading zero uint32_ts on the product - // - while (prod[hi_prod] == 0) { - hi_prod--; - if (hi_prod < 0) - goto ReturnZero; - } - - scale = ScaleResult(prod, hi_prod, scale); - if (scale == -1) - return MONO_DECIMAL_OVERFLOW; - - result->v.v.Lo32 = prod[0]; - result->v.v.Mid32 = prod[1]; - result->Hi32 = prod[2]; - } - - result->u.u.sign = right->u.u.sign ^ left->u.u.sign; - result->u.u.scale = (char)scale; - return MONO_DECIMAL_OK; -} - -// Addition and subtraction -static MonoDecimalStatus -DecAddSub(MonoDecimal *left, MonoDecimal *right, MonoDecimal *result, int8_t sign) -{ - uint32_t num[6]; - uint32_t pwr; - int scale; - int hi_prod; - int cur; - SPLIT64 tmp; - MonoDecimal decRes; - MonoDecimal decTmp; - MonoDecimal *pdecTmp; - - sign ^= (right->u.u.sign ^ left->u.u.sign) & DECIMAL_NEG; - - if (right->u.u.scale == left->u.u.scale) { - // Scale factors are equal, no alignment necessary. - // - decRes.u.signscale = left->u.signscale; - - AlignedAdd: - if (sign) { - // Signs differ - subtract - // - DECIMAL_LO64_SET(decRes, DECIMAL_LO64_GET(*left) - DECIMAL_LO64_GET(*right)); - DECIMAL_HI32(decRes) = DECIMAL_HI32(*left) - DECIMAL_HI32(*right); - - // Propagate carry - // - if (DECIMAL_LO64_GET(decRes) > DECIMAL_LO64_GET(*left)) { - decRes.Hi32--; - if (decRes.Hi32 >= left->Hi32) - goto SignFlip; - } else if (decRes.Hi32 > left->Hi32) { - // Got negative result. Flip its sign. - // - SignFlip: - DECIMAL_LO64_SET(decRes, -(uint64_t)DECIMAL_LO64_GET(decRes)); - decRes.Hi32 = ~decRes.Hi32; - if (DECIMAL_LO64_GET(decRes) == 0) - decRes.Hi32++; - decRes.u.u.sign ^= DECIMAL_NEG; - } - - } else { - // Signs are the same - add - // - DECIMAL_LO64_SET(decRes, DECIMAL_LO64_GET(*left) + DECIMAL_LO64_GET(*right)); - decRes.Hi32 = left->Hi32 + right->Hi32; - - // Propagate carry - // - if (DECIMAL_LO64_GET(decRes) < DECIMAL_LO64_GET(*left)) { - decRes.Hi32++; - if (decRes.Hi32 <= left->Hi32) - goto AlignedScale; - } else if (decRes.Hi32 < left->Hi32) { - AlignedScale: - // The addition carried above 96 bits. Divide the result by 10, - // dropping the scale factor. - // - if (decRes.u.u.scale == 0) - return MONO_DECIMAL_OVERFLOW; - decRes.u.u.scale--; - - tmp.u.Lo = decRes.Hi32; - tmp.u.Hi = 1; - tmp.int64 = DivMod64by32(tmp.int64, 10); - decRes.Hi32 = tmp.u.Lo; - - tmp.u.Lo = decRes.v.v.Mid32; - tmp.int64 = DivMod64by32(tmp.int64, 10); - decRes.v.v.Mid32 = tmp.u.Lo; - - tmp.u.Lo = decRes.v.v.Lo32; - tmp.int64 = DivMod64by32(tmp.int64, 10); - decRes.v.v.Lo32 = tmp.u.Lo; - - // See if we need to round up. - // - if (tmp.u.Hi >= 5 && (tmp.u.Hi > 5 || (decRes.v.v.Lo32 & 1))) { - DECIMAL_LO64_SET(decRes, DECIMAL_LO64_GET(decRes)+1) - if (DECIMAL_LO64_GET(decRes) == 0) - decRes.Hi32++; - } - } - } - } - else { - // Scale factors are not equal. Assume that a larger scale - // factor (more decimal places) is likely to mean that number - // is smaller. Start by guessing that the right operand has - // the larger scale factor. The result will have the larger - // scale factor. - // - decRes.u.u.scale = right->u.u.scale; // scale factor of "smaller" - decRes.u.u.sign = left->u.u.sign; // but sign of "larger" - scale = decRes.u.u.scale - left->u.u.scale; - - if (scale < 0) { - // Guessed scale factor wrong. Swap operands. - // - scale = -scale; - decRes.u.u.scale = left->u.u.scale; - decRes.u.u.sign ^= sign; - pdecTmp = right; - right = left; - left = pdecTmp; - } - - // *left will need to be multiplied by 10^scale so - // it will have the same scale as *right. We could be - // extending it to up to 192 bits of precision. - // - if (scale <= POWER10_MAX) { - // Scaling won't make it larger than 4 uint32_ts - // - pwr = power10[scale]; - DECIMAL_LO64_SET(decTmp, UInt32x32To64(left->v.v.Lo32, pwr)); - tmp.int64 = UInt32x32To64(left->v.v.Mid32, pwr); - tmp.int64 += decTmp.v.v.Mid32; - decTmp.v.v.Mid32 = tmp.u.Lo; - decTmp.Hi32 = tmp.u.Hi; - tmp.int64 = UInt32x32To64(left->Hi32, pwr); - tmp.int64 += decTmp.Hi32; - if (tmp.u.Hi == 0) { - // Result fits in 96 bits. Use standard aligned add. - // - decTmp.Hi32 = tmp.u.Lo; - left = &decTmp; - goto AlignedAdd; - } - num[0] = decTmp.v.v.Lo32; - num[1] = decTmp.v.v.Mid32; - num[2] = tmp.u.Lo; - num[3] = tmp.u.Hi; - hi_prod = 3; - } - else { - // Have to scale by a bunch. Move the number to a buffer - // where it has room to grow as it's scaled. - // - num[0] = left->v.v.Lo32; - num[1] = left->v.v.Mid32; - num[2] = left->Hi32; - hi_prod = 2; - - // Scan for zeros in the upper words. - // - if (num[2] == 0) { - hi_prod = 1; - if (num[1] == 0) { - hi_prod = 0; - if (num[0] == 0) { - // Left arg is zero, return right. - // - DECIMAL_LO64_SET(decRes, DECIMAL_LO64_GET(*right)); - decRes.Hi32 = right->Hi32; - decRes.u.u.sign ^= sign; - goto RetDec; - } - } - } - - // Scaling loop, up to 10^9 at a time. hi_prod stays updated - // with index of highest non-zero uint32_t. - // - for (; scale > 0; scale -= POWER10_MAX) { - if (scale > POWER10_MAX) - pwr = ten_to_nine; - else - pwr = power10[scale]; - - tmp.u.Hi = 0; - for (cur = 0; cur <= hi_prod; cur++) { - tmp.int64 = UInt32x32To64(num[cur], pwr) + tmp.u.Hi; - num[cur] = tmp.u.Lo; - } - - if (tmp.u.Hi != 0) - // We're extending the result by another uint32_t. - num[++hi_prod] = tmp.u.Hi; - } - } - - // Scaling complete, do the add. Could be subtract if signs differ. - // - tmp.u.Lo = num[0]; - tmp.u.Hi = num[1]; - - if (sign) { - // Signs differ, subtract. - // - DECIMAL_LO64_SET(decRes, tmp.int64 - DECIMAL_LO64_GET(*right)); - decRes.Hi32 = num[2] - right->Hi32; - - // Propagate carry - // - if (DECIMAL_LO64_GET(decRes) > tmp.int64) { - decRes.Hi32--; - if (decRes.Hi32 >= num[2]) - goto LongSub; - } - else if (decRes.Hi32 > num[2]) { - LongSub: - // If num has more than 96 bits of precision, then we need to - // carry the subtraction into the higher bits. If it doesn't, - // then we subtracted in the wrong order and have to flip the - // sign of the result. - // - if (hi_prod <= 2) - goto SignFlip; - - cur = 3; - while(num[cur++]-- == 0); - if (num[hi_prod] == 0) - hi_prod--; - } - } - else { - // Signs the same, add. - // - DECIMAL_LO64_SET(decRes, tmp.int64 + DECIMAL_LO64_GET(*right)); - decRes.Hi32 = num[2] + right->Hi32; - - // Propagate carry - // - if (DECIMAL_LO64_GET(decRes) < tmp.int64) { - decRes.Hi32++; - if (decRes.Hi32 <= num[2]) - goto LongAdd; - } - else if (decRes.Hi32 < num[2]) { - LongAdd: - // Had a carry above 96 bits. - // - cur = 3; - do { - if (hi_prod < cur) { - num[cur] = 1; - hi_prod = cur; - break; - } - }while (++num[cur++] == 0); - } - } - - if (hi_prod > 2) { - num[0] = decRes.v.v.Lo32; - num[1] = decRes.v.v.Mid32; - num[2] = decRes.Hi32; - decRes.u.u.scale = ScaleResult(num, hi_prod, decRes.u.u.scale); - if (decRes.u.u.scale == (uint8_t) -1) - return MONO_DECIMAL_OVERFLOW; - - decRes.v.v.Lo32 = num[0]; - decRes.v.v.Mid32 = num[1]; - decRes.Hi32 = num[2]; - } - } - -RetDec: - COPYDEC(*result, decRes); - // Odd, the Microsoft code does not set result->reserved to zero on this case - return MONO_DECIMAL_OK; -} - -// Decimal addition -static MonoDecimalStatus G_GNUC_UNUSED -mono_decimal_add(MonoDecimal *left, MonoDecimal *right, MonoDecimal *result) -{ - return DecAddSub (left, right, result, 0); -} - -// Decimal subtraction -static MonoDecimalStatus G_GNUC_UNUSED -mono_decimal_sub(MonoDecimal *left, MonoDecimal *right, MonoDecimal *result) -{ - return DecAddSub (left, right, result, DECIMAL_NEG); -} - -/** - * IncreaseScale: - * - * Entry: - * num - Pointer to 96-bit number as array of uint32_ts, least-sig first - * pwr - Scale factor to multiply by - * - * Purpose: - * Multiply the two numbers. The low 96 bits of the result overwrite - * the input. The last 32 bits of the product are the return value. - * - * Exit: - * Returns highest 32 bits of product. - * - * Exceptions: - * None. - * - */ -static uint32_t -IncreaseScale(uint32_t *num, uint32_t pwr) -{ - SPLIT64 sdlTmp; - - sdlTmp.int64 = UInt32x32To64(num[0], pwr); - num[0] = sdlTmp.u.Lo; - sdlTmp.int64 = UInt32x32To64(num[1], pwr) + sdlTmp.u.Hi; - num[1] = sdlTmp.u.Lo; - sdlTmp.int64 = UInt32x32To64(num[2], pwr) + sdlTmp.u.Hi; - num[2] = sdlTmp.u.Lo; - return sdlTmp.u.Hi; -} - -/** - * Div96By64: - * - * Entry: - * rgulNum - Pointer to 96-bit dividend as array of uint32_ts, least-sig first - * sdlDen - 64-bit divisor. - * - * Purpose: - * Do partial divide, yielding 32-bit result and 64-bit remainder. - * Divisor must be larger than upper 64 bits of dividend. - * - * Exit: - * Remainder overwrites lower 64-bits of dividend. - * Returns quotient. - * - * Exceptions: - * None. - * - */ -static uint32_t -Div96By64(uint32_t *num, SPLIT64 den) -{ - SPLIT64 quo; - SPLIT64 sdlNum; - SPLIT64 prod; - - sdlNum.u.Lo = num[0]; - - if (num[2] >= den.u.Hi) { - // Divide would overflow. Assume a quotient of 2^32, and set - // up remainder accordingly. Then jump to loop which reduces - // the quotient. - // - sdlNum.u.Hi = num[1] - den.u.Lo; - quo.u.Lo = 0; - goto NegRem; - } - - // Hardware divide won't overflow - // - if (num[2] == 0 && num[1] < den.u.Hi) - // Result is zero. Entire dividend is remainder. - // - return 0; - - // DivMod64by32 returns quotient in Lo, remainder in Hi. - // - quo.u.Lo = num[1]; - quo.u.Hi = num[2]; - quo.int64 = DivMod64by32(quo.int64, den.u.Hi); - sdlNum.u.Hi = quo.u.Hi; // remainder - - // Compute full remainder, rem = dividend - (quo * divisor). - // - prod.int64 = UInt32x32To64(quo.u.Lo, den.u.Lo); // quo * lo divisor - sdlNum.int64 -= prod.int64; - - if (sdlNum.int64 > ~prod.int64) { - NegRem: - // Remainder went negative. Add divisor back in until it's positive, - // a max of 2 times. - // - do { - quo.u.Lo--; - sdlNum.int64 += den.int64; - }while (sdlNum.int64 >= den.int64); - } - - num[0] = sdlNum.u.Lo; - num[1] = sdlNum.u.Hi; - return quo.u.Lo; -} - -/*** -* Div128By96 -* -* Entry: -* rgulNum - Pointer to 128-bit dividend as array of uint32_ts, least-sig first -* den - Pointer to 96-bit divisor. -* -* Purpose: -* Do partial divide, yielding 32-bit result and 96-bit remainder. -* Top divisor uint32_t must be larger than top dividend uint32_t. This is -* assured in the initial call because the divisor is normalized -* and the dividend can't be. In subsequent calls, the remainder -* is multiplied by 10^9 (max), so it can be no more than 1/4 of -* the divisor which is effectively multiplied by 2^32 (4 * 10^9). -* -* Exit: -* Remainder overwrites lower 96-bits of dividend. -* Returns quotient. -* -* Exceptions: -* None. -* -***********************************************************************/ - -static uint32_t -Div128By96(uint32_t *num, uint32_t *den) -{ - SPLIT64 sdlQuo; - SPLIT64 sdlNum; - SPLIT64 sdlProd1; - SPLIT64 sdlProd2; - - sdlNum.u.Lo = num[0]; - sdlNum.u.Hi = num[1]; - - if (num[3] == 0 && num[2] < den[2]){ - // Result is zero. Entire dividend is remainder. - // - return 0; - } - - // DivMod64by32 returns quotient in Lo, remainder in Hi. - // - sdlQuo.u.Lo = num[2]; - sdlQuo.u.Hi = num[3]; - sdlQuo.int64 = DivMod64by32(sdlQuo.int64, den[2]); - - // Compute full remainder, rem = dividend - (quo * divisor). - // - sdlProd1.int64 = UInt32x32To64(sdlQuo.u.Lo, den[0]); // quo * lo divisor - sdlProd2.int64 = UInt32x32To64(sdlQuo.u.Lo, den[1]); // quo * mid divisor - sdlProd2.int64 += sdlProd1.u.Hi; - sdlProd1.u.Hi = sdlProd2.u.Lo; - - sdlNum.int64 -= sdlProd1.int64; - num[2] = sdlQuo.u.Hi - sdlProd2.u.Hi; // sdlQuo.Hi is remainder - - // Propagate carries - // - if (sdlNum.int64 > ~sdlProd1.int64) { - num[2]--; - if (num[2] >= ~sdlProd2.u.Hi) - goto NegRem; - } else if (num[2] > ~sdlProd2.u.Hi) { - NegRem: - // Remainder went negative. Add divisor back in until it's positive, - // a max of 2 times. - // - sdlProd1.u.Lo = den[0]; - sdlProd1.u.Hi = den[1]; - - for (;;) { - sdlQuo.u.Lo--; - sdlNum.int64 += sdlProd1.int64; - num[2] += den[2]; - - if (sdlNum.int64 < sdlProd1.int64) { - // Detected carry. Check for carry out of top - // before adding it in. - // - if (num[2]++ < den[2]) - break; - } - if (num[2] < den[2]) - break; // detected carry - } - } - - num[0] = sdlNum.u.Lo; - num[1] = sdlNum.u.Hi; - return sdlQuo.u.Lo; -} - -// Add a 32 bit unsigned long to an array of 3 unsigned longs representing a 96 integer -// Returns FALSE if there is an overflow -static gboolean -Add32To96(uint32_t *num, uint32_t value) -{ - num[0] += value; - if (num[0] < value) { - if (++num[1] == 0) { - if (++num[2] == 0) { - return FALSE; - } - } - } - return TRUE; -} - -static void -OverflowUnscale (uint32_t *quo, gboolean remainder) -{ - SPLIT64 sdlTmp; - - // We have overflown, so load the high bit with a one. - sdlTmp.u.Hi = 1u; - sdlTmp.u.Lo = quo[2]; - sdlTmp.int64 = DivMod64by32(sdlTmp.int64, 10u); - quo[2] = sdlTmp.u.Lo; - sdlTmp.u.Lo = quo[1]; - sdlTmp.int64 = DivMod64by32(sdlTmp.int64, 10u); - quo[1] = sdlTmp.u.Lo; - sdlTmp.u.Lo = quo[0]; - sdlTmp.int64 = DivMod64by32(sdlTmp.int64, 10u); - quo[0] = sdlTmp.u.Lo; - // The remainder is the last digit that does not fit, so we can use it to work out if we need to round up - if ((sdlTmp.u.Hi > 5) || ((sdlTmp.u.Hi == 5) && ( remainder || (quo[0] & 1)))) { - Add32To96(quo, 1u); - } -} - -// mono_decimal_divide - Decimal divide -static MonoDecimalStatus G_GNUC_UNUSED -mono_decimal_divide_result(MonoDecimal *left, MonoDecimal *right, MonoDecimal *result) -{ - uint32_t quo[3]; - uint32_t quoSave[3]; - uint32_t rem[4]; - uint32_t divisor[3]; - uint32_t pwr; - uint32_t utmp; - uint32_t utmp1; - SPLIT64 sdlTmp; - SPLIT64 sdlDivisor; - int scale; - int cur_scale; - - scale = left->u.u.scale - right->u.u.scale; - divisor[0] = right->v.v.Lo32; - divisor[1] = right->v.v.Mid32; - divisor[2] = right->Hi32; - - if (divisor[1] == 0 && divisor[2] == 0) { - // Divisor is only 32 bits. Easy divide. - // - if (divisor[0] == 0) - return MONO_DECIMAL_DIVBYZERO; - - quo[0] = left->v.v.Lo32; - quo[1] = left->v.v.Mid32; - quo[2] = left->Hi32; - rem[0] = Div96By32(quo, divisor[0]); - - for (;;) { - if (rem[0] == 0) { - if (scale < 0) { - cur_scale = min(9, -scale); - goto HaveScale; - } - break; - } - - // We have computed a quotient based on the natural scale - // ( - ). We have a non-zero - // remainder, so now we should increase the scale if possible to - // include more quotient bits. - // - // If it doesn't cause overflow, we'll loop scaling by 10^9 and - // computing more quotient bits as long as the remainder stays - // non-zero. If scaling by that much would cause overflow, we'll - // drop out of the loop and scale by as much as we can. - // - // Scaling by 10^9 will overflow if quo[2].quo[1] >= 2^32 / 10^9 - // = 4.294 967 296. So the upper limit is quo[2] == 4 and - // quo[1] == 0.294 967 296 * 2^32 = 1,266,874,889.7+. Since - // quotient bits in quo[0] could be all 1's, then 1,266,874,888 - // is the largest value in quo[1] (when quo[2] == 4) that is - // assured not to overflow. - // - cur_scale = SearchScale(quo[2], quo[1], quo [0], scale); - if (cur_scale == 0) { - // No more scaling to be done, but remainder is non-zero. - // Round quotient. - // - utmp = rem[0] << 1; - if (utmp < rem[0] || (utmp >= divisor[0] && - (utmp > divisor[0] || (quo[0] & 1)))) { - RoundUp: - if (++quo[0] == 0) - if (++quo[1] == 0) - quo[2]++; - } - break; - } - - if (cur_scale == -1) - return MONO_DECIMAL_OVERFLOW; - - HaveScale: - pwr = power10[cur_scale]; - scale += cur_scale; - - if (IncreaseScale(quo, pwr) != 0) - return MONO_DECIMAL_OVERFLOW; - - sdlTmp.int64 = DivMod64by32(UInt32x32To64(rem[0], pwr), divisor[0]); - rem[0] = sdlTmp.u.Hi; - - quo[0] += sdlTmp.u.Lo; - if (quo[0] < sdlTmp.u.Lo) { - if (++quo[1] == 0) - quo[2]++; - } - } // for (;;) - } - else { - // Divisor has bits set in the upper 64 bits. - // - // Divisor must be fully normalized (shifted so bit 31 of the most - // significant uint32_t is 1). Locate the MSB so we know how much to - // normalize by. The dividend will be shifted by the same amount so - // the quotient is not changed. - // - if (divisor[2] == 0) - utmp = divisor[1]; - else - utmp = divisor[2]; - - cur_scale = 0; - if (!(utmp & 0xFFFF0000)) { - cur_scale += 16; - utmp <<= 16; - } - if (!(utmp & 0xFF000000)) { - cur_scale += 8; - utmp <<= 8; - } - if (!(utmp & 0xF0000000)) { - cur_scale += 4; - utmp <<= 4; - } - if (!(utmp & 0xC0000000)) { - cur_scale += 2; - utmp <<= 2; - } - if (!(utmp & 0x80000000)) { - cur_scale++; - utmp <<= 1; - } - - // Shift both dividend and divisor left by cur_scale. - // - sdlTmp.int64 = DECIMAL_LO64_GET(*left) << cur_scale; - rem[0] = sdlTmp.u.Lo; - rem[1] = sdlTmp.u.Hi; - sdlTmp.u.Lo = left->v.v.Mid32; - sdlTmp.u.Hi = left->Hi32; - sdlTmp.int64 <<= cur_scale; - rem[2] = sdlTmp.u.Hi; - rem[3] = (left->Hi32 >> (31 - cur_scale)) >> 1; - - sdlDivisor.u.Lo = divisor[0]; - sdlDivisor.u.Hi = divisor[1]; - sdlDivisor.int64 <<= cur_scale; - - if (divisor[2] == 0) { - // Have a 64-bit divisor in sdlDivisor. The remainder - // (currently 96 bits spread over 4 uint32_ts) will be < divisor. - // - sdlTmp.u.Lo = rem[2]; - sdlTmp.u.Hi = rem[3]; - - quo[2] = 0; - quo[1] = Div96By64(&rem[1], sdlDivisor); - quo[0] = Div96By64(rem, sdlDivisor); - - for (;;) { - if ((rem[0] | rem[1]) == 0) { - if (scale < 0) { - cur_scale = min(9, -scale); - goto HaveScale64; - } - break; - } - - // Remainder is non-zero. Scale up quotient and remainder by - // powers of 10 so we can compute more significant bits. - // - cur_scale = SearchScale(quo[2], quo[1], quo [0], scale); - if (cur_scale == 0) { - // No more scaling to be done, but remainder is non-zero. - // Round quotient. - // - sdlTmp.u.Lo = rem[0]; - sdlTmp.u.Hi = rem[1]; - if (sdlTmp.u.Hi >= 0x80000000 || (sdlTmp.int64 <<= 1) > sdlDivisor.int64 || - (sdlTmp.int64 == sdlDivisor.int64 && (quo[0] & 1))) - goto RoundUp; - break; - } - - if (cur_scale == -1) - return MONO_DECIMAL_OVERFLOW; - - HaveScale64: - pwr = power10[cur_scale]; - scale += cur_scale; - - if (IncreaseScale(quo, pwr) != 0) - return MONO_DECIMAL_OVERFLOW; - - rem[2] = 0; // rem is 64 bits, IncreaseScale uses 96 - IncreaseScale(rem, pwr); - utmp = Div96By64(rem, sdlDivisor); - quo[0] += utmp; - if (quo[0] < utmp) - if (++quo[1] == 0) - quo[2]++; - - } // for (;;) - } - else { - // Have a 96-bit divisor in divisor[]. - // - // Start by finishing the shift left by cur_scale. - // - sdlTmp.u.Lo = divisor[1]; - sdlTmp.u.Hi = divisor[2]; - sdlTmp.int64 <<= cur_scale; - divisor[0] = sdlDivisor.u.Lo; - divisor[1] = sdlDivisor.u.Hi; - divisor[2] = sdlTmp.u.Hi; - - // The remainder (currently 96 bits spread over 4 uint32_ts) - // will be < divisor. - // - quo[2] = 0; - quo[1] = 0; - quo[0] = Div128By96(rem, divisor); - - for (;;) { - if ((rem[0] | rem[1] | rem[2]) == 0) { - if (scale < 0) { - cur_scale = min(9, -scale); - goto HaveScale96; - } - break; - } - - // Remainder is non-zero. Scale up quotient and remainder by - // powers of 10 so we can compute more significant bits. - // - cur_scale = SearchScale(quo[2], quo[1], quo [0], scale); - if (cur_scale == 0) { - // No more scaling to be done, but remainder is non-zero. - // Round quotient. - // - if (rem[2] >= 0x80000000) - goto RoundUp; - - utmp = rem[0] > 0x80000000; - utmp1 = rem[1] > 0x80000000; - rem[0] <<= 1; - rem[1] = (rem[1] << 1) + utmp; - rem[2] = (rem[2] << 1) + utmp1; - - if ((rem[2] > divisor[2] || rem[2] == divisor[2]) && - ((rem[1] > divisor[1] || rem[1] == divisor[1]) && - ((rem[0] > divisor[0] || rem[0] == divisor[0]) && - (quo[0] & 1)))) - goto RoundUp; - break; - } - - if (cur_scale == -1) - return MONO_DECIMAL_OVERFLOW; - - HaveScale96: - pwr = power10[cur_scale]; - scale += cur_scale; - - if (IncreaseScale(quo, pwr) != 0) - return MONO_DECIMAL_OVERFLOW; - - rem[3] = IncreaseScale(rem, pwr); - utmp = Div128By96(rem, divisor); - quo[0] += utmp; - if (quo[0] < utmp) - if (++quo[1] == 0) - quo[2]++; - - } // for (;;) - } - } - - // No more remainder. Try extracting any extra powers of 10 we may have - // added. We do this by trying to divide out 10^8, 10^4, 10^2, and 10^1. - // If a division by one of these powers returns a zero remainder, then - // we keep the quotient. If the remainder is not zero, then we restore - // the previous value. - // - // Since 10 = 2 * 5, there must be a factor of 2 for every power of 10 - // we can extract. We use this as a quick test on whether to try a - // given power. - // - while ((quo[0] & 0xFF) == 0 && scale >= 8) { - quoSave[0] = quo[0]; - quoSave[1] = quo[1]; - quoSave[2] = quo[2]; - - if (Div96By32(quoSave, 100000000) == 0) { - quo[0] = quoSave[0]; - quo[1] = quoSave[1]; - quo[2] = quoSave[2]; - scale -= 8; - } - else - break; - } - - if ((quo[0] & 0xF) == 0 && scale >= 4) { - quoSave[0] = quo[0]; - quoSave[1] = quo[1]; - quoSave[2] = quo[2]; - - if (Div96By32(quoSave, 10000) == 0) { - quo[0] = quoSave[0]; - quo[1] = quoSave[1]; - quo[2] = quoSave[2]; - scale -= 4; - } - } - - if ((quo[0] & 3) == 0 && scale >= 2) { - quoSave[0] = quo[0]; - quoSave[1] = quo[1]; - quoSave[2] = quo[2]; - - if (Div96By32(quoSave, 100) == 0) { - quo[0] = quoSave[0]; - quo[1] = quoSave[1]; - quo[2] = quoSave[2]; - scale -= 2; - } - } - - if ((quo[0] & 1) == 0 && scale >= 1) { - quoSave[0] = quo[0]; - quoSave[1] = quo[1]; - quoSave[2] = quo[2]; - - if (Div96By32(quoSave, 10) == 0) { - quo[0] = quoSave[0]; - quo[1] = quoSave[1]; - quo[2] = quoSave[2]; - scale -= 1; - } - } - - result->Hi32 = quo[2]; - result->v.v.Mid32 = quo[1]; - result->v.v.Lo32 = quo[0]; - result->u.u.scale = scale; - result->u.u.sign = left->u.u.sign ^ right->u.u.sign; - return MONO_DECIMAL_OK; -} - -// mono_decimal_absolute - Decimal Absolute Value -static void G_GNUC_UNUSED -mono_decimal_absolute (MonoDecimal *pdecOprd, MonoDecimal *result) -{ - COPYDEC(*result, *pdecOprd); - result->u.u.sign &= ~DECIMAL_NEG; - // Microsoft does not set reserved here -} - -// mono_decimal_fix - Decimal Fix (chop to integer) -static void -mono_decimal_fix (MonoDecimal *pdecOprd, MonoDecimal *result) -{ - DecFixInt(result, pdecOprd); -} - -// mono_decimal_round_to_int - Decimal Int (round down to integer) -static void -mono_decimal_round_to_int (MonoDecimal *pdecOprd, MonoDecimal *result) -{ - if (DecFixInt(result, pdecOprd) != 0 && (result->u.u.sign & DECIMAL_NEG)) { - // We have chopped off a non-zero amount from a negative value. Since - // we round toward -infinity, we must increase the integer result by - // 1 to make it more negative. This will never overflow because - // in order to have a remainder, we must have had a non-zero scale factor. - // Our scale factor is back to zero now. - // - DECIMAL_LO64_SET(*result, DECIMAL_LO64_GET(*result) + 1); - if (DECIMAL_LO64_GET(*result) == 0) - result->Hi32++; - } -} - -// mono_decimal_negate - Decimal Negate -static void G_GNUC_UNUSED -mono_decimal_negate (MonoDecimal *pdecOprd, MonoDecimal *result) -{ - COPYDEC(*result, *pdecOprd); - // Microsoft does not set result->reserved to zero on this case. - result->u.u.sign ^= DECIMAL_NEG; -} - -// -// Returns: MONO_DECIMAL_INVALID_ARGUMENT, MONO_DECIMAL_OK -// -static MonoDecimalStatus -mono_decimal_round_result(MonoDecimal *input, int cDecimals, MonoDecimal *result) -{ - uint32_t num[3]; - uint32_t rem; - uint32_t sticky; - uint32_t pwr; - int scale; - - if (cDecimals < 0) - return MONO_DECIMAL_INVALID_ARGUMENT; - - scale = input->u.u.scale - cDecimals; - if (scale > 0) { - num[0] = input->v.v.Lo32; - num[1] = input->v.v.Mid32; - num[2] = input->Hi32; - result->u.u.sign = input->u.u.sign; - rem = sticky = 0; - - do { - sticky |= rem; - if (scale > POWER10_MAX) - pwr = ten_to_nine; - else - pwr = power10[scale]; - - rem = Div96By32(num, pwr); - scale -= 9; - }while (scale > 0); - - // Now round. rem has last remainder, sticky has sticky bits. - // To do IEEE rounding, we add LSB of result to sticky bits so - // either causes round up if remainder * 2 == last divisor. - // - sticky |= num[0] & 1; - rem = (rem << 1) + (sticky != 0); - if (pwr < rem && - ++num[0] == 0 && - ++num[1] == 0 - ) - ++num[2]; - - result->v.v.Lo32 = num[0]; - result->v.v.Mid32 = num[1]; - result->Hi32 = num[2]; - result->u.u.scale = cDecimals; - return MONO_DECIMAL_OK; - } - - COPYDEC(*result, *input); - // Odd, the Microsoft source does not set the result->reserved to zero here. - return MONO_DECIMAL_OK; -} - -// -// Returns MONO_DECIMAL_OK or MONO_DECIMAL_OVERFLOW -static MonoDecimalStatus -mono_decimal_from_float (float input_f, MonoDecimal* result) -{ - int exp; // number of bits to left of binary point - int power; - uint32_t mant; - double dbl; - SPLIT64 sdlLo; - SPLIT64 sdlHi; - int lmax, cur; // temps used during scale reduction - MonoSingle_float input = { .f = input_f }; - - // The most we can scale by is 10^28, which is just slightly more - // than 2^93. So a float with an exponent of -94 could just - // barely reach 0.5, but smaller exponents will always round to zero. - // - if ((exp = input.s.exp - MONO_SINGLE_BIAS) < -94 ) { - DECIMAL_SETZERO(*result); - return MONO_DECIMAL_OK; - } - - if (exp > 96) - return MONO_DECIMAL_OVERFLOW; - - // Round the input to a 7-digit integer. The R4 format has - // only 7 digits of precision, and we want to keep garbage digits - // out of the Decimal were making. - // - // Calculate max power of 10 input value could have by multiplying - // the exponent by log10(2). Using scaled integer multiplcation, - // log10(2) * 2 ^ 16 = .30103 * 65536 = 19728.3. - // - dbl = fabs(input.f); - power = 6 - ((exp * 19728) >> 16); - - if (power >= 0) { - // We have less than 7 digits, scale input up. - // - if (power > DECMAX) - power = DECMAX; - - dbl = dbl * double_power10[power]; - } else { - if (power != -1 || dbl >= 1E7) - dbl = dbl / fnDblPower10(-power); - else - power = 0; // didn't scale it - } - - g_assert (dbl < 1E7); - if (dbl < 1E6 && power < DECMAX) { - dbl *= 10; - power++; - g_assert(dbl >= 1E6); - } - - // Round to integer - // - mant = (int32_t)dbl; - dbl -= (double)mant; // difference between input & integer - if ( dbl > 0.5 || (dbl == 0.5 && (mant & 1))) - mant++; - - if (mant == 0) { - DECIMAL_SETZERO(*result); - return MONO_DECIMAL_OK; - } - - if (power < 0) { - // Add -power factors of 10, -power <= (29 - 7) = 22. - // - power = -power; - if (power < 10) { - sdlLo.int64 = UInt32x32To64(mant, (uint32_t)long_power10[power]); - - DECIMAL_LO32(*result) = sdlLo.u.Lo; - DECIMAL_MID32(*result) = sdlLo.u.Hi; - DECIMAL_HI32(*result) = 0; - } else { - // Have a big power of 10. - // - if (power > 18) { - sdlLo.int64 = UInt32x32To64(mant, (uint32_t)long_power10[power - 18]); - sdlLo.int64 = UInt64x64To128(sdlLo, ten_to_eighteen, &sdlHi.int64); - - if (sdlHi.u.Hi != 0) - return MONO_DECIMAL_OVERFLOW; - } - else { - sdlLo.int64 = UInt32x32To64(mant, (uint32_t)long_power10[power - 9]); - sdlHi.int64 = UInt32x32To64(ten_to_nine, sdlLo.u.Hi); - sdlLo.int64 = UInt32x32To64(ten_to_nine, sdlLo.u.Lo); - sdlHi.int64 += sdlLo.u.Hi; - sdlLo.u.Hi = sdlHi.u.Lo; - sdlHi.u.Lo = sdlHi.u.Hi; - } - DECIMAL_LO32(*result) = sdlLo.u.Lo; - DECIMAL_MID32(*result) = sdlLo.u.Hi; - DECIMAL_HI32(*result) = sdlHi.u.Lo; - } - DECIMAL_SCALE(*result) = 0; - } else { - // Factor out powers of 10 to reduce the scale, if possible. - // The maximum number we could factor out would be 6. This - // comes from the fact we have a 7-digit number, and the - // MSD must be non-zero -- but the lower 6 digits could be - // zero. Note also the scale factor is never negative, so - // we can't scale by any more than the power we used to - // get the integer. - // - // DivMod32by32 returns the quotient in Lo, the remainder in Hi. - // - lmax = min(power, 6); - - // lmax is the largest power of 10 to try, lmax <= 6. - // We'll try powers 4, 2, and 1 unless they're too big. - // - for (cur = 4; cur > 0; cur >>= 1) - { - if (cur > lmax) - continue; - - sdlLo.int64 = DivMod32by32(mant, (uint32_t)long_power10[cur]); - - if (sdlLo.u.Hi == 0) { - mant = sdlLo.u.Lo; - power -= cur; - lmax -= cur; - } - } - DECIMAL_LO32(*result) = mant; - DECIMAL_MID32(*result) = 0; - DECIMAL_HI32(*result) = 0; - DECIMAL_SCALE(*result) = power; - } - - DECIMAL_SIGN(*result) = (char)input.s.sign << 7; - return MONO_DECIMAL_OK; -} - -// Returns MONO_DECIMAL_OK or MONO_DECIMAL_OVERFLOW -static MonoDecimalStatus -mono_decimal_from_double (double input_d, MonoDecimal *result) -{ - int exp; // number of bits to left of binary point - int power; // power-of-10 scale factor - SPLIT64 sdlMant; - SPLIT64 sdlLo; - double dbl; - int lmax, cur; // temps used during scale reduction - uint32_t pwr_cur; - uint32_t quo; - MonoDouble_double input = { .d = input_d }; - - // The most we can scale by is 10^28, which is just slightly more - // than 2^93. So a float with an exponent of -94 could just - // barely reach 0.5, but smaller exponents will always round to zero. - // - if ((exp = input.s.exp - MONO_DOUBLE_BIAS) < -94) { - DECIMAL_SETZERO(*result); - return MONO_DECIMAL_OK; - } - - if (exp > 96) - return MONO_DECIMAL_OVERFLOW; - - // Round the input to a 15-digit integer. The R8 format has - // only 15 digits of precision, and we want to keep garbage digits - // out of the Decimal were making. - // - // Calculate max power of 10 input value could have by multiplying - // the exponent by log10(2). Using scaled integer multiplcation, - // log10(2) * 2 ^ 16 = .30103 * 65536 = 19728.3. - // - dbl = fabs(input.d); - power = 14 - ((exp * 19728) >> 16); - - if (power >= 0) { - // We have less than 15 digits, scale input up. - // - if (power > DECMAX) - power = DECMAX; - - dbl = dbl * double_power10[power]; - } else { - if (power != -1 || dbl >= 1E15) - dbl = dbl / fnDblPower10(-power); - else - power = 0; // didn't scale it - } - - g_assert (dbl < 1E15); - if (dbl < 1E14 && power < DECMAX) { - dbl *= 10; - power++; - g_assert(dbl >= 1E14); - } - - // Round to int64 - // - sdlMant.int64 = (int64_t)dbl; - dbl -= (double)(int64_t)sdlMant.int64; // dif between input & integer - if ( dbl > 0.5 || (dbl == 0.5 && (sdlMant.u.Lo & 1))) - sdlMant.int64++; - - if (sdlMant.int64 == 0) { - DECIMAL_SETZERO(*result); - return MONO_DECIMAL_OK; - } - - if (power < 0) { - // Add -power factors of 10, -power <= (29 - 15) = 14. - // - power = -power; - if (power < 10) { - sdlLo.int64 = UInt32x32To64(sdlMant.u.Lo, (uint32_t)long_power10[power]); - sdlMant.int64 = UInt32x32To64(sdlMant.u.Hi, (uint32_t)long_power10[power]); - sdlMant.int64 += sdlLo.u.Hi; - sdlLo.u.Hi = sdlMant.u.Lo; - sdlMant.u.Lo = sdlMant.u.Hi; - } - else { - // Have a big power of 10. - // - g_assert(power <= 14); - sdlLo.int64 = UInt64x64To128(sdlMant, sdl_power10[power-10], &sdlMant.int64); - - if (sdlMant.u.Hi != 0) - return MONO_DECIMAL_OVERFLOW; - } - DECIMAL_LO32(*result) = sdlLo.u.Lo; - DECIMAL_MID32(*result) = sdlLo.u.Hi; - DECIMAL_HI32(*result) = sdlMant.u.Lo; - DECIMAL_SCALE(*result) = 0; - } - else { - // Factor out powers of 10 to reduce the scale, if possible. - // The maximum number we could factor out would be 14. This - // comes from the fact we have a 15-digit number, and the - // MSD must be non-zero -- but the lower 14 digits could be - // zero. Note also the scale factor is never negative, so - // we can't scale by any more than the power we used to - // get the integer. - // - // DivMod64by32 returns the quotient in Lo, the remainder in Hi. - // - lmax = min(power, 14); - - // lmax is the largest power of 10 to try, lmax <= 14. - // We'll try powers 8, 4, 2, and 1 unless they're too big. - // - for (cur = 8; cur > 0; cur >>= 1) - { - if (cur > lmax) - continue; - - pwr_cur = (uint32_t)long_power10[cur]; - - if (sdlMant.u.Hi >= pwr_cur) { - // Overflow if we try to divide in one step. - // - sdlLo.int64 = DivMod64by32(sdlMant.u.Hi, pwr_cur); - quo = sdlLo.u.Lo; - sdlLo.u.Lo = sdlMant.u.Lo; - sdlLo.int64 = DivMod64by32(sdlLo.int64, pwr_cur); - } - else { - quo = 0; - sdlLo.int64 = DivMod64by32(sdlMant.int64, pwr_cur); - } - - if (sdlLo.u.Hi == 0) { - sdlMant.u.Hi = quo; - sdlMant.u.Lo = sdlLo.u.Lo; - power -= cur; - lmax -= cur; - } - } - - DECIMAL_HI32(*result) = 0; - DECIMAL_SCALE(*result) = power; - DECIMAL_LO32(*result) = sdlMant.u.Lo; - DECIMAL_MID32(*result) = sdlMant.u.Hi; - } - - DECIMAL_SIGN(*result) = (char)input.s.sign << 7; - return MONO_DECIMAL_OK; -} - -// Returns: MONO_DECIMAL_OK, or MONO_DECIMAL_INVALID_ARGUMENT -static MonoDecimalStatus -mono_decimal_to_double_result(MonoDecimal *input, double *result) -{ - SPLIT64 tmp; - double dbl; - - if (DECIMAL_SCALE(*input) > DECMAX || (DECIMAL_SIGN(*input) & ~DECIMAL_NEG) != 0) - return MONO_DECIMAL_INVALID_ARGUMENT; - - tmp.u.Lo = DECIMAL_LO32(*input); - tmp.u.Hi = DECIMAL_MID32(*input); - - if ((int32_t)DECIMAL_MID32(*input) < 0) - dbl = (ds2to64.d + (double)(int64_t)tmp.int64 + - (double)DECIMAL_HI32(*input) * ds2to64.d) / fnDblPower10(DECIMAL_SCALE(*input)) ; - else - dbl = ((double)(int64_t)tmp.int64 + - (double)DECIMAL_HI32(*input) * ds2to64.d) / fnDblPower10(DECIMAL_SCALE(*input)); - - if (DECIMAL_SIGN(*input)) - dbl = -dbl; - - *result = dbl; - return MONO_DECIMAL_OK; -} - -// Returns: MONO_DECIMAL_OK, or MONO_DECIMAL_INVALID_ARGUMENT -static MonoDecimalStatus -mono_decimal_to_float_result(MonoDecimal *input, float *result) -{ - double dbl; - - if (DECIMAL_SCALE(*input) > DECMAX || (DECIMAL_SIGN(*input) & ~DECIMAL_NEG) != 0) - return MONO_DECIMAL_INVALID_ARGUMENT; - - // Can't overflow; no errors possible. - // - mono_decimal_to_double_result(input, &dbl); - *result = (float)dbl; - return MONO_DECIMAL_OK; -} - -static void -DecShiftLeft(MonoDecimal* value) -{ - unsigned int c0 = DECIMAL_LO32(*value) & 0x80000000? 1: 0; - unsigned int c1 = DECIMAL_MID32(*value) & 0x80000000? 1: 0; - g_assert(value != NULL); - - DECIMAL_LO32(*value) <<= 1; - DECIMAL_MID32(*value) = DECIMAL_MID32(*value) << 1 | c0; - DECIMAL_HI32(*value) = DECIMAL_HI32(*value) << 1 | c1; -} - -static int -D32AddCarry(uint32_t* value, uint32_t i) -{ - uint32_t v = *value; - uint32_t sum = v + i; - *value = sum; - return sum < v || sum < i? 1: 0; -} - -static void -DecAdd(MonoDecimal *value, MonoDecimal* d) -{ - g_assert(value != NULL && d != NULL); - - if (D32AddCarry(&DECIMAL_LO32(*value), DECIMAL_LO32(*d))) { - if (D32AddCarry(&DECIMAL_MID32(*value), 1)) { - D32AddCarry(&DECIMAL_HI32(*value), 1); - } - } - if (D32AddCarry(&DECIMAL_MID32(*value), DECIMAL_MID32(*d))) { - D32AddCarry(&DECIMAL_HI32(*value), 1); - } - D32AddCarry(&DECIMAL_HI32(*value), DECIMAL_HI32(*d)); -} - -static void -DecMul10(MonoDecimal* value) -{ - MonoDecimal d = *value; - g_assert (value != NULL); - - DecShiftLeft(value); - DecShiftLeft(value); - DecAdd(value, &d); - DecShiftLeft(value); -} - -static void -DecAddInt32(MonoDecimal* value, unsigned int i) -{ - g_assert(value != NULL); - - if (D32AddCarry(&DECIMAL_LO32(*value), i)) { - if (D32AddCarry(&DECIMAL_MID32(*value), 1)) { - D32AddCarry(&DECIMAL_HI32(*value), 1); - } - } -} - -MonoDecimalCompareResult -mono_decimal_compare (MonoDecimal *left, MonoDecimal *right) -{ - uint32_t left_sign; - uint32_t right_sign; - MonoDecimal result; - - result.Hi32 = 0; // Just to shut up the compiler - - // First check signs and whether either are zero. If both are - // non-zero and of the same sign, just use subtraction to compare. - // - left_sign = left->v.v.Lo32 | left->v.v.Mid32 | left->Hi32; - right_sign = right->v.v.Lo32 | right->v.v.Mid32 | right->Hi32; - if (left_sign != 0) - left_sign = (left->u.u.sign & DECIMAL_NEG) | 1; - - if (right_sign != 0) - right_sign = (right->u.u.sign & DECIMAL_NEG) | 1; - - // left_sign & right_sign have values 1, 0, or 0x81 depending on if the left/right - // operand is +, 0, or -. - // - if (left_sign == right_sign) { - if (left_sign == 0) // both are zero - return MONO_DECIMAL_CMP_EQ; // return equal - - DecAddSub(left, right, &result, DECIMAL_NEG); - if (DECIMAL_LO64_GET(result) == 0 && result.Hi32 == 0) - return MONO_DECIMAL_CMP_EQ; - if (result.u.u.sign & DECIMAL_NEG) - return MONO_DECIMAL_CMP_LT; - return MONO_DECIMAL_CMP_GT; - } - - // - // Signs are different. Use signed byte comparison - // - if ((signed char)left_sign > (signed char)right_sign) - return MONO_DECIMAL_CMP_GT; - return MONO_DECIMAL_CMP_LT; -} - -void -mono_decimal_init_single (MonoDecimal *_this, float value) -{ - if (mono_decimal_from_float (value, _this) == MONO_DECIMAL_OVERFLOW) { - ERROR_DECL (error); - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - _this->reserved = 0; -} - -void -mono_decimal_init_double (MonoDecimal *_this, double value) -{ - if (mono_decimal_from_double (value, _this) == MONO_DECIMAL_OVERFLOW) { - ERROR_DECL (error); - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - _this->reserved = 0; -} - -void -mono_decimal_floor (MonoDecimal *d) -{ - MonoDecimal decRes; - - mono_decimal_round_to_int(d, &decRes); - - // copy decRes into d - COPYDEC(*d, decRes); - d->reserved = 0; - FC_GC_POLL (); -} - -int32_t -mono_decimal_get_hash_code (MonoDecimal *d) -{ - double dbl; - - if (mono_decimal_to_double_result(d, &dbl) != MONO_DECIMAL_OK) - return 0; - - if (dbl == 0.0) { - // Ensure 0 and -0 have the same hash code - return 0; - } - // conversion to double is lossy and produces rounding errors so we mask off the lowest 4 bits - // - // For example these two numerically equal decimals with different internal representations produce - // slightly different results when converted to double: - // - // decimal a = new decimal(new int[] { 0x76969696, 0x2fdd49fa, 0x409783ff, 0x00160000 }); - // => (decimal)1999021.176470588235294117647000000000 => (double)1999021.176470588 - // decimal b = new decimal(new int[] { 0x3f0f0f0f, 0x1e62edcc, 0x06758d33, 0x00150000 }); - // => (decimal)1999021.176470588235294117647000000000 => (double)1999021.1764705882 - // - return ((((int *)&dbl)[0]) & 0xFFFFFFF0) ^ ((int *)&dbl)[1]; - -} - -void -mono_decimal_multiply (MonoDecimal *d1, MonoDecimal *d2) -{ - MonoDecimal decRes; - - MonoDecimalStatus status = mono_decimal_multiply_result(d1, d2, &decRes); - if (status != MONO_DECIMAL_OK) { - ERROR_DECL (error); - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - - COPYDEC(*d1, decRes); - d1->reserved = 0; - - FC_GC_POLL (); -} - -void -mono_decimal_round (MonoDecimal *d, int32_t decimals) -{ - MonoDecimal decRes; - - // GC is only triggered for throwing, no need to protect result - if (decimals < 0 || decimals > 28) { - ERROR_DECL (error); - mono_error_set_argument_out_of_range (error, "d"); - mono_error_set_pending_exception (error); - return; - } - - mono_decimal_round_result(d, decimals, &decRes); - - // copy decRes into d - COPYDEC(*d, decRes); - d->reserved = 0; - - FC_GC_POLL(); -} - -void -mono_decimal_tocurrency (MonoDecimal *decimal) -{ - // TODO -} - -double -mono_decimal_to_double (MonoDecimal d) -{ - double result = 0.0; - // Note: this can fail if the input is an invalid decimal, but for compatibility we should return 0 - mono_decimal_to_double_result(&d, &result); - return result; -} - -int32_t -mono_decimal_to_int32 (MonoDecimal d) -{ - MonoDecimal result; - - // The following can not return an error, it only returns INVALID_ARG if the decimals is < 0 - mono_decimal_round_result(&d, 0, &result); - - if (DECIMAL_SCALE(result) != 0) { - d = result; - mono_decimal_fix (&d, &result); - } - - if (DECIMAL_HI32(result) == 0 && DECIMAL_MID32(result) == 0) { - int32_t i = DECIMAL_LO32(result); - if ((int16_t)DECIMAL_SIGNSCALE(result) >= 0) { - if (i >= 0) - return i; - } else { - i = -i; - if (i <= 0) - return i; - } - } - - ERROR_DECL (error); - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return 0; -} - -float -mono_decimal_to_float (MonoDecimal d) -{ - float result = 0.0f; - // Note: this can fail if the input is an invalid decimal, but for compatibility we should return 0 - mono_decimal_to_float_result(&d, &result); - return result; -} - -void -mono_decimal_truncate (MonoDecimal *d) -{ - MonoDecimal decRes; - - mono_decimal_fix(d, &decRes); - - // copy decRes into d - COPYDEC(*d, decRes); - d->reserved = 0; - FC_GC_POLL(); -} - -void -mono_decimal_addsub (MonoDecimal *left, MonoDecimal *right, uint8_t sign) -{ - ERROR_DECL (error); - MonoDecimal result, decTmp; - MonoDecimal *pdecTmp, *leftOriginal; - uint32_t num[6], pwr; - int scale, hi_prod, cur; - SPLIT64 sdlTmp; - - g_assert(sign == 0 || sign == DECIMAL_NEG); - - leftOriginal = left; - - sign ^= (DECIMAL_SIGN(*right) ^ DECIMAL_SIGN(*left)) & DECIMAL_NEG; - - if (DECIMAL_SCALE(*right) == DECIMAL_SCALE(*left)) { - // Scale factors are equal, no alignment necessary. - // - DECIMAL_SIGNSCALE(result) = DECIMAL_SIGNSCALE(*left); - - AlignedAdd: - if (sign) { - // Signs differ - subtract - // - DECIMAL_LO64_SET(result, (DECIMAL_LO64_GET(*left) - DECIMAL_LO64_GET(*right))); - DECIMAL_HI32(result) = DECIMAL_HI32(*left) - DECIMAL_HI32(*right); - - // Propagate carry - // - if (DECIMAL_LO64_GET(result) > DECIMAL_LO64_GET(*left)) { - DECIMAL_HI32(result)--; - if (DECIMAL_HI32(result) >= DECIMAL_HI32(*left)) - goto SignFlip; - } else if (DECIMAL_HI32(result) > DECIMAL_HI32(*left)) { - // Got negative result. Flip its sign. - // - SignFlip: - DECIMAL_LO64_SET(result, -(int64_t)DECIMAL_LO64_GET(result)); - DECIMAL_HI32(result) = ~DECIMAL_HI32(result); - if (DECIMAL_LO64_GET(result) == 0) - DECIMAL_HI32(result)++; - DECIMAL_SIGN(result) ^= DECIMAL_NEG; - } - - } else { - // Signs are the same - add - // - DECIMAL_LO64_SET(result, (DECIMAL_LO64_GET(*left) + DECIMAL_LO64_GET(*right))); - DECIMAL_HI32(result) = DECIMAL_HI32(*left) + DECIMAL_HI32(*right); - - // Propagate carry - // - if (DECIMAL_LO64_GET(result) < DECIMAL_LO64_GET(*left)) { - DECIMAL_HI32(result)++; - if (DECIMAL_HI32(result) <= DECIMAL_HI32(*left)) - goto AlignedScale; - } else if (DECIMAL_HI32(result) < DECIMAL_HI32(*left)) { - AlignedScale: - // The addition carried above 96 bits. Divide the result by 10, - // dropping the scale factor. - // - if (DECIMAL_SCALE(result) == 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - DECIMAL_SCALE(result)--; - - sdlTmp.u.Lo = DECIMAL_HI32(result); - sdlTmp.u.Hi = 1; - sdlTmp.int64 = DivMod64by32(sdlTmp.int64, 10); - DECIMAL_HI32(result) = sdlTmp.u.Lo; - - sdlTmp.u.Lo = DECIMAL_MID32(result); - sdlTmp.int64 = DivMod64by32(sdlTmp.int64, 10); - DECIMAL_MID32(result) = sdlTmp.u.Lo; - - sdlTmp.u.Lo = DECIMAL_LO32(result); - sdlTmp.int64 = DivMod64by32(sdlTmp.int64, 10); - DECIMAL_LO32(result) = sdlTmp.u.Lo; - - // See if we need to round up. - // - if (sdlTmp.u.Hi >= 5 && (sdlTmp.u.Hi > 5 || (DECIMAL_LO32(result) & 1))) { - DECIMAL_LO64_SET(result, DECIMAL_LO64_GET(result)+1); - if (DECIMAL_LO64_GET(result) == 0) - DECIMAL_HI32(result)++; - } - } - } - } else { - // Scale factors are not equal. Assume that a larger scale - // factor (more decimal places) is likely to mean that number - // is smaller. Start by guessing that the right operand has - // the larger scale factor. The result will have the larger - // scale factor. - // - DECIMAL_SCALE(result) = DECIMAL_SCALE(*right); // scale factor of "smaller" - DECIMAL_SIGN(result) = DECIMAL_SIGN(*left); // but sign of "larger" - scale = DECIMAL_SCALE(result)- DECIMAL_SCALE(*left); - - if (scale < 0) { - // Guessed scale factor wrong. Swap operands. - // - scale = -scale; - DECIMAL_SCALE(result) = DECIMAL_SCALE(*left); - DECIMAL_SIGN(result) ^= sign; - pdecTmp = right; - right = left; - left = pdecTmp; - } - - // *left will need to be multiplied by 10^scale so - // it will have the same scale as *right. We could be - // extending it to up to 192 bits of precision. - // - if (scale <= POWER10_MAX) { - // Scaling won't make it larger than 4 uint32_ts - // - pwr = power10[scale]; - DECIMAL_LO64_SET(decTmp, UInt32x32To64(DECIMAL_LO32(*left), pwr)); - sdlTmp.int64 = UInt32x32To64(DECIMAL_MID32(*left), pwr); - sdlTmp.int64 += DECIMAL_MID32(decTmp); - DECIMAL_MID32(decTmp) = sdlTmp.u.Lo; - DECIMAL_HI32(decTmp) = sdlTmp.u.Hi; - sdlTmp.int64 = UInt32x32To64(DECIMAL_HI32(*left), pwr); - sdlTmp.int64 += DECIMAL_HI32(decTmp); - if (sdlTmp.u.Hi == 0) { - // Result fits in 96 bits. Use standard aligned add. - // - DECIMAL_HI32(decTmp) = sdlTmp.u.Lo; - left = &decTmp; - goto AlignedAdd; - } - num[0] = DECIMAL_LO32(decTmp); - num[1] = DECIMAL_MID32(decTmp); - num[2] = sdlTmp.u.Lo; - num[3] = sdlTmp.u.Hi; - hi_prod = 3; - } else { - // Have to scale by a bunch. Move the number to a buffer - // where it has room to grow as it's scaled. - // - num[0] = DECIMAL_LO32(*left); - num[1] = DECIMAL_MID32(*left); - num[2] = DECIMAL_HI32(*left); - hi_prod = 2; - - // Scan for zeros in the upper words. - // - if (num[2] == 0) { - hi_prod = 1; - if (num[1] == 0) { - hi_prod = 0; - if (num[0] == 0) { - // Left arg is zero, return right. - // - DECIMAL_LO64_SET(result, DECIMAL_LO64_GET(*right)); - DECIMAL_HI32(result) = DECIMAL_HI32(*right); - DECIMAL_SIGN(result) ^= sign; - goto RetDec; - } - } - } - - // Scaling loop, up to 10^9 at a time. hi_prod stays updated - // with index of highest non-zero uint32_t. - // - for (; scale > 0; scale -= POWER10_MAX) { - if (scale > POWER10_MAX) - pwr = ten_to_nine; - else - pwr = power10[scale]; - - sdlTmp.u.Hi = 0; - for (cur = 0; cur <= hi_prod; cur++) { - sdlTmp.int64 = UInt32x32To64(num[cur], pwr) + sdlTmp.u.Hi; - num[cur] = sdlTmp.u.Lo; - } - - if (sdlTmp.u.Hi != 0) - // We're extending the result by another uint32_t. - num[++hi_prod] = sdlTmp.u.Hi; - } - } - - // Scaling complete, do the add. Could be subtract if signs differ. - // - sdlTmp.u.Lo = num[0]; - sdlTmp.u.Hi = num[1]; - - if (sign) { - // Signs differ, subtract. - // - DECIMAL_LO64_SET(result, (sdlTmp.int64 - DECIMAL_LO64_GET(*right))); - DECIMAL_HI32(result) = num[2] - DECIMAL_HI32(*right); - - // Propagate carry - // - if (DECIMAL_LO64_GET(result) > sdlTmp.int64) { - DECIMAL_HI32(result)--; - if (DECIMAL_HI32(result) >= num[2]) - goto LongSub; - } else if (DECIMAL_HI32(result) > num[2]) { - LongSub: - // If num has more than 96 bits of precision, then we need to - // carry the subtraction into the higher bits. If it doesn't, - // then we subtracted in the wrong order and have to flip the - // sign of the result. - // - if (hi_prod <= 2) - goto SignFlip; - - cur = 3; - while(num[cur++]-- == 0); - if (num[hi_prod] == 0) - hi_prod--; - } - } else { - // Signs the same, add. - // - DECIMAL_LO64_SET(result, (sdlTmp.int64 + DECIMAL_LO64_GET(*right))); - DECIMAL_HI32(result) = num[2] + DECIMAL_HI32(*right); - - // Propagate carry - // - if (DECIMAL_LO64_GET(result) < sdlTmp.int64) { - DECIMAL_HI32(result)++; - if (DECIMAL_HI32(result) <= num[2]) - goto LongAdd; - } else if (DECIMAL_HI32(result) < num[2]) { - LongAdd: - // Had a carry above 96 bits. - // - cur = 3; - do { - if (hi_prod < cur) { - num[cur] = 1; - hi_prod = cur; - break; - } - }while (++num[cur++] == 0); - } - } - - if (hi_prod > 2) { - num[0] = DECIMAL_LO32(result); - num[1] = DECIMAL_MID32(result); - num[2] = DECIMAL_HI32(result); - DECIMAL_SCALE(result) = (uint8_t)ScaleResult(num, hi_prod, DECIMAL_SCALE(result)); - if (DECIMAL_SCALE(result) == (uint8_t)-1) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - - DECIMAL_LO32(result) = num[0]; - DECIMAL_MID32(result) = num[1]; - DECIMAL_HI32(result) = num[2]; - } - } - -RetDec: - left = leftOriginal; - COPYDEC(*left, result); - left->reserved = 0; -} - -void -mono_decimal_divide (MonoDecimal *left, MonoDecimal *right) -{ - ERROR_DECL (error); - uint32_t quo[3], quo_save[3],rem[4], divisor[3]; - uint32_t pwr, tmp, tmp1; - SPLIT64 sdlTmp, sdlDivisor; - int scale, cur_scale; - gboolean unscale; - - scale = DECIMAL_SCALE(*left) - DECIMAL_SCALE(*right); - unscale = FALSE; - divisor[0] = DECIMAL_LO32(*right); - divisor[1] = DECIMAL_MID32(*right); - divisor[2] = DECIMAL_HI32(*right); - - if (divisor[1] == 0 && divisor[2] == 0) { - // Divisor is only 32 bits. Easy divide. - // - if (divisor[0] == 0) { - mono_error_set_divide_by_zero (error); - mono_error_set_pending_exception (error); - return; - } - - quo[0] = DECIMAL_LO32(*left); - quo[1] = DECIMAL_MID32(*left); - quo[2] = DECIMAL_HI32(*left); - rem[0] = Div96By32(quo, divisor[0]); - - for (;;) { - if (rem[0] == 0) { - if (scale < 0) { - cur_scale = min(9, -scale); - goto HaveScale; - } - break; - } - // We need to unscale if and only if we have a non-zero remainder - unscale = TRUE; - - // We have computed a quotient based on the natural scale - // ( - ). We have a non-zero - // remainder, so now we should increase the scale if possible to - // include more quotient bits. - // - // If it doesn't cause overflow, we'll loop scaling by 10^9 and - // computing more quotient bits as long as the remainder stays - // non-zero. If scaling by that much would cause overflow, we'll - // drop out of the loop and scale by as much as we can. - // - // Scaling by 10^9 will overflow if quo[2].quo[1] >= 2^32 / 10^9 - // = 4.294 967 296. So the upper limit is quo[2] == 4 and - // quo[1] == 0.294 967 296 * 2^32 = 1,266,874,889.7+. Since - // quotient bits in quo[0] could be all 1's, then 1,266,874,888 - // is the largest value in quo[1] (when quo[2] == 4) that is - // assured not to overflow. - // - cur_scale = SearchScale(quo[2], quo[1], quo[0], scale); - if (cur_scale == 0) { - // No more scaling to be done, but remainder is non-zero. - // Round quotient. - // - tmp = rem[0] << 1; - if (tmp < rem[0] || (tmp >= divisor[0] && - (tmp > divisor[0] || (quo[0] & 1)))) { - RoundUp: - if (!Add32To96(quo, 1)) { - if (scale == 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - scale--; - OverflowUnscale(quo, TRUE); - break; - } - } - break; - } - - if (cur_scale < 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - - HaveScale: - pwr = power10[cur_scale]; - scale += cur_scale; - - if (IncreaseScale(quo, pwr) != 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - - sdlTmp.int64 = DivMod64by32(UInt32x32To64(rem[0], pwr), divisor[0]); - rem[0] = sdlTmp.u.Hi; - - if (!Add32To96(quo, sdlTmp.u.Lo)) { - if (scale == 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - scale--; - OverflowUnscale(quo, (rem[0] != 0)); - break; - } - } // for (;;) - } else { - // Divisor has bits set in the upper 64 bits. - // - // Divisor must be fully normalized (shifted so bit 31 of the most - // significant uint32_t is 1). Locate the MSB so we know how much to - // normalize by. The dividend will be shifted by the same amount so - // the quotient is not changed. - // - if (divisor[2] == 0) - tmp = divisor[1]; - else - tmp = divisor[2]; - - cur_scale = 0; - if (!(tmp & 0xFFFF0000)) { - cur_scale += 16; - tmp <<= 16; - } - if (!(tmp & 0xFF000000)) { - cur_scale += 8; - tmp <<= 8; - } - if (!(tmp & 0xF0000000)) { - cur_scale += 4; - tmp <<= 4; - } - if (!(tmp & 0xC0000000)) { - cur_scale += 2; - tmp <<= 2; - } - if (!(tmp & 0x80000000)) { - cur_scale++; - tmp <<= 1; - } - - // Shift both dividend and divisor left by cur_scale. - // - sdlTmp.int64 = DECIMAL_LO64_GET(*left) << cur_scale; - rem[0] = sdlTmp.u.Lo; - rem[1] = sdlTmp.u.Hi; - sdlTmp.u.Lo = DECIMAL_MID32(*left); - sdlTmp.u.Hi = DECIMAL_HI32(*left); - sdlTmp.int64 <<= cur_scale; - rem[2] = sdlTmp.u.Hi; - rem[3] = (DECIMAL_HI32(*left) >> (31 - cur_scale)) >> 1; - - sdlDivisor.u.Lo = divisor[0]; - sdlDivisor.u.Hi = divisor[1]; - sdlDivisor.int64 <<= cur_scale; - - if (divisor[2] == 0) { - // Have a 64-bit divisor in sdlDivisor. The remainder - // (currently 96 bits spread over 4 uint32_ts) will be < divisor. - // - sdlTmp.u.Lo = rem[2]; - sdlTmp.u.Hi = rem[3]; - - quo[2] = 0; - quo[1] = Div96By64(&rem[1], sdlDivisor); - quo[0] = Div96By64(rem, sdlDivisor); - - for (;;) { - if ((rem[0] | rem[1]) == 0) { - if (scale < 0) { - cur_scale = min(9, -scale); - goto HaveScale64; - } - break; - } - - // We need to unscale if and only if we have a non-zero remainder - unscale = TRUE; - - // Remainder is non-zero. Scale up quotient and remainder by - // powers of 10 so we can compute more significant bits. - // - cur_scale = SearchScale(quo[2], quo[1], quo[0], scale); - if (cur_scale == 0) { - // No more scaling to be done, but remainder is non-zero. - // Round quotient. - // - sdlTmp.u.Lo = rem[0]; - sdlTmp.u.Hi = rem[1]; - if (sdlTmp.u.Hi >= 0x80000000 || (sdlTmp.int64 <<= 1) > sdlDivisor.int64 || - (sdlTmp.int64 == sdlDivisor.int64 && (quo[0] & 1))) - goto RoundUp; - break; - } - - if (cur_scale < 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - - HaveScale64: - pwr = power10[cur_scale]; - scale += cur_scale; - - if (IncreaseScale(quo, pwr) != 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - - rem[2] = 0; // rem is 64 bits, IncreaseScale uses 96 - IncreaseScale(rem, pwr); - tmp = Div96By64(rem, sdlDivisor); - if (!Add32To96(quo, tmp)) { - if (scale == 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - scale--; - OverflowUnscale(quo, (rem[0] != 0 || rem[1] != 0)); - break; - } - - } // for (;;) - } else { - // Have a 96-bit divisor in divisor[]. - // - // Start by finishing the shift left by cur_scale. - // - sdlTmp.u.Lo = divisor[1]; - sdlTmp.u.Hi = divisor[2]; - sdlTmp.int64 <<= cur_scale; - divisor[0] = sdlDivisor.u.Lo; - divisor[1] = sdlDivisor.u.Hi; - divisor[2] = sdlTmp.u.Hi; - - // The remainder (currently 96 bits spread over 4 uint32_ts) - // will be < divisor. - // - quo[2] = 0; - quo[1] = 0; - quo[0] = Div128By96(rem, divisor); - - for (;;) { - if ((rem[0] | rem[1] | rem[2]) == 0) { - if (scale < 0) { - cur_scale = min(9, -scale); - goto HaveScale96; - } - break; - } - - // We need to unscale if and only if we have a non-zero remainder - unscale = TRUE; - - // Remainder is non-zero. Scale up quotient and remainder by - // powers of 10 so we can compute more significant bits. - // - cur_scale = SearchScale(quo[2], quo[1], quo[0], scale); - if (cur_scale == 0) { - // No more scaling to be done, but remainder is non-zero. - // Round quotient. - // - if (rem[2] >= 0x80000000) - goto RoundUp; - - tmp = rem[0] > 0x80000000; - tmp1 = rem[1] > 0x80000000; - rem[0] <<= 1; - rem[1] = (rem[1] << 1) + tmp; - rem[2] = (rem[2] << 1) + tmp1; - - if (rem[2] > divisor[2] || (rem[2] == divisor[2] && (rem[1] > divisor[1] || rem[1] == (divisor[1] && (rem[0] > divisor[0] || (rem[0] == divisor[0] && (quo[0] & 1))))))) - goto RoundUp; - break; - } - - if (cur_scale < 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - - HaveScale96: - pwr = power10[cur_scale]; - scale += cur_scale; - - if (IncreaseScale(quo, pwr) != 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - - rem[3] = IncreaseScale(rem, pwr); - tmp = Div128By96(rem, divisor); - if (!Add32To96(quo, tmp)) { - if (scale == 0) { - mono_error_set_overflow (error); - mono_error_set_pending_exception (error); - return; - } - - scale--; - OverflowUnscale(quo, (rem[0] != 0 || rem[1] != 0 || rem[2] != 0 || rem[3] != 0)); - break; - } - - } // for (;;) - } - } - - // We need to unscale if and only if we have a non-zero remainder - if (unscale) { - // Try extracting any extra powers of 10 we may have - // added. We do this by trying to divide out 10^8, 10^4, 10^2, and 10^1. - // If a division by one of these powers returns a zero remainder, then - // we keep the quotient. If the remainder is not zero, then we restore - // the previous value. - // - // Since 10 = 2 * 5, there must be a factor of 2 for every power of 10 - // we can extract. We use this as a quick test on whether to try a - // given power. - // - while ((quo[0] & 0xFF) == 0 && scale >= 8) { - quo_save[0] = quo[0]; - quo_save[1] = quo[1]; - quo_save[2] = quo[2]; - - if (Div96By32(quo_save, 100000000) == 0) { - quo[0] = quo_save[0]; - quo[1] = quo_save[1]; - quo[2] = quo_save[2]; - scale -= 8; - } else - break; - } - - if ((quo[0] & 0xF) == 0 && scale >= 4) { - quo_save[0] = quo[0]; - quo_save[1] = quo[1]; - quo_save[2] = quo[2]; - - if (Div96By32(quo_save, 10000) == 0) { - quo[0] = quo_save[0]; - quo[1] = quo_save[1]; - quo[2] = quo_save[2]; - scale -= 4; - } - } - - if ((quo[0] & 3) == 0 && scale >= 2) { - quo_save[0] = quo[0]; - quo_save[1] = quo[1]; - quo_save[2] = quo[2]; - - if (Div96By32(quo_save, 100) == 0) { - quo[0] = quo_save[0]; - quo[1] = quo_save[1]; - quo[2] = quo_save[2]; - scale -= 2; - } - } - - if ((quo[0] & 1) == 0 && scale >= 1) { - quo_save[0] = quo[0]; - quo_save[1] = quo[1]; - quo_save[2] = quo[2]; - - if (Div96By32(quo_save, 10) == 0) { - quo[0] = quo_save[0]; - quo[1] = quo_save[1]; - quo[2] = quo_save[2]; - scale -= 1; - } - } - } - - DECIMAL_SIGN(*left) = DECIMAL_SIGN(*left) ^ DECIMAL_SIGN(*right); - DECIMAL_HI32(*left) = quo[2]; - DECIMAL_MID32(*left) = quo[1]; - DECIMAL_LO32(*left) = quo[0]; - DECIMAL_SCALE(*left) = (uint8_t)scale; - left->reserved = 0; - -} - -#define DECIMAL_PRECISION 29 - -int -mono_decimal_from_number (void *from, MonoDecimal *target) -{ - MonoNumber *number = (MonoNumber *) from; - uint16_t* p = number->digits; - MonoDecimal d; - int e = number->scale; - g_assert(number != NULL); - g_assert(target != NULL); - - d.reserved = 0; - DECIMAL_SIGNSCALE(d) = 0; - DECIMAL_HI32(d) = 0; - DECIMAL_LO32(d) = 0; - DECIMAL_MID32(d) = 0; - g_assert(p != NULL); - if (!*p) { - // To avoid risking an app-compat issue with pre 4.5 (where some app was illegally using Reflection to examine the internal scale bits), we'll only force - // the scale to 0 if the scale was previously positive - if (e > 0) { - e = 0; - } - } else { - if (e > DECIMAL_PRECISION) return 0; - while ((e > 0 || (*p && e > -28)) && (DECIMAL_HI32(d) < 0x19999999 || (DECIMAL_HI32(d) == 0x19999999 && (DECIMAL_MID32(d) < 0x99999999 || (DECIMAL_MID32(d) == 0x99999999 && (DECIMAL_LO32(d) < 0x99999999 || (DECIMAL_LO32(d) == 0x99999999 && *p <= '5'))))))) { - DecMul10(&d); - if (*p) - DecAddInt32(&d, *p++ - '0'); - e--; - } - if (*p++ >= '5') { - gboolean round = TRUE; - if (*(p-1) == '5' && *(p-2) % 2 == 0) { // Check if previous digit is even, only if the when we are unsure whether hows to do Banker's rounding - // For digits > 5 we will be roundinp up anyway. - int count = 20; // Look at the next 20 digits to check to round - while (*p == '0' && count != 0) { - p++; - count--; - } - if (*p == '\0' || count == 0) - round = FALSE;// Do nothing - } - - if (round) { - DecAddInt32(&d, 1); - if ((DECIMAL_HI32(d) | DECIMAL_MID32(d) | DECIMAL_LO32(d)) == 0) { - DECIMAL_HI32(d) = 0x19999999; - DECIMAL_MID32(d) = 0x99999999; - DECIMAL_LO32(d) = 0x9999999A; - e++; - } - } - } - } - if (e > 0) - return 0; - if (e <= -DECIMAL_PRECISION) { - // Parsing a large scale zero can give you more precision than fits in the decimal. - // This should only happen for actual zeros or very small numbers that round to zero. - DECIMAL_SIGNSCALE(d) = 0; - DECIMAL_HI32(d) = 0; - DECIMAL_LO32(d) = 0; - DECIMAL_MID32(d) = 0; - DECIMAL_SCALE(d) = (DECIMAL_PRECISION - 1); - } else { - DECIMAL_SCALE(d) = (uint8_t)(-e); - } - - DECIMAL_SIGN(d) = number->sign? DECIMAL_NEG: 0; - *target = d; - return 1; -} - - -#endif diff --git a/mono/metadata/decimal-ms.h b/mono/metadata/decimal-ms.h deleted file mode 100644 index 38594e7195..0000000000 --- a/mono/metadata/decimal-ms.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * \file - */ - -#ifndef __MONO_DECIMAL_MS_H__ -#define __MONO_DECIMAL_MS_H__ - -typedef struct { - // Decimal.cs treats the first two shorts as one long - // And they seriable the data so we need to little endian - // seriliazation - // The wReserved overlaps with Variant's vt member -#if G_BYTE_ORDER != G_LITTLE_ENDIAN - union { - struct { - uint8_t sign; - uint8_t scale; - } u; - uint16_t signscale; - } u; - uint16_t reserved; -#else - uint16_t reserved; - union { - struct { - uint8_t scale; - uint8_t sign; - } u; - uint16_t signscale; - } u; -#endif - uint32_t Hi32; - union { - struct { - uint32_t Lo32; - uint32_t Mid32; - } v; - uint64_t Lo64; - } v; -} MonoDecimal; - -typedef enum { - MONO_DECIMAL_CMP_LT=-1, - MONO_DECIMAL_CMP_EQ, - MONO_DECIMAL_CMP_GT -} MonoDecimalCompareResult; - -MonoDecimalCompareResult - mono_decimal_compare (MonoDecimal *left, MonoDecimal *right); - -void mono_decimal_init_single (MonoDecimal *_this, float value); -void mono_decimal_init_double (MonoDecimal *_this, double value); -void mono_decimal_floor (MonoDecimal *d); -int32_t mono_decimal_get_hash_code (MonoDecimal *d); -void mono_decimal_multiply (MonoDecimal *d1, MonoDecimal *d2); -void mono_decimal_round (MonoDecimal *d, int32_t decimals); -void mono_decimal_tocurrency (MonoDecimal *decimal); -double mono_decimal_to_double (MonoDecimal d); -int32_t mono_decimal_to_int32 (MonoDecimal d); -float mono_decimal_to_float (MonoDecimal d); -void mono_decimal_truncate (MonoDecimal *d); -void mono_decimal_addsub (MonoDecimal *left, MonoDecimal *right, uint8_t sign); -void mono_decimal_divide (MonoDecimal *left, MonoDecimal *right); -int mono_decimal_from_number (void *from, MonoDecimal *target); - -#endif diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c index 0b41798491..f598aa7c15 100644 --- a/mono/metadata/domain.c +++ b/mono/metadata/domain.c @@ -124,6 +124,9 @@ get_runtimes_from_exe (const char *exe_file, MonoImage **exe_image, const MonoRu static const MonoRuntimeInfo* get_runtime_by_version (const char *version); +MonoAssembly * +mono_domain_assembly_open_internal (MonoDomain *domain, const char *name); + static LockFreeMempool* lock_free_mempool_new (void) { @@ -297,16 +300,16 @@ gc_alloc_fixed_non_heap_list (size_t size) if (mono_gc_is_moving ()) return g_malloc0 (size); else - return mono_gc_alloc_fixed (appdomain_list_size * sizeof (void*), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, NULL, "Domain List"); + return mono_gc_alloc_fixed (size, MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, NULL, "Domain List"); } static void gc_free_fixed_non_heap_list (void *ptr) { if (mono_gc_is_moving ()) - return g_free (ptr); + g_free (ptr); else - return mono_gc_free_fixed (ptr); + mono_gc_free_fixed (ptr); } /* * Allocate an id for domain and set domain->domain_id. @@ -474,6 +477,7 @@ mono_domain_create (void) static MonoDomain * mono_init_internal (const char *filename, const char *exe_filename, const char *runtime_version) { + ERROR_DECL (error); static MonoDomain *domain = NULL; MonoAssembly *ass = NULL; MonoImageOpenStatus status = MONO_IMAGE_OK; @@ -594,7 +598,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * exit (1); } - mono_defaults.corlib = mono_assembly_get_image (ass); + mono_defaults.corlib = mono_assembly_get_image_internal (ass); mono_defaults.object_class = mono_class_load_from_name ( mono_defaults.corlib, "System", "Object"); @@ -773,8 +777,9 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * mono_defaults.threadpool_wait_callback_class = mono_class_load_from_name ( mono_defaults.corlib, "System.Threading", "_ThreadPoolWaitCallback"); - mono_defaults.threadpool_perform_wait_callback_method = mono_class_get_method_from_name ( - mono_defaults.threadpool_wait_callback_class, "PerformWaitCallback", 0); + mono_defaults.threadpool_perform_wait_callback_method = mono_class_get_method_from_name_checked ( + mono_defaults.threadpool_wait_callback_class, "PerformWaitCallback", 0, 0, error); + mono_error_assert_ok (error); mono_defaults.console_class = mono_class_try_load_from_name ( mono_defaults.corlib, "System", "Console"); @@ -917,6 +922,7 @@ mono_domain_unset (void) void mono_domain_set_internal_with_options (MonoDomain *domain, gboolean migrate_exception) { + MONO_REQ_GC_UNSAFE_MODE; MonoInternalThread *thread; if (mono_domain_get () == domain) @@ -961,6 +967,7 @@ mono_domain_set_internal (MonoDomain *domain) void mono_domain_foreach (MonoDomainFunc func, gpointer user_data) { + MONO_ENTER_GC_UNSAFE; int i, size; MonoDomain **copy; @@ -981,6 +988,7 @@ mono_domain_foreach (MonoDomainFunc func, gpointer user_data) } gc_free_fixed_non_heap_list (copy); + MONO_EXIT_GC_UNSAFE; } /* FIXME: maybe we should integrate this with mono_assembly_open? */ @@ -991,11 +999,23 @@ mono_domain_foreach (MonoDomainFunc func, gpointer user_data) */ MonoAssembly * mono_domain_assembly_open (MonoDomain *domain, const char *name) +{ + MonoAssembly *result; + MONO_ENTER_GC_UNSAFE; + result = mono_domain_assembly_open_internal (domain, name); + MONO_EXIT_GC_UNSAFE; + return result; +} + +MonoAssembly * +mono_domain_assembly_open_internal (MonoDomain *domain, const char *name) { MonoDomain *current; MonoAssembly *ass; GSList *tmp; + MONO_REQ_GC_UNSAFE_MODE; + mono_domain_assemblies_lock (domain); for (tmp = domain->domain_assemblies; tmp; tmp = tmp->next) { ass = (MonoAssembly *)tmp->data; @@ -1251,13 +1271,14 @@ mono_domain_get_by_id (gint32 domainid) { MonoDomain * domain; + MONO_ENTER_GC_UNSAFE; mono_appdomains_lock (); if (domainid < appdomain_list_size) domain = appdomains_list [domainid]; else domain = NULL; mono_appdomains_unlock (); - + MONO_EXIT_GC_UNSAFE; return domain; } diff --git a/mono/metadata/environment-internal.h b/mono/metadata/environment-internal.h new file mode 100644 index 0000000000..3657e938dc --- /dev/null +++ b/mono/metadata/environment-internal.h @@ -0,0 +1,24 @@ +/** + * \file + * System.Environment support internal calls + * + * Authors: + * Dick Porter (dick@ximian.com) + * Sebastien Pouliot (sebastien@ximian.com) + * Jay Krell (jaykrell@microsoft.com) + * + * Copyright 2002-2003 Ximian, Inc (http://www.ximian.com) + * Copyright 2004-2009 Novell, Inc (http://www.novell.com) + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ + +#ifndef _MONO_METADATA_ENVIRONMENT_INTERNAL_H_ +#define _MONO_METADATA_ENVIRONMENT_INTERNAL_H_ + +#include + +ICALL_EXPORT +MonoStringHandle +ves_icall_System_Environment_GetOSVersionString (MonoError *error); + +#endif /* _MONO_METADATA_ENVIRONMENT_INTERNAL_H_ */ diff --git a/mono/metadata/environment.c b/mono/metadata/environment.c index d002777bfd..4853de1b55 100644 --- a/mono/metadata/environment.c +++ b/mono/metadata/environment.c @@ -20,8 +20,7 @@ #include #include #include - -extern MonoStringHandle ves_icall_System_Environment_GetOSVersionString (MonoError *error); +#include "environment-internal.h" #if !defined(HOST_WIN32) && defined(HAVE_SYS_UTSNAME_H) #include diff --git a/mono/metadata/environment.h b/mono/metadata/environment.h index 617d18efc8..1fb5a57b31 100644 --- a/mono/metadata/environment.h +++ b/mono/metadata/environment.h @@ -15,8 +15,8 @@ MONO_BEGIN_DECLS -MONO_API extern int32_t mono_environment_exitcode_get (void); -MONO_API extern void mono_environment_exitcode_set (int32_t value); +MONO_API int32_t mono_environment_exitcode_get (void); +MONO_API void mono_environment_exitcode_set (int32_t value); MONO_END_DECLS diff --git a/mono/metadata/exception-internals.h b/mono/metadata/exception-internals.h index 6e6051a84c..429fd6921f 100644 --- a/mono/metadata/exception-internals.h +++ b/mono/metadata/exception-internals.h @@ -11,23 +11,23 @@ #include #include -MonoException * -mono_get_exception_type_initialization_checked (const gchar *type_name, MonoException *inner, MonoError *error); +MonoExceptionHandle +mono_get_exception_type_initialization_handle (const gchar *type_name, MonoExceptionHandle inner, MonoError *error); MonoExceptionHandle mono_get_exception_reflection_type_load_checked (MonoArrayHandle types, MonoArrayHandle exceptions, MonoError *error); -MonoException * -mono_get_exception_runtime_wrapped_checked (MonoObject *wrapped_exception, MonoError *error); +MonoExceptionHandle +mono_get_exception_runtime_wrapped_handle (MonoObjectHandle wrapped_exception, MonoError *error); -MonoException * +MonoExceptionHandle mono_exception_from_name_two_strings_checked (MonoImage *image, const char *name_space, - const char *name, MonoString *a1, MonoString *a2, + const char *name, MonoStringHandle a1, MonoStringHandle a2, MonoError *error); -MonoException * +MonoExceptionHandle mono_exception_from_token_two_strings_checked (MonoImage *image, uint32_t token, - MonoString *a1, MonoString *a2, + MonoStringHandle a1, MonoStringHandle a2, MonoError *error); typedef int (*MonoGetSeqPointFunc) (MonoDomain *domain, MonoMethod *method, gint32 native_offset); @@ -53,19 +53,35 @@ mono_error_set_file_not_found (MonoError *oerror, const char *file_name, const c void mono_error_set_simple_file_not_found (MonoError *oerror, const char *assembly_name, gboolean refection_only); -MonoException * +MonoExceptionHandle mono_corlib_exception_new_with_args (const char *name_space, const char *name, const char *arg_0, const char *arg_1, MonoError *error); +MonoExceptionHandle +mono_exception_new_by_name_msg (MonoImage *image, const char *name_space, + const char *name, const char *msg, MonoError *error); + MonoExceptionHandle mono_exception_new_argument (const char *arg, const char *msg, MonoError *error); MonoExceptionHandle mono_exception_new_thread_interrupted (MonoError *error); -MonoExceptionHandle -mono_exception_new_thread_interrupted (MonoError *error); - MonoExceptionHandle mono_exception_new_thread_abort (MonoError *error); +MonoExceptionHandle +mono_exception_new_serialization (const char *msg, MonoError *error); + +MonoExceptionHandle +mono_exception_new_invalid_operation (const char *msg, MonoError *error); + +MonoExceptionHandle +mono_error_convert_to_exception_handle (MonoError *error); + +MonoExceptionHandle +mono_get_exception_out_of_memory_handle (void); + +MonoExceptionHandle +mono_exception_new_argument_null (const char *arg, MonoError *error); + #endif diff --git a/mono/metadata/exception.c b/mono/metadata/exception.c index 312450f68c..0dc02bfee4 100644 --- a/mono/metadata/exception.c +++ b/mono/metadata/exception.c @@ -38,6 +38,9 @@ static MonoExceptionHandle mono_exception_new_by_name_domain (MonoDomain *domain, MonoImage *image, const char* name_space, const char *name, MonoError *error); +static MonoExceptionHandle +mono_exception_new_argument_internal (const char *type, const char *arg, const char *msg, MonoError *error); + /** * mono_exception_new_by_name: * \param image the Mono image where to look for the class @@ -89,7 +92,7 @@ static MonoExceptionHandle mono_exception_new_by_name_domain (MonoDomain *domain, MonoImage *image, const char* name_space, const char *name, MonoError *error) { - HANDLE_FUNCTION_ENTER () + HANDLE_FUNCTION_ENTER (); MonoDomain * const caller_domain = mono_domain_get (); @@ -110,9 +113,9 @@ mono_exception_new_by_name_domain (MonoDomain *domain, MonoImage *image, goto_if_ok (error, exit); return_null: - MONO_HANDLE_ASSIGN (o, NULL); + MONO_HANDLE_ASSIGN (o, NULL_HANDLE); exit: - HANDLE_FUNCTION_RETURN_REF (MonoException, o); + HANDLE_FUNCTION_RETURN_REF (MonoException, MONO_HANDLE_CAST (MonoException, o)); } /** @@ -131,28 +134,13 @@ MonoException * mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image, const char* name_space, const char *name) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoClass *klass; - MonoObject *o; - MonoDomain *caller_domain = mono_domain_get (); - - klass = mono_class_load_from_name (image, name_space, name); - - o = mono_object_new_checked (domain, klass, error); + MonoExceptionHandle ret = mono_exception_new_by_name_domain (domain, image, name_space, name, error); mono_error_assert_ok (error); - - if (domain != caller_domain) - mono_domain_set_internal (domain); - mono_runtime_object_init_checked (o, error); - mono_error_assert_ok (error); - - if (domain != caller_domain) - mono_domain_set_internal (caller_domain); - - return (MonoException *)o; + HANDLE_FUNCTION_RETURN_OBJ (ret); } - /** * mono_exception_from_token: * \param image the Mono image where to look for the class @@ -165,37 +153,33 @@ mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image, MonoException * mono_exception_from_token (MonoImage *image, guint32 token) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); MonoClass *klass; - MonoObject *o; klass = mono_class_get_checked (image, token, error); mono_error_assert_ok (error); - o = mono_object_new_checked (mono_domain_get (), klass, error); - mono_error_assert_ok (error); - - mono_runtime_object_init_checked (o, error); + MonoObjectHandle o = mono_object_new_handle (mono_domain_get (), klass, error); mono_error_assert_ok (error); - return (MonoException *)o; + mono_runtime_object_init_handle (o, error); + mono_error_assert_ok (error); + + HANDLE_FUNCTION_RETURN_OBJ (MONO_HANDLE_CAST (MonoException, o)); } -static MonoException * -create_exception_two_strings (MonoClass *klass, MonoString *a1, MonoString *a2, MonoError *error) +static MonoExceptionHandle +create_exception_two_strings (MonoClass *klass, MonoStringHandle a1, MonoStringHandle a2, MonoError *error) { - MonoDomain *domain = mono_domain_get (); + HANDLE_FUNCTION_ENTER (); + MonoMethod *method = NULL; - MonoObject *o; - int count = 1; - gpointer args [2]; + int const count = 1 + !MONO_HANDLE_IS_NULL (a2); gpointer iter; MonoMethod *m; - - if (a2 != NULL) - count++; - o = mono_object_new_checked (domain, klass, error); + MonoObjectHandle o = mono_object_new_handle (mono_domain_get (), klass, error); mono_error_assert_ok (error); iter = NULL; @@ -216,13 +200,13 @@ create_exception_two_strings (MonoClass *klass, MonoString *a1, MonoString *a2, break; } - args [0] = a1; - args [1] = a2; + gpointer args [ ] = { MONO_HANDLE_RAW (a1), MONO_HANDLE_RAW (a2) }; - mono_runtime_invoke_checked (method, o, args, error); - return_val_if_nok (error, NULL); + mono_runtime_invoke_handle (method, o, args, error); + if (!is_ok (error)) + o = mono_new_null (); - return (MonoException *) o; + HANDLE_FUNCTION_RETURN_REF (MonoException, MONO_HANDLE_CAST (MonoException, o)); } /** @@ -240,14 +224,15 @@ create_exception_two_strings (MonoClass *klass, MonoString *a1, MonoString *a2, */ MonoException * mono_exception_from_name_two_strings (MonoImage *image, const char *name_space, - const char *name, MonoString *a1, MonoString *a2) + const char *name, MonoString *a1_raw, MonoString *a2_raw) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoException *ret; - - ret = mono_exception_from_name_two_strings_checked (image, name_space, name, a1, a2, error); + MONO_HANDLE_DCL (MonoString, a1); + MONO_HANDLE_DCL (MonoString, a2); + MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked (image, name_space, name, a1, a2, error); mono_error_cleanup (error); - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } /** @@ -265,17 +250,19 @@ mono_exception_from_name_two_strings (MonoImage *image, const char *name_space, * \returns the initialized exception instance. On failure returns * NULL and sets \p error. */ -MonoException * +MonoExceptionHandle mono_exception_from_name_two_strings_checked (MonoImage *image, const char *name_space, - const char *name, MonoString *a1, MonoString *a2, + const char *name, MonoStringHandle a1, MonoStringHandle a2, MonoError *error) { + HANDLE_FUNCTION_ENTER (); + MonoClass *klass; error_init (error); klass = mono_class_load_from_name (image, name_space, name); - return create_exception_two_strings (klass, a1, a2, error); + HANDLE_FUNCTION_RETURN_REF (MonoException, create_exception_two_strings (klass, a1, a2, error)); } /** @@ -289,11 +276,11 @@ mono_exception_from_name_two_strings_checked (MonoImage *image, const char *name * * \returns the initialized exception instance. */ -static MonoExceptionHandle +MonoExceptionHandle mono_exception_new_by_name_msg (MonoImage *image, const char *name_space, const char *name, const char *msg, MonoError *error) { - HANDLE_FUNCTION_ENTER () + HANDLE_FUNCTION_ENTER (); MonoExceptionHandle ex = mono_exception_new_by_name (image, name_space, name, error); goto_if_nok (error, return_null); @@ -307,7 +294,7 @@ mono_exception_new_by_name_msg (MonoImage *image, const char *name_space, } goto exit; return_null: - MONO_HANDLE_ASSIGN (ex, NULL); + MONO_HANDLE_ASSIGN (ex, NULL_HANDLE); exit: HANDLE_FUNCTION_RETURN_REF (MonoException, ex) } @@ -327,18 +314,14 @@ MonoException * mono_exception_from_name_msg (MonoImage *image, const char *name_space, const char *name, const char *msg) { + HANDLE_FUNCTION_ENTER (); + MonoExceptionHandle ex; + MONO_ENTER_GC_UNSAFE; ERROR_DECL (error); - MonoException *ex; - - ex = mono_exception_from_name (image, name_space, name); - - if (msg) { - MonoString *msg_str = mono_string_new_checked (mono_object_get_domain ((MonoObject*)ex), msg, error); - mono_error_assert_ok (error); - MONO_OBJECT_SETREF (ex, message, msg_str); - } - - return ex; + ex = mono_exception_new_by_name_msg (image, name_space, name, msg, error); + mono_error_cleanup (error); + MONO_EXIT_GC_UNSAFE; + HANDLE_FUNCTION_RETURN_OBJ (ex); } /** @@ -348,14 +331,15 @@ mono_exception_from_name_msg (MonoImage *image, const char *name_space, * IMAGE and TOKEN. */ MonoException * -mono_exception_from_token_two_strings (MonoImage *image, guint32 token, - MonoString *a1, MonoString *a2) +mono_exception_from_token_two_strings (MonoImage *image, guint32 token, MonoString *arg1_raw, MonoString *arg2_raw) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoException *ret; - ret = mono_exception_from_token_two_strings_checked (image, token, a1, a2, error); + MONO_HANDLE_DCL (MonoString, arg1); + MONO_HANDLE_DCL (MonoString, arg2); + MonoExceptionHandle ret = mono_exception_from_token_two_strings_checked (image, token, arg1, arg2, error); mono_error_cleanup (error); - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } /** @@ -364,11 +348,13 @@ mono_exception_from_token_two_strings (MonoImage *image, guint32 token, * Same as mono_exception_from_name_two_strings, but lookup the exception class using * IMAGE and TOKEN. */ -MonoException * +MonoExceptionHandle mono_exception_from_token_two_strings_checked (MonoImage *image, guint32 token, - MonoString *a1, MonoString *a2, + MonoStringHandle a1, MonoStringHandle a2, MonoError *error) { + HANDLE_FUNCTION_ENTER (); + MonoClass *klass; error_init (error); @@ -376,7 +362,7 @@ mono_exception_from_token_two_strings_checked (MonoImage *image, guint32 token, klass = mono_class_get_checked (image, token, error); mono_error_assert_ok (error); /* FIXME handle the error. */ - return create_exception_two_strings (klass, a1, a2, error); + HANDLE_FUNCTION_RETURN_REF (MonoException, create_exception_two_strings (klass, a1, a2, error)); } /** @@ -395,7 +381,7 @@ mono_get_exception_divide_by_zero (void) * \returns a new instance of the \c System.Security.SecurityException */ MonoException * -mono_get_exception_security () +mono_get_exception_security (void) { return mono_exception_from_name (mono_get_corlib (), "System.Security", "SecurityException"); @@ -416,7 +402,7 @@ mono_exception_new_thread_abort (MonoError *error) * \returns a new instance of the \c System.Threading.ThreadAbortException */ MonoException * -mono_get_exception_thread_abort () +mono_get_exception_thread_abort (void) { return mono_exception_from_name (mono_get_corlib (), "System.Threading", "ThreadAbortException"); @@ -484,7 +470,11 @@ mono_get_exception_null_reference (void) MonoException * mono_get_exception_execution_engine (const char *msg) { - return mono_exception_from_name_msg (mono_get_corlib (), "System", "ExecutionEngineException", msg); + MonoException *result; + MONO_ENTER_GC_UNSAFE; + result = mono_exception_from_name_msg (mono_get_corlib (), "System", "ExecutionEngineException", msg); + MONO_EXIT_GC_UNSAFE; + return result; } /** @@ -520,6 +510,13 @@ mono_get_exception_invalid_operation (const char *msg) "InvalidOperationException", msg); } +MonoExceptionHandle +mono_exception_new_invalid_operation (const char *msg, MonoError *error) +{ + return mono_exception_new_by_name_msg (mono_get_corlib (), "System", + "InvalidOperationException", msg, error); +} + /** * mono_get_exception_index_out_of_range: * \returns a new instance of the \c System.IndexOutOfRangeException @@ -549,20 +546,23 @@ mono_get_exception_array_type_mismatch (void) * \returns a new instance of the \c System.TypeLoadException */ MonoException * -mono_get_exception_type_load (MonoString *class_name, char *assembly_name) +mono_get_exception_type_load (MonoString *class_name_raw, char *assembly_name) { ERROR_DECL (error); - MonoString *s = NULL; + HANDLE_FUNCTION_ENTER (); + MONO_HANDLE_DCL (MonoString, class_name); + MonoStringHandle s = NULL_HANDLE_STRING; + MonoDomain * const domain = mono_domain_get (); if (assembly_name) { - s = mono_string_new_checked (mono_domain_get (), assembly_name, error); + s = mono_string_new_handle (domain, assembly_name, error); mono_error_assert_ok (error); } else - s = mono_string_empty (mono_domain_get ()); + s = mono_string_empty_handle (domain); - MonoException *ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", + MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", "TypeLoadException", class_name, s, error); mono_error_assert_ok (error); - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } /** @@ -587,6 +587,30 @@ mono_get_exception_not_supported (const char *msg) return mono_exception_from_name_msg (mono_get_corlib (), "System", "NotSupportedException", msg); } +/** + * mono_get_exception_missing_member: + * \param exception_type the specific exception type for the specific member type, i.e. field or method + * \param class_name the class where the lookup was performed. + * \param member_name the name of the missing method. + * \returns a new instance of the \c exception_type (MissingFieldException or MissingMethodException) + */ +static MonoException* +mono_get_exception_missing_member (const char *exception_type, const char *class_name, const char *member_name) +{ + HANDLE_FUNCTION_ENTER (); + ERROR_DECL (error); + MonoDomain * const domain = mono_domain_get (); + MonoStringHandle s1 = mono_string_new_handle (domain, class_name, error); + mono_error_assert_ok (error); + MonoStringHandle s2 = mono_string_new_handle (domain, member_name, error); + mono_error_assert_ok (error); + + MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", + exception_type, s1, s2, error); + mono_error_assert_ok (error); + HANDLE_FUNCTION_RETURN_OBJ (ret); +} + /** * mono_get_exception_missing_method: * \param class_name the class where the lookup was performed. @@ -596,37 +620,36 @@ mono_get_exception_not_supported (const char *msg) MonoException * mono_get_exception_missing_method (const char *class_name, const char *member_name) { - ERROR_DECL (error); - MonoString *s1 = mono_string_new_checked (mono_domain_get (), class_name, error); - mono_error_assert_ok (error); - MonoString *s2 = mono_string_new_checked (mono_domain_get (), member_name, error); - mono_error_assert_ok (error); - - MonoException *ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", - "MissingMethodException", s1, s2, error); - mono_error_assert_ok (error); - return ret; + return mono_get_exception_missing_member ("MissingMethodException", class_name, member_name); } /** * mono_get_exception_missing_field: * \param class_name the class where the lookup was performed - * \param member_name the name of the missing method. + * \param member_name the name of the missing field. * \returns a new instance of the \c System.MissingFieldException */ MonoException * mono_get_exception_missing_field (const char *class_name, const char *member_name) { - ERROR_DECL (error); - MonoString *s1 = mono_string_new_checked (mono_domain_get (), class_name, error); - mono_error_assert_ok (error); - MonoString *s2 = mono_string_new_checked (mono_domain_get (), member_name, error); - mono_error_assert_ok (error); + return mono_get_exception_missing_member ("MissingFieldException", class_name, member_name); +} - MonoException *ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", - "MissingFieldException", s1, s2, error); - mono_error_assert_ok (error); - return ret; +/** + * mono_get_exception_argument_internal: + * \param type the actual type + * \param arg the name of the argument that is invalid or null, etc. + * \param msg optional message + * \returns a new instance of the \c System.ArgumentException or derived + */ +static MonoException* +mono_get_exception_argument_internal (const char *type, const char *arg, const char *msg) +{ + HANDLE_FUNCTION_ENTER (); + ERROR_DECL (error); + MonoExceptionHandle ex = mono_exception_new_argument_internal (type, arg, msg, error); + mono_error_cleanup (error); + HANDLE_FUNCTION_RETURN_OBJ (ex); } /** @@ -637,20 +660,7 @@ mono_get_exception_missing_field (const char *class_name, const char *member_nam MonoException* mono_get_exception_argument_null (const char *arg) { - MonoException *ex; - - ex = mono_exception_from_name ( - mono_get_corlib (), "System", "ArgumentNullException"); - - if (arg) { - ERROR_DECL (error); - MonoArgumentException *argex = (MonoArgumentException *)ex; - MonoString *arg_str = mono_string_new_checked (mono_object_get_domain ((MonoObject*)ex), arg, error); - mono_error_assert_ok (error); - MONO_OBJECT_SETREF (argex, param_name, arg_str); - } - - return ex; + return mono_get_exception_argument_internal ("ArgumentNullException", arg, NULL); } /** @@ -661,32 +671,18 @@ mono_get_exception_argument_null (const char *arg) MonoException * mono_get_exception_argument (const char *arg, const char *msg) { - MonoException *ex; - - ex = mono_exception_from_name_msg ( - mono_get_corlib (), "System", "ArgumentException", msg); - - if (arg) { - ERROR_DECL (error); - MonoArgumentException *argex = (MonoArgumentException *)ex; - MonoString *arg_str = mono_string_new_checked (mono_object_get_domain ((MonoObject*)ex), arg, error); - mono_error_assert_ok (error); - MONO_OBJECT_SETREF (argex, param_name, arg_str); - } - - return ex; + return mono_get_exception_argument_internal ("ArgumentException", arg, msg); } TYPED_HANDLE_DECL (MonoArgumentException); -MonoExceptionHandle -mono_exception_new_argument (const char *arg, const char *msg, MonoError *error) +static MonoExceptionHandle +mono_exception_new_argument_internal (const char *type, const char *arg, const char *msg, MonoError *error) { - MonoExceptionHandle ex; - ex = mono_exception_new_by_name_msg (mono_get_corlib (), "System", "ArgumentException", msg, error); + MonoExceptionHandle ex = mono_exception_new_by_name_msg (mono_get_corlib (), "System", type, msg, error); if (arg && !MONO_HANDLE_IS_NULL (ex)) { - MonoArgumentExceptionHandle argex = (MonoArgumentExceptionHandle)ex; + MonoArgumentExceptionHandle argex = MONO_HANDLE_CAST (MonoArgumentException, ex); MonoStringHandle arg_str = mono_string_new_handle (MONO_HANDLE_DOMAIN (ex), arg, error); MONO_HANDLE_SET (argex, param_name, arg_str); } @@ -694,6 +690,26 @@ mono_exception_new_argument (const char *arg, const char *msg, MonoError *error) return ex; } +MonoExceptionHandle +mono_exception_new_argument (const char *arg, const char *msg, MonoError *error) +{ + return mono_exception_new_argument_internal ("ArgumentException", arg, msg, error); +} + +MonoExceptionHandle +mono_exception_new_argument_null (const char *arg, MonoError *error) +{ + return mono_exception_new_argument_internal ("ArgumentNullException", arg, NULL, error); +} + +MonoExceptionHandle +mono_exception_new_serialization (const char *msg, MonoError *error) +{ + return mono_exception_new_by_name_msg (mono_get_corlib (), + "System.Runtime.Serialization", "SerializationException", + "Could not serialize unhandled exception.", error); +} + /** * mono_get_exception_argument_out_of_range: * \param arg the name of the out of range argument. @@ -702,20 +718,13 @@ mono_exception_new_argument (const char *arg, const char *msg, MonoError *error) MonoException * mono_get_exception_argument_out_of_range (const char *arg) { - MonoException *ex; + return mono_get_exception_argument_internal ("ArgumentOutOfRangeException", arg, NULL); +} - ex = mono_exception_from_name ( - mono_get_corlib (), "System", "ArgumentOutOfRangeException"); - - if (arg) { - ERROR_DECL (error); - MonoArgumentException *argex = (MonoArgumentException *)ex; - MonoString *arg_str = mono_string_new_checked (mono_object_get_domain ((MonoObject*)ex), arg, error); - mono_error_assert_ok (error); - MONO_OBJECT_SETREF (argex, param_name, arg_str); - } - - return ex; +static MonoExceptionHandle +mono_new_exception_argument_out_of_range (const char *arg, MonoError *error) +{ + return mono_exception_new_argument_internal ("ArgumentOutOfRangeException", arg, NULL, error); } /** @@ -723,7 +732,6 @@ mono_get_exception_argument_out_of_range (const char *arg) * \param msg the message to present to the user * \returns a new instance of the \c System.Threading.ThreadStateException */ -MONO_RT_EXTERNAL_ONLY MonoException * mono_get_exception_thread_state (const char *msg) { @@ -739,7 +747,7 @@ mono_get_exception_thread_state (const char *msg) MonoException * mono_get_exception_io (const char *msg) { - return mono_exception_from_name_msg ( + return mono_exception_from_name_msg ( mono_get_corlib (), "System.IO", "IOException", msg); } @@ -749,13 +757,14 @@ mono_get_exception_io (const char *msg) * \returns a new instance of the \c System.IO.FileNotFoundException */ MonoException * -mono_get_exception_file_not_found (MonoString *fname) +mono_get_exception_file_not_found (MonoString *fname_raw) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoException *ret = mono_exception_from_name_two_strings_checked ( - mono_get_corlib (), "System.IO", "FileNotFoundException", fname, fname, error); + MONO_HANDLE_DCL (MonoString, fname); + MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System.IO", "FileNotFoundException", fname, fname, error); mono_error_assert_ok (error); - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } /** @@ -765,19 +774,19 @@ mono_get_exception_file_not_found (MonoString *fname) * \returns a new instance of the \c System.IO.FileNotFoundException */ MonoException * -mono_get_exception_file_not_found2 (const char *msg, MonoString *fname) +mono_get_exception_file_not_found2 (const char *msg, MonoString *fname_raw) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoString *s = NULL; + MONO_HANDLE_DCL (MonoString, fname); + MonoStringHandle s = NULL_HANDLE_STRING; if (msg) { - s = mono_string_new_checked (mono_domain_get (), msg, error); + s = mono_string_new_handle (mono_domain_get (), msg, error); mono_error_assert_ok (error); } - - MonoException *ret = mono_exception_from_name_two_strings_checked ( - mono_get_corlib (), "System.IO", "FileNotFoundException", s, fname, error); + MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System.IO", "FileNotFoundException", s, fname, error); mono_error_assert_ok (error); - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } /** @@ -787,24 +796,25 @@ mono_get_exception_file_not_found2 (const char *msg, MonoString *fname) * \returns a new instance of the \c System.TypeInitializationException */ MonoException * -mono_get_exception_type_initialization (const gchar *type_name, MonoException *inner) +mono_get_exception_type_initialization (const gchar *type_name, MonoException* inner_raw) { + HANDLE_FUNCTION_ENTER (); + MONO_HANDLE_DCL (MonoException, inner); ERROR_DECL (error); - MonoException *ret = mono_get_exception_type_initialization_checked (type_name, inner, error); + MonoExceptionHandle ret = mono_get_exception_type_initialization_handle (type_name, inner, error); if (!is_ok (error)) { + ret = MONO_HANDLE_CAST (MonoException, mono_new_null ()); mono_error_cleanup (error); - return NULL; } - - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } -MonoException * -mono_get_exception_type_initialization_checked (const gchar *type_name, MonoException *inner, MonoError *error) +MonoExceptionHandle +mono_get_exception_type_initialization_handle (const gchar *type_name, MonoExceptionHandle inner, MonoError *error) { + HANDLE_FUNCTION_ENTER (); + MonoClass *klass; - gpointer args [2]; - MonoObject *exc; MonoMethod *method; gpointer iter; @@ -826,18 +836,21 @@ mono_get_exception_type_initialization_checked (const gchar *type_name, MonoExce } g_assert (method); - MonoString *type_name_str = mono_string_new_checked (mono_domain_get (), type_name, error); + MonoDomain * const domain = mono_domain_get (); + MonoStringHandle type_name_str = mono_string_new_handle (domain, type_name, error); mono_error_assert_ok (error); - args [0] = type_name_str; - args [1] = inner; + gpointer args [ ] = { MONO_HANDLE_RAW (type_name_str), MONO_HANDLE_RAW (inner) }; - exc = mono_object_new_checked (mono_domain_get (), klass, error); + MonoObjectHandle exc = mono_object_new_handle (domain, klass, error); mono_error_assert_ok (error); - mono_runtime_invoke_checked (method, exc, args, error); - return_val_if_nok (error, NULL); - - return (MonoException *) exc; + mono_runtime_invoke_handle (method, exc, args, error); + goto_if_nok (error, return_null); + goto exit; +return_null: + exc = mono_new_null (); +exit: + HANDLE_FUNCTION_RETURN_REF (MonoException, MONO_HANDLE_CAST (MonoException, exc)); } /** @@ -890,20 +903,22 @@ mono_get_exception_bad_image_format (const char *msg) * \returns a new instance of the \c System.BadImageFormatException */ MonoException * -mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname) +mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname_raw) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoString *s = NULL; + MonoStringHandle s = NULL_HANDLE_STRING; + MONO_HANDLE_DCL (MonoString, fname); if (msg) { - s = mono_string_new_checked (mono_domain_get (), msg, error); + s = mono_string_new_handle (mono_domain_get (), msg, error); mono_error_assert_ok (error); } - MonoException *ret = mono_exception_from_name_two_strings_checked ( + MonoExceptionHandle ret = mono_exception_from_name_two_strings_checked ( mono_get_corlib (), "System", "BadImageFormatException", s, fname, error); mono_error_assert_ok (error); - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } /** @@ -926,6 +941,12 @@ mono_get_exception_out_of_memory (void) return mono_exception_from_name (mono_get_corlib (), "System", "OutOfMemoryException"); } +MonoExceptionHandle +mono_get_exception_out_of_memory_handle (void) +{ + return MONO_HANDLE_NEW (MonoException, mono_exception_from_name (mono_get_corlib (), "System", "OutOfMemoryException")); +} + /** * mono_get_exception_field_access: * \returns a new instance of the \c System.FieldAccessException @@ -982,17 +1003,17 @@ mono_get_exception_reflection_type_load (MonoArray *types_raw, MonoArray *except MONO_HANDLE_DCL (MonoArray, types); MONO_HANDLE_DCL (MonoArray, exceptions); MonoExceptionHandle ret = mono_get_exception_reflection_type_load_checked (types, exceptions, error); - if (is_ok (error)) { - mono_error_cleanup (error); - ret = MONO_HANDLE_CAST (MonoException, NULL_HANDLE); - } + if (!is_ok (error)) + ret = MONO_HANDLE_CAST (MonoException, mono_new_null ()); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (ret); - } MonoExceptionHandle mono_get_exception_reflection_type_load_checked (MonoArrayHandle types, MonoArrayHandle exceptions, MonoError *error) { + HANDLE_FUNCTION_ENTER (); + MonoClass *klass; MonoMethod *method; gpointer iter; @@ -1016,61 +1037,70 @@ mono_get_exception_reflection_type_load_checked (MonoArrayHandle types, MonoArra } g_assert (method); - MonoExceptionHandle exc = MONO_HANDLE_NEW (MonoException, mono_object_new_checked (mono_domain_get (), klass, error)); + MonoExceptionHandle exc = MONO_HANDLE_CAST (MonoException, MONO_HANDLE_NEW (MonoObject, mono_object_new_checked (mono_domain_get (), klass, error))); mono_error_assert_ok (error); - gpointer args [2]; - args [0] = MONO_HANDLE_RAW (types); - args [1] = MONO_HANDLE_RAW (exceptions); + gpointer args [ ] = { MONO_HANDLE_RAW (types), MONO_HANDLE_RAW (exceptions) }; mono_runtime_invoke_checked (method, MONO_HANDLE_RAW (exc), args, error); - return_val_if_nok (error, MONO_HANDLE_CAST (MonoException, NULL_HANDLE)); - - return exc; + goto_if_nok (error, return_null); + goto exit; +return_null: + exc = MONO_HANDLE_CAST (MonoException, mono_new_null ()); +exit: + HANDLE_FUNCTION_RETURN_REF (MonoException, exc); } /** * mono_get_exception_runtime_wrapped: */ MonoException * -mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception) +mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception_raw) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoException *ret = mono_get_exception_runtime_wrapped_checked (wrapped_exception, error); + MONO_HANDLE_DCL (MonoObject, wrapped_exception); + MonoExceptionHandle ret = mono_get_exception_runtime_wrapped_handle (wrapped_exception, error); if (!is_ok (error)) { mono_error_cleanup (error); - return NULL; + ret = MONO_HANDLE_CAST (MonoException, mono_new_null ()); } - - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } -MonoException * -mono_get_exception_runtime_wrapped_checked (MonoObject *wrapped_exception, MonoError *error) +MonoExceptionHandle +mono_get_exception_runtime_wrapped_handle (MonoObjectHandle wrapped_exception, MonoError *error) { + HANDLE_FUNCTION_ENTER (); + MonoClass *klass; - MonoObject *o; MonoMethod *method; - MonoDomain *domain = mono_domain_get (); klass = mono_class_load_from_name (mono_get_corlib (), "System.Runtime.CompilerServices", "RuntimeWrappedException"); - o = mono_object_new_checked (domain, klass, error); + MonoObjectHandle o = mono_object_new_handle (mono_domain_get (), klass, error); mono_error_assert_ok (error); - g_assert (o != NULL); + g_assert (!MONO_HANDLE_IS_NULL (o)); - method = mono_class_get_method_from_name (klass, ".ctor", 1); + method = mono_class_get_method_from_name_checked (klass, ".ctor", 1, 0, error); + mono_error_assert_ok (error); g_assert (method); - mono_runtime_invoke_checked (method, o, (gpointer*)&wrapped_exception, error); - return_val_if_nok (error, NULL); + gpointer args [ ] = { MONO_HANDLE_RAW (wrapped_exception) }; - return (MonoException *)o; -} + mono_runtime_invoke_handle (method, o, args, error); + goto_if_nok (error, return_null); + goto exit; +return_null: + o = mono_new_null (); +exit: + HANDLE_FUNCTION_RETURN_REF (MonoException, MONO_HANDLE_CAST (MonoException, o)); +} static gboolean append_frame_and_continue (MonoMethod *method, gpointer ip, size_t native_offset, gboolean managed, gpointer user_data) { + MONO_ENTER_GC_UNSAFE; MonoDomain *domain = mono_domain_get (); GString *text = (GString*)user_data; @@ -1081,7 +1111,7 @@ append_frame_and_continue (MonoMethod *method, gpointer ip, size_t native_offset } else { g_string_append_printf (text, "\n", ip); } - + MONO_EXIT_GC_UNSAFE; return FALSE; } @@ -1125,7 +1155,7 @@ mono_exception_handle_get_native_backtrace (MonoExceptionHandle exc) for (i = 0; i < len; ++i) { gpointer ip; MONO_HANDLE_ARRAY_GETVAL (ip, arr, gpointer, i); - MonoJitInfo *ji = mono_jit_info_table_find (mono_domain_get (), ip); + MonoJitInfo *ji = mono_jit_info_table_find (domain, ip); if (ji) { char *msg = mono_debug_print_stack_frame (mono_jit_info_get_method (ji), (char*)ip - (char*)ji->code_start, domain); g_string_append_printf (text, "%s\n", msg); @@ -1149,7 +1179,7 @@ ves_icall_Mono_Runtime_GetNativeStackTrace (MonoExceptionHandle exc, MonoError * MonoStringHandle res; error_init (error); - if (!exc) { + if (MONO_HANDLE_IS_NULL (exc)) { mono_error_set_argument_null (error, "exception", ""); return NULL_HANDLE_STRING; } @@ -1191,13 +1221,17 @@ mono_error_raise_exception_deprecated (MonoError *target_error) gboolean mono_error_set_pending_exception (MonoError *error) { - MonoException *ex = mono_error_convert_to_exception (error); - if (ex) { - mono_set_pending_exception (ex); - return TRUE; - } else { + if (is_ok (error)) return FALSE; - } + + HANDLE_FUNCTION_ENTER (); + + MonoExceptionHandle ex = mono_error_convert_to_exception_handle (error); + gboolean const result = !MONO_HANDLE_IS_NULL (ex); + if (result) + mono_set_pending_exception_handle (ex); + + HANDLE_FUNCTION_RETURN_VAL (result); } void @@ -1248,20 +1282,28 @@ mono_invoke_unhandled_exception_hook (MonoObject *exc) g_assert_not_reached (); } -MonoException * +MonoExceptionHandle mono_corlib_exception_new_with_args (const char *name_space, const char *name, const char *arg_0, const char *arg_1, MonoError *error) { - MonoDomain *domain = mono_domain_get (); - MonoString *str_0, *str_1; - error_init (error); + HANDLE_FUNCTION_ENTER (); - str_0 = arg_0 ? mono_string_new_checked (domain, arg_0, error) : NULL; - return_val_if_nok (error, NULL); + MonoStringHandle str_0 = NULL_HANDLE_STRING; + MonoStringHandle str_1 = NULL_HANDLE_STRING; + MonoExceptionHandle ex = MONO_HANDLE_CAST (MonoException, NULL_HANDLE); + MonoDomain * const domain = mono_domain_get (); - str_1 = arg_1 ? mono_string_new_checked (domain, arg_1, error) : NULL; - return_val_if_nok (error, NULL); + str_0 = arg_0 ? mono_string_new_handle (domain, arg_0, error) : NULL_HANDLE_STRING; + goto_if_nok (error, return_null); - return mono_exception_from_name_two_strings_checked (mono_defaults.corlib, name_space, name, str_0, str_1, error); + str_1 = arg_1 ? mono_string_new_handle (domain, arg_1, error) : NULL_HANDLE_STRING; + goto_if_nok (error, return_null); + + ex = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, name_space, name, str_0, str_1, error); + goto exit; +return_null: + ex = MONO_HANDLE_CAST (MonoException, mono_new_null ()); +exit: + HANDLE_FUNCTION_RETURN_REF (MonoException, ex); } void @@ -1435,6 +1477,16 @@ mono_error_set_simple_file_not_found (MonoError *error, const char *file_name, g void mono_error_set_argument_out_of_range (MonoError *error, const char *name) { - //FIXMEcoop - mono_error_set_exception_instance (error, mono_get_exception_argument_out_of_range (name)); + ERROR_DECL (error_creating_exception); + mono_error_set_exception_handle (error, mono_new_exception_argument_out_of_range (name, error_creating_exception)); + mono_error_cleanup (error_creating_exception); +} + +MonoExceptionHandle +mono_error_convert_to_exception_handle (MonoError *error) +{ + //FIXMEcoop mono_error_convert_to_exception is raw pointer + // The "optimization" here is important to significantly reduce handle usage. + return mono_error_ok (error) ? MONO_HANDLE_CAST (MonoException, NULL_HANDLE) + : MONO_HANDLE_NEW (MonoException, mono_error_convert_to_exception (error)); } diff --git a/mono/metadata/exception.h b/mono/metadata/exception.h index a1fc6ef227..d05a0b239d 100644 --- a/mono/metadata/exception.h +++ b/mono/metadata/exception.h @@ -11,7 +11,7 @@ MONO_BEGIN_DECLS -extern MONO_API MonoException * +MONO_API MonoException * mono_exception_from_name (MonoImage *image, const char* name_space, const char *name); @@ -19,8 +19,8 @@ mono_exception_from_name (MonoImage *image, MONO_API MonoException * mono_exception_from_token (MonoImage *image, uint32_t token); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_exception_from_name_two_strings (MonoImage *image, const char *name_space, const char *name, MonoString *a1, MonoString *a2); @@ -28,12 +28,12 @@ MONO_API MonoException * mono_exception_from_name_msg (MonoImage *image, const char *name_space, const char *name, const char *msg); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_exception_from_token_two_strings (MonoImage *image, uint32_t token, MonoString *a1, MonoString *a2); -extern MONO_API MonoException * +MONO_API MonoException * mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image, const char* name_space, const char *name); @@ -59,12 +59,12 @@ mono_get_exception_execution_engine (const char *msg); MONO_API MonoException * mono_get_exception_thread_abort (void); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_thread_state (const char *msg); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_thread_interrupted (void); MONO_API MonoException * @@ -85,14 +85,16 @@ mono_get_exception_array_type_mismatch (void); MONO_API MonoException * mono_get_exception_type_load (MonoString *class_name, char *assembly_name); -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_missing_method (const char *class_name, const char *member_name); -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_missing_field (const char *class_name, const char *member_name); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_not_implemented (const char *msg); MONO_API MonoException * @@ -104,26 +106,28 @@ mono_get_exception_argument_null (const char *arg); MONO_API MonoException * mono_get_exception_argument (const char *arg, const char *msg); -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_argument_out_of_range (const char *arg); -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_io (const char *msg); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_file_not_found (MonoString *fname); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_file_not_found2 (const char *msg, MonoString *fname); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_type_initialization (const char *type_name, MonoException *inner); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_synchronization_lock (const char *msg); MONO_API MonoException * @@ -135,28 +139,30 @@ mono_get_exception_appdomain_unloaded (void); MONO_API MonoException * mono_get_exception_bad_image_format (const char *msg); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname); MONO_API MonoException * mono_get_exception_stack_overflow (void); -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_out_of_memory (void); -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_field_access (void); MONO_API MonoException * mono_get_exception_method_access (void); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoException * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoException * mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception); /* Installs a function which is called when the runtime encounters an unhandled exception. diff --git a/mono/metadata/file-mmap.h b/mono/metadata/file-mmap.h index 2a79e8474e..e53bd3eeac 100644 --- a/mono/metadata/file-mmap.h +++ b/mono/metadata/file-mmap.h @@ -17,25 +17,33 @@ #include #include +#include +ICALL_EXPORT void mono_mmap_close (void *mmap_handle, MonoError *error); +ICALL_EXPORT void mono_mmap_configure_inheritability (void *mmap_handle, gboolean inheritability, MonoError *error); +ICALL_EXPORT void mono_mmap_flush (void *mmap_handle, MonoError *error); +ICALL_EXPORT void* mono_mmap_open_file (const gunichar2 *path, gint path_length, int mode, const gunichar2 *mapName, gint mapName_length, gint64 *capacity, int access, int options, int *win32error, MonoError *error); +ICALL_EXPORT void* mono_mmap_open_handle (void *handle, const gunichar2 *mapName, gint mapName_length, gint64 *capacity, int access, int options, int *win32error, MonoError *error); +ICALL_EXPORT int mono_mmap_map (void *handle, gint64 offset, gint64 *size, int access, void **mmap_handle, void **base_address, MonoError *error); +ICALL_EXPORT gboolean mono_mmap_unmap (void *base_address, MonoError *error); diff --git a/mono/metadata/filewatcher.c b/mono/metadata/filewatcher.c index c9263f1b68..d3e0237e6c 100644 --- a/mono/metadata/filewatcher.c +++ b/mono/metadata/filewatcher.c @@ -63,7 +63,9 @@ ves_icall_System_IO_FSW_SupportsFSW (void) if (getenv ("MONO_DARWIN_USE_KQUEUE_FSW")) return 3; /* kqueue */ else - return 6; /* FSEvent */ + return 6; /* CoreFX */ +#elif defined(HAVE_SYS_INOTIFY_H) && !defined(TARGET_ANDROID) + return 6; /* CoreFX */ #elif HAVE_KQUEUE return 3; /* kqueue */ #else @@ -72,11 +74,13 @@ ves_icall_System_IO_FSW_SupportsFSW (void) int inotify_instance; char *err; +#if defined (TARGET_ANDROID) inotify_instance = ves_icall_System_IO_InotifyWatcher_GetInotifyInstance (); if (inotify_instance != -1) { close (inotify_instance); return 5; /* inotify */ } +#endif fam_module = mono_dl_open ("libgamin-1.so", MONO_DL_LAZY, NULL); if (fam_module == NULL) { @@ -85,14 +89,14 @@ ves_icall_System_IO_FSW_SupportsFSW (void) } if (fam_module == NULL) - return 0; + return 0; /* DefaultWatcher */ err = mono_dl_symbol (fam_module, "FAMNextEvent", (gpointer *) &FAMNextEvent); g_free (err); if (FAMNextEvent == NULL) return 0; - return lib_used; + return lib_used; /* DefaultWatcher */ #endif } @@ -132,6 +136,7 @@ ves_icall_System_IO_FAMW_InternalFAMNextEvent (gpointer conn, } #endif +#if defined(TARGET_ANDROID) #ifndef HAVE_SYS_INOTIFY_H int ves_icall_System_IO_InotifyWatcher_GetInotifyInstance () { @@ -213,6 +218,7 @@ ves_icall_System_IO_InotifyWatcher_RemoveWatch (int fd, gint32 watch_descriptor) return inotify_rm_watch (fd, watch_descriptor); } #endif +#endif #if HAVE_KQUEUE @@ -265,34 +271,6 @@ ves_icall_System_IO_KqueueMonitor_kevent_notimeout (int *kq_ptr, gpointer change #endif /* #if HAVE_KQUEUE */ -#if defined(__APPLE__) - -#include - -static void -interrupt_CFRunLoop (gpointer data) -{ - g_assert (data); - CFRunLoopStop(data); -} - -void -ves_icall_CoreFX_Interop_RunLoop_CFRunLoopRun (void) -{ - gpointer runloop_ref = CFRunLoopGetCurrent(); - gboolean interrupted; - mono_thread_info_install_interrupt (interrupt_CFRunLoop, runloop_ref, &interrupted); - - if (interrupted) - return; - - MONO_ENTER_GC_SAFE; - CFRunLoopRun(); - MONO_EXIT_GC_SAFE; - - mono_thread_info_uninstall_interrupt (&interrupted); -} - #ifdef HOST_IOS MONO_API char* SystemNative_RealPath(const char* path) @@ -307,5 +285,3 @@ MONO_API void SystemNative_Sync(void) } #endif // HOST_IOS - -#endif /* #if defined(__APPLE__) */ diff --git a/mono/metadata/filewatcher.h b/mono/metadata/filewatcher.h index bad8e31869..6404507e14 100644 --- a/mono/metadata/filewatcher.h +++ b/mono/metadata/filewatcher.h @@ -14,6 +14,7 @@ #include #include "mono/utils/mono-compiler.h" #include +#include #ifdef HAVE_UNISTD_H #include @@ -21,26 +22,30 @@ G_BEGIN_DECLS +ICALL_EXPORT gint ves_icall_System_IO_FSW_SupportsFSW (void); +ICALL_EXPORT gboolean ves_icall_System_IO_FAMW_InternalFAMNextEvent (gpointer conn, MonoString **filename, gint *code, gint *reqnum); - +ICALL_EXPORT int ves_icall_System_IO_InotifyWatcher_GetInotifyInstance (void); + +ICALL_EXPORT int ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, MonoString *directory, gint32 mask); + +ICALL_EXPORT int ves_icall_System_IO_InotifyWatcher_RemoveWatch (int fd, gint32 watch_descriptor); +ICALL_EXPORT int ves_icall_System_IO_KqueueMonitor_kevent_notimeout (int *kq, gpointer changelist, int nchanges, gpointer eventlist, int nevents); -#if defined(__APPLE__) -void ves_icall_CoreFX_Interop_RunLoop_CFRunLoopRun (void); #ifdef HOST_IOS // This will obsoleted by System.Native as soon as it's ported to iOS MONO_API char* SystemNative_RealPath(const char* path); MONO_API void SystemNative_Sync (void); #endif -#endif G_END_DECLS diff --git a/mono/metadata/gc-internals.h b/mono/metadata/gc-internals.h index 4867847af0..ed57e02823 100644 --- a/mono/metadata/gc-internals.h +++ b/mono/metadata/gc-internals.h @@ -17,6 +17,7 @@ #include #include #include +#include #define mono_domain_finalizers_lock(domain) mono_os_mutex_lock (&(domain)->finalizable_objects_hash_lock); #define mono_domain_finalizers_unlock(domain) mono_os_mutex_unlock (&(domain)->finalizable_objects_hash_lock); @@ -57,23 +58,57 @@ #define IS_GC_REFERENCE(class,t) (mono_gc_is_moving () ? FALSE : ((t)->type == MONO_TYPE_U && (class)->image == mono_defaults.corlib)) void mono_object_register_finalizer (MonoObject *obj); + void mono_object_register_finalizer_handle (MonoObjectHandle obj); -void ves_icall_System_GC_InternalCollect (int generation); -gint64 ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection); -void ves_icall_System_GC_KeepAlive (MonoObject *obj); -void ves_icall_System_GC_ReRegisterForFinalize (MonoObject *obj); -void ves_icall_System_GC_SuppressFinalize (MonoObject *obj); -void ves_icall_System_GC_WaitForPendingFinalizers (void); +ICALL_EXPORT +void +ves_icall_System_GC_InternalCollect (int generation, MonoError *error); -MonoObject *ves_icall_System_GCHandle_GetTarget (guint32 handle); -guint32 ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint32 type); -void ves_icall_System_GCHandle_FreeHandle (guint32 handle); -gpointer ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle); -void ves_icall_System_GC_register_ephemeron_array (MonoObject *array); -MonoObject *ves_icall_System_GC_get_ephemeron_tombstone (void); +ICALL_EXPORT +gint64 +ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection, MonoError *error); +ICALL_EXPORT +void +ves_icall_System_GC_KeepAlive (MonoObjectHandle obj, MonoError *error); + +ICALL_EXPORT +void +ves_icall_System_GC_ReRegisterForFinalize (MonoObjectHandle obj, MonoError *error); + +ICALL_EXPORT +void +ves_icall_System_GC_SuppressFinalize (MonoObjectHandle obj, MonoError *error); + +ICALL_EXPORT +void +ves_icall_System_GC_WaitForPendingFinalizers (MonoError *error); + +ICALL_EXPORT +MonoObjectHandle +ves_icall_System_GCHandle_GetTarget (guint32 handle, MonoError *error); + +ICALL_EXPORT +guint32 +ves_icall_System_GCHandle_GetTargetHandle (MonoObjectHandle obj, guint32 handle, gint32 type, MonoError *error); + +ICALL_EXPORT +void +ves_icall_System_GCHandle_FreeHandle (guint32 handle, MonoError *error); + +ICALL_EXPORT +gpointer +ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle, MonoError *error); + +ICALL_EXPORT +void +ves_icall_System_GC_register_ephemeron_array (MonoObjectHandle array, MonoError *error); + +ICALL_EXPORT +MonoObjectHandle +ves_icall_System_GC_get_ephemeron_tombstone (MonoError *error); extern void mono_gc_init (void); extern void mono_gc_base_init (void); @@ -101,8 +136,9 @@ void mono_gchandle_set_target (guint32 gchandle, MonoObject *obj); /*Ephemeron functionality. Sgen only*/ gboolean mono_gc_ephemeron_array_add (MonoObject *obj); +ICALL_EXPORT MonoBoolean -mono_gc_GCHandle_CheckCurrentDomain (guint32 gchandle); +ves_icall_System_GCHandle_CheckCurrentDomain (guint32 gchandle, MonoError *error); /* User defined marking function */ /* It should work like this: @@ -232,6 +268,7 @@ void* mono_gc_get_range_copy_func (void); /* helper for the managed alloc support */ +ICALL_EXPORT MonoString * ves_icall_string_alloc (int length); @@ -315,6 +352,7 @@ void* mono_gc_invoke_with_gc_lock (MonoGCLockedCallbackFunc func, void *data); int mono_gc_get_los_limit (void); guint8* mono_gc_get_card_table (int *shift_bits, gpointer *card_mask); +guint8* mono_gc_get_target_card_table (int *shift_bits, gpointer *card_mask); gboolean mono_gc_card_table_nursery_check (void); void* mono_gc_get_nursery (int *shift_bits, size_t *size); diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c index 2d5eb39958..ca74b6708b 100644 --- a/mono/metadata/gc.c +++ b/mono/metadata/gc.c @@ -94,6 +94,9 @@ static void mono_reference_queue_cleanup (void); static void reference_queue_clear_for_domain (MonoDomain *domain); static void mono_runtime_do_background_work (void); +static MonoReferenceQueue* mono_gc_reference_queue_new_internal (mono_reference_queue_callback callback); +static gboolean mono_gc_reference_queue_add_internal (MonoReferenceQueue *queue, MonoObject *obj, void *user_data); + static MonoThreadInfoWaitRet guarded_wait (MonoThreadHandle *thread_handle, guint32 timeout, gboolean alertable) @@ -292,7 +295,9 @@ mono_gc_run_finalize (void *obj, void *data) #ifndef HOST_WASM if (!domain->finalize_runtime_invoke) { - MonoMethod *invoke = mono_marshal_get_runtime_invoke (mono_class_get_method_from_name_flags (mono_defaults.object_class, "Finalize", 0, 0), TRUE); + MonoMethod *finalize_method = mono_class_get_method_from_name_checked (mono_defaults.object_class, "Finalize", 0, 0, error); + mono_error_assert_ok (error); + MonoMethod *invoke = mono_marshal_get_runtime_invoke (finalize_method, TRUE); domain->finalize_runtime_invoke = mono_compile_method_checked (invoke, error); mono_error_assert_ok (error); /* expect this not to fail */ @@ -392,10 +397,17 @@ object_register_finalizer (MonoObject *obj, void (*callback)(void *, void*)) void mono_object_register_finalizer_handle (MonoObjectHandle obj) { - /* g_print ("Registered finalizer on %p %s.%s\n", obj, mono_object_class (obj)->name_space, mono_object_class (obj)->name); */ + /* g_print ("Registered finalizer on %p %s.%s\n", obj, mono_handle_class (obj)->name_space, mono_handle_class (obj)->name); */ object_register_finalizer (MONO_HANDLE_RAW (obj), mono_gc_run_finalize); } +static void +mono_object_unregister_finalizer_handle (MonoObjectHandle obj) +{ + /* g_print ("Unregistered finalizer on %p %s.%s\n", obj, mono_handle_class (obj)->name_space, mono_handle_class (obj)->name); */ + object_register_finalizer (MONO_HANDLE_RAW (obj), NULL); +} + void mono_object_register_finalizer (MonoObject *obj) { @@ -529,13 +541,13 @@ done: } void -ves_icall_System_GC_InternalCollect (int generation) +ves_icall_System_GC_InternalCollect (int generation, MonoError *error) { mono_gc_collect (generation); } gint64 -ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection) +ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection, MonoError *error) { if (forceCollection) mono_gc_collect (mono_gc_max_generation ()); @@ -543,7 +555,7 @@ ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection) } void -ves_icall_System_GC_KeepAlive (MonoObject *obj) +ves_icall_System_GC_KeepAlive (MonoObjectHandle obj, MonoError *error) { /* * Does nothing. @@ -551,34 +563,34 @@ ves_icall_System_GC_KeepAlive (MonoObject *obj) } void -ves_icall_System_GC_ReRegisterForFinalize (MonoObject *obj) +ves_icall_System_GC_ReRegisterForFinalize (MonoObjectHandle obj, MonoError *error) { - MONO_CHECK_ARG_NULL (obj,); + MONO_CHECK_ARG_NULL_HANDLE (obj,); - object_register_finalizer (obj, mono_gc_run_finalize); + mono_object_register_finalizer_handle (obj); } void -ves_icall_System_GC_SuppressFinalize (MonoObject *obj) +ves_icall_System_GC_SuppressFinalize (MonoObjectHandle obj, MonoError *error) { - MONO_CHECK_ARG_NULL (obj,); + MONO_CHECK_ARG_NULL_HANDLE (obj,); /* delegates have no finalizers, but we register them to deal with the * unmanaged->managed trampoline. We don't let the user suppress it * otherwise we'd leak it. */ - if (m_class_is_delegate (mono_object_class (obj))) + if (m_class_is_delegate (mono_handle_class (obj))) return; /* FIXME: Need to handle case where obj has COM Callable Wrapper * generated for it that needs cleaned up, but user wants to suppress * their derived object finalizer. */ - object_register_finalizer (obj, NULL); + mono_object_unregister_finalizer_handle (obj); } void -ves_icall_System_GC_WaitForPendingFinalizers (void) +ves_icall_System_GC_WaitForPendingFinalizers (MonoError *error) { if (mono_gc_is_null ()) return; @@ -620,48 +632,44 @@ ves_icall_System_GC_WaitForPendingFinalizers (void) } void -ves_icall_System_GC_register_ephemeron_array (MonoObject *array) +ves_icall_System_GC_register_ephemeron_array (MonoObjectHandle array, MonoError *error) { -#ifdef HAVE_SGEN_GC - if (!mono_gc_ephemeron_array_add (array)) { - mono_set_pending_exception (mono_object_domain (array)->out_of_memory_ex); - return; - } -#endif + if (!mono_gc_ephemeron_array_add (MONO_HANDLE_RAW (array))) + mono_error_set_exception_instance (error, MONO_HANDLE_DOMAIN (array)->out_of_memory_ex); } -MonoObject* -ves_icall_System_GC_get_ephemeron_tombstone (void) +MonoObjectHandle +ves_icall_System_GC_get_ephemeron_tombstone (MonoError *error) { - return mono_domain_get ()->ephemeron_tombstone; + return MONO_HANDLE_NEW (MonoObject, mono_domain_get ()->ephemeron_tombstone); } -MonoObject * -ves_icall_System_GCHandle_GetTarget (guint32 handle) +MonoObjectHandle +ves_icall_System_GCHandle_GetTarget (guint32 handle, MonoError *error) { - return mono_gchandle_get_target (handle); + return mono_gchandle_get_target_handle (handle); } /* * if type == -1, change the target of the handle, otherwise allocate a new handle. */ guint32 -ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint32 type) +ves_icall_System_GCHandle_GetTargetHandle (MonoObjectHandle obj, guint32 handle, gint32 type, MonoError *error) { if (type == -1) { - mono_gchandle_set_target (handle, obj); + mono_gchandle_set_target_handle (handle, obj); /* the handle doesn't change */ return handle; } switch (type) { case HANDLE_WEAK: - return mono_gchandle_new_weakref (obj, FALSE); + return mono_gchandle_new_weakref_from_handle (obj); case HANDLE_WEAK_TRACK: - return mono_gchandle_new_weakref (obj, TRUE); + return mono_gchandle_new_weakref_from_handle_track_resurrection (obj); case HANDLE_NORMAL: - return mono_gchandle_new (obj, FALSE); + return mono_gchandle_from_handle (obj, FALSE); case HANDLE_PINNED: - return mono_gchandle_new (obj, TRUE); + return mono_gchandle_from_handle (obj, TRUE); default: g_assert_not_reached (); } @@ -669,14 +677,16 @@ ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint } void -ves_icall_System_GCHandle_FreeHandle (guint32 handle) +ves_icall_System_GCHandle_FreeHandle (guint32 handle, MonoError *error) { mono_gchandle_free (handle); } gpointer -ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle) +ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle, MonoError *error) { + // Handles seem to only be in the way here, and the object is pinned. + MonoObject *obj; if (MONO_GC_HANDLE_TYPE (handle) != HANDLE_PINNED) @@ -684,6 +694,11 @@ ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle) obj = mono_gchandle_get_target (handle); if (obj) { MonoClass *klass = mono_object_class (obj); + + // FIXME This would be a good place for + // object->GetAddrOfPinnedObject() + // or klass->GetAddrOfPinnedObject(obj); + if (klass == mono_defaults.string_class) { return mono_string_chars ((MonoString*)obj); } else if (m_class_get_rank (klass)) { @@ -693,14 +708,14 @@ ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle) /* FIXME: missing !klass->blittable test, see bug #61134 */ if (mono_class_is_auto_layout (klass)) return (gpointer)-1; - return (char*)obj + sizeof (MonoObject); + return mono_object_get_data (obj); } } return NULL; } MonoBoolean -mono_gc_GCHandle_CheckCurrentDomain (guint32 gchandle) +ves_icall_System_GCHandle_CheckCurrentDomain (guint32 gchandle, MonoError *error) { return mono_gchandle_is_in_domain (gchandle, mono_domain_get ()); } @@ -1208,6 +1223,16 @@ reference_queue_clear_for_domain (MonoDomain *domain) */ MonoReferenceQueue* mono_gc_reference_queue_new (mono_reference_queue_callback callback) +{ + MonoReferenceQueue *result; + MONO_ENTER_GC_UNSAFE; + result = mono_gc_reference_queue_new_internal (callback); + MONO_EXIT_GC_UNSAFE; + return result; +} + +MonoReferenceQueue* +mono_gc_reference_queue_new_internal (mono_reference_queue_callback callback) { MonoReferenceQueue *res = g_new0 (MonoReferenceQueue, 1); res->callback = callback; @@ -1234,6 +1259,16 @@ mono_gc_reference_queue_new (mono_reference_queue_callback callback) */ gboolean mono_gc_reference_queue_add (MonoReferenceQueue *queue, MonoObject *obj, void *user_data) +{ + gboolean result; + MONO_ENTER_GC_UNSAFE; + result = mono_gc_reference_queue_add_internal (queue, obj, user_data); + MONO_EXIT_GC_UNSAFE; + return result; +} + +gboolean +mono_gc_reference_queue_add_internal (MonoReferenceQueue *queue, MonoObject *obj, void *user_data) { RefQueueEntry *entry; if (queue->should_be_deleted) diff --git a/mono/metadata/handle.c b/mono/metadata/handle.c index 33b01dcc86..e0ff8f58f7 100644 --- a/mono/metadata/handle.c +++ b/mono/metadata/handle.c @@ -94,7 +94,7 @@ free_handle_chunk (HandleChunk *chunk) g_free (chunk); } -const MonoObjectHandle mono_null_value_handle = NULL; +const MonoObjectHandle mono_null_value_handle; #define THIS_IS_AN_OK_NUMBER_OF_HANDLES 100 @@ -107,7 +107,11 @@ chunk_element (HandleChunk *chunk, int idx) static HandleChunkElem* handle_to_chunk_element (MonoObjectHandle o) { +#if MONO_TYPE_SAFE_HANDLES + return (HandleChunkElem*)o.__raw; +#else return (HandleChunkElem*)o; +#endif } /* Given a HandleChunkElem* search through the current handle stack to find its chunk and offset. */ @@ -240,7 +244,7 @@ retry: goto retry; } -MonoRawHandle +gpointer #ifndef MONO_HANDLE_TRACK_OWNER mono_handle_new_interior (gpointer rawptr) #else @@ -541,5 +545,11 @@ mono_array_handle_memcpy_refs (MonoArrayHandle dest, uintptr_t dest_idx, MonoArr gboolean mono_handle_stack_is_empty (HandleStack *stack) { - return (stack->top == stack->bottom && stack->top->size == 0); + return stack->top == stack->bottom && stack->top->size == 0; +} + +void +mono_gchandle_set_target_handle (guint32 gchandle, MonoObjectHandle obj) +{ + mono_gchandle_set_target (gchandle, MONO_HANDLE_RAW (obj)); } diff --git a/mono/metadata/handle.h b/mono/metadata/handle.h index dbee3b5ff3..4a4a2aedb0 100644 --- a/mono/metadata/handle.h +++ b/mono/metadata/handle.h @@ -24,6 +24,34 @@ #include #include +// Type-safe handles are a struct with a pointer to pointer. +// The only operations allowed on them are the functions/macros in this file, and assignment +// from same handle type to same handle type. +// +// Type-unsafe handles are a pointer to a struct with a pointer. +// Besides the type-safe operations, these can also be: +// 1. compared to NULL, instead of only MONO_HANDLE_IS_NULL +// 2. assigned from NULL, instead of only a handle +// 3. MONO_HANDLE_NEW (T) from anything, instead of only a T* +// 4. MONO_HANDLE_CAST from anything, instead of only another handle type +// 5. assigned from any void*, at least in C +// 6. Cast from any handle type to any handle type, without using MONO_HANDLE_CAST. +// 7. Cast from any handle type to any pointer type and vice versa, such as incorrect unboxing. +// 8. mono_object_class (handle), instead of mono_handle_class +// +// None of those operations were likely intended. +// +// FIXME Do this only on checked builds? Or certain architectures? +// There is not runtime cost. +// NOTE: Running this code depends on the ABI to pass a struct +// with a pointer the same as a pointer. This is tied in with +// marshaling. If this is not the case, turn off type-safety, perhaps per-OS per-CPU. +#if defined (HOST_DARWIN) || defined (HOST_WIN32) || defined (HOST_ARM64) || defined (HOST_ARM) || defined (HOST_AMD64) +#define MONO_TYPE_SAFE_HANDLES 1 +#else +#define MONO_TYPE_SAFE_HANDLES 0 // PowerPC, S390X, SPARC, MIPS, Linux/x86, BSD/x86, etc. +#endif + G_BEGIN_DECLS /* @@ -125,12 +153,10 @@ typedef void (*GcScanFunc) (gpointer*, gpointer); #ifndef MONO_HANDLE_TRACK_OWNER MonoRawHandle mono_handle_new (MonoObject *object); -MonoRawHandle mono_handle_new_full (gpointer rawptr, gboolean interior); -MonoRawHandle mono_handle_new_interior (gpointer rawptr); +gpointer mono_handle_new_interior (gpointer rawptr); #else MonoRawHandle mono_handle_new (MonoObject *object, const char* owner); -MonoRawHandle mono_handle_new_full (gpointer rawptr, gboolean interior, const char *owner); -MonoRawHandle mono_handle_new_interior (gpointer rawptr, const char *owner); +gpointer mono_handle_new_interior (gpointer rawptr, const char *owner); #endif void mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data, gboolean precise, gboolean check); @@ -149,7 +175,7 @@ static inline void mono_stack_mark_init (MonoThreadInfo *info, HandleStackMark *stackmark) { #ifdef MONO_HANDLE_TRACK_SP - gpointer sptop = (gpointer)(intptr_t)&stackmark; + gpointer sptop = &stackmark; #endif HandleStack *handles = (HandleStack *)info->handle_stack; stackmark->size = handles->top->size; @@ -200,7 +226,6 @@ Icall macros mono_stack_mark_record_size (__info, &__mark, __FUNCTION__); \ (RESULT) = mono_stack_mark_pop_value (__info, &__mark, (HANDLE)); - #define HANDLE_FUNCTION_ENTER() do { \ MonoThreadInfo *__info = mono_thread_info_current (); \ SETUP_ICALL_FRAME \ @@ -223,6 +248,18 @@ Icall macros return __result; \ } while (0); } while (0); +#if MONO_TYPE_SAFE_HANDLES + +// Return a coop handle from coop handle. +#define HANDLE_FUNCTION_RETURN_REF(TYPE, HANDLE) \ + do { \ + MonoObjectHandle __result; \ + CLEAR_ICALL_FRAME_VALUE (__result.__raw, (HANDLE).__raw); \ + return MONO_HANDLE_CAST (TYPE, __result); \ + } while (0); } while (0); + +#else + // Return a coop handle from coop handle. #define HANDLE_FUNCTION_RETURN_REF(TYPE, HANDLE) \ do { \ @@ -231,6 +268,8 @@ Icall macros return MONO_HANDLE_CAST (TYPE, __result); \ } while (0); } while (0); +#endif + #ifdef MONO_NEEDS_STACK_WATERMARK static void @@ -298,10 +337,14 @@ Handle macros/functions #define TYPED_HANDLE_NAME(TYPE) TYPE ## Handle #define TYPED_OUT_HANDLE_NAME(TYPE) TYPE ## HandleOut +// internal helpers: +#define MONO_HANDLE_CAST_FOR(type) mono_handle_cast_##type +#define MONO_HANDLE_TYPECHECK_FOR(type) mono_handle_typecheck_##type + #ifdef MONO_HANDLE_TRACK_OWNER #define STRINGIFY_(x) #x #define STRINGIFY(x) STRINGIFY_(x) -#define HANDLE_OWNER_STRINGIFY(file,lineno) (const char*) (file ":" STRINGIFY(lineno)) +#define HANDLE_OWNER (__FILE__ ":" STRINGIFY (__LINE__)) #endif @@ -311,26 +354,58 @@ Handle macros/functions * * For example, TYPED_HANDLE_DECL(MonoObject) (see below) expands to: * + * #if MONO_TYPE_SAFE_HANDLES + * + * typedef struct { + * MonoObject **__raw; + * } MonoObjectHandlePayload, + * MonoObjectHandle, + * MonoObjectHandleOut; + * + * Internal helper functions are also generated. + * + * #else + * * typedef struct { * MonoObject *__raw; * } MonoObjectHandlePayload; * * typedef MonoObjectHandlePayload* MonoObjectHandle; * typedef MonoObjectHandlePayload* MonoObjectHandleOut; + * + * #endif */ + +#if MONO_TYPE_SAFE_HANDLES +#define TYPED_HANDLE_DECL(TYPE) \ + typedef struct { TYPE **__raw; } TYPED_HANDLE_PAYLOAD_NAME (TYPE), \ + TYPED_HANDLE_NAME (TYPE), \ + TYPED_OUT_HANDLE_NAME (TYPE); \ +/* Do not call these functions directly. Use MONO_HANDLE_NEW and MONO_HANDLE_CAST. */ \ +/* Another way to do this involved casting mono_handle_new function to a different type. */ \ +static inline MONO_ALWAYS_INLINE TYPED_HANDLE_NAME (TYPE) \ +MONO_HANDLE_CAST_FOR (TYPE) (gpointer a) \ +{ \ + TYPED_HANDLE_NAME (TYPE) b = { (TYPE**)a }; \ + return b; \ +} \ +static inline MONO_ALWAYS_INLINE gpointer \ +MONO_HANDLE_TYPECHECK_FOR (TYPE) (TYPE *a) \ +{ \ + return a; \ +} + +#else #define TYPED_HANDLE_DECL(TYPE) \ typedef struct { TYPE *__raw; } TYPED_HANDLE_PAYLOAD_NAME (TYPE) ; \ typedef TYPED_HANDLE_PAYLOAD_NAME (TYPE) * TYPED_HANDLE_NAME (TYPE); \ typedef TYPED_HANDLE_PAYLOAD_NAME (TYPE) * TYPED_OUT_HANDLE_NAME (TYPE) +#endif + /* * TYPED_VALUE_HANDLE_DECL(SomeType): * Expands to a decl for handles to SomeType (which is a managed valuetype (likely a struct) of some sort) and to an internal payload struct. - * For example TYPED_HANDLE_DECL(MonoMethodInfo) expands to: - * - * typedef struct { - * MonoMethodInfo *__raw; - * } MonoMethodInfoHandlePayload; - * typedef MonoMethodInfoHandlePayload* MonoMethodInfoHandle; + * It is currently identical to TYPED_HANDLE_DECL (valuetypes vs. referencetypes). */ #define TYPED_VALUE_HANDLE_DECL(TYPE) TYPED_HANDLE_DECL(TYPE) @@ -338,23 +413,51 @@ Handle macros/functions #define MONO_HANDLE_PAYLOAD_OFFSET_(PayloadType) MONO_STRUCT_OFFSET(PayloadType, __raw) #define MONO_HANDLE_PAYLOAD_OFFSET(TYPE) MONO_HANDLE_PAYLOAD_OFFSET_(TYPED_HANDLE_PAYLOAD_NAME (TYPE)) -#define MONO_HANDLE_INIT ((void*) mono_null_value_handle) -#define NULL_HANDLE mono_null_value_handle - //XXX add functions to get/set raw, set field, set field to null, set array, set array to null -#define MONO_HANDLE_RAW(HANDLE) ((HANDLE)->__raw) #define MONO_HANDLE_DCL(TYPE, NAME) TYPED_HANDLE_NAME(TYPE) NAME = MONO_HANDLE_NEW (TYPE, (NAME ## _raw)) +// With Visual C++ compiling as C, the type of a ternary expression +// yielding two unrelated non-void pointers is the type of the first, plus a warning. +// This can be used to simulate gcc typeof extension. +// Otherwise we are forced to evaluate twice, or use C++. +#ifdef _MSC_VER +typedef struct _MonoTypeofCastHelper *MonoTypeofCastHelper; // a pointer type unrelated to anything else +#define MONO_TYPEOF_CAST(typeexpr, expr) __pragma(warning(suppress:4133))(0 ? (typeexpr) : (MonoTypeofCastHelper)(expr)) +#else +#define MONO_TYPEOF_CAST(typeexpr, expr) ((typeof (typeexpr))(expr)) +#endif + +#if MONO_TYPE_SAFE_HANDLES + +#ifndef MONO_HANDLE_TRACK_OWNER + +#define MONO_HANDLE_NEW(type, object) \ + (MONO_HANDLE_CAST_FOR (type) (mono_handle_new (MONO_HANDLE_TYPECHECK_FOR (type) (object)))) + +#else + +#define MONO_HANDLE_NEW(type, object) \ + (MONO_HANDLE_CAST_FOR (type) (mono_handle_new (MONO_HANDLE_TYPECHECK_FOR (type) (object), HANDLE_OWNER))) + +#endif + +#define MONO_HANDLE_CAST(type, value) (MONO_HANDLE_CAST_FOR (type) ((value).__raw)) +#define MONO_HANDLE_RAW(handle) (MONO_TYPEOF_CAST (*(handle).__raw, mono_handle_raw ((handle).__raw))) +#define MONO_HANDLE_IS_NULL(handle) (mono_handle_is_null ((handle).__raw)) + +#else // MONO_TYPE_SAFE_HANDLES + #ifndef MONO_HANDLE_TRACK_OWNER #define MONO_HANDLE_NEW(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( mono_handle_new ((MonoObject*)(VALUE)) ) #else -#define MONO_HANDLE_NEW(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( mono_handle_new ((MonoObject*)(VALUE), HANDLE_OWNER_STRINGIFY(__FILE__, __LINE__))) +#define MONO_HANDLE_NEW(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( mono_handle_new ((MonoObject*)(VALUE), HANDLE_OWNER)) #endif - #define MONO_HANDLE_CAST(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( VALUE ) -#define MONO_HANDLE_IS_NULL(HANDLE) (MONO_HANDLE_SUPPRESS (MONO_HANDLE_RAW(HANDLE) == NULL)) +#define MONO_HANDLE_RAW(handle) (MONO_TYPEOF_CAST ((handle)->__raw, mono_handle_raw (handle))) +#define MONO_HANDLE_IS_NULL(handle) (mono_handle_is_null (handle)) +#endif // MONO_TYPE_SAFE_HANDLES /* WARNING WARNING WARNING @@ -379,12 +482,24 @@ This is why we evaluate index and value before any call to MONO_HANDLE_RAW or ot } while (0); \ } while (0) +#if MONO_TYPE_SAFE_HANDLES + +/* N.B. RESULT is evaluated before HANDLE */ +#define MONO_HANDLE_GET(RESULT, HANDLE, FIELD) do { \ + MonoObjectHandle __dest = MONO_HANDLE_CAST (MonoObject, RESULT); \ + MONO_HANDLE_SUPPRESS (*(gpointer*)__dest.__raw = (gpointer)MONO_HANDLE_RAW (MONO_HANDLE_UNSUPPRESS (HANDLE))->FIELD); \ + } while (0) + +#else + /* N.B. RESULT is evaluated before HANDLE */ #define MONO_HANDLE_GET(RESULT, HANDLE, FIELD) do { \ MonoObjectHandle __dest = MONO_HANDLE_CAST(MonoObject, RESULT); \ MONO_HANDLE_SUPPRESS (*(gpointer*)&__dest->__raw = (gpointer)MONO_HANDLE_RAW (MONO_HANDLE_UNSUPPRESS (HANDLE))->FIELD); \ } while (0) +#endif + // Get ((type)handle)->field as a handle. #define MONO_HANDLE_NEW_GET(TYPE,HANDLE,FIELD) (MONO_HANDLE_NEW(TYPE,MONO_HANDLE_SUPPRESS (MONO_HANDLE_RAW (MONO_HANDLE_UNSUPPRESS (HANDLE))->FIELD))) @@ -470,26 +585,82 @@ TYPED_HANDLE_DECL (MonoObject); TYPED_HANDLE_DECL (MonoException); TYPED_HANDLE_DECL (MonoAppContext); +#if MONO_TYPE_SAFE_HANDLES + +// Structs cannot be cast to structs. +// Therefore, cast the function pointer to change its return type. +// As well, a function is needed because an anonymous struct cannot be initialized in C. +static inline MonoObjectHandle +mono_handle_cast (gpointer a) +{ + return *(MonoObjectHandle*)&a; +} + +#endif + +static inline MONO_ALWAYS_INLINE gboolean +mono_handle_is_null (MonoRawHandle raw_handle) +{ + MONO_HANDLE_SUPPRESS_SCOPE (1); +#if MONO_TYPE_SAFE_HANDLES + MonoObjectHandle *handle = (MonoObjectHandle*)&raw_handle; + return !handle->__raw || !*handle->__raw; +#else + MonoObjectHandle handle = (MonoObjectHandle)raw_handle; + return !handle || !handle->__raw; +#endif +} + +static inline MONO_ALWAYS_INLINE gpointer +mono_handle_raw (MonoRawHandle raw_handle) +{ + MONO_HANDLE_SUPPRESS_SCOPE (1); +#if MONO_TYPE_SAFE_HANDLES + MonoObjectHandle *handle = (MonoObjectHandle*)&raw_handle; + return handle->__raw ? *handle->__raw : NULL; +#else + MonoObjectHandle handle = (MonoObjectHandle)raw_handle; + return handle ? handle->__raw : NULL; +#endif +} + /* Unfortunately MonoThreadHandle is already a typedef used for something unrelated. So * the coop handle for MonoThread* is MonoThreadObjectHandle. */ typedef MonoThread MonoThreadObject; TYPED_HANDLE_DECL (MonoThreadObject); -#define NULL_HANDLE_STRING MONO_HANDLE_CAST(MonoString, NULL_HANDLE) - /* This is the constant for a handle that points nowhere. -Init values to it. +Constant handles may be initialized to it, but non-constant +handles must be NEW'ed. Uses of these are suspicious and should +be reviewed and probably changed FIXME. */ extern const MonoObjectHandle mono_null_value_handle; +#define NULL_HANDLE mono_null_value_handle +#define NULL_HANDLE_STRING (MONO_HANDLE_CAST (MonoString, NULL_HANDLE)) +#define NULL_HANDLE_ARRAY (MONO_HANDLE_CAST (MonoArray, NULL_HANDLE)) + +#if MONO_TYPE_SAFE_HANDLES static inline void mono_handle_assign (MonoObjectHandleOut dest, MonoObjectHandle src) { - MONO_HANDLE_SUPPRESS (dest->__raw = (gpointer)(src ? MONO_HANDLE_RAW (src) : NULL)); + g_assert (dest.__raw); + MONO_HANDLE_SUPPRESS (*dest.__raw = src.__raw ? *src.__raw : NULL); } +#else + +static inline void +mono_handle_assign (MonoObjectHandleOut dest, MonoObjectHandle src) +{ + g_assert (dest); + MONO_HANDLE_SUPPRESS (dest->__raw = (MonoObject *)(src ? MONO_HANDLE_RAW (src) : NULL)); +} + +#endif + /* It is unsafe to call this function directly - it does not pin the handle! Use MONO_HANDLE_GET_FIELD_VAL(). */ static inline gpointer mono_handle_unsafe_field_addr (MonoObjectHandle h, MonoClassField *field) @@ -503,13 +674,18 @@ MonoArrayHandle mono_array_new_handle (MonoDomain *domain, MonoClass *eclass, ui MonoArrayHandle mono_array_new_full_handle (MonoDomain *domain, MonoClass *array_class, uintptr_t *lengths, intptr_t *lower_bounds, MonoError *error); - -uintptr_t mono_array_handle_length (MonoArrayHandle arr); +uintptr_t +mono_array_handle_length (MonoArrayHandle arr); static inline void mono_handle_array_getref (MonoObjectHandleOut dest, MonoArrayHandle array, uintptr_t index) { - MONO_HANDLE_SUPPRESS (dest->__raw = (gpointer)mono_array_get(MONO_HANDLE_RAW (array), gpointer, index)); +#if MONO_TYPE_SAFE_HANDLES + MONO_HANDLE_SUPPRESS (g_assert (dest.__raw)); + MONO_HANDLE_SUPPRESS (*dest.__raw = (MonoObject*)mono_array_get(MONO_HANDLE_RAW (array), gpointer, index)); +#else + MONO_HANDLE_SUPPRESS (dest->__raw = (MonoObject *)mono_array_get(MONO_HANDLE_RAW (array), gpointer, index)); +#endif } #define mono_handle_class(o) MONO_HANDLE_SUPPRESS (mono_object_class (MONO_HANDLE_RAW (MONO_HANDLE_UNSUPPRESS (o)))) @@ -522,6 +698,28 @@ mono_gchandle_from_handle (MonoObjectHandle handle, mono_bool pinned); MonoObjectHandle mono_gchandle_get_target_handle (uint32_t gchandle); +static inline gboolean +mono_gchandle_target_equal (uint32_t gchandle, MonoObjectHandle equal) +{ + // This function serves to reduce coop handle creation. + MONO_HANDLE_SUPPRESS_SCOPE (1); + return mono_gchandle_get_target (gchandle) == MONO_HANDLE_RAW (equal); +} + +static inline void +mono_gchandle_target_is_null_or_equal (uint32_t gchandle, MonoObjectHandle equal, gboolean *is_null, + gboolean *is_equal) +{ + // This function serves to reduce coop handle creation. + MONO_HANDLE_SUPPRESS_SCOPE (1); + MonoObject *target = mono_gchandle_get_target (gchandle); + *is_null = target == NULL; + *is_equal = target == MONO_HANDLE_RAW (equal); +} + +void +mono_gchandle_set_target_handle (guint32 gchandle, MonoObjectHandle obj); + void mono_array_handle_memcpy_refs (MonoArrayHandle dest, uintptr_t dest_idx, MonoArrayHandle src, uintptr_t src_idx, uintptr_t len); @@ -562,6 +760,18 @@ mono_gchandle_new_weakref_from_handle (MonoObjectHandle handle) return mono_gchandle_new_weakref (MONO_HANDLE_SUPPRESS (MONO_HANDLE_RAW (handle)), FALSE); } +static inline int +mono_handle_hash (MonoObjectHandle object) +{ + return mono_object_hash (MONO_HANDLE_SUPPRESS (MONO_HANDLE_RAW (object))); +} + +static inline guint32 +mono_gchandle_new_weakref_from_handle_track_resurrection (MonoObjectHandle handle) +{ + return mono_gchandle_new_weakref (MONO_HANDLE_SUPPRESS (MONO_HANDLE_RAW (handle)), TRUE); +} + G_END_DECLS #endif /* __MONO_HANDLE_H__ */ diff --git a/mono/metadata/icall-def.h b/mono/metadata/icall-def.h index e10d991533..0d99a094d6 100644 --- a/mono/metadata/icall-def.h +++ b/mono/metadata/icall-def.h @@ -64,10 +64,8 @@ * Limitations: "out" and "ref" arguments are not supported yet. */ - #if defined(__APPLE__) -ICALL_TYPE(CLR_INTEROP, "Interop/RunLoop", CLR_INTEROP_1) -ICALL(CLR_INTEROP_1, "CFRunLoopRun", ves_icall_CoreFX_Interop_RunLoop_CFRunLoopRun) -#endif +ICALL_TYPE(CLR_INTEROP_SYS, "Interop/Sys", CLR_INTEROP_SYS_1) +NOHANDLES(ICALL(CLR_INTEROP_SYS_1, "DoubleToString", ves_icall_Interop_Sys_DoubleToString)) ICALL_TYPE(NATIVEMETHODS, "Microsoft.Win32.NativeMethods", NATIVEMETHODS_1) HANDLES(ICALL(NATIVEMETHODS_1, "CloseProcess", ves_icall_Microsoft_Win32_NativeMethods_CloseProcess)) @@ -114,11 +112,11 @@ HANDLES(ICALL(SAFESTRMARSHAL_2, "StringToUtf8", ves_icall_Mono_SafeStringMarshal #ifndef PLATFORM_RO_FS ICALL_TYPE(KPAIR, "Mono.Security.Cryptography.KeyPairPersistence", KPAIR_1) -ICALL(KPAIR_1, "_CanSecure", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure) -ICALL(KPAIR_2, "_IsMachineProtected", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected) -ICALL(KPAIR_3, "_IsUserProtected", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected) -ICALL(KPAIR_4, "_ProtectMachine", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine) -ICALL(KPAIR_5, "_ProtectUser", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser) +HANDLES(ICALL(KPAIR_1, "_CanSecure", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure)) +HANDLES(ICALL(KPAIR_2, "_IsMachineProtected", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected)) +HANDLES(ICALL(KPAIR_3, "_IsUserProtected", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected)) +HANDLES(ICALL(KPAIR_4, "_ProtectMachine", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine)) +HANDLES(ICALL(KPAIR_5, "_ProtectUser", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser)) #endif /* !PLATFORM_RO_FS */ ICALL_TYPE(APPDOM, "System.AppDomain", APPDOM_23) @@ -153,18 +151,19 @@ ICALL(ARGI_3, "IntGetNextArgType", mono_ArgIterator_IntGetNextArg ICALL(ARGI_4, "Setup", mono_ArgIterator_Setup) ICALL_TYPE(ARRAY, "System.Array", ARRAY_1) -ICALL(ARRAY_1, "ClearInternal", ves_icall_System_Array_ClearInternal) -ICALL(ARRAY_3, "CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl) -ICALL(ARRAY_14, "CreateInstanceImpl64", ves_icall_System_Array_CreateInstanceImpl64) +HANDLES(ICALL(ARRAY_1, "ClearInternal", ves_icall_System_Array_ClearInternal)) +HANDLES(ICALL(ARRAY_3, "CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl)) ICALL(ARRAY_4, "FastCopy", ves_icall_System_Array_FastCopy) -ICALL(ARRAY_5, "GetGenericValueImpl", ves_icall_System_Array_GetGenericValueImpl) -ICALL(ARRAY_6, "GetLength", ves_icall_System_Array_GetLength) -ICALL(ARRAY_15, "GetLongLength", ves_icall_System_Array_GetLongLength) -ICALL(ARRAY_7, "GetLowerBound", ves_icall_System_Array_GetLowerBound) -ICALL(ARRAY_8, "GetRank", ves_icall_System_Array_GetRank) -ICALL(ARRAY_9, "GetValue", ves_icall_System_Array_GetValue) -ICALL(ARRAY_10, "GetValueImpl", ves_icall_System_Array_GetValueImpl) -ICALL(ARRAY_11, "SetGenericValueImpl", ves_icall_System_Array_SetGenericValueImpl) +// Generic ref/out parameters are not supported by HANDLES(), so NOHANDLES(). +NOHANDLES(ICALL(ARRAY_5, "GetGenericValueImpl", ves_icall_System_Array_GetGenericValueImpl)) +HANDLES(ICALL(ARRAY_6, "GetLength", ves_icall_System_Array_GetLength)) +HANDLES(ICALL(ARRAY_15, "GetLongLength", ves_icall_System_Array_GetLongLength)) +HANDLES(ICALL(ARRAY_7, "GetLowerBound", ves_icall_System_Array_GetLowerBound)) +HANDLES(ICALL(ARRAY_8, "GetRank", ves_icall_System_Array_GetRank)) +HANDLES(ICALL(ARRAY_9, "GetValue", ves_icall_System_Array_GetValue)) +HANDLES(ICALL(ARRAY_10, "GetValueImpl", ves_icall_System_Array_GetValueImpl)) +// Generic ref/out parameters are not supported by HANDLES(), so NOHANDLES(). +NOHANDLES(ICALL(ARRAY_11, "SetGenericValueImpl", ves_icall_System_Array_SetGenericValueImpl)) HANDLES(ICALL(ARRAY_12, "SetValue", ves_icall_System_Array_SetValue)) HANDLES(ICALL(ARRAY_13, "SetValueImpl", ves_icall_System_Array_SetValueImpl)) @@ -196,23 +195,6 @@ HANDLES(ICALL(CONSOLE_5, "TtySetup", ves_icall_System_ConsoleDriver_TtySetup)) ICALL_TYPE(DTIME, "System.DateTime", DTIME_1) ICALL(DTIME_1, "GetSystemTimeAsFileTime", mono_100ns_datetime) -#ifndef DISABLE_DECIMAL -ICALL_TYPE(DECIMAL, "System.Decimal", DECIMAL_1) -NOHANDLES(ICALL(DECIMAL_1, ".ctor(double)", mono_decimal_init_double)) -NOHANDLES(ICALL(DECIMAL_2, ".ctor(single)", mono_decimal_init_single)) -NOHANDLES(ICALL(DECIMAL_3, "FCallAddSub(System.Decimal&,System.Decimal&,byte)", mono_decimal_addsub)) -NOHANDLES(ICALL(DECIMAL_4, "FCallCompare", mono_decimal_compare)) -NOHANDLES(ICALL(DECIMAL_5, "FCallDivide", mono_decimal_divide)) -NOHANDLES(ICALL(DECIMAL_6, "FCallFloor", mono_decimal_floor)) -NOHANDLES(ICALL(DECIMAL_7, "FCallMultiply", mono_decimal_multiply)) -NOHANDLES(ICALL(DECIMAL_8, "FCallRound", mono_decimal_round)) -NOHANDLES(ICALL(DECIMAL_9, "FCallToInt32", mono_decimal_to_int32)) -NOHANDLES(ICALL(DECIMAL_10, "FCallTruncate", mono_decimal_truncate)) -NOHANDLES(ICALL(DECIMAL_11, "GetHashCode", mono_decimal_get_hash_code)) -NOHANDLES(ICALL(DECIMAL_12, "ToDouble", mono_decimal_to_double)) -NOHANDLES(ICALL(DECIMAL_13, "ToSingle", mono_decimal_to_float)) -#endif - ICALL_TYPE(DELEGATE, "System.Delegate", DELEGATE_1) HANDLES(ICALL(DELEGATE_1, "AllocDelegateLike_internal", ves_icall_System_Delegate_AllocDelegateLike_internal)) HANDLES(ICALL(DELEGATE_2, "CreateDelegate_internal", ves_icall_System_Delegate_CreateDelegate_internal)) @@ -246,13 +228,13 @@ ICALL(PERFCTRCAT_7, "GetInstanceNames", mono_perfcounter_instance_names) ICALL(PERFCTRCAT_8, "InstanceExistsInternal", mono_perfcounter_instance_exists) ICALL_TYPE(PROCESS, "System.Diagnostics.Process", PROCESS_1) -ICALL(PROCESS_1, "CreateProcess_internal", ves_icall_System_Diagnostics_Process_CreateProcess_internal) +HANDLES(ICALL(PROCESS_1, "CreateProcess_internal", ves_icall_System_Diagnostics_Process_CreateProcess_internal)) ICALL(PROCESS_4, "GetModules_internal(intptr)", ves_icall_System_Diagnostics_Process_GetModules_internal) ICALL(PROCESS_5H, "GetProcessData", ves_icall_System_Diagnostics_Process_GetProcessData) ICALL(PROCESS_6, "GetProcess_internal(int)", ves_icall_System_Diagnostics_Process_GetProcess_internal) ICALL(PROCESS_7, "GetProcesses_internal()", ves_icall_System_Diagnostics_Process_GetProcesses_internal) ICALL(PROCESS_10, "ProcessName_internal(intptr)", ves_icall_System_Diagnostics_Process_ProcessName_internal) -ICALL(PROCESS_13, "ShellExecuteEx_internal(System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process/ProcInfo&)", ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal) +HANDLES(ICALL(PROCESS_13, "ShellExecuteEx_internal(System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process/ProcInfo&)", ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal)) ICALL_TYPE(STOPWATCH, "System.Diagnostics.Stopwatch", STOPWATCH_1) ICALL(STOPWATCH_1, "GetTimestamp", mono_100ns_ticks) @@ -293,18 +275,18 @@ HANDLES(ICALL(ENV_19, "internalGetHome", ves_icall_System_Environment_InternalGe ICALL(ENV_20, "set_ExitCode", mono_environment_exitcode_set) ICALL_TYPE(GC, "System.GC", GC_0) -ICALL(GC_0, "GetCollectionCount", mono_gc_collection_count) -ICALL(GC_0a, "GetGeneration", mono_gc_get_generation) -ICALL(GC_0b, "GetMaxGeneration", mono_gc_max_generation) -ICALL(GC_1, "GetTotalMemory", ves_icall_System_GC_GetTotalMemory) -ICALL(GC_2, "InternalCollect", ves_icall_System_GC_InternalCollect) -ICALL(GC_3, "KeepAlive", ves_icall_System_GC_KeepAlive) -ICALL(GC_4a, "RecordPressure", mono_gc_add_memory_pressure) -ICALL(GC_6, "WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers) -ICALL(GC_6b, "_ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize) -ICALL(GC_7, "_SuppressFinalize", ves_icall_System_GC_SuppressFinalize) -ICALL(GC_9, "get_ephemeron_tombstone", ves_icall_System_GC_get_ephemeron_tombstone) -ICALL(GC_8, "register_ephemeron_array", ves_icall_System_GC_register_ephemeron_array) +HANDLES(ICALL(GC_0, "GetCollectionCount", ves_icall_System_GC_GetCollectionCount)) +HANDLES(ICALL(GC_0a, "GetGeneration", ves_icall_System_GC_GetGeneration)) +HANDLES(ICALL(GC_0b, "GetMaxGeneration", ves_icall_System_GC_GetMaxGeneration)) +HANDLES(ICALL(GC_1, "GetTotalMemory", ves_icall_System_GC_GetTotalMemory)) +HANDLES(ICALL(GC_2, "InternalCollect", ves_icall_System_GC_InternalCollect)) +HANDLES(ICALL(GC_3, "KeepAlive", ves_icall_System_GC_KeepAlive)) +HANDLES(ICALL(GC_4a, "RecordPressure", ves_icall_System_GC_RecordPressure)) +HANDLES(ICALL(GC_6, "WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers)) +HANDLES(ICALL(GC_6b, "_ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize)) +HANDLES(ICALL(GC_7, "_SuppressFinalize", ves_icall_System_GC_SuppressFinalize)) +HANDLES(ICALL(GC_9, "get_ephemeron_tombstone", ves_icall_System_GC_get_ephemeron_tombstone)) +HANDLES(ICALL(GC_8, "register_ephemeron_array", ves_icall_System_GC_register_ephemeron_array)) ICALL_TYPE(CALDATA, "System.Globalization.CalendarData", CALDATA_1) ICALL(CALDATA_1, "fill_calendar_data", ves_icall_System_Globalization_CalendarData_fill_calendar_data) @@ -343,10 +325,12 @@ ICALL(FAMW_1, "InternalFAMNextEvent", ves_icall_System_IO_FAMW_InternalFAMNextEv ICALL_TYPE(FILEW, "System.IO.FileSystemWatcher", FILEW_4) ICALL(FILEW_4, "InternalSupportsFSW", ves_icall_System_IO_FSW_SupportsFSW) +#if defined (TARGET_ANDROID) ICALL_TYPE(INOW, "System.IO.InotifyWatcher", INOW_1) ICALL(INOW_1, "AddWatch", ves_icall_System_IO_InotifyWatcher_AddWatch) ICALL(INOW_2, "GetInotifyInstance", ves_icall_System_IO_InotifyWatcher_GetInotifyInstance) ICALL(INOW_3, "RemoveWatch", ves_icall_System_IO_InotifyWatcher_RemoveWatch) +#endif ICALL_TYPE(KQUEM, "System.IO.KqueueMonitor", KQUEM_1) ICALL(KQUEM_1, "kevent_notimeout", ves_icall_System_IO_KqueueMonitor_kevent_notimeout) @@ -365,51 +349,51 @@ HANDLES(ICALL(MMAPIMPL_6, "OpenHandleInternal", mono_mmap_open_handle)) HANDLES(ICALL(MMAPIMPL_7, "Unmap", mono_mmap_unmap)) ICALL_TYPE(MONOIO, "System.IO.MonoIO", MONOIO_1) -ICALL(MONOIO_1, "Close(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Close) +NOHANDLES(ICALL(MONOIO_1, "Close(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Close)) #ifndef PLATFORM_RO_FS -ICALL(MONOIO_2, "CopyFile(char*,char*,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CopyFile) -ICALL(MONOIO_3, "CreateDirectory(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CreateDirectory) -ICALL(MONOIO_4, "CreatePipe", ves_icall_System_IO_MonoIO_CreatePipe) -ICALL(MONOIO_5, "DeleteFile(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_DeleteFile) +NOHANDLES(ICALL(MONOIO_2, "CopyFile(char*,char*,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CopyFile)) +NOHANDLES(ICALL(MONOIO_3, "CreateDirectory(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_CreateDirectory)) +NOHANDLES(ICALL(MONOIO_4, "CreatePipe", ves_icall_System_IO_MonoIO_CreatePipe)) +NOHANDLES(ICALL(MONOIO_5, "DeleteFile(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_DeleteFile)) #endif /* !PLATFORM_RO_FS */ -ICALL(MONOIO_38, "DumpHandles", ves_icall_System_IO_MonoIO_DumpHandles) -ICALL(MONOIO_34, "DuplicateHandle", ves_icall_System_IO_MonoIO_DuplicateHandle) -ICALL(MONOIO_37a, "FindCloseFile", ves_icall_System_IO_MonoIO_FindCloseFile) +NOHANDLES(ICALL(MONOIO_38, "DumpHandles", ves_icall_System_IO_MonoIO_DumpHandles)) +NOHANDLES(ICALL(MONOIO_34, "DuplicateHandle", ves_icall_System_IO_MonoIO_DuplicateHandle)) +NOHANDLES(ICALL(MONOIO_37a, "FindCloseFile", ves_icall_System_IO_MonoIO_FindCloseFile)) HANDLES(ICALL(MONOIO_35a, "FindFirstFile", ves_icall_System_IO_MonoIO_FindFirstFile)) HANDLES(ICALL(MONOIO_36a, "FindNextFile", ves_icall_System_IO_MonoIO_FindNextFile)) -ICALL(MONOIO_6, "Flush(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Flush) +NOHANDLES(ICALL(MONOIO_6, "Flush(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Flush)) HANDLES(ICALL(MONOIO_7, "GetCurrentDirectory(System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetCurrentDirectory)) -ICALL(MONOIO_8, "GetFileAttributes(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileAttributes) -ICALL(MONOIO_9, "GetFileStat(char*,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileStat) -ICALL(MONOIO_11, "GetFileType(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileType) -ICALL(MONOIO_12, "GetLength(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetLength) +NOHANDLES(ICALL(MONOIO_8, "GetFileAttributes(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileAttributes)) +NOHANDLES(ICALL(MONOIO_9, "GetFileStat(char*,System.IO.MonoIOStat&,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileStat)) +NOHANDLES(ICALL(MONOIO_11, "GetFileType(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetFileType)) +NOHANDLES(ICALL(MONOIO_12, "GetLength(intptr,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_GetLength)) #ifndef PLATFORM_RO_FS -ICALL(MONOIO_14, "Lock(intptr,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Lock) -ICALL(MONOIO_15, "MoveFile(char*,char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_MoveFile) +NOHANDLES(ICALL(MONOIO_14, "Lock(intptr,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Lock)) +NOHANDLES(ICALL(MONOIO_15, "MoveFile(char*,char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_MoveFile)) #endif /* !PLATFORM_RO_FS */ -ICALL(MONOIO_16, "Open(char*,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,System.IO.FileOptions,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Open) +NOHANDLES(ICALL(MONOIO_16, "Open(char*,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,System.IO.FileOptions,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Open)) HANDLES(ICALL(MONOIO_17, "Read(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Read)) #ifndef PLATFORM_RO_FS -ICALL(MONOIO_18, "RemoveDirectory(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_RemoveDirectory) -ICALL(MONOIO_18M, "ReplaceFile(char*,char*,char*,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_ReplaceFile) +NOHANDLES(ICALL(MONOIO_18, "RemoveDirectory(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_RemoveDirectory)) +NOHANDLES(ICALL(MONOIO_18M, "ReplaceFile(char*,char*,char*,bool,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_ReplaceFile)) #endif /* !PLATFORM_RO_FS */ -ICALL(MONOIO_19, "Seek(intptr,long,System.IO.SeekOrigin,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Seek) -ICALL(MONOIO_20, "SetCurrentDirectory(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetCurrentDirectory) -ICALL(MONOIO_21, "SetFileAttributes(char*,System.IO.FileAttributes,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileAttributes) -ICALL(MONOIO_22, "SetFileTime(intptr,long,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileTime) -ICALL(MONOIO_23, "SetLength(intptr,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetLength) +NOHANDLES(ICALL(MONOIO_19, "Seek(intptr,long,System.IO.SeekOrigin,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Seek)) +NOHANDLES(ICALL(MONOIO_20, "SetCurrentDirectory(char*,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetCurrentDirectory)) +NOHANDLES(ICALL(MONOIO_21, "SetFileAttributes(char*,System.IO.FileAttributes,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileAttributes)) +NOHANDLES(ICALL(MONOIO_22, "SetFileTime(intptr,long,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetFileTime)) +NOHANDLES(ICALL(MONOIO_23, "SetLength(intptr,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_SetLength)) #ifndef PLATFORM_RO_FS -ICALL(MONOIO_24, "Unlock(intptr,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Unlock) +NOHANDLES(ICALL(MONOIO_24, "Unlock(intptr,long,long,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Unlock)) #endif HANDLES(ICALL(MONOIO_25, "Write(intptr,byte[],int,int,System.IO.MonoIOError&)", ves_icall_System_IO_MonoIO_Write)) -ICALL(MONOIO_26, "get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar) -ICALL(MONOIO_27, "get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError) -ICALL(MONOIO_28, "get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput) -ICALL(MONOIO_29, "get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput) -ICALL(MONOIO_30, "get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar) +NOHANDLES(ICALL(MONOIO_26, "get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar)) +NOHANDLES(ICALL(MONOIO_27, "get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError)) +NOHANDLES(ICALL(MONOIO_28, "get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput)) +NOHANDLES(ICALL(MONOIO_29, "get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput)) +NOHANDLES(ICALL(MONOIO_30, "get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar)) HANDLES(ICALL(MONOIO_31, "get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars)) -ICALL(MONOIO_32, "get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator) -ICALL(MONOIO_33, "get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar) +NOHANDLES(ICALL(MONOIO_32, "get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator)) +NOHANDLES(ICALL(MONOIO_33, "get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar)) ICALL_TYPE(IOPATH, "System.IO.Path", IOPATH_1) HANDLES(ICALL(IOPATH_1, "get_temp_path", ves_icall_System_IO_get_temp_path)) @@ -419,52 +403,52 @@ ICALL(IOSELECTOR_1, "Add", ves_icall_System_IOSelector_Add) ICALL(IOSELECTOR_2, "Remove", ves_icall_System_IOSelector_Remove) ICALL_TYPE(MATH, "System.Math", MATH_19) -ICALL(MATH_19, "Abs(double)", ves_icall_System_Math_Abs_double) -ICALL(MATH_20, "Abs(single)", ves_icall_System_Math_Abs_single) -ICALL(MATH_1, "Acos", ves_icall_System_Math_Acos) -ICALL(MATH_2, "Asin", ves_icall_System_Math_Asin) -ICALL(MATH_3, "Atan", ves_icall_System_Math_Atan) -ICALL(MATH_4, "Atan2", ves_icall_System_Math_Atan2) -ICALL(MATH_21, "Ceiling", ves_icall_System_Math_Ceiling) -ICALL(MATH_5, "Cos", ves_icall_System_Math_Cos) -ICALL(MATH_6, "Cosh", ves_icall_System_Math_Cosh) -ICALL(MATH_7, "Exp", ves_icall_System_Math_Exp) -ICALL(MATH_8, "Floor", ves_icall_System_Math_Floor) -ICALL(MATH_9, "Log", ves_icall_System_Math_Log) -ICALL(MATH_10, "Log10", ves_icall_System_Math_Log10) -ICALL(MATH_11, "Pow", ves_icall_System_Math_Pow) -ICALL(MATH_12, "Round", ves_icall_System_Math_Round) -ICALL(MATH_14, "Sin", ves_icall_System_Math_Sin) -ICALL(MATH_15, "Sinh", ves_icall_System_Math_Sinh) -ICALL(MATH_22, "SplitFractionDouble", ves_icall_System_Math_SplitFractionDouble) -ICALL(MATH_16, "Sqrt", ves_icall_System_Math_Sqrt) -ICALL(MATH_17, "Tan", ves_icall_System_Math_Tan) -ICALL(MATH_18, "Tanh", ves_icall_System_Math_Tanh) +NOHANDLES(ICALL(MATH_19, "Abs(double)", ves_icall_System_Math_Abs_double)) +NOHANDLES(ICALL(MATH_20, "Abs(single)", ves_icall_System_Math_Abs_single)) +NOHANDLES(ICALL(MATH_1, "Acos", ves_icall_System_Math_Acos)) +NOHANDLES(ICALL(MATH_2, "Asin", ves_icall_System_Math_Asin)) +NOHANDLES(ICALL(MATH_3, "Atan", ves_icall_System_Math_Atan)) +NOHANDLES(ICALL(MATH_4, "Atan2", ves_icall_System_Math_Atan2)) +NOHANDLES(ICALL(MATH_21, "Ceiling", ves_icall_System_Math_Ceiling)) +NOHANDLES(ICALL(MATH_5, "Cos", ves_icall_System_Math_Cos)) +NOHANDLES(ICALL(MATH_6, "Cosh", ves_icall_System_Math_Cosh)) +NOHANDLES(ICALL(MATH_7, "Exp", ves_icall_System_Math_Exp)) +NOHANDLES(ICALL(MATH_8, "Floor", ves_icall_System_Math_Floor)) +NOHANDLES(ICALL(MATH_9, "Log", ves_icall_System_Math_Log)) +NOHANDLES(ICALL(MATH_10, "Log10", ves_icall_System_Math_Log10)) +NOHANDLES(ICALL(MATH_11, "Pow", ves_icall_System_Math_Pow)) +NOHANDLES(ICALL(MATH_12, "Round", ves_icall_System_Math_Round)) +NOHANDLES(ICALL(MATH_14, "Sin", ves_icall_System_Math_Sin)) +NOHANDLES(ICALL(MATH_15, "Sinh", ves_icall_System_Math_Sinh)) +NOHANDLES(ICALL(MATH_22, "SplitFractionDouble", ves_icall_System_Math_SplitFractionDouble)) +NOHANDLES(ICALL(MATH_16, "Sqrt", ves_icall_System_Math_Sqrt)) +NOHANDLES(ICALL(MATH_17, "Tan", ves_icall_System_Math_Tan)) +NOHANDLES(ICALL(MATH_18, "Tanh", ves_icall_System_Math_Tanh)) ICALL_TYPE(MATHF, "System.MathF", MATHF_1) -ICALL(MATHF_1, "Acos", ves_icall_System_MathF_Acos) -ICALL(MATHF_2, "Acosh", ves_icall_System_MathF_Acosh) -ICALL(MATHF_3, "Asin", ves_icall_System_MathF_Asin) -ICALL(MATHF_4, "Asinh", ves_icall_System_MathF_Asinh) -ICALL(MATHF_5, "Atan", ves_icall_System_MathF_Atan) -ICALL(MATHF_6, "Atan2", ves_icall_System_MathF_Atan2) -ICALL(MATHF_7, "Atanh", ves_icall_System_MathF_Atanh) -ICALL(MATHF_8, "Cbrt", ves_icall_System_MathF_Cbrt) -ICALL(MATHF_9, "Ceiling", ves_icall_System_MathF_Ceiling) -ICALL(MATHF_10, "Cos", ves_icall_System_MathF_Cos) -ICALL(MATHF_11, "Cosh", ves_icall_System_MathF_Cosh) -ICALL(MATHF_12, "Exp", ves_icall_System_MathF_Exp) -ICALL(MATHF_22, "FMod", ves_icall_System_MathF_FMod) -ICALL(MATHF_13, "Floor", ves_icall_System_MathF_Floor) -ICALL(MATHF_14, "Log", ves_icall_System_MathF_Log) -ICALL(MATHF_15, "Log10", ves_icall_System_MathF_Log10) -ICALL(MATHF_23, "ModF(single,single*)", ves_icall_System_MathF_ModF) -ICALL(MATHF_16, "Pow", ves_icall_System_MathF_Pow) -ICALL(MATHF_17, "Sin", ves_icall_System_MathF_Sin) -ICALL(MATHF_18, "Sinh", ves_icall_System_MathF_Sinh) -ICALL(MATHF_19, "Sqrt", ves_icall_System_MathF_Sqrt) -ICALL(MATHF_20, "Tan", ves_icall_System_MathF_Tan) -ICALL(MATHF_21, "Tanh", ves_icall_System_MathF_Tanh) +NOHANDLES(ICALL(MATHF_1, "Acos", ves_icall_System_MathF_Acos)) +NOHANDLES(ICALL(MATHF_2, "Acosh", ves_icall_System_MathF_Acosh)) +NOHANDLES(ICALL(MATHF_3, "Asin", ves_icall_System_MathF_Asin)) +NOHANDLES(ICALL(MATHF_4, "Asinh", ves_icall_System_MathF_Asinh)) +NOHANDLES(ICALL(MATHF_5, "Atan", ves_icall_System_MathF_Atan)) +NOHANDLES(ICALL(MATHF_6, "Atan2", ves_icall_System_MathF_Atan2)) +NOHANDLES(ICALL(MATHF_7, "Atanh", ves_icall_System_MathF_Atanh)) +NOHANDLES(ICALL(MATHF_8, "Cbrt", ves_icall_System_MathF_Cbrt)) +NOHANDLES(ICALL(MATHF_9, "Ceiling", ves_icall_System_MathF_Ceiling)) +NOHANDLES(ICALL(MATHF_10, "Cos", ves_icall_System_MathF_Cos)) +NOHANDLES(ICALL(MATHF_11, "Cosh", ves_icall_System_MathF_Cosh)) +NOHANDLES(ICALL(MATHF_12, "Exp", ves_icall_System_MathF_Exp)) +NOHANDLES(ICALL(MATHF_22, "FMod", ves_icall_System_MathF_FMod)) +NOHANDLES(ICALL(MATHF_13, "Floor", ves_icall_System_MathF_Floor)) +NOHANDLES(ICALL(MATHF_14, "Log", ves_icall_System_MathF_Log)) +NOHANDLES(ICALL(MATHF_15, "Log10", ves_icall_System_MathF_Log10)) +NOHANDLES(ICALL(MATHF_23, "ModF(single,single*)", ves_icall_System_MathF_ModF)) +NOHANDLES(ICALL(MATHF_16, "Pow", ves_icall_System_MathF_Pow)) +NOHANDLES(ICALL(MATHF_17, "Sin", ves_icall_System_MathF_Sin)) +NOHANDLES(ICALL(MATHF_18, "Sinh", ves_icall_System_MathF_Sinh)) +NOHANDLES(ICALL(MATHF_19, "Sqrt", ves_icall_System_MathF_Sqrt)) +NOHANDLES(ICALL(MATHF_20, "Tan", ves_icall_System_MathF_Tan)) +NOHANDLES(ICALL(MATHF_21, "Tanh", ves_icall_System_MathF_Tanh)) ICALL_TYPE(MCATTR, "System.MonoCustomAttrs", MCATTR_1) HANDLES(ICALL(MCATTR_1, "GetCustomAttributesDataInternal", ves_icall_MonoCustomAttrs_GetCustomAttributesDataInternal)) @@ -516,10 +500,6 @@ ICALL_TYPE(SOCKEX, "System.Net.Sockets.SocketException", SOCKEX_1) ICALL(SOCKEX_1, "WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal) #endif /* !DISABLE_SOCKETS */ -ICALL_TYPE(NUMBER, "System.Number", NUMBER_1) -ICALL(NUMBER_1, "NumberBufferToDecimal", mono_decimal_from_number) -ICALL(NUMBER_2, "NumberBufferToDouble", mono_double_from_number) - ICALL_TYPE(NUMBER_FORMATTER, "System.NumberFormatter", NUMBER_FORMATTER_1) ICALL(NUMBER_FORMATTER_1, "GetFormatterTables", ves_icall_System_NumberFormatter_GetFormatterTables) @@ -627,7 +607,7 @@ HANDLES(ICALL(MODULE_7, "ResolveFieldToken", ves_icall_System_Reflection_Module_ HANDLES(ICALL(MODULE_8, "ResolveMemberToken", ves_icall_System_Reflection_Module_ResolveMemberToken)) HANDLES(ICALL(MODULE_9, "ResolveMethodToken", ves_icall_System_Reflection_Module_ResolveMethodToken)) HANDLES(ICALL(MODULE_10, "ResolveSignature", ves_icall_System_Reflection_Module_ResolveSignature)) -ICALL(MODULE_11, "ResolveStringToken", ves_icall_System_Reflection_Module_ResolveStringToken) +HANDLES(ICALL(MODULE_11, "ResolveStringToken", ves_icall_System_Reflection_Module_ResolveStringToken)) HANDLES(ICALL(MODULE_12, "ResolveTypeToken", ves_icall_System_Reflection_Module_ResolveTypeToken)) HANDLES(ICALL(MODULE_13, "get_MetadataToken", ves_icall_reflection_get_token)) @@ -640,7 +620,7 @@ ICALL_TYPE(MEVIN, "System.Reflection.MonoEventInfo", MEVIN_1) HANDLES(ICALL(MEVIN_1, "get_event_info", ves_icall_MonoEventInfo_get_event_info)) ICALL_TYPE(MFIELD, "System.Reflection.MonoField", MFIELD_1) -ICALL(MFIELD_1, "GetFieldOffset", ves_icall_MonoField_GetFieldOffset) +HANDLES(ICALL(MFIELD_1, "GetFieldOffset", ves_icall_MonoField_GetFieldOffset)) HANDLES(ICALL(MFIELD_2, "GetParentType", ves_icall_MonoField_GetParentType)) ICALL(MFIELD_5, "GetRawConstantValue", ves_icall_MonoField_GetRawConstantValue) ICALL(MFIELD_3, "GetValueInternal", ves_icall_MonoField_GetValueInternal) @@ -692,11 +672,11 @@ ICALL(RUNH_5h, "SufficientExecutionStack", ves_icall_System_Runtime_CompilerServ ICALL(RUNH_6, "get_OffsetToStringData", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetOffsetToStringData) ICALL_TYPE(GCH, "System.Runtime.InteropServices.GCHandle", GCH_1) -ICALL(GCH_1, "CheckCurrentDomain", mono_gc_GCHandle_CheckCurrentDomain) -ICALL(GCH_2, "FreeHandle", ves_icall_System_GCHandle_FreeHandle) -ICALL(GCH_3, "GetAddrOfPinnedObject", ves_icall_System_GCHandle_GetAddrOfPinnedObject) -ICALL(GCH_4, "GetTarget", ves_icall_System_GCHandle_GetTarget) -ICALL(GCH_5, "GetTargetHandle", ves_icall_System_GCHandle_GetTargetHandle) +HANDLES(ICALL(GCH_1, "CheckCurrentDomain", ves_icall_System_GCHandle_CheckCurrentDomain)) +HANDLES(ICALL(GCH_2, "FreeHandle", ves_icall_System_GCHandle_FreeHandle)) +HANDLES(ICALL(GCH_3, "GetAddrOfPinnedObject", ves_icall_System_GCHandle_GetAddrOfPinnedObject)) +HANDLES(ICALL(GCH_4, "GetTarget", ves_icall_System_GCHandle_GetTarget)) +HANDLES(ICALL(GCH_5, "GetTargetHandle", ves_icall_System_GCHandle_GetTargetHandle)) #ifndef DISABLE_COM ICALL_TYPE(MARSHAL, "System.Runtime.InteropServices.Marshal", MARSHAL_1) @@ -704,69 +684,66 @@ ICALL(MARSHAL_1, "AddRefInternal", ves_icall_System_Runtime_InteropServices_Mars #else ICALL_TYPE(MARSHAL, "System.Runtime.InteropServices.Marshal", MARSHAL_2) #endif -ICALL(MARSHAL_2, "AllocCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem) -ICALL(MARSHAL_51,"AllocCoTaskMemSize(uintptr)", ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize) -ICALL(MARSHAL_3, "AllocHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal) -ICALL(MARSHAL_50, "BufferToBSTR", ves_icall_System_Runtime_InteropServices_Marshal_BufferToBSTR) -ICALL(MARSHAL_4, "DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure) -ICALL(MARSHAL_5, "FreeBSTR", ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR) -ICALL(MARSHAL_6, "FreeCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem) -ICALL(MARSHAL_7, "FreeHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal) +HANDLES(ICALL(MARSHAL_2, "AllocCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem)) +HANDLES(ICALL(MARSHAL_51,"AllocCoTaskMemSize(uintptr)", ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize)) +HANDLES(ICALL(MARSHAL_3, "AllocHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal)) +HANDLES(ICALL(MARSHAL_50, "BufferToBSTR", ves_icall_System_Runtime_InteropServices_Marshal_BufferToBSTR)) +HANDLES(ICALL(MARSHAL_4, "DestroyStructure", ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure)) +HANDLES(ICALL(MARSHAL_5, "FreeBSTR", ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR)) +HANDLES(ICALL(MARSHAL_6, "FreeCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem)) +HANDLES(ICALL(MARSHAL_7, "FreeHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal)) #ifndef DISABLE_COM -ICALL(MARSHAL_44, "GetCCW", ves_icall_System_Runtime_InteropServices_Marshal_GetCCW) -ICALL(MARSHAL_8, "GetComSlotForMethodInfoInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal) +HANDLES(ICALL(MARSHAL_44, "GetCCW", ves_icall_System_Runtime_InteropServices_Marshal_GetCCW)) +HANDLES(ICALL(MARSHAL_8, "GetComSlotForMethodInfoInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal)) #endif HANDLES(ICALL(MARSHAL_9, "GetDelegateForFunctionPointerInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal)) HANDLES(ICALL(MARSHAL_10, "GetFunctionPointerForDelegateInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetFunctionPointerForDelegateInternal)) #ifndef DISABLE_COM -ICALL(MARSHAL_52, "GetHRForException_WinRT", ves_icall_System_Runtime_InteropServices_Marshal_GetHRForException_WinRT) -ICALL(MARSHAL_45, "GetIDispatchForObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal) -ICALL(MARSHAL_46, "GetIUnknownForObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal) +HANDLES(ICALL(MARSHAL_52, "GetHRForException_WinRT", ves_icall_System_Runtime_InteropServices_Marshal_GetHRForException_WinRT)) +HANDLES(ICALL(MARSHAL_45, "GetIDispatchForObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal)) +HANDLES(ICALL(MARSHAL_46, "GetIUnknownForObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal)) #endif ICALL(MARSHAL_11, "GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error) #ifndef DISABLE_COM -ICALL(MARSHAL_53, "GetNativeActivationFactory", ves_icall_System_Runtime_InteropServices_Marshal_GetNativeActivationFactory) -ICALL(MARSHAL_47, "GetObjectForCCW", ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW) -ICALL(MARSHAL_54, "GetRawIUnknownForComObjectNoAddRef", ves_icall_System_Runtime_InteropServices_Marshal_GetRawIUnknownForComObjectNoAddRef) -ICALL(MARSHAL_48, "IsComObject", ves_icall_System_Runtime_InteropServices_Marshal_IsComObject) +HANDLES(ICALL(MARSHAL_53, "GetNativeActivationFactory", ves_icall_System_Runtime_InteropServices_Marshal_GetNativeActivationFactory)) +HANDLES(ICALL(MARSHAL_47, "GetObjectForCCW", ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW)) +HANDLES(ICALL(MARSHAL_54, "GetRawIUnknownForComObjectNoAddRef", ves_icall_System_Runtime_InteropServices_Marshal_GetRawIUnknownForComObjectNoAddRef)) +HANDLES(ICALL(MARSHAL_48, "IsComObject", ves_icall_System_Runtime_InteropServices_Marshal_IsComObject)) #endif HANDLES(ICALL(MARSHAL_12, "OffsetOf", ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf)) HANDLES(ICALL(MARSHAL_13, "Prelink", ves_icall_System_Runtime_InteropServices_Marshal_Prelink)) HANDLES(ICALL(MARSHAL_14, "PrelinkAll", ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll)) HANDLES(ICALL(MARSHAL_15, "PtrToStringAnsi(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi)) -ICALL(MARSHAL_16, "PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len) -ICALL(MARSHAL_17, "PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR) -ICALL(MARSHAL_18, "PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni) -ICALL(MARSHAL_19, "PtrToStringUni(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len) -ICALL(MARSHAL_20, "PtrToStructure(intptr,System.Type)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type) -ICALL(MARSHAL_21, "PtrToStructure(intptr,object)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure) +HANDLES(ICALL(MARSHAL_16, "PtrToStringAnsi(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len)) +HANDLES(ICALL(MARSHAL_17, "PtrToStringBSTR", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR)) +HANDLES(ICALL(MARSHAL_18, "PtrToStringUni(intptr)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni)) +HANDLES(ICALL(MARSHAL_19, "PtrToStringUni(intptr,int)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len)) +HANDLES(ICALL(MARSHAL_20, "PtrToStructure(intptr,System.Type)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type)) +HANDLES(ICALL(MARSHAL_21, "PtrToStructure(intptr,object)", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure)) #ifndef DISABLE_COM -ICALL(MARSHAL_22, "QueryInterfaceInternal", ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal) +HANDLES(ICALL(MARSHAL_22, "QueryInterfaceInternal", ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal)) #endif -ICALL(MARSHAL_43, "ReAllocCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem) -ICALL(MARSHAL_23, "ReAllocHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal) +HANDLES(ICALL(MARSHAL_43, "ReAllocCoTaskMem", ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem)) +HANDLES(ICALL(MARSHAL_23, "ReAllocHGlobal", ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal)) #ifndef DISABLE_COM -ICALL(MARSHAL_49, "ReleaseComObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal) -ICALL(MARSHAL_29, "ReleaseInternal", ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal) +HANDLES(ICALL(MARSHAL_49, "ReleaseComObjectInternal", ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal)) +HANDLES(ICALL(MARSHAL_29, "ReleaseInternal", ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal)) #endif HANDLES(ICALL(MARSHAL_30, "SizeOf", ves_icall_System_Runtime_InteropServices_Marshal_SizeOf)) -ICALL(MARSHAL_31, "StringToBSTR", ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR) -ICALL(MARSHAL_32, "StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi) -ICALL(MARSHAL_33, "StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni) -ICALL(MARSHAL_34, "StructureToPtr", ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr) +HANDLES(ICALL(MARSHAL_32, "StringToHGlobalAnsi", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi)) +HANDLES(ICALL(MARSHAL_33, "StringToHGlobalUni", ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni)) +HANDLES(ICALL(MARSHAL_34, "StructureToPtr", ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr)) ICALL(MARSHAL_35, "UnsafeAddrOfPinnedArrayElement", ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement) - -ICALL(MARSHAL_41, "copy_from_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged) -ICALL(MARSHAL_42, "copy_to_unmanaged", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged) - +HANDLES(ICALL(MARSHAL_41, "copy_from_unmanaged_fixed", ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged)) +HANDLES(ICALL(MARSHAL_42, "copy_to_unmanaged_fixed", ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged)) #ifndef DISABLE_COM ICALL_TYPE(WINDOWSRUNTIME_UNM, "System.Runtime.InteropServices.WindowsRuntime.UnsafeNativeMethods", WINDOWSRUNTIME_UNM_0) -ICALL(WINDOWSRUNTIME_UNM_0, "GetRestrictedErrorInfo", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_GetRestrictedErrorInfo) -ICALL(WINDOWSRUNTIME_UNM_1, "RoOriginateLanguageException", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoOriginateLanguageException) -ICALL(WINDOWSRUNTIME_UNM_2, "RoReportUnhandledError", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoReportUnhandledError) -ICALL(WINDOWSRUNTIME_UNM_3, "WindowsCreateString", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsCreateString) -ICALL(WINDOWSRUNTIME_UNM_4, "WindowsDeleteString", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsDeleteString) -ICALL(WINDOWSRUNTIME_UNM_5, "WindowsGetStringRawBuffer", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsGetStringRawBuffer) +HANDLES(ICALL(WINDOWSRUNTIME_UNM_0, "GetRestrictedErrorInfo", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_GetRestrictedErrorInfo)) +HANDLES(ICALL(WINDOWSRUNTIME_UNM_1, "RoOriginateLanguageException", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoOriginateLanguageException)) +HANDLES(ICALL(WINDOWSRUNTIME_UNM_2, "RoReportUnhandledError", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_RoReportUnhandledError)) +HANDLES(ICALL(WINDOWSRUNTIME_UNM_3, "WindowsCreateString", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsCreateString)) +HANDLES(ICALL(WINDOWSRUNTIME_UNM_4, "WindowsDeleteString", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsDeleteString)) +HANDLES(ICALL(WINDOWSRUNTIME_UNM_5, "WindowsGetStringRawBuffer", ves_icall_System_Runtime_InteropServices_WindowsRuntime_UnsafeNativeMethods_WindowsGetStringRawBuffer)) #endif ICALL_TYPE(ACTS, "System.Runtime.Remoting.Activation.ActivationServices", ACTS_1) @@ -795,9 +772,10 @@ ICALL_TYPE(RUNIMPORT, "System.Runtime.RuntimeImports", RUNIMPORT_1) NOHANDLES(ICALL(RUNIMPORT_1, "Memmove", ves_icall_System_Runtime_RuntimeImports_Memmove)) NOHANDLES(ICALL(RUNIMPORT_2, "Memmove_wbarrier", ves_icall_System_Runtime_RuntimeImports_Memmove_wbarrier)) NOHANDLES(ICALL(RUNIMPORT_3, "ZeroMemory", ves_icall_System_Runtime_RuntimeImports_ZeroMemory)) +ICALL(RUNIMPORT_4, "_ecvt_s", ves_icall_System_Runtime_RuntimeImports_ecvt_s) ICALL_TYPE(RVH, "System.Runtime.Versioning.VersioningHelper", RVH_1) -ICALL(RVH_1, "GetRuntimeId", ves_icall_System_Runtime_Versioning_VersioningHelper_GetRuntimeId) +HANDLES(ICALL(RVH_1, "GetRuntimeId", ves_icall_System_Runtime_Versioning_VersioningHelper_GetRuntimeId)) ICALL_TYPE(RFH, "System.RuntimeFieldHandle", RFH_1) ICALL(RFH_1, "SetValueDirect", ves_icall_System_RuntimeFieldHandle_SetValueDirect) @@ -859,10 +837,10 @@ NOHANDLES(ICALL(RTH_17a, "is_subclass_of", ves_icall_RuntimeTypeHandle_is_subcla HANDLES(ICALL(RTH_18, "type_is_assignable_from", ves_icall_RuntimeTypeHandle_type_is_assignable_from)) ICALL_TYPE(RNG, "System.Security.Cryptography.RNGCryptoServiceProvider", RNG_1) -ICALL(RNG_1, "RngClose", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose) -ICALL(RNG_2, "RngGetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes) -ICALL(RNG_3, "RngInitialize", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize) -ICALL(RNG_4, "RngOpen", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen) +HANDLES(ICALL(RNG_1, "RngClose", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose)) +HANDLES(ICALL(RNG_2, "RngGetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes)) +HANDLES(ICALL(RNG_3, "RngInitialize", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize)) +HANDLES(ICALL(RNG_4, "RngOpen", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen)) #ifndef DISABLE_POLICY_EVIDENCE ICALL_TYPE(EVID, "System.Security.Policy.Evidence", EVID_1) @@ -875,14 +853,14 @@ HANDLES(ICALL(WINID_3, "GetUserToken", ves_icall_System_Security_Principal_Windo ICALL(WINID_4, "_GetRoles", ves_icall_System_Security_Principal_WindowsIdentity_GetRoles) ICALL_TYPE(WINIMP, "System.Security.Principal.WindowsImpersonationContext", WINIMP_1) -ICALL(WINIMP_1, "CloseToken", ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken) -ICALL(WINIMP_2, "DuplicateToken", ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken) -ICALL(WINIMP_3, "RevertToSelf", ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf) -ICALL(WINIMP_4, "SetCurrentToken", ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken) +HANDLES(ICALL(WINIMP_1, "CloseToken", ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken)) +HANDLES(ICALL(WINIMP_2, "DuplicateToken", ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken)) +HANDLES(ICALL(WINIMP_3, "RevertToSelf", ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf)) +HANDLES(ICALL(WINIMP_4, "SetCurrentToken", ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken)) ICALL_TYPE(WINPRIN, "System.Security.Principal.WindowsPrincipal", WINPRIN_1) -ICALL(WINPRIN_1, "IsMemberOfGroupId", ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId) -ICALL(WINPRIN_2, "IsMemberOfGroupName", ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName) +HANDLES(ICALL(WINPRIN_1, "IsMemberOfGroupId", ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId)) +HANDLES(ICALL(WINPRIN_2, "IsMemberOfGroupName", ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName)) ICALL_TYPE(SECSTRING, "System.Security.SecureString", SECSTRING_1) ICALL(SECSTRING_1, "DecryptInternal", ves_icall_System_Security_SecureString_DecryptInternal) @@ -890,9 +868,9 @@ ICALL(SECSTRING_2, "EncryptInternal", ves_icall_System_Security_SecureString_Enc #endif /* !DISABLE_POLICY_EVIDENCE */ ICALL_TYPE(SECMAN, "System.Security.SecurityManager", SECMAN_1) -ICALL(SECMAN_1, "get_RequiresElevatedPermissions", mono_security_core_clr_require_elevated_permissions) -ICALL(SECMAN_2, "get_SecurityEnabled", ves_icall_System_Security_SecurityManager_get_SecurityEnabled) -ICALL(SECMAN_3, "set_SecurityEnabled", ves_icall_System_Security_SecurityManager_set_SecurityEnabled) +NOHANDLES(ICALL(SECMAN_1, "get_RequiresElevatedPermissions", mono_security_core_clr_require_elevated_permissions)) +NOHANDLES(ICALL(SECMAN_2, "get_SecurityEnabled", ves_icall_System_Security_SecurityManager_get_SecurityEnabled)) +NOHANDLES(ICALL(SECMAN_3, "set_SecurityEnabled", ves_icall_System_Security_SecurityManager_set_SecurityEnabled)) ICALL_TYPE(STRING, "System.String", STRING_1) ICALL(STRING_1, ".ctor(System.ReadOnlySpan`1)", ves_icall_System_String_ctor_RedirectToCreateString) @@ -915,28 +893,28 @@ ICALL_TYPE(UNORM, "System.Text.Normalization", UNORM_1) HANDLES(ICALL(UNORM_1, "load_normalization_resource", ves_icall_System_Text_Normalization_load_normalization_resource)) ICALL_TYPE(ILOCK, "System.Threading.Interlocked", ILOCK_1) -ICALL(ILOCK_1, "Add(int&,int)", ves_icall_System_Threading_Interlocked_Add_Int) -ICALL(ILOCK_2, "Add(long&,long)", ves_icall_System_Threading_Interlocked_Add_Long) +NOHANDLES(ICALL(ILOCK_1, "Add(int&,int)", ves_icall_System_Threading_Interlocked_Add_Int)) +NOHANDLES(ICALL(ILOCK_2, "Add(long&,long)", ves_icall_System_Threading_Interlocked_Add_Long)) ICALL(ILOCK_3, "CompareExchange(T&,T,T)", ves_icall_System_Threading_Interlocked_CompareExchange_T) -ICALL(ILOCK_4, "CompareExchange(double&,double,double)", ves_icall_System_Threading_Interlocked_CompareExchange_Double) -ICALL(ILOCK_5, "CompareExchange(int&,int,int)", ves_icall_System_Threading_Interlocked_CompareExchange_Int) -ICALL(ILOCK_6, "CompareExchange(int&,int,int,bool&)", ves_icall_System_Threading_Interlocked_CompareExchange_Int_Success) -ICALL(ILOCK_7, "CompareExchange(intptr&,intptr,intptr)", ves_icall_System_Threading_Interlocked_CompareExchange_IntPtr) -ICALL(ILOCK_8, "CompareExchange(long&,long,long)", ves_icall_System_Threading_Interlocked_CompareExchange_Long) +NOHANDLES(ICALL(ILOCK_4, "CompareExchange(double&,double,double)", ves_icall_System_Threading_Interlocked_CompareExchange_Double)) +NOHANDLES(ICALL(ILOCK_5, "CompareExchange(int&,int,int)", ves_icall_System_Threading_Interlocked_CompareExchange_Int)) +NOHANDLES(ICALL(ILOCK_6, "CompareExchange(int&,int,int,bool&)", ves_icall_System_Threading_Interlocked_CompareExchange_Int_Success)) +NOHANDLES(ICALL(ILOCK_7, "CompareExchange(intptr&,intptr,intptr)", ves_icall_System_Threading_Interlocked_CompareExchange_IntPtr)) +NOHANDLES(ICALL(ILOCK_8, "CompareExchange(long&,long,long)", ves_icall_System_Threading_Interlocked_CompareExchange_Long)) ICALL(ILOCK_9, "CompareExchange(object&,object,object)", ves_icall_System_Threading_Interlocked_CompareExchange_Object) -ICALL(ILOCK_10, "CompareExchange(single&,single,single)", ves_icall_System_Threading_Interlocked_CompareExchange_Single) -ICALL(ILOCK_11, "Decrement(int&)", ves_icall_System_Threading_Interlocked_Decrement_Int) -ICALL(ILOCK_12, "Decrement(long&)", ves_icall_System_Threading_Interlocked_Decrement_Long) +NOHANDLES(ICALL(ILOCK_10, "CompareExchange(single&,single,single)", ves_icall_System_Threading_Interlocked_CompareExchange_Single)) +NOHANDLES(ICALL(ILOCK_11, "Decrement(int&)", ves_icall_System_Threading_Interlocked_Decrement_Int)) +NOHANDLES(ICALL(ILOCK_12, "Decrement(long&)", ves_icall_System_Threading_Interlocked_Decrement_Long)) ICALL(ILOCK_13, "Exchange(T&,T)", ves_icall_System_Threading_Interlocked_Exchange_T) -ICALL(ILOCK_14, "Exchange(double&,double)", ves_icall_System_Threading_Interlocked_Exchange_Double) -ICALL(ILOCK_15, "Exchange(int&,int)", ves_icall_System_Threading_Interlocked_Exchange_Int) -ICALL(ILOCK_16, "Exchange(intptr&,intptr)", ves_icall_System_Threading_Interlocked_Exchange_IntPtr) -ICALL(ILOCK_17, "Exchange(long&,long)", ves_icall_System_Threading_Interlocked_Exchange_Long) +NOHANDLES(ICALL(ILOCK_14, "Exchange(double&,double)", ves_icall_System_Threading_Interlocked_Exchange_Double)) +NOHANDLES(ICALL(ILOCK_15, "Exchange(int&,int)", ves_icall_System_Threading_Interlocked_Exchange_Int)) +NOHANDLES(ICALL(ILOCK_16, "Exchange(intptr&,intptr)", ves_icall_System_Threading_Interlocked_Exchange_IntPtr)) +NOHANDLES(ICALL(ILOCK_17, "Exchange(long&,long)", ves_icall_System_Threading_Interlocked_Exchange_Long)) ICALL(ILOCK_18, "Exchange(object&,object)", ves_icall_System_Threading_Interlocked_Exchange_Object) -ICALL(ILOCK_19, "Exchange(single&,single)", ves_icall_System_Threading_Interlocked_Exchange_Single) -ICALL(ILOCK_20, "Increment(int&)", ves_icall_System_Threading_Interlocked_Increment_Int) -ICALL(ILOCK_21, "Increment(long&)", ves_icall_System_Threading_Interlocked_Increment_Long) -ICALL(ILOCK_22, "Read(long&)", ves_icall_System_Threading_Interlocked_Read_Long) +NOHANDLES(ICALL(ILOCK_19, "Exchange(single&,single)", ves_icall_System_Threading_Interlocked_Exchange_Single)) +NOHANDLES(ICALL(ILOCK_20, "Increment(int&)", ves_icall_System_Threading_Interlocked_Increment_Int)) +NOHANDLES(ICALL(ILOCK_21, "Increment(long&)", ves_icall_System_Threading_Interlocked_Increment_Long)) +NOHANDLES(ICALL(ILOCK_22, "Read(long&)", ves_icall_System_Threading_Interlocked_Read_Long)) ICALL_TYPE(ITHREAD, "System.Threading.InternalThread", ITHREAD_1) HANDLES(ICALL(ITHREAD_1, "Thread_free_internal", ves_icall_System_Threading_InternalThread_Thread_free_internal)) @@ -954,7 +932,7 @@ ICALL(MONIT_9, "try_enter_with_atomic_var", ves_icall_System_Threading_Monitor_M ICALL_TYPE(MUTEX, "System.Threading.Mutex", MUTEX_1) HANDLES(ICALL(MUTEX_1, "CreateMutex_internal(bool,string,bool&)", ves_icall_System_Threading_Mutex_CreateMutex_internal)) HANDLES(ICALL(MUTEX_2, "OpenMutex_internal(string,System.Security.AccessControl.MutexRights,System.IO.MonoIOError&)", ves_icall_System_Threading_Mutex_OpenMutex_internal)) -ICALL(MUTEX_3, "ReleaseMutex_internal(intptr)", ves_icall_System_Threading_Mutex_ReleaseMutex_internal) +NOHANDLES(ICALL(MUTEX_3, "ReleaseMutex_internal(intptr)", ves_icall_System_Threading_Mutex_ReleaseMutex_internal)) ICALL_TYPE(NATIVEC, "System.Threading.NativeEventCalls", NATIVEC_1) ICALL(NATIVEC_1, "CloseEvent_internal", ves_icall_System_Threading_Events_CloseEvent_internal) @@ -974,7 +952,7 @@ HANDLES(ICALL(THREAD_1a, "ByteArrayToCurrentDomain(byte[])", ves_icall_System_Th HANDLES(ICALL(THREAD_1b, "ByteArrayToRootDomain(byte[])", ves_icall_System_Threading_Thread_ByteArrayToRootDomain)) HANDLES(ICALL(THREAD_2, "ClrState(System.Threading.InternalThread,System.Threading.ThreadState)", ves_icall_System_Threading_Thread_ClrState)) HANDLES(ICALL(THREAD_2a, "ConstructInternalThread", ves_icall_System_Threading_Thread_ConstructInternalThread)) -ICALL(THREAD_55, "GetAbortExceptionState", ves_icall_System_Threading_Thread_GetAbortExceptionState) +HANDLES(ICALL(THREAD_55, "GetAbortExceptionState", ves_icall_System_Threading_Thread_GetAbortExceptionState)) HANDLES(ICALL(THREAD_60, "GetCurrentThread", ves_icall_System_Threading_Thread_GetCurrentThread)) HANDLES(ICALL(THREAD_7, "GetDomainID", ves_icall_System_Threading_Thread_GetDomainID)) HANDLES(ICALL(THREAD_8, "GetName_internal(System.Threading.InternalThread)", ves_icall_System_Threading_Thread_GetName_internal)) @@ -983,7 +961,7 @@ ICALL(THREAD_59, "GetStackTraces", ves_icall_System_Threading_Thread_GetStackTra HANDLES(ICALL(THREAD_11, "GetState(System.Threading.InternalThread)", ves_icall_System_Threading_Thread_GetState)) HANDLES(ICALL(THREAD_53, "InterruptInternal", ves_icall_System_Threading_Thread_Interrupt_internal)) HANDLES(ICALL(THREAD_12, "JoinInternal", ves_icall_System_Threading_Thread_Join_internal)) -ICALL(THREAD_13, "MemoryBarrier", ves_icall_System_Threading_Thread_MemoryBarrier) +NOHANDLES(ICALL(THREAD_13, "MemoryBarrier", ves_icall_System_Threading_Thread_MemoryBarrier)) HANDLES(ICALL(THREAD_14, "ResetAbortNative", ves_icall_System_Threading_Thread_ResetAbort)) HANDLES(ICALL(THREAD_15, "ResumeInternal", ves_icall_System_Threading_Thread_Resume)) ICALL(THREAD_18, "SetName_internal(System.Threading.InternalThread,string)", ves_icall_System_Threading_Thread_SetName_internal) @@ -993,36 +971,36 @@ HANDLES(ICALL(THREAD_22, "SleepInternal", ves_icall_System_Threading_Thread_Slee HANDLES(ICALL(THREAD_54, "SpinWait_nop", ves_icall_System_Threading_Thread_SpinWait_nop)) HANDLES(ICALL(THREAD_23, "SuspendInternal", ves_icall_System_Threading_Thread_Suspend)) // FIXME SystemMaxStackStize should be SystemMaxStackSize -HANDLES(ICALL(THREAD_56, "SystemMaxStackStize", ves_icall_System_Threading_Thread_SystemMaxStackSize)) +NOHANDLES(ICALL(THREAD_56, "SystemMaxStackStize", ves_icall_System_Threading_Thread_SystemMaxStackSize)) HANDLES(ICALL(THREAD_25, "Thread_internal", ves_icall_System_Threading_Thread_Thread_internal)) -ICALL(THREAD_26, "VolatileRead(byte&)", ves_icall_System_Threading_Thread_VolatileRead1) -ICALL(THREAD_27, "VolatileRead(double&)", ves_icall_System_Threading_Thread_VolatileReadDouble) -ICALL(THREAD_28, "VolatileRead(int&)", ves_icall_System_Threading_Thread_VolatileRead4) -ICALL(THREAD_29, "VolatileRead(int16&)", ves_icall_System_Threading_Thread_VolatileRead2) -ICALL(THREAD_30, "VolatileRead(intptr&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr) -ICALL(THREAD_31, "VolatileRead(long&)", ves_icall_System_Threading_Thread_VolatileRead8) -ICALL(THREAD_32, "VolatileRead(object&)", ves_icall_System_Threading_Thread_VolatileReadObject) -ICALL(THREAD_33, "VolatileRead(sbyte&)", ves_icall_System_Threading_Thread_VolatileRead1) -ICALL(THREAD_34, "VolatileRead(single&)", ves_icall_System_Threading_Thread_VolatileReadFloat) -ICALL(THREAD_35, "VolatileRead(uint&)", ves_icall_System_Threading_Thread_VolatileRead4) -ICALL(THREAD_36, "VolatileRead(uint16&)", ves_icall_System_Threading_Thread_VolatileRead2) -ICALL(THREAD_37, "VolatileRead(uintptr&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr) -ICALL(THREAD_38, "VolatileRead(ulong&)", ves_icall_System_Threading_Thread_VolatileRead8) -ICALL(THREAD_39, "VolatileWrite(byte&,byte)", ves_icall_System_Threading_Thread_VolatileWrite1) -ICALL(THREAD_40, "VolatileWrite(double&,double)", ves_icall_System_Threading_Thread_VolatileWriteDouble) -ICALL(THREAD_41, "VolatileWrite(int&,int)", ves_icall_System_Threading_Thread_VolatileWrite4) -ICALL(THREAD_42, "VolatileWrite(int16&,int16)", ves_icall_System_Threading_Thread_VolatileWrite2) -ICALL(THREAD_43, "VolatileWrite(intptr&,intptr)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr) -ICALL(THREAD_44, "VolatileWrite(long&,long)", ves_icall_System_Threading_Thread_VolatileWrite8) -ICALL(THREAD_45, "VolatileWrite(object&,object)", ves_icall_System_Threading_Thread_VolatileWriteObject) -ICALL(THREAD_46, "VolatileWrite(sbyte&,sbyte)", ves_icall_System_Threading_Thread_VolatileWrite1) -ICALL(THREAD_47, "VolatileWrite(single&,single)", ves_icall_System_Threading_Thread_VolatileWriteFloat) -ICALL(THREAD_48, "VolatileWrite(uint&,uint)", ves_icall_System_Threading_Thread_VolatileWrite4) -ICALL(THREAD_49, "VolatileWrite(uint16&,uint16)", ves_icall_System_Threading_Thread_VolatileWrite2) -ICALL(THREAD_50, "VolatileWrite(uintptr&,uintptr)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr) -ICALL(THREAD_51, "VolatileWrite(ulong&,ulong)", ves_icall_System_Threading_Thread_VolatileWrite8) -HANDLES(ICALL(THREAD_9, "YieldInternal", ves_icall_System_Threading_Thread_Yield)) -HANDLES(ICALL(THREAD_52, "current_lcid()", ves_icall_System_Threading_Thread_current_lcid)) +NOHANDLES(ICALL(THREAD_26, "VolatileRead(byte&)", ves_icall_System_Threading_Thread_VolatileRead1)) +NOHANDLES(ICALL(THREAD_27, "VolatileRead(double&)", ves_icall_System_Threading_Thread_VolatileReadDouble)) +NOHANDLES(ICALL(THREAD_28, "VolatileRead(int&)", ves_icall_System_Threading_Thread_VolatileRead4)) +NOHANDLES(ICALL(THREAD_29, "VolatileRead(int16&)", ves_icall_System_Threading_Thread_VolatileRead2)) +NOHANDLES(ICALL(THREAD_30, "VolatileRead(intptr&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr)) +NOHANDLES(ICALL(THREAD_31, "VolatileRead(long&)", ves_icall_System_Threading_Thread_VolatileRead8)) +NOHANDLES(ICALL(THREAD_32, "VolatileRead(object&)", ves_icall_System_Threading_Thread_VolatileReadObject)) +NOHANDLES(ICALL(THREAD_33, "VolatileRead(sbyte&)", ves_icall_System_Threading_Thread_VolatileRead1)) +NOHANDLES(ICALL(THREAD_34, "VolatileRead(single&)", ves_icall_System_Threading_Thread_VolatileReadFloat)) +NOHANDLES(ICALL(THREAD_35, "VolatileRead(uint&)", ves_icall_System_Threading_Thread_VolatileRead4)) +NOHANDLES(ICALL(THREAD_36, "VolatileRead(uint16&)", ves_icall_System_Threading_Thread_VolatileRead2)) +NOHANDLES(ICALL(THREAD_37, "VolatileRead(uintptr&)", ves_icall_System_Threading_Thread_VolatileReadIntPtr)) +NOHANDLES(ICALL(THREAD_38, "VolatileRead(ulong&)", ves_icall_System_Threading_Thread_VolatileRead8)) +NOHANDLES(ICALL(THREAD_39, "VolatileWrite(byte&,byte)", ves_icall_System_Threading_Thread_VolatileWrite1)) +NOHANDLES(ICALL(THREAD_40, "VolatileWrite(double&,double)", ves_icall_System_Threading_Thread_VolatileWriteDouble)) +NOHANDLES(ICALL(THREAD_41, "VolatileWrite(int&,int)", ves_icall_System_Threading_Thread_VolatileWrite4)) +NOHANDLES(ICALL(THREAD_42, "VolatileWrite(int16&,int16)", ves_icall_System_Threading_Thread_VolatileWrite2)) +NOHANDLES(ICALL(THREAD_43, "VolatileWrite(intptr&,intptr)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr)) +NOHANDLES(ICALL(THREAD_44, "VolatileWrite(long&,long)", ves_icall_System_Threading_Thread_VolatileWrite8)) +NOHANDLES(ICALL(THREAD_45, "VolatileWrite(object&,object)", ves_icall_System_Threading_Thread_VolatileWriteObject)) +NOHANDLES(ICALL(THREAD_46, "VolatileWrite(sbyte&,sbyte)", ves_icall_System_Threading_Thread_VolatileWrite1)) +NOHANDLES(ICALL(THREAD_47, "VolatileWrite(single&,single)", ves_icall_System_Threading_Thread_VolatileWriteFloat)) +NOHANDLES(ICALL(THREAD_48, "VolatileWrite(uint&,uint)", ves_icall_System_Threading_Thread_VolatileWrite4)) +NOHANDLES(ICALL(THREAD_49, "VolatileWrite(uint16&,uint16)", ves_icall_System_Threading_Thread_VolatileWrite2)) +NOHANDLES(ICALL(THREAD_50, "VolatileWrite(uintptr&,uintptr)", ves_icall_System_Threading_Thread_VolatileWriteIntPtr)) +NOHANDLES(ICALL(THREAD_51, "VolatileWrite(ulong&,ulong)", ves_icall_System_Threading_Thread_VolatileWrite8)) +NOHANDLES(ICALL(THREAD_9, "YieldInternal", ves_icall_System_Threading_Thread_YieldInternal)) +NOHANDLES(ICALL(THREAD_52, "current_lcid()", ves_icall_System_Threading_Thread_current_lcid)) ICALL_TYPE(THREADP, "System.Threading.ThreadPool", THREADP_1) HANDLES(ICALL(THREADP_1, "BindIOCompletionCallbackNative", ves_icall_System_Threading_ThreadPool_BindIOCompletionCallbackNative)) @@ -1041,37 +1019,37 @@ HANDLES(ICALL(THREADP_13, "SetMaxThreadsNative", ves_icall_System_Threading_Thre HANDLES(ICALL(THREADP_14, "SetMinThreadsNative", ves_icall_System_Threading_ThreadPool_SetMinThreadsNative)) ICALL_TYPE(TTIMER, "System.Threading.Timer", TTIMER_1) -ICALL(TTIMER_1, "GetTimeMonotonic", mono_100ns_ticks) +NOHANDLES(ICALL(TTIMER_1, "GetTimeMonotonic", mono_100ns_ticks)) ICALL_TYPE(VOLATILE, "System.Threading.Volatile", VOLATILE_28) ICALL(VOLATILE_28, "Read(T&)", ves_icall_System_Threading_Volatile_Read_T) -ICALL(VOLATILE_1, "Read(bool&)", ves_icall_System_Threading_Volatile_Read1) -ICALL(VOLATILE_2, "Read(byte&)", ves_icall_System_Threading_Volatile_Read1) -ICALL(VOLATILE_3, "Read(double&)", ves_icall_System_Threading_Volatile_ReadDouble) -ICALL(VOLATILE_4, "Read(int&)", ves_icall_System_Threading_Volatile_Read4) -ICALL(VOLATILE_5, "Read(int16&)", ves_icall_System_Threading_Volatile_Read2) -ICALL(VOLATILE_6, "Read(intptr&)", ves_icall_System_Threading_Volatile_ReadIntPtr) -ICALL(VOLATILE_7, "Read(long&)", ves_icall_System_Threading_Volatile_Read8) -ICALL(VOLATILE_8, "Read(sbyte&)", ves_icall_System_Threading_Volatile_Read1) -ICALL(VOLATILE_9, "Read(single&)", ves_icall_System_Threading_Volatile_ReadFloat) -ICALL(VOLATILE_10, "Read(uint&)", ves_icall_System_Threading_Volatile_Read4) -ICALL(VOLATILE_11, "Read(uint16&)", ves_icall_System_Threading_Volatile_Read2) -ICALL(VOLATILE_12, "Read(uintptr&)", ves_icall_System_Threading_Volatile_ReadIntPtr) -ICALL(VOLATILE_13, "Read(ulong&)", ves_icall_System_Threading_Volatile_Read8) +NOHANDLES(ICALL(VOLATILE_1, "Read(bool&)", ves_icall_System_Threading_Volatile_Read1)) +NOHANDLES(ICALL(VOLATILE_2, "Read(byte&)", ves_icall_System_Threading_Volatile_Read1)) +NOHANDLES(ICALL(VOLATILE_3, "Read(double&)", ves_icall_System_Threading_Volatile_ReadDouble)) +NOHANDLES(ICALL(VOLATILE_4, "Read(int&)", ves_icall_System_Threading_Volatile_Read4)) +NOHANDLES(ICALL(VOLATILE_5, "Read(int16&)", ves_icall_System_Threading_Volatile_Read2)) +NOHANDLES(ICALL(VOLATILE_6, "Read(intptr&)", ves_icall_System_Threading_Volatile_ReadIntPtr)) +NOHANDLES(ICALL(VOLATILE_7, "Read(long&)", ves_icall_System_Threading_Volatile_Read8)) +NOHANDLES(ICALL(VOLATILE_8, "Read(sbyte&)", ves_icall_System_Threading_Volatile_Read1)) +NOHANDLES(ICALL(VOLATILE_9, "Read(single&)", ves_icall_System_Threading_Volatile_ReadFloat)) +NOHANDLES(ICALL(VOLATILE_10, "Read(uint&)", ves_icall_System_Threading_Volatile_Read4)) +NOHANDLES(ICALL(VOLATILE_11, "Read(uint16&)", ves_icall_System_Threading_Volatile_Read2)) +NOHANDLES(ICALL(VOLATILE_12, "Read(uintptr&)", ves_icall_System_Threading_Volatile_ReadIntPtr)) +NOHANDLES(ICALL(VOLATILE_13, "Read(ulong&)", ves_icall_System_Threading_Volatile_Read8)) ICALL(VOLATILE_27, "Write(T&,T)", ves_icall_System_Threading_Volatile_Write_T) -ICALL(VOLATILE_14, "Write(bool&,bool)", ves_icall_System_Threading_Volatile_Write1) -ICALL(VOLATILE_15, "Write(byte&,byte)", ves_icall_System_Threading_Volatile_Write1) -ICALL(VOLATILE_16, "Write(double&,double)", ves_icall_System_Threading_Volatile_WriteDouble) -ICALL(VOLATILE_17, "Write(int&,int)", ves_icall_System_Threading_Volatile_Write4) -ICALL(VOLATILE_18, "Write(int16&,int16)", ves_icall_System_Threading_Volatile_Write2) -ICALL(VOLATILE_19, "Write(intptr&,intptr)", ves_icall_System_Threading_Volatile_WriteIntPtr) -ICALL(VOLATILE_20, "Write(long&,long)", ves_icall_System_Threading_Volatile_Write8) -ICALL(VOLATILE_21, "Write(sbyte&,sbyte)", ves_icall_System_Threading_Volatile_Write1) -ICALL(VOLATILE_22, "Write(single&,single)", ves_icall_System_Threading_Volatile_WriteFloat) -ICALL(VOLATILE_23, "Write(uint&,uint)", ves_icall_System_Threading_Volatile_Write4) -ICALL(VOLATILE_24, "Write(uint16&,uint16)", ves_icall_System_Threading_Volatile_Write2) -ICALL(VOLATILE_25, "Write(uintptr&,uintptr)", ves_icall_System_Threading_Volatile_WriteIntPtr) -ICALL(VOLATILE_26, "Write(ulong&,ulong)", ves_icall_System_Threading_Volatile_Write8) +NOHANDLES(ICALL(VOLATILE_14, "Write(bool&,bool)", ves_icall_System_Threading_Volatile_Write1)) +NOHANDLES(ICALL(VOLATILE_15, "Write(byte&,byte)", ves_icall_System_Threading_Volatile_Write1)) +NOHANDLES(ICALL(VOLATILE_16, "Write(double&,double)", ves_icall_System_Threading_Volatile_WriteDouble)) +NOHANDLES(ICALL(VOLATILE_17, "Write(int&,int)", ves_icall_System_Threading_Volatile_Write4)) +NOHANDLES(ICALL(VOLATILE_18, "Write(int16&,int16)", ves_icall_System_Threading_Volatile_Write2)) +NOHANDLES(ICALL(VOLATILE_19, "Write(intptr&,intptr)", ves_icall_System_Threading_Volatile_WriteIntPtr)) +NOHANDLES(ICALL(VOLATILE_20, "Write(long&,long)", ves_icall_System_Threading_Volatile_Write8)) +NOHANDLES(ICALL(VOLATILE_21, "Write(sbyte&,sbyte)", ves_icall_System_Threading_Volatile_Write1)) +NOHANDLES(ICALL(VOLATILE_22, "Write(single&,single)", ves_icall_System_Threading_Volatile_WriteFloat)) +NOHANDLES(ICALL(VOLATILE_23, "Write(uint&,uint)", ves_icall_System_Threading_Volatile_Write4)) +NOHANDLES(ICALL(VOLATILE_24, "Write(uint16&,uint16)", ves_icall_System_Threading_Volatile_Write2)) +NOHANDLES(ICALL(VOLATILE_25, "Write(uintptr&,uintptr)", ves_icall_System_Threading_Volatile_WriteIntPtr)) +NOHANDLES(ICALL(VOLATILE_26, "Write(ulong&,ulong)", ves_icall_System_Threading_Volatile_Write8)) ICALL_TYPE(WAITH, "System.Threading.WaitHandle", WAITH_1) HANDLES(ICALL(WAITH_1, "SignalAndWait_Internal", ves_icall_System_Threading_WaitHandle_SignalAndWait_Internal)) @@ -1096,7 +1074,7 @@ HANDLES(ICALL(WEBIC_3, "GetUnmanagedResourcesPtr", ves_icall_get_resources_ptr)) #ifndef DISABLE_COM ICALL_TYPE(COMOBJ, "System.__ComObject", COMOBJ_1) -ICALL(COMOBJ_1, "CreateRCW", ves_icall_System_ComObject_CreateRCW) -ICALL(COMOBJ_2, "GetInterfaceInternal", ves_icall_System_ComObject_GetInterfaceInternal) -ICALL(COMOBJ_3, "ReleaseInterfaces", ves_icall_System_ComObject_ReleaseInterfaces) +HANDLES(ICALL(COMOBJ_1, "CreateRCW", ves_icall_System_ComObject_CreateRCW)) +HANDLES(ICALL(COMOBJ_2, "GetInterfaceInternal", ves_icall_System_ComObject_GetInterfaceInternal)) +HANDLES(ICALL(COMOBJ_3, "ReleaseInterfaces", ves_icall_System_ComObject_ReleaseInterfaces)) #endif diff --git a/mono/metadata/icall-table.c b/mono/metadata/icall-table.c index 88c5e399e1..36868ad689 100644 --- a/mono/metadata/icall-table.c +++ b/mono/metadata/icall-table.c @@ -35,6 +35,7 @@ #include #include #include +#include /* * icall.c defines a lot of icalls as static, to avoid having to add prototypes for @@ -42,7 +43,7 @@ */ // Generate prototypes #define ICALL_TYPE(id,name,first) -#define ICALL(id,name,func) extern void func (void); +#define ICALL(id,name,func) ICALL_EXPORT void func (void); #define HANDLES(inner) inner #define NOHANDLES(inner) inner #include "metadata/icall-def.h" @@ -125,7 +126,7 @@ static const struct msgstrtn_t { }; static const guint16 icall_type_names_idx [] = { -#define ICALL_TYPE(id,name,first) [Icall_type_ ## id] = offsetof (struct msgstrtn_t, MSGSTRFIELD(__LINE__)), +#define ICALL_TYPE(id,name,first) (offsetof (struct msgstrtn_t, MSGSTRFIELD(__LINE__))), #define ICALL(id,name,func) #define HANDLES(inner) inner #define NOHANDLES(inner) inner @@ -162,7 +163,7 @@ static const struct msgstr_t { static const guint16 icall_names_idx [] = { #define ICALL_TYPE(id,name,first) -#define ICALL(id,name,func) [Icall_ ## id] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), +#define ICALL(id,name,func) (offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__))), #define HANDLES(inner) inner #define NOHANDLES(inner) inner #include "metadata/icall-def.h" diff --git a/mono/metadata/icall-windows.c b/mono/metadata/icall-windows.c index 306930dccf..4cb9ecd5f1 100644 --- a/mono/metadata/icall-windows.c +++ b/mono/metadata/icall-windows.c @@ -12,8 +12,8 @@ #include #include #include "mono/metadata/icall-windows-internals.h" - -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#include "mono/metadata/w32subset.h" +#if HAVE_API_SUPPORT_WIN32_SH_GET_FOLDER_PATH #include #endif @@ -45,27 +45,27 @@ mono_icall_module_get_hinstance (MonoReflectionModuleHandle module) return (gpointer) (-1); } -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#if HAVE_API_SUPPORT_WIN32_GET_COMPUTER_NAME +// Support older UWP SDK? +WINBASEAPI +BOOL +WINAPI +GetComputerNameW ( + PWSTR buffer, + PDWORD size + ); + MonoStringHandle mono_icall_get_machine_name (MonoError *error) { - gunichar2 *buf; - guint32 len; - MonoStringHandle result; + gunichar2 buf [MAX_COMPUTERNAME_LENGTH + 1]; + DWORD len = G_N_ELEMENTS (buf); - len = MAX_COMPUTERNAME_LENGTH + 1; - buf = g_new (gunichar2, len); - - result = NULL; - if (GetComputerName (buf, (PDWORD) &len)) { - result = mono_string_new_utf16_handle (mono_domain_get (), buf, len, error); - } else - result = MONO_HANDLE_NEW (MonoString, NULL); - - g_free (buf); - return result; + if (GetComputerNameW (buf, &len)) + return mono_string_new_utf16_handle (mono_domain_get (), buf, len, error); + return MONO_HANDLE_NEW (MonoString, NULL); } -#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ +#endif int mono_icall_get_platform (void) @@ -170,7 +170,7 @@ mono_icall_set_environment_variable (MonoString *name, MonoString *value) SetEnvironmentVariable (utf16_name, utf16_value); } -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#if HAVE_API_SUPPORT_WIN32_SH_GET_FOLDER_PATH MonoStringHandle mono_icall_get_windows_folder_path (int folder, MonoError *error) { @@ -189,9 +189,9 @@ mono_icall_get_windows_folder_path (int folder, MonoError *error) } return mono_string_new_handle (mono_domain_get (), "", error); } -#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ +#endif -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#if HAVE_API_SUPPORT_WIN32_SEND_MESSAGE_TIMEOUT MonoBoolean mono_icall_broadcast_setting_change (MonoError *error) { @@ -199,13 +199,15 @@ mono_icall_broadcast_setting_change (MonoError *error) SendMessageTimeout (HWND_BROADCAST, WM_SETTINGCHANGE, (WPARAM)NULL, (LPARAM)L"Environment", SMTO_ABORTIFHUNG, 2000, 0); return TRUE; } +#endif +#if HAVE_API_SUPPORT_WIN32_WAIT_FOR_INPUT_IDLE gint32 mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds) { return WaitForInputIdle (handle, milliseconds); } -#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ +#endif void mono_icall_write_windows_debug_string (const gunichar2 *message) diff --git a/mono/metadata/icall.c.REMOVED.git-id b/mono/metadata/icall.c.REMOVED.git-id index 261453f90a..cf28a9f3c9 100644 --- a/mono/metadata/icall.c.REMOVED.git-id +++ b/mono/metadata/icall.c.REMOVED.git-id @@ -1 +1 @@ -62f329a4dd84568e6c3b81b0d561ea7b0ab2bffc \ No newline at end of file +19dc54af539b21a817f00d7f3db3cead81fa8ba2 \ No newline at end of file diff --git a/mono/metadata/icalls.h b/mono/metadata/icalls.h new file mode 100644 index 0000000000..db7036050d --- /dev/null +++ b/mono/metadata/icalls.h @@ -0,0 +1,20 @@ +/** + * \file + */ + +#ifndef __MONO_METADATA_ICALLS_H__ +#define __MONO_METADATA_ICALLS_H__ + +#include + +#ifdef ENABLE_ICALL_EXPORT +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#define ICALL_DECL_EXPORT MONO_API +#define ICALL_EXPORT MONO_API +#else +#define ICALL_DECL_EXPORT /* nothing */ +/* Can't be static as icall.c defines icalls referenced by icall-tables.c */ +#define ICALL_EXPORT MONO_EXTERN_C +#endif + +#endif // __MONO_METADATA_ICALLS_H__ diff --git a/mono/metadata/image.c b/mono/metadata/image.c index a9d8d1ed26..8887fd98a1 100644 --- a/mono/metadata/image.c +++ b/mono/metadata/image.c @@ -1150,7 +1150,7 @@ static const char *ignored_assemblies_file_names[] = { "System.Threading.Overlapped.dll" }; -#define IGNORED_ASSEMBLY(HASH, NAME, GUID, VER_STR) { .hash = HASH, .assembly_name = NAME, .guid = GUID } +#define IGNORED_ASSEMBLY(HASH, NAME, GUID, VER_STR) { HASH, NAME, GUID } static const IgnoredAssembly ignored_assemblies [] = { IGNORED_ASSEMBLY (0x10CADA75, SYS_NET_HTTP, "EA2EC6DC-51DD-479C-BFC2-E713FB9E7E47", "4.1.1 net46"), @@ -1220,7 +1220,7 @@ static const char *ignored_assemblies_names[] = { "System.Threading.Overlapped" }; -#define IGNORED_ASM_VER(NAME, MAJOR, MINOR, BUILD, REVISION) { .assembly_name = NAME, .major = MAJOR, .minor = MINOR, .build = BUILD, .revision = REVISION } +#define IGNORED_ASM_VER(NAME, MAJOR, MINOR, BUILD, REVISION) { NAME, MAJOR, MINOR, BUILD, REVISION } static const IgnoredAssemblyVersion ignored_assembly_versions [] = { IGNORED_ASM_VER (SYS_GLOBALIZATION_EXT, 4, 0, 0, 0), @@ -1552,6 +1552,9 @@ register_image (MonoImage *image) g_hash_table_insert (loaded_images_by_name, (char *) image->assembly_name, image); mono_images_unlock (); + if (mono_is_problematic_image (image)) { + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Registering %s, problematic image '%s'", image->ref_only ? "REFONLY" : "default", image->name); + } return image; } @@ -1602,7 +1605,11 @@ mono_image_open_from_data_internal (char *data, guint32 data_len, gboolean need_ MonoImage * mono_image_open_from_data_with_name (char *data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus *status, gboolean refonly, const char *name) { - return mono_image_open_from_data_internal (data, data_len, need_copy, status, refonly, FALSE, name); + MonoImage *result; + MONO_ENTER_GC_UNSAFE; + result = mono_image_open_from_data_internal (data, data_len, need_copy, status, refonly, FALSE, name); + MONO_EXIT_GC_UNSAFE; + return result; } /** @@ -1611,7 +1618,11 @@ mono_image_open_from_data_with_name (char *data, guint32 data_len, gboolean need MonoImage * mono_image_open_from_data_full (char *data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus *status, gboolean refonly) { - return mono_image_open_from_data_with_name (data, data_len, need_copy, status, refonly, NULL); + MonoImage *result; + MONO_ENTER_GC_UNSAFE; + result = mono_image_open_from_data_internal (data, data_len, need_copy, status, refonly, FALSE, NULL); + MONO_EXIT_GC_UNSAFE; + return result; } /** @@ -1620,7 +1631,11 @@ mono_image_open_from_data_full (char *data, guint32 data_len, gboolean need_copy MonoImage * mono_image_open_from_data (char *data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus *status) { - return mono_image_open_from_data_full (data, data_len, need_copy, status, FALSE); + MonoImage *result; + MONO_ENTER_GC_UNSAFE; + result = mono_image_open_from_data_internal (data, data_len, need_copy, status, FALSE, FALSE, NULL); + MONO_EXIT_GC_UNSAFE; + return result; } #ifdef HOST_WIN32 @@ -1773,6 +1788,7 @@ mono_image_open_a_lot (const char *fname, MonoImageOpenStatus *status, gboolean // to see it again when we go searching for an image // to load. mono_images_unlock (); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Not returning problematic image '%s' refcount=%d", image->name, image->ref_count); return NULL; } mono_image_addref (image); diff --git a/mono/metadata/image.h b/mono/metadata/image.h index b71217ab6d..903f1acf7e 100644 --- a/mono/metadata/image.h +++ b/mono/metadata/image.h @@ -32,11 +32,14 @@ MONO_API MonoImage *mono_image_open_full (const char *fname, MonoImageOpenStatus *status, mono_bool refonly); MONO_API MonoImage *mono_pe_file_open (const char *fname, MonoImageOpenStatus *status); -MONO_API MonoImage *mono_image_open_from_data (char *data, uint32_t data_len, mono_bool need_copy, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoImage *mono_image_open_from_data (char *data, uint32_t data_len, mono_bool need_copy, MonoImageOpenStatus *status); -MONO_API MonoImage *mono_image_open_from_data_full (char *data, uint32_t data_len, mono_bool need_copy, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoImage *mono_image_open_from_data_full (char *data, uint32_t data_len, mono_bool need_copy, MonoImageOpenStatus *status, mono_bool refonly); -MONO_API MonoImage *mono_image_open_from_data_with_name (char *data, uint32_t data_len, mono_bool need_copy, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoImage *mono_image_open_from_data_with_name (char *data, uint32_t data_len, mono_bool need_copy, MonoImageOpenStatus *status, mono_bool refonly, const char *name); MONO_API void mono_image_fixup_vtable (MonoImage *image); MONO_API MonoImage *mono_image_loaded (const char *name); @@ -55,9 +58,9 @@ MONO_API int mono_image_ensure_section_idx (MonoImage *image, MONO_API uint32_t mono_image_get_entry_point (MonoImage *image); MONO_API const char *mono_image_get_resource (MonoImage *image, uint32_t offset, uint32_t *size); -MONO_RT_EXTERNAL_ONLY MONO_API MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx); +MONO_API MONO_RT_EXTERNAL_ONLY MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx); -MONO_RT_EXTERNAL_ONLY MONO_API MonoImage* mono_image_load_module (MonoImage *image, int idx); +MONO_API MONO_RT_EXTERNAL_ONLY MonoImage* mono_image_load_module (MonoImage *image, int idx); MONO_API const char* mono_image_get_name (MonoImage *image); MONO_API const char* mono_image_get_filename (MonoImage *image); diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c index 68c33e6144..a887a938c3 100644 --- a/mono/metadata/loader.c +++ b/mono/metadata/loader.c @@ -78,6 +78,10 @@ static MonoNativeTlsKey loader_lock_nest_id; static void dllmap_cleanup (void); static void cached_module_cleanup(void); +static void dllmap_insert_global (const char *dll, const char *func, const char *tdll, const char *tfunc); +static void dllmap_insert_image (MonoImage *assembly, const char *dll, const char *func, const char *tdll, const char *tfun); + + /* Class lazy loading functions */ GENERATE_GET_CLASS_WITH_CACHE (appdomain_unloaded_exception, "System", "AppDomainUnloadedException") @@ -1050,12 +1054,23 @@ mono_dllmap_lookup (MonoImage *assembly, const char *dll, const char* func, cons */ void mono_dllmap_insert (MonoImage *assembly, const char *dll, const char *func, const char *tdll, const char *tfunc) +{ + if (!assembly) + dllmap_insert_global (dll, func, tdll, tfunc); + else { + MONO_ENTER_GC_UNSAFE; + dllmap_insert_image (assembly, dll, func, tdll, tfunc); + MONO_EXIT_GC_UNSAFE; + } +} + +void +dllmap_insert_global (const char *dll, const char *func, const char *tdll, const char *tfunc) { MonoDllMap *entry; - mono_loader_init (); + mono_loader_init (); - if (!assembly) { entry = (MonoDllMap *)g_malloc0 (sizeof (MonoDllMap)); entry->dll = dll? g_strdup (dll): NULL; entry->target = tdll? g_strdup (tdll): NULL; @@ -1066,7 +1081,16 @@ mono_dllmap_insert (MonoImage *assembly, const char *dll, const char *func, cons entry->next = global_dll_map; global_dll_map = entry; global_loader_data_unlock (); - } else { +} + +void +dllmap_insert_image (MonoImage *assembly, const char *dll, const char *func, const char *tdll, const char *tfunc) +{ + MonoDllMap *entry; + g_assert (assembly != NULL); + + mono_loader_init (); + entry = (MonoDllMap *)mono_image_alloc0 (assembly, sizeof (MonoDllMap)); entry->dll = dll? mono_image_strdup (assembly, dll): NULL; entry->target = tdll? mono_image_strdup (assembly, tdll): NULL; @@ -1077,7 +1101,6 @@ mono_dllmap_insert (MonoImage *assembly, const char *dll, const char *func, cons entry->next = assembly->dll_map; assembly->dll_map = entry; mono_image_unlock (assembly); - } } static void @@ -1836,7 +1859,10 @@ get_method_constrained (MonoImage *image, MonoMethod *method, MonoClass *constra return NULL; } - MonoGenericContext inflated_method_ctx = { .class_inst = NULL, .method_inst = NULL }; + MonoGenericContext inflated_method_ctx; + memset (&inflated_method_ctx, 0, sizeof (inflated_method_ctx)); + inflated_method_ctx.class_inst = NULL; + inflated_method_ctx.method_inst = NULL; gboolean inflated_generic_method = FALSE; if (method->is_inflated) { MonoGenericContext *method_ctx = mono_method_get_context (method); @@ -2579,7 +2605,7 @@ mono_method_signature (MonoMethod *m) { ERROR_DECL (error); MonoMethodSignature *sig; - + MONO_ENTER_GC_UNSAFE; sig = mono_method_signature_checked (m, error); if (!sig) { char *type_name = mono_type_get_full_name (m->klass); @@ -2587,7 +2613,7 @@ mono_method_signature (MonoMethod *m) g_free (type_name); mono_error_cleanup (error); } - + MONO_EXIT_GC_UNSAFE; return sig; } diff --git a/mono/metadata/loader.h b/mono/metadata/loader.h index 0891613e45..085b512b42 100644 --- a/mono/metadata/loader.h +++ b/mono/metadata/loader.h @@ -13,31 +13,31 @@ MONO_BEGIN_DECLS typedef mono_bool (*MonoStackWalk) (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_bool managed, void* data); -MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod * +MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod * mono_get_method (MonoImage *image, uint32_t token, MonoClass *klass); -MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod * +MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod * mono_get_method_full (MonoImage *image, uint32_t token, MonoClass *klass, MonoGenericContext *context); -MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod * +MONO_API MONO_RT_EXTERNAL_ONLY MonoMethod * mono_get_method_constrained (MonoImage *image, uint32_t token, MonoClass *constrained_class, MonoGenericContext *context, MonoMethod **cil_method); MONO_API void mono_free_method (MonoMethod *method); -MONO_RT_EXTERNAL_ONLY MONO_API MonoMethodSignature* +MONO_API MONO_RT_EXTERNAL_ONLY MonoMethodSignature* mono_method_get_signature_full (MonoMethod *method, MonoImage *image, uint32_t token, MonoGenericContext *context); -MONO_RT_EXTERNAL_ONLY MONO_API MonoMethodSignature* +MONO_API MONO_RT_EXTERNAL_ONLY MonoMethodSignature* mono_method_get_signature (MonoMethod *method, MonoImage *image, uint32_t token); -MONO_API MonoMethodSignature* +MONO_API MonoMethodSignature* mono_method_signature (MonoMethod *method); -MONO_RT_EXTERNAL_ONLY MONO_API MonoMethodHeader* +MONO_API MONO_RT_EXTERNAL_ONLY MonoMethodHeader* mono_method_get_header (MonoMethod *method); MONO_API const char* diff --git a/mono/metadata/locales.c b/mono/metadata/locales.c index 3575098d85..e6d7074d62 100644 --- a/mono/metadata/locales.c +++ b/mono/metadata/locales.c @@ -808,10 +808,10 @@ int ves_icall_System_Globalization_CompareInfo_internal_index_char (MonoCompareI } int -ves_icall_System_Threading_Thread_current_lcid (MonoError *error) +ves_icall_System_Threading_Thread_current_lcid (void) { /* Invariant */ - return(0x007F); + return 0x007F; } static gint32 string_invariant_compare_char (gunichar2 c1, gunichar2 c2, diff --git a/mono/metadata/locales.h b/mono/metadata/locales.h index 8059491d28..6ad2560120 100644 --- a/mono/metadata/locales.h +++ b/mono/metadata/locales.h @@ -14,6 +14,7 @@ #include #include +#include /* This is a copy of System.Globalization.CompareOptions */ typedef enum { @@ -27,31 +28,74 @@ typedef enum { CompareOptions_Ordinal=0x40000000 } MonoCompareOptions; -extern MonoBoolean ves_icall_System_Globalization_CalendarData_fill_calendar_data (MonoCalendarData *this_obj, MonoString *name, gint32 calendar_index); -extern void ves_icall_System_Globalization_CultureData_fill_culture_data (MonoCultureData *this_obj, gint32 datetime_index); -extern void ves_icall_System_Globalization_CultureData_fill_number_data (MonoNumberFormatInfo* number, gint32 number_index); -extern void ves_icall_System_Globalization_CultureInfo_construct_internal_locale (MonoCultureInfo *this_obj, MonoString *locale); -extern MonoStringHandle ves_icall_System_Globalization_CultureInfo_get_current_locale_name (MonoError *error); -extern MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_lcid (MonoCultureInfo *this_obj, gint lcid); -extern MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_name (MonoCultureInfo *this_obj, MonoString *name); -extern MonoArray *ves_icall_System_Globalization_CultureInfo_internal_get_cultures (MonoBoolean neutral, MonoBoolean specific, MonoBoolean installed); -extern void ves_icall_System_Globalization_CompareInfo_construct_compareinfo (MonoCompareInfo *comp, MonoString *locale); -extern int ves_icall_System_Globalization_CompareInfo_internal_compare (MonoCompareInfo *this_obj, MonoString *str1, gint32 off1, gint32 len1, MonoString *str2, gint32 off2, gint32 len2, gint32 options); -extern void ves_icall_System_Globalization_CompareInfo_free_internal_collator (MonoCompareInfo *this_obj); -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_Globalization_CalendarData_fill_calendar_data (MonoCalendarData *this_obj, MonoString *name, gint32 calendar_index); + +ICALL_EXPORT +void ves_icall_System_Globalization_CultureData_fill_culture_data (MonoCultureData *this_obj, gint32 datetime_index); + +ICALL_EXPORT +void ves_icall_System_Globalization_CultureData_fill_number_data (MonoNumberFormatInfo* number, gint32 number_index); + +ICALL_EXPORT +void ves_icall_System_Globalization_CultureInfo_construct_internal_locale (MonoCultureInfo *this_obj, MonoString *locale); + +ICALL_EXPORT +MonoStringHandle ves_icall_System_Globalization_CultureInfo_get_current_locale_name (MonoError *error); + +ICALL_EXPORT +MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_lcid (MonoCultureInfo *this_obj, gint lcid); + +ICALL_EXPORT +MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_name (MonoCultureInfo *this_obj, MonoString *name); + +ICALL_EXPORT +MonoArray *ves_icall_System_Globalization_CultureInfo_internal_get_cultures (MonoBoolean neutral, MonoBoolean specific, MonoBoolean installed); + +ICALL_EXPORT +void ves_icall_System_Globalization_CompareInfo_construct_compareinfo (MonoCompareInfo *comp, MonoString *locale); + +ICALL_EXPORT +int ves_icall_System_Globalization_CompareInfo_internal_compare (MonoCompareInfo *this_obj, MonoString *str1, gint32 off1, gint32 len1, MonoString *str2, gint32 off2, gint32 len2, gint32 options); + +ICALL_EXPORT +void ves_icall_System_Globalization_CompareInfo_free_internal_collator (MonoCompareInfo *this_obj); + +ICALL_EXPORT +MonoBoolean ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_lcid (MonoRegionInfo *this_obj, gint lcid); -extern MonoBoolean + +ICALL_EXPORT +MonoBoolean ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_name (MonoRegionInfo *this_obj, MonoString *name); -extern void ves_icall_System_Globalization_CompareInfo_assign_sortkey (MonoCompareInfo *this_obj, MonoSortKey *key, MonoString *source, gint32 options); -extern int ves_icall_System_Globalization_CompareInfo_internal_index (MonoCompareInfo *this_obj, MonoString *source, gint32 sindex, gint32 count, MonoString *value, gint32 options, MonoBoolean first); -extern int ves_icall_System_Globalization_CompareInfo_internal_index_char (MonoCompareInfo *this_obj, MonoString *source, gint32 sindex, gint32 count, gunichar2 value, gint32 options, MonoBoolean first); + +ICALL_EXPORT +void ves_icall_System_Globalization_CompareInfo_assign_sortkey (MonoCompareInfo *this_obj, MonoSortKey *key, MonoString *source, gint32 options); + +ICALL_EXPORT +int ves_icall_System_Globalization_CompareInfo_internal_index (MonoCompareInfo *this_obj, MonoString *source, gint32 sindex, gint32 count, MonoString *value, gint32 options, MonoBoolean first); + +ICALL_EXPORT +int ves_icall_System_Globalization_CompareInfo_internal_index_char (MonoCompareInfo *this_obj, MonoString *source, gint32 sindex, gint32 count, gunichar2 value, gint32 options, MonoBoolean first); + +ICALL_EXPORT int -ves_icall_System_Threading_Thread_current_lcid (MonoError *error); -extern MonoString *ves_icall_System_String_InternalToLower_Comp (MonoString *this_obj, MonoCultureInfo *cult); -extern MonoString *ves_icall_System_String_InternalToUpper_Comp (MonoString *this_obj, MonoCultureInfo *cult); -extern gunichar2 ves_icall_System_Char_InternalToUpper_Comp (gunichar2 c, MonoCultureInfo *cult); -extern gunichar2 ves_icall_System_Char_InternalToLower_Comp (gunichar2 c, MonoCultureInfo *cult); -extern void ves_icall_System_Text_Normalization_load_normalization_resource (guint8 **argProps, guint8** argMappedChars, guint8** argCharMapIndex, guint8** argHelperIndex, guint8** argMapIdxToComposite, guint8** argCombiningClass, MonoError *error); +ves_icall_System_Threading_Thread_current_lcid (void); + +ICALL_EXPORT +MonoString *ves_icall_System_String_InternalToLower_Comp (MonoString *this_obj, MonoCultureInfo *cult); + +ICALL_EXPORT +MonoString *ves_icall_System_String_InternalToUpper_Comp (MonoString *this_obj, MonoCultureInfo *cult); + +ICALL_EXPORT +gunichar2 ves_icall_System_Char_InternalToUpper_Comp (gunichar2 c, MonoCultureInfo *cult); + +ICALL_EXPORT +gunichar2 ves_icall_System_Char_InternalToLower_Comp (gunichar2 c, MonoCultureInfo *cult); + +ICALL_EXPORT +void ves_icall_System_Text_Normalization_load_normalization_resource (guint8 **argProps, guint8** argMappedChars, guint8** argCharMapIndex, guint8** argHelperIndex, guint8** argMapIdxToComposite, guint8** argCombiningClass, MonoError *error); #endif /* _MONO_METADATA_FILEIO_H_ */ diff --git a/mono/metadata/marshal-ilgen.c.REMOVED.git-id b/mono/metadata/marshal-ilgen.c.REMOVED.git-id index 6029b7e42c..d02c7ef227 100644 --- a/mono/metadata/marshal-ilgen.c.REMOVED.git-id +++ b/mono/metadata/marshal-ilgen.c.REMOVED.git-id @@ -1 +1 @@ -f41be5a5e3fa0ca54d62daf9a2c3299a75feaf8e \ No newline at end of file +0851a5b12ca8942603fd018e39a90fdac1454109 \ No newline at end of file diff --git a/mono/metadata/marshal-windows.c b/mono/metadata/marshal-windows.c index afc4f39d7a..bb07f04840 100644 --- a/mono/metadata/marshal-windows.c +++ b/mono/metadata/marshal-windows.c @@ -31,7 +31,6 @@ void mono_marshal_free_hglobal (gpointer ptr) { GlobalFree (ptr); - return; } #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ @@ -45,7 +44,6 @@ void mono_marshal_free_co_task_mem (void *ptr) { CoTaskMemFree (ptr); - return; } gpointer @@ -54,73 +52,89 @@ mono_marshal_realloc_co_task_mem (gpointer ptr, size_t size) return CoTaskMemRealloc (ptr, size); } -gpointer -ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string) +char* +ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (const gunichar2 *s, int length, MonoError *error) { - ERROR_DECL (error); - char* tres, *ret; - size_t len; - tres = mono_string_to_utf8_checked (string, error); - if (mono_error_set_pending_exception (error)) - return NULL; + // FIXME pass mono_utf16_to_utf8 an allocator to avoid double alloc/copy. + + char* tres = mono_utf16_to_utf8 (s, length, error); + return_val_if_nok (error, NULL); if (!tres) return tres; /* - * mono_string_to_utf8_checked() returns a memory area at least as large as the size of the - * MonoString, even if it contains NULL characters. The copy we allocate here has to be equally + * mono_utf16_to_utf8() returns a memory area at least as large as length, + * even if it contains NULL characters. The copy we allocate here has to be equally * large. */ - len = MAX (strlen (tres) + 1, string->length); - ret = ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal ((gpointer)len); - memcpy (ret, tres, len); + size_t len = MAX (strlen (tres) + 1, length); + char* ret = ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (len, error); + if (ret) + memcpy (ret, tres, len); g_free (tres); return ret; } -gpointer -ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString *string) +gunichar2* +ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (const gunichar2 *s, int length, MonoError *error) { - if (string == NULL) + if (!s) return NULL; - else { - size_t len = ((mono_string_length (string) + 1) * 2); - gunichar2 *res = ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal ((gpointer)len); - memcpy (res, mono_string_chars (string), mono_string_length (string) * 2); - res [mono_string_length (string)] = 0; - return res; + gsize const len = ((gsize)length + 1) * 2; + gunichar2 *res = ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (len, error); + if (res) { + memcpy (res, s, length * 2); + res [length] = 0; } + return res; } gpointer -mono_string_to_utf8str (MonoString *s) +mono_string_to_utf8str_handle (MonoStringHandle s, MonoError *error) { char *as, *tmp; glong len; GError *gerror = NULL; - if (s == NULL) + if (MONO_HANDLE_IS_NULL (s)) return NULL; - if (!s->length) { + if (!mono_string_handle_length (s)) { as = CoTaskMemAlloc (1); + g_assert (as); as [0] = '\0'; return as; } - tmp = g_utf16_to_utf8 (mono_string_chars (s), s->length, NULL, &len, &gerror); + // FIXME pass g_utf16_to_utf8 an allocator to avoid double alloc/copy. + + uint32_t gchandle = 0; + tmp = g_utf16_to_utf8 (mono_string_handle_pin_chars (s, &gchandle), mono_string_handle_length (s), NULL, &len, &gerror); + mono_gchandle_free (gchandle); if (gerror) { - MonoException *exc = mono_get_exception_argument ("string", gerror->message); + mono_error_set_argument (error, "string", gerror->message); g_error_free (gerror); - mono_set_pending_exception (exc); return NULL; } else { as = CoTaskMemAlloc (len + 1); + g_assert (as); memcpy (as, tmp, len + 1); g_free (tmp); return as; } } +/* This is a JIT icall, it sets the pending exception and returns NULL on error. */ +gpointer +mono_string_to_utf8str (MonoString *s_raw) +{ + HANDLE_FUNCTION_ENTER (); + ERROR_DECL (error); + MONO_HANDLE_DCL (MonoString, s); + gpointer result = mono_string_to_utf8str_handle (s, error); + mono_error_set_pending_exception (error); + HANDLE_FUNCTION_RETURN_VAL (result); +} + #endif /* HOST_WIN32 */ diff --git a/mono/metadata/marshal.c.REMOVED.git-id b/mono/metadata/marshal.c.REMOVED.git-id index 814fc1e154..24c0dfd80f 100644 --- a/mono/metadata/marshal.c.REMOVED.git-id +++ b/mono/metadata/marshal.c.REMOVED.git-id @@ -1 +1 @@ -d7c0d78283406062508ff7aa85aca7b59d9ed364 \ No newline at end of file +683582c79fe6e5aa8bedafea63a75054f637c92b \ No newline at end of file diff --git a/mono/metadata/marshal.h b/mono/metadata/marshal.h index 510cb913ef..bfd0c0da89 100644 --- a/mono/metadata/marshal.h +++ b/mono/metadata/marshal.h @@ -20,6 +20,10 @@ #include #include #include +#include + +typedef gunichar2 *mono_bstr; +typedef const gunichar2 *mono_bstr_const; #define mono_marshal_find_bitfield_offset(type, elem, byte_offset, bitmask) \ do { \ @@ -343,8 +347,8 @@ mono_type_native_stack_size (MonoType *type, guint32 *alignment); gpointer mono_string_to_ansibstr (MonoString *string_obj); -gpointer -mono_ptr_to_bstr (gpointer ptr, int slen); +mono_bstr +mono_ptr_to_bstr (const gunichar2* ptr, int slen); gpointer mono_string_to_bstr(MonoString* str); @@ -363,7 +367,7 @@ mono_free_lparray (MonoArray *array, gpointer* nativeArray); void mono_marshal_ftnptr_eh_callback (guint32 gchandle); -void +MONO_PAL_API void mono_marshal_set_last_error (void); guint @@ -477,7 +481,7 @@ MonoMethod * mono_marshal_get_array_accessor_wrapper (MonoMethod *method); MonoMethod * -mono_marshal_get_generic_array_helper (MonoClass *klass, gchar *name, MonoMethod *method); +mono_marshal_get_generic_array_helper (MonoClass *klass, const gchar *name, MonoMethod *method); MonoMethod * mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method); @@ -514,9 +518,11 @@ mono_marshal_free_ccw (MonoObject* obj); void mono_cominterop_release_all_rcws (void); +ICALL_EXPORT MonoString* -ves_icall_mono_string_from_utf16 (gunichar2 *data); +ves_icall_mono_string_from_utf16 (const gunichar2 *data); +ICALL_EXPORT char* ves_icall_mono_string_to_utf8 (MonoString *str); @@ -538,10 +544,10 @@ mono_string_to_utf8str (MonoString *string_obj); #endif MonoStringBuilder * -mono_string_utf8_to_builder2 (char *text); +mono_string_utf8_to_builder2 (const char *text); MonoStringBuilder * -mono_string_utf16_to_builder2 (gunichar2 *text); +mono_string_utf16_to_builder2 (const gunichar2 *text); gchar* mono_string_builder_to_utf8 (MonoStringBuilder *sb); @@ -550,10 +556,10 @@ gunichar2* mono_string_builder_to_utf16 (MonoStringBuilder *sb); void -mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text); +mono_string_utf8_to_builder (MonoStringBuilder *sb, const char *text); void -mono_string_utf16_to_builder (MonoStringBuilder *sb, gunichar2 *text); +mono_string_utf16_to_builder (MonoStringBuilder *sb, const gunichar2 *text); void mono_string_to_byvalstr (gpointer dst, MonoString *src, int size); @@ -585,6 +591,7 @@ mono_struct_delete_old (MonoClass *klass, char *ptr); MonoObject* mono_object_isinst_icall (MonoObject *obj, MonoClass *klass); +ICALL_EXPORT MonoString* ves_icall_string_new_wrapper (const char *text); @@ -638,143 +645,188 @@ mono_icall_end (MonoThreadInfo *info, HandleStackMark *stackmark, MonoError *err MonoObjectHandle mono_icall_handle_new (gpointer rawobj); -MonoObjectHandle +gpointer mono_icall_handle_new_interior (gpointer rawobj); +ICALL_EXPORT void* ves_icall_marshal_alloc (gsize size); +ICALL_EXPORT void -ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged (MonoArray *src, gint32 start_index, - gpointer dest, gint32 length); +ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged (MonoArrayHandle src, gint32 start_index, + gpointer dest, gint32 length, gconstpointer managed_source_addr, MonoError *error); +ICALL_EXPORT void -ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer src, gint32 start_index, - MonoArray *dest, gint32 length); +ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gconstpointer src, gint32 start_index, + MonoArrayHandle dest, gint32 length, gpointer managed_dest_addr, MonoError *error); +ICALL_EXPORT MonoStringHandle -ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr, MonoError *error); +ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (const char *ptr, MonoError *error); -MonoString * -ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (char *ptr, gint32 len); +ICALL_EXPORT +MonoStringHandle +ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (const char *ptr, gint32 len, MonoError *error); -MonoString * -ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (guint16 *ptr); +ICALL_EXPORT +MonoStringHandle +ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (const guint16 *ptr, MonoError *error); -MonoString * -ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (guint16 *ptr, gint32 len); +ICALL_EXPORT +MonoStringHandle +ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (const guint16 *ptr, gint32 len, MonoError *error); -MonoString * -ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (gpointer ptr); +ICALL_EXPORT +MonoStringHandle +ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (mono_bstr_const ptr, MonoError *error); +ICALL_EXPORT guint32 -ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal (MonoReflectionMethod *m); +ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal (MonoReflectionMethodHandle m, MonoError *error); +ICALL_EXPORT guint32 ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error (void); +ICALL_EXPORT guint32 ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionTypeHandle rtype, MonoError *error); +ICALL_EXPORT void -ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObject *obj, gpointer dst, MonoBoolean delete_old); +ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObjectHandle obj, gpointer dst, MonoBoolean delete_old, MonoError *error); +ICALL_EXPORT void -ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gpointer src, MonoObject *dst); +ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gconstpointer src, MonoObjectHandle dst, MonoError *error); -MonoObject * -ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gpointer src, MonoReflectionType *type); +ICALL_EXPORT +MonoObjectHandle +ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gconstpointer src, MonoReflectionTypeHandle type, MonoError *error); +ICALL_EXPORT int ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionTypeHandle type, MonoStringHandle field_name, MonoError *error); -gpointer -ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR (MonoString *string); +ICALL_EXPORT +mono_bstr +ves_icall_System_Runtime_InteropServices_Marshal_BufferToBSTR (const gunichar2 *ptr, int len, MonoError *error); -gpointer -ves_icall_System_Runtime_InteropServices_Marshal_BufferToBSTR (MonoArray *ptr, int len); +ICALL_EXPORT +char* +ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (const gunichar2 *s, int length, MonoError *error); -gpointer -ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string); - -gpointer -ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString *string); +ICALL_EXPORT +gunichar2* +ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (const gunichar2 *s, int length, MonoError *error); +ICALL_EXPORT void -ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoReflectionType *type); +ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoReflectionTypeHandle type, MonoError *error); +ICALL_EXPORT void* -ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size); +ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size, MonoError *error); +ICALL_EXPORT void* -ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize (gulong size); +ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize (gulong size, MonoError *error); +ICALL_EXPORT void -ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr); +ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr, MonoError *error); +ICALL_EXPORT gpointer -ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, int size); +ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, int size, MonoError *error); +ICALL_EXPORT void* -ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (gpointer size); +ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (gsize size, MonoError *error); +ICALL_EXPORT gpointer -ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, gpointer size); +ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, gsize size, MonoError *error); +ICALL_EXPORT void -ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal (void *ptr); +ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal (void *ptr, MonoError *error); +ICALL_EXPORT void -ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR (void *ptr); +ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR (mono_bstr_const ptr, MonoError *error); +ICALL_EXPORT void* ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement (MonoArray *arrayobj, int index); +ICALL_EXPORT MonoDelegateHandle ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal (void *ftn, MonoReflectionTypeHandle type, MonoError *error); +ICALL_EXPORT gpointer ves_icall_System_Runtime_InteropServices_Marshal_GetFunctionPointerForDelegateInternal (MonoDelegateHandle delegate, MonoError *error); +ICALL_EXPORT int -ves_icall_System_Runtime_InteropServices_Marshal_AddRefInternal (gpointer pUnk); +ves_icall_System_Runtime_InteropServices_Marshal_AddRefInternal (MonoIUnknown *pUnk, MonoError *error); +ICALL_EXPORT int -ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (gpointer pUnk, gpointer riid, gpointer* ppv); +ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (MonoIUnknown *pUnk, gconstpointer riid, gpointer* ppv, MonoError *error); +ICALL_EXPORT int -ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (gpointer pUnk); +ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (MonoIUnknown *pUnk, MonoError *error); +ICALL_EXPORT void* -ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal (MonoObject* object); +ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal (MonoObjectHandle object, MonoError *error); -MonoObject* -ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW (void* pUnk); +ICALL_EXPORT +MonoObjectHandle +ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW (void* pUnk, MonoError *error); +ICALL_EXPORT void* -ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal (MonoObject* object); +ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal (MonoObjectHandle object, MonoError *error); +ICALL_EXPORT void* -ves_icall_System_Runtime_InteropServices_Marshal_GetCCW (MonoObject* object, MonoReflectionType* type); +ves_icall_System_Runtime_InteropServices_Marshal_GetCCW (MonoObjectHandle object, MonoReflectionTypeHandle type, MonoError *error); +ICALL_EXPORT MonoBoolean -ves_icall_System_Runtime_InteropServices_Marshal_IsComObject (MonoObject* object); +ves_icall_System_Runtime_InteropServices_Marshal_IsComObject (MonoObjectHandle object, MonoError *error); +ICALL_EXPORT gint32 -ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal (MonoObject* object); +ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal (MonoObjectHandle object, MonoError *error); -MonoObject * -ves_icall_System_ComObject_CreateRCW (MonoReflectionType *type); +ICALL_EXPORT +MonoObjectHandle +ves_icall_System_ComObject_CreateRCW (MonoReflectionTypeHandle ref_type, MonoError *error); +ICALL_EXPORT void -ves_icall_System_ComObject_ReleaseInterfaces(MonoComObject* obj); +mono_System_ComObject_ReleaseInterfaces (MonoComObjectHandle obj); +ICALL_EXPORT +void +ves_icall_System_ComObject_ReleaseInterfaces (MonoComObjectHandle obj, MonoError *error); + +ICALL_EXPORT gpointer -ves_icall_System_ComObject_GetInterfaceInternal (MonoComObject* obj, MonoReflectionType* type, MonoBoolean throw_exception); +ves_icall_System_ComObject_GetInterfaceInternal (MonoComObjectHandle obj, MonoReflectionTypeHandle ref_type, MonoBoolean throw_exception, MonoError *error); +ICALL_EXPORT void ves_icall_Mono_Interop_ComInteropProxy_AddProxy (gpointer pUnk, MonoComInteropProxyHandle proxy, MonoError *error); +ICALL_EXPORT MonoComInteropProxyHandle ves_icall_Mono_Interop_ComInteropProxy_FindProxy (gpointer pUnk, MonoError *error); @@ -826,6 +878,7 @@ mono_marshal_use_aot_wrappers (gboolean use); MonoObject * mono_marshal_xdomain_copy_value (MonoObject *val, MonoError *error); +ICALL_EXPORT MonoObject * ves_icall_mono_marshal_xdomain_copy_value (MonoObject *val); @@ -847,5 +900,3 @@ mono_mb_create_and_cache_full (GHashTable *cache, gpointer key, G_END_DECLS #endif /* __MONO_MARSHAL_H__ */ - - diff --git a/mono/metadata/metadata.c.REMOVED.git-id b/mono/metadata/metadata.c.REMOVED.git-id index 51b998e0ac..552ded14ce 100644 --- a/mono/metadata/metadata.c.REMOVED.git-id +++ b/mono/metadata/metadata.c.REMOVED.git-id @@ -1 +1 @@ -6c775b7cde5c9c53e4e0a68d43cdc9241b73a445 \ No newline at end of file +20bbcdecd735865a236f0fcd6309a4c18095285e \ No newline at end of file diff --git a/mono/metadata/metadata.h b/mono/metadata/metadata.h index 179eb6b0aa..ed75175f39 100644 --- a/mono/metadata/metadata.h +++ b/mono/metadata/metadata.h @@ -236,8 +236,8 @@ MONO_API uint32_t mono_metadata_typedef_from_method (MonoImage *meta, uint32_t t MONO_API uint32_t mono_metadata_nested_in_typedef (MonoImage *meta, uint32_t table_index); MONO_API uint32_t mono_metadata_nesting_typedef (MonoImage *meta, uint32_t table_index, uint32_t start_index); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoClass** mono_metadata_interfaces_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *count); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoClass** mono_metadata_interfaces_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *count); MONO_API uint32_t mono_metadata_events_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *end_idx); MONO_API uint32_t mono_metadata_methods_from_event (MonoImage *meta, uint32_t table_index, unsigned int *end); @@ -399,28 +399,27 @@ MONO_API int mono_metadata_parse_custom_mod (MonoImage *m, MonoCustomMod *dest, const char *ptr, const char **rptr); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArrayType *mono_metadata_parse_array (MonoImage *m, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoArrayType *mono_metadata_parse_array (MonoImage *m, const char *ptr, const char **rptr); MONO_API void mono_metadata_free_array (MonoArrayType *array); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoType *mono_metadata_parse_type (MonoImage *m, +MONO_API MONO_RT_EXTERNAL_ONLY MonoType *mono_metadata_parse_type (MonoImage *m, MonoParseTypeMode mode, short opt_attrs, const char *ptr, const char **rptr); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoType *mono_metadata_parse_param (MonoImage *m, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoType *mono_metadata_parse_param (MonoImage *m, const char *ptr, const char **rptr); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoType *mono_metadata_parse_field_type (MonoImage *m, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoType *mono_metadata_parse_field_type (MonoImage *m, short field_flags, const char *ptr, const char **rptr); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoType *mono_type_create_from_typespec (MonoImage *image, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoType *mono_type_create_from_typespec (MonoImage *image, uint32_t type_spec); MONO_API void mono_metadata_free_type (MonoType *type); MONO_API int mono_type_size (MonoType *type, @@ -438,12 +437,12 @@ MONO_API MonoMethodSignature *mono_metadata_signature_alloc (MonoImage *image, MONO_API MonoMethodSignature *mono_metadata_signature_dup (MonoMethodSignature *sig); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoMethodSignature *mono_metadata_parse_signature (MonoImage *image, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoMethodSignature *mono_metadata_parse_signature (MonoImage *image, uint32_t token); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoMethodSignature *mono_metadata_parse_method_signature (MonoImage *m, +MONO_API MONO_RT_EXTERNAL_ONLY +MonoMethodSignature *mono_metadata_parse_method_signature (MonoImage *m, int def, const char *ptr, const char **rptr); @@ -454,8 +453,8 @@ MONO_API mono_bool mono_metadata_signature_equal (MonoMethodSignature * MONO_API unsigned int mono_signature_hash (MonoMethodSignature *sig); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoMethodHeader *mono_metadata_parse_mh (MonoImage *m, const char *ptr); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoMethodHeader *mono_metadata_parse_mh (MonoImage *m, const char *ptr); MONO_API void mono_metadata_free_mh (MonoMethodHeader *mh); /* MonoMethodHeader acccessors */ diff --git a/mono/metadata/method-builder-ilgen.c b/mono/metadata/method-builder-ilgen.c index 52cb0c5148..832c88e81a 100644 --- a/mono/metadata/method-builder-ilgen.c +++ b/mono/metadata/method-builder-ilgen.c @@ -548,11 +548,13 @@ mono_mb_emit_icall (MonoMethodBuilder *mb, gpointer func) void mono_mb_emit_exception_full (MonoMethodBuilder *mb, const char *exc_nspace, const char *exc_name, const char *msg) { + ERROR_DECL (error); MonoMethod *ctor = NULL; MonoClass *mme = mono_class_load_from_name (mono_defaults.corlib, exc_nspace, exc_name); mono_class_init (mme); - ctor = mono_class_get_method_from_name (mme, ".ctor", 0); + ctor = mono_class_get_method_from_name_checked (mme, ".ctor", 0, 0, error); + mono_error_assert_ok (error); g_assert (ctor); mono_mb_emit_op (mb, CEE_NEWOBJ, ctor); if (msg != NULL) { diff --git a/mono/metadata/monitor.c b/mono/metadata/monitor.c index 51287794e8..0d6a68d1d7 100644 --- a/mono/metadata/monitor.c +++ b/mono/metadata/monitor.c @@ -611,7 +611,7 @@ mono_object_hash (MonoObject* obj) mono_monitor_inflate (obj); lw.sync = obj->synchronisation; } else if (lock_word_is_flat (lw)) { - int id = mono_thread_info_get_small_id (); + int const id = mono_thread_info_get_small_id (); if (lock_word_get_owner (lw) == id) mono_monitor_inflate_owned (obj, id); else @@ -967,7 +967,7 @@ static inline gint32 mono_monitor_try_enter_internal (MonoObject *obj, guint32 ms, gboolean allow_interruption) { LockWord lw; - int id = mono_thread_info_get_small_id (); + int const id = mono_thread_info_get_small_id (); LOCK_DEBUG (g_message("%s: (%d) Trying to lock object %p (%d ms)", __func__, id, obj, ms)); @@ -1270,16 +1270,15 @@ ves_icall_System_Threading_Monitor_Monitor_test_synchronised (MonoObject *obj) * any extra struct locking */ -void -ves_icall_System_Threading_Monitor_Monitor_pulse (MonoObject *obj) +static void +mono_monitor_pulse (MonoObject *obj, const char *func, gboolean all) { - int id; + int const id = mono_thread_info_get_small_id (); LockWord lw; MonoThreadsSync *mon; - LOCK_DEBUG (g_message ("%s: (%d) Pulsing %p", __func__, mono_thread_info_get_small_id (), obj)); + LOCK_DEBUG (g_message ("%s: (%d) Pulsing %p", func, id, obj)); - id = mono_thread_info_get_small_id (); lw.sync = obj->synchronisation; if (!mono_monitor_ensure_owned (lw, id)) @@ -1292,46 +1291,28 @@ ves_icall_System_Threading_Monitor_Monitor_pulse (MonoObject *obj) mon = lock_word_get_inflated_lock (lw); - LOCK_DEBUG (g_message ("%s: (%d) %d threads waiting", __func__, mono_thread_info_get_small_id (), g_slist_length (mon->wait_list))); + LOCK_DEBUG (g_message ("%s: (%d) %d threads waiting", func, id, g_slist_length (mon->wait_list))); - if (mon->wait_list != NULL) { - LOCK_DEBUG (g_message ("%s: (%d) signalling and dequeuing handle %p", __func__, mono_thread_info_get_small_id (), mon->wait_list->data)); - - mono_w32event_set (mon->wait_list->data); - mon->wait_list = g_slist_remove (mon->wait_list, mon->wait_list->data); - } + do { + if (mon->wait_list != NULL) { + LOCK_DEBUG (g_message ("%s: (%d) signalling and dequeuing handle %p", func, id, mon->wait_list->data)); + + mono_w32event_set (mon->wait_list->data); + mon->wait_list = g_slist_remove (mon->wait_list, mon->wait_list->data); + } + } while (all && mon->wait_list); +} + +void +ves_icall_System_Threading_Monitor_Monitor_pulse (MonoObject *obj) +{ + mono_monitor_pulse (obj, __func__, FALSE); } void ves_icall_System_Threading_Monitor_Monitor_pulse_all (MonoObject *obj) { - int id; - LockWord lw; - MonoThreadsSync *mon; - - LOCK_DEBUG (g_message("%s: (%d) Pulsing all %p", __func__, mono_thread_info_get_small_id (), obj)); - - id = mono_thread_info_get_small_id (); - lw.sync = obj->synchronisation; - - if (!mono_monitor_ensure_owned (lw, id)) - return; - - if (!lock_word_is_inflated (lw)) { - /* No threads waiting. A wait would have inflated the lock */ - return; - } - - mon = lock_word_get_inflated_lock (lw); - - LOCK_DEBUG (g_message ("%s: (%d) %d threads waiting", __func__, mono_thread_info_get_small_id (), g_slist_length (mon->wait_list))); - - while (mon->wait_list != NULL) { - LOCK_DEBUG (g_message ("%s: (%d) signalling and dequeuing handle %p", __func__, mono_thread_info_get_small_id (), mon->wait_list->data)); - - mono_w32event_set (mon->wait_list->data); - mon->wait_list = g_slist_remove (mon->wait_list, mon->wait_list->data); - } + mono_monitor_pulse (obj, __func__, TRUE); } MonoBoolean @@ -1345,9 +1326,9 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms) gboolean success = FALSE; gint32 regain; MonoInternalThread *thread = mono_thread_internal_current (); - int id = mono_thread_info_get_small_id (); + int const id = mono_thread_info_get_small_id (); - LOCK_DEBUG (g_message ("%s: (%d) Trying to wait for %p with timeout %dms", __func__, mono_thread_info_get_small_id (), obj, ms)); + LOCK_DEBUG (g_message ("%s: (%d) Trying to wait for %p with timeout %dms", __func__, id, obj, ms)); lw.sync = obj->synchronisation; @@ -1373,7 +1354,7 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms) return FALSE; } - LOCK_DEBUG (g_message ("%s: (%d) queuing handle %p", __func__, mono_thread_info_get_small_id (), event)); + LOCK_DEBUG (g_message ("%s: (%d) queuing handle %p", __func__, id, event)); /* This looks superfluous */ if (mono_thread_current_check_pending_interrupt ()) { @@ -1391,7 +1372,7 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms) mono_memory_write_barrier (); mono_monitor_exit_inflated (obj); - LOCK_DEBUG (g_message ("%s: (%d) Unlocked %p lock %p", __func__, mono_thread_info_get_small_id (), obj, mon)); + LOCK_DEBUG (g_message ("%s: (%d) Unlocked %p lock %p", __func__, id, obj, mon)); /* There's no race between unlocking mon and waiting for the * event, because auto reset events are sticky, and this event @@ -1421,7 +1402,7 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms) mon->nest = nest; - LOCK_DEBUG (g_message ("%s: (%d) Regained %p lock %p", __func__, mono_thread_info_get_small_id (), obj, mon)); + LOCK_DEBUG (g_message ("%s: (%d) Regained %p lock %p", __func__, id, obj, mon)); if (ret == MONO_W32HANDLE_WAIT_RET_TIMEOUT) { /* Poll the event again, just in case it was signalled @@ -1447,10 +1428,10 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms) */ if (ret == MONO_W32HANDLE_WAIT_RET_SUCCESS_0) { - LOCK_DEBUG (g_message ("%s: (%d) Success", __func__, mono_thread_info_get_small_id ())); + LOCK_DEBUG (g_message ("%s: (%d) Success", __func__, id)); success = TRUE; } else { - LOCK_DEBUG (g_message ("%s: (%d) Wait failed, dequeuing handle %p", __func__, mono_thread_info_get_small_id (), event)); + LOCK_DEBUG (g_message ("%s: (%d) Wait failed, dequeuing handle %p", __func__, id, event)); /* No pulse, so we have to remove ourself from the * wait queue */ diff --git a/mono/metadata/monitor.h b/mono/metadata/monitor.h index e2a0e532a9..e082d80a02 100644 --- a/mono/metadata/monitor.h +++ b/mono/metadata/monitor.h @@ -15,6 +15,7 @@ #include #include #include +#include G_BEGIN_DECLS @@ -78,15 +79,10 @@ struct _MonoThreadsSync */ typedef union { -#if SIZEOF_REGISTER == 8 - guint64 lock_word; -#elif SIZEOF_REGISTER == 4 - guint32 lock_word; -#endif + gsize lock_word; MonoThreadsSync *sync; } LockWord; - enum { LOCK_WORD_FLAT = 0, LOCK_WORD_HAS_HASH = 1, @@ -103,30 +99,63 @@ enum { LOCK_WORD_OWNER_SHIFT = LOCK_WORD_STATUS_BITS + LOCK_WORD_NEST_BITS }; -MONO_API void mono_locks_dump (gboolean include_untaken); +MONO_API void +mono_locks_dump (gboolean include_untaken); -void mono_monitor_init (void); -void mono_monitor_cleanup (void); +void +mono_monitor_init (void); -MonoBoolean mono_monitor_enter_internal (MonoObject *obj); -void mono_monitor_enter_v4_internal (MonoObject *obj, MonoBoolean *lock_taken); +void +mono_monitor_cleanup (void); -guint32 mono_monitor_enter_fast (MonoObject *obj); -guint32 mono_monitor_enter_v4_fast (MonoObject *obj, MonoBoolean *lock_taken); +MonoBoolean +mono_monitor_enter_internal (MonoObject *obj); -guint32 mono_monitor_get_object_monitor_gchandle (MonoObject *object); +void +mono_monitor_enter_v4_internal (MonoObject *obj, MonoBoolean *lock_taken); -void mono_monitor_threads_sync_members_offset (int *status_offset, int *nest_offset); +guint32 +mono_monitor_enter_fast (MonoObject *obj); + +guint32 +mono_monitor_enter_v4_fast (MonoObject *obj, MonoBoolean *lock_taken); + +guint32 +mono_monitor_get_object_monitor_gchandle (MonoObject *object); + +void +mono_monitor_threads_sync_members_offset (int *status_offset, int *nest_offset); #define MONO_THREADS_SYNC_MEMBER_OFFSET(o) ((o)>>8) #define MONO_THREADS_SYNC_MEMBER_SIZE(o) ((o)&0xff) -extern MonoBoolean ves_icall_System_Threading_Monitor_Monitor_test_owner(MonoObject *obj); -extern MonoBoolean ves_icall_System_Threading_Monitor_Monitor_test_synchronised(MonoObject *obj); -extern void ves_icall_System_Threading_Monitor_Monitor_pulse(MonoObject *obj); -extern void ves_icall_System_Threading_Monitor_Monitor_pulse_all(MonoObject *obj); -extern MonoBoolean ves_icall_System_Threading_Monitor_Monitor_wait(MonoObject *obj, guint32 ms); -extern void ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObject *obj, guint32 ms, MonoBoolean *lockTaken); -extern void ves_icall_System_Threading_Monitor_Monitor_Enter (MonoObject *obj); +ICALL_EXPORT +MonoBoolean +ves_icall_System_Threading_Monitor_Monitor_test_owner (MonoObject *obj); + +ICALL_EXPORT +MonoBoolean +ves_icall_System_Threading_Monitor_Monitor_test_synchronised (MonoObject *obj); + +ICALL_EXPORT +void +ves_icall_System_Threading_Monitor_Monitor_pulse (MonoObject *obj); + +ICALL_EXPORT +void +ves_icall_System_Threading_Monitor_Monitor_pulse_all (MonoObject *obj); + +ICALL_EXPORT +MonoBoolean +ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms); + +ICALL_EXPORT +void +ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObject *obj, guint32 ms, MonoBoolean *lockTaken); + +ICALL_EXPORT +void +ves_icall_System_Threading_Monitor_Monitor_Enter (MonoObject *obj); + G_END_DECLS #endif /* _MONO_METADATA_MONITOR_H_ */ diff --git a/mono/metadata/mono-conc-hash.c b/mono/metadata/mono-conc-hash.c index 2aa1fe225b..b2c9107077 100644 --- a/mono/metadata/mono-conc-hash.c +++ b/mono/metadata/mono-conc-hash.c @@ -32,7 +32,8 @@ struct _MonoConcGHashTable { volatile conc_table *table; /* goes to HP0 */ GHashFunc hash_func; GEqualFunc equal_func; - int element_count; + int element_count; //KVP + tombstones + int tombstone_count; //just tombstones int overflow_count; GDestroyNotify key_destroy_func; GDestroyNotify value_destroy_func; @@ -150,10 +151,10 @@ insert_one_local (conc_table *table, GHashFunc hash_func, gpointer key, gpointer } static void -expand_table (MonoConcGHashTable *hash_table) +rehash_table (MonoConcGHashTable *hash_table, int multiplier) { conc_table *old_table = (conc_table*)hash_table->table; - conc_table *new_table = conc_table_new (hash_table, old_table->table_size * EXPAND_RATIO); + conc_table *new_table = conc_table_new (hash_table, old_table->table_size * multiplier); int i; for (i = 0; i < old_table->table_size; ++i) { @@ -168,6 +169,18 @@ expand_table (MonoConcGHashTable *hash_table) } +static void +check_table_size (MonoConcGHashTable *hash_table) +{ + if (hash_table->element_count >= hash_table->overflow_count) { + //if we have more tombstones than KVP we rehash to the same size + if (hash_table->tombstone_count > hash_table->element_count / 2) + rehash_table (hash_table, 1); + else + rehash_table (hash_table, EXPAND_RATIO); + } +} + MonoConcGHashTable * mono_conc_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, void *key, const char *msg) { @@ -323,8 +336,7 @@ mono_conc_g_hash_table_insert (MonoConcGHashTable *hash_table, gpointer key, gpo hash = mix_hash (hash_table->hash_func (key)); - if (hash_table->element_count >= hash_table->overflow_count) - expand_table (hash_table); + check_table_size (hash_table); table = (conc_table*)hash_table->table; table_mask = table->table_size - 1; @@ -333,13 +345,18 @@ mono_conc_g_hash_table_insert (MonoConcGHashTable *hash_table, gpointer key, gpo if (!hash_table->equal_func) { for (;;) { gpointer cur_key = table->keys [i]; - if (!cur_key || key_is_tombstone (hash_table, cur_key)) { + gboolean is_tombstone = FALSE; + if (!cur_key || (is_tombstone = key_is_tombstone (hash_table, cur_key))) { set_value (table, i, value); /* The write to values must happen after the write to keys */ mono_memory_barrier (); set_key (table, i, key); - ++hash_table->element_count; + if (is_tombstone) + --hash_table->tombstone_count; + else + ++hash_table->element_count; + return NULL; } if (key == cur_key) { @@ -352,12 +369,17 @@ mono_conc_g_hash_table_insert (MonoConcGHashTable *hash_table, gpointer key, gpo GEqualFunc equal = hash_table->equal_func; for (;;) { gpointer cur_key = table->keys [i]; - if (!cur_key || key_is_tombstone (hash_table, cur_key)) { + gboolean is_tombstone = FALSE; + if (!cur_key || (is_tombstone = key_is_tombstone (hash_table, cur_key))) { set_value (table, i, value); /* The write to values must happen after the write to keys */ mono_memory_barrier (); set_key (table, i, key); - ++hash_table->element_count; + if (is_tombstone) + --hash_table->tombstone_count; + else + ++hash_table->element_count; + return NULL; } if (equal (key, cur_key)) { @@ -395,14 +417,14 @@ mono_conc_g_hash_table_remove (MonoConcGHashTable *hash_table, gconstpointer key table->values [i] = NULL; mono_memory_barrier (); set_key_to_tombstone (table, i); - - --hash_table->element_count; + ++hash_table->tombstone_count; if (hash_table->key_destroy_func != NULL) (*hash_table->key_destroy_func) (cur_key); if (hash_table->value_destroy_func != NULL) (*hash_table->value_destroy_func) (value); + check_table_size (hash_table); return value; } i = (i + 1) & table_mask; @@ -425,6 +447,8 @@ mono_conc_g_hash_table_remove (MonoConcGHashTable *hash_table, gconstpointer key (*hash_table->key_destroy_func) (cur_key); if (hash_table->value_destroy_func != NULL) (*hash_table->value_destroy_func) (value); + + check_table_size (hash_table); return value; } diff --git a/mono/metadata/mono-config.c b/mono/metadata/mono-config.c index 16d4ad56e4..eeee76e9b2 100644 --- a/mono/metadata/mono-config.c +++ b/mono/metadata/mono-config.c @@ -93,6 +93,8 @@ #endif #endif +static void mono_config_for_assembly_internal (MonoImage *assembly); + /** * mono_config_get_os: * @@ -606,6 +608,16 @@ mono_config_string_for_assembly_file (const char *filename) void mono_config_for_assembly (MonoImage *assembly) { + MONO_ENTER_GC_UNSAFE; + mono_config_for_assembly_internal (assembly); + MONO_EXIT_GC_UNSAFE; +} + +void +mono_config_for_assembly_internal (MonoImage *assembly) +{ + MONO_REQ_GC_UNSAFE_MODE; + ParseState state = {NULL}; int got_it = 0, i; char *aname, *cfg, *cfg_name; diff --git a/mono/metadata/mono-debug.c b/mono/metadata/mono-debug.c index 1b0f618b5e..7da5a60e7d 100644 --- a/mono/metadata/mono-debug.c +++ b/mono/metadata/mono-debug.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -157,10 +158,13 @@ mono_debug_init (MonoDebugFormat format) void mono_debug_open_image_from_memory (MonoImage *image, const guint8 *raw_contents, int size) { + MONO_ENTER_GC_UNSAFE; if (!mono_debug_initialized) - return; + goto leave; mono_debug_open_image (image, raw_contents, size); +leave: + MONO_EXIT_GC_UNSAFE; } void @@ -248,6 +252,12 @@ mono_debug_close_image (MonoImage *image) mono_debugger_unlock (); } +MonoDebugHandle * +mono_debug_get_handle (MonoImage *image) +{ + return mono_debug_open_image (image, NULL, 0); +} + static MonoDebugHandle * mono_debug_open_image (MonoImage *image, const guint8 *raw_contents, int size) { @@ -289,7 +299,7 @@ mono_debug_add_assembly (MonoAssembly *assembly, gpointer user_data) MonoImage *image; mono_debugger_lock (); - image = mono_assembly_get_image (assembly); + image = mono_assembly_get_image_internal (assembly); handle = open_symfile_from_bundle (image); if (!handle) mono_debug_open_image (image, NULL, 0); diff --git a/mono/metadata/mono-debug.h b/mono/metadata/mono-debug.h index 66365a01c6..57ac9e8e34 100644 --- a/mono/metadata/mono-debug.h +++ b/mono/metadata/mono-debug.h @@ -178,6 +178,9 @@ mono_debug_lookup_method_addresses (MonoMethod *method); MONO_API MonoDebugMethodJitInfo* mono_debug_find_method (MonoMethod *method, MonoDomain *domain); +MONO_API MonoDebugHandle * +mono_debug_get_handle (MonoImage *image); + MONO_API void mono_debug_free_method_jit_info (MonoDebugMethodJitInfo *jit); diff --git a/mono/metadata/mono-hash.c b/mono/metadata/mono-hash.c index f58738bf8c..1353d27cc4 100644 --- a/mono/metadata/mono-hash.c +++ b/mono/metadata/mono-hash.c @@ -53,6 +53,9 @@ struct _MonoGHashTable { const char *msg; }; +MonoGHashTable * +mono_g_hash_table_new_type_internal (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, void *key, const char *msg); + #if UNUSED static gboolean test_prime (int x) @@ -141,6 +144,18 @@ static inline int mono_g_hash_table_find_slot (MonoGHashTable *hash, const MonoO MonoGHashTable * mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, void *key, const char *msg) { + MonoGHashTable *result; + MONO_ENTER_GC_UNSAFE; + result = mono_g_hash_table_new_type_internal (hash_func, key_equal_func, type, source, key, msg); + MONO_EXIT_GC_UNSAFE; + return result; +} + + +MonoGHashTable * +mono_g_hash_table_new_type_internal (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, void *key, const char *msg) +{ + MONO_REQ_GC_UNSAFE_MODE; MonoGHashTable *hash; if (!hash_func) @@ -434,6 +449,7 @@ mono_g_hash_table_destroy (MonoGHashTable *hash) static void mono_g_hash_table_insert_replace (MonoGHashTable *hash, gpointer key, gpointer value, gboolean replace) { + MONO_REQ_GC_UNSAFE_MODE; int slot; g_return_if_fail (hash != NULL); @@ -464,7 +480,9 @@ mono_g_hash_table_insert_replace (MonoGHashTable *hash, gpointer key, gpointer v void mono_g_hash_table_insert (MonoGHashTable *h, gpointer k, gpointer v) { + MONO_ENTER_GC_UNSAFE; mono_g_hash_table_insert_replace (h, k, v, FALSE); + MONO_EXIT_GC_UNSAFE; } /** diff --git a/mono/metadata/mono-mlist.h b/mono/metadata/mono-mlist.h index cfeeba39ac..4defa3b866 100644 --- a/mono/metadata/mono-mlist.h +++ b/mono/metadata/mono-mlist.h @@ -12,18 +12,18 @@ #include typedef struct _MonoMList MonoMList; -MONO_RT_EXTERNAL_ONLY -MONO_API MonoMList* mono_mlist_alloc (MonoObject *data); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoMList* mono_mlist_alloc (MonoObject *data); MONO_API MonoObject* mono_mlist_get_data (MonoMList* list); MONO_API void mono_mlist_set_data (MonoMList* list, MonoObject *data); MONO_API MonoMList* mono_mlist_set_next (MonoMList* list, MonoMList *next); MONO_API int mono_mlist_length (MonoMList* list); MONO_API MonoMList* mono_mlist_next (MonoMList* list); MONO_API MonoMList* mono_mlist_last (MonoMList* list); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoMList* mono_mlist_prepend (MonoMList* list, MonoObject *data); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoMList* mono_mlist_append (MonoMList* list, MonoObject *data); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoMList* mono_mlist_prepend (MonoMList* list, MonoObject *data); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoMList* mono_mlist_append (MonoMList* list, MonoObject *data); MonoMList* mono_mlist_prepend_checked (MonoMList* list, MonoObject *data, MonoError *error); MonoMList* mono_mlist_append_checked (MonoMList* list, MonoObject *data, MonoError *error); diff --git a/mono/metadata/mono-perfcounters.h b/mono/metadata/mono-perfcounters.h index 47329537c1..02d4e5644b 100644 --- a/mono/metadata/mono-perfcounters.h +++ b/mono/metadata/mono-perfcounters.h @@ -8,25 +8,46 @@ #include #include #include +#include typedef struct _MonoCounterSample MonoCounterSample; +ICALL_EXPORT void* mono_perfcounter_get_impl (MonoString* category, MonoString* counter, MonoString* instance, int *type, MonoBoolean *custom); +ICALL_EXPORT MonoBoolean mono_perfcounter_get_sample (void *impl, MonoBoolean only_value, MonoCounterSample *sample); +ICALL_EXPORT gint64 mono_perfcounter_update_value (void *impl, MonoBoolean do_incr, gint64 value); + +ICALL_EXPORT void mono_perfcounter_free_data (void *impl); /* Category icalls */ +ICALL_EXPORT MonoBoolean mono_perfcounter_category_del (MonoString *name); + +ICALL_EXPORT MonoString* mono_perfcounter_category_help (MonoString *category); + +ICALL_EXPORT MonoBoolean mono_perfcounter_category_exists (MonoString *counter, MonoString *category); + +ICALL_EXPORT MonoBoolean mono_perfcounter_create (MonoString *category, MonoString *help, int type, MonoArray *items); + +ICALL_EXPORT MonoBoolean mono_perfcounter_instance_exists (MonoString *instance, MonoString *category); + +ICALL_EXPORT MonoArray* mono_perfcounter_category_names (void); + +ICALL_EXPORT MonoArray* mono_perfcounter_counter_names (MonoString *category); + +ICALL_EXPORT MonoArray* mono_perfcounter_instance_names (MonoString *category); typedef gboolean (*PerfCounterEnumCallback) (char *category_name, char *name, unsigned char type, gint64 value, gpointer user_data); diff --git a/mono/metadata/mono-route.h b/mono/metadata/mono-route.h index 26d729aaed..dbe432855b 100644 --- a/mono/metadata/mono-route.h +++ b/mono/metadata/mono-route.h @@ -18,11 +18,13 @@ #endif #include +#include in_addr_t gateway_from_rtm (struct rt_msghdr *rtm); /* Category icalls */ -extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal (MonoString *iface, MonoArray **gw_addr_list); +ICALL_EXPORT +MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal (MonoString *iface, MonoArray **gw_addr_list); #endif /* #if defined(HOST_DARWIN) || defined(HOST_BSD) */ #endif /* __MONO_ROUTE_H__ */ diff --git a/mono/metadata/mono-security-windows-internals.h b/mono/metadata/mono-security-windows-internals.h index dc76e58cd0..addfef17a8 100644 --- a/mono/metadata/mono-security-windows-internals.h +++ b/mono/metadata/mono-security-windows-internals.h @@ -20,16 +20,17 @@ gint32 mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname); gboolean -mono_security_win_is_machine_protected (gunichar2 *path); +mono_security_win_is_machine_protected (const gunichar2 *path, MonoError *error); gboolean -mono_security_win_is_user_protected (gunichar2 *path); +mono_security_win_is_user_protected (const gunichar2 *path, MonoError *error); gboolean -mono_security_win_protect_machine (gunichar2 *path); +mono_security_win_protect_machine (const gunichar2 *path, MonoError *error); gboolean -mono_security_win_protect_user (gunichar2 *path); +mono_security_win_protect_user (const gunichar2 *path, MonoError *error); + #endif /* HOST_WIN32 */ #endif /* __MONO_METADATA_MONO_SECURITY_WINDOWS_INTERNALS_H__ */ diff --git a/mono/metadata/mono-security-windows.c b/mono/metadata/mono-security-windows.c index 2369e8b72e..4a2339b207 100644 --- a/mono/metadata/mono-security-windows.c +++ b/mono/metadata/mono-security-windows.c @@ -23,6 +23,7 @@ #endif #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) + static gunichar2* GetSidName (gunichar2 *server, PSID sid, gint32 *size) { @@ -69,7 +70,7 @@ GetSidName (gunichar2 *server, PSID sid, gint32 *size) } gpointer -mono_security_principal_windows_identity_get_current_token (void) +mono_security_principal_windows_identity_get_current_token (MonoError *error) { gpointer token = NULL; @@ -89,8 +90,7 @@ mono_security_principal_windows_identity_get_current_token (void) gpointer ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error) { - error_init (error); - return mono_security_principal_windows_identity_get_current_token (); + return mono_security_principal_windows_identity_get_current_token (error); } gint32 @@ -201,81 +201,74 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ gboolean -ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token) +ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token, MonoError *error) { - gboolean result = TRUE; - result = (CloseHandle (token) != 0); - return result; + return !!CloseHandle (token); } #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) gpointer -ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token) +ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token, MonoError *error) { gpointer dupe = NULL; - - if (DuplicateToken (token, SecurityImpersonation, &dupe) == 0) { - dupe = NULL; - } - return dupe; + return DuplicateToken (token, SecurityImpersonation, &dupe) ? dup : NULL; } #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ gboolean -ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group) +ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group, MonoError *error) { - gboolean result = FALSE; - /* The convertion from an ID to a string is done in managed code for Windows */ g_warning ("IsMemberOfGroupId should never be called on Win32"); - return result; + return FALSE; } gboolean -ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, MonoString *group) +ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, const gchar *group, MonoError *error) { - gboolean result = FALSE; - /* Windows version use a cache built using WindowsIdentity._GetRoles */ g_warning ("IsMemberOfGroupName should never be called on Win32"); - return result; + return FALSE; } #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) + +static PSID +GetSidHelper (const SID_IDENTIFIER_AUTHORITY *authority, BYTE subAuthorityCount, DWORD subAuthority0, DWORD subAuthority1) +{ + PSID pSid = NULL; + // This SID must be freed with FreeSid (). + return AllocateAndInitializeSid ((PSID_IDENTIFIER_AUTHORITY)authority, subAuthorityCount, + subAuthority0, subAuthority1, 0/*2*/, 0/*3*/, 0/*4*/, 0/*5*/, 0/*6*/, 0/*7*/, &pSid) ? pSid : NULL; +} + static PSID GetAdministratorsSid (void) { - SID_IDENTIFIER_AUTHORITY admins = { SECURITY_NT_AUTHORITY }; - PSID pSid = NULL; - if (!AllocateAndInitializeSid (&admins, 2, SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pSid)) - return NULL; - /* Note: this SID must be freed with FreeSid () */ - return pSid; + const static SID_IDENTIFIER_AUTHORITY admins = { SECURITY_NT_AUTHORITY }; + // This SID must be freed with FreeSid (). + return GetSidHelper (&admins, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS); } static PSID GetEveryoneSid (void) { - SID_IDENTIFIER_AUTHORITY everyone = { SECURITY_WORLD_SID_AUTHORITY }; - PSID pSid = NULL; - if (!AllocateAndInitializeSid (&everyone, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &pSid)) - return NULL; - /* Note: this SID must be freed with FreeSid () */ - return pSid; + const static SID_IDENTIFIER_AUTHORITY everyone = { SECURITY_WORLD_SID_AUTHORITY }; + // This SID must be freed with FreeSid (). + return GetSidHelper (&everyone, 1, SECURITY_WORLD_RID, 0); } static PSID -GetCurrentUserSid (void) +GetCurrentUserSid (MonoError *error) { PSID sid = NULL; - guint32 size = 0; - gpointer token = mono_security_principal_windows_identity_get_current_token (); + DWORD size = 0; + gpointer token = mono_security_principal_windows_identity_get_current_token (error); - GetTokenInformation (token, TokenUser, NULL, size, (PDWORD)&size); + GetTokenInformation (token, TokenUser, NULL, size, &size); if (size > 0) { TOKEN_USER *tu = g_malloc0 (size); - if (GetTokenInformation (token, TokenUser, tu, size, (PDWORD)&size)) { + if (GetTokenInformation (token, TokenUser, tu, size, &size)) { DWORD length = GetLengthSid (tu->User.Sid); sid = (PSID) g_malloc0 (length); if (!CopySid (length, sid, tu->User.Sid)) { @@ -303,21 +296,20 @@ GetRightsFromSid (PSID sid, PACL acl) } gboolean -mono_security_win_is_machine_protected (gunichar2 *path) +mono_security_win_is_machine_protected (const gunichar2 *path, MonoError *error) { gboolean success = FALSE; PACL pDACL = NULL; PSECURITY_DESCRIPTOR pSD = NULL; - PSID pEveryoneSid = NULL; - DWORD dwRes = GetNamedSecurityInfoW (path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &pDACL, NULL, &pSD); + DWORD dwRes = GetNamedSecurityInfoW ((PWSTR)path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &pDACL, NULL, &pSD); if (dwRes != ERROR_SUCCESS) return FALSE; /* We check that Everyone is still limited to READ-ONLY - but not if new entries have been added by an Administrator */ - pEveryoneSid = GetEveryoneSid (); + PSID const pEveryoneSid = GetEveryoneSid (); if (pEveryoneSid) { ACCESS_MASK rights = GetRightsFromSid (pEveryoneSid, pDACL); /* http://msdn.microsoft.com/library/en-us/security/security/generic_access_rights.asp?frame=true */ @@ -327,21 +319,19 @@ mono_security_win_is_machine_protected (gunichar2 *path) /* Note: we don't need to check our own access - we'll know soon enough when reading the file */ - if (pSD) - LocalFree (pSD); + LocalFree (pSD); return success; } gboolean -mono_security_win_is_user_protected (gunichar2 *path) +mono_security_win_is_user_protected (const gunichar2 *path, MonoError *error) { gboolean success = FALSE; PACL pDACL = NULL; - PSID pEveryoneSid = NULL; PSECURITY_DESCRIPTOR pSecurityDescriptor = NULL; - DWORD dwRes = GetNamedSecurityInfoW (path, SE_FILE_OBJECT, + DWORD dwRes = GetNamedSecurityInfoW ((PWSTR)path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &pDACL, NULL, &pSecurityDescriptor); if (dwRes != ERROR_SUCCESS) return FALSE; @@ -350,7 +340,7 @@ mono_security_win_is_user_protected (gunichar2 *path) but not if new entries have been added by the user */ /* Everyone should be denied */ - pEveryoneSid = GetEveryoneSid (); + PSID const pEveryoneSid = GetEveryoneSid (); if (pEveryoneSid) { ACCESS_MASK rights = GetRightsFromSid (pEveryoneSid, pDACL); success = (rights == 0); @@ -359,14 +349,13 @@ mono_security_win_is_user_protected (gunichar2 *path) /* Note: we don't need to check our own access - we'll know soon enough when reading the file */ - if (pSecurityDescriptor) - LocalFree (pSecurityDescriptor); + LocalFree (pSecurityDescriptor); return success; } gboolean -mono_security_win_protect_machine (gunichar2 *path) +mono_security_win_protect_machine (const gunichar2 *path, MonoError *error) { PSID pEveryoneSid = GetEveryoneSid (); PSID pAdminsSid = GetAdministratorsSid (); @@ -375,7 +364,7 @@ mono_security_win_protect_machine (gunichar2 *path) if (pEveryoneSid && pAdminsSid) { PACL pDACL = NULL; EXPLICIT_ACCESS ea [2]; - ZeroMemory (&ea, 2 * sizeof (EXPLICIT_ACCESS)); + ZeroMemory (&ea, sizeof (ea)); /* grant all access to the BUILTIN\Administrators group */ BuildTrusteeWithSidW (&ea [0].Trustee, pAdminsSid); @@ -397,27 +386,26 @@ mono_security_win_protect_machine (gunichar2 *path) if (retval == ERROR_SUCCESS) { /* with PROTECTED_DACL_SECURITY_INFORMATION we */ /* remove any existing ACL (like inherited ones) */ - retval = SetNamedSecurityInfo (path, SE_FILE_OBJECT, + retval = SetNamedSecurityInfoW ((PWSTR)path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION, NULL, NULL, pDACL, NULL); } - if (pDACL) - LocalFree (pDACL); + LocalFree (pDACL); } if (pEveryoneSid) FreeSid (pEveryoneSid); if (pAdminsSid) FreeSid (pAdminsSid); - return (retval == ERROR_SUCCESS); + return retval == ERROR_SUCCESS; } gboolean -mono_security_win_protect_user (gunichar2 *path) +mono_security_win_protect_user (const gunichar2 *path, MonoError *error) { DWORD retval = -1; - PSID pCurrentSid = GetCurrentUserSid (); + PSID const pCurrentSid = GetCurrentUserSid (error); if (pCurrentSid) { PACL pDACL = NULL; EXPLICIT_ACCESS ea; @@ -435,68 +423,57 @@ mono_security_win_protect_user (gunichar2 *path) if (retval == ERROR_SUCCESS) { /* with PROTECTED_DACL_SECURITY_INFORMATION we remove any existing ACL (like inherited ones) */ - retval = SetNamedSecurityInfo (path, SE_FILE_OBJECT, + retval = SetNamedSecurityInfoW ((PWSTR)path, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION, NULL, NULL, pDACL, NULL); } - if (pDACL) - LocalFree (pDACL); + LocalFree (pDACL); g_free (pCurrentSid); /* g_malloc0 */ } - return (retval == ERROR_SUCCESS); + return retval == ERROR_SUCCESS; } + #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (MonoString *root) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (const gunichar2 *root, MonoError *error) { - gint32 flags; + DWORD flags = 0; /* ACL are nice... unless you have FAT or other uncivilized filesystem */ - if (!GetVolumeInformation (mono_string_chars (root), NULL, 0, NULL, NULL, (LPDWORD)&flags, NULL, 0)) + if (!GetVolumeInformationW (root, NULL, 0, NULL, NULL, &flags, NULL, 0)) return FALSE; - return ((flags & FS_PERSISTENT_ACLS) == FS_PERSISTENT_ACLS); + return (flags & FS_PERSISTENT_ACLS) == FS_PERSISTENT_ACLS; } MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (MonoString *path) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (const gunichar2 *path, MonoError *error) { - gboolean ret = FALSE; - /* no one, but the owner, should have write access to the directory */ - ret = mono_security_win_is_machine_protected (mono_string_chars (path)); - return (MonoBoolean)ret; + return (MonoBoolean)mono_security_win_is_machine_protected (path, error); } MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (MonoString *path) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (const gunichar2 *path, MonoError *error) { - gboolean ret = FALSE; - /* no one, but the user, should have access to the directory */ - ret = mono_security_win_is_user_protected (mono_string_chars (path)); - return (MonoBoolean)ret; + return (MonoBoolean)mono_security_win_is_user_protected (path, error); } MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (MonoString *path) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (const gunichar2 *path, MonoError *error) { - gboolean ret = FALSE; - /* read/write to owner, read to everyone else */ - ret = mono_security_win_protect_machine (mono_string_chars (path)); - return (MonoBoolean)ret; + return (MonoBoolean)mono_security_win_protect_machine (path, error); } MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (MonoString *path) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (const gunichar2 *path, MonoError *error) { - gboolean ret = FALSE; - /* read/write to user, no access to everyone else */ - ret = mono_security_win_protect_user (mono_string_chars (path)); - return (MonoBoolean)ret; + return (MonoBoolean)mono_security_win_protect_user (path, error); } + #endif /* HOST_WIN32 */ diff --git a/mono/metadata/mono-security.c b/mono/metadata/mono-security.c index c68ab92d9a..c023079ee8 100644 --- a/mono/metadata/mono-security.c +++ b/mono/metadata/mono-security.c @@ -216,7 +216,7 @@ IsMemberOf (gid_t user, struct group *g) #ifndef HOST_WIN32 gpointer -mono_security_principal_windows_identity_get_current_token () +mono_security_principal_windows_identity_get_current_token (MonoError *error) { return GINT_TO_POINTER (geteuid ()); } @@ -224,8 +224,7 @@ mono_security_principal_windows_identity_get_current_token () gpointer ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error) { - error_init (error); - return mono_security_principal_windows_identity_get_current_token (); + return mono_security_principal_windows_identity_get_current_token (error); } static gint32 @@ -349,7 +348,7 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) #ifndef HOST_WIN32 gboolean -ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token) +ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token, MonoError *error) { return TRUE; } @@ -357,7 +356,7 @@ ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpoi #ifndef HOST_WIN32 gpointer -ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token) +ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token, MonoError *error) { return token; } @@ -365,7 +364,7 @@ ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken ( #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) gboolean -ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token) +ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token, MonoError *error) { #ifdef HOST_WIN32 return (ImpersonateLoggedOnUser (token) != 0); @@ -380,7 +379,7 @@ ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken } gboolean -ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void) +ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (MonoError *error) { #ifdef HOST_WIN32 return (RevertToSelf () != 0); @@ -409,7 +408,7 @@ ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (vo #ifndef HOST_WIN32 gboolean -ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group) +ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group, MonoError *error) { gboolean result = FALSE; @@ -438,9 +437,8 @@ ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer result = (g != NULL); #endif - if (result) { + if (result) result = IsMemberOf ((uid_t) GPOINTER_TO_INT (user), g); - } #ifdef HAVE_GETGRGID_R g_free (fbuf); @@ -452,15 +450,12 @@ ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer } gboolean -ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, MonoString *group) +ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, const gchar *utf8_groupname, MonoError *error) { gboolean result = FALSE; #ifdef HAVE_GRP_H - gchar *utf8_groupname; - - utf8_groupname = mono_unicode_to_external (mono_string_chars (group)); if (utf8_groupname) { struct group *g = NULL; #ifdef HAVE_GETGRNAM_R @@ -480,15 +475,12 @@ ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpoint g = getgrnam (utf8_groupname); result = (g != NULL); #endif - - if (result) { + if (result) result = IsMemberOf ((uid_t) GPOINTER_TO_INT (user), g); - } #ifdef HAVE_GETGRNAM_R g_free (fbuf); #endif - g_free (utf8_groupname); } #endif /* HAVE_GRP_H */ @@ -501,10 +493,10 @@ ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpoint #ifndef HOST_WIN32 static gboolean -IsProtected (MonoString *path, gint32 protection) +IsProtected (const gunichar2 *path, gint32 protection) { gboolean result = FALSE; - gchar *utf8_name = mono_unicode_to_external (mono_string_chars (path)); + gchar *utf8_name = mono_unicode_to_external (path); if (utf8_name) { struct stat st; if (stat (utf8_name, &st) == 0) { @@ -517,10 +509,10 @@ IsProtected (MonoString *path, gint32 protection) static gboolean -Protect (MonoString *path, gint32 file_mode, gint32 add_dir_mode) +Protect (const gunichar2 *path, gint32 file_mode, gint32 add_dir_mode) { gboolean result = FALSE; - gchar *utf8_name = mono_unicode_to_external (mono_string_chars (path)); + gchar *utf8_name = mono_unicode_to_external (path); if (utf8_name) { struct stat st; if (stat (utf8_name, &st) == 0) { @@ -535,14 +527,14 @@ Protect (MonoString *path, gint32 file_mode, gint32 add_dir_mode) } MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (MonoString *root) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (const gunichar2 *path, MonoError *error) { /* we assume some kind of security is applicable outside Windows */ return TRUE; } MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (MonoString *path) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (const gunichar2 *path, MonoError *error) { gboolean ret = FALSE; @@ -552,7 +544,7 @@ ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (Mono } MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (MonoString *path) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (const gunichar2 *path, MonoError *error) { gboolean ret = FALSE; @@ -562,7 +554,7 @@ ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (MonoStr } MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (MonoString *path) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (const gunichar2 *path, MonoError *error) { gboolean ret = FALSE; @@ -572,7 +564,7 @@ ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (MonoStri } MonoBoolean -ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (MonoString *path) +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (const gunichar2 *path, MonoError *error) { gboolean ret = FALSE; @@ -604,7 +596,7 @@ ves_icall_System_Security_Policy_Evidence_IsAuthenticodePresent (MonoReflectionA /* System.Security.SecureString related internal calls */ -static MonoImage *system_security_assembly = NULL; +static MonoImage *system_security_assembly; void ves_icall_System_Security_SecureString_DecryptInternal (MonoArray *data, MonoObject *scope) @@ -635,13 +627,15 @@ void mono_invoke_protected_memory_method (MonoArray *data, MonoObject *scope, gb MonoAssembly *sa = mono_assembly_open_predicate ("System.Security.dll", MONO_ASMCTX_DEFAULT, NULL, NULL, NULL, NULL); if (!sa) g_assert_not_reached (); - system_security_assembly = mono_assembly_get_image (sa); + system_security_assembly = mono_assembly_get_image_internal (sa); } } klass = mono_class_load_from_name (system_security_assembly, "System.Security.Cryptography", "ProtectedMemory"); - method = mono_class_get_method_from_name (klass, encrypt ? "Protect" : "Unprotect", 2); + method = mono_class_get_method_from_name_checked (klass, encrypt ? "Protect" : "Unprotect", 2, 0, error); + mono_error_assert_ok (error); + g_assert (method); params [0] = data; params [1] = scope; /* MemoryProtectionScope.SameProcess */ diff --git a/mono/metadata/null-gc.c b/mono/metadata/null-gc.c index 20f3441bdf..fdcdccc07a 100644 --- a/mono/metadata/null-gc.c +++ b/mono/metadata/null-gc.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -279,8 +280,8 @@ void mono_gc_wbarrier_object_copy (MonoObject* obj, MonoObject *src) { /* do not copy the sync state */ - mono_gc_memmove_aligned ((char*)obj + sizeof (MonoObject), (char*)src + sizeof (MonoObject), - mono_object_class (obj)->instance_size - sizeof (MonoObject)); + mono_gc_memmove_aligned (mono_object_get_data (obj), (char*)src + MONO_ABI_SIZEOF (MonoObject), + mono_object_class (obj)->instance_size - MONO_ABI_SIZEOF (MonoObject)); } gboolean @@ -428,6 +429,14 @@ mono_gc_get_card_table (int *shift_bits, gpointer *card_mask) return NULL; } +guint8* +mono_gc_get_target_card_table (int *shift_bits, gpointer *card_mask) +{ + *shift_bits = 0; + *card_mask = NULL; + return NULL; +} + gboolean mono_gc_card_table_nursery_check (void) { @@ -574,6 +583,12 @@ mono_gc_pending_finalizers (void) return FALSE; } +gboolean +mono_gc_ephemeron_array_add (MonoObject *obj) +{ + return TRUE; +} + #else MONO_EMPTY_SOURCE_FILE (null_gc); diff --git a/mono/metadata/number-ms.c b/mono/metadata/number-ms.c deleted file mode 100644 index bb6bc6aeaf..0000000000 --- a/mono/metadata/number-ms.c +++ /dev/null @@ -1,331 +0,0 @@ -/** - * \file - * System.Double, System.Single and System.Number runtime support - * - * Author: - * Ludovic Henry (ludovic@xamarin.com) - * - * Copyright 2015 Xamarin, Inc (http://www.xamarin.com) - * Licensed under the MIT license. See LICENSE file in the project root for full license information. - */ - -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// -// Files: -// - src/classlibnative/bcltype/number.cpp -// -// Ported from C++ to C and adjusted to Mono runtime - -#include - -#include "number-ms.h" - -static const guint64 rgval64Power10[] = { - /* powers of 10 */ - 0xa000000000000000LL, - 0xc800000000000000LL, - 0xfa00000000000000LL, - 0x9c40000000000000LL, - 0xc350000000000000LL, - 0xf424000000000000LL, - 0x9896800000000000LL, - 0xbebc200000000000LL, - 0xee6b280000000000LL, - 0x9502f90000000000LL, - 0xba43b74000000000LL, - 0xe8d4a51000000000LL, - 0x9184e72a00000000LL, - 0xb5e620f480000000LL, - 0xe35fa931a0000000LL, - - /* powers of 0.1 */ - 0xcccccccccccccccdLL, - 0xa3d70a3d70a3d70bLL, - 0x83126e978d4fdf3cLL, - 0xd1b71758e219652eLL, - 0xa7c5ac471b478425LL, - 0x8637bd05af6c69b7LL, - 0xd6bf94d5e57a42beLL, - 0xabcc77118461ceffLL, - 0x89705f4136b4a599LL, - 0xdbe6fecebdedd5c2LL, - 0xafebff0bcb24ab02LL, - 0x8cbccc096f5088cfLL, - 0xe12e13424bb40e18LL, - 0xb424dc35095cd813LL, - 0x901d7cf73ab0acdcLL, -}; - -static const gint8 rgexp64Power10[] = { - /* exponents for both powers of 10 and 0.1 */ - 4, - 7, - 10, - 14, - 17, - 20, - 24, - 27, - 30, - 34, - 37, - 40, - 44, - 47, - 50, -}; - -static const guint64 rgval64Power10By16[] = { - /* powers of 10^16 */ - 0x8e1bc9bf04000000LL, - 0x9dc5ada82b70b59eLL, - 0xaf298d050e4395d6LL, - 0xc2781f49ffcfa6d4LL, - 0xd7e77a8f87daf7faLL, - 0xefb3ab16c59b14a0LL, - 0x850fadc09923329cLL, - 0x93ba47c980e98cdeLL, - 0xa402b9c5a8d3a6e6LL, - 0xb616a12b7fe617a8LL, - 0xca28a291859bbf90LL, - 0xe070f78d39275566LL, - 0xf92e0c3537826140LL, - 0x8a5296ffe33cc92cLL, - 0x9991a6f3d6bf1762LL, - 0xaa7eebfb9df9de8aLL, - 0xbd49d14aa79dbc7eLL, - 0xd226fc195c6a2f88LL, - 0xe950df20247c83f8LL, - 0x81842f29f2cce373LL, - 0x8fcac257558ee4e2LL, - - /* powers of 0.1^16 */ - 0xe69594bec44de160LL, - 0xcfb11ead453994c3LL, - 0xbb127c53b17ec165LL, - 0xa87fea27a539e9b3LL, - 0x97c560ba6b0919b5LL, - 0x88b402f7fd7553abLL, - 0xf64335bcf065d3a0LL, - 0xddd0467c64bce4c4LL, - 0xc7caba6e7c5382edLL, - 0xb3f4e093db73a0b7LL, - 0xa21727db38cb0053LL, - 0x91ff83775423cc29LL, - 0x8380dea93da4bc82LL, - 0xece53cec4a314f00LL, - 0xd5605fcdcf32e217LL, - 0xc0314325637a1978LL, - 0xad1c8eab5ee43ba2LL, - 0x9becce62836ac5b0LL, - 0x8c71dcd9ba0b495cLL, - 0xfd00b89747823938LL, - 0xe3e27a444d8d991aLL, -}; - -static const gint16 rgexp64Power10By16[] = { - /* exponents for both powers of 10^16 and 0.1^16 */ - 54, - 107, - 160, - 213, - 266, - 319, - 373, - 426, - 479, - 532, - 585, - 638, - 691, - 745, - 798, - 851, - 904, - 957, - 1010, - 1064, - 1117, -}; - -static inline guint64 -digits_to_int (guint16 *p, int count) -{ - g_assert (1 <= count && count <= 9); - guint8 i = 0; - guint64 res = 0; - switch (count) { - case 9: res += 100000000 * (p [i++] - '0'); - case 8: res += 10000000 * (p [i++] - '0'); - case 7: res += 1000000 * (p [i++] - '0'); - case 6: res += 100000 * (p [i++] - '0'); - case 5: res += 10000 * (p [i++] - '0'); - case 4: res += 1000 * (p [i++] - '0'); - case 3: res += 100 * (p [i++] - '0'); - case 2: res += 10 * (p [i++] - '0'); - case 1: res += 1 * (p [i++] - '0'); - } - return res; -} - -static inline guint64 -mul_64_lossy (guint64 a, guint64 b, gint *pexp) -{ - /* it's ok to losse some precision here - it will be called - * at most twice during the conversion, so the error won't - * propagate to any of the 53 significant bits of the result */ - guint64 val = - ((((guint64) (guint32) (a >> 32)) * ((guint64) (guint32) (b >> 32))) ) - + ((((guint64) (guint32) (a >> 32)) * ((guint64) (guint32) (b ))) >> 32) - + ((((guint64) (guint32) (a )) * ((guint64) (guint32) (b >> 32))) >> 32); - - /* normalize */ - if ((val & 0x8000000000000000LL) == 0) { - val <<= 1; - *pexp -= 1; - } - - return val; -} - -static inline void -number_to_double (MonoNumber *number, gdouble *value) -{ - guint64 val; - guint16 *src; - gint exp, remaining, total, count, scale, absscale, index; - - total = 0; - src = number->digits; - while (*src++) total ++; - - remaining = total; - - src = number->digits; - while (*src == '0') { - remaining --; - src ++; - } - - if (remaining == 0) { - *value = 0; - goto done; - } - - count = MIN (remaining, 9); - remaining -= count; - val = digits_to_int (src, count); - - if (remaining > 0) { - count = MIN (remaining, 9); - remaining -= count; - - /* get the denormalized power of 10 */ - guint32 mult = (guint32) (rgval64Power10 [count - 1] >> (64 - rgexp64Power10 [count - 1])); - val = ((guint64) (guint32) val) * ((guint64) mult) + digits_to_int (src + 9, count); - } - - scale = number->scale - (total - remaining); - absscale = abs (scale); - - if (absscale >= 22 * 16) { - /* overflow / underflow */ - *(guint64*) value = (scale > 0) ? 0x7FF0000000000000LL : 0; - goto done; - } - - exp = 64; - - /* normalize the mantiss */ - if ((val & 0xFFFFFFFF00000000LL) == 0) { val <<= 32; exp -= 32; } - if ((val & 0xFFFF000000000000LL) == 0) { val <<= 16; exp -= 16; } - if ((val & 0xFF00000000000000LL) == 0) { val <<= 8; exp -= 8; } - if ((val & 0xF000000000000000LL) == 0) { val <<= 4; exp -= 4; } - if ((val & 0xC000000000000000LL) == 0) { val <<= 2; exp -= 2; } - if ((val & 0x8000000000000000LL) == 0) { val <<= 1; exp -= 1; } - - index = absscale & 15; - if (index) { - gint multexp = rgexp64Power10 [index - 1]; - /* the exponents are shared between the inverted and regular table */ - exp += (scale < 0) ? (-multexp + 1) : multexp; - - guint64 multval = rgval64Power10 [index + ((scale < 0) ? 15 : 0) - 1]; - val = mul_64_lossy (val, multval, &exp); - } - - index = absscale >> 4; - if (index) { - gint multexp = rgexp64Power10By16 [index - 1]; - /* the exponents are shared between the inverted and regular table */ - exp += (scale < 0) ? (-multexp + 1) : multexp; - - guint64 multval = rgval64Power10By16 [index + ((scale < 0) ? 21 : 0) - 1]; - val = mul_64_lossy (val, multval, &exp); - } - - if ((guint32) val & (1 << 10)) { - /* IEEE round to even */ - guint64 tmp = val + ((1 << 10) - 1) + (((guint32) val >> 11) & 1); - if (tmp < val) { - /* overflow */ - tmp = (tmp >> 1) | 0x8000000000000000LL; - exp += 1; - } - val = tmp; - } - - /* return the exponent to a biased state */ - exp += 0x3FE; - - /* handle overflow, underflow, "Epsilon - 1/2 Epsilon", denormalized, and the normal case */ - if (exp <= 0) { - if (exp == -52 && (val >= 0x8000000000000058LL)) { - /* round X where {Epsilon > X >= 2.470328229206232730000000E-324} up to Epsilon (instead of down to zero) */ - val = 0x0000000000000001LL; - } else if (exp <= -52) { - /* underflow */ - val = 0; - } else { - /* denormalized */ - val >>= (-exp + 11 + 1); - } - } else if (exp >= 0x7FF) { - /* overflow */ - val = 0x7FF0000000000000LL; - } else { - /* normal postive exponent case */ - val = ((guint64) exp << 52) + ((val >> 11) & 0x000FFFFFFFFFFFFFLL); - } - - *(guint64*) value = val; - -done: - if (number->sign) - *(guint64*) value |= 0x8000000000000000LL; -} - -gint -mono_double_from_number (gpointer from, MonoDouble *target) -{ - MonoDouble_double res; - guint e, mant_lo, mant_hi; - - res.d = 0; - - number_to_double ((MonoNumber*) from, &res.d); - e = res.s.exp; - mant_lo = res.s.mantLo; - mant_hi = res.s.mantHi; - - if (e == 0x7ff) - return 0; - - if (e == 0 && mant_lo == 0 && mant_hi == 0) - res.d = 0; - - *target = res.s; - return 1; -} diff --git a/mono/metadata/number-ms.h b/mono/metadata/number-ms.h index f20cc95cce..461f605da9 100644 --- a/mono/metadata/number-ms.h +++ b/mono/metadata/number-ms.h @@ -17,11 +17,17 @@ typedef struct { guint exp : 11; guint mantHi : 20; guint mantLo : 32; + +#define MONO_INIT_DOUBLE(sign, exp, mantHi, mantLo) { sign, exp, mantHi, mantLo } + #else // BIGENDIAN guint mantLo : 32; guint mantHi : 20; guint exp : 11; guint sign : 1; + +#define MONO_INIT_DOUBLE(sign, exp, mantHi, mantLo) { mantLo, mantHi, exp, sign } + #endif } MonoDouble; @@ -30,38 +36,4 @@ typedef union { gdouble d; } MonoDouble_double; -// Single floating point Bias -#define MONO_SINGLE_BIAS 126 - -// Structure to access an encoded single floating point -typedef struct { -#if G_BYTE_ORDER == G_BIG_ENDIAN - guint sign : 1; - guint exp : 8; - guint mant : 23; -#else - guint mant : 23; - guint exp : 8; - guint sign : 1; -#endif -} MonoSingle; - -typedef union { - MonoSingle s; - gfloat f; -} MonoSingle_float; - -#define MONO_NUMBER_MAXDIGITS 50 - -typedef struct { - gint32 precision; - gint32 scale; - gint32 sign; - guint16 digits [MONO_NUMBER_MAXDIGITS + 1]; - guint16 *allDigits; -} MonoNumber; - -gint -mono_double_from_number (gpointer from, MonoDouble *target); - #endif diff --git a/mono/metadata/object-internals.h b/mono/metadata/object-internals.h index eaabf5df48..e4ffb55778 100644 --- a/mono/metadata/object-internals.h +++ b/mono/metadata/object-internals.h @@ -21,35 +21,43 @@ #include "mono/utils/mono-stack-unwinding.h" #include "mono/utils/mono-tls.h" #include "mono/utils/mono-coop-mutex.h" +#include -/* Use this as MONO_CHECK_ARG_NULL (arg,expr,) in functions returning void */ -#define MONO_CHECK_ARG(arg, expr, retval) G_STMT_START{ \ - if (G_UNLIKELY (!(expr))) \ - { \ - MonoException *ex; \ - char *msg = g_strdup_printf ("assertion `%s' failed", \ - #expr); \ - if (arg) {} /* check if the name exists */ \ - ex = mono_get_exception_argument (#arg, msg); \ - g_free (msg); \ - mono_set_pending_exception (ex); \ - return retval; \ - }; }G_STMT_END +/* Use this as MONO_CHECK_ARG (arg,expr,) in functions returning void */ +#define MONO_CHECK_ARG(arg, expr, retval) do { \ + if (G_UNLIKELY (!(expr))) \ + { \ + if (0) { (void)(arg); } /* check if the name exists */ \ + ERROR_DECL (error); \ + mono_error_set_argument_format (error, #arg, "assertion `%s' failed", #expr); \ + mono_error_set_pending_exception (error); \ + return retval; \ + } \ +} while (0) /* Use this as MONO_CHECK_ARG_NULL (arg,) in functions returning void */ -#define MONO_CHECK_ARG_NULL(arg, retval) G_STMT_START{ \ - if (G_UNLIKELY (arg == NULL)) \ - { \ - MonoException *ex; \ - if (arg) {} /* check if the name exists */ \ - ex = mono_get_exception_argument_null (#arg); \ - mono_set_pending_exception (ex); \ - return retval; \ - }; }G_STMT_END +#define MONO_CHECK_ARG_NULL(arg, retval) do { \ + if (G_UNLIKELY (!(arg))) \ + { \ + ERROR_DECL (error); \ + mono_error_set_argument_null (error, #arg, ""); \ + mono_error_set_pending_exception (error); \ + return retval; \ + } \ +} while (0) -/* Use this as MONO_ARG_NULL (arg,) in functions returning void */ +/* Use this as MONO_CHECK_ARG_NULL_HANDLE (arg,) in functions returning void */ +#define MONO_CHECK_ARG_NULL_HANDLE(arg, retval) do { \ + if (G_UNLIKELY (MONO_HANDLE_IS_NULL (arg))) \ + { \ + mono_error_set_argument_null (error, #arg, ""); \ + return retval; \ + } \ +} while (0) + +/* Use this as MONO_CHECK_NULL (arg,) in functions returning void */ #define MONO_CHECK_NULL(arg, retval) do { \ - if (G_UNLIKELY (arg == NULL)) \ + if (G_UNLIKELY (!(arg))) \ { \ ERROR_DECL (error); \ mono_error_set_null_reference (error); \ @@ -73,7 +81,7 @@ #define mono_class_get_field_from_name_cached(klass,name) ({ \ static MonoClassField *tmp_field; \ if (!tmp_field) { \ - tmp_field = mono_class_get_field_from_name ((klass), (name)); \ + tmp_field = mono_class_get_field_from_name_full ((klass), (name), NULL); \ g_assert (tmp_field); \ }; \ tmp_field; }) @@ -93,11 +101,20 @@ __arr = mono_array_new_specific_checked (__vtable, (size), (error)); \ __arr; }) +/* eclass should be a run-time constant */ +#define mono_array_new_cached_handle(domain, eclass, size, error) ({ \ + MonoVTable *__vtable = mono_class_vtable_checked ((domain), mono_array_class_get_cached ((eclass), 1), (error)); \ + MonoArrayHandle __arr = NULL_HANDLE_ARRAY; \ + if (is_ok ((error))) \ + __arr = mono_array_new_specific_handle (__vtable, (size), (error)); \ + __arr; }) + #else #define mono_class_get_field_from_name_cached(klass,name) mono_class_get_field_from_name ((klass), (name)) #define mono_array_class_get_cached(eclass,rank) mono_class_create_array ((eclass), (rank)) #define mono_array_new_cached(domain, eclass, size, error) mono_array_new_checked ((domain), (eclass), (size), (error)) +#define mono_array_new_cached_handle(domain, eclass, size, error) (mono_array_new_handle ((domain), (eclass), (size), (error))) #endif @@ -128,7 +145,7 @@ struct _MonoArray { mono_64bitaligned_t vector [MONO_ZERO_LEN_ARRAY]; }; -#define MONO_SIZEOF_MONO_ARRAY (sizeof (MonoArray) - MONO_ZERO_LEN_ARRAY * sizeof (mono_64bitaligned_t)) +#define MONO_SIZEOF_MONO_ARRAY (MONO_STRUCT_OFFSET (MonoArray, vector)) struct _MonoString { MonoObject object; @@ -145,6 +162,10 @@ struct _MonoString { #define mono_string_length_fast(s) ((s)->length) #define mono_array_length_fast(array) ((array)->max_length) + +// Equivalent to mono_array_addr_with_size, except: +// 1. A macro instead of a function. +// 2. No GC enter/exit unsafe transition. #define mono_array_addr_with_size_fast(array,size,index) ( ((char*)(array)->vector) + (size) * (index) ) #define mono_array_addr_fast(array,type,index) ((type*)(void*) mono_array_addr_with_size_fast (array, sizeof (type), index)) @@ -176,11 +197,9 @@ mono_handle_array_has_bounds (MonoArrayHandle arr) static inline void mono_handle_array_get_bounds_dim (MonoArrayHandle arr, gint32 dim, MonoArrayBounds *bounds) { - MonoArrayBounds *src = MONO_HANDLE_GETVAL (arr, bounds); - memcpy (bounds, &src[dim], sizeof (MonoArrayBounds)); + *bounds = MONO_HANDLE_GETVAL (arr, bounds [dim]); } - typedef struct { MonoObject obj; MonoObject *identity; @@ -320,13 +339,37 @@ typedef struct { /* Safely access System.Runtime.Remoting.Proxies.RealProxy from native code */ TYPED_HANDLE_DECL (MonoRealProxy); +typedef struct _MonoIUnknown MonoIUnknown; +typedef struct _MonoIUnknownVTable MonoIUnknownVTable; + +/* STDCALL on windows, CDECL everywhere else to work with XPCOM and MainWin COM */ +#ifdef HOST_WIN32 +#define STDCALL __stdcall +#else +#define STDCALL +#endif + +struct _MonoIUnknownVTable +{ + int (STDCALL *QueryInterface)(MonoIUnknown *pUnk, gconstpointer riid, gpointer* ppv); + int (STDCALL *AddRef)(MonoIUnknown *pUnk); + int (STDCALL *Release)(MonoIUnknown *pUnk); +}; + +struct _MonoIUnknown +{ + MonoIUnknownVTable const * const vtable; +}; + typedef struct { MonoMarshalByRefObject object; - gpointer iunknown; + MonoIUnknown *iunknown; GHashTable* itf_hash; MonoObject *synchronization_context; } MonoComObject; +TYPED_HANDLE_DECL (MonoComObject); + typedef struct { MonoRealProxy real_proxy; MonoComObject *com_object; @@ -388,6 +431,8 @@ typedef enum { MONO_THREAD_FLAG_APPDOMAIN_ABORT = 4, // Current requested abort originates from appdomain unload } MonoThreadFlags; +struct _MonoThreadInfo; + struct _MonoInternalThread { MonoObject obj; volatile int lock_thread_id; /* to be used as the pre-shifted thread id in thin locks. Used for appdomain_ref push/pop */ @@ -402,7 +447,7 @@ struct _MonoInternalThread { guint64 tid; /* This is accessed as a gsize in the code (so it can hold a 64bit pointer on systems that need it), but needs to reserve 64 bits of space on all machines as it corresponds to a field in managed code */ gsize debugger_thread; // FIXME switch to bool as soon as CI testing with corlib version bump works gpointer *static_data; - void *thread_info; /*This is MonoThreadInfo*, but to simplify dependencies, let's make it a void* here. */ + struct _MonoThreadInfo *thread_info; MonoAppContext *current_appcontext; MonoThread *root_domain_thread; MonoObject *_serialized_principal; @@ -634,9 +679,7 @@ typedef struct { gpointer (*create_delegate_trampoline) (MonoDomain *domain, MonoClass *klass); gpointer (*interp_get_remoting_invoke) (gpointer imethod, MonoError *error); GHashTable *(*get_weak_field_indexes) (MonoImage *image); -#ifdef TARGET_OSX void (*install_state_summarizer) (void); -#endif } MonoRuntimeCallbacks; typedef gboolean (*MonoInternalStackWalk) (MonoStackFrameInfo *frame, MonoContext *ctx, gpointer data); @@ -654,10 +697,8 @@ typedef struct { gboolean (*mono_above_abort_threshold) (void); void (*mono_clear_abort_threshold) (void); void (*mono_reraise_exception) (MonoException *ex); -#ifdef TARGET_OSX void (*mono_summarize_stack) (MonoDomain *domain, MonoThreadSummary *out, MonoContext *crash_ctx); void (*mono_summarize_exception) (MonoException *exc, MonoThreadSummary *out); -#endif } MonoRuntimeExceptionHandlingCallbacks; MONO_COLD void mono_set_pending_exception (MonoException *exc); @@ -667,7 +708,7 @@ MONO_COLD void mono_set_pending_exception (MonoException *exc); MonoAsyncResult * mono_async_result_new (MonoDomain *domain, gpointer handle, MonoObject *state, gpointer data, MonoObject *object_data, MonoError *error); - +ICALL_EXPORT MonoObject * ves_icall_System_Runtime_Remoting_Messaging_AsyncResult_Invoke (MonoAsyncResult *ares); @@ -698,6 +739,15 @@ mono_delegate_ctor_with_method (MonoObjectHandle this_obj, MonoObjectHandle targ gboolean mono_delegate_ctor (MonoObjectHandle this_obj, MonoObjectHandle target, gpointer addr, MonoError *error); +MonoMethod * +mono_get_delegate_invoke_checked (MonoClass *klass, MonoError *error); + +MonoMethod * +mono_get_delegate_begin_invoke_checked (MonoClass *klass, MonoError *error); + +MonoMethod * +mono_get_delegate_end_invoke_checked (MonoClass *klass, MonoError *error); + void mono_runtime_free_method (MonoDomain *domain, MonoMethod *method); @@ -1508,6 +1558,7 @@ void mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod void mono_reflection_destroy_dynamic_method (MonoReflectionDynamicMethod *mb); +ICALL_EXPORT void ves_icall_SymbolType_create_unmanaged_type (MonoReflectionType *type); @@ -1525,12 +1576,15 @@ mono_reflection_bind_generic_parameters (MonoReflectionTypeHandle type, int type void mono_reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *fields); +ICALL_EXPORT MonoReflectionEvent * ves_icall_TypeBuilder_get_event_info (MonoReflectionTypeBuilder *tb, MonoReflectionEventBuilder *eb); +ICALL_EXPORT MonoArrayHandle ves_icall_SignatureHelper_get_signature_local (MonoReflectionSigHelperHandle sig, MonoError *error); +ICALL_EXPORT MonoArrayHandle ves_icall_SignatureHelper_get_signature_field (MonoReflectionSigHelperHandle sig, MonoError *error); @@ -1543,6 +1597,7 @@ mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean gboolean mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass, MonoError *error); +ICALL_EXPORT void ves_icall_System_Reflection_CustomAttributeData_ResolveArgumentsInternal (MonoReflectionMethod *method, MonoReflectionAssembly *assembly, gpointer data, guint32 data_length, MonoArray **ctor_args, MonoArray ** named_args); @@ -1586,9 +1641,14 @@ mono_array_new_full_checked (MonoDomain *domain, MonoClass *array_class, uintptr MonoArray* mono_array_new_specific_checked (MonoVTable *vtable, uintptr_t n, MonoError *error); +MonoArrayHandle +mono_array_new_specific_handle (MonoVTable *vtable, uintptr_t n, MonoError *error); + +ICALL_EXPORT MonoArray* ves_icall_array_new (MonoDomain *domain, MonoClass *eclass, uintptr_t n); +ICALL_EXPORT MonoArray* ves_icall_array_new_specific (MonoVTable *vtable, uintptr_t n); @@ -1647,6 +1707,10 @@ mono_nullable_box (gpointer buf, MonoClass *klass, MonoError *error); MonoObjectHandle mono_nullable_box_handle (gpointer buf, MonoClass *klass, MonoError *error); +// A code size optimization (source and object) equivalent to MONO_HANDLE_NEW (MonoObject, NULL); +MonoObjectHandle +mono_new_null (void); + #ifdef MONO_SMALL_CONFIG #define MONO_IMT_SIZE 9 #else @@ -1729,8 +1793,8 @@ mono_method_clear_object (MonoDomain *domain, MonoMethod *method); gsize* mono_class_compute_bitmap (MonoClass *klass, gsize *bitmap, int size, int offset, int *max_set, gboolean static_fields); -MonoObject* -mono_object_xdomain_representation (MonoObject *obj, MonoDomain *target_domain, MonoError *error); +MonoObjectHandle +mono_object_xdomain_representation (MonoObjectHandle obj, MonoDomain *target_domain, MonoError *error); gboolean mono_class_is_reflection_method_or_constructor (MonoClass *klass); @@ -1756,18 +1820,26 @@ mono_class_free_ref_info (MonoClass *klass); MonoObject * mono_object_new_pinned (MonoDomain *domain, MonoClass *klass, MonoError *error); +MonoObjectHandle +mono_object_new_pinned_handle (MonoDomain *domain, MonoClass *klass, MonoError *error); + MonoObject * mono_object_new_specific_checked (MonoVTable *vtable, MonoError *error); +ICALL_EXPORT MonoObject * ves_icall_object_new (MonoDomain *domain, MonoClass *klass); +ICALL_EXPORT MonoObject * ves_icall_object_new_specific (MonoVTable *vtable); MonoObject * mono_object_new_alloc_specific_checked (MonoVTable *vtable, MonoError *error); +void +mono_field_get_value_internal (MonoObject *obj, MonoClassField *field, void *value); + void mono_field_static_get_value_checked (MonoVTable *vt, MonoClassField *field, void *value, MonoError *error); @@ -1784,15 +1856,15 @@ mono_vtable_get_static_field_data (MonoVTable *vt); MonoObject * mono_field_get_value_object_checked (MonoDomain *domain, MonoClassField *field, MonoObject *obj, MonoError *error); +MonoObjectHandle +mono_static_field_get_value_handle (MonoDomain *domain, MonoClassField *field, MonoError *error); + gboolean -mono_property_set_value_checked (MonoProperty *prop, void *obj, void **params, MonoError *error); +mono_property_set_value_handle (MonoProperty *prop, MonoObjectHandle obj, void **params, MonoError *error); MonoObject* mono_property_get_value_checked (MonoProperty *prop, void *obj, void **params, MonoError *error); -MonoString* -mono_object_to_string_checked (MonoObject *obj, MonoError *error); - MonoString* mono_object_try_to_string (MonoObject *obj, MonoObject **exc, MonoError *error); @@ -1808,6 +1880,7 @@ mono_string_intern_checked (MonoString *str, MonoError *error); char * mono_exception_handle_get_native_backtrace (MonoExceptionHandle exc); +ICALL_EXPORT MonoStringHandle ves_icall_Mono_Runtime_GetNativeStackTrace (MonoExceptionHandle exc, MonoError *erro); @@ -1832,6 +1905,11 @@ mono_object_new_checked (MonoDomain *domain, MonoClass *klass, MonoError *error) MonoObjectHandle mono_object_new_handle (MonoDomain *domain, MonoClass *klass, MonoError *error); +// This function skips handling of remoting and COM. +// "alloc" means "less". +MonoObjectHandle +mono_object_new_alloc_by_vtable (MonoVTable *vtable, MonoError *error); + MonoObject* mono_object_new_mature (MonoVTable *vtable, MonoError *error); @@ -1859,6 +1937,9 @@ mono_string_new_size_checked (MonoDomain *domain, gint32 len, MonoError *error); MonoString* mono_ldstr_checked (MonoDomain *domain, MonoImage *image, uint32_t str_index, MonoError *error); +MonoStringHandle +mono_ldstr_handle (MonoDomain *domain, MonoImage *image, uint32_t str_index, MonoError *error); + MonoString* mono_string_new_len_checked (MonoDomain *domain, const char *text, guint length, MonoError *error); @@ -1874,11 +1955,14 @@ mono_string_new_utf16_checked (MonoDomain *domain, const guint16 *text, gint32 l MonoStringHandle mono_string_new_utf16_handle (MonoDomain *domain, const guint16 *text, gint32 len, MonoError *error); -MonoString * -mono_string_from_utf16_checked (mono_unichar2 *data, MonoError *error); +MonoStringHandle +mono_string_new_utf8_len_handle (MonoDomain *domain, const char *text, guint length, MonoError *error); MonoString * -mono_string_from_utf32_checked (mono_unichar4 *data, MonoError *error); +mono_string_from_utf16_checked (const mono_unichar2 *data, MonoError *error); + +MonoString * +mono_string_from_utf32_checked (const mono_unichar4 *data, MonoError *error); char* mono_ldstr_utf8 (MonoImage *image, guint32 idx, MonoError *error); @@ -1892,9 +1976,19 @@ mono_runtime_object_init_checked (MonoObject *this_obj, MonoError *error); MonoObject* mono_runtime_try_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error); +// The exc parameter is deliberately missing and so far this has proven to reduce code duplication. +// In particular, if an exception is returned from underlying otherwise succeeded call, +// is set into the MonoError with mono_error_set_exception_instance. +// The result is that caller need only check MonoError. +MonoObjectHandle +mono_runtime_try_invoke_handle (MonoMethod *method, MonoObjectHandle obj, void **params, MonoError* error); + MonoObject* mono_runtime_invoke_checked (MonoMethod *method, void *obj, void **params, MonoError *error); +MonoObjectHandle +mono_runtime_invoke_handle (MonoMethod *method, MonoObjectHandle obj, void **params, MonoError* error); + MonoObject* mono_runtime_try_invoke_array (MonoMethod *method, void *obj, MonoArray *params, MonoObject **exc, MonoError *error); @@ -1931,56 +2025,70 @@ mono_runtime_exec_main_checked (MonoMethod *method, MonoArray *args, MonoError * int mono_runtime_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc); +ICALL_EXPORT MonoReflectionMethodHandle ves_icall_MonoMethod_MakeGenericMethod_impl (MonoReflectionMethodHandle rmethod, MonoArrayHandle types, MonoError *error); +ICALL_EXPORT gint32 ves_icall_ModuleBuilder_getToken (MonoReflectionModuleBuilderHandle mb, MonoObjectHandle obj, gboolean create_open_instance, MonoError *error); +ICALL_EXPORT gint32 ves_icall_ModuleBuilder_getMethodToken (MonoReflectionModuleBuilderHandle mb, MonoReflectionMethodHandle method, MonoArrayHandle opt_param_types, MonoError *error); - +ICALL_EXPORT void ves_icall_ModuleBuilder_WriteToFile (MonoReflectionModuleBuilder *mb, gpointer file); +ICALL_EXPORT void ves_icall_ModuleBuilder_build_metadata (MonoReflectionModuleBuilder *mb); +ICALL_EXPORT void ves_icall_ModuleBuilder_RegisterToken (MonoReflectionModuleBuilderHandle mb, MonoObjectHandle obj, guint32 token, MonoError *error); +ICALL_EXPORT MonoObjectHandle ves_icall_ModuleBuilder_GetRegisteredToken (MonoReflectionModuleBuilderHandle mb, guint32 token, MonoError *error); +ICALL_EXPORT void ves_icall_AssemblyBuilder_basic_init (MonoReflectionAssemblyBuilder *assemblyb); +ICALL_EXPORT void ves_icall_AssemblyBuilder_UpdateNativeCustomAttributes (MonoReflectionAssemblyBuilderHandle assemblyb, MonoError *error); +ICALL_EXPORT MonoArray* ves_icall_CustomAttributeBuilder_GetBlob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues); +ICALL_EXPORT void ves_icall_DynamicMethod_create_dynamic_method (MonoReflectionDynamicMethodHandle mb, MonoError *error); +ICALL_EXPORT MonoReflectionTypeHandle ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilderHandle tb, MonoError *error); +ICALL_EXPORT void ves_icall_EnumBuilder_setup_enum_type (MonoReflectionTypeHandle enumtype, MonoReflectionTypeHandle t, MonoError *error); - +ICALL_EXPORT void ves_icall_ModuleBuilder_basic_init (MonoReflectionModuleBuilderHandle moduleb, MonoError *error); +ICALL_EXPORT guint32 ves_icall_ModuleBuilder_getUSIndex (MonoReflectionModuleBuilderHandle module, MonoStringHandle str, MonoError *error); +ICALL_EXPORT void ves_icall_ModuleBuilder_set_wrappers_type (MonoReflectionModuleBuilderHandle moduleb, MonoReflectionTypeHandle type, MonoError *error); @@ -1997,4 +2105,13 @@ mono_gc_wbarrier_object_copy_handle (MonoObjectHandle obj, MonoObjectHandle src) MonoMethod* mono_class_get_virtual_method (MonoClass *klass, MonoMethod *method, gboolean is_proxy, MonoError *error); +MonoStringHandle +mono_string_empty_handle (MonoDomain *domain); + +gpointer +mono_object_get_data (MonoObject *o); + +gpointer +mono_vtype_get_field_addr (guint8 *vtype, MonoClassField *field); + #endif /* __MONO_OBJECT_INTERNALS_H__ */ diff --git a/mono/metadata/object-offsets.h b/mono/metadata/object-offsets.h index 038392a262..9343b9a612 100644 --- a/mono/metadata/object-offsets.h +++ b/mono/metadata/object-offsets.h @@ -171,6 +171,7 @@ DECL_OFFSET(MonoContinuation, return_sp) DECL_OFFSET(MonoContinuation, lmf) DECL_OFFSET(MonoContinuation, return_ip) +DECL_OFFSET(MonoDelegateTrampInfo, method) DECL_OFFSET(MonoDelegateTrampInfo, invoke_impl) DECL_OFFSET(MonoDelegateTrampInfo, method_ptr) @@ -285,6 +286,14 @@ DECL_OFFSET(CallContext, stack_size) DECL_OFFSET(CallContext, stack) #endif +#if defined(TARGET_X86) +DECL_OFFSET(GSharedVtCallInfo, stack_usage) +DECL_OFFSET(GSharedVtCallInfo, vret_slot) +DECL_OFFSET(GSharedVtCallInfo, vret_arg_slot) +DECL_OFFSET(GSharedVtCallInfo, ret_marshal) +DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in) +#endif + DECL_OFFSET(MonoFtnDesc, arg) DECL_OFFSET(MonoFtnDesc, addr) diff --git a/mono/metadata/object.c.REMOVED.git-id b/mono/metadata/object.c.REMOVED.git-id index fce8f408f0..49582b208e 100644 --- a/mono/metadata/object.c.REMOVED.git-id +++ b/mono/metadata/object.c.REMOVED.git-id @@ -1 +1 @@ -960a260ea505c05f293bd6311205a73eb083e26f \ No newline at end of file +4f6a30f08bf6a75757f62af8341d750b41441f67 \ No newline at end of file diff --git a/mono/metadata/object.h b/mono/metadata/object.h index 53cd548a60..032dfb797b 100644 --- a/mono/metadata/object.h +++ b/mono/metadata/object.h @@ -49,7 +49,7 @@ typedef void (*MonoMainThreadFunc) (void* user_data); mono_gc_wbarrier_generic_store (&((s)->field), (MonoObject*)(value)); \ } while (0) -#define mono_array_addr(array,type,index) ((type*)(void*) mono_array_addr_with_size (array, sizeof (type), index)) +#define mono_array_addr(array,type,index) ((type*)mono_array_addr_with_size ((array), sizeof (type), (index))) #define mono_array_get(array,type,index) ( *(type*)mono_array_addr ((array), type, (index)) ) #define mono_array_set(array,type,index,value) \ do { \ @@ -72,41 +72,41 @@ typedef void (*MonoMainThreadFunc) (void* user_data); MONO_API mono_unichar2 *mono_string_chars (MonoString *s); MONO_API int mono_string_length (MonoString *s); -MONO_RT_EXTERNAL_ONLY MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject * mono_object_new (MonoDomain *domain, MonoClass *klass); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoObject * mono_object_new_specific (MonoVTable *vtable); /* can be used for classes without finalizer in non-profiling mode */ -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoObject * mono_object_new_fast (MonoVTable *vtable); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoObject * mono_object_new_alloc_specific (MonoVTable *vtable); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoObject * mono_object_new_from_token (MonoDomain *domain, MonoImage *image, uint32_t token); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArray* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoArray* mono_array_new (MonoDomain *domain, MonoClass *eclass, uintptr_t n); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArray* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoArray* mono_array_new_full (MonoDomain *domain, MonoClass *array_class, uintptr_t *lengths, intptr_t *lower_bounds); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArray * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoArray * mono_array_new_specific (MonoVTable *vtable, uintptr_t n); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArray* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoArray* mono_array_clone (MonoArray *array); MONO_API char* @@ -118,46 +118,46 @@ mono_array_length (MonoArray *array); MONO_API MonoString* mono_string_empty (MonoDomain *domain); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoString* mono_string_empty_wrapper (void); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoString* mono_string_new_utf16 (MonoDomain *domain, const mono_unichar2 *text, int32_t len); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoString* mono_string_new_size (MonoDomain *domain, int32_t len); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoString* mono_ldstr (MonoDomain *domain, MonoImage *image, uint32_t str_index); MONO_API MonoString* mono_string_is_interned (MonoString *str); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoString* mono_string_intern (MonoString *str); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoString* mono_string_new (MonoDomain *domain, const char *text); MONO_API MonoString* mono_string_new_wrapper (const char *text); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoString* mono_string_new_len (MonoDomain *domain, const char *text, unsigned int length); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString* +MONO_API MONO_RT_EXTERNAL_ONLY +MonoString* mono_string_new_utf32 (MonoDomain *domain, const mono_unichar4 *text, int32_t len); -MONO_RT_EXTERNAL_ONLY -MONO_API char * +MONO_API MONO_RT_EXTERNAL_ONLY +char * mono_string_to_utf8 (MonoString *string_obj); MONO_API char * @@ -169,13 +169,11 @@ mono_string_to_utf16 (MonoString *string_obj); MONO_API mono_unichar4 * mono_string_to_utf32 (MonoString *string_obj); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString * -mono_string_from_utf16 (mono_unichar2 *data); +MONO_API MONO_RT_EXTERNAL_ONLY MonoString * +mono_string_from_utf16 (/*const*/ mono_unichar2 *data); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString * -mono_string_from_utf32 (mono_unichar4 *data); +MONO_API MONO_RT_EXTERNAL_ONLY MonoString * +mono_string_from_utf32 (/*const*/ mono_unichar4 *data); MONO_API mono_bool mono_string_equal (MonoString *s1, MonoString *s2); @@ -186,16 +184,15 @@ mono_string_hash (MonoString *s); MONO_API int mono_object_hash (MonoObject* obj); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoString * +MONO_API MONO_RT_EXTERNAL_ONLY +MonoString * mono_object_to_string (MonoObject *obj, MonoObject **exc); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject * mono_value_box (MonoDomain *domain, MonoClass *klass, void* val); MONO_API void -mono_value_copy (void* dest, void* src, MonoClass *klass); +mono_value_copy (void* dest, /*const*/ void* src, MonoClass *klass); MONO_API void mono_value_copy_array (MonoArray *dest, int dest_idx, void* src, int count); @@ -212,20 +209,16 @@ mono_object_get_class (MonoObject *obj); MONO_API void* mono_object_unbox (MonoObject *obj); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject * mono_object_clone (MonoObject *obj); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject * mono_object_isinst (MonoObject *obj, MonoClass *klass); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject * mono_object_isinst_mbyref (MonoObject *obj, MonoClass *klass); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject * mono_object_castclass_mbyref (MonoObject *obj, MonoClass *klass); MONO_API mono_bool @@ -243,24 +236,19 @@ mono_object_get_size (MonoObject *o); MONO_API void mono_monitor_exit (MonoObject *obj); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_raise_exception (MonoException *ex); -MONO_RT_EXTERNAL_ONLY -MONO_API mono_bool +MONO_API MONO_RT_EXTERNAL_ONLY mono_bool mono_runtime_set_pending_exception (MonoException *exc, mono_bool overwrite); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_reraise_exception (MonoException *ex); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_runtime_object_init (MonoObject *this_obj); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_runtime_class_init (MonoVTable *vtable); MONO_API MonoDomain * @@ -272,8 +260,7 @@ mono_vtable_class (MonoVTable *vtable); MONO_API MonoMethod* mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject* +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject* mono_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc); @@ -286,22 +273,18 @@ mono_get_delegate_begin_invoke (MonoClass *klass); MONO_API MonoMethod * mono_get_delegate_end_invoke (MonoClass *klass); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject* +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject* mono_runtime_delegate_invoke (MonoObject *delegate, void **params, MonoObject **exc); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject* +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject* mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params, MonoObject **exc); -MONO_RT_EXTERNAL_ONLY -MONO_API void* +MONO_API MONO_RT_EXTERNAL_ONLY void* mono_method_get_unmanaged_thunk (MonoMethod *method); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArray* +MONO_API MONO_RT_EXTERNAL_ONLY MonoArray* mono_runtime_get_main_args (void); MONO_API void @@ -309,13 +292,11 @@ mono_runtime_exec_managed_code (MonoDomain *domain, MonoMainThreadFunc main_func, void* main_args); -MONO_RT_EXTERNAL_ONLY -MONO_API int +MONO_API MONO_RT_EXTERNAL_ONLY int mono_runtime_run_main (MonoMethod *method, int argc, char* argv[], MonoObject **exc); -MONO_RT_EXTERNAL_ONLY -MONO_API int +MONO_API MONO_RT_EXTERNAL_ONLY int mono_runtime_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc); @@ -324,20 +305,16 @@ mono_runtime_set_main_args (int argc, char* argv[]); /* The following functions won't be available with mono was configured with remoting disabled. */ /*#ifndef DISABLE_REMOTING */ -MONO_RT_EXTERNAL_ONLY -MONO_API void* +MONO_API MONO_RT_EXTERNAL_ONLY void* mono_load_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void **res); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject * mono_load_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassField *field); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_store_remote_field (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void* val); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_store_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg); /* #endif */ @@ -348,8 +325,8 @@ mono_unhandled_exception (MonoObject *exc); MONO_API void mono_print_unhandled_exception (MonoObject *exc); -MONO_RT_EXTERNAL_ONLY -MONO_API void* +MONO_API MONO_RT_EXTERNAL_ONLY +void* mono_compile_method (MonoMethod *method); /* accessors for fields and properties */ @@ -362,20 +339,16 @@ mono_field_static_set_value (MonoVTable *vt, MonoClassField *field, void *value) MONO_API void mono_field_get_value (MonoObject *obj, MonoClassField *field, void *value); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_field_static_get_value (MonoVTable *vt, MonoClassField *field, void *value); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject * +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject * mono_field_get_value_object (MonoDomain *domain, MonoClassField *field, MonoObject *obj); -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject* +MONO_API MONO_RT_EXTERNAL_ONLY MonoObject* mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc); /* GC handles support @@ -422,7 +395,7 @@ MONO_API void mono_gc_wbarrier_arrayref_copy (void* dest_ptr, void* src_ptr, int MONO_API void mono_gc_wbarrier_generic_store (void* ptr, MonoObject* value); MONO_API void mono_gc_wbarrier_generic_store_atomic (void *ptr, MonoObject *value); MONO_API void mono_gc_wbarrier_generic_nostore (void* ptr); -MONO_API void mono_gc_wbarrier_value_copy (void* dest, void* src, int count, MonoClass *klass); +MONO_API void mono_gc_wbarrier_value_copy (void* dest, /*const*/ void* src, int count, MonoClass *klass); MONO_API void mono_gc_wbarrier_object_copy (MonoObject* obj, MonoObject *src); MONO_END_DECLS diff --git a/mono/metadata/opcodes.c b/mono/metadata/opcodes.c index d3a712bc22..0522a9f5ae 100644 --- a/mono/metadata/opcodes.c +++ b/mono/metadata/opcodes.c @@ -40,7 +40,7 @@ static const struct msgstr_t { #undef OPDEF }; static const int16_t opidx [] = { -#define OPDEF(a,b,c,d,e,f,g,h,i,j) [MONO_ ## a] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), +#define OPDEF(a,b,c,d,e,f,g,h,i,j) offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), #include "mono/cil/opcode.def" #undef OPDEF }; diff --git a/mono/metadata/opcodes.h b/mono/metadata/opcodes.h index 022668573f..30edc54c29 100644 --- a/mono/metadata/opcodes.h +++ b/mono/metadata/opcodes.h @@ -71,7 +71,7 @@ typedef struct { unsigned short opval; } MonoOpcode; -MONO_API extern const MonoOpcode mono_opcodes []; +MONO_API_DATA const MonoOpcode mono_opcodes []; MONO_API const char* mono_opcode_name (int opcode); diff --git a/mono/metadata/pal-icalls.c b/mono/metadata/pal-icalls.c new file mode 100644 index 0000000000..1d4cd038d5 --- /dev/null +++ b/mono/metadata/pal-icalls.c @@ -0,0 +1,78 @@ +/** + * \file + * System.Native PAL internal calls + * Adapter code between the Mono runtime and the CoreFX Platform Abstraction Layer (PAL) + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. +*/ + +#include +#include +#include "pal_io.h" +#include "mono/utils/mono-threads-api.h" +#include "mono/utils/atomic.h" + +#include "pal-icalls.h" + +/* + * mono_pal_init: + * + * Initializes Mono's usage of the PAL (probably just by registering the necessary internal calls). + * This is called only from managed code, by any Interop.* classes that need to use the code here. + * The function may be called multiple times. + * + */ +void +mono_pal_init (void) +{ + volatile static gboolean module_initialized = FALSE; + if (mono_atomic_cas_i32 (&module_initialized, TRUE, FALSE) == FALSE) { + mono_add_internal_call ("Interop/Sys::Read", ves_icall_Interop_Sys_Read); + +#if defined(__APPLE__) + mono_add_internal_call ("Interop/RunLoop::CFRunLoopRun", ves_icall_Interop_RunLoop_CFRunLoopRun); +#endif + } + +} + +gint32 +ves_icall_Interop_Sys_Read (intptr_t fd, gchar* buffer, gint32 count) +{ + gint32 result; + MONO_ENTER_GC_SAFE; + result = SystemNative_Read (fd, buffer, count); + mono_marshal_set_last_error (); + MONO_EXIT_GC_SAFE; + return result; +} + +#if defined(__APPLE__) + +#include + +static void +interrupt_CFRunLoop (gpointer data) +{ + g_assert (data); + CFRunLoopStop (data); +} + +void +ves_icall_Interop_RunLoop_CFRunLoopRun (void) +{ + gpointer runloop_ref = CFRunLoopGetCurrent (); + gboolean interrupted; + mono_thread_info_install_interrupt (interrupt_CFRunLoop, runloop_ref, &interrupted); + + if (interrupted) + return; + + MONO_ENTER_GC_SAFE; + CFRunLoopRun (); + MONO_EXIT_GC_SAFE; + + mono_thread_info_uninstall_interrupt (&interrupted); +} + +#endif diff --git a/mono/metadata/pal-icalls.h b/mono/metadata/pal-icalls.h new file mode 100644 index 0000000000..6f17ea9275 --- /dev/null +++ b/mono/metadata/pal-icalls.h @@ -0,0 +1,26 @@ +/** + * \file + * System.Native PAL internal calls + * Adapter code between the Mono runtime and the CoreFX Platform Abstraction Layer (PAL) + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. +*/ + +#ifndef __MONO_METADATA_PAL_ICALLS_H__ +#define __MONO_METADATA_PAL_ICALLS_H__ + +#include "metadata.h" +#include "class-internals.h" + +MONO_API void mono_pal_init (void); + +extern void mono_marshal_set_last_error (void); +gint32 ves_icall_Interop_Sys_Read (intptr_t fd, gchar* buffer, gint32 count); + +#if defined(__APPLE__) +extern void mono_thread_info_install_interrupt (void (*callback) (gpointer data), gpointer data, gboolean *interrupted); +extern void mono_thread_info_uninstall_interrupt (gboolean *interrupted); +void ves_icall_Interop_RunLoop_CFRunLoopRun (void); +#endif + +#endif diff --git a/mono/metadata/pal_config.h b/mono/metadata/pal_config.h index d26953e6cd..d166722bfe 100644 --- a/mono/metadata/pal_config.h +++ b/mono/metadata/pal_config.h @@ -1 +1,3 @@ #include + +#define MONO 1 diff --git a/mono/metadata/profiler-private.h b/mono/metadata/profiler-private.h index 600c36a9ca..f18d70c5e7 100644 --- a/mono/metadata/profiler-private.h +++ b/mono/metadata/profiler-private.h @@ -12,6 +12,7 @@ #include #include #include +#include struct _MonoProfilerDesc { MonoProfilerHandle next; diff --git a/mono/metadata/profiler.c b/mono/metadata/profiler.c index cc969e0d3e..ed680d6427 100644 --- a/mono/metadata/profiler.c +++ b/mono/metadata/profiler.c @@ -25,14 +25,13 @@ typedef void (*MonoProfilerInitializer) (const char *); static gboolean load_profiler (MonoDl *module, const char *name, const char *desc) { - if (!module) - return FALSE; + g_assert (module); char *err, *old_name = g_strdup_printf (OLD_INITIALIZER_NAME); MonoProfilerInitializer func; if (!(err = mono_dl_symbol (module, old_name, (gpointer) &func))) { - mono_profiler_printf_err ("Found old-style startup symbol '%s' for the '%s' profiler; it has not been migrated to the new API.", old_name, name); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_PROFILER, "Found old-style startup symbol '%s' for the '%s' profiler; it has not been migrated to the new API.", old_name, name); g_free (old_name); return FALSE; } @@ -71,7 +70,7 @@ load_profiler_from_executable (const char *name, const char *desc) MonoDl *module = mono_dl_open (NULL, MONO_DL_EAGER, &err); if (!module) { - mono_profiler_printf_err ("Could not open main executable: %s", err); + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_PROFILER, "Could not open main executable: %s", err); g_free (err); return FALSE; } @@ -82,17 +81,22 @@ load_profiler_from_executable (const char *name, const char *desc) static gboolean load_profiler_from_directory (const char *directory, const char *libname, const char *name, const char *desc) { - char* path; + char *path, *err; void *iter = NULL; while ((path = mono_dl_build_path (directory, libname, &iter))) { - // See the comment in load_embedded_profiler (). - MonoDl *module = mono_dl_open (path, MONO_DL_EAGER, NULL); + MonoDl *module = mono_dl_open (path, MONO_DL_EAGER, &err); + + if (!module) { + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_PROFILER, "Could not open from directory \"%s\": %s", path, err); + g_free (err); + g_free (path); + continue; + } g_free (path); - if (module) - return load_profiler (module, name, desc); + return load_profiler (module, name, desc); } return FALSE; @@ -104,12 +108,13 @@ load_profiler_from_installation (const char *libname, const char *name, const ch char *err; MonoDl *module = mono_dl_open_runtime_lib (libname, MONO_DL_EAGER, &err); - g_free (err); + if (!module) { + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_PROFILER, "Could not open from installation: %s", err); + g_free (err); + return FALSE; + } - if (module) - return load_profiler (module, name, desc); - - return FALSE; + return load_profiler (module, name, desc); } /** @@ -137,35 +142,39 @@ load_profiler_from_installation (const char *libname, const char *name, const ch void mono_profiler_load (const char *desc) { + char *col, *mname, *libname; + + mname = libname = NULL; + if (!desc || !strcmp ("default", desc)) desc = "log:report"; - const char *col = strchr (desc, ':'); - char *mname; - - if (col != NULL) { + if ((col = strchr (desc, ':')) != NULL) { mname = (char *) g_memdup (desc, col - desc + 1); mname [col - desc] = 0; - } else + } else { mname = g_strdup (desc); - - if (!load_profiler_from_executable (mname, desc)) { - char *libname = g_strdup_printf ("mono-profiler-%s", mname); - gboolean res = load_profiler_from_installation (libname, mname, desc); - - if (!res && mono_config_get_assemblies_dir ()) - res = load_profiler_from_directory (mono_assembly_getrootdir (), libname, mname, desc); - - if (!res) - res = load_profiler_from_directory (NULL, libname, mname, desc); - - if (!res) - mono_profiler_printf_err ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname); - - g_free (libname); } + if (load_profiler_from_executable (mname, desc)) + goto done; + + libname = g_strdup_printf ("mono-profiler-%s", mname); + + if (load_profiler_from_installation (libname, mname, desc)) + goto done; + + if (mono_config_get_assemblies_dir () && load_profiler_from_directory (mono_assembly_getrootdir (), libname, mname, desc)) + goto done; + + if (load_profiler_from_directory (NULL, libname, mname, desc)) + goto done; + + mono_trace (G_LOG_LEVEL_CRITICAL, MONO_TRACE_PROFILER, "The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname); + +done: g_free (mname); + g_free (libname); } /** @@ -345,14 +354,14 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, srcfile = sinfo->source_file; } - MonoProfilerCoverageData data = { - .method = method, - .il_offset = sp->il_offset, - .counter = 0, - .file_name = srcfile, - .line = sp->line, - .column = 0, - }; + MonoProfilerCoverageData data; + memset (&data, 0, sizeof (data)); + data.method = method; + data.il_offset = sp->il_offset; + data.counter = 0; + data.file_name = srcfile; + data.line = sp->line; + data.column = 0; cb (handle->prof, &data); } @@ -370,13 +379,13 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, if (cil_code && cil_code >= start && cil_code < end) { guint32 offset = cil_code - start; - MonoProfilerCoverageData data = { - .method = method, - .il_offset = offset, - .counter = info->data [i].count, - .line = 1, - .column = 1, - }; + MonoProfilerCoverageData data; + memset (&data, 0, sizeof (data)); + data.method = method; + data.il_offset = offset; + data.counter = info->data [i].count; + data.line = 1; + data.column = 1; if (minfo) { MonoDebugSourceLocation *loc = mono_debug_method_lookup_location (minfo, offset); diff --git a/mono/metadata/rand.c b/mono/metadata/rand.c index 6729f87481..985eaf1706 100644 --- a/mono/metadata/rand.c +++ b/mono/metadata/rand.c @@ -21,30 +21,27 @@ #include "utils/mono-rand.h" MonoBoolean -ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (void) +ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (MonoError *error) { return (MonoBoolean) mono_rand_open (); } gpointer -ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize (MonoArray *seed) +ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize (const guchar *seed, gssize seed_length, MonoError *error) { - - return mono_rand_init (seed ? mono_array_addr (seed, guchar, 0) : NULL, seed ? mono_array_length (seed) : 0); + return mono_rand_init (seed, seed_length); } gpointer -ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpointer handle, MonoArray *arry) +ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpointer handle, guchar *array, gssize array_length, MonoError *error) { - ERROR_DECL (error); - g_assert (arry); - mono_rand_try_get_bytes (&handle, mono_array_addr (arry, guchar, 0), mono_array_length (arry), error); - mono_error_set_pending_exception (error); + g_assert (array || !array_length); + mono_rand_try_get_bytes (&handle, array, array_length, error); return handle; } void -ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose (gpointer handle) +ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose (gpointer handle, MonoError *error) { mono_rand_close (handle); } diff --git a/mono/metadata/rand.h b/mono/metadata/rand.h index 898f44f0c1..d27297f9e0 100644 --- a/mono/metadata/rand.h +++ b/mono/metadata/rand.h @@ -17,10 +17,22 @@ #include #include #include "mono/utils/mono-compiler.h" +#include -MonoBoolean ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (void); -gpointer ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize (MonoArray *seed); -gpointer ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpointer handle, MonoArray *arry); -void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose (gpointer handle); +ICALL_EXPORT +MonoBoolean +ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (MonoError *error); + +ICALL_EXPORT +gpointer +ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize (const guchar *seed, gssize seed_length, MonoError *error); + +ICALL_EXPORT +gpointer +ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpointer handle, guchar *array, gssize array_length, MonoError *error); + +ICALL_EXPORT +void +ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose (gpointer handle, MonoError *error); #endif diff --git a/mono/metadata/reflection-cache.h b/mono/metadata/reflection-cache.h index 8d76b16275..0762e8da84 100644 --- a/mono/metadata/reflection-cache.h +++ b/mono/metadata/reflection-cache.h @@ -95,7 +95,7 @@ cache_object_handle (MonoDomain *domain, MonoClass *klass, gpointer item, MonoOb } #define CACHE_OBJECT(t,p,o,k) ((t) (cache_object (domain, (k), (p), (o)))) -#define CACHE_OBJECT_HANDLE(t,p,o,k) ((t) (cache_object_handle (domain, (k), (p), (o)))) +#define CACHE_OBJECT_HANDLE(t,p,o,k) (MONO_HANDLE_CAST (t, cache_object_handle (domain, (k), (p), (o)))) static inline MonoObjectHandle check_object_handle (MonoDomain* domain, MonoClass *klass, gpointer item) @@ -107,8 +107,7 @@ check_object_handle (MonoDomain* domain, MonoClass *klass, gpointer item) if (!hash) return MONO_HANDLE_NEW (MonoObject, NULL); - MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_conc_g_hash_table_lookup (hash, &e)); - return obj; + return MONO_HANDLE_NEW (MonoObject, mono_conc_g_hash_table_lookup (hash, &e)); } @@ -122,15 +121,15 @@ check_or_construct_handle (MonoDomain *domain, MonoClass *klass, gpointer item, if (!MONO_HANDLE_IS_NULL (obj)) return obj; MONO_HANDLE_ASSIGN (obj, construct (domain, klass, item, user_data, error)); - return_val_if_nok (error, NULL); + return_val_if_nok (error, NULL_HANDLE); if (MONO_HANDLE_IS_NULL (obj)) return obj; /* note no caching if there was an error in construction */ return cache_object_handle (domain, klass, item, obj); } - -#define CHECK_OR_CONSTRUCT_HANDLE(t,p,k,construct,ud) ((t) check_or_construct_handle (domain, (k), (p), (ud), error, (ReflectionCacheConstructFunc_handle) (construct))) - +#define CHECK_OR_CONSTRUCT_HANDLE(t,p,k,construct,ud) \ + (MONO_HANDLE_CAST (t, check_or_construct_handle ( \ + domain, (k), (p), (ud), error, (ReflectionCacheConstructFunc_handle) (construct)))) #endif /*__MONO_METADATA_REFLECTION_CACHE_H__*/ diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index ca3a8993ce..0ed34c1210 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -219,9 +219,12 @@ MonoReflectionAssembly* mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly) { HANDLE_FUNCTION_ENTER (); + MonoReflectionAssemblyHandle result; + MONO_ENTER_GC_UNSAFE; ERROR_DECL (error); - MonoReflectionAssemblyHandle result = mono_assembly_get_object_handle (domain, assembly, error); + result = mono_assembly_get_object_handle (domain, assembly, error); mono_error_cleanup (error); /* FIXME new API that doesn't swallow the error */ + MONO_EXIT_GC_UNSAFE; HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -229,7 +232,7 @@ static MonoReflectionAssemblyHandle assembly_object_construct (MonoDomain *domain, MonoClass *unused_klass, MonoAssembly *assembly, gpointer user_data, MonoError *error) { error_init (error); - MonoReflectionAssemblyHandle res = (MonoReflectionAssemblyHandle) mono_object_new_handle (domain, mono_class_get_mono_assembly_class (), error); + MonoReflectionAssemblyHandle res = MONO_HANDLE_CAST (MonoReflectionAssembly, mono_object_new_handle (domain, mono_class_get_mono_assembly_class (), error)); return_val_if_nok (error, MONO_HANDLE_CAST (MonoReflectionAssembly, NULL_HANDLE)); MONO_HANDLE_SETVAL (res, assembly, MonoAssembly*, assembly); return res; @@ -246,7 +249,7 @@ MonoReflectionAssemblyHandle mono_assembly_get_object_handle (MonoDomain *domain, MonoAssembly *assembly, MonoError *error) { error_init (error); - return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionAssemblyHandle, assembly, NULL, assembly_object_construct, NULL); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionAssembly, assembly, NULL, assembly_object_construct, NULL); } /** @@ -268,7 +271,7 @@ module_object_construct (MonoDomain *domain, MonoClass *unused_klass, MonoImage char* basename; error_init (error); - MonoReflectionModuleHandle res = (MonoReflectionModuleHandle)mono_object_new_handle (domain, mono_class_get_mono_module_class (), error); + MonoReflectionModuleHandle res = MONO_HANDLE_CAST (MonoReflectionModule, mono_object_new_handle (domain, mono_class_get_mono_module_class (), error)); goto_if_nok (error, fail); MONO_HANDLE_SETVAL (res, image, MonoImage *, image); @@ -310,7 +313,7 @@ MonoReflectionModuleHandle mono_module_get_object_handle (MonoDomain *domain, MonoImage *image, MonoError *error) { error_init (error); - return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionModuleHandle, image, NULL, module_object_construct, NULL); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionModule, image, NULL, module_object_construct, NULL); } /** @@ -337,7 +340,7 @@ mono_module_file_get_object_handle (MonoDomain *domain, MonoImage *image, int ta error_init (error); - MonoReflectionModuleHandle res = (MonoReflectionModuleHandle)mono_object_new_handle (domain, mono_class_get_mono_module_class (), error); + MonoReflectionModuleHandle res = MONO_HANDLE_CAST (MonoReflectionModule, mono_object_new_handle (domain, mono_class_get_mono_module_class (), error)); goto_if_nok (error, fail); table = &image->tables [MONO_TABLE_FILE]; @@ -572,9 +575,12 @@ MonoReflectionMethod* mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass) { HANDLE_FUNCTION_ENTER (); + MonoReflectionMethodHandle ret; + MONO_ENTER_GC_UNSAFE; ERROR_DECL (error); - MonoReflectionMethodHandle ret = mono_method_get_object_handle (domain, method, refclass, error); + ret = mono_method_get_object_handle (domain, method, refclass, error); mono_error_cleanup (error); + MONO_EXIT_GC_UNSAFE; HANDLE_FUNCTION_RETURN_OBJ (ret); } @@ -597,7 +603,7 @@ method_object_construct (MonoDomain *domain, MonoClass *refclass, MonoMethod *me else { klass = mono_class_get_mono_method_class (); } - MonoReflectionMethodHandle ret = (MonoReflectionMethodHandle)mono_object_new_handle (domain, klass, error); + MonoReflectionMethodHandle ret = MONO_HANDLE_CAST (MonoReflectionMethod, mono_object_new_handle (domain, klass, error)); goto_if_nok (error, fail); MONO_HANDLE_SETVAL (ret, method, MonoMethod*, method); @@ -629,7 +635,7 @@ mono_method_get_object_handle (MonoDomain *domain, MonoMethod *method, MonoClass if (!refclass) refclass = method->klass; - return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionMethodHandle, method, refclass, method_object_construct, NULL); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionMethod, method, refclass, method_object_construct, NULL); } /* * mono_method_get_object_checked: @@ -697,7 +703,7 @@ field_object_construct (MonoDomain *domain, MonoClass *klass, MonoClassField *fi { error_init (error); - MonoReflectionFieldHandle res = (MonoReflectionFieldHandle)mono_object_new_handle (domain, mono_class_get_mono_field_class (), error); + MonoReflectionFieldHandle res = MONO_HANDLE_CAST (MonoReflectionField, mono_object_new_handle (domain, mono_class_get_mono_field_class (), error)); goto_if_nok (error, fail); MONO_HANDLE_SETVAL (res, klass, MonoClass *, klass); MONO_HANDLE_SETVAL (res, field, MonoClassField *, field); @@ -731,7 +737,7 @@ MonoReflectionFieldHandle mono_field_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoClassField *field, MonoError *error) { error_init (error); - return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionFieldHandle, field, klass, field_object_construct, NULL); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionField, field, klass, field_object_construct, NULL); } @@ -777,7 +783,7 @@ property_object_construct (MonoDomain *domain, MonoClass *klass, MonoProperty *p { error_init (error); - MonoReflectionPropertyHandle res = (MonoReflectionPropertyHandle)mono_object_new_handle (domain, mono_class_get_mono_property_class (), error); + MonoReflectionPropertyHandle res = MONO_HANDLE_CAST (MonoReflectionProperty, mono_object_new_handle (domain, mono_class_get_mono_property_class (), error)); goto_if_nok (error, fail); MONO_HANDLE_SETVAL (res, klass, MonoClass *, klass); MONO_HANDLE_SETVAL (res, property, MonoProperty *, property); @@ -799,7 +805,7 @@ fail: MonoReflectionPropertyHandle mono_property_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error) { - return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionPropertyHandle, property, klass, property_object_construct, NULL); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionProperty, property, klass, property_object_construct, NULL); } /** @@ -842,7 +848,7 @@ event_object_construct (MonoDomain *domain, MonoClass *klass, MonoEvent *event, { error_init (error); - MonoReflectionMonoEventHandle mono_event = (MonoReflectionMonoEventHandle)mono_object_new_handle (domain, mono_class_get_mono_event_class (), error); + MonoReflectionMonoEventHandle mono_event = MONO_HANDLE_CAST (MonoReflectionMonoEvent, mono_object_new_handle (domain, mono_class_get_mono_event_class (), error)); if (!is_ok (error)) return MONO_HANDLE_CAST (MonoReflectionEvent, NULL_HANDLE); MONO_HANDLE_SETVAL (mono_event, klass, MonoClass* , klass); @@ -863,7 +869,7 @@ MonoReflectionEventHandle mono_event_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoEvent *event, MonoError *error) { error_init (error); - return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionEventHandle, event, klass, event_object_construct, NULL); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionEvent, event, klass, event_object_construct, NULL); } @@ -887,7 +893,7 @@ mono_get_reflection_missing_object (MonoDomain *domain) MonoClass *missing_klass; missing_klass = mono_class_get_missing_class (); mono_class_init (missing_klass); - missing_value_field = mono_class_get_field_from_name (missing_klass, "Value"); + missing_value_field = mono_class_get_field_from_name_full (missing_klass, "Value", NULL); g_assert (missing_value_field); } /* FIXME change mono_field_get_value_object_checked to return a handle */ @@ -906,7 +912,7 @@ get_dbnull_object (MonoDomain *domain, MonoError *error) if (!dbnull_value_field) { MonoClass *dbnull_klass; dbnull_klass = mono_class_get_dbnull_class (); - dbnull_value_field = mono_class_get_field_from_name (dbnull_klass, "Value"); + dbnull_value_field = mono_class_get_field_from_name_full (dbnull_klass, "Value", NULL); g_assert (dbnull_value_field); } /* FIXME change mono_field_get_value_object_checked to return a handle */ @@ -936,7 +942,7 @@ add_parameter_object_to_array (MonoDomain *domain, MonoMethod *method, MonoObjec { HANDLE_FUNCTION_ENTER (); error_init (error); - MonoReflectionParameterHandle param = (MonoReflectionParameterHandle)mono_object_new_handle (domain, mono_class_get_mono_parameter_info_class (), error); + MonoReflectionParameterHandle param = MONO_HANDLE_CAST (MonoReflectionParameter, mono_object_new_handle (domain, mono_class_get_mono_parameter_info_class (), error)); goto_if_nok (error, leave); MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, sig_param, error); @@ -1026,7 +1032,7 @@ param_objects_construct (MonoDomain *domain, MonoClass *refclass, MonoMethodSign mono_method_get_marshal_info (method, mspecs); res = mono_array_new_handle (domain, mono_class_get_mono_parameter_info_class (), sig->param_count, error); - if (!res) + if (MONO_HANDLE_IS_NULL (res)) goto leave; gboolean any_default_value = FALSE; @@ -1064,7 +1070,7 @@ leave: g_free (mspecs); if (!is_ok (error)) - return NULL; + return NULL_HANDLE_ARRAY; return res; } @@ -1096,9 +1102,9 @@ mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoCla /* Note: the cache is based on the address of the signature into the method * since we already cache MethodInfos with the method as keys. */ - return CHECK_OR_CONSTRUCT_HANDLE (MonoArrayHandle, &method->signature, refclass, param_objects_construct, method); + return CHECK_OR_CONSTRUCT_HANDLE (MonoArray, &method->signature, refclass, param_objects_construct, method); fail: - return MONO_HANDLE_NEW (MonoArray, NULL_HANDLE); + return MONO_HANDLE_NEW (MonoArray, NULL); } /** @@ -1119,7 +1125,7 @@ add_local_var_info_to_array (MonoDomain *domain, MonoMethodHeader *header, int i { HANDLE_FUNCTION_ENTER (); error_init (error); - MonoReflectionLocalVariableInfoHandle info = (MonoReflectionLocalVariableInfoHandle)mono_object_new_handle (domain, mono_class_get_local_variable_info_class (), error); + MonoReflectionLocalVariableInfoHandle info = MONO_HANDLE_CAST (MonoReflectionLocalVariableInfo, mono_object_new_handle (domain, mono_class_get_local_variable_info_class (), error)); goto_if_nok (error, leave); MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, header->locals [idx], error); @@ -1141,7 +1147,7 @@ add_exception_handling_clause_to_array (MonoDomain *domain, MonoMethodHeader *he { HANDLE_FUNCTION_ENTER (); error_init (error); - MonoReflectionExceptionHandlingClauseHandle info = (MonoReflectionExceptionHandlingClauseHandle)mono_object_new_handle (domain, mono_class_get_exception_handling_clause_class (), error); + MonoReflectionExceptionHandlingClauseHandle info = MONO_HANDLE_CAST (MonoReflectionExceptionHandlingClause, mono_object_new_handle (domain, mono_class_get_exception_handling_clause_class (), error)); goto_if_nok (error, leave); MonoExceptionClause *clause = &header->clauses [idx]; @@ -1232,7 +1238,7 @@ method_body_object_construct (MonoDomain *domain, MonoClass *unused_class, MonoM } else local_var_sig_token = 0; //FIXME - MonoReflectionMethodBodyHandle ret = (MonoReflectionMethodBodyHandle)mono_object_new_handle (domain, mono_class_get_method_body_class (), error); + MonoReflectionMethodBodyHandle ret = MONO_HANDLE_CAST (MonoReflectionMethodBody, mono_object_new_handle (domain, mono_class_get_method_body_class (), error)); goto_if_nok (error, fail); MONO_HANDLE_SETVAL (ret, init_locals, MonoBoolean, header->init_locals); @@ -1269,7 +1275,7 @@ method_body_object_construct (MonoDomain *domain, MonoClass *unused_class, MonoM fail: if (header) mono_metadata_free_mh (header); - return NULL; + return MONO_HANDLE_CAST (MonoReflectionMethodBody, NULL_HANDLE); } /** @@ -1284,7 +1290,7 @@ MonoReflectionMethodBodyHandle mono_method_body_get_object_handle (MonoDomain *domain, MonoMethod *method, MonoError *error) { error_init (error); - return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionMethodBodyHandle, method, NULL, method_body_object_construct, NULL); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionMethodBody, method, NULL, method_body_object_construct, NULL); } @@ -1388,7 +1394,7 @@ mono_get_object_from_blob (MonoDomain *domain, MonoType *type, const char *blob, if (m_class_is_valuetype (klass)) { object = mono_object_new_checked (domain, klass, error); return_val_if_nok (error, NULL); - retval = ((gchar *) object + sizeof (MonoObject)); + retval = mono_object_get_data (object); if (m_class_is_enumtype (klass)) basetype = mono_class_enum_basetype (klass); } else { @@ -1822,7 +1828,7 @@ mono_reflection_parse_type_checked (char *name, MonoTypeNameParse *info, MonoErr if (ok) { mono_identifier_unescape_info (info); } else { - mono_error_set_argument (error, "typeName", "failed parse: %s", name); + mono_error_set_argument_format (error, "typeName", "failed parse: %s", name); } return (ok != 0); } @@ -1837,7 +1843,7 @@ _mono_reflection_get_type_from_info (MonoTypeNameParse *info, MonoImage *image, error_init (error); if (info->assembly.name) { - MonoAssembly *assembly = mono_assembly_loaded (&info->assembly); + MonoAssembly *assembly = mono_assembly_loaded_full (&info->assembly, FALSE); if (!assembly && image && image->assembly && mono_assembly_names_equal (&info->assembly, &image->assembly->aname)) /* * This could happen in the AOT compiler case when the search hook is not @@ -2406,7 +2412,7 @@ mono_reflection_bind_generic_parameters (MonoReflectionTypeHandle reftype, int t guint gtd_type_argc = mono_class_get_generic_container (klass)->type_argc; if (gtd_type_argc != type_argc) { mono_loader_unlock (); - mono_error_set_argument (error, "types", "The generic type definition needs %d type arguments, but was instantiated with %d ", gtd_type_argc, type_argc); + mono_error_set_argument_format (error, "types", "The generic type definition needs %d type arguments, but was instantiated with %d ", gtd_type_argc, type_argc); return NULL; } @@ -2958,7 +2964,8 @@ mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass, Mono error_init (error); if (method == NULL) { - method = mono_class_get_method_from_name (mono_class_get_type_builder_class (), "IsAssignableTo", 1); + method = mono_class_get_method_from_name_checked (mono_class_get_type_builder_class (), "IsAssignableTo", 1, 0, error); + mono_error_assert_ok (error); g_assert (method); } @@ -2990,11 +2997,14 @@ mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass, Mono MonoType* mono_reflection_type_get_type (MonoReflectionType *reftype) { + MonoType *result; + MONO_ENTER_GC_UNSAFE; g_assert (reftype); ERROR_DECL (error); - MonoType *result = mono_reflection_type_get_handle (reftype, error); + result = mono_reflection_type_get_handle (reftype, error); mono_error_assert_ok (error); + MONO_EXIT_GC_UNSAFE; return result; } diff --git a/mono/metadata/reflection.h b/mono/metadata/reflection.h index bcb4574cac..83bcfccd65 100644 --- a/mono/metadata/reflection.h +++ b/mono/metadata/reflection.h @@ -46,69 +46,70 @@ typedef enum { ResolveTokenError_Other } MonoResolveTokenError; -MONO_RT_EXTERNAL_ONLY -MONO_API int mono_reflection_parse_type (char *name, MonoTypeNameParse *info); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoType* mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, mono_bool ignorecase, mono_bool *type_resolve); +MONO_API MONO_RT_EXTERNAL_ONLY +int mono_reflection_parse_type (char *name, MonoTypeNameParse *info); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoType* mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, mono_bool ignorecase, mono_bool *type_resolve); MONO_API void mono_reflection_free_type_info (MonoTypeNameParse *info); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoType* mono_reflection_type_from_name (char *name, MonoImage *image); -MONO_RT_EXTERNAL_ONLY -MONO_API uint32_t mono_reflection_get_token (MonoObject *obj); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoType* mono_reflection_type_from_name (char *name, MonoImage *image); +MONO_API MONO_RT_EXTERNAL_ONLY +uint32_t mono_reflection_get_token (MonoObject *obj); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoReflectionAssembly* mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoReflectionModule* mono_module_get_object (MonoDomain *domain, MonoImage *image); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoReflectionModule* mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index); -MONO_API MonoReflectionType* mono_type_get_object (MonoDomain *domain, MonoType *type); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoReflectionMethod* mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoReflectionField* mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoReflectionEvent* mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoReflectionAssembly* mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoReflectionModule* mono_module_get_object (MonoDomain *domain, MonoImage *image); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoReflectionModule* mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoReflectionType* mono_type_get_object (MonoDomain *domain, MonoType *type); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoReflectionMethod* mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoReflectionField* mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoReflectionEvent* mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event); /* note: this one is slightly different: we keep the whole array of params in the cache */ -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArray* mono_param_get_objects (MonoDomain *domain, MonoMethod *method); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoReflectionMethodBody* mono_method_body_get_object (MonoDomain *domain, MonoMethod *method); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoArray* mono_param_get_objects (MonoDomain *domain, MonoMethod *method); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoReflectionMethodBody* mono_method_body_get_object (MonoDomain *domain, MonoMethod *method); MONO_API MonoObject *mono_get_dbnull_object (MonoDomain *domain); MONO_API MonoArray* mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass, MonoError *error); MONO_API MonoArray* mono_reflection_get_custom_attrs (MonoObject *obj); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArray* mono_reflection_get_custom_attrs_data (MonoObject *obj); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArray* mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoArray* mono_reflection_get_custom_attrs_data (MonoObject *obj); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoArray* mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoCustomAttrInfo* mono_reflection_get_custom_attrs_info (MonoObject *obj); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoArray* mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_index (MonoImage *image, uint32_t idx); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_method (MonoMethod *method); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_class (MonoClass *klass); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_assembly (MonoAssembly *assembly); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_event (MonoClass *klass, MonoEvent *event); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_field (MonoClass *klass, MonoClassField *field); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_param (MonoMethod *method, uint32_t param); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoCustomAttrInfo* mono_reflection_get_custom_attrs_info (MonoObject *obj); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoArray* mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoCustomAttrInfo* mono_custom_attrs_from_index (MonoImage *image, uint32_t idx); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoCustomAttrInfo* mono_custom_attrs_from_method (MonoMethod *method); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoCustomAttrInfo* mono_custom_attrs_from_class (MonoClass *klass); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoCustomAttrInfo* mono_custom_attrs_from_assembly (MonoAssembly *assembly); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoCustomAttrInfo* mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoCustomAttrInfo* mono_custom_attrs_from_event (MonoClass *klass, MonoEvent *event); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoCustomAttrInfo* mono_custom_attrs_from_field (MonoClass *klass, MonoClassField *field); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoCustomAttrInfo* mono_custom_attrs_from_param (MonoMethod *method, uint32_t param); MONO_API mono_bool mono_custom_attrs_has_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass); -MONO_RT_EXTERNAL_ONLY -MONO_API MonoObject* mono_custom_attrs_get_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoObject* mono_custom_attrs_get_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass); MONO_API void mono_custom_attrs_free (MonoCustomAttrInfo *ainfo); @@ -163,7 +164,8 @@ MONO_API MonoBoolean mono_declsec_get_method_action (MonoMethod *method, uint32_ MONO_API MonoBoolean mono_declsec_get_class_action (MonoClass *klass, uint32_t action, MonoDeclSecurityEntry *entry); MONO_API MonoBoolean mono_declsec_get_assembly_action (MonoAssembly *assembly, uint32_t action, MonoDeclSecurityEntry *entry); -MONO_API MonoType* mono_reflection_type_get_type (MonoReflectionType *reftype); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoType* mono_reflection_type_get_type (MonoReflectionType *reftype); MONO_API MonoAssembly* mono_reflection_assembly_get_assembly (MonoReflectionAssembly *refassembly); diff --git a/mono/metadata/remoting.c b/mono/metadata/remoting.c index da06c28f5a..609ebea100 100644 --- a/mono/metadata/remoting.c +++ b/mono/metadata/remoting.c @@ -167,6 +167,7 @@ mono_remoting_init (void) static void mono_remoting_marshal_init (void) { + ERROR_DECL (error); MonoClass *klass; static gboolean module_initialized = FALSE; @@ -179,27 +180,34 @@ mono_remoting_marshal_init (void) #ifndef DISABLE_JIT klass = mono_class_get_remoting_services_class (); - method_rs_serialize = mono_class_get_method_from_name (klass, "SerializeCallData", -1); + method_rs_serialize = mono_class_get_method_from_name_checked (klass, "SerializeCallData", -1, 0, error); + mono_error_assert_ok (error); g_assert (method_rs_serialize); - method_rs_deserialize = mono_class_get_method_from_name (klass, "DeserializeCallData", -1); + method_rs_deserialize = mono_class_get_method_from_name_checked (klass, "DeserializeCallData", -1, 0, error); + mono_error_assert_ok (error); g_assert (method_rs_deserialize); - method_rs_serialize_exc = mono_class_get_method_from_name (klass, "SerializeExceptionData", -1); + method_rs_serialize_exc = mono_class_get_method_from_name_checked (klass, "SerializeExceptionData", -1, 0, error); + mono_error_assert_ok (error); g_assert (method_rs_serialize_exc); klass = mono_defaults.real_proxy_class; - method_rs_appdomain_target = mono_class_get_method_from_name (klass, "GetAppDomainTarget", -1); + method_rs_appdomain_target = mono_class_get_method_from_name_checked (klass, "GetAppDomainTarget", -1, 0, error); + mono_error_assert_ok (error); g_assert (method_rs_appdomain_target); klass = mono_defaults.exception_class; - method_exc_fixexc = mono_class_get_method_from_name (klass, "FixRemotingException", -1); + method_exc_fixexc = mono_class_get_method_from_name_checked (klass, "FixRemotingException", -1, 0, error); + mono_error_assert_ok (error); g_assert (method_exc_fixexc); klass = mono_class_get_call_context_class (); - method_set_call_context = mono_class_get_method_from_name (klass, "SetCurrentCallContext", -1); + method_set_call_context = mono_class_get_method_from_name_checked (klass, "SetCurrentCallContext", -1, 0, error); + mono_error_assert_ok (error); g_assert (method_set_call_context); klass = mono_class_get_context_class (); - method_needs_context_sink = mono_class_get_method_from_name (klass, "get_NeedsContextSink", -1); + method_needs_context_sink = mono_class_get_method_from_name_checked (klass, "get_NeedsContextSink", -1, 0, error); + mono_error_assert_ok (error); g_assert (method_needs_context_sink); #endif @@ -1457,7 +1465,9 @@ mono_marshal_get_ldfld_wrapper (MonoType *type) #ifndef DISABLE_REMOTING if (!tp_load) { - tp_load = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "LoadRemoteFieldNew", -1); + ERROR_DECL (error); + tp_load = mono_class_get_method_from_name_checked (mono_defaults.transparent_proxy_class, "LoadRemoteFieldNew", -1, 0, error); + mono_error_assert_ok (error); g_assert (tp_load != NULL); } #endif @@ -1757,7 +1767,9 @@ mono_marshal_get_stfld_wrapper (MonoType *type) #ifndef DISABLE_REMOTING if (!tp_store) { - tp_store = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "StoreRemoteField", -1); + ERROR_DECL (error); + tp_store = mono_class_get_method_from_name_checked (mono_defaults.transparent_proxy_class, "StoreRemoteField", -1, 0, error); + mono_error_assert_ok (error); g_assert (tp_store != NULL); } #endif @@ -2053,7 +2065,7 @@ mono_marshal_xdomain_copy_value_handle (MonoObjectHandle val, MonoError *error) case MONO_TYPE_R4: case MONO_TYPE_R8: { uint32_t gchandle = mono_gchandle_from_handle (val, TRUE); - MonoObjectHandle res = MONO_HANDLE_NEW (MonoObject, mono_value_box_checked (domain, klass, ((char*)val) + sizeof(MonoObject), error)); /* FIXME use handles in mono_value_box_checked */ + MonoObjectHandle res = MONO_HANDLE_NEW (MonoObject, mono_value_box_checked (domain, klass, ((char*)MONO_HANDLE_RAW (val)) + sizeof(MonoObject), error)); /* FIXME use handles in mono_value_box_checked */ mono_gchandle_free (gchandle); goto_if_nok (error, leave); MONO_HANDLE_ASSIGN (result, res); diff --git a/mono/metadata/runtime.c b/mono/metadata/runtime.c index 188c1bc761..7eb839fbb0 100644 --- a/mono/metadata/runtime.c +++ b/mono/metadata/runtime.c @@ -59,7 +59,7 @@ fire_process_exit_event (MonoDomain *domain, gpointer user_data) gpointer pa [2]; MonoObject *delegate, *exc; - field = mono_class_get_field_from_name (mono_defaults.appdomain_class, "ProcessExit"); + field = mono_class_get_field_from_name_full (mono_defaults.appdomain_class, "ProcessExit", NULL); g_assert (field); delegate = *(MonoObject **)(((char *)domain->domain) + field->offset); diff --git a/mono/metadata/security-core-clr.h b/mono/metadata/security-core-clr.h index 04103412e4..f3718aff73 100644 --- a/mono/metadata/security-core-clr.h +++ b/mono/metadata/security-core-clr.h @@ -62,9 +62,9 @@ extern MonoSecurityCoreCLRLevel mono_security_core_clr_method_level (MonoMethod extern gboolean mono_security_core_clr_is_platform_image (MonoImage *image); extern gboolean mono_security_core_clr_determine_platform_image (MonoImage *image); -extern MONO_API gboolean mono_security_core_clr_require_elevated_permissions (void); +MONO_API gboolean mono_security_core_clr_require_elevated_permissions (void); -extern MONO_API void mono_security_core_clr_set_options (MonoSecurityCoreCLROptions options); -extern MONO_API MonoSecurityCoreCLROptions mono_security_core_clr_get_options (void); +MONO_API void mono_security_core_clr_set_options (MonoSecurityCoreCLROptions options); +MONO_API MonoSecurityCoreCLROptions mono_security_core_clr_get_options (void); #endif /* _MONO_METADATA_SECURITY_CORE_CLR_H_ */ diff --git a/mono/metadata/security-manager.c b/mono/metadata/security-manager.c index 64d03261dd..2818261b67 100644 --- a/mono/metadata/security-manager.c +++ b/mono/metadata/security-manager.c @@ -102,8 +102,10 @@ mono_get_context_capture_method (void) /* older corlib revisions won't have the class (nor the method) */ MonoClass *execution_context = mono_class_try_get_execution_context_class (); if (execution_context && !method) { + ERROR_DECL (error); mono_class_init (execution_context); - method = mono_class_get_method_from_name (execution_context, "Capture", 0); + method = mono_class_get_method_from_name_checked (execution_context, "Capture", 0, 0, error); + mono_error_assert_ok (error); } return method; diff --git a/mono/metadata/security-manager.h b/mono/metadata/security-manager.h index d9f49ceb51..e389769ac1 100644 --- a/mono/metadata/security-manager.h +++ b/mono/metadata/security-manager.h @@ -23,7 +23,7 @@ #include "image.h" #include "reflection.h" #include "tabledefs.h" - +#include /* Definitions */ @@ -61,7 +61,10 @@ void mono_security_set_mode (MonoSecurityMode mode); MonoSecurityMode mono_security_get_mode (void); /* internal calls */ +ICALL_EXPORT MonoBoolean ves_icall_System_Security_SecurityManager_get_SecurityEnabled (void); + +ICALL_EXPORT void ves_icall_System_Security_SecurityManager_set_SecurityEnabled (MonoBoolean value); #ifndef DISABLE_SECURITY diff --git a/mono/metadata/security.h b/mono/metadata/security.h index 4d64d670d2..28f268eeef 100644 --- a/mono/metadata/security.h +++ b/mono/metadata/security.h @@ -18,48 +18,95 @@ #include #include #include +#include G_BEGIN_DECLS /* System.Environment */ -extern MonoStringHandle ves_icall_System_Environment_get_UserName (MonoError *error); +ICALL_EXPORT +MonoStringHandle +ves_icall_System_Environment_get_UserName (MonoError *error); /* System.Security.Principal.WindowsIdentity */ -gpointer mono_security_principal_windows_identity_get_current_token (void); -extern MonoArray* ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token); -extern gpointer ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error); -extern MonoStringHandle ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token, MonoError *error); -extern gpointer ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoStringHandle username, MonoError *error); +gpointer +mono_security_principal_windows_identity_get_current_token (MonoError *error); +MonoArray* +ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token); + +gpointer +ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error); + +MonoStringHandle +ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token, MonoError *error); + +gpointer +ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoStringHandle username, MonoError *error); + +MonoArray* +ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token); + +gpointer +ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (MonoError *error); + +MonoStringHandle +ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token, MonoError *error); + +gpointer +ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoStringHandle username, MonoError *error); /* System.Security.Principal.WindowsImpersonationContext */ -extern gboolean ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token); -extern gpointer ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token); -extern gboolean ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token); -extern gboolean ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void); +gboolean +ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token, MonoError *error); + +gpointer +ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token, MonoError *error); + +gboolean +ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token, MonoError *error); + +gboolean +ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (MonoError *error); /* System.Security.Principal.WindowsPrincipal */ -extern gboolean ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group); -extern gboolean ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, MonoString *group); +gboolean +ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group, MonoError *error); +gboolean +ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, const gchar *group, MonoError *error); /* Mono.Security.Cryptography.KeyPairPersistance */ -extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (MonoString *root); -extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (MonoString *path); -extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (MonoString *path); -extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (MonoString *path); -extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (MonoString *path); +MonoBoolean +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (const gunichar2 *root, MonoError *error); + +MonoBoolean +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (const gunichar2 *path, MonoError *error); + +MonoBoolean +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (const gunichar2 *path, MonoError *error); + +MonoBoolean +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (const gunichar2 *path, MonoError *error); + +MonoBoolean +ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (const gunichar2 *path, MonoError *error); /* System.Security.Policy.Evidence */ -MonoBoolean ves_icall_System_Security_Policy_Evidence_IsAuthenticodePresent (MonoReflectionAssemblyHandle refass, MonoError *error); +MonoBoolean +ves_icall_System_Security_Policy_Evidence_IsAuthenticodePresent (MonoReflectionAssemblyHandle refass, MonoError *error); /* System.Security.SecureString */ -extern void ves_icall_System_Security_SecureString_DecryptInternal (MonoArray *data, MonoObject *scope); -extern void ves_icall_System_Security_SecureString_EncryptInternal (MonoArray *data, MonoObject *scope); -void mono_invoke_protected_memory_method (MonoArray *data, MonoObject *scope, gboolean encrypt, MonoError *error); +void +ves_icall_System_Security_SecureString_DecryptInternal (MonoArray *data, MonoObject *scope); + +void +ves_icall_System_Security_SecureString_EncryptInternal (MonoArray *data, MonoObject *scope); + +void +mono_invoke_protected_memory_method (MonoArray *data, MonoObject *scope, gboolean encrypt, MonoError *error); G_END_DECLS diff --git a/mono/metadata/sgen-bridge.c b/mono/metadata/sgen-bridge.c index 4d51102ea6..b3d05f94e4 100644 --- a/mono/metadata/sgen-bridge.c +++ b/mono/metadata/sgen-bridge.c @@ -583,7 +583,7 @@ bridge_test_cross_reference2 (int num_sccs, MonoGCBridgeSCC **sccs, int num_xref gboolean modified; if (!mono_bridge_test_field) { - mono_bridge_test_field = mono_class_get_field_from_name (mono_object_get_class (sccs[0]->objs [0]), "__test"); + mono_bridge_test_field = mono_class_get_field_from_name_full (mono_object_get_class (sccs[0]->objs [0]), "__test", NULL); g_assert (mono_bridge_test_field); } @@ -633,7 +633,7 @@ bridge_test_positive_status (int num_sccs, MonoGCBridgeSCC **sccs, int num_xrefs int i; if (!mono_bridge_test_field) { - mono_bridge_test_field = mono_class_get_field_from_name (mono_object_get_class (sccs[0]->objs [0]), "__test"); + mono_bridge_test_field = mono_class_get_field_from_name_full (mono_object_get_class (sccs[0]->objs [0]), "__test", NULL); g_assert (mono_bridge_test_field); } diff --git a/mono/metadata/sgen-client-mono.h b/mono/metadata/sgen-client-mono.h index 0de2fa83e5..3ed143fd1d 100644 --- a/mono/metadata/sgen-client-mono.h +++ b/mono/metadata/sgen-client-mono.h @@ -379,18 +379,18 @@ static void mono_binary_protocol_alloc_generic (gpointer obj, gpointer vtable, size_t size, gboolean pinned) { #ifdef ENABLE_DTRACE - const char *namespace = sgen_client_vtable_get_namespace (vtable); + const char *name_space = sgen_client_vtable_get_namespace (vtable); const char *name = sgen_client_vtable_get_name (vtable); if (sgen_ptr_in_nursery (obj)) { if (G_UNLIKELY (MONO_GC_NURSERY_OBJ_ALLOC_ENABLED ())) - MONO_GC_NURSERY_OBJ_ALLOC ((mword)obj, size, namespace, name); + MONO_GC_NURSERY_OBJ_ALLOC ((mword)obj, size, name_space, name); } else { if (size > SGEN_MAX_SMALL_OBJ_SIZE) { if (G_UNLIKELY (MONO_GC_MAJOR_OBJ_ALLOC_LARGE_ENABLED ())) - MONO_GC_MAJOR_OBJ_ALLOC_LARGE ((mword)obj, size, namespace, name); + MONO_GC_MAJOR_OBJ_ALLOC_LARGE ((mword)obj, size, name_space, name); } else if (pinned) { - MONO_GC_MAJOR_OBJ_ALLOC_PINNED ((mword)obj, size, namespace, name); + MONO_GC_MAJOR_OBJ_ALLOC_PINNED ((mword)obj, size, name_space, name); } } #endif diff --git a/mono/metadata/sgen-mono-ilgen.c b/mono/metadata/sgen-mono-ilgen.c index f93f34bff2..4ab3c651bb 100644 --- a/mono/metadata/sgen-mono-ilgen.c +++ b/mono/metadata/sgen-mono-ilgen.c @@ -144,8 +144,8 @@ emit_nursery_check_ilgen (MonoMethodBuilder *mb, gboolean is_concurrent) mono_mb_emit_icon (mb, CARD_BITS); mono_mb_emit_byte (mb, CEE_SHR_UN); mono_mb_emit_byte (mb, CEE_CONV_I); -#ifdef SGEN_HAVE_OVERLAPPING_CARDS -#if SIZEOF_VOID_P == 8 +#ifdef SGEN_TARGET_HAVE_OVERLAPPING_CARDS +#if TARGET_SIZEOF_VOID_P == 8 mono_mb_emit_icon8 (mb, CARD_MASK); #else mono_mb_emit_icon (mb, CARD_MASK); @@ -226,6 +226,7 @@ emit_managed_allocater_ilgen (MonoMethodBuilder *mb, gboolean slowpath, gboolean mono_mb_emit_byte (mb, CEE_CONV_I); mono_mb_emit_stloc (mb, size_var); } else if (atype == ATYPE_VECTOR) { + ERROR_DECL (error); MonoExceptionClause *clause; int pos, pos_leave, pos_error; MonoClass *oom_exc_class; @@ -286,7 +287,8 @@ emit_managed_allocater_ilgen (MonoMethodBuilder *mb, gboolean slowpath, gboolean oom_exc_class = mono_class_load_from_name (mono_defaults.corlib, "System", "OutOfMemoryException"); - ctor = mono_class_get_method_from_name (oom_exc_class, ".ctor", 0); + ctor = mono_class_get_method_from_name_checked (oom_exc_class, ".ctor", 0, 0, error); + mono_error_assert_ok (error); g_assert (ctor); mono_mb_emit_byte (mb, CEE_POP); diff --git a/mono/metadata/sgen-mono.c b/mono/metadata/sgen-mono.c index 45c6b3dc7f..c6f95cc355 100644 --- a/mono/metadata/sgen-mono.c +++ b/mono/metadata/sgen-mono.c @@ -30,6 +30,7 @@ #include "metadata/sgen-mono-ilgen.h" #include "metadata/gc-internals.h" #include "metadata/handle.h" +#include "metadata/abi-details.h" #include "utils/mono-memory-model.h" #include "utils/mono-logger-internals.h" #include "utils/mono-threads-coop.h" @@ -118,7 +119,7 @@ mono_gc_wbarrier_value_copy (gpointer dest, gpointer src, int count, MonoClass * int i; for (i = 0; i < count; ++i) { scan_object_for_binary_protocol_copy_wbarrier ((char*)dest + i * element_size, - (char*)src + i * element_size - sizeof (MonoObject), + (char*)src + i * element_size - MONO_ABI_SIZEOF (MonoObject), (mword) klass->gc_descr); } } @@ -142,8 +143,8 @@ mono_gc_wbarrier_object_copy (MonoObject* obj, MonoObject *src) SGEN_ASSERT (6, !ptr_on_stack (obj), "Why is this called for a non-reference type?"); if (sgen_ptr_in_nursery (obj) || !SGEN_OBJECT_HAS_REFERENCES (src)) { size = m_class_get_instance_size (mono_object_class (obj)); - mono_gc_memmove_aligned ((char*)obj + sizeof (MonoObject), (char*)src + sizeof (MonoObject), - size - sizeof (MonoObject)); + mono_gc_memmove_aligned ((char*)obj + MONO_ABI_SIZEOF (MonoObject), (char*)src + MONO_ABI_SIZEOF (MonoObject), + size - MONO_ABI_SIZEOF (MonoObject)); return; } @@ -348,7 +349,7 @@ get_array_fill_vtable (void) vtable->klass = klass; bmap = 0; - vtable->gc_descr = mono_gc_make_descr_for_array (TRUE, &bmap, 0, 1); + vtable->gc_descr = mono_gc_make_descr_for_array (TRUE, &bmap, 0, 8); vtable->rank = 1; array_fill_vtable = vtable; @@ -371,7 +372,9 @@ sgen_client_array_fill_range (char *start, size_t size) /* Mark this as not a real object */ o->obj.synchronisation = (MonoThreadsSync *)GINT_TO_POINTER (-1); o->bounds = NULL; - o->max_length = (mono_array_size_t)(size - MONO_SIZEOF_MONO_ARRAY); + /* We use array of int64 */ + g_assert ((size - MONO_SIZEOF_MONO_ARRAY) % 8 == 0); + o->max_length = (mono_array_size_t)((size - MONO_SIZEOF_MONO_ARRAY) / 8); return TRUE; } @@ -1622,11 +1625,11 @@ report_handle_stack_root (gpointer *ptr, gpointer user_data) static void report_handle_stack_roots (GCRootReport *report, SgenThreadInfo *info, gboolean precise) { - ReportHandleStackRoot ud = { - .precise = precise, - .report = report, - .info = info, - }; + ReportHandleStackRoot ud; + memset (&ud, 0, sizeof (ud)); + ud.precise = precise; + ud.report = report; + ud.info = info; mono_handle_stack_scan ((HandleStack *) info->client_info.info.handle_stack, report_handle_stack_root, &ud, ud.precise, FALSE); } @@ -2246,9 +2249,10 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p if (precise) mono_handle_stack_scan ((HandleStack*)info->client_info.info.handle_stack, (GcScanFunc)ctx.ops->copy_or_mark_object, ctx.queue, precise, TRUE); else { - PinHandleStackInteriorPtrData ud = { .start_nursery = start_nursery, - .end_nursery = end_nursery, - }; + PinHandleStackInteriorPtrData ud; + memset (&ud, 0, sizeof (ud)); + ud.start_nursery = (void**)start_nursery; + ud.end_nursery = (void**)end_nursery; mono_handle_stack_scan ((HandleStack*)info->client_info.info.handle_stack, pin_handle_stack_interior_ptrs, &ud, precise, FALSE); } } @@ -2307,9 +2311,11 @@ mono_gc_pthread_create (pthread_t *new_thread, const pthread_attr_t *attr, void { int res; + MONO_ENTER_GC_SAFE; mono_threads_join_lock (); res = pthread_create (new_thread, attr, start_routine, arg); mono_threads_join_unlock (); + MONO_EXIT_GC_SAFE; return res; } @@ -2420,7 +2426,9 @@ mono_gc_precise_stack_mark_enabled (void) void mono_gc_collect (int generation) { + MONO_ENTER_GC_UNSAFE; sgen_gc_collect (generation); + MONO_EXIT_GC_UNSAFE; } int @@ -2679,6 +2687,12 @@ mono_gc_get_card_table (int *shift_bits, gpointer *mask) return sgen_get_card_table_configuration (shift_bits, mask); } +guint8* +mono_gc_get_target_card_table (int *shift_bits, gpointer *mask) +{ + return sgen_get_target_card_table_configuration (shift_bits, mask); +} + gboolean mono_gc_card_table_nursery_check (void) { diff --git a/mono/metadata/sgen-stw.c b/mono/metadata/sgen-stw.c index 7e4cf767ad..2af66e00b0 100644 --- a/mono/metadata/sgen-stw.c +++ b/mono/metadata/sgen-stw.c @@ -256,23 +256,49 @@ sgen_unified_suspend_stop_world (void) mono_threads_begin_global_suspend (); THREADS_STW_DEBUG ("[GC-STW-BEGIN][%p] *** BEGIN SUSPEND *** \n", mono_thread_info_get_tid (mono_thread_info_current ())); - FOREACH_THREAD_EXCLUDE (info, MONO_THREAD_INFO_FLAGS_NO_GC) { - info->client_info.skip = FALSE; - info->client_info.suspend_done = FALSE; + for (MonoThreadSuspendPhase phase = MONO_THREAD_SUSPEND_PHASE_INITIAL; phase < MONO_THREAD_SUSPEND_PHASE_COUNT; phase++) { + gboolean need_next_phase = FALSE; + FOREACH_THREAD_EXCLUDE (info, MONO_THREAD_INFO_FLAGS_NO_GC) { + /* look at every thread in the first phase. */ + if (phase == MONO_THREAD_SUSPEND_PHASE_INITIAL) { + info->client_info.skip = FALSE; + info->client_info.suspend_done = FALSE; + } else { + /* skip threads suspended by previous phase. */ + /* threads with info->client_info->skip set to TRUE will be skipped by sgen_is_thread_in_current_stw. */ + if (info->client_info.suspend_done) + continue; + } - int reason; - if (!sgen_is_thread_in_current_stw (info, &reason)) { - THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND] IGNORE thread %p skip %s reason %d\n", mono_thread_info_get_tid (info), info->client_info.skip ? "true" : "false", reason); - continue; - } + int reason; + if (!sgen_is_thread_in_current_stw (info, &reason)) { + THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND-%d] IGNORE thread %p skip %s reason %d\n", (int)phase, mono_thread_info_get_tid (info), info->client_info.skip ? "true" : "false", reason); + continue; + } - info->client_info.skip = !mono_thread_info_begin_suspend (info); + switch (mono_thread_info_begin_suspend (info, phase)) { + case MONO_THREAD_BEGIN_SUSPEND_SUSPENDED: + info->client_info.skip = FALSE; + break; + case MONO_THREAD_BEGIN_SUSPEND_SKIP: + info->client_info.skip = TRUE; + break; + case MONO_THREAD_BEGIN_SUSPEND_NEXT_PHASE: + need_next_phase = TRUE; + break; + default: + g_assert_not_reached (); + } - THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND] SUSPEND thread %p skip %s\n", mono_thread_info_get_tid (info), info->client_info.skip ? "true" : "false"); - } FOREACH_THREAD_END + THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND-%d] SUSPEND thread %p skip %s\n", (int)phase, mono_thread_info_get_tid (info), info->client_info.skip ? "true" : "false"); + } FOREACH_THREAD_END; - mono_thread_info_current ()->client_info.suspend_done = TRUE; - mono_threads_wait_pending_operations (); + mono_thread_info_current ()->client_info.suspend_done = TRUE; + mono_threads_wait_pending_operations (); + + if (!need_next_phase) + break; + } for (;;) { gint restart_counter = 0; @@ -335,7 +361,18 @@ sgen_unified_suspend_stop_world (void) continue; } - info->client_info.skip = !mono_thread_info_begin_suspend (info); + switch (mono_thread_info_begin_suspend (info, MONO_THREAD_SUSPEND_PHASE_MOPUP)) { + case MONO_THREAD_BEGIN_SUSPEND_SUSPENDED: + info->client_info.skip = FALSE; + break; + case MONO_THREAD_BEGIN_SUSPEND_SKIP: + info->client_info.skip = TRUE; + break; + case MONO_THREAD_BEGIN_SUSPEND_NEXT_PHASE: + g_assert_not_reached (); + default: + g_assert_not_reached (); + } THREADS_STW_DEBUG ("[GC-STW-RESTART] SUSPEND thread %p skip %s\n", mono_thread_info_get_tid (info), info->client_info.skip ? "true" : "false"); } FOREACH_THREAD_END diff --git a/mono/metadata/sgen-tarjan-bridge.c b/mono/metadata/sgen-tarjan-bridge.c index 6cf7ce50b1..a67bb499ef 100644 --- a/mono/metadata/sgen-tarjan-bridge.c +++ b/mono/metadata/sgen-tarjan-bridge.c @@ -1137,7 +1137,7 @@ processing_build_callback_data (int generation) } } - g_assert (xref_count == xref_index); + g_assertf (xref_count == xref_index, "xref_count is %d but we added %d xrefs", xref_count, xref_index); xref_setup_time = step_timer (&curtime); #if defined (DUMP_GRAPH) diff --git a/mono/metadata/sgen-toggleref.c b/mono/metadata/sgen-toggleref.c index 1f4e1c64db..936ac54c31 100644 --- a/mono/metadata/sgen-toggleref.c +++ b/mono/metadata/sgen-toggleref.c @@ -203,11 +203,12 @@ test_toggleref_callback (MonoObject *obj) MonoToggleRefStatus status = MONO_TOGGLE_REF_DROP; if (!mono_toggleref_test_field) { - mono_toggleref_test_field = mono_class_get_field_from_name (mono_object_get_class (obj), "__test"); + mono_toggleref_test_field = mono_class_get_field_from_name_full (mono_object_get_class (obj), "__test", NULL); g_assert (mono_toggleref_test_field); } - mono_field_get_value (obj, mono_toggleref_test_field, &status); + /* In coop mode, important to not call a helper that will pin obj! */ + mono_field_get_value_internal (obj, mono_toggleref_test_field, &status); printf ("toggleref-cb obj %d\n", status); return status; } diff --git a/mono/metadata/sre-encode.c b/mono/metadata/sre-encode.c index 420e611c49..b1aef64c23 100644 --- a/mono/metadata/sre-encode.c +++ b/mono/metadata/sre-encode.c @@ -239,7 +239,7 @@ encode_reflection_type (MonoDynamicImage *assembly, MonoReflectionTypeHandle typ error_init (error); - if (!type) { + if (MONO_HANDLE_IS_NULL (type)) { sigbuffer_add_value (buf, MONO_TYPE_VOID); return; } @@ -529,7 +529,7 @@ mono_dynimage_encode_constant (MonoDynamicImage *assembly, MonoObject *val, Mono len = 4; box_val = (char*)&dummy; } else { - box_val = ((char*)val) + sizeof (MonoObject); + box_val = mono_object_get_data (val); *ret_type = m_class_get_byval_arg (val->vtable->klass)->type; } handle_enum: diff --git a/mono/metadata/sre-save.c.REMOVED.git-id b/mono/metadata/sre-save.c.REMOVED.git-id index 049e2afab3..801e242260 100644 --- a/mono/metadata/sre-save.c.REMOVED.git-id +++ b/mono/metadata/sre-save.c.REMOVED.git-id @@ -1 +1 @@ -fea48cf8c7bc5fa4f359239c84d890797a2e36cb \ No newline at end of file +d56a4c56da6d95959efdfd1c2892411b6924e2b5 \ No newline at end of file diff --git a/mono/metadata/sre.c.REMOVED.git-id b/mono/metadata/sre.c.REMOVED.git-id index 389158023c..8198e42c13 100644 --- a/mono/metadata/sre.c.REMOVED.git-id +++ b/mono/metadata/sre.c.REMOVED.git-id @@ -1 +1 @@ -b66a93b6156c318968e9f52434a5b78e9ab1b5de \ No newline at end of file +cf0f2b72994b27812e93ff84a7d58af092888200 \ No newline at end of file diff --git a/mono/metadata/string-icalls.h b/mono/metadata/string-icalls.h index 84be0998e0..ea9a7329fc 100644 --- a/mono/metadata/string-icalls.h +++ b/mono/metadata/string-icalls.h @@ -18,19 +18,25 @@ #include #include #include "mono/utils/mono-compiler.h" +#include +ICALL_EXPORT void ves_icall_System_String_ctor_RedirectToCreateString (void); +ICALL_EXPORT MonoString * ves_icall_System_String_InternalAllocateStr (gint32 length); +ICALL_EXPORT MonoString * ves_icall_System_String_InternalIntern (MonoString *str); +ICALL_EXPORT MonoString * ves_icall_System_String_InternalIsInterned (MonoString *str); +ICALL_EXPORT int ves_icall_System_String_GetLOSLimit (void); diff --git a/mono/metadata/sysmath.c b/mono/metadata/sysmath.c index 8b8f7e00d0..157de9c197 100644 --- a/mono/metadata/sysmath.c +++ b/mono/metadata/sysmath.c @@ -30,19 +30,19 @@ #include "number-ms.h" #include "utils/mono-compiler.h" -static const MonoDouble_double NaN = { .s = { .sign = 0x0, .exp = 0x7FF, .mantHi = 0x80000, .mantLo = 0x0 } }; +static const MonoDouble_double NaN = { MONO_INIT_DOUBLE (0, 0x7FF, 0x80000, 0) }; /* +Infinity */ -static const MonoDouble_double PInfinity = { .s = { .sign = 0x0, .exp = 0x7FF, .mantHi = 0x0, .mantLo = 0x0 } }; +static const MonoDouble_double PInfinity = { MONO_INIT_DOUBLE (0, 0x7FF, 0, 0) }; /* -Infinity */ -static const MonoDouble_double MInfinity = { .s = { .sign = 0x1, .exp = 0x7FF, .mantHi = 0x0, .mantLo = 0x0 } }; +static const MonoDouble_double MInfinity = { MONO_INIT_DOUBLE (1, 0x7FF, 0, 0) }; /* +1 */ -static const MonoDouble_double POne = { .s = { .sign = 0x0, .exp = 0x3FF, .mantHi = 0x0, .mantLo = 0x0 } }; +static const MonoDouble_double POne = { MONO_INIT_DOUBLE (0, 0x3FF, 0, 0) }; /* -1 */ -static const MonoDouble_double MOne = { .s = { .sign = 0x1, .exp = 0x3FF, .mantHi = 0x0, .mantLo = 0x0 } }; +static const MonoDouble_double MOne = { MONO_INIT_DOUBLE (1, 0x3FF, 0, 0) }; static MONO_ALWAYS_INLINE gboolean isplusinfinity (gdouble d) diff --git a/mono/metadata/sysmath.h b/mono/metadata/sysmath.h index 627a5cef08..e8f19a2311 100644 --- a/mono/metadata/sysmath.h +++ b/mono/metadata/sysmath.h @@ -15,136 +15,181 @@ #include #include +#include +ICALL_EXPORT gdouble ves_icall_System_Math_Floor (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Round (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Sin (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Cos (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Tan (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Sinh (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Cosh (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Tanh (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Acos (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Asin (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Atan (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Atan2 (gdouble y, gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Exp (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Log (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Log10 (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Pow (gdouble x, gdouble y); +ICALL_EXPORT gdouble ves_icall_System_Math_Sqrt (gdouble x); +ICALL_EXPORT gdouble ves_icall_System_Math_Abs_double (gdouble v); +ICALL_EXPORT gfloat ves_icall_System_Math_Abs_single (gfloat v); +ICALL_EXPORT gdouble ves_icall_System_Math_SplitFractionDouble (gdouble *v); +ICALL_EXPORT gdouble ves_icall_System_Math_Ceiling (gdouble v); +ICALL_EXPORT float ves_icall_System_MathF_Acos (float x); +ICALL_EXPORT float ves_icall_System_MathF_Acosh (float x); +ICALL_EXPORT float ves_icall_System_MathF_Asin (float x); +ICALL_EXPORT float ves_icall_System_MathF_Asinh (float x); +ICALL_EXPORT float ves_icall_System_MathF_Atan (float x); +ICALL_EXPORT float ves_icall_System_MathF_Atan2 (float x, float y); +ICALL_EXPORT float ves_icall_System_MathF_Atanh (float x); +ICALL_EXPORT float ves_icall_System_MathF_Cbrt (float x); +ICALL_EXPORT float ves_icall_System_MathF_Ceiling (float x); +ICALL_EXPORT float ves_icall_System_MathF_Cos (float x); +ICALL_EXPORT float ves_icall_System_MathF_Cosh (float x); +ICALL_EXPORT float ves_icall_System_MathF_Exp (float x); +ICALL_EXPORT float ves_icall_System_MathF_Floor (float x); +ICALL_EXPORT float ves_icall_System_MathF_Log (float x); +ICALL_EXPORT float ves_icall_System_MathF_Log10 (float x); +ICALL_EXPORT float ves_icall_System_MathF_Pow (float x, float y); +ICALL_EXPORT float ves_icall_System_MathF_Sin (float x); +ICALL_EXPORT float ves_icall_System_MathF_Sinh (float x); +ICALL_EXPORT float ves_icall_System_MathF_Sqrt (float x); +ICALL_EXPORT float ves_icall_System_MathF_Tan (float x); +ICALL_EXPORT float ves_icall_System_MathF_Tanh (float x); +ICALL_EXPORT float ves_icall_System_MathF_FMod (float x, float y); +ICALL_EXPORT float ves_icall_System_MathF_ModF (float x, float *d); diff --git a/mono/metadata/threadpool-io-epoll.c b/mono/metadata/threadpool-io-epoll.c index 40efee6b42..a1ca70ce39 100644 --- a/mono/metadata/threadpool-io-epoll.c +++ b/mono/metadata/threadpool-io-epoll.c @@ -123,10 +123,10 @@ epoll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), g } static ThreadPoolIOBackend backend_epoll = { - .init = epoll_init, - .register_fd = epoll_register_fd, - .remove_fd = epoll_remove_fd, - .event_wait = epoll_event_wait, + epoll_init, + epoll_register_fd, + epoll_remove_fd, + epoll_event_wait, }; #endif diff --git a/mono/metadata/threadpool-io-poll.c b/mono/metadata/threadpool-io-poll.c index e086835577..b3236b78de 100644 --- a/mono/metadata/threadpool-io-poll.c +++ b/mono/metadata/threadpool-io-poll.c @@ -213,8 +213,8 @@ poll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), gp } static ThreadPoolIOBackend backend_poll = { - .init = poll_init, - .register_fd = poll_register_fd, - .remove_fd = poll_remove_fd, - .event_wait = poll_event_wait, + poll_init, + poll_register_fd, + poll_remove_fd, + poll_event_wait, }; diff --git a/mono/metadata/threadpool-io.c b/mono/metadata/threadpool-io.c index adec9d2b96..eed6f2cba5 100644 --- a/mono/metadata/threadpool-io.c +++ b/mono/metadata/threadpool-io.c @@ -419,7 +419,10 @@ selector_thread (gpointer data) domain = update->data.remove_domain.domain; g_assert (domain); - FilterSockaresForDomainData user_data = { .domain = domain, .states = states }; + FilterSockaresForDomainData user_data; + memset (&user_data, 0, sizeof (user_data)); + user_data.domain = domain; + user_data.states = states; mono_g_hash_table_foreach (states, filter_jobs_for_domain, &user_data); for (j = i + 1; j < threadpool_io->updates_size; ++j) { diff --git a/mono/metadata/threadpool-io.h b/mono/metadata/threadpool-io.h index c3f62f049e..a71a9f8280 100644 --- a/mono/metadata/threadpool-io.h +++ b/mono/metadata/threadpool-io.h @@ -9,12 +9,15 @@ #include #include +#include typedef struct _MonoIOSelectorJob MonoIOSelectorJob; +ICALL_EXPORT void ves_icall_System_IOSelector_Add (gpointer handle, MonoIOSelectorJob *job); +ICALL_EXPORT void ves_icall_System_IOSelector_Remove (gpointer handle); diff --git a/mono/metadata/threadpool-worker-default.c b/mono/metadata/threadpool-worker-default.c index 33870a6de1..81e54bfc48 100644 --- a/mono/metadata/threadpool-worker-default.c +++ b/mono/metadata/threadpool-worker-default.c @@ -307,20 +307,20 @@ mono_threadpool_worker_cleanup (void) static void work_item_push (void) { - gint32 old, new; + gint32 old, new_; do { old = mono_atomic_load_i32 (&worker.work_items_count); g_assert (old >= 0); - new = old + 1; - } while (mono_atomic_cas_i32 (&worker.work_items_count, new, old) != old); + new_ = old + 1; + } while (mono_atomic_cas_i32 (&worker.work_items_count, new_, old) != old); } static gboolean work_item_try_pop (void) { - gint32 old, new; + gint32 old, new_; do { old = mono_atomic_load_i32 (&worker.work_items_count); @@ -329,8 +329,8 @@ work_item_try_pop (void) if (old == 0) return FALSE; - new = old - 1; - } while (mono_atomic_cas_i32 (&worker.work_items_count, new, old) != old); + new_ = old - 1; + } while (mono_atomic_cas_i32 (&worker.work_items_count, new_, old) != old); return TRUE; } @@ -362,7 +362,7 @@ worker_park (void) { gboolean timeout = FALSE; gboolean interrupted = FALSE; - gint32 old, new; + gint32 old, new_; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker parking", GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); @@ -385,8 +385,8 @@ worker_park (void) old = mono_atomic_load_i32 (&worker.parked_threads_count); g_assert (old >= G_MININT32); - new = old + 1; - } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old); + new_ = old + 1; + } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new_, old) != old); switch (mono_coop_sem_timedwait (&worker.parked_threads_sem, rand_next (&rand_handle, 5 * 1000, 60 * 1000), MONO_SEM_FLAGS_ALERTABLE)) { case MONO_SEM_TIMEDWAIT_RET_SUCCESS: @@ -407,8 +407,8 @@ worker_park (void) old = mono_atomic_load_i32 (&worker.parked_threads_count); g_assert (old > G_MININT32); - new = old - 1; - } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old); + new_ = old - 1; + } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new_, old) != old); } COUNTER_ATOMIC (counter, { @@ -427,7 +427,7 @@ static gboolean worker_try_unpark (void) { gboolean res = TRUE; - gint32 old, new; + gint32 old, new_; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker", GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); @@ -441,8 +441,8 @@ worker_try_unpark (void) break; } - new = old - 1; - } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old); + new_ = old - 1; + } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new_, old) != old); if (res) mono_coop_sem_post (&worker.parked_threads_sem); @@ -477,10 +477,17 @@ worker_thread (gpointer unused) if (mono_thread_interruption_checkpoint_bool ()) continue; - if (!work_item_try_pop ()) { - gboolean timeout; + // If a worker thread is in its native top, not running managed code, + // there is no point in raising thread abort, and no code will clear + // the abort request. As such, the subsequent timedwait, would + // not be interrupted at runtime shutdown, because an abort is already requested. + // Clear the abort request. + // This avoids a shutdown hang in tests thread6 and thread7. + if (thread->state & ThreadState_AbortRequested) + mono_thread_internal_reset_abort (thread); - timeout = worker_park (); + if (!work_item_try_pop ()) { + gboolean const timeout = worker_park (); if (timeout) break; @@ -651,9 +658,7 @@ monitor_sufficient_delay_since_last_dequeue (void) if (worker.cpu_usage < CPU_USAGE_LOW) { threshold = MONITOR_INTERVAL; } else { - ThreadPoolWorkerCounter counter; - counter = COUNTER_READ (); - threshold = counter._.max_working * MONITOR_INTERVAL * 2; + threshold = COUNTER_READ ()._.max_working * MONITOR_INTERVAL * 2; } return mono_msec_ticks () >= worker.heuristic_last_dequeue + threshold; @@ -1065,8 +1070,7 @@ static gboolean heuristic_should_adjust (void) { if (worker.heuristic_last_dequeue > worker.heuristic_last_adjustment + worker.heuristic_adjustment_interval) { - ThreadPoolWorkerCounter counter; - counter = COUNTER_READ (); + ThreadPoolWorkerCounter const counter = COUNTER_READ (); if (counter._.working <= counter._.max_working) return TRUE; } @@ -1083,11 +1087,9 @@ heuristic_adjust (void) gint64 sample_duration = sample_end - worker.heuristic_sample_start; if (sample_duration >= worker.heuristic_adjustment_interval / 2) { - ThreadPoolWorkerCounter counter; - gint16 new_thread_count; - counter = COUNTER_READ (); - new_thread_count = hill_climbing_update (counter._.max_working, sample_duration, completions, &worker.heuristic_adjustment_interval); + ThreadPoolWorkerCounter counter = COUNTER_READ (); + gint16 const new_thread_count = hill_climbing_update (counter._.max_working, sample_duration, completions, &worker.heuristic_adjustment_interval); COUNTER_ATOMIC (counter, { counter._.max_working = new_thread_count; @@ -1117,11 +1119,9 @@ heuristic_notify_work_completed (void) gboolean mono_threadpool_worker_notify_completed (void) { - ThreadPoolWorkerCounter counter; - heuristic_notify_work_completed (); - counter = COUNTER_READ (); + ThreadPoolWorkerCounter const counter = COUNTER_READ (); return counter._.working <= counter._.max_working; } diff --git a/mono/metadata/threadpool.c b/mono/metadata/threadpool.c index 0495a3ceba..d4459622b5 100644 --- a/mono/metadata/threadpool.c +++ b/mono/metadata/threadpool.c @@ -168,8 +168,10 @@ mono_threadpool_enqueue_work_item (MonoDomain *domain, MonoObject *work_item, Mo if (!threadpool_class) threadpool_class = mono_class_load_from_name (mono_defaults.corlib, "System.Threading", "ThreadPool"); - if (!unsafe_queue_custom_work_item_method) - unsafe_queue_custom_work_item_method = mono_class_get_method_from_name (threadpool_class, "UnsafeQueueCustomWorkItem", 2); + if (!unsafe_queue_custom_work_item_method) { + unsafe_queue_custom_work_item_method = mono_class_get_method_from_name_checked (threadpool_class, "UnsafeQueueCustomWorkItem", 2, 0, error); + mono_error_assert_ok (error); + } g_assert (unsafe_queue_custom_work_item_method); f = FALSE; diff --git a/mono/metadata/threadpool.h b/mono/metadata/threadpool.h index 912e033bda..c6e70f6670 100644 --- a/mono/metadata/threadpool.h +++ b/mono/metadata/threadpool.h @@ -10,6 +10,7 @@ #include #include +#include typedef struct _MonoNativeOverlapped MonoNativeOverlapped; @@ -29,35 +30,59 @@ mono_threadpool_suspend (void); void mono_threadpool_resume (void); +ICALL_EXPORT void ves_icall_System_Threading_ThreadPool_GetAvailableThreadsNative (gint32 *worker_threads, gint32 *completion_port_threads, MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_ThreadPool_GetMinThreadsNative (gint32 *worker_threads, gint32 *completion_port_threads, MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_ThreadPool_GetMaxThreadsNative (gint32 *worker_threads, gint32 *completion_port_threads, MonoError *error); + +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_ThreadPool_SetMinThreadsNative (gint32 worker_threads, gint32 completion_port_threads, MonoError *error); + +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_ThreadPool_SetMaxThreadsNative (gint32 worker_threads, gint32 completion_port_threads, MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_ThreadPool_InitializeVMTp (MonoBoolean *enable_worker_tracking, MonoError *error); + +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_ThreadPool_NotifyWorkItemComplete (MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_ThreadPool_NotifyWorkItemProgressNative (MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_ThreadPool_ReportThreadStatus (MonoBoolean is_working, MonoError *error); + +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_ThreadPool_RequestWorkerThread (MonoError *error); +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_ThreadPool_PostQueuedCompletionStatus (MonoNativeOverlapped *native_overlapped, MonoError *error); +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_ThreadPool_BindIOCompletionCallbackNative (gpointer file_handle, MonoError *error); +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_ThreadPool_IsThreadPoolHosted (MonoError *error); diff --git a/mono/metadata/threads-types.h b/mono/metadata/threads-types.h index 761f60429c..41e04881b6 100644 --- a/mono/metadata/threads-types.h +++ b/mono/metadata/threads-types.h @@ -21,6 +21,7 @@ #include "mono/utils/mono-membar.h" #include "mono/utils/mono-threads.h" #include "mono/metadata/class-internals.h" +#include /* This is a copy of System.Threading.ThreadState */ typedef enum { @@ -82,133 +83,280 @@ mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, Mo void mono_threads_install_cleanup (MonoThreadCleanupFunc func); +ICALL_EXPORT void ves_icall_System_Threading_Thread_ConstructInternalThread (MonoThreadObjectHandle this_obj, MonoError *error); +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_Thread_Thread_internal (MonoThreadObjectHandle this_obj, MonoObjectHandle start, MonoError *error); +ICALL_EXPORT void ves_icall_System_Threading_InternalThread_Thread_free_internal (MonoInternalThreadHandle this_obj, MonoError *error); +ICALL_EXPORT void ves_icall_System_Threading_Thread_Sleep_internal (gint32 ms, MonoError *error); +ICALL_EXPORT gboolean ves_icall_System_Threading_Thread_Join_internal (MonoThreadObjectHandle thread_handle, int ms, MonoError *error); +ICALL_EXPORT gint32 ves_icall_System_Threading_Thread_GetDomainID (MonoError *error); -gboolean -ves_icall_System_Threading_Thread_Yield (MonoError *error); - +ICALL_EXPORT MonoStringHandle ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThreadHandle this_obj, MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_SetName_internal (MonoInternalThread *this_obj, MonoString *name); + +ICALL_EXPORT int ves_icall_System_Threading_Thread_GetPriority (MonoThreadObjectHandle this_obj, MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_SetPriority (MonoThreadObjectHandle this_obj, int priority, MonoError *error); + +ICALL_EXPORT MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentCulture (MonoInternalThread *this_obj); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_SetCachedCurrentCulture (MonoThread *this_obj, MonoObject *culture); + +ICALL_EXPORT MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentUICulture (MonoInternalThread *this_obj); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_SetCachedCurrentUICulture (MonoThread *this_obj, MonoObject *culture); + +ICALL_EXPORT MonoThreadObjectHandle ves_icall_System_Threading_Thread_GetCurrentThread (MonoError *error); +ICALL_EXPORT gint32 ves_icall_System_Threading_WaitHandle_Wait_internal(gpointer *handles, gint32 numhandles, MonoBoolean waitall, gint32 ms, MonoError *error); + +ICALL_EXPORT gint32 ves_icall_System_Threading_WaitHandle_SignalAndWait_Internal (gpointer toSignal, gpointer toWait, gint32 ms, MonoError *error); +ICALL_EXPORT MonoArrayHandle ves_icall_System_Threading_Thread_ByteArrayToRootDomain (MonoArrayHandle arr, MonoError *error); + +ICALL_EXPORT MonoArrayHandle ves_icall_System_Threading_Thread_ByteArrayToCurrentDomain (MonoArrayHandle arr, MonoError *error); +ICALL_EXPORT gint32 ves_icall_System_Threading_Interlocked_Increment_Int(gint32 *location); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Interlocked_Increment_Long(gint64 *location); + +ICALL_EXPORT gint32 ves_icall_System_Threading_Interlocked_Decrement_Int(gint32 *location); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Interlocked_Decrement_Long(gint64 * location); +ICALL_EXPORT gint32 ves_icall_System_Threading_Interlocked_Exchange_Int(gint32 *location, gint32 value); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Interlocked_Exchange_Long(gint64 *location, gint64 value); + +ICALL_EXPORT MonoObject *ves_icall_System_Threading_Interlocked_Exchange_Object(MonoObject **location, MonoObject *value); + +ICALL_EXPORT gpointer ves_icall_System_Threading_Interlocked_Exchange_IntPtr(gpointer *location, gpointer value); + +ICALL_EXPORT gfloat ves_icall_System_Threading_Interlocked_Exchange_Single(gfloat *location, gfloat value); + +ICALL_EXPORT gdouble ves_icall_System_Threading_Interlocked_Exchange_Double(gdouble *location, gdouble value); +ICALL_EXPORT gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int(gint32 *location, gint32 value, gint32 comparand); + +ICALL_EXPORT gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int_Success(gint32 *location, gint32 value, gint32 comparand, MonoBoolean *success); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Interlocked_CompareExchange_Long(gint64 *location, gint64 value, gint64 comparand); + +ICALL_EXPORT MonoObject *ves_icall_System_Threading_Interlocked_CompareExchange_Object(MonoObject **location, MonoObject *value, MonoObject *comparand); + +ICALL_EXPORT gpointer ves_icall_System_Threading_Interlocked_CompareExchange_IntPtr(gpointer *location, gpointer value, gpointer comparand); + +ICALL_EXPORT gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single(gfloat *location, gfloat value, gfloat comparand); + +ICALL_EXPORT gdouble ves_icall_System_Threading_Interlocked_CompareExchange_Double(gdouble *location, gdouble value, gdouble comparand); + +ICALL_EXPORT MonoObject* ves_icall_System_Threading_Interlocked_CompareExchange_T(MonoObject **location, MonoObject *value, MonoObject *comparand); + +ICALL_EXPORT MonoObject* ves_icall_System_Threading_Interlocked_Exchange_T(MonoObject **location, MonoObject *value); +ICALL_EXPORT gint32 ves_icall_System_Threading_Interlocked_Add_Int(gint32 *location, gint32 value); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Interlocked_Add_Long(gint64 *location, gint64 value); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Interlocked_Read_Long(gint64 *location); +ICALL_EXPORT gint32 ves_icall_System_Threading_Interlocked_Increment_Int(gint32 *location); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Interlocked_Increment_Long(gint64 *location); +ICALL_EXPORT gint32 ves_icall_System_Threading_Interlocked_Decrement_Int(gint32 *location); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Interlocked_Decrement_Long(gint64 * location); +ICALL_EXPORT void ves_icall_System_Threading_Thread_Abort (MonoInternalThreadHandle thread_handle, MonoObjectHandle state, MonoError *error); +ICALL_EXPORT void ves_icall_System_Threading_Thread_ResetAbort (MonoThreadObjectHandle this_obj, MonoError *error); -MonoObject* ves_icall_System_Threading_Thread_GetAbortExceptionState (MonoThread *thread); +ICALL_EXPORT +MonoObjectHandle +ves_icall_System_Threading_Thread_GetAbortExceptionState (MonoThreadObjectHandle thread, MonoError *error); +ICALL_EXPORT void ves_icall_System_Threading_Thread_Suspend (MonoThreadObjectHandle this_obj, MonoError *error); +ICALL_EXPORT void ves_icall_System_Threading_Thread_Resume (MonoThreadObjectHandle thread_handle, MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_ClrState (MonoInternalThreadHandle thread, guint32 state, MonoError *error); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_SetState (MonoInternalThreadHandle thread_handle, guint32 state, MonoError *error); + +ICALL_EXPORT guint32 ves_icall_System_Threading_Thread_GetState (MonoInternalThreadHandle thread_handle, MonoError *error); +ICALL_EXPORT gint8 ves_icall_System_Threading_Thread_VolatileRead1 (void *ptr); + +ICALL_EXPORT gint16 ves_icall_System_Threading_Thread_VolatileRead2 (void *ptr); + +ICALL_EXPORT gint32 ves_icall_System_Threading_Thread_VolatileRead4 (void *ptr); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Thread_VolatileRead8 (void *ptr); + +ICALL_EXPORT void * ves_icall_System_Threading_Thread_VolatileReadIntPtr (void *ptr); + +ICALL_EXPORT void * ves_icall_System_Threading_Thread_VolatileReadObject (void *ptr); + +ICALL_EXPORT double ves_icall_System_Threading_Thread_VolatileReadDouble (void *ptr); + +ICALL_EXPORT float ves_icall_System_Threading_Thread_VolatileReadFloat (void *ptr); +ICALL_EXPORT void ves_icall_System_Threading_Thread_VolatileWrite1 (void *ptr, gint8); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_VolatileWrite2 (void *ptr, gint16); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_VolatileWrite4 (void *ptr, gint32); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_VolatileWrite8 (void *ptr, gint64); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_VolatileWriteIntPtr (void *ptr, void *); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_VolatileWriteObject (void *ptr, MonoObject *); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_VolatileWriteFloat (void *ptr, float); + +ICALL_EXPORT void ves_icall_System_Threading_Thread_VolatileWriteDouble (void *ptr, double); +ICALL_EXPORT gint8 ves_icall_System_Threading_Volatile_Read1 (void *ptr); + +ICALL_EXPORT gint16 ves_icall_System_Threading_Volatile_Read2 (void *ptr); + +ICALL_EXPORT gint32 ves_icall_System_Threading_Volatile_Read4 (void *ptr); + +ICALL_EXPORT gint64 ves_icall_System_Threading_Volatile_Read8 (void *ptr); + +ICALL_EXPORT void * ves_icall_System_Threading_Volatile_ReadIntPtr (void *ptr); + +ICALL_EXPORT double ves_icall_System_Threading_Volatile_ReadDouble (void *ptr); + +ICALL_EXPORT float ves_icall_System_Threading_Volatile_ReadFloat (void *ptr); + +ICALL_EXPORT MonoObject* ves_icall_System_Threading_Volatile_Read_T (void *ptr); +ICALL_EXPORT void ves_icall_System_Threading_Volatile_Write1 (void *ptr, gint8); + +ICALL_EXPORT void ves_icall_System_Threading_Volatile_Write2 (void *ptr, gint16); + +ICALL_EXPORT void ves_icall_System_Threading_Volatile_Write4 (void *ptr, gint32); + +ICALL_EXPORT void ves_icall_System_Threading_Volatile_Write8 (void *ptr, gint64); + +ICALL_EXPORT void ves_icall_System_Threading_Volatile_WriteIntPtr (void *ptr, void *); + +ICALL_EXPORT void ves_icall_System_Threading_Volatile_WriteFloat (void *ptr, float); + +ICALL_EXPORT void ves_icall_System_Threading_Volatile_WriteDouble (void *ptr, double); + +ICALL_EXPORT void ves_icall_System_Threading_Volatile_Write_T (void *ptr, MonoObject *value); +ICALL_EXPORT void ves_icall_System_Threading_Thread_MemoryBarrier (void); +ICALL_EXPORT void ves_icall_System_Threading_Thread_Interrupt_internal (MonoThreadObjectHandle thread_handle, MonoError *error); +ICALL_EXPORT void ves_icall_System_Threading_Thread_SpinWait_nop (MonoError *error); @@ -217,7 +365,10 @@ mono_threads_register_app_context (MonoAppContext* ctx, MonoError *error); void mono_threads_release_app_context (MonoAppContext* ctx, MonoError *error); +ICALL_EXPORT void ves_icall_System_Runtime_Remoting_Contexts_Context_RegisterContext (MonoAppContextHandle ctx, MonoError *error); + +ICALL_EXPORT void ves_icall_System_Runtime_Remoting_Contexts_Context_ReleaseContext (MonoAppContextHandle ctx, MonoError *error); MONO_PROFILER_API MonoInternalThread *mono_thread_internal_current (void); @@ -248,6 +399,8 @@ void mono_threads_set_shutting_down (void); gunichar2* mono_thread_get_name (MonoInternalThread *this_obj, guint32 *name_len); MONO_API MonoException* mono_thread_get_undeniable_exception (void); + +ICALL_EXPORT void ves_icall_thread_finish_async_abort (void); MONO_PROFILER_API void mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean permanent, gboolean reset, MonoError *error); @@ -287,12 +440,12 @@ void mono_threads_perform_thread_dump (void); gboolean mono_thread_create_checked (MonoDomain *domain, gpointer func, gpointer arg, MonoError *error); -/* Can't include utils/mono-threads.h because of the THREAD_INFO_TYPE wizardry */ -void mono_threads_add_joinable_runtime_thread (gpointer thread_info); +void mono_threads_add_joinable_runtime_thread (MonoThreadInfo *thread_info); void mono_threads_add_joinable_thread (gpointer tid); void mono_threads_join_threads (void); void mono_thread_join (gpointer tid); +ICALL_EXPORT void ves_icall_System_Threading_Thread_GetStackTraces (MonoArray **out_threads, MonoArray **out_stack_traces); MONO_API gpointer @@ -338,7 +491,9 @@ mono_threads_exit_gc_safe_region_unbalanced_internal (gpointer cookie, MonoStack void mono_set_thread_dump_dir(gchar* dir); -#ifdef TARGET_OSX +MONO_COLD void +mono_set_pending_exception_handle (MonoExceptionHandle exc); + #define MONO_MAX_SUMMARY_NAME_LEN 140 #define MONO_MAX_SUMMARY_THREADS 32 #define MONO_MAX_SUMMARY_FRAMES 40 @@ -383,6 +538,5 @@ typedef struct { gboolean mono_threads_summarize (MonoContext *ctx, gchar **out, MonoStackHash *hashes); -#endif #endif /* _MONO_METADATA_THREADS_TYPES_H_ */ diff --git a/mono/metadata/threads.c.REMOVED.git-id b/mono/metadata/threads.c.REMOVED.git-id index dc3f9b1df9..6f9b1077c6 100644 --- a/mono/metadata/threads.c.REMOVED.git-id +++ b/mono/metadata/threads.c.REMOVED.git-id @@ -1 +1 @@ -152038ab038e0863629eb2ac05d89c0a7ed3c923 \ No newline at end of file +b8800c4291c83fcaf75b94e0ba4a66d9dc3ac9b5 \ No newline at end of file diff --git a/mono/metadata/threads.h b/mono/metadata/threads.h index bad65287b5..65020eb039 100644 --- a/mono/metadata/threads.h +++ b/mono/metadata/threads.h @@ -21,41 +21,42 @@ MONO_BEGIN_DECLS /* This callback should return TRUE if the runtime must wait for the thread, FALSE otherwise */ typedef mono_bool (*MonoThreadManageCallback) (MonoThread* thread); -extern MONO_API void mono_thread_init (MonoThreadStartCB start_cb, +MONO_API void mono_thread_init (MonoThreadStartCB start_cb, MonoThreadAttachCB attach_cb); -extern MONO_API void mono_thread_cleanup (void); -extern MONO_API void mono_thread_manage(void); +MONO_API void mono_thread_cleanup (void); +MONO_API void mono_thread_manage(void); -extern MONO_API MonoThread *mono_thread_current (void); +MONO_API MonoThread *mono_thread_current (void); -extern MONO_API void mono_thread_set_main (MonoThread *thread); -extern MONO_API MonoThread *mono_thread_get_main (void); +MONO_API void mono_thread_set_main (MonoThread *thread); +MONO_API MonoThread *mono_thread_get_main (void); -extern MONO_RT_EXTERNAL_ONLY MONO_API void mono_thread_stop (MonoThread *thread); +MONO_API MONO_RT_EXTERNAL_ONLY void mono_thread_stop (MonoThread *thread); -extern MONO_API void mono_thread_new_init (intptr_t tid, void* stack_start, +MONO_API void mono_thread_new_init (intptr_t tid, void* stack_start, void* func); -extern MONO_RT_EXTERNAL_ONLY MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_thread_create (MonoDomain *domain, void* func, void* arg); -extern MONO_API MonoThread *mono_thread_attach (MonoDomain *domain); -extern MONO_API void mono_thread_detach (MonoThread *thread); -extern MONO_API void mono_thread_exit (void); +MONO_API MonoThread *mono_thread_attach (MonoDomain *domain); +MONO_API void mono_thread_detach (MonoThread *thread); +MONO_API void mono_thread_exit (void); -extern MONO_API char *mono_thread_get_name_utf8 (MonoThread *thread); -extern MONO_API int32_t mono_thread_get_managed_id (MonoThread *thread); +MONO_API char *mono_thread_get_name_utf8 (MonoThread *thread); +MONO_API int32_t mono_thread_get_managed_id (MonoThread *thread); MONO_API void mono_thread_set_manage_callback (MonoThread *thread, MonoThreadManageCallback func); -extern MONO_API void mono_threads_set_default_stacksize (uint32_t stacksize); -extern MONO_API uint32_t mono_threads_get_default_stacksize (void); +MONO_API void mono_threads_set_default_stacksize (uint32_t stacksize); +MONO_API uint32_t mono_threads_get_default_stacksize (void); MONO_API void mono_threads_request_thread_dump (void); MONO_API mono_bool mono_thread_is_foreign (MonoThread *thread); -extern MONO_API mono_bool mono_thread_detach_if_exiting (void); +MONO_API MONO_RT_EXTERNAL_ONLY mono_bool +mono_thread_detach_if_exiting (void); MONO_END_DECLS diff --git a/mono/metadata/verify.c.REMOVED.git-id b/mono/metadata/verify.c.REMOVED.git-id index 8832c3ea8a..89a6263e4c 100644 --- a/mono/metadata/verify.c.REMOVED.git-id +++ b/mono/metadata/verify.c.REMOVED.git-id @@ -1 +1 @@ -4b5ddbb85d59d2bdc80da553c67980f54c1ec593 \ No newline at end of file +149519b35396644935e75f23d0b518770facb63e \ No newline at end of file diff --git a/mono/metadata/w32event-unix.c b/mono/metadata/w32event-unix.c index 93c595abf2..93371bcc25 100644 --- a/mono/metadata/w32event-unix.c +++ b/mono/metadata/w32event-unix.c @@ -112,7 +112,7 @@ static gsize namedevent_typesize (void) void mono_w32event_init (void) { - static MonoW32HandleOps event_ops = { + static const MonoW32HandleOps event_ops = { NULL, /* close */ event_handle_signal, /* signal */ event_handle_own, /* own */ @@ -124,7 +124,7 @@ mono_w32event_init (void) event_typesize, /* typesize */ }; - static MonoW32HandleOps namedevent_ops = { + static const MonoW32HandleOps namedevent_ops = { NULL, /* close */ event_handle_signal, /* signal */ event_handle_own, /* own */ diff --git a/mono/metadata/w32event.h b/mono/metadata/w32event.h index 779407de84..4cb02fbd78 100644 --- a/mono/metadata/w32event.h +++ b/mono/metadata/w32event.h @@ -11,6 +11,7 @@ #include "object.h" #include "object-internals.h" #include "w32handle-namespace.h" +#include void mono_w32event_init (void); @@ -27,18 +28,23 @@ mono_w32event_set (gpointer handle); void mono_w32event_reset (gpointer handle); +ICALL_EXPORT gpointer ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual, MonoBoolean initial, MonoStringHandle name, gint32 *err, MonoError *error); +ICALL_EXPORT gboolean ves_icall_System_Threading_Events_SetEvent_internal (gpointer handle); +ICALL_EXPORT gboolean ves_icall_System_Threading_Events_ResetEvent_internal (gpointer handle); +ICALL_EXPORT void ves_icall_System_Threading_Events_CloseEvent_internal (gpointer handle); +ICALL_EXPORT gpointer ves_icall_System_Threading_Events_OpenEvent_internal (MonoStringHandle name, gint32 rights, gint32 *err, MonoError *error); diff --git a/mono/metadata/w32file-unix.c.REMOVED.git-id b/mono/metadata/w32file-unix.c.REMOVED.git-id index f38ac8195f..52a6f3ccb7 100644 --- a/mono/metadata/w32file-unix.c.REMOVED.git-id +++ b/mono/metadata/w32file-unix.c.REMOVED.git-id @@ -1 +1 @@ -1c95eda0a9336906afaf9e4a95f7be5b070960a9 \ No newline at end of file +622c71c5beca1500ec3039c31189799f1ad2ebe2 \ No newline at end of file diff --git a/mono/metadata/w32file-win32.c b/mono/metadata/w32file-win32.c index b8e63409c8..12332ddadf 100644 --- a/mono/metadata/w32file-win32.c +++ b/mono/metadata/w32file-win32.c @@ -11,6 +11,7 @@ #include #include #include "mono/metadata/w32file-win32-internals.h" +#include "mono/metadata/w32subset.h" void mono_w32file_init (void) @@ -82,21 +83,25 @@ mono_w32file_delete (const gunichar2 *name) } gboolean -mono_w32file_read(gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread) +mono_w32file_read(gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread, gint32 *win32error) { gboolean res; MONO_ENTER_GC_SAFE; - res = ReadFile (handle, buffer, numbytes, bytesread, NULL); + res = ReadFile (handle, buffer, numbytes, (PDWORD)bytesread, NULL); + if (!res) + *win32error = GetLastError (); MONO_EXIT_GC_SAFE; return res; } gboolean -mono_w32file_write (gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten) +mono_w32file_write (gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten, gint32 *win32error) { gboolean res; MONO_ENTER_GC_SAFE; - res = WriteFile (handle, buffer, numbytes, byteswritten, NULL); + res = WriteFile (handle, buffer, numbytes, (PDWORD)byteswritten, NULL); + if (!res) + *win32error = GetLastError (); MONO_EXIT_GC_SAFE; return res; } @@ -126,7 +131,7 @@ mono_w32file_seek (gpointer handle, gint32 movedistance, gint32 *highmovedistanc { guint32 res; MONO_ENTER_GC_SAFE; - res = SetFilePointer (handle, movedistance, highmovedistance, method); + res = SetFilePointer (handle, movedistance, (PLONG)highmovedistance, method); MONO_EXIT_GC_SAFE; return res; } @@ -370,13 +375,12 @@ mono_w32file_get_volume_information (const gunichar2 *path, gunichar2 *volumenam { gboolean res; MONO_ENTER_GC_SAFE; - res = GetVolumeInformation (path, volumename, volumesize, outserial, maxcomp, fsflags, fsbuffer, fsbuffersize); + res = GetVolumeInformation (path, volumename, volumesize, (PDWORD)outserial, (PDWORD)maxcomp, (PDWORD)fsflags, fsbuffer, fsbuffersize); MONO_EXIT_GC_SAFE; return res; } -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) - +#if HAVE_API_SUPPORT_WIN32_MOVE_FILE gboolean mono_w32file_move (const gunichar2 *path, const gunichar2 *dest, gint32 *error) { @@ -392,7 +396,9 @@ mono_w32file_move (const gunichar2 *path, const gunichar2 *dest, gint32 *error) return result; } +#endif +#if HAVE_API_SUPPORT_WIN32_REPLACE_FILE gboolean mono_w32file_replace (const gunichar2 *destinationFileName, const gunichar2 *sourceFileName, const gunichar2 *destinationBackupFileName, guint32 flags, gint32 *error) { @@ -408,6 +414,18 @@ mono_w32file_replace (const gunichar2 *destinationFileName, const gunichar2 *sou return result; } +#endif + +#if HAVE_API_SUPPORT_WIN32_COPY_FILE +// Support older UWP SDK? +WINBASEAPI +BOOL +WINAPI +CopyFileW ( + PCWSTR ExistingFileName, + PCWSTR NewFileName, + BOOL FailIfExists + ); gboolean mono_w32file_copy (const gunichar2 *path, const gunichar2 *dest, gboolean overwrite, gint32 *error) @@ -424,7 +442,9 @@ mono_w32file_copy (const gunichar2 *path, const gunichar2 *dest, gboolean overwr return result; } +#endif +#if HAVE_API_SUPPORT_WIN32_LOCK_FILE gboolean mono_w32file_lock (gpointer handle, gint64 position, gint64 length, gint32 *error) { @@ -440,7 +460,9 @@ mono_w32file_lock (gpointer handle, gint64 position, gint64 length, gint32 *erro return result; } +#endif +#if HAVE_API_SUPPORT_WIN32_UNLOCK_FILE gboolean mono_w32file_unlock (gpointer handle, gint64 position, gint64 length, gint32 *error) { @@ -456,7 +478,9 @@ mono_w32file_unlock (gpointer handle, gint64 position, gint64 length, gint32 *er return result; } +#endif +#if HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE HANDLE mono_w32file_get_console_input (void) { @@ -486,25 +510,33 @@ mono_w32file_get_console_error (void) MONO_EXIT_GC_SAFE; return res; } +#endif // HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE gint64 -mono_w32file_get_file_size (gpointer handle, gint32 *error) +mono_w32file_get_file_size (HANDLE handle, gint32 *error) { - gint64 length; - guint32 length_hi; + LARGE_INTEGER length; MONO_ENTER_GC_SAFE; - length = GetFileSize (handle, &length_hi); - if(length==INVALID_FILE_SIZE) { + if (!GetFileSizeEx (handle, &length)) { *error=GetLastError (); + length.QuadPart = INVALID_FILE_SIZE; } MONO_EXIT_GC_SAFE; - - return length | ((gint64)length_hi << 32); + return length.QuadPart; } +#if HAVE_API_SUPPORT_WIN32_GET_DRIVE_TYPE +// Support older UWP SDK? +WINBASEAPI +UINT +WINAPI +GetDriveTypeW ( + PCWSTR RootPathName + ); + guint32 mono_w32file_get_drive_type (const gunichar2 *root_path_name) { @@ -514,7 +546,9 @@ mono_w32file_get_drive_type (const gunichar2 *root_path_name) MONO_EXIT_GC_SAFE; return res; } +#endif +#if HAVE_API_SUPPORT_WIN32_GET_LOGICAL_DRIVE_STRINGS gint32 mono_w32file_get_logical_drive (guint32 len, gunichar2 *buf) { @@ -524,5 +558,4 @@ mono_w32file_get_logical_drive (guint32 len, gunichar2 *buf) MONO_EXIT_GC_SAFE; return res; } - -#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ +#endif diff --git a/mono/metadata/w32file.c b/mono/metadata/w32file.c index f6ba0c0c16..557f810587 100644 --- a/mono/metadata/w32file.c +++ b/mono/metadata/w32file.c @@ -515,7 +515,7 @@ ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArrayHandle dest, *io_error=ERROR_SUCCESS; - MONO_CHECK_ARG_NULL (dest, 0); + MONO_CHECK_ARG_NULL (MONO_HANDLE_RAW (dest), 0); if (dest_offset > mono_array_handle_length (dest) - count) { mono_error_set_argument (error, "array", "array too small. numBytes/offset wrong."); @@ -524,13 +524,11 @@ ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArrayHandle dest, guint32 buffer_handle = 0; buffer = MONO_ARRAY_HANDLE_PIN (dest, guchar, dest_offset, &buffer_handle); - result = mono_w32file_read (handle, buffer, count, &n); + result = mono_w32file_read (handle, buffer, count, &n, io_error); mono_gchandle_free (buffer_handle); - if (!result) { - *io_error=mono_w32error_get_last (); + if (!result) return -1; - } return (gint32)n; } @@ -547,7 +545,7 @@ ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArrayHandle src, *io_error=ERROR_SUCCESS; - MONO_CHECK_ARG_NULL (src, 0); + MONO_CHECK_ARG_NULL (MONO_HANDLE_RAW (src), 0); if (src_offset > mono_array_handle_length (src) - count) { mono_error_set_argument (error, "array", "array too small. numBytes/offset wrong."); @@ -556,13 +554,11 @@ ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArrayHandle src, guint32 src_handle = 0; buffer = MONO_ARRAY_HANDLE_PIN (src, guchar, src_offset, &src_handle); - result = mono_w32file_write (handle, buffer, count, &n); + result = mono_w32file_write (handle, buffer, count, &n, io_error); mono_gchandle_free (src_handle); - if (!result) { - *io_error=mono_w32error_get_last (); + if (!result) return -1; - } return (gint32)n; } @@ -693,19 +689,19 @@ ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time, } HANDLE -ves_icall_System_IO_MonoIO_get_ConsoleOutput () +ves_icall_System_IO_MonoIO_get_ConsoleOutput (void) { return mono_w32file_get_console_output (); } HANDLE -ves_icall_System_IO_MonoIO_get_ConsoleInput () +ves_icall_System_IO_MonoIO_get_ConsoleInput (void) { return mono_w32file_get_console_input (); } HANDLE -ves_icall_System_IO_MonoIO_get_ConsoleError () +ves_icall_System_IO_MonoIO_get_ConsoleError (void) { return mono_w32file_get_console_error (); } @@ -762,19 +758,19 @@ ves_icall_System_IO_MonoIO_DuplicateHandle (HANDLE source_process_handle, HANDLE #ifndef HOST_WIN32 gunichar2 -ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar () +ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void) { return (gunichar2) '/'; /* forward slash */ } gunichar2 -ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar () +ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar (void) { return (gunichar2) '/'; /* forward slash */ } gunichar2 -ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar () +ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar (void) { if (IS_PORTABILITY_SET) return (gunichar2) '\\'; /* backslash */ @@ -783,7 +779,7 @@ ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar () } gunichar2 -ves_icall_System_IO_MonoIO_get_PathSeparator () +ves_icall_System_IO_MonoIO_get_PathSeparator (void) { return (gunichar2) ':'; /* colon */ } @@ -820,7 +816,7 @@ ves_icall_System_IO_MonoIO_get_InvalidPathChars (MonoError *error) domain = mono_domain_get (); n = sizeof (invalid_path_chars) / sizeof (gunichar2); MONO_HANDLE_ASSIGN (chars, mono_array_new_handle (domain, mono_defaults.char_class, n, error)); - return_val_if_nok (error, NULL); + return_val_if_nok (error, MONO_HANDLE_CAST (MonoArray, mono_new_null ())); for (i = 0; i < n; ++ i) MONO_HANDLE_ARRAY_SETVAL (chars, gunichar2, i, invalid_path_chars [i]); diff --git a/mono/metadata/w32file.h b/mono/metadata/w32file.h index 67fb2fcb65..e780367465 100644 --- a/mono/metadata/w32file.h +++ b/mono/metadata/w32file.h @@ -19,6 +19,7 @@ #include #include +#include G_BEGIN_DECLS @@ -114,145 +115,167 @@ typedef struct _MonoFSAsyncResult { */ /* System.IO.MonoIO */ -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_CreateDirectory (const gunichar2 *path, gint32 *error); -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_RemoveDirectory (const gunichar2 *path, gint32 *error); -extern gpointer +ICALL_EXPORT +gpointer ves_icall_System_IO_MonoIO_FindFirstFile (const gunichar2 *path_with_pattern, MonoStringHandleOut file_name, gint32 *file_attr, gint32 *ioerror, MonoError *error); - -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_FindNextFile (gpointer hnd, MonoStringHandleOut file_name, gint32 *file_attr, gint32 *ioerror, MonoError *error); - -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_FindCloseFile (gpointer hnd); -extern MonoStringHandle +ICALL_EXPORT +MonoStringHandle ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *io_error, MonoError *error); -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_SetCurrentDirectory (const gunichar2 *path, gint32 *error); - -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_MoveFile (const gunichar2 *path, const gunichar2 *dest, gint32 *error); - -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_CopyFile (const gunichar2 *path, const gunichar2 *dest, MonoBoolean overwrite, gint32 *error); - -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_DeleteFile (const gunichar2 *path, gint32 *error); -extern gint32 +ICALL_EXPORT +gint32 ves_icall_System_IO_MonoIO_GetFileAttributes (const gunichar2 *path, gint32 *error); -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_SetFileAttributes (const gunichar2 *path, gint32 attrs, gint32 *error); - -extern gint32 +ICALL_EXPORT +gint32 ves_icall_System_IO_MonoIO_GetFileType (gpointer handle, gint32 *error); -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_GetFileStat (const gunichar2 *path, MonoIOStat *stat, gint32 *error); - -extern gpointer +ICALL_EXPORT +gpointer ves_icall_System_IO_MonoIO_Open (const gunichar2 *filename, gint32 mode, gint32 access_mode, gint32 share, gint32 options, gint32 *error); - -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_Close (gpointer handle, gint32 *error); -extern gint32 +ICALL_EXPORT +gint32 ves_icall_System_IO_MonoIO_Read (gpointer handle, MonoArrayHandle dest, gint32 dest_offset, gint32 count, gint32 *io_error, MonoError *error); - -extern gint32 +ICALL_EXPORT +gint32 ves_icall_System_IO_MonoIO_Write (gpointer handle, MonoArrayHandle src, gint32 src_offset, gint32 count, gint32 *io_error, MonoError *error); - -extern gint64 +ICALL_EXPORT +gint64 ves_icall_System_IO_MonoIO_Seek (gpointer handle, gint64 offset, gint32 origin, gint32 *error); - -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_Flush (gpointer handle, gint32 *error); -extern gint64 +ICALL_EXPORT +gint64 ves_icall_System_IO_MonoIO_GetLength (gpointer handle, gint32 *error); -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_SetLength (gpointer handle, gint64 length, gint32 *error); - -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_SetFileTime (gpointer handle, gint64 creation_time, gint64 last_access_time, gint64 last_write_time, gint32 *error); - -extern gpointer +ICALL_EXPORT +gpointer ves_icall_System_IO_MonoIO_get_ConsoleOutput (void); -extern gpointer +ICALL_EXPORT +gpointer ves_icall_System_IO_MonoIO_get_ConsoleInput (void); -extern gpointer +ICALL_EXPORT +gpointer ves_icall_System_IO_MonoIO_get_ConsoleError (void); -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_CreatePipe (gpointer *read_handle, gpointer *write_handle, gint32 *error); -extern MonoBoolean +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_DuplicateHandle (gpointer source_process_handle, gpointer source_handle, gpointer target_process_handle, gpointer *target_handle, gint32 access, gint32 inherit, gint32 options, gint32 *error); -extern gunichar2 +ICALL_EXPORT +gunichar2 ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void); -extern gunichar2 +ICALL_EXPORT +gunichar2 ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar (void); -extern gunichar2 +ICALL_EXPORT +gunichar2 ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar (void); -extern gunichar2 +ICALL_EXPORT +gunichar2 ves_icall_System_IO_MonoIO_get_PathSeparator (void); -extern MonoArrayHandle +ICALL_EXPORT +MonoArrayHandle ves_icall_System_IO_MonoIO_get_InvalidPathChars (MonoError *error); -extern void ves_icall_System_IO_MonoIO_Lock (gpointer handle, gint64 position, +ICALL_EXPORT +void ves_icall_System_IO_MonoIO_Lock (gpointer handle, gint64 position, gint64 length, gint32 *error); -extern void ves_icall_System_IO_MonoIO_Unlock (gpointer handle, gint64 position, - gint64 length, gint32 *error); -extern MonoBoolean +ICALL_EXPORT +void ves_icall_System_IO_MonoIO_Unlock (gpointer handle, gint64 position, + gint64 length, gint32 *error); +ICALL_EXPORT +MonoBoolean ves_icall_System_IO_MonoIO_ReplaceFile (const gunichar2 *source_file_name, const gunichar2 *destination_file_name, const gunichar2 *destination_backup_file_name, MonoBoolean ignore_metadata_errors, gint32 *error); #if defined (TARGET_IOS) || defined (TARGET_ANDROID) -MONO_RT_EXTERNAL_ONLY -extern gint64 +MONO_API MONO_RT_EXTERNAL_ONLY gint64 mono_filesize_from_path (MonoString *path); extern gint64 @@ -260,6 +283,7 @@ mono_filesize_from_fd (int fd); #endif +ICALL_EXPORT void ves_icall_System_IO_MonoIO_DumpHandles (void); @@ -383,10 +407,10 @@ gboolean mono_w32file_delete (const gunichar2 *name); gboolean -mono_w32file_read (gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread); +mono_w32file_read (gpointer handle, gpointer buffer, guint32 numbytes, guint32 *bytesread, gint32 *win32error); gboolean -mono_w32file_write (gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten); +mono_w32file_write (gpointer handle, gconstpointer buffer, guint32 numbytes, guint32 *byteswritten, gint32 *win32error); gboolean mono_w32file_flush (gpointer handle); diff --git a/mono/metadata/w32handle-namespace.c b/mono/metadata/w32handle-namespace.c index ab24689c35..c141b28909 100644 --- a/mono/metadata/w32handle-namespace.c +++ b/mono/metadata/w32handle-namespace.c @@ -104,7 +104,7 @@ mono_w32handle_namespace_search_handle (MonoW32Type type, const gchar *name) NamespaceSearchHandleData search_data; if (!has_namespace (type)) - g_error ("%s: type %s does not have a namespace", __func__, type); + g_error ("%s: type %s does not have a namespace", __func__, mono_w32handle_get_typename (type)); mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_HANDLE, "%s: Lookup for handle named [%s] type %s", __func__, name, mono_w32handle_get_typename (type)); diff --git a/mono/metadata/w32handle.c b/mono/metadata/w32handle.c index 81733f1151..a2ef2beebb 100644 --- a/mono/metadata/w32handle.c +++ b/mono/metadata/w32handle.c @@ -33,7 +33,7 @@ struct _MonoW32HandleSlot { }; static MonoW32HandleCapability handle_caps [MONO_W32TYPE_COUNT]; -static MonoW32HandleOps *handle_ops [MONO_W32TYPE_COUNT]; +static MonoW32HandleOps const *handle_ops [MONO_W32TYPE_COUNT]; static MonoW32HandleSlot *handles_slots_first; static MonoW32HandleSlot *handles_slots_last; @@ -399,18 +399,18 @@ done: static gboolean mono_w32handle_ref_core (MonoW32Handle *handle_data) { - guint old, new; + guint old, new_; do { old = handle_data->ref; if (old == 0) return FALSE; - new = old + 1; - } while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new, (gint32)old) != (gint32)old); + new_ = old + 1; + } while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new_, (gint32)old) != (gint32)old); mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_HANDLE, "%s: ref %s handle %p, ref: %d -> %d", - __func__, mono_w32handle_ops_typename (handle_data->type), handle_data, old, new); + __func__, mono_w32handle_ops_typename (handle_data->type), handle_data, old, new_); return TRUE; } @@ -419,7 +419,7 @@ static gboolean mono_w32handle_unref_core (MonoW32Handle *handle_data) { MonoW32Type type; - guint old, new; + guint old, new_; type = handle_data->type; @@ -428,19 +428,20 @@ mono_w32handle_unref_core (MonoW32Handle *handle_data) if (!(old >= 1)) g_error ("%s: handle %p has ref %d, it should be >= 1", __func__, handle_data, old); - new = old - 1; - } while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new, (gint32)old) != (gint32)old); + new_ = old - 1; + } while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new_, (gint32)old) != (gint32)old); /* handle_data might contain invalid data from now on, if * another thread is unref'ing this handle at the same time */ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_HANDLE, "%s: unref %s handle %p, ref: %d -> %d destroy: %s", - __func__, mono_w32handle_ops_typename (type), handle_data, old, new, new == 0 ? "true" : "false"); + __func__, mono_w32handle_ops_typename (type), handle_data, old, new_, new_ == 0 ? "true" : "false"); - return new == 0; + return new_ == 0; } -static void (*_wapi_handle_ops_get_close_func (MonoW32Type type))(gpointer, gpointer); +static void +mono_w32handle_ops_close (MonoW32Type type, gpointer handle_specific); static void w32handle_destroy (MonoW32Handle *handle_data) @@ -453,7 +454,6 @@ w32handle_destroy (MonoW32Handle *handle_data) */ MonoW32Type type; gpointer handle_specific; - void (*close_func)(gpointer, gpointer); g_assert (!handle_data->in_use); @@ -471,10 +471,7 @@ w32handle_destroy (MonoW32Handle *handle_data) mono_coop_mutex_unlock (&scan_mutex); - close_func = _wapi_handle_ops_get_close_func (type); - if (close_func != NULL) { - close_func (handle_data, handle_specific); - } + mono_w32handle_ops_close (type, handle_specific); memset (handle_specific, 0, mono_w32handle_ops_typesize (type)); @@ -493,7 +490,7 @@ mono_w32handle_unref (MonoW32Handle *handle_data) } void -mono_w32handle_register_ops (MonoW32Type type, MonoW32HandleOps *ops) +mono_w32handle_register_ops (MonoW32Type type, const MonoW32HandleOps *ops) { handle_ops [type] = ops; } @@ -513,14 +510,12 @@ mono_w32handle_test_capabilities (MonoW32Handle *handle_data, MonoW32HandleCapab return (handle_caps [handle_data->type] & caps) != 0; } -static void (*_wapi_handle_ops_get_close_func (MonoW32Type type))(gpointer, gpointer) +static void +mono_w32handle_ops_close (MonoW32Type type, gpointer data) { - if (handle_ops[type] != NULL && - handle_ops[type]->close != NULL) { - return (handle_ops[type]->close); - } - - return (NULL); + const MonoW32HandleOps *ops = handle_ops [type]; + if (ops && ops->close) + ops->close (data); } static void @@ -534,8 +529,8 @@ static const gchar* mono_w32handle_ops_typename (MonoW32Type type) { g_assert (handle_ops [type]); - g_assert (handle_ops [type]->typename); - return handle_ops [type]->typename (); + g_assert (handle_ops [type]->type_name); + return handle_ops [type]->type_name (); } static gsize @@ -608,6 +603,7 @@ again: if (iter == 1000) iter = 10; + MONO_ENTER_GC_SAFE; #ifdef HOST_WIN32 SleepEx (iter, TRUE); #else @@ -620,6 +616,7 @@ again: sleepytime.tv_nsec = iter * 1000000; nanosleep (&sleepytime, NULL); #endif /* HOST_WIN32 */ + MONO_EXIT_GC_SAFE; goto again; } diff --git a/mono/metadata/w32handle.h b/mono/metadata/w32handle.h index 13a1cb26bb..8b5d7541df 100644 --- a/mono/metadata/w32handle.h +++ b/mono/metadata/w32handle.h @@ -56,7 +56,7 @@ typedef enum { typedef struct { - void (*close)(gpointer handle, gpointer data); + void (*close)(gpointer data); /* mono_w32handle_signal_and_wait */ void (*signal)(MonoW32Handle *handle_data); @@ -92,7 +92,7 @@ typedef struct void (*details)(MonoW32Handle *handle_data); /* Called to get the name of the handle type */ - const gchar* (*typename) (void); + const char* (*type_name) (void); /* Called to get the size of the handle type */ gsize (*typesize) (void); @@ -112,7 +112,7 @@ void mono_w32handle_cleanup (void); void -mono_w32handle_register_ops (MonoW32Type type, MonoW32HandleOps *ops); +mono_w32handle_register_ops (MonoW32Type type, const MonoW32HandleOps *ops); gpointer mono_w32handle_new (MonoW32Type type, gpointer handle_specific); diff --git a/mono/metadata/w32mutex-unix.c b/mono/metadata/w32mutex-unix.c index f28414fe1f..1183817acc 100644 --- a/mono/metadata/w32mutex-unix.c +++ b/mono/metadata/w32mutex-unix.c @@ -213,7 +213,7 @@ static gsize namedmutex_typesize (void) void mono_w32mutex_init (void) { - static MonoW32HandleOps mutex_ops = { + static const MonoW32HandleOps mutex_ops = { NULL, /* close */ mutex_handle_signal, /* signal */ mutex_handle_own, /* own */ @@ -225,7 +225,7 @@ mono_w32mutex_init (void) mutex_typesize, /* typesize */ }; - static MonoW32HandleOps namedmutex_ops = { + static const MonoW32HandleOps namedmutex_ops = { NULL, /* close */ mutex_handle_signal, /* signal */ mutex_handle_own, /* own */ @@ -339,7 +339,6 @@ ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned, MonoSt { gpointer mutex; - error_init (error); *created = TRUE; /* Need to blow away any old errors here, because code tests @@ -427,7 +426,6 @@ ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle) gpointer ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoStringHandle name, gint32 rights G_GNUC_UNUSED, gint32 *err, MonoError *error) { - error_init (error); gchar *utf8_name = mono_string_handle_to_utf8 (name, error); return_val_if_nok (error, NULL); gpointer handle = mono_w32mutex_open (utf8_name, rights, err); diff --git a/mono/metadata/w32mutex-win32.c b/mono/metadata/w32mutex-win32.c index f7a68c5c74..fa7e9b246c 100644 --- a/mono/metadata/w32mutex-win32.c +++ b/mono/metadata/w32mutex-win32.c @@ -30,6 +30,11 @@ ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned, MonoSt *created = TRUE; + /* Need to blow away any old errors here, because code tests + * for ERROR_ALREADY_EXISTS on success (!) to see if a mutex + * was freshly created */ + SetLastError (ERROR_SUCCESS); + if (MONO_HANDLE_IS_NULL (name)) { MONO_ENTER_GC_SAFE; mutex = CreateMutex (NULL, owned, NULL); @@ -60,7 +65,6 @@ ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoStringHandle name, gint { HANDLE ret; - error_init (error); *err = ERROR_SUCCESS; uint32_t gchandle = 0; diff --git a/mono/metadata/w32mutex.h b/mono/metadata/w32mutex.h index 499b3236ef..68bc0e7e7a 100644 --- a/mono/metadata/w32mutex.h +++ b/mono/metadata/w32mutex.h @@ -11,16 +11,20 @@ #include "object.h" #include "object-internals.h" #include "w32handle-namespace.h" +#include void mono_w32mutex_init (void); +ICALL_EXPORT gpointer ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned, MonoStringHandle name, MonoBoolean *created, MonoError *error); +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle); +ICALL_EXPORT gpointer ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoStringHandle name, gint32 rights, gint32 *err, MonoError *error); diff --git a/mono/metadata/w32process-unix-default.c b/mono/metadata/w32process-unix-default.c index 0ea952a0c1..12136e7b88 100644 --- a/mono/metadata/w32process-unix-default.c +++ b/mono/metadata/w32process-unix-default.c @@ -20,6 +20,14 @@ #endif #endif +#ifdef _AIX +/* like solaris, just different */ +#include +/* fallback for procfs-less i */ +#include +#include +#endif + /* makedev() macro */ #ifdef MAJOR_IN_MKDEV #include @@ -33,6 +41,7 @@ #define MAXPATHLEN 242 #endif +/* XXX: why don't we just use proclib? */ gchar* mono_w32process_get_name (pid_t pid) { @@ -41,7 +50,7 @@ mono_w32process_get_name (pid_t pid) gchar buf[256]; gchar *ret = NULL; -#if defined(HOST_SOLARIS) +#if defined(HOST_SOLARIS) || (defined(_AIX) && !defined(__PASE__)) filename = g_strdup_printf ("/proc/%d/psinfo", pid); if ((fp = fopen (filename, "r")) != NULL) { struct psinfo info; @@ -55,6 +64,15 @@ mono_w32process_get_name (pid_t pid) fclose (fp); } g_free (filename); +#elif defined(__PASE__) + /* AIX has a procfs, but it's not available on i */ + struct procentry64 proc; + pid_t newpid; + + newpid = pid; + if (getprocs64(&proc, sizeof (proc), NULL, NULL, &newpid, 1) == 1) { + ret = g_strdup (proc.pi_comm); + } #else memset (buf, '\0', sizeof(buf)); filename = g_strdup_printf ("/proc/%d/exe", pid); @@ -140,6 +158,74 @@ open_process_map (int pid, const char *mode) GSList* mono_w32process_get_modules (pid_t pid) { +#if defined(_AIX) + /* due to procfs, this won't work on i */ + GSList *ret = NULL; + FILE *fp; + MonoW32ProcessModule *mod; + struct prmap module; + int i; + fpos64_t curpos; + + char pidpath[32]; /* "/proc//map" plus null, rounded */ + char libpath[MAXPATHLEN + 1]; + char membername[MAXPATHLEN + 1]; + char combinedname[(MAXPATHLEN * 2) + 3]; /* lib, member, (), and nul */ + + sprintf (pidpath, "/proc/%d/map", pid); + if ((fp = fopen(pidpath, "r"))) { + while (fread (&module, sizeof (module), 1, fp) == 1 + /* proc(4) declares such a struct to be the array terminator */ + && (module.pr_size != 0 && module.pr_mflags != 0) + && (module.pr_mflags & MA_READ)) { + + fgetpos64 (fp, &curpos); /* save our position */ + fseeko (fp, module.pr_pathoff, SEEK_SET); + while ((libpath[i++] = fgetc (fp))); + i = 0; + while ((membername[i++] = fgetc (fp))); + i = 0; + fsetpos64 (fp, &curpos); /* back to normal */ + + mod = g_new0 (MonoW32ProcessModule, 1); + mod->address_start = module.pr_vaddr; + mod->address_end = module.pr_vaddr + module.pr_size; + mod->address_offset = module.pr_off; + mod->perms = g_strdup ("r--p"); /* XXX? */ + + /* AIX has what appears to be device, channel and inode information, + * but it's in a string. Try parsing it. + * + * XXX: I believe it's fstype.devno.chano.inode, but I'm uncertain + * as to how that maps out, so I only fill in the inode (like BSD) + */ + sscanf (module.pr_mapname, "%*[^.].%*lu.%*u.%lu", &(mod->inode)); + + if (membername[0]) { + snprintf(combinedname, MAXPATHLEN, "%s(%s)", libpath, membername); + mod->filename = g_strdup (combinedname); + } else { + mod->filename = g_strdup (libpath); + } + + if (g_slist_find_custom (ret, mod, mono_w32process_module_equals) == NULL) { + ret = g_slist_prepend (ret, mod); + } else { + mono_w32process_module_free (mod); + } + } + } else { + mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_PROCESS, "%s: Can't open process map file for pid %d", __func__, pid); + return NULL; + } + + if (ret) + ret = g_slist_reverse (ret); + + fclose (fp); + + return(ret); +#else GSList *ret = NULL; FILE *fp; MonoW32ProcessModule *mod; @@ -263,6 +349,7 @@ mono_w32process_get_modules (pid_t pid) fclose (fp); return(ret); +#endif } #endif diff --git a/mono/metadata/w32process-unix.c.REMOVED.git-id b/mono/metadata/w32process-unix.c.REMOVED.git-id index 268428a7db..ad1a0b9750 100644 --- a/mono/metadata/w32process-unix.c.REMOVED.git-id +++ b/mono/metadata/w32process-unix.c.REMOVED.git-id @@ -1 +1 @@ -2db5dea7a705f856a897812249c9fd272858d650 \ No newline at end of file +db46988cc26a250d0a2b0d1fa5f9bf420ffef210 \ No newline at end of file diff --git a/mono/metadata/w32process-win32.c b/mono/metadata/w32process-win32.c index 844258554f..5c8ef27c35 100644 --- a/mono/metadata/w32process-win32.c +++ b/mono/metadata/w32process-win32.c @@ -72,39 +72,32 @@ ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid) #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) MonoBoolean -ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_info) +ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfoHandle proc_start_info, MonoW32ProcessInfo *process_info, MonoError *error) { + MonoCreateProcessCoop coop; + mono_createprocess_coop_init (&coop, proc_start_info, process_info); + SHELLEXECUTEINFO shellex = {0}; gboolean ret; shellex.cbSize = sizeof(SHELLEXECUTEINFO); shellex.fMask = (gulong)(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_UNICODE); - shellex.nShow = (gulong)proc_start_info->window_style; + shellex.nShow = (gulong)MONO_HANDLE_GETVAL (proc_start_info, window_style); shellex.nShow = (gulong)((shellex.nShow == 0) ? 1 : (shellex.nShow == 1 ? 0 : shellex.nShow)); - if (proc_start_info->filename != NULL) { - shellex.lpFile = mono_string_chars (proc_start_info->filename); - } + shellex.lpFile = coop.filename; + shellex.lpParameters = coop.arguments; - if (proc_start_info->arguments != NULL) { - shellex.lpParameters = mono_string_chars (proc_start_info->arguments); - } + if (coop.length.verb) + shellex.lpVerb = coop.verb; - if (proc_start_info->verb != NULL && - mono_string_length (proc_start_info->verb) != 0) { - shellex.lpVerb = mono_string_chars (proc_start_info->verb); - } + if (coop.length.working_directory) + shellex.lpDirectory = coop.working_directory; - if (proc_start_info->working_directory != NULL && - mono_string_length (proc_start_info->working_directory) != 0) { - shellex.lpDirectory = mono_string_chars (proc_start_info->working_directory); - } - - if (proc_start_info->error_dialog) { - shellex.hwnd = proc_start_info->error_dialog_parent_handle; - } else { + if (MONO_HANDLE_GETVAL (proc_start_info, error_dialog)) + shellex.hwnd = MONO_HANDLE_GETVAL (proc_start_info, error_dialog_parent_handle); + else shellex.fMask = (gulong)(shellex.fMask | SEE_MASK_FLAG_NO_UI); - } ret = ShellExecuteEx (&shellex); if (ret == FALSE) { @@ -118,6 +111,8 @@ ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStar #endif } + mono_createprocess_coop_cleanup (&coop); + return ret; } #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ @@ -135,27 +130,28 @@ mono_process_init_startup_info (HANDLE stdin_handle, HANDLE stdout_handle, HANDL } static gboolean -mono_process_create_process (MonoW32ProcessInfo *mono_process_info, MonoString *cmd, guint32 creation_flags, - gunichar2 *env_vars, gunichar2 *dir, STARTUPINFO *start_info, PROCESS_INFORMATION *process_info) +mono_process_create_process (MonoCreateProcessCoop *coop, MonoW32ProcessInfo *mono_process_info, + MonoStringHandle cmd, guint32 creation_flags, gunichar2 *env_vars, gunichar2 *dir, STARTUPINFO *start_info, + PROCESS_INFORMATION *process_info) { gboolean result = FALSE; + gchandle_t cmd_gchandle = 0; + gunichar2 *cmd_chars = MONO_HANDLE_IS_NULL (cmd) ? NULL : mono_string_handle_pin_chars (cmd, &cmd_gchandle); - if (mono_process_info->username) { + if (coop->username) { guint32 logon_flags = mono_process_info->load_user_profile ? LOGON_WITH_PROFILE : 0; - result = CreateProcessWithLogonW (mono_string_chars (mono_process_info->username), - mono_process_info->domain ? mono_string_chars (mono_process_info->domain) : NULL, - (const gunichar2 *)mono_process_info->password, + result = CreateProcessWithLogonW (coop->username, + coop->domain, + mono_process_info->password, logon_flags, NULL, - cmd ? mono_string_chars (cmd) : NULL, + cmd_chars, creation_flags, env_vars, dir, start_info, process_info); - } else { - result = CreateProcessW (NULL, - cmd ? mono_string_chars (cmd): NULL, + cmd_chars, NULL, NULL, TRUE, @@ -164,9 +160,10 @@ mono_process_create_process (MonoW32ProcessInfo *mono_process_info, MonoString * dir, start_info, process_info); - } + mono_gchandle_free (cmd_gchandle); + return result; } #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ @@ -202,118 +199,129 @@ process_quote_path (const gchar *path) static gboolean process_complete_path (const gunichar2 *appname, gchar **completed) { - gchar *utf8app, *utf8appmemory; - gchar *found; + // FIXME This function should stick to gunichar2. + + char *utf8app; + char *utf8appmemory = NULL; + char *found = NULL; + gboolean result; utf8appmemory = g_utf16_to_utf8 (appname, -1, NULL, NULL, NULL); utf8app = process_unquote_application_name (utf8appmemory); if (g_path_is_absolute (utf8app)) { *completed = process_quote_path (utf8app); - g_free (utf8appmemory); - return TRUE; + result = TRUE; + goto exit; } if (g_file_test (utf8app, G_FILE_TEST_IS_EXECUTABLE) && !g_file_test (utf8app, G_FILE_TEST_IS_DIR)) { *completed = process_quote_path (utf8app); - g_free (utf8appmemory); - return TRUE; + result = TRUE; + goto exit; } found = g_find_program_in_path (utf8app); if (found == NULL) { *completed = NULL; - g_free (utf8appmemory); - return FALSE; + result = FALSE; + goto exit; } *completed = process_quote_path (found); +exit: g_free (found); g_free (utf8appmemory); - return TRUE; + return result; } static gboolean -process_get_shell_arguments (MonoW32ProcessStartInfo *proc_start_info, MonoString **cmd) +process_get_shell_arguments (MonoCreateProcessCoop *proc_start_info, MonoStringHandle *cmd, MonoError *error) { - gchar *spath = NULL; - gchar *new_cmd, *cmd_utf8; - ERROR_DECL_VALUE (mono_error); + char *spath = NULL; + char *new_cmd = NULL; + char *cmd_utf8 = NULL; - *cmd = proc_start_info->arguments; + *cmd = proc_start_info->coophandle.arguments; - if (process_complete_path (mono_string_chars (proc_start_info->filename), &spath)) { + // FIXME There are excess utf8 <=> gunichar2 conversions here. + // We are either returning spath, or spath + " " + cmd. + // Just use gunichar2. Maybe move logic to C#. + + if (process_complete_path (proc_start_info->filename, &spath)) { /* Seems like our CreateProcess does not work as the windows one. * This hack is needed to deal with paths containing spaces */ - if (*cmd) { - cmd_utf8 = mono_string_to_utf8_checked (*cmd, &mono_error); - if (!mono_error_set_pending_exception (&mono_error)) { - new_cmd = g_strdup_printf ("%s %s", spath, cmd_utf8); - *cmd = mono_string_new_wrapper (new_cmd); - g_free (cmd_utf8); - g_free (new_cmd); - } else { - *cmd = NULL; - } + if (!MONO_HANDLE_IS_NULL (*cmd)) { + cmd_utf8 = mono_string_handle_to_utf8 (*cmd, error); + goto_if_nok (error, error); + new_cmd = g_strdup_printf ("%s %s", spath, cmd_utf8); + *cmd = mono_string_new_utf8_len_handle (mono_domain_get (), new_cmd, strlen (new_cmd), error); + goto_if_nok (error, error); } else { - *cmd = mono_string_new_wrapper (spath); + *cmd = mono_string_new_utf8_len_handle (mono_domain_get (), spath, strlen (spath), error); + goto_if_nok (error, error); } - - g_free (spath); } - return (*cmd != NULL) ? TRUE : FALSE; +exit: + g_free (spath); + g_free (cmd_utf8); + g_free (new_cmd); + return !MONO_HANDLE_IS_NULL (*cmd); +error: + *cmd = NULL_HANDLE_STRING; + goto exit; } MonoBoolean -ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStartInfo *proc_start_info, HANDLE stdin_handle, - HANDLE stdout_handle, HANDLE stderr_handle, MonoW32ProcessInfo *process_info) +ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStartInfoHandle proc_start_info, + HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, MonoW32ProcessInfo *process_info, MonoError *error) { + MonoCreateProcessCoop coop; + mono_createprocess_coop_init (&coop, proc_start_info, process_info); + gboolean ret; - gunichar2 *dir; + gunichar2 *dir = NULL; STARTUPINFO startinfo={0}; PROCESS_INFORMATION procinfo; gunichar2 *env_vars = NULL; - MonoString *cmd = NULL; + MonoStringHandle cmd = NULL_HANDLE_STRING; guint32 creation_flags; mono_process_init_startup_info (stdin_handle, stdout_handle, stderr_handle, &startinfo); creation_flags = CREATE_UNICODE_ENVIRONMENT; - if (proc_start_info->create_no_window) + if (MONO_HANDLE_GETVAL (proc_start_info, create_no_window)) creation_flags |= CREATE_NO_WINDOW; - if (process_get_shell_arguments (proc_start_info, &cmd) == FALSE) { + if (process_get_shell_arguments (&coop, &cmd, error) == FALSE) { + // FIXME This should be passed back separately. process_info->pid = -ERROR_FILE_NOT_FOUND; - return FALSE; + ret = FALSE; + goto exit; } if (process_info->env_variables) { - gint i, len; - MonoString *var; - gunichar2 *str, *ptr; + MonoArrayHandle array = MONO_HANDLE_NEW (MonoArray, process_info->env_variables); + MonoStringHandle var = MONO_HANDLE_NEW (MonoString, NULL); + gsize const array_length = mono_array_handle_length (array); + gsize len = 1; // nul-terminated - len = 0; - - for (i = 0; i < mono_array_length (process_info->env_variables); i++) { - var = mono_array_get (process_info->env_variables, MonoString*, i); - - len += mono_string_length (var) * sizeof (gunichar2); - - /* null-separated */ - len += sizeof (gunichar2); + for (gsize i = 0; i < array_length; i++) { + MONO_HANDLE_ARRAY_GETREF (var, array, i); + len += mono_string_handle_length (var) + 1; // nul-separated } - /* null-terminated */ - len += sizeof (gunichar2); - env_vars = ptr = g_new0 (gunichar2, len); + gunichar2 *ptr = g_new0 (gunichar2, len); + env_vars = ptr; - for (i = 0; i < mono_array_length (process_info->env_variables); i++) { - var = mono_array_get (process_info->env_variables, MonoString*, i); - - memcpy (ptr, mono_string_chars (var), mono_string_length (var) * sizeof (gunichar2)); - ptr += mono_string_length (var); + for (gsize i = 0; i < array_length; i++) { + MONO_HANDLE_ARRAY_GETREF (var, array, i); + gchandle_t gchandle = 0; + memcpy (ptr, mono_string_handle_pin_chars (var, &gchandle), mono_string_handle_length (var) * sizeof (gunichar2)); + mono_gchandle_free (gchandle); + ptr += mono_string_handle_length (var); ptr += 1; // Skip over the null-separator } } @@ -321,12 +329,10 @@ ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStart /* The default dir name is "". Turn that into NULL to mean * "current directory" */ - if (proc_start_info->working_directory == NULL || mono_string_length (proc_start_info->working_directory) == 0) - dir = NULL; - else - dir = mono_string_chars (proc_start_info->working_directory); + if (coop.length.working_directory) + dir = coop.working_directory; - ret = mono_process_create_process (process_info, cmd, creation_flags, env_vars, dir, &startinfo, &procinfo); + ret = mono_process_create_process (&coop, process_info, cmd, creation_flags, env_vars, dir, &startinfo, &procinfo); g_free (env_vars); @@ -337,9 +343,12 @@ ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStart CloseHandle (procinfo.hThread); process_info->pid = procinfo.dwProcessId; } else { + // FIXME This should be passed back separately. process_info->pid = -GetLastError (); } - + +exit: + mono_createprocess_coop_cleanup (&coop); return ret; } @@ -403,14 +412,14 @@ ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess (gpointer handle, gint3 MonoBoolean ves_icall_Microsoft_Win32_NativeMethods_GetExitCodeProcess (gpointer handle, gint32 *exitcode, MonoError *error) { - return GetExitCodeProcess (handle, exitcode); + return GetExitCodeProcess (handle, (PDWORD)exitcode); } #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) static inline MonoBoolean mono_icall_get_process_working_set_size (gpointer handle, gsize *min, gsize *max) { - return GetProcessWorkingSetSize (handle, min, max); + return GetProcessWorkingSetSize (handle, (PSIZE_T)min, (PSIZE_T)max); } #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ diff --git a/mono/metadata/w32process.c b/mono/metadata/w32process.c index 9bca41ee5b..9f720bb892 100644 --- a/mono/metadata/w32process.c +++ b/mono/metadata/w32process.c @@ -28,9 +28,9 @@ mono_w32process_get_pid (gpointer handle) } static gboolean -mono_w32process_try_get_modules (gpointer process, gpointer *modules, guint32 size, guint32 *needed) +mono_w32process_try_get_modules (gpointer process, HMODULE *modules, guint32 size, PDWORD needed) { - return EnumProcessModules (process, (HMODULE *) modules, size, (LPDWORD) needed); + return EnumProcessModules (process, modules, size, needed); } static guint32 @@ -54,7 +54,7 @@ mono_w32process_module_get_information (gpointer process, gpointer module, MODUL static gboolean mono_w32process_get_fileversion_info (gunichar2 *filename, gpointer *data) { - guint32 handle; + DWORD handle; gsize datasize; g_assert (data); @@ -142,7 +142,7 @@ process_set_field_object (MonoObject *obj, const gchar *fieldname, MonoObject *d klass = mono_object_class (obj); g_assert (klass); - field = mono_class_get_field_from_name (klass, fieldname); + field = mono_class_get_field_from_name_full (klass, fieldname, NULL); g_assert (field); mono_gc_wbarrier_generic_store (((char *)obj) + field->offset, data); @@ -166,7 +166,7 @@ process_set_field_string (MonoObject *obj, const gchar *fieldname, const gunicha klass = mono_object_class (obj); g_assert (klass); - field = mono_class_get_field_from_name (klass, fieldname); + field = mono_class_get_field_from_name_full (klass, fieldname, NULL); g_assert (field); string = mono_string_new_utf16_checked (domain, val, len, error); @@ -192,7 +192,7 @@ process_set_field_string_char (MonoObject *obj, const gchar *fieldname, const gc klass = mono_object_class (obj); g_assert (klass); - field = mono_class_get_field_from_name (klass, fieldname); + field = mono_class_get_field_from_name_full (klass, fieldname, NULL); g_assert (field); string = mono_string_new_checked (domain, val, error); @@ -212,7 +212,7 @@ process_set_field_int (MonoObject *obj, const gchar *fieldname, guint32 val) klass = mono_object_class (obj); g_assert (klass); - field = mono_class_get_field_from_name (klass, fieldname); + field = mono_class_get_field_from_name_full (klass, fieldname, NULL); g_assert (field); *(guint32 *)(((char *)obj) + field->offset)=val; @@ -229,7 +229,7 @@ process_set_field_intptr (MonoObject *obj, const gchar *fieldname, gpointer val) klass = mono_object_class (obj); g_assert (klass); - field = mono_class_get_field_from_name (klass, fieldname); + field = mono_class_get_field_from_name_full (klass, fieldname, NULL); g_assert (field); *(gpointer *)(((char *)obj) + field->offset) = val; @@ -246,7 +246,7 @@ process_set_field_bool (MonoObject *obj, const gchar *fieldname, gboolean val) klass = mono_object_class (obj); g_assert (klass); - field = mono_class_get_field_from_name (klass, fieldname); + field = mono_class_get_field_from_name_full (klass, fieldname, NULL); g_assert (field); *(guint8 *)(((char *)obj) + field->offset) = val; @@ -672,3 +672,48 @@ ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, *error = perror; return res; } + +static void +mono_pin_string (MonoStringHandle in_coophandle, MonoStringHandle *out_coophandle, gunichar2 **chars, gsize *length, gchandle_t *gchandle) +{ + *out_coophandle = in_coophandle; + if (!MONO_HANDLE_IS_NULL (in_coophandle)) { + *chars = mono_string_handle_pin_chars (in_coophandle, gchandle); + *length = mono_string_handle_length (in_coophandle); + } +} + +void +mono_createprocess_coop_init (MonoCreateProcessCoop *coop, MonoW32ProcessStartInfoHandle proc_start_info, MonoW32ProcessInfo *process_info) +{ + memset (coop, 0, sizeof (*coop)); + +#define PIN_STRING(h, x) (mono_pin_string (h, &coop->coophandle.x, &coop->x, &coop->length.x, &coop->gchandle.x)) + +#define PIN(x) PIN_STRING (MONO_HANDLE_NEW_GET (MonoString, proc_start_info, x), x) + PIN (filename); + PIN (arguments); + PIN (working_directory); + PIN (verb); +#undef PIN +#define PIN(x) PIN_STRING (MONO_HANDLE_NEW (MonoString, process_info->x), x) + PIN (username); + PIN (domain); +#undef PIN +} + +static void +mono_unpin_array (gchandle_t *gchandles, gsize count) +{ + for (gsize i = 0; i < count; ++i) { + mono_gchandle_free (gchandles [i]); + gchandles [i] = 0; + } +} + +void +mono_createprocess_coop_cleanup (MonoCreateProcessCoop *coop) +{ + mono_unpin_array ((gchandle_t*)&coop->gchandle, sizeof (coop->gchandle) / sizeof (gchandle_t)); + memset (coop, 0, sizeof (*coop)); +} diff --git a/mono/metadata/w32process.h b/mono/metadata/w32process.h index 1f82f970a3..4d32fb2214 100644 --- a/mono/metadata/w32process.h +++ b/mono/metadata/w32process.h @@ -19,6 +19,8 @@ #endif #include +#include "object-internals.h" +#include "marshal.h" G_BEGIN_DECLS @@ -38,7 +40,7 @@ typedef struct MonoArray *env_variables; MonoString *username; MonoString *domain; - gpointer password; /* BSTR from SecureString in 2.0 profile */ + mono_bstr password; /* BSTR from SecureString in 2.0 profile */ MonoBoolean load_user_profile; } MonoW32ProcessInfo; @@ -53,21 +55,68 @@ typedef struct MonoBoolean error_dialog; gpointer error_dialog_parent_handle; MonoBoolean use_shell_execute; - MonoString *username; - MonoString *domain; - MonoObject *password; /* SecureString in 2.0 profile, dummy in 1.x */ - MonoString *password_in_clear_text; - MonoBoolean load_user_profile; - MonoBoolean redirect_standard_input; - MonoBoolean redirect_standard_output; - MonoBoolean redirect_standard_error; - MonoObject *encoding_stdout; - MonoObject *encoding_stderr; + + MonoString *unused_username; + MonoString *unused_domain; + MonoObject *unused_password; /* SecureString in 2.0 profile, dummy in 1.x */ + MonoString *unused_password_in_clear_text; + MonoBoolean unused_load_user_profile; + MonoBoolean unused_redirect_standard_input; + MonoBoolean unused_redirect_standard_output; + MonoBoolean unused_redirect_standard_error; + MonoObject *unused_encoding_stdout; + MonoObject *unused_encoding_stderr; + MonoBoolean create_no_window; - MonoObject *weak_parent_process; - MonoObject *envVars; + + MonoObject *unused_weak_parent_process; + MonoObject *unused_envVars; + } MonoW32ProcessStartInfo; +TYPED_HANDLE_DECL (MonoW32ProcessStartInfo); + +typedef uint32_t gchandle_t; // FIXME use this more, make it typesafe. + +typedef struct _MonoCreateProcessCoop { + gunichar2 *filename; + gunichar2 *arguments; + gunichar2 *working_directory; + gunichar2 *verb; + gunichar2 *username; + gunichar2 *domain; + struct { + MonoStringHandle filename; + MonoStringHandle arguments; + MonoStringHandle working_directory; + MonoStringHandle verb; + MonoStringHandle username; + MonoStringHandle domain; + } coophandle; + struct { + gchandle_t filename; + gchandle_t arguments; + gchandle_t working_directory; + gchandle_t verb; + gchandle_t username; + gchandle_t domain; + } gchandle; + struct { + gsize filename; + gsize arguments; + gsize working_directory; + gsize verb; + gsize username; + gsize domain; + } length; +} MonoCreateProcessCoop; + +void +mono_createprocess_coop_init (MonoCreateProcessCoop *coop, MonoW32ProcessStartInfoHandle proc_start_info, MonoW32ProcessInfo *process_info); + +void +mono_createprocess_coop_cleanup (MonoCreateProcessCoop *coop); + void mono_w32process_init (void); @@ -100,11 +149,11 @@ void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename); MonoBoolean -ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_handle); +ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfoHandle proc_start_info, MonoW32ProcessInfo *process_info, MonoError *error); MonoBoolean -ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStartInfo *proc_start_info, gpointer stdin_handle, - gpointer stdout_handle, gpointer stderr_handle, MonoW32ProcessInfo *process_handle); +ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoW32ProcessStartInfoHandle proc_start_info, gpointer stdin_handle, + gpointer stdout_handle, gpointer stderr_handle, MonoW32ProcessInfo *process_handle, MonoError *error); MonoString* ves_icall_System_Diagnostics_Process_ProcessName_internal (gpointer process); diff --git a/mono/metadata/w32semaphore-unix.c b/mono/metadata/w32semaphore-unix.c index 4a13b56942..22e30a2f13 100644 --- a/mono/metadata/w32semaphore-unix.c +++ b/mono/metadata/w32semaphore-unix.c @@ -103,7 +103,7 @@ static gsize namedsema_typesize (void) void mono_w32semaphore_init (void) { - static MonoW32HandleOps sem_ops = { + static const MonoW32HandleOps sem_ops = { NULL, /* close */ sem_handle_signal, /* signal */ sem_handle_own, /* own */ @@ -115,7 +115,7 @@ mono_w32semaphore_init (void) sema_typesize, /* typesize */ }; - static MonoW32HandleOps namedsem_ops = { + static const MonoW32HandleOps namedsem_ops = { NULL, /* close */ sem_handle_signal, /* signal */ sem_handle_own, /* own */ diff --git a/mono/metadata/w32semaphore-win32.c b/mono/metadata/w32semaphore-win32.c index ca4ec59b43..ae03377d66 100644 --- a/mono/metadata/w32semaphore-win32.c +++ b/mono/metadata/w32semaphore-win32.c @@ -35,7 +35,7 @@ ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCou MonoBoolean ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (gpointer handle, gint32 releaseCount, gint32 *prevcount) { - return ReleaseSemaphore (handle, releaseCount, prevcount); + return ReleaseSemaphore (handle, releaseCount, (PLONG)prevcount); } gpointer diff --git a/mono/metadata/w32semaphore.h b/mono/metadata/w32semaphore.h index 13c963a10a..3aba7b3e07 100644 --- a/mono/metadata/w32semaphore.h +++ b/mono/metadata/w32semaphore.h @@ -7,19 +7,22 @@ #include #include - #include "object.h" #include "w32handle-namespace.h" +#include void mono_w32semaphore_init (void); +ICALL_EXPORT gpointer ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCount, gint32 maximumCount, MonoString *name, gint32 *error); +ICALL_EXPORT MonoBoolean ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (gpointer handle, gint32 releaseCount, gint32 *prevcount); +ICALL_EXPORT gpointer ves_icall_System_Threading_Semaphore_OpenSemaphore_internal (MonoString *name, gint32 rights, gint32 *error); diff --git a/mono/metadata/w32socket-unix.c b/mono/metadata/w32socket-unix.c index d675b53e66..c5bf6f1cbe 100644 --- a/mono/metadata/w32socket-unix.c +++ b/mono/metadata/w32socket-unix.c @@ -122,10 +122,10 @@ socket_data_destroy (MonoFDHandle *fdhandle) void mono_w32socket_initialize (void) { - MonoFDHandleCallback socket_data_callbacks = { - .close = socket_data_close, - .destroy = socket_data_destroy - }; + MonoFDHandleCallback socket_data_callbacks; + memset (&socket_data_callbacks, 0, sizeof (socket_data_callbacks)); + socket_data_callbacks.close = socket_data_close; + socket_data_callbacks.destroy = socket_data_destroy; mono_fdhandle_register (MONO_FDTYPE_SOCKET, &socket_data_callbacks); } diff --git a/mono/metadata/w32socket-win32.c b/mono/metadata/w32socket-win32.c index 6ef4d3618a..af677cc4cd 100644 --- a/mono/metadata/w32socket-win32.c +++ b/mono/metadata/w32socket-win32.c @@ -177,7 +177,7 @@ int mono_w32socket_recvbuffers (SOCKET s, WSABUF *lpBuffers, guint32 dwBufferCou { int ret = SOCKET_ERROR; MONO_ENTER_GC_SAFE; - ALERTABLE_SOCKET_CALL (FD_READ_BIT, blocking, TRUE, ret, WSARecv, s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags, lpOverlapped, lpCompletionRoutine); + ALERTABLE_SOCKET_CALL (FD_READ_BIT, blocking, TRUE, ret, WSARecv, s, lpBuffers, dwBufferCount, (PDWORD)lpNumberOfBytesRecvd, (PDWORD)lpFlags, lpOverlapped, lpCompletionRoutine); MONO_EXIT_GC_SAFE; return ret; } @@ -204,7 +204,7 @@ int mono_w32socket_sendbuffers (SOCKET s, WSABUF *lpBuffers, guint32 dwBufferCou { int ret = SOCKET_ERROR; MONO_ENTER_GC_SAFE; - ALERTABLE_SOCKET_CALL (FD_WRITE_BIT, blocking, TRUE, ret, WSASend, s, lpBuffers, dwBufferCount, lpNumberOfBytesRecvd, lpFlags, lpOverlapped, lpCompletionRoutine); + ALERTABLE_SOCKET_CALL (FD_WRITE_BIT, blocking, TRUE, ret, WSASend, s, lpBuffers, dwBufferCount, (PDWORD)lpNumberOfBytesRecvd, lpFlags, lpOverlapped, lpCompletionRoutine); MONO_EXIT_GC_SAFE; return ret; } diff --git a/mono/metadata/w32socket.c b/mono/metadata/w32socket.c index 11a88c7406..bd722f8299 100644 --- a/mono/metadata/w32socket.c +++ b/mono/metadata/w32socket.c @@ -215,12 +215,6 @@ mono_w32socket_close (SOCKET sock) #endif /* HOST_WIN32 */ -static void -abort_syscall (gpointer data) -{ - mono_thread_info_abort_socket_syscall_for_close ((MonoNativeThreadId) (gsize) data); -} - static gint32 convert_family (MonoAddressFamily mono_family) { @@ -722,7 +716,7 @@ get_socket_assembly (void) if (!sa) { g_assert_not_reached (); } else { - socket_assembly = mono_assembly_get_image (sa); + socket_assembly = mono_assembly_get_image_internal (sa); } } mono_atomic_store_release (&domain->socket_assembly, socket_assembly); @@ -831,28 +825,16 @@ ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean bloc gpointer ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *werror, gboolean blocking, MonoError *error) { - gboolean interrupted; SOCKET newsock; error_init (error); *werror = 0; - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - *werror = WSAEINTR; + newsock = mono_w32socket_accept (sock, NULL, 0, blocking); + if (newsock == INVALID_SOCKET) { + *werror = mono_w32socket_get_last_error (); return NULL; } - - newsock = mono_w32socket_accept (sock, NULL, 0, blocking); - if (newsock == INVALID_SOCKET) - *werror = mono_w32socket_get_last_error (); - - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) - *werror = WSAEINTR; - - if (*werror) - return NULL; return GUINT_TO_POINTER (newsock); } @@ -907,13 +889,13 @@ create_object_handle_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 /* Locate the SocketAddress data buffer in the object */ if (!domain->sockaddr_data_field) { - domain->sockaddr_data_field = mono_class_get_field_from_name (domain->sockaddr_class, "m_Buffer"); + domain->sockaddr_data_field = mono_class_get_field_from_name_full (domain->sockaddr_class, "m_Buffer", NULL); g_assert (domain->sockaddr_data_field); } /* Locate the SocketAddress data buffer length in the object */ if (!domain->sockaddr_data_length_field) { - domain->sockaddr_data_length_field = mono_class_get_field_from_name (domain->sockaddr_class, "m_Size"); + domain->sockaddr_data_length_field = mono_class_get_field_from_name_full (domain->sockaddr_class, "m_Size", NULL); g_assert (domain->sockaddr_data_length_field); } @@ -1057,7 +1039,7 @@ ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 a salen = get_sockaddr_size (convert_family ((MonoAddressFamily)af)); if (salen == 0) { *werror = WSAEAFNOSUPPORT; - return NULL; + return NULL_HANDLE; } sa = (salen <= 128) ? (gchar *)alloca (salen) : (gchar *)g_malloc0 (salen); @@ -1125,13 +1107,13 @@ create_sockaddr_from_handle (MonoObjectHandle saddr_obj, socklen_t *sa_size, gin /* Locate the SocketAddress data buffer in the object */ if (!domain->sockaddr_data_field) { - domain->sockaddr_data_field = mono_class_get_field_from_name (domain->sockaddr_class, "m_Buffer"); + domain->sockaddr_data_field = mono_class_get_field_from_name_full (domain->sockaddr_class, "m_Buffer", NULL); g_assert (domain->sockaddr_data_field); } /* Locate the SocketAddress data buffer length in the object */ if (!domain->sockaddr_data_length_field) { - domain->sockaddr_data_length_field = mono_class_get_field_from_name (domain->sockaddr_class, "m_Size"); + domain->sockaddr_data_length_field = mono_class_get_field_from_name_full (domain->sockaddr_class, "m_Size", NULL); g_assert (domain->sockaddr_data_length_field); } @@ -1274,7 +1256,6 @@ ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode, MonoInternalThread *thread = mono_thread_internal_current (); mono_pollfd *pfds; int ret; - gboolean interrupted; time_t start; error_init (error); @@ -1299,26 +1280,12 @@ ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode, start = time (NULL); do { - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - g_free (pfds); - *werror = WSAEINTR; - return FALSE; - } - MONO_ENTER_GC_SAFE; ret = mono_poll (pfds, 1, timeout); MONO_EXIT_GC_SAFE; - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) { - g_free (pfds); - *werror = WSAEINTR; - return FALSE; - } - if (timeout > 0 && ret < 0) { int err = errno; int sec = time (NULL) - start; @@ -1360,7 +1327,6 @@ ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObjectHand struct sockaddr *sa; socklen_t sa_size; int ret; - gboolean interrupted; error_init (error); *werror = 0; @@ -1372,20 +1338,10 @@ ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObjectHand LOGDEBUG (g_message("%s: connecting to %s port %d", __func__, inet_ntoa (((struct sockaddr_in *)sa)->sin_addr), ntohs (((struct sockaddr_in *)sa)->sin_port))); - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - *werror = WSAEINTR; - return; - } - ret = mono_w32socket_connect (sock, sa, sa_size, blocking); if (ret == SOCKET_ERROR) *werror = mono_w32socket_get_last_error (); - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) - *werror = WSAEINTR; - g_free (sa); } @@ -1394,23 +1350,11 @@ ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObjectHand void ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *werror, MonoError *error) { - gboolean interrupted; - error_init (error); LOGDEBUG (g_message("%s: disconnecting from socket %p (reuse %d)", __func__, sock, reuse)); - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - *werror = WSAEINTR; - return; - } - *werror = mono_w32socket_disconnect (sock, reuse); - - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) - *werror = WSAEINTR; } #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */ @@ -1433,7 +1377,6 @@ ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, gchar *buffer, { int ret; int recvflags = 0; - gboolean interrupted; error_init (error); *werror = 0; @@ -1444,21 +1387,11 @@ ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, gchar *buffer, return 0; } - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) - return 0; - ret = mono_w32socket_recv (sock, buffer, count, recvflags, blocking); - - if (ret == SOCKET_ERROR) + if (ret == SOCKET_ERROR) { *werror = mono_w32socket_get_last_error (); - - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) - *werror = WSAEINTR; - - if (*werror) return 0; + } return ret; } @@ -1467,7 +1400,6 @@ gint32 ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, WSABUF *buffers, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error) { int ret; - gboolean interrupted; guint32 recv; guint32 recvflags = 0; @@ -1480,24 +1412,12 @@ ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, WSABUF * return 0; } - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - *werror = WSAEINTR; + ret = mono_w32socket_recvbuffers (sock, buffers, count, &recv, &recvflags, NULL, NULL, blocking); + if (ret == SOCKET_ERROR) { + *werror = mono_w32socket_get_last_error (); return 0; } - ret = mono_w32socket_recvbuffers (sock, buffers, count, &recv, &recvflags, NULL, NULL, blocking); - - if (ret == SOCKET_ERROR) - *werror = mono_w32socket_get_last_error (); - - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) - *werror = WSAEINTR; - - if (*werror) - return 0; - return recv; } @@ -1508,7 +1428,6 @@ ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, gchar *buf int recvflags = 0; struct sockaddr *sa; socklen_t sa_size; - gboolean interrupted; error_init (error); *werror = 0; @@ -1525,24 +1444,9 @@ ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, gchar *buf return 0; } - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - g_free (sa); - *werror = WSAEINTR; - return 0; - } - ret = mono_w32socket_recvfrom (sock, buffer, count, recvflags, sa, &sa_size, blocking); - - if (ret == SOCKET_ERROR) + if (ret == SOCKET_ERROR) { *werror = mono_w32socket_get_last_error (); - - mono_thread_info_uninstall_interrupt (&interrupted); - - if (interrupted) - *werror = WSAEINTR; - - if (*werror) { g_free(sa); return 0; } @@ -1571,7 +1475,6 @@ ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, gchar *buffer, gi { int ret; int sendflags = 0; - gboolean interrupted; error_init (error); *werror = 0; @@ -1584,24 +1487,12 @@ ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, gchar *buffer, gi return 0; } - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - *werror = WSAEINTR; + ret = mono_w32socket_send (sock, buffer, count, sendflags, blocking); + if (ret == SOCKET_ERROR) { + *werror = mono_w32socket_get_last_error (); return 0; } - ret = mono_w32socket_send (sock, buffer, count, sendflags, blocking); - - if (ret == SOCKET_ERROR) - *werror = mono_w32socket_get_last_error (); - - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) - *werror = WSAEINTR; - - if (*werror) - return 0; - return ret; } @@ -1611,7 +1502,6 @@ ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, WSABUF *buf int ret; guint32 sent; guint32 sendflags = 0; - gboolean interrupted; error_init (error); *werror = 0; @@ -1622,24 +1512,12 @@ ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, WSABUF *buf return 0; } - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - *werror = WSAEINTR; + ret = mono_w32socket_sendbuffers (sock, buffers, count, &sent, sendflags, NULL, NULL, blocking); + if (ret == SOCKET_ERROR) { + *werror = mono_w32socket_get_last_error (); return 0; } - ret = mono_w32socket_sendbuffers (sock, buffers, count, &sent, sendflags, NULL, NULL, blocking); - - if (ret == SOCKET_ERROR) - *werror = mono_w32socket_get_last_error (); - - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) - *werror = WSAEINTR; - - if (*werror) - return 0; - return sent; } @@ -1650,45 +1528,30 @@ ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, gchar *buffer, int sendflags = 0; struct sockaddr *sa; socklen_t sa_size; - gboolean interrupted; *werror = 0; sa = create_sockaddr_from_handle (sockaddr, &sa_size, werror, error); - if (*werror != 0) + if (*werror != 0 || !is_ok (error)) return 0; - return_val_if_nok (error, 0); LOGDEBUG (g_message("%s: Sending %d bytes", __func__, count)); sendflags = convert_socketflags (flags); if (sendflags == -1) { - g_free (sa); *werror = WSAEOPNOTSUPP; - return 0; - } - - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { g_free (sa); - *werror = WSAEINTR; return 0; } ret = mono_w32socket_sendto (sock, buffer, count, sendflags, sa, sa_size, blocking); - - if (ret == SOCKET_ERROR) + if (ret == SOCKET_ERROR) { *werror = mono_w32socket_get_last_error (); - - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) - *werror = WSAEINTR; + g_free(sa); + return 0; + } g_free(sa); - - if (*werror) - return 0; - return ret; } @@ -1697,7 +1560,7 @@ Socket_to_SOCKET (MonoObjectHandle sockobj) { MonoClassField *field; - field = mono_class_get_field_from_name (mono_handle_class (sockobj), "m_Handle"); + field = mono_class_get_field_from_name_full (mono_handle_class (sockobj), "m_Handle", NULL); MonoSafeHandleHandle safe_handle = MONO_HANDLE_NEW_GET_FIELD(sockobj, MonoSafeHandle, field); if (MONO_HANDLE_IS_NULL (safe_handle)) @@ -1773,7 +1636,6 @@ ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArrayHandle sockets, gi MonoClass *sock_arr_class; time_t start; uintptr_t socks_size; - gboolean interrupted; error_init (error); *werror = 0; @@ -1795,26 +1657,12 @@ ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArrayHandle sockets, gi timeout = (timeout >= 0) ? (timeout / 1000) : -1; start = time (NULL); do { - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - g_free (pfds); - *werror = WSAEINTR; - return; - } - MONO_ENTER_GC_SAFE; ret = mono_poll (pfds, nfds, timeout); MONO_EXIT_GC_SAFE; - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) { - g_free (pfds); - *werror = WSAEINTR; - return; - } - if (timeout > 0 && ret < 0) { int err = errno; int sec = time (NULL) - start; @@ -1963,10 +1811,10 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gi /* Locate and set the fields "bool enabled" and "int * lingerTime" */ - field = mono_class_get_field_from_name(obj_class, "enabled"); + field = mono_class_get_field_from_name_full (obj_class, "enabled", NULL); MONO_HANDLE_SET_FIELD_VAL (obj, guint8, field, linger.l_onoff); - field = mono_class_get_field_from_name(obj_class, "lingerTime"); + field = mono_class_get_field_from_name_full (obj_class, "lingerTime", NULL); MONO_HANDLE_SET_FIELD_VAL (obj, guint32, field, linger.l_linger); MONO_HANDLE_ASSIGN (obj_val, obj); @@ -2005,7 +1853,7 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gi *werror = WSAENOPROTOOPT; return; } else { - mono_posix_image = mono_assembly_get_image (sa); + mono_posix_image = mono_assembly_get_image_internal (sa); } } } @@ -2013,7 +1861,7 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gi obj_class = mono_class_load_from_name (mono_posix_image, "Mono.Posix", "PeerCredData"); - MonoPeerCredDataHandle cred_data = (MonoPeerCredDataHandle)mono_object_new_handle (domain, obj_class, error); + MonoPeerCredDataHandle cred_data = MONO_HANDLE_CAST (MonoPeerCredData, mono_object_new_handle (domain, obj_class, error)); return_if_nok (error); MONO_HANDLE_SETVAL (cred_data, pid, gint, cred.pid); @@ -2078,7 +1926,7 @@ ipaddress_handle_to_struct_in_addr (MonoObjectHandle ipaddr) struct in_addr inaddr; MonoClassField *field; - field = mono_class_get_field_from_name (mono_handle_class (ipaddr), "m_Address"); + field = mono_class_get_field_from_name_full (mono_handle_class (ipaddr), "m_Address", NULL); g_assert (field); /* No idea why .net uses a 64bit type to hold a 32bit value... @@ -2098,7 +1946,7 @@ ipaddress_handle_to_struct_in6_addr (MonoObjectHandle ipaddr) MonoClassField *field; int i; - field = mono_class_get_field_from_name (mono_handle_class (ipaddr), "m_Numbers"); + field = mono_class_get_field_from_name_full (mono_handle_class (ipaddr), "m_Numbers", NULL); g_assert (field); MonoArrayHandle data = MONO_HANDLE_NEW_GET_FIELD (ipaddr, MonoArray, field); @@ -2200,9 +2048,9 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 /* Dig out "bool enabled" and "int lingerTime" * fields */ - field = mono_class_get_field_from_name (obj_class, "enabled"); + field = mono_class_get_field_from_name_full (obj_class, "enabled", NULL); linger.l_onoff = MONO_HANDLE_GET_FIELD_VAL (obj_val, guint8, field); - field = mono_class_get_field_from_name (obj_class, "lingerTime"); + field = mono_class_get_field_from_name_full (obj_class, "lingerTime", NULL); linger.l_linger = MONO_HANDLE_GET_FIELD_VAL (obj_val, guint32, field); valsize = sizeof (linger); @@ -2220,14 +2068,14 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 /* * Get group address */ - field = mono_class_get_field_from_name (obj_class, "m_Group"); + field = mono_class_get_field_from_name_full (obj_class, "m_Group", NULL); g_assert (field); MONO_HANDLE_ASSIGN (address, MONO_HANDLE_NEW_GET_FIELD (obj_val, MonoObject, field)); if (!MONO_HANDLE_IS_NULL (address)) mreq6.ipv6mr_multiaddr = ipaddress_handle_to_struct_in6_addr (address); - field = mono_class_get_field_from_name (obj_class, "m_Interface"); + field = mono_class_get_field_from_name_full (obj_class, "m_Interface", NULL); mreq6.ipv6mr_interface = MONO_HANDLE_GET_FIELD_VAL (obj_val, guint64, field); #if defined(__APPLE__) || defined(__FreeBSD__) @@ -2262,7 +2110,7 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 * members, so I have to dig the value out of * those :-( */ - field = mono_class_get_field_from_name (obj_class, "group"); + field = mono_class_get_field_from_name_full (obj_class, "group", NULL); MONO_HANDLE_ASSIGN (address, MONO_HANDLE_NEW_GET_FIELD (obj_val, MonoObject, field)); /* address might not be defined and if so, set the address to ADDR_ANY. @@ -2270,14 +2118,14 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 if (!MONO_HANDLE_IS_NULL (address)) mreq.imr_multiaddr = ipaddress_handle_to_struct_in_addr (address); - field = mono_class_get_field_from_name (obj_class, "localAddress"); + field = mono_class_get_field_from_name_full (obj_class, "localAddress", NULL); MONO_HANDLE_ASSIGN (address, MONO_HANDLE_NEW_GET_FIELD (obj_val, MonoObject, field)); #ifdef HAVE_STRUCT_IP_MREQN if (!MONO_HANDLE_IS_NULL (address)) mreq.imr_address = ipaddress_handle_to_struct_in_addr (address); - field = mono_class_get_field_from_name (obj_class, "ifIndex"); + field = mono_class_get_field_from_name_full (obj_class, "ifIndex", NULL); mreq.imr_ifindex = MONO_HANDLE_GET_FIELD_VAL (obj_val, gint32, field); #else if (!MONO_HANDLE_IS_NULL (address)) @@ -2394,27 +2242,14 @@ void ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *werror, MonoError *error) { int ret; - gboolean interrupted; error_init (error); *werror = 0; - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - *werror = WSAEINTR; - return; - } - /* Currently, the values for how (recv=0, send=1, both=2) match the BSD API */ ret = mono_w32socket_shutdown (sock, how); if (ret == SOCKET_ERROR) *werror = mono_w32socket_get_last_error (); - - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) { - *werror = WSAEINTR; - } - } gint @@ -2732,7 +2567,6 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHan { HANDLE file; gboolean ret; - gboolean interrupted; TRANSMIT_FILE_BUFFERS buffers; uint32_t pre_buffer_gchandle = 0; uint32_t post_buffer_gchandle = 0; @@ -2754,14 +2588,6 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHan return FALSE; } - mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted); - if (interrupted) { - mono_w32file_close (file); - mono_w32error_set_last (WSAEINTR); - return FALSE; - } - - memset (&buffers, 0, sizeof (buffers)); if (!MONO_HANDLE_IS_NULL (pre_buffer)) { buffers.Head = MONO_ARRAY_HANDLE_PIN (pre_buffer, guchar, 0, &pre_buffer_gchandle); @@ -2782,13 +2608,6 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHan if (!ret) *werror = mono_w32socket_get_last_error (); - mono_thread_info_uninstall_interrupt (&interrupted); - if (interrupted) { - mono_w32file_close (file); - *werror = WSAEINTR; - return FALSE; - } - mono_w32file_close (file); if (*werror) diff --git a/mono/metadata/w32socket.h b/mono/metadata/w32socket.h index 9a8928191c..67c8d30d04 100644 --- a/mono/metadata/w32socket.h +++ b/mono/metadata/w32socket.h @@ -13,8 +13,8 @@ #include #include - #include +#include #ifndef HOST_WIN32 #define INVALID_SOCKET ((SOCKET)(guint32)(~0)) @@ -174,114 +174,130 @@ typedef struct /* Safely access Mono.Posix.PeerCredData from native code */ TYPED_HANDLE_DECL (MonoPeerCredData); +ICALL_EXPORT gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObjectHandle this_obj, gint32 family, gint32 type, gint32 proto, gint32 *werror, MonoError *error); - +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Close_internal (gsize sock, gint32 *werror, MonoError *error); +ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal (void); +ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *werror, MonoError *error); +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean block, gint32 *werror, MonoError *error); +ICALL_EXPORT gpointer ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *werror, gboolean blocking, MonoError *error); +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Listen_internal (gsize sock, guint32 backlog, gint32 *werror, MonoError *error); +ICALL_EXPORT MonoObjectHandle ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error); +ICALL_EXPORT MonoObjectHandle ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error); +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Bind_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, MonoError *error); +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error); +ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, gchar *buffer, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error); - +ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, WSABUF *buffers, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error); - +ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, gchar *buffer, gint32 count, gint32 flags, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error); - - +ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, gchar *buffer, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error); - +ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, WSABUF *buffers, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error); - +ICALL_EXPORT gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, gchar *buffer, gint32 count, gint32 flags, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error); - +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArrayHandle sockets, gint32 timeout, gint32 *werror, MonoError *error); +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *werror, MonoError *error); +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gint32 level, gint32 name, MonoObjectHandle obj_val, gint32 *werror, MonoError *error); - +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (gsize sock, gint32 level, gint32 name, MonoArrayHandle byte_val, gint32 *werror, MonoError *error); - +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 level, gint32 name, MonoObjectHandle obj_val, MonoArrayHandle byte_val, gint32 int_val, gint32 *werror, MonoError *error); - +ICALL_EXPORT int ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code, MonoArrayHandle input, MonoArrayHandle output, gint32 *werror, MonoError *error); - +ICALL_EXPORT MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal (MonoStringHandle host, MonoStringHandleOut h_name, MonoArrayHandleOut h_aliases, MonoArrayHandleOut h_addr_list, gint32 hint, MonoError *error); - +ICALL_EXPORT MonoBoolean ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoStringHandle addr, MonoStringHandleOut h_name, MonoArrayHandleOut h_aliases, MonoArrayHandleOut h_addr_list, gint32 hint, MonoError *error); - +ICALL_EXPORT MonoBoolean ves_icall_System_Net_Dns_GetHostName_internal (MonoStringHandleOut h_name, MonoError *error); +ICALL_EXPORT MonoBoolean ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode, gint timeout, gint32 *werror, MonoError *error); +ICALL_EXPORT void ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *werror, MonoError *error); +ICALL_EXPORT MonoBoolean ves_icall_System_Net_Sockets_Socket_Duplicate_internal (gpointer handle, gint32 targetProcessId, gpointer *duplicate_handle, gint32 *werror, MonoError *error); +ICALL_EXPORT gboolean ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHandle filename, MonoArrayHandle pre_buffer, MonoArrayHandle post_buffer, @@ -290,6 +306,7 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHan void ves_icall_cancel_blocking_socket_operation (MonoThreadObjectHandle thread, MonoError *error); +ICALL_EXPORT gboolean ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto, MonoError *error); diff --git a/mono/metadata/w32subset.h b/mono/metadata/w32subset.h new file mode 100644 index 0000000000..f4ccd47173 --- /dev/null +++ b/mono/metadata/w32subset.h @@ -0,0 +1,108 @@ +/** + * \file + * Define Win32 API subset defaults. + * Other subsetters can fork this file, or + * define symbols ahead of it, or after it (with undef). + * + * Note that #if of an undefined symbols is defined as if 0, + * so that an implicit default here. + * + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ + +#ifndef HAVE_API_SUPPORT_WIN32_GET_COMPUTER_NAME +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_GET_COMPUTER_NAME 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_GET_DRIVE_TYPE +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_GET_DRIVE_TYPE 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_REPLACE_FILE +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_REPLACE_FILE 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_COPY_FILE +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_COPY_FILE 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_COPY_FILE2 // not on Windows7 +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_COPY_FILE2 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_LOCK_FILE +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_LOCK_FILE 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_UNLOCK_FILE +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_UNLOCK_FILE 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_MOVE_FILE +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_MOVE_FILE 0 +#elif G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_MOVE_FILE 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_MOVE_FILE_EX +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_MOVE_FILE_EX 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE 0 +#elif G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_GET_STD_HANDLE 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_GET_LOGICAL_DRIVE_STRINGS +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_GET_LOGICAL_DRIVE_STRINGS 0 +#elif G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_GET_LOGICAL_DRIVE_STRINGS 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_SH_GET_FOLDER_PATH +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_SH_GET_FOLDER_PATH 0 +#elif G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_SH_GET_FOLDER_PATH 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_SEND_MESSAGE_TIMEOUT +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_SEND_MESSAGE_TIMEOUT 0 +#elif G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_SEND_MESSAGE_TIMEOUT 1 +#endif +#endif + +#ifndef HAVE_API_SUPPORT_WIN32_WAIT_FOR_INPUT_IDLE +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_WAIT_FOR_INPUT_IDLE 0 +#elif G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#define HAVE_API_SUPPORT_WIN32_WAIT_FOR_INPUT_IDLE 1 +#endif +#endif diff --git a/mono/mini/Makefile.am b/mono/mini/Makefile.am index 8a23e50f67..4f3ef2faba 100644 --- a/mono/mini/Makefile.am +++ b/mono/mini/Makefile.am @@ -34,6 +34,21 @@ sgen_libs = \ $(monodir)/mono/utils/libmonoutils.la \ $(glib_libs) +if ENABLE_LLVM +-include $(mono_build_root)/llvm/llvm_config.mk +LLVM_CFLAGS=$(LLVM_CFLAGS_INTERNAL) $(LLVM_CFLAGS_EXTERNAL) +LLVM_CXXFLAGS=$(LLVM_CXXFLAGS_INTERNAL) $(LLVM_CXXFLAGS_EXTERNAL) +LLVM_LDFLAGS=$(LLVM_LDFLAGS_INTERNAL) $(LLVM_LDFLAGS_EXTERNAL) +LLVM_LIBS=$(LLVM_LIBS_INTERNAL) $(LLVM_LIBS_EXTERNAL) + +print-llvm-info: + echo "cflags: $(LLVM_CFLAGS)" + echo "cxxflags: $(LLVM_CXXFLAGS)" + echo "ldflags: $(LLVM_LDFLAGS)" + echo "libs: $(LLVM_LIBS)" +endif + + if FULL_AOT_TESTS # if the tests are going to run with framework assemblies compiled with # -d:MOBILE, tell the runtime to remap framework assemblies using the mobile @@ -158,8 +173,9 @@ if LOADED_LLVM lib_LTLIBRARIES += libmono-llvm.la libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp libmono_llvm_la_LIBADD = $(glib_libs) $(LLVM_LIBS) $(LLVM_LDFLAGS) + if HOST_DARWIN -libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace +libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace endif endif @@ -229,7 +245,7 @@ mono_boehm_LDADD = \ $(MONO_DTRACE_OBJECT) mono_boehm_LDFLAGS = \ - $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) + $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) mono_sgen_LDADD = \ $(MONO_SGEN_LIB) \ @@ -238,7 +254,7 @@ mono_sgen_LDADD = \ -lm \ $(MONO_DTRACE_OBJECT) -mono_sgen_LDFLAGS = $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) +mono_sgen_LDFLAGS = $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) if BITCODE libmonoldflags += -no-undefined @@ -280,6 +296,7 @@ endif wasm_sources = \ mini-wasm.c \ mini-wasm.h \ + mini-wasm-debugger.c \ debugger-engine.c \ exceptions-wasm.c \ tramp-wasm.c @@ -453,6 +470,7 @@ common_sources = \ debugger-agent.h \ debugger-engine.h \ debugger-agent-stubs.c \ + debugger-state-machine.h \ xdebug.c \ mini-llvm.h \ mini-llvm-cpp.h \ @@ -640,7 +658,7 @@ if !WASM extra_libmono_dbg_source = debugger-engine.c endif -libmono_dbg_la_SOURCES = debugger-agent.c $(extra_libmono_dbg_source) +libmono_dbg_la_SOURCES = debugger-agent.c debugger-state-machine.c $(extra_libmono_dbg_source) libmono_dbg_la_CFLAGS = $(mono_CFLAGS) if BITCODE if DISABLE_DEBUGGER_AGENT @@ -669,15 +687,18 @@ libmini_la_CFLAGS = $(mono_CFLAGS) libmonoboehm_2_0_la_SOURCES = libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS) libmonoboehm_2_0_la_LIBADD = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) -libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) +libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) libmonosgen_2_0_la_SOURCES = libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS) libmonosgen_2_0_la_LIBADD = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) -libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) +libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit +# These are public headers. +# They should not use glib.h, G_BEGIN_DECLS, guint, etc. +# They should be wrapped in MONO_BEGIN_DECLS / MONO_END_DECLS. libmonoinclude_HEADERS = jit.h CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649,0618 @@ -808,8 +829,9 @@ gsharedvtcheck: hybridcheck: $(MAKE) fullaotcheck HYBRID=1 +# FIXME: force preemptive suspend while interpreter doesn't support coop/hybird suspend fullaotmixedcheck: - $(MAKE) fullaotcheck MIXED=1 + $(MAKE) fullaotcheck MIXED=1 MONO_THREADS_SUSPEND=preemptive fullaot_regtests = $(regtests) fullaot_testing_deps = generics-variant-types.dll TestDriver.dll MemoryIntrinsics.dll @@ -975,9 +997,16 @@ patch-automake: tags: etags -o TAGS `find .. -name "*.h" -o -name "*.c"` +if ENABLE_LLVM +llvm_makefile_dep = $(mono_build_root)/llvm/llvm_config.mk +endif + if HAS_EXTENSION_MODULE else Makefile.am: Makefile.am.in echo "##################### Generated from Makefile.am.in, do not modify ##########################" > $@ cat $< >> $@ + endif + +CFLAGS := $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @CXX_ADD_CFLAGS@ diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index 8a23e50f67..4f3ef2faba 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -34,6 +34,21 @@ sgen_libs = \ $(monodir)/mono/utils/libmonoutils.la \ $(glib_libs) +if ENABLE_LLVM +-include $(mono_build_root)/llvm/llvm_config.mk +LLVM_CFLAGS=$(LLVM_CFLAGS_INTERNAL) $(LLVM_CFLAGS_EXTERNAL) +LLVM_CXXFLAGS=$(LLVM_CXXFLAGS_INTERNAL) $(LLVM_CXXFLAGS_EXTERNAL) +LLVM_LDFLAGS=$(LLVM_LDFLAGS_INTERNAL) $(LLVM_LDFLAGS_EXTERNAL) +LLVM_LIBS=$(LLVM_LIBS_INTERNAL) $(LLVM_LIBS_EXTERNAL) + +print-llvm-info: + echo "cflags: $(LLVM_CFLAGS)" + echo "cxxflags: $(LLVM_CXXFLAGS)" + echo "ldflags: $(LLVM_LDFLAGS)" + echo "libs: $(LLVM_LIBS)" +endif + + if FULL_AOT_TESTS # if the tests are going to run with framework assemblies compiled with # -d:MOBILE, tell the runtime to remap framework assemblies using the mobile @@ -158,8 +173,9 @@ if LOADED_LLVM lib_LTLIBRARIES += libmono-llvm.la libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp libmono_llvm_la_LIBADD = $(glib_libs) $(LLVM_LIBS) $(LLVM_LDFLAGS) + if HOST_DARWIN -libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace +libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace endif endif @@ -229,7 +245,7 @@ mono_boehm_LDADD = \ $(MONO_DTRACE_OBJECT) mono_boehm_LDFLAGS = \ - $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) + $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) mono_sgen_LDADD = \ $(MONO_SGEN_LIB) \ @@ -238,7 +254,7 @@ mono_sgen_LDADD = \ -lm \ $(MONO_DTRACE_OBJECT) -mono_sgen_LDFLAGS = $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) +mono_sgen_LDFLAGS = $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) if BITCODE libmonoldflags += -no-undefined @@ -280,6 +296,7 @@ endif wasm_sources = \ mini-wasm.c \ mini-wasm.h \ + mini-wasm-debugger.c \ debugger-engine.c \ exceptions-wasm.c \ tramp-wasm.c @@ -453,6 +470,7 @@ common_sources = \ debugger-agent.h \ debugger-engine.h \ debugger-agent-stubs.c \ + debugger-state-machine.h \ xdebug.c \ mini-llvm.h \ mini-llvm-cpp.h \ @@ -640,7 +658,7 @@ if !WASM extra_libmono_dbg_source = debugger-engine.c endif -libmono_dbg_la_SOURCES = debugger-agent.c $(extra_libmono_dbg_source) +libmono_dbg_la_SOURCES = debugger-agent.c debugger-state-machine.c $(extra_libmono_dbg_source) libmono_dbg_la_CFLAGS = $(mono_CFLAGS) if BITCODE if DISABLE_DEBUGGER_AGENT @@ -669,15 +687,18 @@ libmini_la_CFLAGS = $(mono_CFLAGS) libmonoboehm_2_0_la_SOURCES = libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS) libmonoboehm_2_0_la_LIBADD = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) -libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) +libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) libmonosgen_2_0_la_SOURCES = libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS) libmonosgen_2_0_la_LIBADD = libmini.la $(interp_libs_with_mini) $(dbg_libs_with_mini) $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) -libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) +libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit +# These are public headers. +# They should not use glib.h, G_BEGIN_DECLS, guint, etc. +# They should be wrapped in MONO_BEGIN_DECLS / MONO_END_DECLS. libmonoinclude_HEADERS = jit.h CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649,0618 @@ -808,8 +829,9 @@ gsharedvtcheck: hybridcheck: $(MAKE) fullaotcheck HYBRID=1 +# FIXME: force preemptive suspend while interpreter doesn't support coop/hybird suspend fullaotmixedcheck: - $(MAKE) fullaotcheck MIXED=1 + $(MAKE) fullaotcheck MIXED=1 MONO_THREADS_SUSPEND=preemptive fullaot_regtests = $(regtests) fullaot_testing_deps = generics-variant-types.dll TestDriver.dll MemoryIntrinsics.dll @@ -975,9 +997,16 @@ patch-automake: tags: etags -o TAGS `find .. -name "*.h" -o -name "*.c"` +if ENABLE_LLVM +llvm_makefile_dep = $(mono_build_root)/llvm/llvm_config.mk +endif + if HAS_EXTENSION_MODULE else Makefile.am: Makefile.am.in echo "##################### Generated from Makefile.am.in, do not modify ##########################" > $@ cat $< >> $@ + endif + +CFLAGS := $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @CXX_ADD_CFLAGS@ diff --git a/mono/mini/Makefile.in.REMOVED.git-id b/mono/mini/Makefile.in.REMOVED.git-id index 22bc9b53ce..3e119adf95 100644 --- a/mono/mini/Makefile.in.REMOVED.git-id +++ b/mono/mini/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -8a05fbf6f22cbe22fbd6226898404afe7e104140 \ No newline at end of file +f3443bae4d65727925223ee9da4ae2274e347298 \ No newline at end of file diff --git a/mono/mini/abcremoval.c b/mono/mini/abcremoval.c index 803d1f6dcc..2ca5a13a8f 100644 --- a/mono/mini/abcremoval.c +++ b/mono/mini/abcremoval.c @@ -23,7 +23,7 @@ #include "abcremoval.h" -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 #define OP_PCONST OP_I8CONST #else #define OP_PCONST OP_ICONST @@ -1227,10 +1227,10 @@ type_to_value_kind (MonoType *type) return MONO_UNSIGNED_INTEGER_VALUE_SIZE_4; break; case MONO_TYPE_I: - return (MonoIntegerValueKind)SIZEOF_VOID_P; + return (MonoIntegerValueKind)TARGET_SIZEOF_VOID_P; break; case MONO_TYPE_U: - return (MonoIntegerValueKind)(MONO_UNSIGNED_VALUE_FLAG | SIZEOF_VOID_P); + return (MonoIntegerValueKind)(MONO_UNSIGNED_VALUE_FLAG | TARGET_SIZEOF_VOID_P); break; case MONO_TYPE_I8: return MONO_INTEGER_VALUE_SIZE_8; diff --git a/mono/mini/alias-analysis.c b/mono/mini/alias-analysis.c index b6d57d3fa8..465be90423 100644 --- a/mono/mini/alias-analysis.c +++ b/mono/mini/alias-analysis.c @@ -21,7 +21,7 @@ static gboolean is_int_stack_size (int type) { -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 return type == STACK_I4 || type == STACK_MP; #else return type == STACK_I4; @@ -31,7 +31,7 @@ is_int_stack_size (int type) static gboolean is_long_stack_size (int type) { -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 return type == STACK_I8 || type == STACK_MP; #else return type == STACK_I8; @@ -114,7 +114,7 @@ lower_store_imm (MonoCompile *cfg, MonoInst *store, MonoInst *ldaddr) return FALSE; switch (store->opcode) { -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 case OP_STORE_MEMBASE_IMM: #endif case OP_STOREI4_MEMBASE_IMM: @@ -129,7 +129,7 @@ lower_store_imm (MonoCompile *cfg, MonoInst *store, MonoInst *ldaddr) store->inst_c0 = store->inst_imm; break; -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 case OP_STORE_MEMBASE_IMM: #endif case OP_STOREI8_MEMBASE_IMM: diff --git a/mono/mini/aot-compiler.c.REMOVED.git-id b/mono/mini/aot-compiler.c.REMOVED.git-id index 6d30d1f222..27e4430933 100644 --- a/mono/mini/aot-compiler.c.REMOVED.git-id +++ b/mono/mini/aot-compiler.c.REMOVED.git-id @@ -1 +1 @@ -72adcbab7c990d56f40f314018622875e3336a7d \ No newline at end of file +930f53e1927e9f9e93c85a0ce3bceb2d7b9e4580 \ No newline at end of file diff --git a/mono/mini/aot-runtime-wasm.c b/mono/mini/aot-runtime-wasm.c index 2840c3a234..399b8794b3 100644 --- a/mono/mini/aot-runtime-wasm.c +++ b/mono/mini/aot-runtime-wasm.c @@ -63,7 +63,7 @@ handle_enum: } } -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 #define FIDX(x) ((x) * 2) #else #define FIDX(x) (x) diff --git a/mono/mini/aot-runtime.c.REMOVED.git-id b/mono/mini/aot-runtime.c.REMOVED.git-id index 732b8e5338..dce39d7668 100644 --- a/mono/mini/aot-runtime.c.REMOVED.git-id +++ b/mono/mini/aot-runtime.c.REMOVED.git-id @@ -1 +1 @@ -d7c7f5c7ecb001abf75c2e01e6373978c7c0f289 \ No newline at end of file +cd468667440738fc8581517da08eda786e416601 \ No newline at end of file diff --git a/mono/mini/aot-runtime.h b/mono/mini/aot-runtime.h index 3f83833704..20e5cb50dd 100644 --- a/mono/mini/aot-runtime.h +++ b/mono/mini/aot-runtime.h @@ -11,7 +11,7 @@ #include "mini.h" /* Version number of the AOT file format */ -#define MONO_AOT_FILE_VERSION 146 +#define MONO_AOT_FILE_VERSION 149 #define MONO_AOT_TRAMP_PAGE_SIZE 16384 @@ -182,8 +182,8 @@ typedef struct MonoAotFileInfo /* Index of the blob entry holding the GC used by this module */ gint32 gc_name_index; guint32 num_rgctx_fetch_trampolines; - /* These are used for sanity checking object layout problems when cross-compiling */ - guint32 double_align, long_align, generic_tramp_num; + /* These are used for sanity checking when cross-compiling */ + guint32 double_align, long_align, generic_tramp_num, card_table_shift_bits, card_table_mask; /* The page size used by trampoline pages */ guint32 tramp_page_size; /* diff --git a/mono/mini/aot-tests.cs b/mono/mini/aot-tests.cs index c69b1c0f8b..5a53f68b6f 100644 --- a/mono/mini/aot-tests.cs +++ b/mono/mini/aot-tests.cs @@ -57,6 +57,13 @@ class Tests public static T Get_T2 (double d, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, T t) { return t; } + public static T Get_T3 (double d, int i, T t) { + return t; + } + public static T Get_T4 (int i, double d, T t) + { + return t; + } } class Foo3 { @@ -86,7 +93,54 @@ class Tests } [Category ("DYNCALL")] - [Category ("!FULLAOT-AMD64")] + static int test_0_amd64_dyncall_double_int_double () + { + double arg1 = 1.0f; + int arg2 = 1; + double s = 2.0f; + var res = (double)typeof (Foo2).GetMethod ("Get_T3").Invoke (null, new object [] { arg1, arg2, s }); + if (res != 2.0f) + return 1; + return 0; + } + + [Category ("DYNCALL")] + static int test_0_amd64_dyncall_double_int_float () + { + double arg1 = 1.0f; + int arg2 = 1; + float s = 2.0f; + var res = (float)typeof (Foo2).GetMethod ("Get_T3").Invoke (null, new object [] { arg1, arg2, s }); + if (res != 2.0f) + return 1; + return 0; + } + + [Category ("DYNCALL")] + static int test_0_amd64_dyncall_int_double_int () + { + int arg1 = 1; + double arg2 = 1.0f; + int s = 2; + var res = (int)typeof (Foo2).GetMethod ("Get_T4").Invoke (null, new object [] { arg1, arg2, s }); + if (res != 2) + return 1; + return 0; + } + + [Category ("DYNCALL")] + static int test_0_amd64_dyncall_int_double_ref () + { + int arg1 = 1; + double arg2 = 1.0f; + object s = new object (); + var res = (object)typeof (Foo2).GetMethod ("Get_T4").Invoke (null, new object [] { arg1, arg2, s }); + if (res != s) + return 1; + return 0; + } + + [Category ("DYNCALL")] static int test_0_arm64_dyncall_hfa_double () { double arg1 = 1.0f; // HFA with double members @@ -100,7 +154,6 @@ class Tests } [Category ("DYNCALL")] - [Category ("!FULLAOT-AMD64")] static int test_0_arm64_dyncall_hfa_float () { double arg1 = 1.0f; var s = new Struct2 (); @@ -112,9 +165,60 @@ class Tests return 0; } + [Category ("DYNCALL")] + static int test_0_amd64_dyncall_use_stack_float () + { + float s = 10.0f; + var res = (float)typeof (Foo2).GetMethod ("Get_T2").Invoke (null, new object [] { 1.0f, 2, 3, 4, 5, 6, 7, 8, 9, s }); + if (res != s) + return 1; + return 0; + } + + [Category ("DYNCALL")] + static int test_0_amd64_dyncall_use_stack_double () + { + double s = 10.0f; + var res = (double)typeof (Foo2).GetMethod ("Get_T2").Invoke (null, new object [] { 1.0f, 2, 3, 4, 5, 6, 7, 8, 9, s }); + if (res != s) + return 1; + return 0; + } + + [Category ("DYNCALL")] + static int test_0_amd64_dyncall_use_stack_int () + { + int s = 10; + var res = (int)typeof (Foo2).GetMethod ("Get_T2").Invoke (null, new object [] { 1.0f, 2, 3, 4, 5, 6, 7, 8, 9, s }); + if (res != s) + return 1; + return 0; + } + + [Category ("DYNCALL")] + static int test_0_amd64_dyncall_use_stack_ref () + { + object s = new object (); + var res = (object)typeof (Foo2).GetMethod ("Get_T2").Invoke (null, new object [] { 1.0f, 2, 3, 4, 5, 6, 7, 8, 9, s }); + if (res != s) + return 1; + return 0; + } + + [Category ("DYNCALL")] + static int test_0_amd64_dyncall_use_stack_struct () + { + Struct1 s = new Struct1 (); + s.a = 10.0f; + s.b = 11.0f; + var res = (Struct1)typeof (Foo2).GetMethod ("Get_T2").Invoke (null, new object [] { 1.0f, 2, 3, 4, 5, 6, 7, 8, 9, s }); + if (res.a != s.a || res.b != s.b) + return 1; + return 0; + } + [Category ("DYNCALL")] [Category ("GSHAREDVT")] - [Category ("!FULLAOT-AMD64")] static int test_0_arm64_dyncall_gsharedvt_out_hfa_double () { /* gsharedvt out trampoline with double hfa argument */ double arg1 = 1.0f; @@ -134,7 +238,6 @@ class Tests [Category ("DYNCALL")] [Category ("GSHAREDVT")] - [Category ("!FULLAOT-AMD64")] static int test_0_arm64_dyncall_gsharedvt_out_hfa_float () { /* gsharedvt out trampoline with double hfa argument */ double arg1 = 1.0f; @@ -201,7 +304,6 @@ class Tests [Category ("DYNCALL")] [Category ("GSHAREDVT")] - [Category ("!FULLAOT-AMD64")] static int test_0_arm64_dyncall_vtypebyref_ret () { var s = new VTypeByRefStruct () { o1 = 1, o2 = 2, o3 = 3 }; Type t = typeof (Foo5<>).MakeGenericType (new Type [] { typeof (VTypeByRefStruct) }); @@ -216,6 +318,8 @@ class Tests return 0; } + [Category ("DYNCALL")] + [Category ("GSHAREDVT")] static int test_42_arm64_dyncall_vtypebyval () { var method = typeof (Foo5).GetMethod ("vtype_by_val").MakeGenericMethod (new Type [] { typeof (int), typeof (long?), typeof (long?), typeof (long?), typeof (long?) }); long res = (long)method.Invoke (null, new object [] { 1, 2L, 3L, 4L, 42L }); @@ -294,7 +398,6 @@ class Tests } [Category ("DYNCALL")] - [Category ("!FULLAOT-AMD64")] public static int test_0_dyncall_nullable () { int? v; @@ -462,7 +565,6 @@ class Tests } [Category ("DYNCALL")] - [Category ("!FULLAOT-AMD64")] [Category ("!WASM")] //Interp fails public static int test_0_large_nullable_invoke () { var s = new LargeStruct () { a = 1, b = 2, c = 3, d = 4 }; diff --git a/mono/mini/debugger-agent.c.REMOVED.git-id b/mono/mini/debugger-agent.c.REMOVED.git-id index 45ac517100..83916434c1 100644 --- a/mono/mini/debugger-agent.c.REMOVED.git-id +++ b/mono/mini/debugger-agent.c.REMOVED.git-id @@ -1 +1 @@ -7bd26dad12e4930bcb115b47836d61819796dd2f \ No newline at end of file +65be6782ad6ac30a8926beb026517429580d596f \ No newline at end of file diff --git a/mono/mini/debugger-agent.h b/mono/mini/debugger-agent.h index 26d57bd0cf..f1d455c5d2 100644 --- a/mono/mini/debugger-agent.h +++ b/mono/mini/debugger-agent.h @@ -30,6 +30,8 @@ struct _MonoDebuggerCallbacks { gboolean (*debug_log_is_enabled) (void); }; +typedef struct _DebuggerTlsData DebuggerTlsData; + MONO_API void mono_debugger_agent_init (void); diff --git a/mono/mini/debugger-engine.c b/mono/mini/debugger-engine.c index 1d7446994f..e2f203fbfd 100644 --- a/mono/mini/debugger-engine.c +++ b/mono/mini/debugger-engine.c @@ -15,10 +15,29 @@ #if !defined (DISABLE_SDB) || defined(TARGET_WASM) #include - +#include "seq-points.h" +#include "aot-runtime.h" #include "debugger-engine.h" +#include "debugger-state-machine.h" +#include -// Locking +static void mono_de_ss_start (SingleStepReq *ss_req, SingleStepArgs *ss_args); +static gboolean mono_de_ss_update (SingleStepReq *req, MonoJitInfo *ji, SeqPoint *sp, void *tls, MonoContext *ctx, MonoMethod* method); + + +static DebuggerEngineCallbacks rt_callbacks; + +/* + * Logging support + */ +static int log_level; +static FILE *log_file; + +#ifdef HOST_ANDROID +#define DEBUG_PRINTF(level, ...) do { if (G_UNLIKELY ((level) <= log_level)) { g_print (__VA_ARGS__); } } while (0) +#else +#define DEBUG_PRINTF(level, ...) do { if (G_UNLIKELY ((level) <= log_level)) { fprintf (log_file, __VA_ARGS__); fflush (log_file); } } while (0) +#endif /* * Locking @@ -39,20 +58,1508 @@ mono_de_unlock (void) dbg_unlock (); } + +/* + * Domain support + */ + + +/* A hash table containing all active domains */ +/* Protected by the loader lock */ +static GHashTable *domains; + + +static void +domains_init (void) +{ + domains = g_hash_table_new (mono_aligned_addr_hash, NULL); +} + +static void +domains_cleanup (void) +{ + //FIXME can we safely destroy `domains`? +} + +/* + * mono_de_foreach_domain: + * + * Iterate over all domains under debugging. Caller must take the loader lock. + * + * FIXME can we move the locking to here? Callers in sdb must be properly audited. + */ +void +mono_de_foreach_domain (GHFunc func, gpointer user_data) +{ + g_hash_table_foreach (domains, func, user_data); +} + +/* + * LOCKING: Takes the loader lock + */ +void +mono_de_domain_remove (MonoDomain *domain) +{ + mono_loader_lock (); + g_hash_table_remove (domains, domain); + mono_loader_unlock (); +} + +/* + * LOCKING: Takes the loader lock + */ +void +mono_de_domain_add (MonoDomain *domain) +{ + mono_loader_lock (); + g_hash_table_insert (domains, domain, domain); + mono_loader_unlock (); +} + +/* + * BREAKPOINTS + */ + +/* List of breakpoints */ +/* Protected by the loader lock */ +static GPtrArray *breakpoints; +/* Maps breakpoint locations to the number of breakpoints at that location */ +static GHashTable *bp_locs; + +static void +breakpoints_init (void) +{ + breakpoints = g_ptr_array_new (); + bp_locs = g_hash_table_new (NULL, NULL); +} + +/* + * insert_breakpoint: + * + * Insert the breakpoint described by BP into the method described by + * JI. + */ +static void +insert_breakpoint (MonoSeqPointInfo *seq_points, MonoDomain *domain, MonoJitInfo *ji, MonoBreakpoint *bp, MonoError *error) +{ + int count; + BreakpointInstance *inst; + SeqPointIterator it; + gboolean it_has_sp = FALSE; + + if (error) + error_init (error); + + mono_seq_point_iterator_init (&it, seq_points); + while (mono_seq_point_iterator_next (&it)) { + if (it.seq_point.il_offset == bp->il_offset) { + it_has_sp = TRUE; + break; + } + } + + if (!it_has_sp) { + /* + * The set of IL offsets with seq points doesn't completely match the + * info returned by CMD_METHOD_GET_DEBUG_INFO (#407). + */ + mono_seq_point_iterator_init (&it, seq_points); + while (mono_seq_point_iterator_next (&it)) { + if (it.seq_point.il_offset != METHOD_ENTRY_IL_OFFSET && + it.seq_point.il_offset != METHOD_EXIT_IL_OFFSET && + it.seq_point.il_offset + 1 == bp->il_offset) { + it_has_sp = TRUE; + break; + } + } + } + + if (!it_has_sp) { + char *s = g_strdup_printf ("Unable to insert breakpoint at %s:%d", mono_method_full_name (jinfo_get_method (ji), TRUE), bp->il_offset); + + mono_seq_point_iterator_init (&it, seq_points); + while (mono_seq_point_iterator_next (&it)) + DEBUG_PRINTF (1, "%d\n", it.seq_point.il_offset); + + if (error) { + mono_error_set_error (error, MONO_ERROR_GENERIC, "%s", s); + g_warning ("%s", s); + g_free (s); + return; + } else { + g_warning ("%s", s); + g_free (s); + return; + } + } + + inst = g_new0 (BreakpointInstance, 1); + inst->il_offset = it.seq_point.il_offset; + inst->native_offset = it.seq_point.native_offset; + inst->ip = (guint8*)ji->code_start + it.seq_point.native_offset; + inst->ji = ji; + inst->domain = domain; + + mono_loader_lock (); + + g_ptr_array_add (bp->children, inst); + + mono_loader_unlock (); + + dbg_lock (); + count = GPOINTER_TO_INT (g_hash_table_lookup (bp_locs, inst->ip)); + g_hash_table_insert (bp_locs, inst->ip, GINT_TO_POINTER (count + 1)); + dbg_unlock (); + + if (it.seq_point.native_offset == SEQ_POINT_NATIVE_OFFSET_DEAD_CODE) { + DEBUG_PRINTF (1, "[dbg] Attempting to insert seq point at dead IL offset %d, ignoring.\n", (int)bp->il_offset); + } else if (count == 0) { + if (ji->is_interp) { + mini_get_interp_callbacks ()->set_breakpoint (ji, inst->ip); + } else { +#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED + mono_arch_set_breakpoint (ji, inst->ip); +#else + NOT_IMPLEMENTED; +#endif + } + } + + DEBUG_PRINTF (1, "[dbg] Inserted breakpoint at %s:[il=0x%x,native=0x%x] [%p](%d).\n", mono_method_full_name (jinfo_get_method (ji), TRUE), (int)it.seq_point.il_offset, (int)it.seq_point.native_offset, inst->ip, count); +} + +static void +remove_breakpoint (BreakpointInstance *inst) +{ + int count; + MonoJitInfo *ji = inst->ji; + guint8 *ip = inst->ip; + + dbg_lock (); + count = GPOINTER_TO_INT (g_hash_table_lookup (bp_locs, ip)); + g_hash_table_insert (bp_locs, ip, GINT_TO_POINTER (count - 1)); + dbg_unlock (); + + g_assert (count > 0); + + if (count == 1 && inst->native_offset != SEQ_POINT_NATIVE_OFFSET_DEAD_CODE) { + if (ji->is_interp) { + mini_get_interp_callbacks ()->clear_breakpoint (ji, ip); + } else { +#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED + mono_arch_clear_breakpoint (ji, ip); +#else + NOT_IMPLEMENTED; +#endif + } + DEBUG_PRINTF (1, "[dbg] Clear breakpoint at %s [%p].\n", mono_method_full_name (jinfo_get_method (ji), TRUE), ip); + } +} + +/* + * This doesn't take any locks. + */ +static inline gboolean +bp_matches_method (MonoBreakpoint *bp, MonoMethod *method) +{ + int i; + + if (!bp->method) + return TRUE; + if (method == bp->method) + return TRUE; + if (method->is_inflated && ((MonoMethodInflated*)method)->declaring == bp->method) + return TRUE; + + if (bp->method->is_inflated && method->is_inflated) { + MonoMethodInflated *bpimethod = (MonoMethodInflated*)bp->method; + MonoMethodInflated *imethod = (MonoMethodInflated*)method; + + /* Open generic methods should match closed generic methods of the same class */ + if (bpimethod->declaring == imethod->declaring && bpimethod->context.class_inst == imethod->context.class_inst && bpimethod->context.method_inst && bpimethod->context.method_inst->is_open) { + for (i = 0; i < bpimethod->context.method_inst->type_argc; ++i) { + MonoType *t1 = bpimethod->context.method_inst->type_argv [i]; + + /* FIXME: Handle !mvar */ + if (t1->type != MONO_TYPE_MVAR) + return FALSE; + } + return TRUE; + } + } + + return FALSE; +} + +/* + * mono_de_add_pending_breakpoints: + * + * Insert pending breakpoints into the newly JITted method METHOD. + */ +void +mono_de_add_pending_breakpoints (MonoMethod *method, MonoJitInfo *ji) +{ + int i, j; + MonoSeqPointInfo *seq_points; + MonoDomain *domain; + MonoMethod *jmethod; + + if (!breakpoints) + return; + + domain = mono_domain_get (); + + mono_loader_lock (); + + for (i = 0; i < breakpoints->len; ++i) { + MonoBreakpoint *bp = (MonoBreakpoint *)g_ptr_array_index (breakpoints, i); + gboolean found = FALSE; + + if (!bp_matches_method (bp, method)) + continue; + + for (j = 0; j < bp->children->len; ++j) { + BreakpointInstance *inst = (BreakpointInstance *)g_ptr_array_index (bp->children, j); + + if (inst->ji == ji) + found = TRUE; + } + + if (!found) { + MonoMethod *declaring = NULL; + + jmethod = jinfo_get_method (ji); + if (jmethod->is_inflated) + declaring = mono_method_get_declaring_generic_method (jmethod); + + mono_domain_lock (domain); + seq_points = (MonoSeqPointInfo *)g_hash_table_lookup (domain_jit_info (domain)->seq_points, jmethod); + if (!seq_points && declaring) + seq_points = (MonoSeqPointInfo *)g_hash_table_lookup (domain_jit_info (domain)->seq_points, declaring); + mono_domain_unlock (domain); + if (!seq_points) + /* Could be AOT code */ + continue; + g_assert (seq_points); + + insert_breakpoint (seq_points, domain, ji, bp, NULL); + } + } + + mono_loader_unlock (); +} + +static void +set_bp_in_method (MonoDomain *domain, MonoMethod *method, MonoSeqPointInfo *seq_points, MonoBreakpoint *bp, MonoError *error) +{ + gpointer code; + MonoJitInfo *ji; + + if (error) + error_init (error); + + code = mono_jit_find_compiled_method_with_jit_info (domain, method, &ji); + if (!code) { + ERROR_DECL_VALUE (oerror); + + /* Might be AOTed code */ + mono_class_init (method->klass); + code = mono_aot_get_method (domain, method, &oerror); + if (code) { + mono_error_assert_ok (&oerror); + ji = mono_jit_info_table_find (domain, code); + } else { + /* Might be interpreted */ + ji = mini_get_interp_callbacks ()->find_jit_info (domain, method); + } + g_assert (ji); + } + + insert_breakpoint (seq_points, domain, ji, bp, error); +} + +typedef struct { + MonoBreakpoint *bp; + GPtrArray *methods; + GPtrArray *method_domains; + GPtrArray *method_seq_points; +} CollectDomainData; + +static void +collect_domain_bp (gpointer key, gpointer value, gpointer user_data) +{ + GHashTableIter iter; + MonoDomain *domain = (MonoDomain*)key; + MonoSeqPointInfo *seq_points; + CollectDomainData *ud = (CollectDomainData*)user_data; + MonoMethod *m; + + mono_domain_lock (domain); + g_hash_table_iter_init (&iter, domain_jit_info (domain)->seq_points); + while (g_hash_table_iter_next (&iter, (void**)&m, (void**)&seq_points)) { + if (bp_matches_method (ud->bp, m)) { + /* Save the info locally to simplify the code inside the domain lock */ + g_ptr_array_add (ud->methods, m); + g_ptr_array_add (ud->method_domains, domain); + g_ptr_array_add (ud->method_seq_points, seq_points); + } + } + mono_domain_unlock (domain); +} + +void +mono_de_clear_all_breakpoints (void) +{ + while (breakpoints->len) + mono_de_clear_breakpoint ((MonoBreakpoint*)g_ptr_array_index (breakpoints, 0)); +} + +/* + * mono_de_set_breakpoint: + * + * Set a breakpoint at IL_OFFSET in METHOD. + * METHOD can be NULL, in which case a breakpoint is placed in all methods. + * METHOD can also be a generic method definition, in which case a breakpoint + * is placed in all instances of the method. + * If ERROR is non-NULL, then it is set and NULL is returnd if some breakpoints couldn't be + * inserted. + */ +MonoBreakpoint* +mono_de_set_breakpoint (MonoMethod *method, long il_offset, EventRequest *req, MonoError *error) +{ + MonoBreakpoint *bp; + MonoDomain *domain; + MonoMethod *m; + MonoSeqPointInfo *seq_points; + GPtrArray *methods; + GPtrArray *method_domains; + GPtrArray *method_seq_points; + int i; + + if (error) + error_init (error); + + // FIXME: + // - suspend/resume the vm to prevent code patching problems + // - multiple breakpoints on the same location + // - dynamic methods + // - races + + bp = g_new0 (MonoBreakpoint, 1); + bp->method = method; + bp->il_offset = il_offset; + bp->req = req; + bp->children = g_ptr_array_new (); + + DEBUG_PRINTF (1, "[dbg] Setting %sbreakpoint at %s:0x%x.\n", (req->event_kind == EVENT_KIND_STEP) ? "single step " : "", method ? mono_method_full_name (method, TRUE) : "", (int)il_offset); + + methods = g_ptr_array_new (); + method_domains = g_ptr_array_new (); + method_seq_points = g_ptr_array_new (); + + mono_loader_lock (); + + CollectDomainData user_data = { + .bp = bp, + .methods = methods, + .method_domains = method_domains, + .method_seq_points = method_seq_points + }; + mono_de_foreach_domain (collect_domain_bp, &user_data); + + for (i = 0; i < methods->len; ++i) { + m = (MonoMethod *)g_ptr_array_index (methods, i); + domain = (MonoDomain *)g_ptr_array_index (method_domains, i); + seq_points = (MonoSeqPointInfo *)g_ptr_array_index (method_seq_points, i); + set_bp_in_method (domain, m, seq_points, bp, error); + } + + g_ptr_array_add (breakpoints, bp); + mono_debugger_log_add_bp (bp, bp->method, bp->il_offset); + mono_loader_unlock (); + + g_ptr_array_free (methods, TRUE); + g_ptr_array_free (method_domains, TRUE); + g_ptr_array_free (method_seq_points, TRUE); + + if (error && !mono_error_ok (error)) { + mono_de_clear_breakpoint (bp); + return NULL; + } + + return bp; +} + +void +mono_de_clear_breakpoint (MonoBreakpoint *bp) +{ + int i; + + // FIXME: locking, races + for (i = 0; i < bp->children->len; ++i) { + BreakpointInstance *inst = (BreakpointInstance *)g_ptr_array_index (bp->children, i); + + remove_breakpoint (inst); + + g_free (inst); + } + + mono_loader_lock (); + mono_debugger_log_remove_bp (bp, bp->method, bp->il_offset); + g_ptr_array_remove (breakpoints, bp); + mono_loader_unlock (); + + g_ptr_array_free (bp->children, TRUE); + g_free (bp); +} + +void +mono_de_collect_breakpoints_by_sp (SeqPoint *sp, MonoJitInfo *ji, GPtrArray *ss_reqs, GPtrArray *bp_reqs) +{ + for (int i = 0; i < breakpoints->len; ++i) { + MonoBreakpoint *bp = (MonoBreakpoint *)g_ptr_array_index (breakpoints, i); + + if (!bp->method) + continue; + + for (int j = 0; j < bp->children->len; ++j) { + BreakpointInstance *inst = (BreakpointInstance *)g_ptr_array_index (bp->children, j); + if (inst->ji == ji && inst->il_offset == sp->il_offset && inst->native_offset == sp->native_offset) { + if (bp->req->event_kind == EVENT_KIND_STEP) { + if (ss_reqs) + g_ptr_array_add (ss_reqs, bp->req); + } else { + if (bp_reqs) + g_ptr_array_add (bp_reqs, bp->req); + } + } + } + } +} + +static void +breakpoints_cleanup (void) +{ + int i; + + mono_loader_lock (); + + for (i = 0; i < breakpoints->len; ++i) + g_free (g_ptr_array_index (breakpoints, i)); + + g_ptr_array_free (breakpoints, TRUE); + g_hash_table_destroy (bp_locs); + + breakpoints = NULL; + bp_locs = NULL; + + mono_loader_unlock (); +} + +/* + * mono_de_clear_breakpoints_for_domain: + * + * Clear breakpoint instances which reference DOMAIN. + */ +void +mono_de_clear_breakpoints_for_domain (MonoDomain *domain) +{ + int i, j; + + /* This could be called after shutdown */ + if (!breakpoints) + return; + + mono_loader_lock (); + for (i = 0; i < breakpoints->len; ++i) { + MonoBreakpoint *bp = (MonoBreakpoint *)g_ptr_array_index (breakpoints, i); + + j = 0; + while (j < bp->children->len) { + BreakpointInstance *inst = (BreakpointInstance *)g_ptr_array_index (bp->children, j); + + if (inst->domain == domain) { + remove_breakpoint (inst); + + g_free (inst); + + g_ptr_array_remove_index_fast (bp->children, j); + } else { + j ++; + } + } + } + mono_loader_unlock (); +} + +/* Single stepping engine */ +/* Number of single stepping operations in progress */ +static int ss_count; + +/* The single step request instance */ +static SingleStepReq *the_ss_req; + +/* + * mono_de_start_single_stepping: + * + * Turn on single stepping. Can be called multiple times, for example, + * by a single step event request + a suspend. + */ +void +mono_de_start_single_stepping (void) +{ + int val = mono_atomic_inc_i32 (&ss_count); + + if (val == 1) { +#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED + mono_arch_start_single_stepping (); +#endif + mini_get_interp_callbacks ()->start_single_stepping (); + } +} + +void +mono_de_stop_single_stepping (void) +{ + int val = mono_atomic_dec_i32 (&ss_count); + + if (val == 0) { +#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED + mono_arch_stop_single_stepping (); +#endif + mini_get_interp_callbacks ()->stop_single_stepping (); + } +} + +static MonoJitInfo* +get_top_method_ji (gpointer ip, MonoDomain **domain, gpointer *out_ip) +{ + MonoJitInfo *ji; + + if (out_ip) + *out_ip = ip; + + ji = mini_jit_info_table_find (mono_domain_get (), (char*)ip, domain); + if (!ji) { + /* Could be an interpreter method */ + + MonoLMF *lmf = mono_get_lmf (); + MonoInterpFrameHandle *frame; + + g_assert (((gsize)lmf->previous_lmf) & 2); + MonoLMFExt *ext = (MonoLMFExt*)lmf; + + g_assert (ext->kind == MONO_LMFEXT_INTERP_EXIT || ext->kind == MONO_LMFEXT_INTERP_EXIT_WITH_CTX); + frame = (MonoInterpFrameHandle*)ext->interp_exit_data; + ji = mini_get_interp_callbacks ()->frame_get_jit_info (frame); + if (domain) + *domain = mono_domain_get (); + if (out_ip) + *out_ip = mini_get_interp_callbacks ()->frame_get_ip (frame); + } + return ji; +} + +static void +no_seq_points_found (MonoMethod *method, int offset) +{ + /* + * This can happen in full-aot mode with assemblies AOTed without the 'soft-debug' option to save space. + */ + printf ("Unable to find seq points for method '%s', offset 0x%x.\n", mono_method_full_name (method, TRUE), offset); +} + +static const char* +ss_depth_to_string (StepDepth depth) +{ + switch (depth) { + case STEP_DEPTH_OVER: + return "over"; + case STEP_DEPTH_OUT: + return "out"; + case STEP_DEPTH_INTO: + return "into"; + default: + g_assert_not_reached (); + return NULL; + } +} + +/* + * ss_stop: + * + * Stop the single stepping operation given by SS_REQ. + */ +static void +ss_stop (SingleStepReq *ss_req) +{ + if (ss_req->bps) { + GSList *l; + + for (l = ss_req->bps; l; l = l->next) { + mono_de_clear_breakpoint ((MonoBreakpoint *)l->data); + } + g_slist_free (ss_req->bps); + ss_req->bps = NULL; + } + + ss_req->async_id = 0; + ss_req->async_stepout_method = NULL; + if (ss_req->global) { + mono_de_stop_single_stepping (); + ss_req->global = FALSE; + } +} + +static void +ss_destroy (SingleStepReq *req) +{ + DEBUG_PRINTF (1, "[dbg] ss_destroy.\n"); + + ss_stop (req); + + g_free (req); +} + +static SingleStepReq* +ss_req_acquire (void) +{ + SingleStepReq *req; + + dbg_lock (); + req = the_ss_req; + if (req) + req->refcount ++; + dbg_unlock (); + return req; +} + +static void +mono_de_ss_req_release (SingleStepReq *req) +{ + gboolean free = FALSE; + + dbg_lock (); + g_assert (req->refcount); + req->refcount --; + if (req->refcount == 0) + free = TRUE; + dbg_unlock (); + if (free) { + if (req == the_ss_req) + the_ss_req = NULL; + ss_destroy (req); + } +} + +void +mono_de_cancel_ss (void) +{ + if (the_ss_req) { + mono_de_ss_req_release (the_ss_req); + the_ss_req = NULL; + } +} + + +void +mono_de_process_single_step (void *tls, gboolean from_signal) +{ + MonoJitInfo *ji; + guint8 *ip; + GPtrArray *reqs; + int il_offset; + MonoDomain *domain; + MonoContext *ctx = rt_callbacks.tls_get_restore_state (tls); + MonoMethod *method; + SeqPoint sp; + MonoSeqPointInfo *info; + SingleStepReq *ss_req; + + /* Skip the instruction causing the single step */ + rt_callbacks.begin_single_step_processing (ctx, from_signal); + + if (rt_callbacks.try_process_suspend (tls, ctx)) + return; + + /* + * This can run concurrently with a clear_event_request () call, so needs locking/reference counts. + */ + ss_req = ss_req_acquire (); + + if (!ss_req) + // FIXME: A suspend race + return; + + if (mono_thread_internal_current () != ss_req->thread) + goto exit; + + ip = (guint8 *)MONO_CONTEXT_GET_IP (ctx); + + ji = get_top_method_ji (ip, &domain, (gpointer*)&ip); + g_assert (ji && !ji->is_trampoline); + + if (log_level > 0) { + DEBUG_PRINTF (1, "[%p] Single step event (depth=%s) at %s (%p)[0x%x], sp %p, last sp %p\n", (gpointer) (gsize) mono_native_thread_id_get (), ss_depth_to_string (ss_req->depth), mono_method_full_name (jinfo_get_method (ji), TRUE), MONO_CONTEXT_GET_IP (ctx), (int)((guint8*)MONO_CONTEXT_GET_IP (ctx) - (guint8*)ji->code_start), MONO_CONTEXT_GET_SP (ctx), ss_req->last_sp); + } + + method = jinfo_get_method (ji); + g_assert (method); + + if (method->wrapper_type && method->wrapper_type != MONO_WRAPPER_DYNAMIC_METHOD) + goto exit; + + /* + * FIXME: + * Stopping in memset makes half-initialized vtypes visible. + * Stopping in memcpy makes half-copied vtypes visible. + */ + if (method->klass == mono_defaults.string_class && (!strcmp (method->name, "memset") || strstr (method->name, "memcpy"))) + goto exit; + + /* + * This could be in mono_de_ss_update method, but mono_find_next_seq_point_for_native_offset is pretty expensive method, + * hence we prefer this check here. + */ + if (ss_req->user_assemblies) { + gboolean found = FALSE; + for (int k = 0; ss_req->user_assemblies[k]; k++) + if (ss_req->user_assemblies[k] == m_class_get_image (method->klass)->assembly) { + found = TRUE; + break; + } + if (!found) + goto exit; + } + + /* + * The ip points to the instruction causing the single step event, which is before + * the offset recorded in the seq point map, so find the next seq point after ip. + */ + if (!mono_find_next_seq_point_for_native_offset (domain, method, (guint8*)ip - (guint8*)ji->code_start, &info, &sp)) { + g_assert_not_reached (); + goto exit; + } + + il_offset = sp.il_offset; + + if (!mono_de_ss_update (ss_req, ji, &sp, tls, ctx, method)) + goto exit; + + /* Start single stepping again from the current sequence point */ + + SingleStepArgs args; + memset (&args, 0, sizeof (args)); + args.method = method; + args.ctx = ctx; + args.tls = tls; + args.step_to_catch = FALSE; + args.sp = sp; + args.info = info; + args.frames = NULL; + args.nframes = 0; + mono_de_ss_start (ss_req, &args); + + if ((ss_req->filter & STEP_FILTER_STATIC_CTOR) && + (method->flags & METHOD_ATTRIBUTE_SPECIAL_NAME) && + !strcmp (method->name, ".cctor")) + goto exit; + + // FIXME: Has to lock earlier + + reqs = g_ptr_array_new (); + + mono_loader_lock (); + + g_ptr_array_add (reqs, ss_req->req); + + void *bp_events; + bp_events = rt_callbacks.create_breakpoint_events (reqs, NULL, ji, EVENT_KIND_BREAKPOINT); + + g_ptr_array_free (reqs, TRUE); + + mono_loader_unlock (); + + rt_callbacks.process_breakpoint_events (bp_events, method, ctx, il_offset); + + exit: + mono_de_ss_req_release (ss_req); +} + +/* + * mono_de_ss_update: + * + * Return FALSE if single stepping needs to continue. + */ +static gboolean +mono_de_ss_update (SingleStepReq *req, MonoJitInfo *ji, SeqPoint *sp, void *tls, MonoContext *ctx, MonoMethod* method) +{ + MonoDebugMethodInfo *minfo; + MonoDebugSourceLocation *loc = NULL; + gboolean hit = TRUE; + + if ((req->filter & STEP_FILTER_STATIC_CTOR)) { + DbgEngineStackFrame **frames; + int nframes; + rt_callbacks.ss_calculate_framecount (tls, ctx, TRUE, &frames, &nframes); + + gboolean ret = FALSE; + gboolean method_in_stack = FALSE; + + for (int i = 0; i < nframes; i++) { + MonoMethod *external_method = frames [i]->method; + if (method == external_method) + method_in_stack = TRUE; + + if (!ret) { + ret = (external_method->flags & METHOD_ATTRIBUTE_SPECIAL_NAME); + ret = ret && !strcmp (external_method->name, ".cctor"); + ret = ret && (external_method != req->start_method); + } + } + + if (!method_in_stack) { + g_printerr ("[%p] The instruction pointer of the currently executing method(%s) is not on the recorded stack. This is likely due to a runtime bug. The %d frames are as follow: \n", (gpointer)(gsize)mono_native_thread_id_get (), mono_method_full_name (method, TRUE), nframes); + /*DEBUG_PRINTF (1, "[%p] The instruction pointer of the currently executing method(%s) is not on the recorded stack. This is likely due to a runtime bug. The %d frames are as follow: \n", (gpointer)(gsize)mono_native_thread_id_get (), mono_method_full_name (method, TRUE), tls->frame_count);*/ + + for (int i=0; i < nframes; i++) + g_printerr ("\t [%p] Frame (%d / %d): %s\n", (gpointer)(gsize)mono_native_thread_id_get (), i, nframes, mono_method_full_name (frames [i]->method, TRUE)); + } + + rt_callbacks.ss_discard_frame_context (tls); + + if (ret) + return FALSE; + } + + if (req->async_stepout_method == method) { + DEBUG_PRINTF (1, "[%p] Breakpoint hit during async step-out at %s hit, continuing stepping out.\n", (gpointer)(gsize)mono_native_thread_id_get (), method->name); + return FALSE; + } + + if (req->depth == STEP_DEPTH_OVER && (sp->flags & MONO_SEQ_POINT_FLAG_NONEMPTY_STACK)) { + /* + * These seq points are inserted by the JIT after calls, step over needs to skip them. + */ + DEBUG_PRINTF (1, "[%p] Seq point at nonempty stack %x while stepping over, continuing single stepping.\n", (gpointer) (gsize) mono_native_thread_id_get (), sp->il_offset); + return FALSE; + } + + if ((req->depth == STEP_DEPTH_OVER || req->depth == STEP_DEPTH_OUT) && hit && !req->async_stepout_method) { + gboolean is_step_out = req->depth == STEP_DEPTH_OUT; + int nframes; + rt_callbacks.ss_calculate_framecount (tls, ctx, FALSE, NULL, &nframes); + + // Because functions can call themselves recursively, we need to make sure we're stopping at the right stack depth. + // In case of step out, the target is the frame *enclosing* the one where the request was made. + int target_frames = req->nframes + (is_step_out ? -1 : 0); + if (req->nframes > 0 && nframes > 0 && nframes > target_frames) { + /* Hit the breakpoint in a recursive call, don't halt */ + DEBUG_PRINTF (1, "[%p] Breakpoint at lower frame while stepping %s, continuing single stepping.\n", (gpointer) (gsize) mono_native_thread_id_get (), is_step_out ? "out" : "over"); + return FALSE; + } + } + + if (req->depth == STEP_DEPTH_INTO && req->size == STEP_SIZE_MIN && (sp->flags & MONO_SEQ_POINT_FLAG_NONEMPTY_STACK) && req->start_method) { + int nframes; + rt_callbacks.ss_calculate_framecount (tls, ctx, FALSE, NULL, &nframes); + if (req->start_method == method && req->nframes && nframes == req->nframes) { //Check also frame count(could be recursion) + DEBUG_PRINTF (1, "[%p] Seq point at nonempty stack %x while stepping in, continuing single stepping.\n", (gpointer) (gsize) mono_native_thread_id_get (), sp->il_offset); + return FALSE; + } + } + + MonoDebugMethodAsyncInfo* async_method = mono_debug_lookup_method_async_debug_info (method); + if (async_method) { + for (int i = 0; i < async_method->num_awaits; i++) { + if (async_method->yield_offsets[i] == sp->il_offset || async_method->resume_offsets[i] == sp->il_offset) { + mono_debug_free_method_async_debug_info (async_method); + return FALSE; + } + } + mono_debug_free_method_async_debug_info (async_method); + } + + if (req->size != STEP_SIZE_LINE) + return TRUE; + + /* Have to check whenever a different source line was reached */ + minfo = mono_debug_lookup_method (method); + + if (minfo) + loc = mono_debug_method_lookup_location (minfo, sp->il_offset); + + if (!loc) { + DEBUG_PRINTF (1, "[%p] No line number info for il offset %x, continuing single stepping.\n", (gpointer) (gsize) mono_native_thread_id_get (), sp->il_offset); + req->last_method = method; + hit = FALSE; + } else if (loc && method == req->last_method && loc->row == req->last_line) { + int nframes; + rt_callbacks.ss_calculate_framecount (tls, ctx, FALSE, NULL, &nframes); + if (nframes == req->nframes) { // If the frame has changed we're clearly not on the same source line. + DEBUG_PRINTF (1, "[%p] Same source line (%d), continuing single stepping.\n", (gpointer) (gsize) mono_native_thread_id_get (), loc->row); + hit = FALSE; + } + } + + if (loc) { + req->last_method = method; + req->last_line = loc->row; + mono_debug_free_source_location (loc); + } + + return hit; +} + +void +mono_de_process_breakpoint (void *void_tls, gboolean from_signal) +{ + DebuggerTlsData *tls = (DebuggerTlsData*)void_tls; + MonoJitInfo *ji; + guint8 *ip; + int i; + guint32 native_offset; + MonoBreakpoint *bp; + GPtrArray *bp_reqs, *ss_reqs_orig, *ss_reqs; + EventKind kind = EVENT_KIND_BREAKPOINT; + MonoContext *ctx = rt_callbacks.tls_get_restore_state (tls); + MonoMethod *method; + MonoSeqPointInfo *info; + SeqPoint sp; + gboolean found_sp; + + if (rt_callbacks.try_process_suspend (tls, ctx)) + return; + + ip = (guint8 *)MONO_CONTEXT_GET_IP (ctx); + + ji = get_top_method_ji (ip, NULL, (gpointer*)&ip); + g_assert (ji && !ji->is_trampoline); + method = jinfo_get_method (ji); + + /* Compute the native offset of the breakpoint from the ip */ + native_offset = ip - (guint8*)ji->code_start; + + if (!rt_callbacks.begin_breakpoint_processing (tls, ctx, ji, from_signal)) + return; + + if (method->wrapper_type) + return; + + bp_reqs = g_ptr_array_new (); + ss_reqs = g_ptr_array_new (); + ss_reqs_orig = g_ptr_array_new (); + + mono_loader_lock (); + + /* + * The ip points to the instruction causing the breakpoint event, which is after + * the offset recorded in the seq point map, so find the prev seq point before ip. + */ + found_sp = mono_find_prev_seq_point_for_native_offset (mono_domain_get (), method, native_offset, &info, &sp); + + if (!found_sp) + no_seq_points_found (method, native_offset); + + g_assert (found_sp); + + DEBUG_PRINTF (1, "[%p] Breakpoint hit, method=%s, ip=%p, [il=0x%x,native=0x%x].\n", (gpointer) (gsize) mono_native_thread_id_get (), method->name, ip, sp.il_offset, native_offset); + + mono_debugger_log_bp_hit (tls, method, sp.il_offset); + + bp = NULL; + mono_de_collect_breakpoints_by_sp (&sp, ji, ss_reqs_orig, bp_reqs); + + if (bp_reqs->len == 0 && ss_reqs_orig->len == 0) { + /* Maybe a method entry/exit event */ + if (sp.il_offset == METHOD_ENTRY_IL_OFFSET) + kind = EVENT_KIND_METHOD_ENTRY; + else if (sp.il_offset == METHOD_EXIT_IL_OFFSET) + kind = EVENT_KIND_METHOD_EXIT; + } + + /* Process single step requests */ + for (i = 0; i < ss_reqs_orig->len; ++i) { + EventRequest *req = (EventRequest *)g_ptr_array_index (ss_reqs_orig, i); + SingleStepReq *ss_req = (SingleStepReq *)req->info; + gboolean hit; + + //if we hit async_stepout_method, it's our no matter which thread + if ((ss_req->async_stepout_method != method) && (ss_req->async_id || mono_thread_internal_current () != ss_req->thread)) { + DbgEngineStackFrame **frames; + int nframes; + //We have different thread and we don't have async stepping in progress + //it's breakpoint in parallel thread, ignore it + if (ss_req->async_id == 0) + continue; + + rt_callbacks.ss_discard_frame_context (tls); + rt_callbacks.ss_calculate_framecount (tls, ctx, FALSE, &frames, &nframes); + //make sure we have enough data to get current async method instance id + if (nframes == 0 || !rt_callbacks.ensure_jit (frames [0])) + continue; + + //Check method is async before calling get_this_async_id + MonoDebugMethodAsyncInfo* asyncMethod = mono_debug_lookup_method_async_debug_info (method); + if (!asyncMethod) + continue; + else + mono_debug_free_method_async_debug_info (asyncMethod); + + //breakpoint was hit in parallelly executing async method, ignore it + if (ss_req->async_id != rt_callbacks.get_this_async_id (frames [0])) + continue; + } + + //Update stepping request to new thread/frame_count that we are continuing on + //so continuing with normal stepping works as expected + if (ss_req->async_stepout_method || ss_req->async_id) { + int nframes; + rt_callbacks.ss_discard_frame_context (tls); + rt_callbacks.ss_calculate_framecount (tls, ctx, FALSE, NULL, &nframes); + ss_req->thread = mono_thread_internal_current (); + ss_req->nframes = nframes; + } + + hit = mono_de_ss_update (ss_req, ji, &sp, tls, ctx, method); + if (hit) + g_ptr_array_add (ss_reqs, req); + + SingleStepArgs args; + memset (&args, 0, sizeof (args)); + args.method = method; + args.ctx = ctx; + args.tls = tls; + args.step_to_catch = FALSE; + args.sp = sp; + args.info = info; + args.frames = NULL; + args.nframes = 0; + mono_de_ss_start (ss_req, &args); + } + + void *bp_events = rt_callbacks.create_breakpoint_events (ss_reqs, bp_reqs, ji, kind); + + mono_loader_unlock (); + + g_ptr_array_free (bp_reqs, TRUE); + g_ptr_array_free (ss_reqs, TRUE); + + rt_callbacks.process_breakpoint_events (bp_events, method, ctx, 0); +} + +/* + * ss_bp_is_unique: + * + * Reject breakpoint if it is a duplicate of one already in list or hash table. + */ +static gboolean +ss_bp_is_unique (GSList *bps, GHashTable *ss_req_bp_cache, MonoMethod *method, guint32 il_offset) +{ + if (ss_req_bp_cache) { + MonoBreakpoint dummy = {method, il_offset, NULL, NULL}; + return !g_hash_table_lookup (ss_req_bp_cache, &dummy); + } + for (GSList *l = bps; l; l = l->next) { + MonoBreakpoint *bp = (MonoBreakpoint *)l->data; + if (bp->method == method && bp->il_offset == il_offset) + return FALSE; + } + return TRUE; +} + +/* + * ss_bp_eq: + * + * GHashTable equality for a MonoBreakpoint (only care about method and il_offset fields) + */ +static gint +ss_bp_eq (gconstpointer ka, gconstpointer kb) +{ + const MonoBreakpoint *s1 = (const MonoBreakpoint *)ka; + const MonoBreakpoint *s2 = (const MonoBreakpoint *)kb; + return (s1->method == s2->method && s1->il_offset == s2->il_offset) ? 1 : 0; +} + +/* + * ss_bp_eq: + * + * GHashTable hash for a MonoBreakpoint (only care about method and il_offset fields) + */ +static guint +ss_bp_hash (gconstpointer data) +{ + const MonoBreakpoint *s = (const MonoBreakpoint *)data; + guint hash = (guint) (uintptr_t) s->method; + hash ^= ((guint)s->il_offset) << 16; // Assume low bits are more interesting + hash ^= ((guint)s->il_offset) >> 16; + return hash; +} + +#define MAX_LINEAR_SCAN_BPS 7 + +/* + * ss_bp_add_one: + * + * Create a new breakpoint and add it to a step request. + * Will adjust the bp count and cache used by mono_de_ss_start. + */ +static void +ss_bp_add_one (SingleStepReq *ss_req, int *ss_req_bp_count, GHashTable **ss_req_bp_cache, + MonoMethod *method, guint32 il_offset) +{ + // This list is getting too long, switch to using the hash table + if (!*ss_req_bp_cache && *ss_req_bp_count > MAX_LINEAR_SCAN_BPS) { + *ss_req_bp_cache = g_hash_table_new (ss_bp_hash, ss_bp_eq); + for (GSList *l = ss_req->bps; l; l = l->next) + g_hash_table_insert (*ss_req_bp_cache, l->data, l->data); + } + + if (ss_bp_is_unique (ss_req->bps, *ss_req_bp_cache, method, il_offset)) { + // Create and add breakpoint + MonoBreakpoint *bp = mono_de_set_breakpoint (method, il_offset, ss_req->req, NULL); + ss_req->bps = g_slist_append (ss_req->bps, bp); + if (*ss_req_bp_cache) + g_hash_table_insert (*ss_req_bp_cache, bp, bp); + (*ss_req_bp_count)++; + } else { + DEBUG_PRINTF (1, "[dbg] Candidate breakpoint at %s:[il=0x%x] is a duplicate for this step request, will not add.\n", mono_method_full_name (method, TRUE), (int)il_offset); + } +} + +static gboolean +is_last_non_empty (SeqPoint* sp, MonoSeqPointInfo *info) +{ + if (!sp->next_len) + return TRUE; + SeqPoint* next = g_new (SeqPoint, sp->next_len); + mono_seq_point_init_next (info, *sp, next); + for (int i = 0; i < sp->next_len; i++) { + if (next [i].flags & MONO_SEQ_POINT_FLAG_NONEMPTY_STACK) { + if (!is_last_non_empty (&next [i], info)) { + g_free (next); + return FALSE; + } + } else { + g_free (next); + return FALSE; + } + } + g_free (next); + return TRUE; +} + +/* + * mono_de_ss_start: + * + * Start the single stepping operation given by SS_REQ from the sequence point SP. + * If CTX is not set, then this can target any thread. If CTX is set, then TLS should + * belong to the same thread as CTX. + * If FRAMES is not-null, use that instead of tls->frames for placing breakpoints etc. + */ +static void +mono_de_ss_start (SingleStepReq *ss_req, SingleStepArgs *ss_args) +{ + int i, j, frame_index; + SeqPoint *next_sp, *parent_sp = NULL; + SeqPoint local_sp, local_parent_sp; + gboolean found_sp; + MonoSeqPointInfo *parent_info; + MonoMethod *parent_sp_method = NULL; + gboolean enable_global = FALSE; + + // When 8 or more entries are in bps, we build a hash table to serve as a set of breakpoints. + // Recreating this on each pass is a little wasteful but at least keeps behavior linear. + int ss_req_bp_count = g_slist_length (ss_req->bps); + GHashTable *ss_req_bp_cache = NULL; + + /* Stop the previous operation */ + ss_stop (ss_req); + + gboolean locked = FALSE; + + void *tls = ss_args->tls; + MonoMethod *method = ss_args->method; + DbgEngineStackFrame **frames = ss_args->frames; + int nframes = ss_args->nframes; + SeqPoint *sp = &ss_args->sp; + + /* + * Implement single stepping using breakpoints if possible. + */ + if (ss_args->step_to_catch) { + ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, method, sp->il_offset); + } else { + frame_index = 1; + + if (ss_args->ctx && !frames) { + + mono_loader_lock (); + locked = TRUE; + + /* Need parent frames */ + rt_callbacks.ss_calculate_framecount (tls, ss_args->ctx, FALSE, &frames, &nframes); + } + + MonoDebugMethodAsyncInfo* asyncMethod = mono_debug_lookup_method_async_debug_info (method); + + /* Need to stop in catch clauses as well */ + for (i = ss_req->depth == STEP_DEPTH_OUT ? 1 : 0; i < nframes; ++i) { + DbgEngineStackFrame *frame = frames [i]; + + if (frame->ji) { + MonoJitInfo *jinfo = frame->ji; + for (j = 0; j < jinfo->num_clauses; ++j) { + // In case of async method we don't want to place breakpoint on last catch handler(which state machine added for whole method) + if (asyncMethod && asyncMethod->num_awaits && i == 0 && j + 1 == jinfo->num_clauses) + break; + MonoJitExceptionInfo *ei = &jinfo->clauses [j]; + + if (mono_find_next_seq_point_for_native_offset (frame->domain, frame->method, (char*)ei->handler_start - (char*)jinfo->code_start, NULL, &local_sp)) + ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, frame->method, local_sp.il_offset); + } + } + } + + if (asyncMethod && asyncMethod->num_awaits && nframes && rt_callbacks.ensure_jit (frames [0])) { + //asyncMethod has value and num_awaits > 0, this means we are inside async method with awaits + + // Check if we hit yield_offset during normal stepping, because if we did... + // Go into special async stepping mode which places breakpoint on resumeOffset + // of this await call and sets async_id so we can distinguish it from parallel executions + for (i = 0; i < asyncMethod->num_awaits; i++) { + if (sp->il_offset == asyncMethod->yield_offsets [i]) { + ss_req->async_id = rt_callbacks.get_this_async_id (frames [0]); + ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, method, asyncMethod->resume_offsets [i]); + g_hash_table_destroy (ss_req_bp_cache); + mono_debug_free_method_async_debug_info (asyncMethod); + if (locked) + mono_loader_unlock (); + goto cleanup; + } + } + //If we are at end of async method and doing step-in or step-over... + //Switch to step-out, so whole NotifyDebuggerOfWaitCompletion magic happens... + if (is_last_non_empty (sp, ss_args->info)) { + ss_req->depth = STEP_DEPTH_OUT;//setting depth to step-out is important, don't inline IF, because code later depends on this + } + if (ss_req->depth == STEP_DEPTH_OUT) { + //If we are inside `async void` method, do normal step-out + if (rt_callbacks.set_set_notification_for_wait_completion_flag (frames [0])) { + ss_req->async_id = rt_callbacks.get_this_async_id (frames [0]); + ss_req->async_stepout_method = rt_callbacks.get_notify_debugger_of_wait_completion_method (); + ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, ss_req->async_stepout_method, 0); + g_hash_table_destroy (ss_req_bp_cache); + mono_debug_free_method_async_debug_info (asyncMethod); + if (locked) + mono_loader_unlock (); + goto cleanup; + } + } + } + + if (asyncMethod) + mono_debug_free_method_async_debug_info (asyncMethod); + + /* + * Find the first sequence point in the current or in a previous frame which + * is not the last in its method. + */ + if (ss_req->depth == STEP_DEPTH_OUT) { + /* Ignore seq points in current method */ + while (frame_index < nframes) { + DbgEngineStackFrame *frame = frames [frame_index]; + + method = frame->method; + found_sp = mono_find_prev_seq_point_for_native_offset (frame->domain, frame->method, frame->native_offset, &ss_args->info, &local_sp); + sp = (found_sp)? &local_sp : NULL; + frame_index ++; + if (sp && sp->next_len != 0) + break; + } + // There could be method calls before the next seq point in the caller when using nested calls + //enable_global = TRUE; + } else { + if (sp && sp->next_len == 0) { + sp = NULL; + while (frame_index < nframes) { + DbgEngineStackFrame *frame = frames [frame_index]; + + method = frame->method; + found_sp = mono_find_prev_seq_point_for_native_offset (frame->domain, frame->method, frame->native_offset, &ss_args->info, &local_sp); + sp = (found_sp)? &local_sp : NULL; + if (sp && sp->next_len != 0) + break; + sp = NULL; + frame_index ++; + } + } else { + /* Have to put a breakpoint into a parent frame since the seq points might not cover all control flow out of the method */ + while (frame_index < nframes) { + DbgEngineStackFrame *frame = frames [frame_index]; + + parent_sp_method = frame->method; + found_sp = mono_find_prev_seq_point_for_native_offset (frame->domain, frame->method, frame->native_offset, &parent_info, &local_parent_sp); + parent_sp = found_sp ? &local_parent_sp : NULL; + if (found_sp && parent_sp->next_len != 0) + break; + parent_sp = NULL; + frame_index ++; + } + } + } + + if (sp && sp->next_len > 0) { + SeqPoint* next = g_new(SeqPoint, sp->next_len); + + mono_seq_point_init_next (ss_args->info, *sp, next); + for (i = 0; i < sp->next_len; i++) { + next_sp = &next[i]; + + ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, method, next_sp->il_offset); + } + g_free (next); + } + + if (parent_sp) { + SeqPoint* next = g_new(SeqPoint, parent_sp->next_len); + + mono_seq_point_init_next (parent_info, *parent_sp, next); + for (i = 0; i < parent_sp->next_len; i++) { + next_sp = &next[i]; + + ss_bp_add_one (ss_req, &ss_req_bp_count, &ss_req_bp_cache, parent_sp_method, next_sp->il_offset); + } + g_free (next); + } + + if (ss_req->nframes == 0) + ss_req->nframes = nframes; + + if ((ss_req->depth == STEP_DEPTH_OVER) && (!sp && !parent_sp)) { + DEBUG_PRINTF (1, "[dbg] No parent frame for step over, transition to step into.\n"); + /* + * This is needed since if we leave managed code, and later return to it, step over + * is not going to stop. + * This approach is a bit ugly, since we change the step depth, but it only affects + * clients who reuse the same step request, and only in this special case. + */ + ss_req->depth = STEP_DEPTH_INTO; + } + + if (ss_req->depth == STEP_DEPTH_INTO) { + /* Enable global stepping so we stop at method entry too */ + enable_global = TRUE; + } + + /* + * The ctx/frame info computed above will become invalid when we continue. + */ + rt_callbacks.ss_discard_frame_context (tls); + } + + if (enable_global) { + DEBUG_PRINTF (1, "[dbg] Turning on global single stepping.\n"); + ss_req->global = TRUE; + mono_de_start_single_stepping (); + } else if (!ss_req->bps) { + DEBUG_PRINTF (1, "[dbg] Turning on global single stepping.\n"); + ss_req->global = TRUE; + mono_de_start_single_stepping (); + } else { + ss_req->global = FALSE; + } + + g_hash_table_destroy (ss_req_bp_cache); + + if (locked) + mono_loader_unlock (); + +cleanup: + rt_callbacks.ss_args_destroy (ss_args); +} + + +/* + * Start single stepping of thread THREAD + */ +DbgEngineErrorCode +mono_de_ss_create (MonoInternalThread *thread, StepSize size, StepDepth depth, StepFilter filter, EventRequest *req) +{ + int err = rt_callbacks.ensure_runtime_is_suspended (); + if (err) + return err; + + // FIXME: Multiple requests + if (the_ss_req) { + DEBUG_PRINTF (0, "Received a single step request while the previous one was still active.\n"); + return DE_ERR_NOT_IMPLEMENTED; + } + + DEBUG_PRINTF (1, "[dbg] Starting single step of thread %p (depth=%s).\n", thread, ss_depth_to_string (depth)); + + SingleStepReq *ss_req = g_new0 (SingleStepReq, 1); + ss_req->req = req; + ss_req->thread = thread; + ss_req->size = size; + ss_req->depth = depth; + ss_req->filter = filter; + ss_req->refcount = 1; + req->info = ss_req; + + for (int i = 0; i < req->nmodifiers; i++) { + if (req->modifiers[i].kind == MOD_KIND_ASSEMBLY_ONLY) { + ss_req->user_assemblies = req->modifiers[i].data.assemblies; + break; + } + } + + SingleStepArgs args; + err = rt_callbacks.ss_create_init_args (ss_req, &args); + if (err) + return err; + + the_ss_req = ss_req; + + mono_de_ss_start (ss_req, &args); + + return DE_ERR_NONE; +} + +/* + * mono_de_set_log_level: + * + * Configures logging level and output file. Must be called together with mono_de_init. + */ +void +mono_de_set_log_level (int level, FILE *file) +{ + log_level = level; + log_file = file; +} + /* * mono_de_init: * * Inits the shared debugger engine. Not reentrant. */ void -mono_de_init (void) +mono_de_init (DebuggerEngineCallbacks *cbs) { + rt_callbacks = *cbs; mono_coop_mutex_init_recursive (&debug_mutex); + + domains_init (); + breakpoints_init (); + + mono_debugger_log_init (); } void mono_de_cleanup (void) { + breakpoints_cleanup (); + domains_cleanup (); } #endif diff --git a/mono/mini/debugger-engine.h b/mono/mini/debugger-engine.h index 6481a9c3f6..12952b6445 100644 --- a/mono/mini/debugger-engine.h +++ b/mono/mini/debugger-engine.h @@ -5,6 +5,10 @@ #ifndef __MONO_DEBUGGER_ENGINE_H__ #define __MONO_DEBUGGER_ENGINE_H__ +#include "mini.h" +#include +#include + /* FIXME: - Move EventKind back to debugger-agent.c as it contains sdb wire protocol constants. @@ -154,11 +158,109 @@ typedef struct { guint32 native_offset; } DbgEngineStackFrame; -void mono_de_init (void); +typedef struct { + /* + * Method where to start single stepping + */ + MonoMethod *method; + + /* + * If ctx is set, tls must belong to the same thread. + */ + MonoContext *ctx; + void *tls; + + /* + * Stopped at a throw site + */ + gboolean step_to_catch; + + /* + * Sequence point to start from. + */ + SeqPoint sp; + MonoSeqPointInfo *info; + + /* + * Frame data, will be freed at the end of ss_start if provided + */ + DbgEngineStackFrame **frames; + int nframes; +} SingleStepArgs; + +typedef int DbgEngineErrorCode; +#define DE_ERR_NONE 0 +// WARNING WARNING WARNING +// Error codes MUST match those of sdb for now +#define DE_ERR_NOT_IMPLEMENTED 100 + +MonoGHashTable * +mono_debugger_get_thread_states (void); + +gboolean +mono_debugger_is_disconnected (void); + +gsize +mono_debugger_tls_thread_id (DebuggerTlsData *debuggerTlsData); + +void +mono_debugger_set_thread_state (DebuggerTlsData *ref, MonoDebuggerThreadState expected, MonoDebuggerThreadState set); + +MonoDebuggerThreadState +mono_debugger_get_thread_state (DebuggerTlsData *ref); + +typedef struct { + MonoContext *(*tls_get_restore_state) (void *tls); + gboolean (*try_process_suspend) (void *tls, MonoContext *ctx); + gboolean (*begin_breakpoint_processing) (void *tls, MonoContext *ctx, MonoJitInfo *ji, gboolean from_signal); + void (*begin_single_step_processing) (MonoContext *ctx, gboolean from_signal); + + void (*ss_discard_frame_context) (void *tls); + void (*ss_calculate_framecount) (void *tls, MonoContext *ctx, gboolean force_use_ctx, DbgEngineStackFrame ***frames, int *nframes); + gboolean (*ensure_jit) (DbgEngineStackFrame *frame); + int (*ensure_runtime_is_suspended) (void); + + int (*get_this_async_id) (DbgEngineStackFrame *frame); + + void* (*create_breakpoint_events) (GPtrArray *ss_reqs, GPtrArray *bp_reqs, MonoJitInfo *ji, EventKind kind); + void (*process_breakpoint_events) (void *_evts, MonoMethod *method, MonoContext *ctx, int il_offset); + + gboolean (*set_set_notification_for_wait_completion_flag) (DbgEngineStackFrame *f); + MonoMethod* (*get_notify_debugger_of_wait_completion_method)(void); + + int (*ss_create_init_args) (SingleStepReq *ss_req, SingleStepArgs *args); + void (*ss_args_destroy) (SingleStepArgs *ss_args); +} DebuggerEngineCallbacks; + + +void mono_de_init (DebuggerEngineCallbacks *cbs); void mono_de_cleanup (void); +void mono_de_set_log_level (int level, FILE *file); //locking - we expose the lock object from the debugging engine to ensure we keep the same locking semantics of sdb. void mono_de_lock (void); void mono_de_unlock (void); +// domain handling +void mono_de_foreach_domain (GHFunc func, gpointer user_data); +void mono_de_domain_add (MonoDomain *domain); +void mono_de_domain_remove (MonoDomain *domain); + +//breakpoints +void mono_de_clear_breakpoint (MonoBreakpoint *bp); +MonoBreakpoint* mono_de_set_breakpoint (MonoMethod *method, long il_offset, EventRequest *req, MonoError *error); +void mono_de_collect_breakpoints_by_sp (SeqPoint *sp, MonoJitInfo *ji, GPtrArray *ss_reqs, GPtrArray *bp_reqs); +void mono_de_clear_breakpoints_for_domain (MonoDomain *domain); +void mono_de_add_pending_breakpoints (MonoMethod *method, MonoJitInfo *ji); +void mono_de_clear_all_breakpoints (void); + +//single stepping +void mono_de_start_single_stepping (void); +void mono_de_stop_single_stepping (void); + +void mono_de_process_breakpoint (void *tls, gboolean from_signal); +void mono_de_process_single_step (void *tls, gboolean from_signal); +DbgEngineErrorCode mono_de_ss_create (MonoInternalThread *thread, StepSize size, StepDepth depth, StepFilter filter, EventRequest *req); +void mono_de_cancel_ss (void); + #endif diff --git a/mono/mini/debugger-state-machine.c b/mono/mini/debugger-state-machine.c new file mode 100644 index 0000000000..88cdbab467 --- /dev/null +++ b/mono/mini/debugger-state-machine.c @@ -0,0 +1,410 @@ +/** + * \file + * Support for verbose unmanaged crash dumps + * + * Author: + * Alexander Kyte (alkyte@microsoft.com) + * + * (C) 2018 Microsoft, Inc. + * + */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static const char * +mono_debug_log_thread_state_to_string (MonoDebuggerThreadState state) +{ + switch (state) { + case MONO_DEBUGGER_SUSPENDED: return "suspended"; + case MONO_DEBUGGER_RESUMED: return "resumed"; + case MONO_DEBUGGER_TERMINATED: return "terminated"; + case MONO_DEBUGGER_STARTED: return "started"; + default: + g_assert_not_reached (); + } +} + +typedef enum { + DEBUG_LOG_ILLEGAL = 0x0, + DEBUG_LOG_STATE_CHANGE = 0x1, + DEBUG_LOG_BREAKPOINT = 0x2, + DEBUG_LOG_COMMAND = 0x3, + DEBUG_LOG_EVENT = 0x4, + DEBUG_LOG_EXIT = 0x5 +} MonoDebugLogKind; + +// Number of messages +#define MONO_MAX_DEBUGGER_LOG_LEN 65 +// Length of each message +#define MONO_MAX_DEBUGGER_MSG_LEN 200 + +typedef struct { + MonoDebugLogKind kind; + intptr_t tid; + char message [MONO_MAX_DEBUGGER_MSG_LEN]; +} MonoDebugLogItem; + +static const char * +mono_debug_log_kind_to_string (MonoDebugLogKind kind) +{ + switch (kind) { + case DEBUG_LOG_STATE_CHANGE: return "transition"; + case DEBUG_LOG_BREAKPOINT: return "breakpoint"; + case DEBUG_LOG_COMMAND: return "command"; + case DEBUG_LOG_EVENT: return "event"; + case DEBUG_LOG_EXIT: return "exit"; + default: + g_assert_not_reached (); + } +} + +#define MONO_DEBUGGER_LOG_FREED -1 +static MonoFlightRecorder *debugger_log; +static GPtrArray *breakpoint_copy; + +void +mono_debugger_log_init (void) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + g_error ("Attempted to initialize debugger log after cleanup"); + + debugger_log = mono_flight_recorder_init (MONO_MAX_DEBUGGER_LOG_LEN, sizeof (MonoDebugLogItem)); + breakpoint_copy = g_ptr_array_new (); +} + +void +mono_debugger_log_free (void) +{ + MonoFlightRecorder *log = debugger_log; + debugger_log = GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED); + + mono_memory_barrier (); + mono_flight_recorder_free (log); +} + +void +mono_debugger_log_command (const char *command_set, const char *command, guint8 *buf, int len) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return; + + // FIXME: print the array in a format that can be decoded / printed? + char *msg = g_strdup_printf ("Command Logged: %s %s Response: %d", command_set, command, len); + MonoDebugLogItem payload; + payload.kind = DEBUG_LOG_COMMAND; + payload.tid = 0x0; + g_snprintf ((gchar *) &payload.message, MONO_MAX_DEBUGGER_MSG_LEN, msg); + mono_flight_recorder_append (debugger_log, &payload); +} + +void +mono_debugger_log_event (DebuggerTlsData *tls, const char *event, guint8 *buf, int len) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return; + + // FIXME: print the array in a format that can be decoded / printed? + intptr_t tid = mono_debugger_tls_thread_id (tls); + char *msg = g_strdup_printf ("Event logged of type %s Response: %d", event, len); + MonoDebugLogItem payload; + payload.kind = DEBUG_LOG_EVENT; + payload.tid = tid; + g_snprintf ((gchar *) &payload.message, MONO_MAX_DEBUGGER_MSG_LEN, msg); + mono_flight_recorder_append (debugger_log, &payload); +} + +void +mono_debugger_log_exit (int exit_code) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return; + + char *msg = g_strdup_printf ("Exited with code %d", exit_code); + MonoDebugLogItem payload; + payload.kind = DEBUG_LOG_EXIT; + payload.tid = 0x0; + g_snprintf ((gchar *) &payload.message, MONO_MAX_DEBUGGER_MSG_LEN, msg); + mono_flight_recorder_append (debugger_log, &payload); +} + +void +mono_debugger_log_add_bp (gpointer bp, MonoMethod *method, long il_offset) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return; + + MonoCoopMutex *debugger_log_mutex = mono_flight_recorder_mutex (debugger_log); + mono_coop_mutex_lock (debugger_log_mutex); + g_ptr_array_add (breakpoint_copy, bp); + mono_coop_mutex_unlock (debugger_log_mutex); + + char *msg = g_strdup_printf ("Add breakpoint %s %lu", method ? mono_method_full_name (method, TRUE) : "No method", il_offset); + MonoDebugLogItem payload; + payload.kind = DEBUG_LOG_BREAKPOINT; + payload.tid = 0x0; + g_snprintf ((gchar *) &payload.message, MONO_MAX_DEBUGGER_MSG_LEN, msg); + mono_flight_recorder_append (debugger_log, &payload); +} + +void +mono_debugger_log_remove_bp (gpointer bp, MonoMethod *method, long il_offset) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return; + + MonoCoopMutex *debugger_log_mutex = mono_flight_recorder_mutex (debugger_log); + mono_coop_mutex_lock (debugger_log_mutex); + g_ptr_array_remove (breakpoint_copy, bp); + mono_coop_mutex_unlock (debugger_log_mutex); + + char *msg = g_strdup_printf ("Remove breakpoint %s %lu", method ? mono_method_full_name (method, TRUE) : "No method", il_offset); + MonoDebugLogItem payload; + payload.kind = DEBUG_LOG_BREAKPOINT; + payload.tid = 0x0; + g_snprintf ((gchar *) &payload.message, MONO_MAX_DEBUGGER_MSG_LEN, msg); + mono_flight_recorder_append (debugger_log, &payload); +} + +void +mono_debugger_log_bp_hit (DebuggerTlsData *tls, MonoMethod *method, long il_offset) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return; + + intptr_t tid = mono_debugger_tls_thread_id (tls); + char *msg = g_strdup_printf ("Hit breakpoint %s %lu", method ? mono_method_full_name (method, TRUE) : "No method", il_offset); + MonoDebugLogItem payload; + payload.kind = DEBUG_LOG_BREAKPOINT; + payload.tid = tid; + g_snprintf ((gchar *) &payload.message, MONO_MAX_DEBUGGER_MSG_LEN, msg); + mono_flight_recorder_append (debugger_log, &payload); +} + +void +mono_debugger_log_resume (DebuggerTlsData *tls) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return; + + intptr_t tid = mono_debugger_tls_thread_id (tls); + MonoDebuggerThreadState prev_state = mono_debugger_get_thread_state (tls); + g_assert (prev_state == MONO_DEBUGGER_SUSPENDED || prev_state == MONO_DEBUGGER_STARTED); + mono_debugger_set_thread_state (tls, prev_state, MONO_DEBUGGER_RESUMED); + + char *msg = g_strdup_printf ("Resuming 0x%x from state %s", tid, mono_debug_log_thread_state_to_string (prev_state)); + MonoDebugLogItem payload; + payload.kind = DEBUG_LOG_STATE_CHANGE; + payload.tid = tid; + g_snprintf ((gchar *) &payload.message, MONO_MAX_DEBUGGER_MSG_LEN, msg); + mono_flight_recorder_append (debugger_log, &payload); +} + +void +mono_debugger_log_suspend (DebuggerTlsData *tls) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return; + + intptr_t tid = mono_debugger_tls_thread_id (tls); + MonoDebuggerThreadState prev_state = mono_debugger_get_thread_state (tls); + g_assert (prev_state == MONO_DEBUGGER_RESUMED || prev_state == MONO_DEBUGGER_STARTED); + mono_debugger_set_thread_state (tls, prev_state, MONO_DEBUGGER_SUSPENDED); + + char *msg = g_strdup_printf ("Suspending 0x%x from state %s", tid, mono_debug_log_thread_state_to_string (prev_state)); + MonoDebugLogItem payload; + payload.kind = DEBUG_LOG_STATE_CHANGE; + payload.tid = tid; + g_snprintf ((gchar *) &payload.message, MONO_MAX_DEBUGGER_MSG_LEN, msg); + mono_flight_recorder_append (debugger_log, &payload); +} + +typedef struct { + JsonWriter *writer; + gboolean not_first; +} DebuggerThreadIterState; + +// FIXME: log TCP handshake / connection state +static void +dump_thread_state (gpointer key, gpointer value, gpointer user_data) +{ + DebuggerTlsData *debugger_tls = (DebuggerTlsData *) value; + DebuggerThreadIterState *data = (DebuggerThreadIterState *) user_data; + + if (data->not_first) + mono_json_writer_printf (data->writer, ",\n"); + else + data->not_first = TRUE; + + mono_json_writer_indent (data->writer); + mono_json_writer_object_begin (data->writer); + + mono_json_writer_indent (data->writer); + mono_json_writer_object_key(data->writer, "thread_id"); + mono_json_writer_printf (data->writer, "\"0x%x\",\n", mono_debugger_tls_thread_id (debugger_tls)); + + mono_json_writer_indent (data->writer); + mono_json_writer_object_key (data->writer, "thread_state"); + const char *state = mono_debug_log_thread_state_to_string (mono_debugger_get_thread_state (debugger_tls)); + mono_json_writer_printf (data->writer, "\"%s\"\n", state); + + mono_json_writer_indent_pop (data->writer); + mono_json_writer_indent (data->writer); + mono_json_writer_object_end (data->writer); +} + +void +mono_debugger_state (JsonWriter *writer) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return; + + MonoCoopMutex *debugger_log_mutex = mono_flight_recorder_mutex (debugger_log); + mono_coop_mutex_lock (debugger_log_mutex); + mono_json_writer_object_begin(writer); + + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "debugger_state"); + mono_json_writer_object_begin(writer); + + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "thread_states"); + mono_json_writer_array_begin (writer); + mono_json_writer_indent_push (writer); + + DebuggerThreadIterState iterState; + iterState.writer = writer; + iterState.not_first = FALSE; + MonoGHashTable *thread_to_tls = mono_debugger_get_thread_states (); + mono_g_hash_table_foreach (thread_to_tls, dump_thread_state, &iterState); + mono_json_writer_printf (writer, "\n"); + + mono_json_writer_indent_pop (writer); + mono_json_writer_indent (writer); + mono_json_writer_array_end (writer); + + mono_json_writer_printf (writer, ",\n"); + + // FIXME: Log breakpoint state + if (breakpoint_copy->len > 0) { + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "breakpoints"); + mono_json_writer_array_begin (writer); + + for (int i=0; i < breakpoint_copy->len; i++) { + MonoBreakpoint *bp = (MonoBreakpoint *) g_ptr_array_index (breakpoint_copy, i); + + mono_json_writer_indent (writer); + mono_json_writer_object_begin(writer); + + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "method"); + mono_json_writer_printf (writer, "\"%s\",\n", bp->method ? mono_method_full_name (bp->method, TRUE) : "No method"); + + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "il_offset"); + mono_json_writer_printf (writer, "\"0x%x\",\n", bp->il_offset); + + mono_json_writer_indent_pop (writer); + mono_json_writer_indent (writer); + mono_json_writer_object_end (writer); + mono_json_writer_printf (writer, ",\n"); + } + + mono_json_writer_indent_pop (writer); + mono_json_writer_indent (writer); + mono_json_writer_array_end (writer); + mono_json_writer_printf (writer, ",\n"); + } + + // Log history + MonoFlightRecorderIter diter; + mono_flight_recorder_iter_init (debugger_log, &diter); + + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "debugger_history"); + mono_json_writer_array_begin (writer); + + gboolean first = TRUE; + MonoDebugLogItem item; + MonoFlightRecorderHeader header; + + while (mono_flight_recorder_iter_next (&diter, &header, (gpointer *) &item)) { + if (!first) + mono_json_writer_printf (writer, ",\n"); + else + first = FALSE; + + mono_json_writer_indent (writer); + mono_json_writer_object_begin(writer); + + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "kind"); + mono_json_writer_printf (writer, "\"%s\",\n", mono_debug_log_kind_to_string (item.kind)); + + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "tid"); + mono_json_writer_printf (writer, "\"0x%x\",\n", item.tid); + + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "message"); + mono_json_writer_printf (writer, "\"%s\",\n", item.message); + + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "counter"); + mono_json_writer_printf (writer, "\"%d\"\n", header.counter); + + mono_json_writer_indent_pop (writer); + mono_json_writer_indent (writer); + mono_json_writer_object_end (writer); + } + mono_json_writer_printf (writer, "\n"); + + mono_json_writer_indent_pop (writer); + mono_json_writer_indent (writer); + mono_json_writer_array_end (writer); + mono_json_writer_printf (writer, ",\n"); + + mono_flight_recorder_iter_destroy (&diter); + + // Log client/connection state + gboolean disconnected = mono_debugger_is_disconnected (); + mono_json_writer_indent (writer); + mono_json_writer_object_key(writer, "client_state"); + mono_json_writer_printf (writer, "\"%s\"\n", disconnected ? "disconnected" : "connected"); + + mono_json_writer_indent (writer); + mono_json_writer_object_end (writer); + mono_json_writer_printf (writer, "\n"); + + mono_json_writer_indent_pop (writer); + mono_json_writer_indent (writer); + mono_json_writer_object_end (writer); + + mono_coop_mutex_unlock (debugger_log_mutex); +} + +char * +mono_debugger_state_str (void) +{ + if (debugger_log == GINT_TO_POINTER (MONO_DEBUGGER_LOG_FREED)) + return NULL; + + JsonWriter writer; + mono_json_writer_init (&writer); + mono_debugger_state (&writer); + + char *result = g_strdup(writer.text->str); + mono_json_writer_destroy (&writer); + + return result; +} + diff --git a/mono/mini/debugger-state-machine.h b/mono/mini/debugger-state-machine.h new file mode 100644 index 0000000000..8c179e1e19 --- /dev/null +++ b/mono/mini/debugger-state-machine.h @@ -0,0 +1,70 @@ +/** + * \file + * Types for the debugger state machine and wire protocol + * + * Author: + * Alexander Kyte (alkyte@microsoft.com) + * + * (C) 2018 Microsoft, Inc. + * + */ +#ifndef __MONO_DEBUGGER_STATE_MACHINE__ +#define __MONO_DEBUGGER_STATE_MACHINE__ + + +#include +#include +#include +#include +#include "debugger-agent.h" + +typedef enum { + MONO_DEBUGGER_STARTED = 0, + MONO_DEBUGGER_RESUMED = 1, + MONO_DEBUGGER_SUSPENDED = 2, + MONO_DEBUGGER_TERMINATED = 3, +} MonoDebuggerThreadState; + +void +mono_debugger_log_init (void); + +void +mono_debugger_log_free (void); + +void +mono_debugger_log_exit (int exit_code); + +void +mono_debugger_log_add_bp (gpointer key, MonoMethod *method, long il_offset); + +void +mono_debugger_log_remove_bp (gpointer key, MonoMethod *method, long il_offset); + +void +mono_debugger_log_command (const char *command_set, const char *command, guint8 *buf, int len); + +void +mono_debugger_log_event (DebuggerTlsData *tls, const char *event, guint8 *buf, int len); + +void +mono_debugger_log_bp_hit (DebuggerTlsData *tls, MonoMethod *method, long il_offset); + +void +mono_debugger_log_resume (DebuggerTlsData *tls); + +void +mono_debugger_log_suspend (DebuggerTlsData *tls); + +#if 0 +#define DEBUGGER_STATE_MACHINE_DEBUG(level, ...) +#else +#define DEBUGGER_STATE_MACHINE_DEBUG(level, ...) MOSTLY_ASYNC_SAFE_PRINTF(__VA_ARGS__) +#endif + +void +mono_debugger_state (JsonWriter *writer); + +char * +mono_debugger_state_str (void); + +#endif // __MONO_DEBUGGER_STATE_MACHINE__ diff --git a/mono/mini/decompose.c b/mono/mini/decompose.c index 9d599dd44e..d522d7e01e 100644 --- a/mono/mini/decompose.c +++ b/mono/mini/decompose.c @@ -38,20 +38,20 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins) break; case OP_LCONV_TO_I8: case OP_LCONV_TO_U8: - if (SIZEOF_VOID_P == 4) + if (TARGET_SIZEOF_VOID_P == 4) ins->opcode = OP_LMOVE; else ins->opcode = OP_MOVE; break; case OP_LCONV_TO_I: - if (SIZEOF_VOID_P == 4) + if (TARGET_SIZEOF_VOID_P == 4) /* OP_LCONV_TO_I4 */ ins->opcode = OP_SEXT_I4; else ins->opcode = OP_MOVE; break; case OP_LCONV_TO_U: - if (SIZEOF_VOID_P == 4) { + if (TARGET_SIZEOF_VOID_P == 4) { /* OP_LCONV_TO_U4 */ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_UN_IMM, ins->dreg, ins->sreg1, 0); NULLIFY_INS (ins); @@ -208,7 +208,7 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins) NULLIFY_INS (ins); break; case OP_LCONV_TO_OVF_I4: -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 case OP_LCONV_TO_OVF_I: #endif MONO_EMIT_NEW_LCOMPARE_IMM (cfg, ins->sreg1, 0x7fffffff); @@ -225,7 +225,7 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins) NULLIFY_INS (ins); break; case OP_LCONV_TO_OVF_I4_UN: -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 case OP_LCONV_TO_OVF_I_UN: #endif MONO_EMIT_NEW_LCOMPARE_IMM (cfg, ins->sreg1, 0x7fffffff); @@ -234,7 +234,7 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins) NULLIFY_INS (ins); break; case OP_LCONV_TO_OVF_U4: -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 case OP_LCONV_TO_OVF_U: #endif MONO_EMIT_NEW_LCOMPARE_IMM (cfg, ins->sreg1, 0xffffffffUL); @@ -245,7 +245,7 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins) NULLIFY_INS (ins); break; case OP_LCONV_TO_OVF_U4_UN: -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 case OP_LCONV_TO_OVF_U_UN: #endif MONO_EMIT_NEW_LCOMPARE_IMM (cfg, ins->sreg1, 0xffffffff); @@ -253,7 +253,7 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins) MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, ins->dreg, ins->sreg1); NULLIFY_INS (ins); break; -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 case OP_LCONV_TO_OVF_I: case OP_LCONV_TO_OVF_U_UN: #endif @@ -261,7 +261,7 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins) case OP_LCONV_TO_OVF_I8: ins->opcode = OP_MOVE; break; -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 case OP_LCONV_TO_OVF_I_UN: #endif case OP_LCONV_TO_OVF_I8_UN: @@ -271,7 +271,7 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins) NULLIFY_INS (ins); break; case OP_LCONV_TO_OVF_U8: -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 case OP_LCONV_TO_OVF_U: #endif MONO_EMIT_NEW_LCOMPARE_IMM (cfg, ins->sreg1, 0); @@ -390,7 +390,7 @@ mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins) break; case OP_ICONV_TO_OVF_U4: case OP_ICONV_TO_OVF_I4_UN: -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 case OP_ICONV_TO_OVF_U: case OP_ICONV_TO_OVF_I_UN: #endif @@ -403,21 +403,21 @@ mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins) case OP_ICONV_TO_U4: case OP_ICONV_TO_OVF_I4: case OP_ICONV_TO_OVF_U4_UN: -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 case OP_ICONV_TO_OVF_I: case OP_ICONV_TO_OVF_U_UN: #endif ins->opcode = OP_MOVE; break; case OP_ICONV_TO_I: -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 ins->opcode = OP_SEXT_I4; #else ins->opcode = OP_MOVE; #endif break; case OP_ICONV_TO_U: -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 ins->opcode = OP_ZEXT_I4; #else ins->opcode = OP_MOVE; @@ -470,7 +470,7 @@ mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins) } break; -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 case OP_LDIV: case OP_LREM: case OP_LDIV_UN: @@ -633,8 +633,8 @@ mono_decompose_long_opts (MonoCompile *cfg) switch (tree->opcode) { case OP_I8CONST: - MONO_EMIT_NEW_ICONST (cfg, MONO_LVREG_LS (tree->dreg), tree->inst_ls_word); - MONO_EMIT_NEW_ICONST (cfg, MONO_LVREG_MS (tree->dreg), tree->inst_ms_word); + MONO_EMIT_NEW_ICONST (cfg, MONO_LVREG_LS (tree->dreg), ins_get_l_low (tree)); + MONO_EMIT_NEW_ICONST (cfg, MONO_LVREG_MS (tree->dreg), ins_get_l_high (tree)); break; case OP_DUMMY_I8CONST: MONO_EMIT_NEW_DUMMY_INIT (cfg, MONO_LVREG_LS (tree->dreg), OP_DUMMY_ICONST); @@ -917,24 +917,24 @@ mono_decompose_long_opts (MonoCompile *cfg) break; case OP_LADD_IMM: - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADDCC_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), tree->inst_ls_word); - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADC_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), tree->inst_ms_word); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADDCC_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), ins_get_l_low (tree)); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ADC_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), ins_get_l_high (tree)); break; case OP_LSUB_IMM: - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUBCC_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), tree->inst_ls_word); - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SBB_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), tree->inst_ms_word); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUBCC_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), ins_get_l_low (tree)); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SBB_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), ins_get_l_high (tree)); break; case OP_LAND_IMM: - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), tree->inst_ls_word); - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), tree->inst_ms_word); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), ins_get_l_low (tree)); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), ins_get_l_high (tree)); break; case OP_LOR_IMM: - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_OR_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), tree->inst_ls_word); - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_OR_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), tree->inst_ms_word); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_OR_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), ins_get_l_low (tree)); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_OR_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), ins_get_l_high (tree)); break; case OP_LXOR_IMM: - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_XOR_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), tree->inst_ls_word); - MONO_EMIT_NEW_BIALU_IMM (cfg, OP_XOR_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), tree->inst_ms_word); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_XOR_IMM, MONO_LVREG_LS (tree->dreg), MONO_LVREG_LS (tree->sreg1), ins_get_l_low (tree)); + MONO_EMIT_NEW_BIALU_IMM (cfg, OP_XOR_IMM, MONO_LVREG_MS (tree->dreg), MONO_LVREG_MS (tree->sreg1), ins_get_l_high (tree)); break; #ifdef TARGET_POWERPC /* FIXME This is normally handled in cprop. Proper fix or remove if no longer needed. */ @@ -1036,8 +1036,8 @@ mono_decompose_long_opts (MonoCompile *cfg) /* Not yet used, since lcompare is decomposed before local cprop */ case OP_LCOMPARE_IMM: { MonoInst *next = mono_inst_next (tree, FILTER_IL_SEQ_POINT); - guint32 low_imm = tree->inst_ls_word; - guint32 high_imm = tree->inst_ms_word; + guint32 low_imm = ins_get_l_low (tree); + guint32 high_imm = ins_get_l_high (tree); int low_reg = MONO_LVREG_LS (tree->sreg1); int high_reg = MONO_LVREG_MS (tree->sreg1); @@ -1214,6 +1214,9 @@ mono_decompose_vtype_opts (MonoCompile *cfg) restart = FALSE; for (ins = bb->code; ins; ins = ins->next) { +#ifdef MONO_ARCH_SIMD_INTRINSICS + mono_simd_decompose_intrinsic (cfg, bb, ins); +#endif switch (ins->opcode) { case OP_VMOVE: { g_assert (ins->klass); @@ -1541,7 +1544,7 @@ mono_decompose_array_access_opts (MonoCompile *cfg) MONO_ADD_INS (cfg->cbb, dest); break; case OP_BOUNDS_CHECK: - MONO_EMIT_NULL_CHECK (cfg, ins->sreg1); + MONO_EMIT_NULL_CHECK (cfg, ins->sreg1, FALSE); if (COMPILE_LLVM (cfg)) { int index2_reg = alloc_preg (cfg); MONO_EMIT_NEW_UNALU (cfg, OP_SEXT_I4, index2_reg, ins->sreg2); diff --git a/mono/mini/driver.c b/mono/mini/driver.c index eae72ec489..ad690317a2 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -75,6 +75,7 @@ static FILE *mini_stats_fd; static void mini_usage (void); static void mono_runtime_set_execution_mode (MonoEEMode mode); +static int mono_jit_exec_internal (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]); #ifdef HOST_WIN32 /* Need this to determine whether to detach console */ @@ -161,8 +162,10 @@ parse_optimizations (guint32 opt, const char* p, gboolean cpu_opts) /* call out to cpu detection code here that sets the defaults ... */ if (cpu_opts) { +#ifndef MONO_CROSS_COMPILE opt |= mono_arch_cpu_optimizations (&exclude); opt &= ~exclude; +#endif } if (!p) return opt; @@ -314,9 +317,9 @@ opt_sets [] = { MONO_OPT_FCMOV, MONO_OPT_ALIAS_ANALYSIS, #ifdef MONO_ARCH_SIMD_INTRINSICS - MONO_OPT_SIMD, + MONO_OPT_SIMD | MONO_OPT_INTRINS, MONO_OPT_SSE2, - MONO_OPT_SIMD | MONO_OPT_SSE2, + MONO_OPT_SIMD | MONO_OPT_SSE2 | MONO_OPT_INTRINS, #endif MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_INTRINS, MONO_OPT_BRANCH | MONO_OPT_PEEPHOLE | MONO_OPT_INTRINS | MONO_OPT_ALIAS_ANALYSIS, @@ -554,7 +557,7 @@ mini_regression_list (int verbose, int count, char *images []) g_warning ("failed to load assembly: %s", images [i]); continue; } - total += mini_regression (mono_assembly_get_image (ass), verbose, &run); + total += mini_regression (mono_assembly_get_image_internal (ass), verbose, &run); total_run += run; } if (total > 0){ @@ -627,11 +630,16 @@ interp_regression_step (MonoImage *image, int verbose, int *total_run, int *tota /* FIXME: there is an ordering problem if there're multiple attributes, do this instead: * MonoObject *obj = create_custom_attr (ainfo->image, centry->ctor, centry->data, centry->data_size, error); */ mono_error_cleanup (error); - MonoMethod *getter = mono_class_get_method_from_name (klass, "get_Category", -1); + error_init (error); + MonoMethod *getter = mono_class_get_method_from_name_checked (klass, "get_Category", -1, 0, error); + mono_error_cleanup (error); + error_init (error); MonoObject *str = mini_get_interp_callbacks ()->runtime_invoke (getter, obj, NULL, &exc, error); mono_error_cleanup (error); + error_init (error); char *utf8_str = mono_string_to_utf8_checked ((MonoString *) str, error); mono_error_cleanup (error); + error_init (error); if (!strcmp (utf8_str, "!INTERPRETER")) { g_print ("skip %s...\n", method->name); filter = FALSE; @@ -720,7 +728,7 @@ mono_interp_regression_list (int verbose, int count, char *images []) g_warning ("failed to load assembly: %s", images [i]); continue; } - total += interp_regression (mono_assembly_get_image (ass), verbose, &run); + total += interp_regression (mono_assembly_get_image_internal (ass), verbose, &run); total_run += run; } if (total > 0) { @@ -1076,7 +1084,7 @@ compile_all_methods_thread_main_inner (CompileAllThreadArgs *args) { MonoAssembly *ass = args->ass; int verbose = args->verbose; - MonoImage *image = mono_assembly_get_image (ass); + MonoImage *image = mono_assembly_get_image_internal (ass); MonoMethod *method; MonoCompile *cfg; int i, count = 0, fail_count = 0; @@ -1174,8 +1182,19 @@ compile_all_methods (MonoAssembly *ass, int verbose, guint32 opts, guint32 recom int mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]) { + int rv; + MONO_ENTER_GC_UNSAFE; + rv = mono_jit_exec_internal (domain, assembly, argc, argv); + MONO_EXIT_GC_UNSAFE; + return rv; +} + +int +mono_jit_exec_internal (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]) +{ + MONO_REQ_GC_UNSAFE_MODE; ERROR_DECL (error); - MonoImage *image = mono_assembly_get_image (assembly); + MonoImage *image = mono_assembly_get_image_internal (assembly); MonoMethod *method; guint32 entry = mono_image_get_entry_point (image); @@ -1321,7 +1340,7 @@ load_agent (MonoDomain *domain, char *desc) * Can't use mono_jit_exec (), as it sets things which might confuse the * real Main method. */ - image = mono_assembly_get_image (agent_assembly); + image = mono_assembly_get_image_internal (agent_assembly); entry = mono_image_get_entry_point (image); if (!entry) { g_print ("Assembly '%s' doesn't have an entry point.\n", mono_image_get_filename (image)); @@ -1503,50 +1522,67 @@ mini_debug_usage (void) #define MONO_ARCHITECTURE MONO_ARCH_ARCHITECTURE #endif -static const char info[] = -#ifdef HAVE_KW_THREAD - "\tTLS: __thread\n" +static char * +mono_get_version_info (void) +{ + GString *output; + output = g_string_new (""); + +#ifdef MONO_KEYWORD_THREAD + g_string_append_printf (output, "\tTLS: __thread\n"); #else - "\tTLS: normal\n" -#endif /* HAVE_KW_THREAD */ + g_string_append_printf (output, "\tTLS: \n"); +#endif /* MONO_KEYWORD_THREAD */ + #ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK - "\tSIGSEGV: altstack\n" + g_string_append_printf (output, "\tSIGSEGV: altstack\n"); #else - "\tSIGSEGV: normal\n" + g_string_append_printf (output, "\tSIGSEGV: normal\n"); #endif + #ifdef HAVE_EPOLL - "\tNotifications: epoll\n" + g_string_append_printf (output, "\tNotifications: epoll\n"); #elif defined(HAVE_KQUEUE) - "\tNotification: kqueue\n" + g_string_append_printf (output, "\tNotification: kqueue\n"); #else - "\tNotification: Thread + polling\n" + g_string_append_printf (output, "\tNotification: Thread + polling\n"); #endif - "\tArchitecture: " MONO_ARCHITECTURE "\n" - "\tDisabled: " DISABLED_FEATURES "\n" - "\tMisc: " + + g_string_append_printf (output, "\tArchitecture: %s\n", MONO_ARCHITECTURE); + g_string_append_printf (output, "\tDisabled: %s\n", DISABLED_FEATURES); + + g_string_append_printf (output, "\tMisc: "); #ifdef MONO_SMALL_CONFIG - "smallconfig " + g_string_append_printf (output, "smallconfig "); #endif + #ifdef MONO_BIG_ARRAYS - "bigarrays " + g_string_append_printf (output, "bigarrays "); #endif + #if !defined(DISABLE_SDB) - "softdebug " + g_string_append_printf (output, "softdebug "); #endif - "\n" + g_string_append_printf (output, "\n"); + #ifndef DISABLE_INTERPRETER - "\tInterpreter: yes\n" + g_string_append_printf (output, "\tInterpreter: yes\n"); #else - "\tInterpreter: no\n" + g_string_append_printf (output, "\tInterpreter: no\n"); #endif + #ifdef MONO_ARCH_LLVM_SUPPORTED #ifdef ENABLE_LLVM - "\tLLVM: yes(" LLVM_VERSION ")\n" + g_string_append_printf (output, "\tLLVM: yes(%d)\n", LLVM_API_VERSION); #else - "\tLLVM: supported, not enabled.\n" + g_string_append_printf (output, "\tLLVM: supported, not enabled.\n"); #endif #endif - ""; + + g_string_append_printf (output, "\tSuspend: %s\n", mono_threads_suspend_policy_name ()); + + return g_string_free (output, FALSE); +} #ifndef MONO_ARCH_AOT_SUPPORTED #define error_if_aot_unsupported() do {fprintf (stderr, "AOT compilation is not supported on this platform.\n"); exit (1);} while (0) @@ -1774,6 +1810,7 @@ mono_enable_interp (const char *opts) #ifndef MONO_ARCH_INTERPRETER_SUPPORTED g_error ("--interpreter not supported on this architecture.\n"); #endif + } /** @@ -1867,7 +1904,10 @@ mono_main (int argc, char* argv[]) g_print ("Mono JIT compiler version %s\nCopyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com\n", build); g_free (build); + char *info = mono_get_version_info (); g_print (info); + g_free (info); + gc_descr = mono_gc_get_description (); g_print ("\tGC: %s\n", gc_descr); g_free (gc_descr); @@ -2217,10 +2257,7 @@ mono_main (int argc, char* argv[]) fprintf (stderr, "This mono runtime is compiled for cross-compiling. Only the --aot option is supported.\n"); exit (1); } -#if SIZEOF_VOID_P == 8 && (defined(TARGET_ARM) || defined(TARGET_X86)) - fprintf (stderr, "Can't cross-compile on 64-bit platforms to 32-bit architecture.\n"); - exit (1); -#elif SIZEOF_VOID_P == 4 && (defined(TARGET_ARM64) || defined(TARGET_AMD64)) +#if TARGET_SIZEOF_VOID_P == 4 && (defined(TARGET_ARM64) || defined(TARGET_AMD64)) fprintf (stderr, "Can't cross-compile on 32-bit platforms to 64-bit architecture.\n"); exit (1); #endif @@ -2383,7 +2420,7 @@ mono_main (int argc, char* argv[]) #if defined(HOST_WIN32) && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) /* Detach console when executing IMAGE_SUBSYSTEM_WINDOWS_GUI on win32 */ - if (!enable_debugging && !mono_compile_aot && ((MonoCLIImageInfo*)(mono_assembly_get_image (assembly)->image_info))->cli_header.nt.pe_subsys_required == IMAGE_SUBSYSTEM_WINDOWS_GUI) + if (!enable_debugging && !mono_compile_aot && ((MonoCLIImageInfo*)(mono_assembly_get_image_internal (assembly)->image_info))->cli_header.nt.pe_subsys_required == IMAGE_SUBSYSTEM_WINDOWS_GUI) FreeConsole (); #endif @@ -2418,7 +2455,7 @@ mono_main (int argc, char* argv[]) mini_cleanup (domain); return 3; } - method = mono_method_desc_search_in_image (desc, mono_assembly_get_image (assembly)); + method = mono_method_desc_search_in_image (desc, mono_assembly_get_image_internal (assembly)); if (!method) { g_print ("Cannot find method %s\n", mname); mini_cleanup (domain); @@ -2564,9 +2601,11 @@ mono_jit_init_version (const char *domain_name, const char *runtime_version) void mono_jit_cleanup (MonoDomain *domain) { + MONO_ENTER_GC_UNSAFE; mono_thread_manage (); mini_cleanup (domain); + MONO_EXIT_GC_UNSAFE; } void diff --git a/mono/mini/dwarfwriter.c b/mono/mini/dwarfwriter.c index 156a8b3b8b..cb2e642493 100644 --- a/mono/mini/dwarfwriter.c +++ b/mono/mini/dwarfwriter.c @@ -23,6 +23,7 @@ #include #include +#include #ifndef HOST_WIN32 #include @@ -353,7 +354,7 @@ emit_cie (MonoDwarfWriter *w) g_free (uw_info); } - emit_alignment (w, sizeof (gpointer)); + emit_alignment (w, sizeof (target_mgreg_t)); emit_label (w, ".Lcie0_end"); } @@ -361,7 +362,7 @@ static void emit_pointer_value (MonoDwarfWriter *w, gpointer ptr) { gssize val = (gssize)ptr; - emit_bytes (w, (guint8*)&val, sizeof (gpointer)); + emit_bytes (w, (guint8*)&val, sizeof (target_mgreg_t)); } static void @@ -393,7 +394,7 @@ emit_fde (MonoDwarfWriter *w, int fde_index, char *start_symbol, char *end_symbo emit_pointer_value (w, code); emit_int32 (w, code_size); } -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 /* Upper 32 bits of code size */ emit_int32 (w, 0); #endif @@ -413,7 +414,7 @@ emit_fde (MonoDwarfWriter *w, int fde_index, char *start_symbol, char *end_symbo emit_bytes (w, uw_info, uw_info_len); g_free (uw_info); - emit_alignment (w, sizeof (mgreg_t)); + emit_alignment (w, sizeof (target_mgreg_t)); emit_label (w, symbol2); } @@ -556,15 +557,15 @@ static DwarfBasicType basic_types [] = { { ".LDIE_U4", "uint", MONO_TYPE_U4, 4, DW_ATE_unsigned }, { ".LDIE_I8", "long", MONO_TYPE_I8, 8, DW_ATE_signed }, { ".LDIE_U8", "ulong", MONO_TYPE_U8, 8, DW_ATE_unsigned }, - { ".LDIE_I", "intptr", MONO_TYPE_I, SIZEOF_VOID_P, DW_ATE_signed }, - { ".LDIE_U", "uintptr", MONO_TYPE_U, SIZEOF_VOID_P, DW_ATE_unsigned }, + { ".LDIE_I", "intptr", MONO_TYPE_I, TARGET_SIZEOF_VOID_P, DW_ATE_signed }, + { ".LDIE_U", "uintptr", MONO_TYPE_U, TARGET_SIZEOF_VOID_P, DW_ATE_unsigned }, { ".LDIE_R4", "float", MONO_TYPE_R4, 4, DW_ATE_float }, { ".LDIE_R8", "double", MONO_TYPE_R8, 8, DW_ATE_float }, { ".LDIE_BOOLEAN", "boolean", MONO_TYPE_BOOLEAN, 1, DW_ATE_boolean }, { ".LDIE_CHAR", "char", MONO_TYPE_CHAR, 2, DW_ATE_unsigned_char }, - { ".LDIE_STRING", "string", MONO_TYPE_STRING, sizeof (gpointer), DW_ATE_address }, - { ".LDIE_OBJECT", "object", MONO_TYPE_OBJECT, sizeof (gpointer), DW_ATE_address }, - { ".LDIE_SZARRAY", "object", MONO_TYPE_SZARRAY, sizeof (gpointer), DW_ATE_address }, + { ".LDIE_STRING", "string", MONO_TYPE_STRING, sizeof (target_mgreg_t), DW_ATE_address }, + { ".LDIE_OBJECT", "object", MONO_TYPE_OBJECT, sizeof (target_mgreg_t), DW_ATE_address }, + { ".LDIE_SZARRAY", "object", MONO_TYPE_SZARRAY, sizeof (target_mgreg_t), DW_ATE_address }, }; /* Constants for encoding line number special opcodes */ @@ -842,7 +843,7 @@ mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSLis emit_label (w, ".Ldebug_info_begin"); emit_int16 (w, 0x2); /* DWARF version 2 */ emit_int32 (w, 0); /* .debug_abbrev offset */ - emit_byte (w, sizeof (gpointer)); /* address size */ + emit_byte (w, sizeof (target_mgreg_t)); /* address size */ /* Compilation unit */ emit_uleb128 (w, ABBREV_COMPILE_UNIT); @@ -981,7 +982,7 @@ emit_class_dwarf_info (MonoDwarfWriter *w, MonoClass *klass, gboolean vtype) /* Emit enum values */ iter = NULL; - while ((field = mono_class_get_fields (klass, &iter))) { + while ((field = mono_class_get_fields_internal (klass, &iter))) { const char *p; MonoTypeEnum def_type; @@ -1016,7 +1017,7 @@ emit_class_dwarf_info (MonoDwarfWriter *w, MonoClass *klass, gboolean vtype) break; case MONO_TYPE_I: case MONO_TYPE_U: -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 emit_sleb128 (w, read64 (p)); #else emit_sleb128 (w, read32 (p)); @@ -1040,7 +1041,7 @@ emit_class_dwarf_info (MonoDwarfWriter *w, MonoClass *klass, gboolean vtype) /* Emit field types */ iter = NULL; - while ((field = mono_class_get_fields (klass, &iter))) { + while ((field = mono_class_get_fields_internal (klass, &iter))) { if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; @@ -1048,7 +1049,7 @@ emit_class_dwarf_info (MonoDwarfWriter *w, MonoClass *klass, gboolean vtype) } iter = NULL; - has_children = parent_die || mono_class_get_fields (klass, &iter); + has_children = parent_die || mono_class_get_fields_internal (klass, &iter); emit_label (w, die); @@ -1069,7 +1070,7 @@ emit_class_dwarf_info (MonoDwarfWriter *w, MonoClass *klass, gboolean vtype) /* Emit fields */ iter = NULL; - while ((field = mono_class_get_fields (klass, &iter))) { + while ((field = mono_class_get_fields_internal (klass, &iter))) { if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; @@ -1082,7 +1083,7 @@ emit_class_dwarf_info (MonoDwarfWriter *w, MonoClass *klass, gboolean vtype) p = buf; *p ++= DW_OP_plus_uconst; if (m_class_is_valuetype (klass) && vtype) - encode_uleb128 (field->offset - sizeof (MonoObject), p, &p); + encode_uleb128 (field->offset - MONO_ABI_SIZEOF (MonoObject), p, &p); else encode_uleb128 (field->offset, p, &p); @@ -1596,7 +1597,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, emit_section_change (w, ".debug_line", 0); emit_byte (w, 0); - emit_byte (w, sizeof (gpointer) + 1); + emit_byte (w, sizeof (target_mgreg_t) + 1); emit_byte (w, DW_LNE_set_address); if (start_symbol) emit_pointer_unaligned (w, start_symbol); @@ -1669,7 +1670,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, emit_section_change (w, ".debug_line", 0); emit_byte (w, 0); - emit_byte (w, sizeof (gpointer) + 1); + emit_byte (w, sizeof (target_mgreg_t) + 1); emit_byte (w, DW_LNE_set_address); emit_pointer_value (w, code); diff --git a/mono/mini/ee.h b/mono/mini/ee.h index c89eb87174..af1fd730de 100644 --- a/mono/mini/ee.h +++ b/mono/mini/ee.h @@ -15,7 +15,7 @@ #ifndef __MONO_EE_H__ #define __MONO_EE_H__ -#define MONO_EE_API_VERSION 0x4 +#define MONO_EE_API_VERSION 0x5 typedef struct _MonoInterpStackIter MonoInterpStackIter; @@ -28,7 +28,7 @@ typedef gpointer MonoInterpFrameHandle; struct _MonoEECallbacks { void (*entry_from_trampoline) (gpointer ccontext, gpointer imethod); - gpointer (*create_method_pointer) (MonoMethod *method, MonoError *error); + gpointer (*create_method_pointer) (MonoMethod *method, gboolean compile, MonoError *error); MonoObject* (*runtime_invoke) (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error); void (*init_delegate) (MonoDelegate *del); void (*delegate_ctor) (MonoObjectHandle this_obj, MonoObjectHandle target, gpointer addr, MonoError *error); diff --git a/mono/mini/exceptions-amd64.c b/mono/mini/exceptions-amd64.c index ac4e496416..4fab03e79d 100644 --- a/mono/mini/exceptions-amd64.c +++ b/mono/mini/exceptions-amd64.c @@ -1084,8 +1084,8 @@ static GList *g_dynamic_function_table_end; // SRW lock (lightweight read/writer lock) protecting dynamic function table. static SRWLOCK g_dynamic_function_table_lock = SRWLOCK_INIT; -// Module handle used when explicit loading ntdll. -static HMODULE g_ntdll; +static RtlInstallFunctionTableCallbackPtr g_rtl_install_function_table_callback; +static RtlDeleteFunctionTablePtr g_rtl_delete_function_table; // If Win8 or Win2012Server or later, use growable function tables instead // of callbacks. Callback solution will still be fallback on older systems. @@ -1096,9 +1096,9 @@ static RtlDeleteGrowableFunctionTablePtr g_rtl_delete_growable_function_table; // When using function table callback solution an out of proc module is needed by // debuggers in order to read unwind info from debug target. #ifdef _MSC_VER -#define MONO_DAC_MODULE TEXT("mono-2.0-dac-sgen.dll") +#define MONO_DAC_MODULE L"mono-2.0-dac-sgen.dll" #else -#define MONO_DAC_MODULE TEXT("mono-2.0-sgen.dll") +#define MONO_DAC_MODULE L"mono-2.0-sgen.dll" #endif #define MONO_DAC_MODULE_MAX_PATH 1024 @@ -1109,17 +1109,28 @@ init_table_no_lock (void) if (g_dyn_func_table_inited == FALSE) { g_assert_checked (g_dynamic_function_table_begin == NULL); g_assert_checked (g_dynamic_function_table_end == NULL); + g_assert_checked (g_rtl_install_function_table_callback == NULL); + g_assert_checked (g_rtl_delete_function_table == NULL); g_assert_checked (g_rtl_add_growable_function_table == NULL); g_assert_checked (g_rtl_grow_function_table == NULL); g_assert_checked (g_rtl_delete_growable_function_table == NULL); - g_assert_checked (g_ntdll == NULL); // Load functions available on Win8/Win2012Server or later. If running on earlier // systems the below GetProceAddress will fail, this is expected behavior. - if (GetModuleHandleEx (0, TEXT("ntdll.dll"), &g_ntdll) == TRUE) { - g_rtl_add_growable_function_table = (RtlAddGrowableFunctionTablePtr)GetProcAddress (g_ntdll, "RtlAddGrowableFunctionTable"); - g_rtl_grow_function_table = (RtlGrowFunctionTablePtr)GetProcAddress (g_ntdll, "RtlGrowFunctionTable"); - g_rtl_delete_growable_function_table = (RtlDeleteGrowableFunctionTablePtr)GetProcAddress (g_ntdll, "RtlDeleteGrowableFunctionTable"); + HMODULE ntdll; + if (GetModuleHandleEx (0, L"ntdll.dll", &ntdll)) { + g_rtl_add_growable_function_table = (RtlAddGrowableFunctionTablePtr)GetProcAddress (ntdll, "RtlAddGrowableFunctionTable"); + g_rtl_grow_function_table = (RtlGrowFunctionTablePtr)GetProcAddress (ntdll, "RtlGrowFunctionTable"); + g_rtl_delete_growable_function_table = (RtlDeleteGrowableFunctionTablePtr)GetProcAddress (ntdll, "RtlDeleteGrowableFunctionTable"); + } + + // Fallback on systems not having RtlAddGrowableFunctionTable. + if (g_rtl_add_growable_function_table == NULL) { + HMODULE kernel32dll; + if (GetModuleHandleEx (0, L"kernel32.dll", &kernel32dll)) { + g_rtl_install_function_table_callback = (RtlInstallFunctionTableCallbackPtr)GetProcAddress (kernel32dll, "RtlInstallFunctionTableCallback"); + g_rtl_delete_function_table = (RtlDeleteFunctionTablePtr)GetProcAddress (kernel32dll, "RtlDeleteFunctionTable"); + } } g_dyn_func_table_inited = TRUE; @@ -1162,10 +1173,8 @@ terminate_table_no_lock (void) g_rtl_grow_function_table = NULL; g_rtl_add_growable_function_table = NULL; - if (g_ntdll != NULL) { - FreeLibrary (g_ntdll); - g_ntdll = NULL; - } + g_rtl_delete_function_table = NULL; + g_rtl_install_function_table_callback = NULL; g_dyn_func_table_inited = FALSE; } @@ -1392,7 +1401,7 @@ mono_arch_unwindinfo_insert_range_in_table (const gpointer code_block, gsize blo new_entry->rt_funcs, new_entry->rt_funcs_current_count, new_entry->rt_funcs_max_count, new_entry->begin_range, new_entry->end_range); g_assert (!result); - } else { + } else if (g_rtl_install_function_table_callback != NULL) { WCHAR buffer [MONO_DAC_MODULE_MAX_PATH] = { 0 }; WCHAR *path = buffer; @@ -1410,10 +1419,12 @@ mono_arch_unwindinfo_insert_range_in_table (const gpointer code_block, gsize blo // Register function table callback + out of proc module. new_entry->handle = (PVOID)((DWORD64)(new_entry->begin_range) | 3); - BOOLEAN result = RtlInstallFunctionTableCallback ((DWORD64)(new_entry->handle), - (DWORD64)(new_entry->begin_range), (DWORD)(new_entry->end_range - new_entry->begin_range), - MONO_GET_RUNTIME_FUNCTION_CALLBACK, new_entry, path); + BOOLEAN result = g_rtl_install_function_table_callback ((DWORD64)(new_entry->handle), + (DWORD64)(new_entry->begin_range), (DWORD)(new_entry->end_range - new_entry->begin_range), + MONO_GET_RUNTIME_FUNCTION_CALLBACK, new_entry, path); g_assert(result); + } else { + g_assert_not_reached (); } // Only included in checked builds. Validates the structure of table after insert. @@ -1447,8 +1458,10 @@ remove_range_in_table_no_lock (GList *entry) if (removed_entry->handle != NULL) { if (g_rtl_delete_growable_function_table != NULL) { g_rtl_delete_growable_function_table (removed_entry->handle); + } else if (g_rtl_delete_function_table != NULL) { + g_rtl_delete_function_table ((PRUNTIME_FUNCTION)removed_entry->handle); } else { - RtlDeleteFunctionTable ((PRUNTIME_FUNCTION)removed_entry->handle); + g_assert_not_reached (); } } @@ -1772,7 +1785,7 @@ mono_arch_unwindinfo_init_method_unwind_info (gpointer cfg) } void -mono_arch_unwindinfo_install_method_unwind_info (gpointer *monoui, gpointer code, guint code_size) +mono_arch_unwindinfo_install_method_unwind_info (PUNWIND_INFO *monoui, gpointer code, guint code_size) { PUNWIND_INFO unwindinfo, targetinfo; guchar codecount; @@ -1780,7 +1793,7 @@ mono_arch_unwindinfo_install_method_unwind_info (gpointer *monoui, gpointer code if (!*monoui) return; - unwindinfo = (PUNWIND_INFO)*monoui; + unwindinfo = *monoui; targetlocation = (guint64)&(((guchar*)code)[code_size]); targetinfo = (PUNWIND_INFO) ALIGN_TO(targetlocation, sizeof (mgreg_t)); diff --git a/mono/mini/exceptions-wasm.c b/mono/mini/exceptions-wasm.c index 0b2158c967..9c7d26048e 100644 --- a/mono/mini/exceptions-wasm.c +++ b/mono/mini/exceptions-wasm.c @@ -53,7 +53,7 @@ gpointer mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) { if (info) - *info = mono_tramp_info_create ("call_filter", wasm_call_filter, 1, NULL, NULL); + *info = mono_tramp_info_create ("call_filter", (guint8*)wasm_call_filter, 1, NULL, NULL); return wasm_call_filter; } @@ -61,14 +61,14 @@ gpointer mono_arch_get_restore_context (MonoTrampInfo **info, gboolean aot) { if (info) - *info = mono_tramp_info_create ("restore_context", wasm_restore_context, 1, NULL, NULL); + *info = mono_tramp_info_create ("restore_context", (guint8*)wasm_restore_context, 1, NULL, NULL); return wasm_restore_context; } gpointer mono_arch_get_throw_corlib_exception (MonoTrampInfo **info, gboolean aot) { if (info) - *info = mono_tramp_info_create ("throw_corlib_exception", wasm_throw_corlib_exception, 1, NULL, NULL); + *info = mono_tramp_info_create ("throw_corlib_exception", (guint8*)wasm_throw_corlib_exception, 1, NULL, NULL); return wasm_throw_corlib_exception; } @@ -76,7 +76,7 @@ gpointer mono_arch_get_rethrow_exception (MonoTrampInfo **info, gboolean aot) { if (info) - *info = mono_tramp_info_create ("rethrow_exception", wasm_rethrow_exception, 1, NULL, NULL); + *info = mono_tramp_info_create ("rethrow_exception", (guint8*)wasm_rethrow_exception, 1, NULL, NULL); return wasm_rethrow_exception; } @@ -84,7 +84,7 @@ gpointer mono_arch_get_throw_exception (MonoTrampInfo **info, gboolean aot) { if (info) - *info = mono_tramp_info_create ("throw_exception", wasm_throw_exception, 1, NULL, NULL); + *info = mono_tramp_info_create ("throw_exception", (guint8*)wasm_throw_exception, 1, NULL, NULL); return wasm_throw_exception; } diff --git a/mono/mini/exceptions-x86.c b/mono/mini/exceptions-x86.c index 474d54695c..a39c7ab2f6 100644 --- a/mono/mini/exceptions-x86.c +++ b/mono/mini/exceptions-x86.c @@ -798,7 +798,7 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, *new_ctx = *ctx; if (ji != NULL) { - gssize regs [MONO_MAX_IREGS + 1]; + mgreg_t regs [MONO_MAX_IREGS + 1]; guint8 *cfa; guint32 unwind_info_len; guint8 *unwind_info; @@ -888,6 +888,9 @@ mono_arch_ip_from_context (void *sigctx) #if defined(HOST_WATCHOS) printf("WARNING: mono_arch_ip_from_context() called!\n"); return (NULL); +#elif defined(MONO_CROSS_COMPILE) + g_assert_not_reached (); + return NULL; #elif defined(MONO_ARCH_USE_SIGACTION) ucontext_t *ctx = (ucontext_t*)sigctx; return (gpointer)UCONTEXT_REG_EIP (ctx); @@ -1088,7 +1091,7 @@ altstack_handle_and_restore (MonoContext *ctx, gpointer obj, gboolean stack_ovf) void mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo, gpointer fault_addr, gboolean stack_ovf) { -#ifdef MONO_ARCH_USE_SIGACTION +#if defined(MONO_ARCH_USE_SIGACTION) && !defined(MONO_CROSS_COMPILE) MonoException *exc = NULL; ucontext_t *ctx = (ucontext_t*)sigctx; MonoJitInfo *ji = mini_jit_info_table_find (mono_domain_get (), (gpointer)UCONTEXT_REG_EIP (ctx), NULL); diff --git a/mono/mini/helpers.c b/mono/mini/helpers.c index 95a08a3a74..1e37c6a3e4 100644 --- a/mono/mini/helpers.c +++ b/mono/mini/helpers.c @@ -192,9 +192,9 @@ mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) } } if (cindex == 0) { - fprintf (ofd, "\n.byte %d", (unsigned int) code [i]); + fprintf (ofd, "\n.byte %u", (unsigned int) code [i]); } else { - fprintf (ofd, ",%d", (unsigned int) code [i]); + fprintf (ofd, ",%u", (unsigned int) code [i]); } cindex++; if (cindex == 64) diff --git a/mono/mini/image-writer.c b/mono/mini/image-writer.c index 3e1d64b555..94cc996dbb 100644 --- a/mono/mini/image-writer.c +++ b/mono/mini/image-writer.c @@ -675,7 +675,7 @@ enum { SECT_NUM }; -#if SIZEOF_VOID_P == 4 +#if TARGET_SIZEOF_VOID_P == 4 typedef Elf32_Ehdr ElfHeader; typedef Elf32_Shdr ElfSectHeader; @@ -707,15 +707,15 @@ typedef struct { static SectInfo section_info [] = { {"", 0, 0, 0, 0}, - {".hash", SHT_HASH, 4, 2, SIZEOF_VOID_P}, - {".dynsym", SHT_DYNSYM, sizeof (ElfSymbol), 2, SIZEOF_VOID_P}, + {".hash", SHT_HASH, 4, 2, TARGET_SIZEOF_VOID_P}, + {".dynsym", SHT_DYNSYM, sizeof (ElfSymbol), 2, TARGET_SIZEOF_VOID_P}, {".dynstr", SHT_STRTAB, 0, 2, 1}, - {".rel.dyn", SHT_REL, sizeof (ElfReloc), 2, SIZEOF_VOID_P}, - {".rela.dyn", SHT_RELA, sizeof (ElfRelocA), 2, SIZEOF_VOID_P}, + {".rel.dyn", SHT_REL, sizeof (ElfReloc), 2, TARGET_SIZEOF_VOID_P}, + {".rela.dyn", SHT_RELA, sizeof (ElfRelocA), 2, TARGET_SIZEOF_VOID_P}, {".text", SHT_PROGBITS, 0, 6, 4096}, {".rodata", SHT_PROGBITS, 0, SHF_ALLOC, 4096}, - {".dynamic", SHT_DYNAMIC, sizeof (ElfDynamic), 3, SIZEOF_VOID_P}, - {".got.plt", SHT_PROGBITS, SIZEOF_VOID_P, 3, SIZEOF_VOID_P}, + {".dynamic", SHT_DYNAMIC, sizeof (ElfDynamic), 3, TARGET_SIZEOF_VOID_P}, + {".got.plt", SHT_PROGBITS, TARGET_SIZEOF_VOID_P, 3, TARGET_SIZEOF_VOID_P}, {".data", SHT_PROGBITS, 0, 3, 8}, {".bss", SHT_NOBITS, 0, 3, 8}, {".debug_frame", SHT_PROGBITS, 0, 0, 8}, @@ -724,7 +724,7 @@ static SectInfo section_info [] = { {".debug_line", SHT_PROGBITS, 0, 0, 1}, {".debug_loc", SHT_PROGBITS, 0, 0, 1}, {".shstrtab", SHT_STRTAB, 0, 0, 1}, - {".symtab", SHT_SYMTAB, sizeof (ElfSymbol), 0, SIZEOF_VOID_P}, + {".symtab", SHT_SYMTAB, sizeof (ElfSymbol), 0, TARGET_SIZEOF_VOID_P}, {".strtab", SHT_STRTAB, 0, 0, 1} }; @@ -1247,8 +1247,8 @@ bin_writer_emit_writeout (MonoImageWriter *acfg) secth [i].sh_flags = section_info [i].flags; secth [i].sh_entsize = section_info [i].esize; } - secth [SECT_DYNSYM].sh_info = SIZEOF_VOID_P == 4 ? 4 : 2; - secth [SECT_SYMTAB].sh_info = SIZEOF_VOID_P == 4 ? 20 : 17; + secth [SECT_DYNSYM].sh_info = TARGET_SIZEOF_VOID_P == 4 ? 4 : 2; + secth [SECT_SYMTAB].sh_info = TARGET_SIZEOF_VOID_P == 4 ? 20 : 17; secth [SECT_HASH].sh_link = SECT_DYNSYM; secth [SECT_DYNSYM].sh_link = SECT_DYNSTR; secth [SECT_REL_DYN].sh_link = SECT_DYNSYM; @@ -1359,7 +1359,7 @@ bin_writer_emit_writeout (MonoImageWriter *acfg) virt_offset = ALIGN_TO (virt_offset, secth [SECT_GOT_PLT].sh_addralign); secth [SECT_GOT_PLT].sh_addr = virt_offset; secth [SECT_GOT_PLT].sh_offset = file_offset; - size = 3 * SIZEOF_VOID_P; + size = 3 * TARGET_SIZEOF_VOID_P; secth [SECT_GOT_PLT].sh_size = size; file_offset += size; virt_offset += size; @@ -1456,7 +1456,7 @@ bin_writer_emit_writeout (MonoImageWriter *acfg) header.e_ident [EI_MAG1] = ELFMAG1; header.e_ident [EI_MAG2] = ELFMAG2; header.e_ident [EI_MAG3] = ELFMAG3; - header.e_ident [EI_CLASS] = SIZEOF_VOID_P == 4 ? ELFCLASS32 : ELFCLASS64; + header.e_ident [EI_CLASS] = TARGET_SIZEOF_VOID_P == 4 ? ELFCLASS32 : ELFCLASS64; header.e_ident [EI_DATA] = ELFDATA2LSB; header.e_ident [EI_VERSION] = EV_CURRENT; header.e_ident [EI_OSABI] = ELFOSABI_NONE; @@ -1547,14 +1547,14 @@ bin_writer_emit_writeout (MonoImageWriter *acfg) progh [2].p_offset = secth [SECT_DYNAMIC].sh_offset; progh [2].p_vaddr = progh [2].p_paddr = secth [SECT_DYNAMIC].sh_addr; progh [2].p_filesz = progh [2].p_memsz = secth [SECT_DYNAMIC].sh_size; - progh [2].p_align = SIZEOF_VOID_P; + progh [2].p_align = TARGET_SIZEOF_VOID_P; progh [2].p_flags = 6; progh [3].p_type = PT_GNU_STACK; progh [3].p_offset = secth [SECT_DYNAMIC].sh_offset; progh [3].p_vaddr = progh [3].p_paddr = secth [SECT_DYNAMIC].sh_addr; progh [3].p_filesz = progh [3].p_memsz = secth [SECT_DYNAMIC].sh_size; - progh [3].p_align = SIZEOF_VOID_P; + progh [3].p_align = TARGET_SIZEOF_VOID_P; progh [3].p_flags = 6; /* Compute the addresses of the bin sections, so relocation can be done */ @@ -1862,7 +1862,7 @@ static void asm_writer_emit_pointer (MonoImageWriter *acfg, const char *target) { asm_writer_emit_unset_mode (acfg); - asm_writer_emit_alignment (acfg, sizeof (gpointer)); + asm_writer_emit_alignment (acfg, sizeof (target_mgreg_t)); asm_writer_emit_pointer_unaligned (acfg, target); } diff --git a/mono/mini/interp-stubs.c b/mono/mini/interp-stubs.c index a779aca294..81eee0d1dc 100644 --- a/mono/mini/interp-stubs.c +++ b/mono/mini/interp-stubs.c @@ -107,7 +107,7 @@ stub_frame_iter_next (MonoInterpStackIter *iter, StackFrameInfo *frame) } static gpointer -stub_create_method_pointer (MonoMethod *method, MonoError *error) +stub_create_method_pointer (MonoMethod *method, gboolean compile, MonoError *error) { g_assert_not_reached (); return NULL; diff --git a/mono/mini/interp/hacks.h b/mono/mini/interp/hacks.h index 6984c38b39..0499e04518 100644 --- a/mono/mini/interp/hacks.h +++ b/mono/mini/interp/hacks.h @@ -80,78 +80,3 @@ #endif #endif - -/* - * Attempt at using the goto label construct of GNU GCC: - * it turns out this does give some benefit: 5-15% speedup. - * Don't look at these macros, it hurts... - */ -#define GOTO_LABEL -#undef GOTO_LABEL -#ifdef GOTO_LABEL - -#define SWITCH(a) goto *goto_map [(a)]; -#define BREAK SWITCH(*ip) -#define CASE(l) l ## _LABEL: -#define DEFAULT \ - CEE_ILLEGAL_LABEL: \ - CEE_ENDMAC_LABEL: -#define SUB_SWITCH \ - CEE_PREFIX1_LABEL: \ - CEE_ARGLIST_LABEL: \ - CEE_CEQ_LABEL: \ - CEE_CGT_LABEL: \ - CEE_CGT_UN_LABEL: \ - CEE_CLT_LABEL: \ - CEE_CLT_UN_LABEL: \ - CEE_LDFTN_LABEL: \ - CEE_LDVIRTFTN_LABEL: \ - CEE_UNUSED56_LABEL: \ - CEE_LDARG_LABEL: \ - CEE_LDARGA_LABEL: \ - CEE_STARG_LABEL: \ - CEE_LDLOC_LABEL: \ - CEE_LDLOCA_LABEL: \ - CEE_STLOC_LABEL: \ - CEE_LOCALLOC_LABEL: \ - CEE_UNUSED57_LABEL: \ - CEE_ENDFILTER_LABEL: \ - CEE_UNALIGNED__LABEL: \ - CEE_VOLATILE__LABEL: \ - CEE_TAIL__LABEL: \ - CEE_INITOBJ_LABEL: \ - CEE_UNUSED68_LABEL: \ - CEE_CPBLK_LABEL: \ - CEE_INITBLK_LABEL: \ - CEE_UNUSED69_LABEL: \ - CEE_RETHROW_LABEL: \ - CEE_UNUSED_LABEL: \ - CEE_SIZEOF_LABEL: \ - CEE_REFANYTYPE_LABEL: \ - CEE_UNUSED52_LABEL: \ - CEE_UNUSED53_LABEL: \ - CEE_UNUSED54_LABEL: \ - CEE_UNUSED55_LABEL: \ - CEE_UNUSED70_LABEL: -#define GOTO_LABEL_VARS \ - const static void * const goto_map [] = {\ -#define OPDEF(a,b,c,d,e,f,g,h,i,j) \ \ - && a ## _LABEL, \ -#include "mono/cil/opcode.def" \ -#undef OPDEF \ - &&DUMMY_LABEL \ - }; \ - DUMMY_LABEL: - -#else - -#define SWITCH(a) switch(a) -#define BREAK break -#define CASE(l) case l: -#define DEFAULT \ - default: \ - g_error ("Unimplemented opcode: %x at 0x%x\n", *ip, ip-header->code); -#define SUB_SWITCH case 0xFE: -#define GOTO_LABEL_VARS - -#endif diff --git a/mono/mini/interp/interp-internals.h b/mono/mini/interp/interp-internals.h index 66e8aa0f2f..b1db90c4c0 100644 --- a/mono/mini/interp/interp-internals.h +++ b/mono/mini/interp/interp-internals.h @@ -62,6 +62,7 @@ typedef struct { float f_r4; double f; /* native size integer and pointer types */ + MonoObject *o; gpointer p; mono_u nati; gpointer vt; @@ -96,6 +97,7 @@ typedef struct _InterpMethod guint32 alloca_size; unsigned int init_locals : 1; unsigned int vararg : 1; + unsigned int needs_thread_attach : 1; unsigned short *code; unsigned short *new_body_start; /* after all STINARG instrs */ MonoPIFunc func; @@ -138,7 +140,6 @@ struct _InterpFrame { }; typedef struct { - MonoDomain *original_domain; InterpFrame *current_frame; /* Resume state for resuming execution in mixed mode */ gboolean has_resume_state; diff --git a/mono/mini/interp/interp.c.REMOVED.git-id b/mono/mini/interp/interp.c.REMOVED.git-id index 1a4e706ba7..8f51931483 100644 --- a/mono/mini/interp/interp.c.REMOVED.git-id +++ b/mono/mini/interp/interp.c.REMOVED.git-id @@ -1 +1 @@ -c5e269f4afe7f230bba93c2338bdb0c81f8727ef \ No newline at end of file +9602f0f090d055d50702c425cd9854c353288089 \ No newline at end of file diff --git a/mono/mini/interp/mintops.c b/mono/mini/interp/mintops.c index 3a8e04dfb1..8a5bd944a8 100644 --- a/mono/mini/interp/mintops.c +++ b/mono/mini/interp/mintops.c @@ -31,7 +31,7 @@ unsigned char mono_interp_oplen[] = { d, MintOpArgType mono_interp_opargtype[] = { #include "mintops.def" - 0 + (MintOpArgType)0 }; #undef OPDEF diff --git a/mono/mini/interp/mintops.def b/mono/mini/interp/mintops.def index 648763226f..d1d754cad1 100644 --- a/mono/mini/interp/mintops.def +++ b/mono/mini/interp/mintops.def @@ -180,6 +180,7 @@ OPDEF(MINT_RETHROW, "rethrow", 2, MintOpUShortInt) OPDEF(MINT_ENDFINALLY, "endfinally", 2, MintOpNoArgs) OPDEF(MINT_CHECKPOINT, "checkpoint", 1, MintOpNoArgs) +OPDEF(MINT_SAFEPOINT, "safepoint", 1, MintOpNoArgs) OPDEF(MINT_BRFALSE_I4, "brfalse.i4", 3, MintOpBranch) OPDEF(MINT_BRFALSE_I8, "brfalse.i8", 3, MintOpBranch) @@ -293,7 +294,8 @@ OPDEF(MINT_VCALL, "vcall", 2, MintOpMethodToken) OPDEF(MINT_CALLVIRT, "callvirt", 2, MintOpMethodToken) OPDEF(MINT_VCALLVIRT, "vcallvirt", 2, MintOpMethodToken) OPDEF(MINT_CALLI, "calli", 2, MintOpMethodToken) -OPDEF(MINT_CALLI_NAT, "calli.nat", 2, MintOpMethodToken) +OPDEF(MINT_CALLI_NAT, "calli.nat", 3, MintOpMethodToken) +OPDEF(MINT_CALLI_NAT_FAST, "calli.nat.fast", 2, MintOpMethodToken) OPDEF(MINT_JMP, "jmp", 2, MintOpMethodToken) OPDEF(MINT_CALLRUN, "callrun", 3, MintOpNoArgs) @@ -492,6 +494,10 @@ OPDEF(MINT_CONV_OVF_I1_I4, "conv.ovf.i1.i4", 1, MintOpNoArgs) OPDEF(MINT_CONV_OVF_I1_I8, "conv.ovf.i1.i8", 1, MintOpNoArgs) OPDEF(MINT_CONV_OVF_I1_R8, "conv.ovf.i1.r8", 1, MintOpNoArgs) +OPDEF(MINT_CONV_OVF_I1_U4, "conv.ovf.i1.u4", 1, MintOpNoArgs) +OPDEF(MINT_CONV_OVF_I1_U8, "conv.ovf.i1.u8", 1, MintOpNoArgs) +OPDEF(MINT_CONV_OVF_I1_UN_R8, "conv.ovf.i1.un.r8", 1, MintOpNoArgs) + OPDEF(MINT_CONV_OVF_U1_I4, "conv.ovf.u1.i4", 1, MintOpNoArgs) OPDEF(MINT_CONV_OVF_U1_I8, "conv.ovf.u1.i8", 1, MintOpNoArgs) OPDEF(MINT_CONV_OVF_U1_R8, "conv.ovf.u1.r8", 1, MintOpNoArgs) @@ -500,6 +506,10 @@ OPDEF(MINT_CONV_OVF_I2_I4, "conv.ovf.i2.i4", 1, MintOpNoArgs) OPDEF(MINT_CONV_OVF_I2_I8, "conv.ovf.i2.i8", 1, MintOpNoArgs) OPDEF(MINT_CONV_OVF_I2_R8, "conv.ovf.i2.r8", 1, MintOpNoArgs) +OPDEF(MINT_CONV_OVF_I2_U4, "conv.ovf.i2.u4", 1, MintOpNoArgs) +OPDEF(MINT_CONV_OVF_I2_U8, "conv.ovf.i2.u8", 1, MintOpNoArgs) +OPDEF(MINT_CONV_OVF_I2_UN_R8, "conv.ovf.i2.un.r8", 1, MintOpNoArgs) + OPDEF(MINT_CONV_OVF_U2_I4, "conv.ovf.u2.i4", 1, MintOpNoArgs) OPDEF(MINT_CONV_OVF_U2_I8, "conv.ovf.u2.i8", 1, MintOpNoArgs) OPDEF(MINT_CONV_OVF_U2_R8, "conv.ovf.u2.r8", 1, MintOpNoArgs) @@ -594,13 +604,15 @@ OPDEF(MINT_ICALL_V_P, "mono_icall_v_p", 2, MintOpClassToken) OPDEF(MINT_ICALL_P_V, "mono_icall_p_v", 2, MintOpClassToken) OPDEF(MINT_ICALL_P_P, "mono_icall_p_p", 2, MintOpClassToken) OPDEF(MINT_ICALL_PP_V, "mono_icall_pp_v", 2, MintOpClassToken) -OPDEF(MINT_ICALL_PI_V, "mono_icall_pi_v", 2, MintOpClassToken) OPDEF(MINT_ICALL_PP_P, "mono_icall_pp_p", 2, MintOpClassToken) -OPDEF(MINT_ICALL_PI_P, "mono_icall_pi_p", 2, MintOpClassToken) OPDEF(MINT_ICALL_PPP_V, "mono_icall_ppp_v", 2, MintOpClassToken) -OPDEF(MINT_ICALL_PPI_V, "mono_icall_ppi_v", 2, MintOpClassToken) -OPDEF(MINT_ICALL_PII_P, "mono_icall_pii_p", 2, MintOpClassToken) -OPDEF(MINT_ICALL_PPII_V, "mono_icall_ppii_v", 2, MintOpClassToken) +OPDEF(MINT_ICALL_PPP_P, "mono_icall_ppp_p", 2, MintOpClassToken) +OPDEF(MINT_ICALL_PPPP_V, "mono_icall_pppp_v", 2, MintOpClassToken) +OPDEF(MINT_ICALL_PPPP_P, "mono_icall_pppp_p", 2, MintOpClassToken) +OPDEF(MINT_ICALL_PPPPP_V, "mono_icall_ppppp_v", 2, MintOpClassToken) +OPDEF(MINT_ICALL_PPPPP_P, "mono_icall_ppppp_p", 2, MintOpClassToken) +OPDEF(MINT_ICALL_PPPPPP_V, "mono_icall_pppppp_v", 2, MintOpClassToken) +OPDEF(MINT_ICALL_PPPPPP_P, "mono_icall_pppppp_p", 2, MintOpClassToken) OPDEF(MINT_MONO_LDPTR, "mono_ldptr", 2, MintOpClassToken) OPDEF(MINT_MONO_TLS, "mono_tls", 3, MintOpInt) OPDEF(MINT_MONO_NEWOBJ, "mono_newobj", 2, MintOpClassToken) @@ -608,8 +620,6 @@ OPDEF(MINT_MONO_RETOBJ, "mono_retobj", 1, MintOpNoArgs) OPDEF(MINT_MONO_FREE, "mono_free", 1, MintOpNoArgs) OPDEF(MINT_MONO_ATOMIC_STORE_I4, "mono_atomic.store.i4", 1, MintOpNoArgs) OPDEF(MINT_MONO_MEMORY_BARRIER, "mono_memory_barrier", 1, MintOpNoArgs) -OPDEF(MINT_MONO_JIT_ATTACH, "mono_jit_attach", 1, MintOpNoArgs) -OPDEF(MINT_MONO_JIT_DETACH, "mono_jit_detach", 1, MintOpNoArgs) OPDEF(MINT_MONO_LDDOMAIN, "mono_lddomain", 1, MintOpNoArgs) // FIXME: MintOp @@ -621,7 +631,6 @@ OPDEF(MINT_LD_DELEGATE_METHOD_PTR, "ld_delegate_method_ptr", 1, MintOpNoArgs) OPDEF(MINT_LD_DELEGATE_INVOKE_IMPL, "ld_delegate_invoke_impl", 2, MintOpNoArgs) OPDEF(MINT_START_ABORT_PROT, "start_abort_protected", 1, MintOpNoArgs) -OPDEF(MINT_END_ABORT_PROT, "end_abort_protected", 1, MintOpNoArgs) /* * This needs to be an opcode because we need to trigger the enter event after diff --git a/mono/mini/interp/transform.c.REMOVED.git-id b/mono/mini/interp/transform.c.REMOVED.git-id index 6c4ffde1d8..96781d2f84 100644 --- a/mono/mini/interp/transform.c.REMOVED.git-id +++ b/mono/mini/interp/transform.c.REMOVED.git-id @@ -1 +1 @@ -0cfdf0afdcc0aba826255ac02d2a8ecbd50ed2e9 \ No newline at end of file +810cf17603c64490f39ab121f0fd0eb313ccdf3a \ No newline at end of file diff --git a/mono/mini/intrinsics.c b/mono/mini/intrinsics.c index d8aaa2b0b5..4d94c455be 100644 --- a/mono/mini/intrinsics.c +++ b/mono/mini/intrinsics.c @@ -192,13 +192,13 @@ emit_span_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature { MonoInst *ins; - MonoClassField *ptr_field = mono_class_get_field_from_name (cmethod->klass, "_pointer"); + MonoClassField *ptr_field = mono_class_get_field_from_name_full (cmethod->klass, "_pointer", NULL); if (!ptr_field) /* Portable Span */ return NULL; if (!strcmp (cmethod->name, "get_Item")) { - MonoClassField *length_field = mono_class_get_field_from_name (cmethod->klass, "_length"); + MonoClassField *length_field = mono_class_get_field_from_name_full (cmethod->klass, "_length", NULL); g_assert (length_field); @@ -211,13 +211,13 @@ emit_span_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature int span_reg = args [0]->dreg; /* Load _pointer.Value */ int base_reg = alloc_preg (cfg); - EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOAD_MEMBASE, base_reg, span_reg, ptr_field->offset - sizeof (MonoObject)); + EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOAD_MEMBASE, base_reg, span_reg, ptr_field->offset - MONO_ABI_SIZEOF (MonoObject)); /* Similar to mini_emit_ldelema_1_ins () */ int size = mono_class_array_element_size (param_class); int index_reg = mini_emit_sext_index_reg (cfg, args [1]); - MONO_EMIT_BOUNDS_CHECK_OFFSET(cfg, span_reg, length_field->offset - sizeof (MonoObject), index_reg); + MONO_EMIT_BOUNDS_CHECK_OFFSET(cfg, span_reg, length_field->offset - MONO_ABI_SIZEOF (MonoObject), index_reg); // FIXME: Sign extend index ? @@ -231,7 +231,7 @@ emit_span_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature return ins; } else if (!strcmp (cmethod->name, "get_Length")) { - MonoClassField *length_field = mono_class_get_field_from_name (cmethod->klass, "_length"); + MonoClassField *length_field = mono_class_get_field_from_name_full (cmethod->klass, "_length", NULL); g_assert (length_field); /* @@ -241,7 +241,7 @@ emit_span_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature MONO_INST_NEW (cfg, ins, OP_LDLEN); ins->dreg = alloc_preg (cfg); ins->sreg1 = args [0]->dreg; - ins->inst_imm = length_field->offset - sizeof (MonoObject); + ins->inst_imm = length_field->offset - MONO_ABI_SIZEOF (MonoObject); ins->type = STACK_I4; MONO_ADD_INS (cfg->cbb, ins); diff --git a/mono/mini/ir-emit.h b/mono/mini/ir-emit.h index 0248ea3124..ea2a151af2 100644 --- a/mono/mini/ir-emit.h +++ b/mono/mini/ir-emit.h @@ -151,7 +151,7 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) */ #define MONO_INST_NEW(cfg,dest,op) do { \ (dest) = (MonoInst *)mono_mempool_alloc ((cfg)->mempool, sizeof (MonoInst)); \ - (dest)->inst_c0 = (dest)->inst_c1 = 0; \ + (dest)->inst_i0 = (dest)->inst_i1 = 0; \ (dest)->next = (dest)->prev = NULL; \ (dest)->opcode = (op); \ (dest)->flags = 0; \ @@ -272,7 +272,7 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) } else { \ MONO_INST_NEW ((cfg), (dest), cfg->compile_aot ? OP_AOTCONST : OP_PCONST); \ (dest)->inst_p0 = (cons); \ - (dest)->inst_i1 = (MonoInst *)(patch_type); \ + (dest)->inst_p1 = GUINT_TO_POINTER (patch_type); \ (dest)->type = STACK_PTR; \ (dest)->dreg = alloc_dreg ((cfg), STACK_PTR); \ } \ @@ -884,8 +884,8 @@ static int ccount = 0; } while (0) /* Emit an explicit null check which doesn't depend on SIGSEGV signal handling */ -#define MONO_EMIT_NULL_CHECK(cfg, reg) do { \ - if (cfg->explicit_null_checks) { \ +#define MONO_EMIT_NULL_CHECK(cfg, reg, out_of_page) do { \ + if (cfg->explicit_null_checks || (out_of_page)) { \ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, (reg), 0); \ MONO_EMIT_NEW_COND_EXC (cfg, EQ, "NullReferenceException"); \ } else { \ @@ -896,7 +896,7 @@ static int ccount = 0; #define MONO_EMIT_NEW_CHECK_THIS(cfg, sreg) do { \ cfg->flags |= MONO_CFG_HAS_CHECK_THIS; \ if (cfg->explicit_null_checks) { \ - MONO_EMIT_NULL_CHECK (cfg, sreg); \ + MONO_EMIT_NULL_CHECK (cfg, sreg, FALSE); \ } else { \ MONO_EMIT_NEW_UNALU (cfg, OP_CHECK_THIS, -1, sreg); \ MONO_EMIT_NEW_IMPLICIT_EXCEPTION_LOAD_STORE (cfg); \ @@ -907,7 +907,8 @@ static int ccount = 0; #define NEW_LOAD_MEMBASE_FLAGS(cfg,dest,op,dr,base,offset,ins_flags) do { \ int __ins_flags = ins_flags; \ if (__ins_flags & MONO_INST_FAULT) { \ - MONO_EMIT_NULL_CHECK ((cfg), (base)); \ + gboolean __out_of_page = offset > mono_target_pagesize (); \ + MONO_EMIT_NULL_CHECK ((cfg), (base), __out_of_page); \ } \ NEW_LOAD_MEMBASE ((cfg), (dest), (op), (dr), (base), (offset)); \ (dest)->flags = (__ins_flags); \ @@ -916,8 +917,9 @@ static int ccount = 0; #define MONO_EMIT_NEW_LOAD_MEMBASE_OP_FLAGS(cfg,op,dr,base,offset,ins_flags) do { \ MonoInst *inst; \ int __ins_flags = ins_flags; \ - if (__ins_flags & MONO_INST_FAULT) { \ - MONO_EMIT_NULL_CHECK ((cfg), (base)); \ + if (__ins_flags & MONO_INST_FAULT) { \ + int __out_of_page = offset > mono_target_pagesize (); \ + MONO_EMIT_NULL_CHECK ((cfg), (base), __out_of_page); \ } \ NEW_LOAD_MEMBASE ((cfg), (inst), (op), (dr), (base), (offset)); \ inst->flags = (__ins_flags); \ @@ -964,7 +966,7 @@ static int ccount = 0; #define MONO_EMIT_BOUNDS_CHECK_OFFSET(cfg, array_reg, array_length_offset, index_reg) do { \ if (!(cfg->opt & MONO_OPT_UNSAFE)) { \ if (!(cfg->opt & MONO_OPT_ABCREM)) { \ - MONO_EMIT_NULL_CHECK (cfg, array_reg); \ + MONO_EMIT_NULL_CHECK (cfg, array_reg, FALSE); \ if (COMPILE_LLVM (cfg)) \ MONO_EMIT_DEFAULT_BOUNDS_CHECK ((cfg), (array_reg), (array_length_offset), (index_reg), TRUE); \ else \ diff --git a/mono/mini/jit-icalls.c b/mono/mini/jit-icalls.c index 6a1fdcd7e6..2b3c6e2845 100644 --- a/mono/mini/jit-icalls.c +++ b/mono/mini/jit-icalls.c @@ -1222,23 +1222,28 @@ mono_create_corlib_exception_0 (guint32 token) } MonoException * -mono_create_corlib_exception_1 (guint32 token, MonoString *arg) +mono_create_corlib_exception_1 (guint32 token, MonoString *arg_raw) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoException *ret = mono_exception_from_token_two_strings_checked ( - mono_defaults.corlib, token, arg, NULL, error); + MONO_HANDLE_DCL (MonoString, arg); + MonoExceptionHandle ret = mono_exception_from_token_two_strings_checked ( + mono_defaults.corlib, token, arg, NULL_HANDLE_STRING, error); mono_error_set_pending_exception (error); - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } MonoException * -mono_create_corlib_exception_2 (guint32 token, MonoString *arg1, MonoString *arg2) +mono_create_corlib_exception_2 (guint32 token, MonoString *arg1_raw, MonoString *arg2_raw) { + HANDLE_FUNCTION_ENTER (); ERROR_DECL (error); - MonoException *ret = mono_exception_from_token_two_strings_checked ( + MONO_HANDLE_DCL (MonoString, arg1); + MONO_HANDLE_DCL (MonoString, arg2); + MonoExceptionHandle ret = mono_exception_from_token_two_strings_checked ( mono_defaults.corlib, token, arg1, arg2, error); mono_error_set_pending_exception (error); - return ret; + HANDLE_FUNCTION_RETURN_OBJ (ret); } MonoObject* @@ -1355,6 +1360,11 @@ mono_get_native_calli_wrapper (MonoImage *image, MonoMethodSignature *sig, gpoin m = mono_marshal_get_native_func_wrapper (image, sig, &piinfo, mspecs, func); + for (int i = sig->param_count; i >= 0; i--) + if (mspecs [i]) + mono_metadata_free_marshal_spec (mspecs [i]); + g_free (mspecs); + gpointer compiled_ptr = mono_compile_method_checked (m, error); mono_error_set_pending_exception (error); return compiled_ptr; diff --git a/mono/mini/jit-icalls.h b/mono/mini/jit-icalls.h index 4a34989e4c..c41cf78bf8 100644 --- a/mono/mini/jit-icalls.h +++ b/mono/mini/jit-icalls.h @@ -6,8 +6,8 @@ #define __MONO_JIT_ICALLS_H__ #include - #include "mini.h" +#include void* mono_ldftn (MonoMethod *method); @@ -101,6 +101,7 @@ double mono_lconv_to_r8_un (guint64 a); gpointer mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg); +ICALL_EXPORT MonoString* ves_icall_mono_ldstr (MonoDomain *domain, MonoImage *image, guint32 idx); @@ -186,15 +187,18 @@ mono_object_isinst_with_cache (MonoObject *obj, MonoClass *klass, gpointer *cach MonoObject* mono_object_castclass_with_cache (MonoObject *obj, MonoClass *klass, gpointer *cache); +ICALL_EXPORT void ves_icall_runtime_class_init (MonoVTable *vtable); void mono_generic_class_init (MonoVTable *vtable); +ICALL_EXPORT void ves_icall_mono_delegate_ctor (MonoObject *this_obj, MonoObject *target, gpointer addr); +ICALL_EXPORT void ves_icall_mono_delegate_ctor_interp (MonoObject *this_obj, MonoObject *target, gpointer addr); diff --git a/mono/mini/liveness.c b/mono/mini/liveness.c index 1ed551730c..4975c0bea7 100644 --- a/mono/mini/liveness.c +++ b/mono/mini/liveness.c @@ -37,6 +37,62 @@ static void mono_analyze_liveness2 (MonoCompile *cfg); #endif + +#define INLINE_SIZE 16 + +typedef struct { + int capacity; + gpointer data [INLINE_SIZE]; +} MonoPtrSet; + +static void +mono_ptrset_init (MonoPtrSet *set) +{ + set->capacity = 0; +} + +static void +mono_ptrset_destroy (MonoPtrSet *set) +{ + if (set->capacity > INLINE_SIZE) + g_hash_table_destroy (set->data [0]); +} + +static void +mono_ptrset_add (MonoPtrSet *set, gpointer val) +{ + //switch to hashtable + if (set->capacity == INLINE_SIZE) { + GHashTable *tmp = g_hash_table_new (NULL, NULL); + for (int i = 0; i < INLINE_SIZE; ++i) + g_hash_table_insert (tmp, set->data [i], set->data [i]); + set->data [0] = tmp; + ++set->capacity; + } + + if (set->capacity > INLINE_SIZE) { + g_hash_table_insert (set->data [0], val, val); + } else { + set->data [set->capacity] = val; + ++set->capacity; + } +} + +static gboolean +mono_ptrset_contains (MonoPtrSet *set, gpointer val) +{ + if (set->capacity <= INLINE_SIZE) { + for (int i = 0; i < set->capacity; ++i) { + if (set->data [i] == val) + return TRUE; + } + return FALSE; + } + + return g_hash_table_lookup (set->data [0], val) != NULL; +} + + static void optimize_initlocals (MonoCompile *cfg); @@ -78,12 +134,12 @@ mono_bitset_print (MonoBitSet *set) } static void -visit_bb (MonoCompile *cfg, MonoBasicBlock *bb, GSList **visited) +visit_bb (MonoCompile *cfg, MonoBasicBlock *bb, MonoPtrSet *visited) { int i; MonoInst *ins; - if (g_slist_find (*visited, bb)) + if (mono_ptrset_contains (visited, bb)) return; for (ins = bb->code; ins; ins = ins->next) { @@ -132,7 +188,7 @@ visit_bb (MonoCompile *cfg, MonoBasicBlock *bb, GSList **visited) } } - *visited = g_slist_append (*visited, bb); + mono_ptrset_add (visited, bb); /* * Need to visit all bblocks reachable from this one since they can be @@ -147,7 +203,6 @@ void mono_liveness_handle_exception_clauses (MonoCompile *cfg) { MonoBasicBlock *bb; - GSList *visited = NULL; MonoMethodHeader *header = cfg->header; MonoExceptionClause *clause, *clause2; int i, j; @@ -182,6 +237,8 @@ mono_liveness_handle_exception_clauses (MonoCompile *cfg) } } + MonoPtrSet visited; + mono_ptrset_init (&visited); /* * Variables in exception handler register cannot be allocated to registers * so make them volatile. See bug #42136. This will not be neccessary when @@ -203,7 +260,7 @@ mono_liveness_handle_exception_clauses (MonoCompile *cfg) visit_bb (cfg, bb, &visited); } - g_slist_free (visited); + mono_ptrset_destroy (&visited); } static inline void diff --git a/mono/mini/local-propagation.c b/mono/mini/local-propagation.c index f0cbf882a2..bd2a98a2e5 100644 --- a/mono/mini/local-propagation.c +++ b/mono/mini/local-propagation.c @@ -669,15 +669,13 @@ mono_local_cprop (MonoCompile *cfg) opcode2 = mono_op_to_op_imm (ins->opcode); if ((opcode2 != -1) && mono_arch_is_inst_imm (ins->opcode, opcode2, def->inst_c0) && ((srcindex == 1) || (ins->sreg2 == -1))) { ins->opcode = opcode2; - if ((def->opcode == OP_I8CONST) && (sizeof (gpointer) == 4)) { - ins->inst_ls_word = def->inst_ls_word; - ins->inst_ms_word = def->inst_ms_word; - } else if (regtype == 'l' && sizeof (gpointer) == 4) { + if ((def->opcode == OP_I8CONST) && TARGET_SIZEOF_VOID_P == 4) + ins->inst_l = def->inst_l; + else if (regtype == 'l' && TARGET_SIZEOF_VOID_P == 4) /* This can happen if the def was a result of an iconst+conv.i8, which is transformed into just an iconst */ ins->inst_l = def->inst_c0; - } else { + else ins->inst_imm = def->inst_c0; - } sregs [srcindex] = -1; mono_inst_set_src_registers (ins, sregs); diff --git a/mono/mini/main.c b/mono/mini/main.c index 0192135f7d..a0c62afe88 100644 --- a/mono/mini/main.c +++ b/mono/mini/main.c @@ -295,10 +295,15 @@ probe_embedded (const char *program, int *ref_argc, char **ref_argv []) item_size = STREAM_INT (p); p += 4; - if (mapaddress == NULL){ - mapaddress = mono_file_map (directory_location-offset, MONO_MMAP_READ | MONO_MMAP_PRIVATE, fd, offset, &maphandle); - if (mapaddress == NULL){ - perror ("Error mapping file"); + if (mapaddress == NULL) { + char *error_message = NULL; + mapaddress = mono_file_map_error (directory_location - offset, MONO_MMAP_READ | MONO_MMAP_PRIVATE, + fd, offset, &maphandle, program, &error_message); + if (mapaddress == NULL) { + if (error_message) + fprintf (stderr, "Error mapping file: %s\n", error_message); + else + perror ("Error mapping file"); exit (1); } baseline = offset; @@ -321,7 +326,9 @@ probe_embedded (const char *program, int *ref_argc, char **ref_argv []) } else if (strncmp (kind, "options:", strlen ("options:")) == 0){ mono_parse_options_from (load_from_region (fd, offset, item_size), ref_argc, ref_argv); } else if (strncmp (kind, "config_dir:", strlen ("config_dir:")) == 0){ - mono_set_dirs (getenv ("MONO_PATH"), load_from_region (fd, offset, item_size)); + char *mono_path_value = g_getenv ("MONO_PATH"); + mono_set_dirs (mono_path_value, load_from_region (fd, offset, item_size)); + g_free (mono_path_value); } else if (strncmp (kind, "machineconfig:", strlen ("machineconfig:")) == 0) { mono_register_machine_config (load_from_region (fd, offset, item_size)); } else if (strncmp (kind, "env:", strlen ("env:")) == 0){ diff --git a/mono/mini/memory-access.c b/mono/mini/memory-access.c index 038c79fc00..3ce499d219 100644 --- a/mono/mini/memory-access.c +++ b/mono/mini/memory-access.c @@ -9,6 +9,7 @@ #ifndef DISABLE_JIT #include +#include #include #include "mini.h" @@ -54,12 +55,12 @@ mini_emit_memset (MonoCompile *cfg, int destreg, int offset, int size, int val, else MONO_EMIT_NEW_ICONST (cfg, val_reg, val); - if (align < SIZEOF_VOID_P) { + if (align < TARGET_SIZEOF_VOID_P) { if (align % 2 == 1) goto set_1; if (align % 4 == 2) goto set_2; - if (SIZEOF_VOID_P == 8 && align % 8 == 4) + if (TARGET_SIZEOF_VOID_P == 8 && align % 8 == 4) goto set_4; } @@ -71,7 +72,7 @@ mini_emit_memset (MonoCompile *cfg, int destreg, int offset, int size, int val, goto set_1; if (offsets_mask % 4 == 2) goto set_2; - if (SIZEOF_VOID_P == 8 && offsets_mask % 8 == 4) + if (TARGET_SIZEOF_VOID_P == 8 && offsets_mask % 8 == 4) goto set_4; } @@ -115,7 +116,7 @@ mini_emit_memcpy (MonoCompile *cfg, int destreg, int doffset, int srcreg, int so g_assert (size < MAX_INLINE_COPY_SIZE); g_assert (align > 0); - if (align < SIZEOF_VOID_P) { + if (align < TARGET_SIZEOF_VOID_P) { if (align == 4) goto copy_4; if (align == 2) @@ -131,7 +132,7 @@ mini_emit_memcpy (MonoCompile *cfg, int destreg, int doffset, int srcreg, int so goto copy_1; if (offsets_mask % 4 == 2) goto copy_2; - if (SIZEOF_VOID_P == 8 && offsets_mask % 8 == 4) + if (TARGET_SIZEOF_VOID_P == 8 && offsets_mask % 8 == 4) goto copy_4; } @@ -241,15 +242,15 @@ create_write_barrier_bitmap (MonoCompile *cfg, MonoClass *klass, unsigned *wb_bi MonoClassField *field; gpointer iter = NULL; - while ((field = mono_class_get_fields (klass, &iter))) { + while ((field = mono_class_get_fields_internal (klass, &iter))) { int foffset; if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; - foffset = m_class_is_valuetype (klass) ? field->offset - sizeof (MonoObject): field->offset; + foffset = m_class_is_valuetype (klass) ? field->offset - MONO_ABI_SIZEOF (MonoObject): field->offset; if (mini_type_is_reference (mono_field_get_type (field))) { - g_assert ((foffset % SIZEOF_VOID_P) == 0); - *wb_bitmap |= 1 << ((offset + foffset) / SIZEOF_VOID_P); + g_assert ((foffset % TARGET_SIZEOF_VOID_P) == 0); + *wb_bitmap |= 1 << ((offset + foffset) / TARGET_SIZEOF_VOID_P); } else { MonoClass *field_class = mono_class_from_mono_type (field->type); if (m_class_has_references (field_class)) @@ -268,10 +269,10 @@ mini_emit_wb_aware_memcpy (MonoCompile *cfg, MonoClass *klass, MonoInst *iargs[4 align = 4; /*types with references can't have alignment smaller than sizeof(void*) */ - if (align < SIZEOF_VOID_P) + if (align < TARGET_SIZEOF_VOID_P) return FALSE; - if (size > 5 * SIZEOF_VOID_P) + if (size > 5 * TARGET_SIZEOF_VOID_P) return FALSE; create_write_barrier_bitmap (cfg, klass, &need_wb, 0); @@ -286,7 +287,7 @@ mini_emit_wb_aware_memcpy (MonoCompile *cfg, MonoClass *klass, MonoInst *iargs[4 /*tmp = dreg*/ EMIT_NEW_UNALU (cfg, iargs [0], OP_MOVE, dest_ptr_reg, destreg); - while (size >= SIZEOF_VOID_P) { + while (size >= TARGET_SIZEOF_VOID_P) { MonoInst *load_inst; MONO_INST_NEW (cfg, load_inst, OP_LOAD_MEMBASE); load_inst->dreg = tmp_reg; @@ -299,13 +300,13 @@ mini_emit_wb_aware_memcpy (MonoCompile *cfg, MonoClass *klass, MonoInst *iargs[4 if (need_wb & 0x1) mini_emit_write_barrier (cfg, iargs [0], load_inst); - offset += SIZEOF_VOID_P; - size -= SIZEOF_VOID_P; + offset += TARGET_SIZEOF_VOID_P; + size -= TARGET_SIZEOF_VOID_P; need_wb >>= 1; /*tmp += sizeof (void*)*/ - if (size >= SIZEOF_VOID_P) { - NEW_BIALU_IMM (cfg, iargs [0], OP_PADD_IMM, dest_ptr_reg, dest_ptr_reg, SIZEOF_VOID_P); + if (size >= TARGET_SIZEOF_VOID_P) { + NEW_BIALU_IMM (cfg, iargs [0], OP_PADD_IMM, dest_ptr_reg, dest_ptr_reg, TARGET_SIZEOF_VOID_P); MONO_ADD_INS (cfg->cbb, iargs [0]); } } @@ -372,7 +373,7 @@ mini_emit_memory_copy_internal (MonoCompile *cfg, MonoInst *dest, MonoInst *src, size = mono_class_value_size (klass, &align); if (!align) - align = SIZEOF_VOID_P; + align = TARGET_SIZEOF_VOID_P; if (explicit_align) align = explicit_align; @@ -402,7 +403,7 @@ mini_emit_memory_copy_internal (MonoCompile *cfg, MonoInst *dest, MonoInst *src, /* It's ok to intrinsify under gsharing since shared code types are layout stable. */ if (!size_ins && (cfg->opt & MONO_OPT_INTRINS) && mini_emit_wb_aware_memcpy (cfg, klass, iargs, size, align)) { - } else if (size_ins || align < SIZEOF_VOID_P) { + } else if (size_ins || align < TARGET_SIZEOF_VOID_P) { if (context_used) { iargs [2] = mini_emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_KLASS); } else { @@ -417,8 +418,8 @@ mini_emit_memory_copy_internal (MonoCompile *cfg, MonoInst *dest, MonoInst *src, } else { /* We don't unroll more than 5 stores to avoid code bloat. */ /*This is harmless and simplify mono_gc_get_range_copy_func */ - size += (SIZEOF_VOID_P - 1); - size &= ~(SIZEOF_VOID_P - 1); + size += (TARGET_SIZEOF_VOID_P - 1); + size &= ~(TARGET_SIZEOF_VOID_P - 1); EMIT_NEW_ICONST (cfg, iargs [2], size); mono_emit_jit_icall (cfg, mono_gc_get_range_copy_func (), iargs); @@ -506,7 +507,7 @@ mini_emit_memory_store (MonoCompile *cfg, MonoType *type, MonoInst *dest, MonoIn void mini_emit_memory_copy_bytes (MonoCompile *cfg, MonoInst *dest, MonoInst *src, MonoInst *size, int ins_flag) { - int align = (ins_flag & MONO_INST_UNALIGNED) ? 1 : SIZEOF_VOID_P; + int align = (ins_flag & MONO_INST_UNALIGNED) ? 1 : TARGET_SIZEOF_VOID_P; /* * FIXME: It's unclear whether we should be emitting both the acquire @@ -536,7 +537,7 @@ mini_emit_memory_copy_bytes (MonoCompile *cfg, MonoInst *dest, MonoInst *src, Mo void mini_emit_memory_init_bytes (MonoCompile *cfg, MonoInst *dest, MonoInst *value, MonoInst *size, int ins_flag) { - int align = (ins_flag & MONO_INST_UNALIGNED) ? 1 : SIZEOF_VOID_P; + int align = (ins_flag & MONO_INST_UNALIGNED) ? 1 : TARGET_SIZEOF_VOID_P; if (ins_flag & MONO_INST_VOLATILE) { /* Volatile stores have release semantics, see 12.6.7 in Ecma 335 */ diff --git a/mono/mini/method-to-ir.c.REMOVED.git-id b/mono/mini/method-to-ir.c.REMOVED.git-id index 00f2885956..d336f41fd4 100644 --- a/mono/mini/method-to-ir.c.REMOVED.git-id +++ b/mono/mini/method-to-ir.c.REMOVED.git-id @@ -1 +1 @@ -ccd499e859dac3d27128e4786460a49b4de4f459 \ No newline at end of file +04ed46d337048ccbd364cc2f24f9e3b0ca3a0a29 \ No newline at end of file diff --git a/mono/mini/mini-amd64.c.REMOVED.git-id b/mono/mini/mini-amd64.c.REMOVED.git-id index 04f9946a16..72b034b7cd 100644 --- a/mono/mini/mini-amd64.c.REMOVED.git-id +++ b/mono/mini/mini-amd64.c.REMOVED.git-id @@ -1 +1 @@ -1ad38235798612ecc88e944cb331c348e57ab0fc \ No newline at end of file +64dd908704ebcb3eb24bde74530511f1af58cf24 \ No newline at end of file diff --git a/mono/mini/mini-amd64.h b/mono/mini/mini-amd64.h index 52a2f86ef1..fa361d10a7 100644 --- a/mono/mini/mini-amd64.h +++ b/mono/mini/mini-amd64.h @@ -63,6 +63,17 @@ typedef struct { #define MONO_UNWIND_INFO_RT_FUNC_SIZE 128 +typedef BOOLEAN (WINAPI* RtlInstallFunctionTableCallbackPtr)( + DWORD64 TableIdentifier, + DWORD64 BaseAddress, + DWORD Length, + PGET_RUNTIME_FUNCTION_CALLBACK Callback, + PVOID Context, + PCWSTR OutOfProcessCallbackDll); + +typedef BOOLEAN (WINAPI* RtlDeleteFunctionTablePtr)( + PRUNTIME_FUNCTION FunctionTable); + // On Win8/Win2012Server and later we can use dynamic growable function tables // instead of RtlInstallFunctionTableCallback. This gives us the benefit to // include all needed unwind upon registration. @@ -203,10 +214,9 @@ typedef struct MonoCompileArch { gint32 async_point_count; gpointer vret_addr_loc; #ifdef HOST_WIN32 - gpointer unwindinfo; + struct _UNWIND_INFO* unwindinfo; #endif gpointer seq_point_info_var; - gpointer ss_trigger_page_var; gpointer ss_tramp_var; gpointer bp_tramp_var; gpointer lmf_var; @@ -214,13 +224,13 @@ typedef struct MonoCompileArch { #ifdef TARGET_WIN32 -static AMD64_Reg_No param_regs [] = { AMD64_RCX, AMD64_RDX, AMD64_R8, AMD64_R9 }; +static const AMD64_Reg_No param_regs [] = { AMD64_RCX, AMD64_RDX, AMD64_R8, AMD64_R9 }; -static AMD64_XMM_Reg_No float_param_regs [] = { AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3 }; +static const AMD64_XMM_Reg_No float_param_regs [] = { AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3 }; -static AMD64_Reg_No return_regs [] = { AMD64_RAX }; +static const AMD64_Reg_No return_regs [] = { AMD64_RAX }; -static AMD64_XMM_Reg_No float_return_regs [] = { AMD64_XMM0 }; +static const AMD64_XMM_Reg_No float_return_regs [] = { AMD64_XMM0 }; #define PARAM_REGS G_N_ELEMENTS(param_regs) #define FLOAT_PARAM_REGS G_N_ELEMENTS(float_param_regs) @@ -236,6 +246,10 @@ static AMD64_XMM_Reg_No float_return_regs [] = { AMD64_XMM0 }; static const AMD64_Reg_No param_regs [] = {AMD64_RDI, AMD64_RSI, AMD64_RDX, AMD64_RCX, AMD64_R8, AMD64_R9}; +static const AMD64_XMM_Reg_No float_param_regs[] = {AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, + AMD64_XMM3, AMD64_XMM4, AMD64_XMM5, + AMD64_XMM6, AMD64_XMM7}; + static const AMD64_Reg_No return_regs [] = {AMD64_RAX, AMD64_RDX}; #endif @@ -511,7 +525,6 @@ mono_amd64_get_tls_gs_offset (void) MONO_LLVM_INTERNAL; #if defined(TARGET_WIN32) && !defined(DISABLE_JIT) -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) #define MONO_ARCH_HAVE_UNWIND_TABLE 1 #define MONO_ARCH_HAVE_CODE_CHUNK_TRACKING 1 @@ -585,7 +598,7 @@ guint mono_arch_unwindinfo_init_method_unwind_info (gpointer cfg); void -mono_arch_unwindinfo_install_method_unwind_info (gpointer *monoui, gpointer code, guint code_size); +mono_arch_unwindinfo_install_method_unwind_info (PUNWIND_INFO *monoui, gpointer code, guint code_size); void mono_arch_unwindinfo_install_tramp_unwind_info (GSList *unwind_ops, gpointer code, guint code_size); @@ -596,7 +609,6 @@ mono_arch_code_chunk_new (void *chunk, int size); void mono_arch_code_chunk_destroy (void *chunk); -#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ #endif /* defined(TARGET_WIN32) && !defined(DISABLE_JIT) */ #ifdef MONO_ARCH_HAVE_UNWIND_TABLE diff --git a/mono/mini/mini-arm.c.REMOVED.git-id b/mono/mini/mini-arm.c.REMOVED.git-id index 9c9b2b34c9..570a5ee737 100644 --- a/mono/mini/mini-arm.c.REMOVED.git-id +++ b/mono/mini/mini-arm.c.REMOVED.git-id @@ -1 +1 @@ -06bd9533a5cf1aea2c52fe6c07ca071893a2676f \ No newline at end of file +b6622251ae84b8461e9bba777eae3f28760a72e8 \ No newline at end of file diff --git a/mono/mini/mini-arm64.c.REMOVED.git-id b/mono/mini/mini-arm64.c.REMOVED.git-id index cfaa33770b..972c0a91bc 100644 --- a/mono/mini/mini-arm64.c.REMOVED.git-id +++ b/mono/mini/mini-arm64.c.REMOVED.git-id @@ -1 +1 @@ -e0e9b12b0186f304a7af08a0faf1ea157594ee23 \ No newline at end of file +0770581da33ffbcd9d9af147ba3d7d9259554825 \ No newline at end of file diff --git a/mono/mini/mini-codegen.c b/mono/mini/mini-codegen.c index 8961d630ad..096c0979ee 100644 --- a/mono/mini/mini-codegen.c +++ b/mono/mini/mini-codegen.c @@ -567,6 +567,7 @@ mono_print_ins_index_strbuf (int i, MonoInst *ins) case OP_IOR_IMM: case OP_IXOR_IMM: case OP_SUB_IMM: + case OP_MUL_IMM: case OP_STORE_MEMBASE_IMM: g_string_append_printf (sbuf, " [%d]", (int)ins->inst_imm); break; @@ -2720,7 +2721,7 @@ mini_type_is_hfa (MonoType *t, int *out_nfields, int *out_esize) klass = mono_class_from_mono_type (t); iter = NULL; - while ((field = mono_class_get_fields (klass, &iter))) { + while ((field = mono_class_get_fields_internal (klass, &iter))) { if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; ftype = mono_field_get_type (field); diff --git a/mono/mini/mini-exceptions.c.REMOVED.git-id b/mono/mini/mini-exceptions.c.REMOVED.git-id index 5cb93e084c..4164dccf1c 100644 --- a/mono/mini/mini-exceptions.c.REMOVED.git-id +++ b/mono/mini/mini-exceptions.c.REMOVED.git-id @@ -1 +1 @@ -dd04c1edbcc895c475e5fdf96c1ae3be8a67d9ae \ No newline at end of file +f5358bc222b1892a0a9903d53de6903cfbf3e18c \ No newline at end of file diff --git a/mono/mini/mini-gc.c b/mono/mini/mini-gc.c index 5b3b501a11..42f3007c1e 100644 --- a/mono/mini/mini-gc.c +++ b/mono/mini/mini-gc.c @@ -1785,7 +1785,7 @@ process_variables (MonoCompile *cfg) for (j = 0; j < numbits; ++j) { if (bitmap [j / GC_BITS_PER_WORD] & ((gsize)1 << (j % GC_BITS_PER_WORD))) { /* The descriptor is for the boxed object */ - set_slot (gcfg, (pos + j - (sizeof (MonoObject) / SIZEOF_SLOT)), cindex, pin ? SLOT_PIN : SLOT_REF); + set_slot (gcfg, (pos + j - (MONO_ABI_SIZEOF (MonoObject) / SIZEOF_SLOT)), cindex, pin ? SLOT_PIN : SLOT_REF); } } } @@ -1794,7 +1794,7 @@ process_variables (MonoCompile *cfg) if (cfg->verbose_level > 1) { for (j = 0; j < numbits; ++j) { if (bitmap [j / GC_BITS_PER_WORD] & ((gsize)1 << (j % GC_BITS_PER_WORD))) - printf ("\t\t%s slot at 0x%x(fp) (slot = %d)\n", pin ? "pin" : "ref", (int)(ins->inst_offset + (j * SIZEOF_SLOT)), (int)(pos + j - (sizeof (MonoObject) / SIZEOF_SLOT))); + printf ("\t\t%s slot at 0x%x(fp) (slot = %d)\n", pin ? "pin" : "ref", (int)(ins->inst_offset + (j * SIZEOF_SLOT)), (int)(pos + j - (MONO_ABI_SIZEOF (MonoObject) / SIZEOF_SLOT))); } } } else { diff --git a/mono/mini/mini-generic-sharing.c.REMOVED.git-id b/mono/mini/mini-generic-sharing.c.REMOVED.git-id index 40613bd93a..2afb093d3e 100644 --- a/mono/mini/mini-generic-sharing.c.REMOVED.git-id +++ b/mono/mini/mini-generic-sharing.c.REMOVED.git-id @@ -1 +1 @@ -c85b3cb53f8ab9905aa40da1b07ce96bda8a603e \ No newline at end of file +e95d70c4a30dee531ef9d06bdc74e4ba35b3c899 \ No newline at end of file diff --git a/mono/mini/mini-llvm.c.REMOVED.git-id b/mono/mini/mini-llvm.c.REMOVED.git-id index f94f41138d..af724d59ea 100644 --- a/mono/mini/mini-llvm.c.REMOVED.git-id +++ b/mono/mini/mini-llvm.c.REMOVED.git-id @@ -1 +1 @@ -9de9f3fa41740e56973928c320307aa2ea64d9e5 \ No newline at end of file +364e72e497fc0de41242f9596d48f8ef65734854 \ No newline at end of file diff --git a/mono/mini/mini-mips.c.REMOVED.git-id b/mono/mini/mini-mips.c.REMOVED.git-id index f609ce053a..e4b8a9b43e 100644 --- a/mono/mini/mini-mips.c.REMOVED.git-id +++ b/mono/mini/mini-mips.c.REMOVED.git-id @@ -1 +1 @@ -97a10cbe27316b319ea119bc4285ac720138fadb \ No newline at end of file +dc51e2bd7ede042390322b765af38ba18c345c2d \ No newline at end of file diff --git a/mono/mini/mini-native-types.c b/mono/mini/mini-native-types.c index fcc60681d2..165d075308 100644 --- a/mono/mini/mini-native-types.c +++ b/mono/mini/mini-native-types.c @@ -37,7 +37,7 @@ typedef struct { } MagicTypeInfo; -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 #define OP_PT_ADD OP_LADD #define OP_PT_SUB OP_LSUB #define OP_PT_MUL OP_LMUL @@ -138,7 +138,7 @@ mini_magic_type_size (MonoCompile *cfg, MonoType *type) return 4; else if (type->type == MONO_TYPE_R8 && !type->byref) return 8; - return SIZEOF_VOID_P; + return TARGET_SIZEOF_VOID_P; } #ifndef DISABLE_JIT @@ -183,7 +183,7 @@ emit_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi MonoInst *ins; int type_index, stack_type; - if (info->op_index == 2 && cfg->r4fp && SIZEOF_VOID_P == 4) { + if (info->op_index == 2 && cfg->r4fp && TARGET_SIZEOF_VOID_P == 4) { type_index = 3; stack_type = STACK_R4; } else { @@ -225,9 +225,9 @@ emit_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi int arg0 = args [1]->dreg; int arg_size = mini_magic_type_size (cfg, fsig->params [0]); - if (arg_size > SIZEOF_VOID_P) //8 -> 4 + if (arg_size > TARGET_SIZEOF_VOID_P) //8 -> 4 arg0 = emit_narrow (cfg, info, arg0)->dreg; - else if (arg_size < SIZEOF_VOID_P) //4 -> 8 + else if (arg_size < TARGET_SIZEOF_VOID_P) //4 -> 8 arg0 = emit_widen (cfg, info, arg0)->dreg; if (is_ldaddr) { /*Eliminate LDADDR if it's initing a local var*/ @@ -435,7 +435,7 @@ mono_class_is_magic_float (MonoClass *klass) magic_nfloat_class = klass; /* Assert that we are using the matching assembly */ - MonoClassField *value_field = mono_class_get_field_from_name (klass, "v"); + MonoClassField *value_field = mono_class_get_field_from_name_full (klass, "v", NULL); g_assert (value_field); MonoType *t = mono_field_get_type (value_field); MonoType *native = mini_native_type_replace_type (m_class_get_byval_arg (klass)); @@ -474,7 +474,7 @@ mini_native_type_replace_type (MonoType *type) if (mono_class_is_magic_int (klass)) return type->byref ? m_class_get_this_arg (mono_defaults.int_class) : mono_get_int_type (); if (mono_class_is_magic_float (klass)) -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 return type->byref ? m_class_get_this_arg (mono_defaults.double_class) : m_class_get_byval_arg (mono_defaults.double_class); #else return type->byref ? m_class_get_this_arg (mono_defaults.single_class) : m_class_get_byval_arg (mono_defaults.single_class); diff --git a/mono/mini/mini-posix.c b/mono/mini/mini-posix.c index bdfe9267fb..aaea4bfbb9 100644 --- a/mono/mini/mini-posix.c +++ b/mono/mini/mini-posix.c @@ -20,6 +20,9 @@ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_EXECINFO_H +#include +#endif #include #ifdef HAVE_SYS_TIME_H #include @@ -27,6 +30,12 @@ #ifdef HAVE_SYS_SYSCALL_H #include #endif +#ifdef HAVE_SYS_PRCTL_H +#include +#endif +#ifdef HAVE_SYS_WAIT_H +#include +#endif #include #include @@ -59,6 +68,8 @@ #include #include #include +#include +#include #include "mini.h" #include @@ -213,11 +224,11 @@ MONO_SIG_HANDLER_FUNC (static, sigabrt_signal_handler) } } -#ifdef TARGET_OSX MONO_SIG_HANDLER_FUNC (static, sigterm_signal_handler) { MONO_SIG_HANDLER_GET_CONTEXT; +#ifndef DISABLE_CRASH_REPORTING // Note: this function only returns for a single thread // When it's invoked on other threads once the dump begins, // those threads perform their dumps and then sleep until we @@ -229,19 +240,22 @@ MONO_SIG_HANDLER_FUNC (static, sigterm_signal_handler) if (!mono_threads_summarize (&mctx, &output, &hashes)) g_assert_not_reached (); +#ifdef TARGET_OSX if (mono_merp_enabled ()) { pid_t crashed_pid = getpid (); mono_merp_invoke (crashed_pid, "SIGTERM", output, &hashes); - } else { + } else +#endif + { // Only the dumping-supervisor thread exits mono_thread_summarize MOSTLY_ASYNC_SAFE_PRINTF("Unhandled exception dump: \n######\n%s\n######\n", output); sleep (3); } +#endif mono_chain_signal (MONO_SIG_HANDLER_PARAMS); exit (1); } -#endif #if (defined (USE_POSIX_BACKEND) && defined (SIGRTMIN)) || defined (SIGPROF) #define HAVE_PROFILER_SIGNAL @@ -394,49 +408,60 @@ remove_signal_handler (int signo) } } -#ifdef TARGET_OSX void mini_register_sigterm_handler (void) { +#ifndef DISABLE_CRASH_REPORTING /* always catch SIGTERM, conditionals inside of handler */ add_signal_handler (SIGTERM, sigterm_signal_handler, 0); -} #endif +} void mono_runtime_posix_install_handlers (void) { sigset_t signal_set; - - if (mini_get_debug_options ()->handle_sigint) + sigemptyset (&signal_set); + if (mini_get_debug_options ()->handle_sigint) { add_signal_handler (SIGINT, mono_sigint_signal_handler, SA_RESTART); + sigaddset (&signal_set, SIGINT); + } add_signal_handler (SIGFPE, mono_sigfpe_signal_handler, 0); + sigaddset (&signal_set, SIGFPE); add_signal_handler (SIGQUIT, sigquit_signal_handler, SA_RESTART); + sigaddset (&signal_set, SIGQUIT); add_signal_handler (SIGILL, mono_sigill_signal_handler, 0); + sigaddset (&signal_set, SIGILL); add_signal_handler (SIGBUS, mono_sigsegv_signal_handler, 0); - if (mono_jit_trace_calls != NULL) + sigaddset (&signal_set, SIGBUS); + if (mono_jit_trace_calls != NULL) { add_signal_handler (SIGUSR2, sigusr2_signal_handler, SA_RESTART); + sigaddset (&signal_set, SIGUSR2); + } /* it seems to have become a common bug for some programs that run as parents * of many processes to block signal delivery for real time signals. * We try to detect and work around their breakage here. */ - sigemptyset (&signal_set); if (mono_gc_get_suspend_signal () != -1) sigaddset (&signal_set, mono_gc_get_suspend_signal ()); if (mono_gc_get_restart_signal () != -1) sigaddset (&signal_set, mono_gc_get_restart_signal ()); sigaddset (&signal_set, SIGCHLD); - sigprocmask (SIG_UNBLOCK, &signal_set, NULL); signal (SIGPIPE, SIG_IGN); + sigaddset (&signal_set, SIGPIPE); add_signal_handler (SIGABRT, sigabrt_signal_handler, 0); + sigaddset (&signal_set, SIGABRT); /* catch SIGSEGV */ add_signal_handler (SIGSEGV, mono_sigsegv_signal_handler, 0); + sigaddset (&signal_set, SIGSEGV); + + sigprocmask (SIG_UNBLOCK, &signal_set, NULL); } #ifndef HOST_DARWIN @@ -852,6 +877,247 @@ mono_runtime_setup_stat_profiler (void) #endif /* defined(HOST_WATCHOS) */ +#ifndef MONO_CROSS_COMPILE +static gchar +conv_ascii_char (gchar s) +{ + if (s < 0x20) + return '.'; + if (s > 0x7e) + return '.'; + return s; +} + +static void +xxd_mem (gpointer d, int len) +{ + guint8 *data = (guint8 *) d; + + for (int off = 0; off < len; off += 0x10) { + gchar *line = g_strdup_printf ("%p ", data + off); + + for (int i = 0; i < 0x10; i++) { + if ((i + off) >= len) + line = g_strdup_printf ("%s ", line); + else + line = g_strdup_printf ("%s%02x ", line, data [off + i]); + } + + line = g_strdup_printf ("%s ", line); + + for (int i = 0; i < 0x10; i++) { + if ((i + off) >= len) + line = g_strdup_printf ("%s ", line); + else + line = g_strdup_printf ("%s%c", line, conv_ascii_char (data [off + i])); + } + + mono_runtime_printf_err ("%s", line); + } +} + +static void +dump_memory_around_ip (void *ctx) +{ +#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX + MonoContext mctx; + mono_sigctx_to_monoctx (ctx, &mctx); + gpointer native_ip = MONO_CONTEXT_GET_IP (&mctx); + if (native_ip) { + mono_runtime_printf_err ("Memory around native instruction pointer (%p):", native_ip); + xxd_mem (((guint8 *) native_ip) - 0x10, 0x40); + } else { + mono_runtime_printf_err ("instruction pointer is NULL, skip dumping"); + } +#endif +} + +static void +print_process_map (void) +{ +#ifdef __linux__ + FILE *fp = fopen ("/proc/self/maps", "r"); + char line [256]; + + if (fp == NULL) { + mono_runtime_printf_err ("no /proc/self/maps, not on linux?\n"); + return; + } + + mono_runtime_printf_err ("/proc/self/maps:"); + const int max_lines = 25; + int i = 0; + + while (fgets (line, sizeof (line), fp) && i++ < max_lines) { + // strip newline + size_t len = strlen (line); + if (len > 0 && line [len - 1] == '\n') + line [len - 1] = '\0'; + + mono_runtime_printf_err ("%s", line); + } + + fclose (fp); +#else + /* do nothing */ +#endif +} + +static void +dump_native_stacktrace (const char *signal, void *ctx) +{ +#ifdef HAVE_BACKTRACE_SYMBOLS + void *array [256]; + char **names; + int i, size; + + mono_runtime_printf_err ("\nNative stacktrace:\n"); + + size = backtrace (array, 256); + names = backtrace_symbols (array, size); + for (i = 0; i < size; ++i) { + mono_runtime_printf_err ("\t%s", names [i]); + } + g_free (names); + + /* Try to get more meaningful information using gdb */ + // FIXME: Remove locking and reenable. Can race with itself + // due to signals being handled on other threads. + // + // char *debugger_log = mono_debugger_state_str (); + // if (debugger_log) { + // fprintf (stderr, "\n\tDebugger session state:\n%s\n", debugger_log); + // } + +#if !defined(HOST_WIN32) && defined(HAVE_SYS_SYSCALL_H) && (defined(SYS_fork) || HAVE_FORK) + if (!mini_get_debug_options ()->no_gdb_backtrace) { + /* From g_spawn_command_line_sync () in eglib */ + pid_t pid; + int status; + pid_t crashed_pid = getpid (); + +#ifndef DISABLE_CRASH_REPORTING + MonoStackHash hashes; + gchar *output = NULL; + MonoContext mctx; + if (ctx) { + gboolean leave = FALSE; + gboolean dump_for_merp = FALSE; +#if defined(TARGET_OSX) + dump_for_merp = mono_merp_enabled (); +#endif + + if (!dump_for_merp) { +#ifdef DISABLE_STRUCTURED_CRASH + leave = TRUE; +#else + mini_register_sigterm_handler (); +#endif + } + + if (!leave) { + mono_sigctx_to_monoctx (ctx, &mctx); + // Do before forking + if (!mono_threads_summarize (&mctx, &output, &hashes)) + g_assert_not_reached (); + } + + // We want our crash, and don't have telemetry + // So we dump to disk + if (!leave && !dump_for_merp) + mono_crash_dump (output, &hashes); + } +#endif + + /* + * glibc fork acquires some locks, so if the crash happened inside malloc/free, + * it will deadlock. Call the syscall directly instead. + */ +#if defined(HOST_ANDROID) + /* SYS_fork is defined to be __NR_fork which is not defined in some ndk versions */ + g_assert_not_reached (); +#elif !defined(HOST_DARWIN) && defined(SYS_fork) + pid = (pid_t) syscall (SYS_fork); +#elif HAVE_FORK + pid = (pid_t) fork (); +#else + g_assert_not_reached (); +#endif + +#if defined (HAVE_PRCTL) && defined(PR_SET_PTRACER) + if (pid > 0) { + // Allow gdb to attach to the process even if ptrace_scope sysctl variable is set to + // a value other than 0 (the most permissive ptrace scope). Most modern Linux + // distributions set the scope to 1 which allows attaching only to direct children of + // the current process + prctl (PR_SET_PTRACER, pid, 0, 0, 0); + } +#endif + +#if defined(TARGET_OSX) && !defined(DISABLE_CRASH_REPORTING) + if (mono_merp_enabled ()) { + if (pid == 0) { + if (!ctx) { + mono_runtime_printf_err ("\nMust always pass non-null context when using merp.\n"); + exit (1); + } + + mono_merp_invoke (crashed_pid, signal, output, &hashes); + + exit (1); + } + } +#endif + + if (pid == 0) { + dup2 (STDERR_FILENO, STDOUT_FILENO); + + mono_gdb_render_native_backtraces (crashed_pid); + exit (1); + } + + mono_runtime_printf_err ("\nDebug info from gdb:\n"); + waitpid (pid, &status, 0); + } +#endif +#else +#ifdef HOST_ANDROID + /* set DUMPABLE for this process so debuggerd can attach with ptrace(2), see: + * https://android.googlesource.com/platform/bionic/+/151da681000c07da3c24cd30a3279b1ca017f452/linker/debugger.cpp#206 + * this has changed on later versions of Android. Also, we don't want to + * set this on start-up as DUMPABLE has security implications. */ + prctl (PR_SET_DUMPABLE, 1); + + mono_runtime_printf_err ("\nNo native Android stacktrace (see debuggerd output).\n"); +#endif +#endif +} + +void +mono_dump_native_crash_info (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info) +{ + print_process_map (); + + dump_memory_around_ip (ctx); + + dump_native_stacktrace (signal, ctx); +} + +void +mono_post_native_crash_handler (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining) +{ + if (!crash_chaining) { + /*Android abort is a fluke, it doesn't abort, it triggers another segv. */ +#if defined (HOST_ANDROID) + exit (-1); +#else + abort (); +#endif + } +} +#endif /* !MONO_CROSS_COMPILE */ + + static gboolean native_stack_with_gdb (pid_t crashed_pid, const char **argv, FILE *commands, char* commands_filename) { diff --git a/mono/mini/mini-ppc.c.REMOVED.git-id b/mono/mini/mini-ppc.c.REMOVED.git-id index 34dc2e3438..bd7bdcc5ed 100644 --- a/mono/mini/mini-ppc.c.REMOVED.git-id +++ b/mono/mini/mini-ppc.c.REMOVED.git-id @@ -1 +1 @@ -282868e019dac051573da276677e947a18d2ff86 \ No newline at end of file +1aa44390c1dc2750287cd740c5361541ffcdb1e2 \ No newline at end of file diff --git a/mono/mini/mini-runtime.c.REMOVED.git-id b/mono/mini/mini-runtime.c.REMOVED.git-id index 5d6d6aceac..426b8980fc 100644 --- a/mono/mini/mini-runtime.c.REMOVED.git-id +++ b/mono/mini/mini-runtime.c.REMOVED.git-id @@ -1 +1 @@ -286f3ba4893b8a62595f5ed58752f7f9cc70d892 \ No newline at end of file +18893d5c5b9b61aba04987c1fd5c8b94d9bebcd7 \ No newline at end of file diff --git a/mono/mini/mini-runtime.h b/mono/mini/mini-runtime.h index 6243537e5d..0217f9d77d 100644 --- a/mono/mini/mini-runtime.h +++ b/mono/mini/mini-runtime.h @@ -308,7 +308,7 @@ struct MonoJumpInfo { MonoJumpInfoType type; union { gconstpointer target; -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 gint64 offset; #else int offset; @@ -340,11 +340,11 @@ extern gboolean mono_compile_aot; extern gboolean mono_aot_only; extern gboolean mono_llvm_only; extern MonoAotMode mono_aot_mode; -extern MONO_API const char *mono_build_date; +MONO_API_DATA const char *mono_build_date; extern gboolean mono_do_signal_chaining; extern gboolean mono_do_crash_chaining; -extern MONO_API gboolean mono_use_llvm; -extern MONO_API gboolean mono_use_interpreter; +MONO_API_DATA gboolean mono_use_llvm; +MONO_API_DATA gboolean mono_use_interpreter; extern const char* mono_interp_opts_string; extern gboolean mono_do_single_method_regression; extern guint32 mono_single_method_regression_opt; @@ -427,7 +427,8 @@ void mono_set_lmf (MonoLMF *lmf); void mono_push_lmf (MonoLMFExt *ext); void mono_pop_lmf (MonoLMF *lmf); MonoJitTlsData* mono_get_jit_tls (void); -MONO_API MonoDomain* mono_jit_thread_attach (MonoDomain *domain); +MONO_API MONO_RT_EXTERNAL_ONLY +MonoDomain* mono_jit_thread_attach (MonoDomain *domain); MONO_API void mono_jit_set_domain (MonoDomain *domain); gboolean mono_method_same_domain (MonoJitInfo *caller, MonoJitInfo *callee); @@ -481,16 +482,38 @@ gboolean mono_jit_map_is_enabled (void); /* * Per-OS implementation functions. */ -void mono_runtime_install_handlers (void); -gboolean mono_runtime_install_custom_handlers (const char *handlers); -void mono_runtime_install_custom_handlers_usage (void); -void mono_runtime_cleanup_handlers (void); -void mono_runtime_setup_stat_profiler (void); -void mono_runtime_shutdown_stat_profiler (void); -void mono_runtime_posix_install_handlers (void); -void mono_gdb_render_native_backtraces (pid_t crashed_pid); +void +mono_runtime_install_handlers (void); -void mono_cross_helpers_run (void); +gboolean +mono_runtime_install_custom_handlers (const char *handlers); + +void +mono_runtime_install_custom_handlers_usage (void); + +void +mono_runtime_cleanup_handlers (void); + +void +mono_runtime_setup_stat_profiler (void); + +void +mono_runtime_shutdown_stat_profiler (void); + +void +mono_runtime_posix_install_handlers (void); + +void +mono_gdb_render_native_backtraces (pid_t crashed_pid); + +void +mono_cross_helpers_run (void); + +void +mono_dump_native_crash_info (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info); + +void +mono_post_native_crash_handler (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining); /* * Signal handling @@ -543,9 +566,7 @@ gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal); #define DISABLE_SDB 1 #endif -#ifdef TARGET_OSX void mini_register_sigterm_handler (void); -#endif #endif /* __MONO_MINI_RUNTIME_H__ */ diff --git a/mono/mini/mini-s390x.c.REMOVED.git-id b/mono/mini/mini-s390x.c.REMOVED.git-id index a2d082327a..0d01f29281 100644 --- a/mono/mini/mini-s390x.c.REMOVED.git-id +++ b/mono/mini/mini-s390x.c.REMOVED.git-id @@ -1 +1 @@ -5f63931ffcb6fbd84e66d229e2e743d60100ee71 \ No newline at end of file +3293b2dfc8d35b4430791eb9b625668fbabf322d \ No newline at end of file diff --git a/mono/mini/mini-sparc.c.REMOVED.git-id b/mono/mini/mini-sparc.c.REMOVED.git-id index 4379678b58..b9a80e9379 100644 --- a/mono/mini/mini-sparc.c.REMOVED.git-id +++ b/mono/mini/mini-sparc.c.REMOVED.git-id @@ -1 +1 @@ -87f087dd9084a7dd6a6d80404b6666cda90f2b4a \ No newline at end of file +313f1694208b6763ed17c10be9084db6c82eb27e \ No newline at end of file diff --git a/mono/mini/mini-sparc.h b/mono/mini/mini-sparc.h index 0bea1fdbd7..86e72c2fcd 100644 --- a/mono/mini/mini-sparc.h +++ b/mono/mini/mini-sparc.h @@ -52,7 +52,7 @@ #define MONO_ARCH_INST_REGPAIR_REG2(desc,hreg1) (((desc == 'l') ? sparc_o0 : (desc == 'L' ? (hreg1 + 1) : -1))) #endif -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 #define MONO_ARCH_FRAME_ALIGNMENT 16 #else #define MONO_ARCH_FRAME_ALIGNMENT 8 diff --git a/mono/mini/mini-trampolines.c b/mono/mini/mini-trampolines.c index c88b0c5edd..5c0ef9cdd2 100644 --- a/mono/mini/mini-trampolines.c +++ b/mono/mini/mini-trampolines.c @@ -1456,7 +1456,7 @@ mono_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean ad error_init (error); if (mono_use_interpreter) { - gpointer ret = mini_get_interp_callbacks ()->create_method_pointer (method, error); + gpointer ret = mini_get_interp_callbacks ()->create_method_pointer (method, FALSE, error); if (!mono_error_ok (error)) return NULL; return ret; diff --git a/mono/mini/mini-wasm-debugger.c b/mono/mini/mini-wasm-debugger.c new file mode 100644 index 0000000000..e2613e852b --- /dev/null +++ b/mono/mini/mini-wasm-debugger.c @@ -0,0 +1,657 @@ +#include "mini.h" +#include "mini-runtime.h" +#include +#include +#include +#include +#include +#include +#include + +//XXX This is dirty, extend ee.h to support extracting info from MonoInterpFrameHandle +#include + +#include + + +static int log_level = 1; + +#define DEBUG_PRINTF(level, ...) do { if (G_UNLIKELY ((level) <= log_level)) { fprintf (stdout, __VA_ARGS__); } } while (0) + +//functions exported to be used by JS +EMSCRIPTEN_KEEPALIVE int mono_wasm_set_breakpoint (const char *assembly_name, int method_token, int il_offset); +EMSCRIPTEN_KEEPALIVE int mono_wasm_current_bp_id (void); +EMSCRIPTEN_KEEPALIVE void mono_wasm_enum_frames (void); +EMSCRIPTEN_KEEPALIVE void mono_wasm_get_var_info (int scope, int pos); +EMSCRIPTEN_KEEPALIVE void mono_wasm_clear_all_breakpoints (void); +EMSCRIPTEN_KEEPALIVE void mono_wasm_setup_single_step (int kind); + +//JS functions imported that we use +extern void mono_wasm_add_frame (int il_offset, int method_token, const char *assembly_name); +extern void mono_wasm_fire_bp (void); +extern void mono_wasm_add_bool_var (gint8); +extern void mono_wasm_add_int_var (gint32); +extern void mono_wasm_add_long_var (gint64); +extern void mono_wasm_add_float_var (float); +extern void mono_wasm_add_double_var (double); +extern void mono_wasm_add_string_var (const char*); + +//FIXME move all of those fields to the profiler object +static gboolean debugger_enabled; + +static int event_request_id; +#define THREAD_TO_INTERNAL(thread) (thread)->internal_thread + +static void +inplace_tolower (char *c) +{ + int i; + for (i = strlen (c) - 1; i >= 0; --i) + c [i] = tolower (c [i]); +} + +static void +jit_done (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo) +{ + mono_de_add_pending_breakpoints (method, jinfo); +} + +static void +appdomain_load (MonoProfiler *prof, MonoDomain *domain) +{ + mono_de_domain_add (domain); +} + +/* Frame state handling */ +static GPtrArray *frames; + +static void +free_frame (DbgEngineStackFrame *frame) +{ + g_free (frame); +} + +static gboolean +collect_frames (MonoStackFrameInfo *info, MonoContext *ctx, gpointer data) +{ + SeqPoint sp; + MonoMethod *method; + + //skip wrappers + if (info->type != FRAME_TYPE_MANAGED && info->type != FRAME_TYPE_INTERP) + return FALSE; + + if (info->ji) + method = jinfo_get_method (info->ji); + else + method = info->method; + + if (!method) + return FALSE; + + DEBUG_PRINTF (2, "Reporting method %s native_offset %d\n", method->name, info->native_offset); + + if (!mono_find_prev_seq_point_for_native_offset (mono_get_root_domain (), method, info->native_offset, NULL, &sp)) + DEBUG_PRINTF (1, "Failed to lookup sequence point\n"); + + DbgEngineStackFrame *frame = g_new0 (DbgEngineStackFrame, 1); + + frame->ji = info->ji; + frame->domain = info->domain; + frame->method = method; + frame->native_offset = info->native_offset; + + g_ptr_array_add (frames, frame); + + return FALSE; +} + +static void +free_frame_state (void) +{ + if (frames) { + int i; + for (i = 0; i < frames->len; ++i) + free_frame (g_ptr_array_index (frames, i)); + g_ptr_array_set_size (frames, 0); + } +} + +static void +compute_frames (void) { + if (frames) { + int i; + for (i = 0; i < frames->len; ++i) + free_frame (g_ptr_array_index (frames, i)); + g_ptr_array_set_size (frames, 0); + } else { + frames = g_ptr_array_new (); + } + + mono_walk_stack_with_ctx (collect_frames, NULL, MONO_UNWIND_NONE, NULL); +} +static MonoContext* +tls_get_restore_state (void *tls) +{ + return NULL; +} + +static gboolean +try_process_suspend (void *tls, MonoContext *ctx) +{ + return FALSE; +} + +static gboolean +begin_breakpoint_processing (void *tls, MonoContext *ctx, MonoJitInfo *ji, gboolean from_signal) +{ + return TRUE; +} + +static void +begin_single_step_processing (MonoContext *ctx, gboolean from_signal) +{ +} + +static void +ss_discard_frame_context (void *the_tls) +{ + free_frame_state (); +} + +static void +ss_calculate_framecount (void *tls, MonoContext *ctx, gboolean force_use_ctx, DbgEngineStackFrame ***out_frames, int *nframes) +{ + compute_frames (); + if (out_frames) + *out_frames = (DbgEngineStackFrame **)frames->pdata; + if (nframes) + *nframes = frames->len; +} + +static gboolean +ensure_jit (DbgEngineStackFrame* the_frame) +{ + return TRUE; +} + +static int +ensure_runtime_is_suspended (void) +{ + return DE_ERR_NONE; +} + +static int +get_this_async_id (DbgEngineStackFrame *f) +{ + g_error ("get_this_async_id"); + return 0; +} + +static gboolean +set_set_notification_for_wait_completion_flag (DbgEngineStackFrame *f) +{ + g_error ("set_set_notification_for_wait_completion_flag"); + return FALSE; +} + +static MonoMethod* +get_notify_debugger_of_wait_completion_method (void) +{ + g_error ("get_notify_debugger_of_wait_completion_method"); +} + +typedef struct { + gboolean is_ss; //do I need this? +} BpEvents; + +static void* +create_breakpoint_events (GPtrArray *ss_reqs, GPtrArray *bp_reqs, MonoJitInfo *ji, EventKind kind) +{ + printf ("ss_reqs %d bp_reqs %d\n", ss_reqs->len, bp_reqs->len); + if ((ss_reqs && ss_reqs->len) || (bp_reqs && bp_reqs->len)) { + BpEvents *evts = g_new0 (BpEvents, 1); //just a non-null value to make sure we can raise it on process_breakpoint_events + evts->is_ss = (ss_reqs && ss_reqs->len); + return evts; + } + return NULL; +} + +static void +process_breakpoint_events (void *_evts, MonoMethod *method, MonoContext *ctx, int il_offsets) +{ + BpEvents *evts = _evts; + if (evts) { + if (evts->is_ss) + mono_de_cancel_ss (); + mono_wasm_fire_bp (); + g_free (evts); + } +} + +static void +no_seq_points_found (MonoMethod *method, int offset) +{ + /* + * This can happen in full-aot mode with assemblies AOTed without the 'soft-debug' option to save space. + */ + printf ("Unable to find seq points for method '%s', offset 0x%x.\n", mono_method_full_name (method, TRUE), offset); +} + +#define DBG_NOT_SUSPENDED 1 + +static int +ss_create_init_args (SingleStepReq *ss_req, SingleStepArgs *ss_args) +{ + printf ("ss_create_init_args\n"); + int dummy = 0; + ss_req->start_sp = ss_req->last_sp = &dummy; + compute_frames (); + memset (ss_args, 0, sizeof (*ss_args)); + + //BIG WTF, should not happen maybe should assert? + if (frames->len == 0) { + DEBUG_PRINTF (1, "SINGLE STEPPING FOUND NO FRAMES"); + return DBG_NOT_SUSPENDED; + } + + DbgEngineStackFrame *frame = g_ptr_array_index (frames, 0); + ss_req->start_method = ss_args->method = frame->method; + gboolean found_sp = mono_find_prev_seq_point_for_native_offset (frame->domain, frame->method, frame->native_offset, &ss_args->info, &ss_args->sp); + if (!found_sp) + no_seq_points_found (frame->method, frame->native_offset); + g_assert (found_sp); + + ss_args->frames = (DbgEngineStackFrame**)frames->pdata; + ss_args->nframes = frames->len; + //XXX do sp + + return DE_ERR_NONE; +} + +static void +ss_args_destroy (SingleStepArgs *ss_args) +{ + //nothing to do +} + +void +mono_wasm_debugger_init (void) +{ + if (!debugger_enabled) + return; + + DebuggerEngineCallbacks cbs = { + .tls_get_restore_state = tls_get_restore_state, + .try_process_suspend = try_process_suspend, + .begin_breakpoint_processing = begin_breakpoint_processing, + .begin_single_step_processing = begin_single_step_processing, + .ss_discard_frame_context = ss_discard_frame_context, + .ss_calculate_framecount = ss_calculate_framecount, + .ensure_jit = ensure_jit, + .ensure_runtime_is_suspended = ensure_runtime_is_suspended, + .get_this_async_id = get_this_async_id, + .set_set_notification_for_wait_completion_flag = set_set_notification_for_wait_completion_flag, + .get_notify_debugger_of_wait_completion_method = get_notify_debugger_of_wait_completion_method, + .create_breakpoint_events = create_breakpoint_events, + .process_breakpoint_events = process_breakpoint_events, + .ss_create_init_args = ss_create_init_args, + .ss_args_destroy = ss_args_destroy, + }; + + mono_debug_init (MONO_DEBUG_FORMAT_MONO); + mono_de_init (&cbs); + mono_de_set_log_level (1, stdout); + + mini_get_debug_options ()->gen_sdb_seq_points = TRUE; + mini_get_debug_options ()->mdb_optimizations = TRUE; + mono_disable_optimizations (MONO_OPT_LINEARS); + mini_get_debug_options ()->load_aot_jit_info_eagerly = TRUE; + + MonoProfilerHandle prof = mono_profiler_create (NULL); + mono_profiler_set_jit_done_callback (prof, jit_done); + //FIXME support multiple appdomains + mono_profiler_set_domain_loaded_callback (prof, appdomain_load); +} + +MONO_API void +mono_wasm_enable_debugging (void) +{ + DEBUG_PRINTF (1, "DEBUGGING ENABLED\n"); + debugger_enabled = TRUE; +} + +EMSCRIPTEN_KEEPALIVE void +mono_wasm_setup_single_step (int kind) +{ + int nmodifiers = 1; + + printf (">>>> mono_wasm_setup_single_step %d\n", kind); + EventRequest *req = (EventRequest *)g_malloc0 (sizeof (EventRequest) + (nmodifiers * sizeof (Modifier))); + req->id = ++event_request_id; + req->event_kind = EVENT_KIND_STEP; + // DE doesn't care about suspend_policy + // req->suspend_policy = SUSPEND_POLICY_ALL; + req->nmodifiers = nmodifiers; + + StepSize size = STEP_SIZE_MIN; + + //FIXME I DON'T KNOW WHAT I'M DOING!!!!! filter all the things. + StepFilter filter = (StepFilter)(STEP_FILTER_STATIC_CTOR | STEP_FILTER_DEBUGGER_HIDDEN | STEP_FILTER_DEBUGGER_STEP_THROUGH | STEP_FILTER_DEBUGGER_NON_USER_CODE); + req->modifiers [0].data.filter = filter; + + StepDepth depth; + switch (kind) { + case 0: //into + depth = STEP_DEPTH_INTO; + break; + case 1: //out + depth = STEP_DEPTH_OUT; + break; + case 2: //over + depth = STEP_DEPTH_OVER; + break; + default: + g_error ("dunno step kind %d", kind); + } + + DbgEngineErrorCode err = mono_de_ss_create (THREAD_TO_INTERNAL (mono_thread_current ()), size, depth, filter, req); + if (err != DE_ERR_NONE) { + DEBUG_PRINTF (1, "[dbg] Failed to setup single step request"); + } + printf ("ss is in place, now ahat?\n"); +} + +EMSCRIPTEN_KEEPALIVE void +mono_wasm_clear_all_breakpoints (void) +{ + DEBUG_PRINTF (1, "CLEAR BREAKPOINTS\n"); + mono_de_clear_all_breakpoints (); +} + +EMSCRIPTEN_KEEPALIVE int +mono_wasm_set_breakpoint (const char *assembly_name, int method_token, int il_offset) +{ + int i; + ERROR_DECL (error); + DEBUG_PRINTF (1, "SET BREAKPOINT: assembly %s method %x offset %x\n", assembly_name, method_token, il_offset); + + + //we get 'foo.dll' but mono_assembly_load expects 'foo' so we strip the last dot + char *lookup_name = g_strdup (assembly_name); + for (i = strlen (lookup_name) - 1; i >= 0; --i) { + if (lookup_name [i] == '.') { + lookup_name [i] = 0; + break; + } + } + + //resolve the assembly + MonoImageOpenStatus status; + MonoAssemblyName* aname = mono_assembly_name_new (lookup_name); + MonoAssembly *assembly = mono_assembly_load (aname, NULL, &status); + g_free (lookup_name); + if (!assembly) { + DEBUG_PRINTF (1, "Could not resolve assembly %s\n", assembly_name); + return -1; + } + + mono_assembly_name_free (aname); + + MonoMethod *method = mono_get_method_checked (assembly->image, MONO_TOKEN_METHOD_DEF | method_token, NULL, NULL, error); + if (!method) { + //FIXME don't swallow the error + DEBUG_PRINTF (1, "Could not find method due to %s\n", mono_error_get_message (error)); + mono_error_cleanup (error); + return -1; + } + + //FIXME right now none of the EventRequest fields are used by debugger-engine + EventRequest *req = g_new0 (EventRequest, 1); + req->id = ++event_request_id; + req->event_kind = EVENT_KIND_BREAKPOINT; + //DE doesn't care about suspend_policy + // req->suspend_policy = SUSPEND_POLICY_ALL; + req->nmodifiers = 0; //funny thing, + + // BreakPointRequest *req = breakpoint_request_new (assembly, method, il_offset); + MonoBreakpoint *bp = mono_de_set_breakpoint (method, il_offset, req, error); + + if (!bp) { + DEBUG_PRINTF (1, "Could not set breakpoint to %s\n", mono_error_get_message (error)); + mono_error_cleanup (error); + return 0; + } + + DEBUG_PRINTF (1, "NEW BP %p has id %d\n", req, req->id); + return req->id; +} + +void +mono_wasm_single_step_hit (void) +{ + mono_de_process_single_step (NULL, FALSE); +} + +void +mono_wasm_breakpoint_hit (void) +{ + mono_de_process_breakpoint (NULL, FALSE); + // mono_wasm_fire_bp (); +} + +EMSCRIPTEN_KEEPALIVE int +mono_wasm_current_bp_id (void) +{ + DEBUG_PRINTF (1, "COMPUTING breapoint ID\n"); + //FIXME handle compiled case + + /* Interpreter */ + MonoLMF *lmf = mono_get_lmf (); + + g_assert (((guint64)lmf->previous_lmf) & 2); + MonoLMFExt *ext = (MonoLMFExt*)lmf; + + g_assert (ext->kind == MONO_LMFEXT_INTERP_EXIT || ext->kind == MONO_LMFEXT_INTERP_EXIT_WITH_CTX); + MonoInterpFrameHandle *frame = ext->interp_exit_data; + MonoJitInfo *ji = mini_get_interp_callbacks ()->frame_get_jit_info (frame); + guint8 *ip = mini_get_interp_callbacks ()->frame_get_ip (frame); + + g_assert (ji && !ji->is_trampoline); + MonoMethod *method = jinfo_get_method (ji); + + /* Compute the native offset of the breakpoint from the ip */ + guint32 native_offset = ip - (guint8*)ji->code_start; + + MonoSeqPointInfo *info = NULL; + SeqPoint sp; + gboolean found_sp = mono_find_prev_seq_point_for_native_offset (mono_domain_get (), method, native_offset, &info, &sp); + if (!found_sp) + DEBUG_PRINTF (1, "Could not find SP\n"); + + + GPtrArray *bp_reqs = g_ptr_array_new (); + mono_de_collect_breakpoints_by_sp (&sp, ji, NULL, bp_reqs); + + if (bp_reqs->len == 0) { + DEBUG_PRINTF (1, "BP NOT FOUND for method %s JI %p il_offset %d\n", method->name, ji, sp.il_offset); + return -1; + } + + if (bp_reqs->len > 1) + DEBUG_PRINTF (1, "Multiple breakpoints (%d) at the same location, returning the first one.", bp_reqs->len); + + EventRequest *evt = (EventRequest *)g_ptr_array_index (bp_reqs, 0); + g_ptr_array_free (bp_reqs, TRUE); + + DEBUG_PRINTF (1, "Found BP %p with id %d\n", evt, evt->id); + return evt->id; +} + +static gboolean +list_frames (MonoStackFrameInfo *info, MonoContext *ctx, gpointer data) +{ + SeqPoint sp; + MonoMethod *method; + + //skip wrappers + if (info->type != FRAME_TYPE_MANAGED && info->type != FRAME_TYPE_INTERP) + return FALSE; + + + if (info->ji) + method = jinfo_get_method (info->ji); + else + method = info->method; + + if (!method) + return FALSE; + + DEBUG_PRINTF (2, "Reporting method %s native_offset %d\n", method->name, info->native_offset); + + if (!mono_find_prev_seq_point_for_native_offset (mono_get_root_domain (), method, info->native_offset, NULL, &sp)) + DEBUG_PRINTF (1, "Failed to lookup sequence point\n"); + + while (method->is_inflated) + method = ((MonoMethodInflated*)method)->declaring; + + char *assembly_name = g_strdup (m_class_get_image (method->klass)->module_name); + inplace_tolower (assembly_name); + + if (method->wrapper_type == MONO_WRAPPER_NONE) { + DEBUG_PRINTF (2, "adding off %d token %d assembly name %s\n", sp.il_offset, mono_metadata_token_index (method->token), assembly_name); + mono_wasm_add_frame (sp.il_offset, mono_metadata_token_index (method->token), assembly_name); + } + + g_free (assembly_name); + + return FALSE; +} + +EMSCRIPTEN_KEEPALIVE void +mono_wasm_enum_frames (void) +{ + mono_walk_stack_with_ctx (list_frames, NULL, MONO_UNWIND_NONE, NULL); +} + +typedef struct { + int cur_frame; + int target_frame; + int variable; +} FrameDescData; + +static gboolean +describe_variable (MonoStackFrameInfo *info, MonoContext *ctx, gpointer ud) +{ + ERROR_DECL (error); + MonoMethodHeader *header = NULL; + + FrameDescData *data = ud; + + //skip wrappers + if (info->type != FRAME_TYPE_MANAGED && info->type != FRAME_TYPE_INTERP) { + return FALSE; + } + + if (data->cur_frame < data->target_frame) { + ++data->cur_frame; + return FALSE; + } + + InterpFrame *frame = info->interp_frame; + g_assert (frame); + MonoMethod *method = frame->imethod->method; + g_assert (method); + + MonoType *type = NULL; + gpointer addr = NULL; + int pos = data->variable; + if (pos < 0) { + pos = -pos - 1; + type = mono_method_signature (method)->params [pos]; + addr = mini_get_interp_callbacks ()->frame_get_arg (frame, pos); + } else { + header = mono_method_get_header_checked (method, error); + mono_error_assert_ok (error); /* FIXME report error */ + + type = header->locals [pos]; + addr = mini_get_interp_callbacks ()->frame_get_local (frame, pos); + } + + DEBUG_PRINTF (2, "adding val %p type [%p] %s\n", addr, type, mono_type_full_name (type)); + + switch (type->type) { + case MONO_TYPE_BOOLEAN: + mono_wasm_add_bool_var (*(gint8*)addr); + break; + case MONO_TYPE_I1: + case MONO_TYPE_U1: + mono_wasm_add_int_var (*(gint8*)addr); + break; + case MONO_TYPE_CHAR: + case MONO_TYPE_I2: + case MONO_TYPE_U2: + mono_wasm_add_int_var (*(gint16*)addr); + break; + case MONO_TYPE_I4: + case MONO_TYPE_U4: + case MONO_TYPE_I: + case MONO_TYPE_U: + mono_wasm_add_int_var (*(gint32*)addr); + break; + case MONO_TYPE_I8: + case MONO_TYPE_U8: + mono_wasm_add_long_var (*(gint32*)addr); + break; + case MONO_TYPE_R4: + mono_wasm_add_float_var (*(float*)addr); + break; + case MONO_TYPE_R8: + mono_wasm_add_float_var (*(double*)addr); + break; + case MONO_TYPE_STRING: { + MonoString *str_obj = *(MonoString **)addr; + if (!str_obj) + mono_wasm_add_string_var (NULL); + char *str = mono_string_to_utf8_checked (str_obj, error); + mono_error_assert_ok (error); /* FIXME report error */ + + mono_wasm_add_string_var (str); + g_free (str); + break; + } + default: { + char *type_name = mono_type_full_name (type); + char *msg = g_strdup_printf("can't handle type %s [%p, %x]", type_name, type, type->type); + mono_wasm_add_string_var (msg); + g_free (msg); + g_free (type_name); + } + } + if (header) + mono_metadata_free_mh (header); + + return TRUE; +} + +//FIXME this doesn't support getting the return value pseudo-var +EMSCRIPTEN_KEEPALIVE void +mono_wasm_get_var_info (int scope, int pos) +{ + DEBUG_PRINTF (2, "getting var %d of scope %d\n", pos, scope); + + FrameDescData data; + data.cur_frame = 0; + data.target_frame = scope; + data.variable = pos; + + mono_walk_stack_with_ctx (describe_variable, NULL, MONO_UNWIND_NONE, &data); +} + + +// Functions required by debugger-state-machine. +gsize +mono_debugger_tls_thread_id (DebuggerTlsData *debuggerTlsData) +{ + return 1; +} diff --git a/mono/mini/mini-wasm.c b/mono/mini/mini-wasm.c index d30b9c9051..bae020a656 100644 --- a/mono/mini/mini-wasm.c +++ b/mono/mini/mini-wasm.c @@ -12,29 +12,11 @@ #include - -static int log_level = 1; - -#define DEBUG_PRINTF(level, ...) do { if (G_UNLIKELY ((level) <= log_level)) { fprintf (stdout, __VA_ARGS__); } } while (0) - //functions exported to be used by JS -EMSCRIPTEN_KEEPALIVE int mono_wasm_set_breakpoint (const char *assembly_name, int method_token, int il_offset); EMSCRIPTEN_KEEPALIVE void mono_set_timeout_exec (int id); -EMSCRIPTEN_KEEPALIVE int mono_wasm_current_bp_id (void); -EMSCRIPTEN_KEEPALIVE void mono_wasm_enum_frames (void); -EMSCRIPTEN_KEEPALIVE void mono_wasm_get_var_info (int scope, int pos); //JS functions imported that we use -extern void mono_wasm_add_frame (int il_offset, int method_token, const char *assembly_name); -extern void mono_wasm_fire_bp (void); extern void mono_set_timeout (int t, int d); -extern void mono_wasm_add_bool_var (gint8); -extern void mono_wasm_add_int_var (gint32); -extern void mono_wasm_add_long_var (gint64); -extern void mono_wasm_add_float_var (float); -extern void mono_wasm_add_double_var (double); -extern void mono_wasm_add_string_var (const char*); - gpointer mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) @@ -196,7 +178,8 @@ mono_set_timeout_exec (int id) MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System.Threading", "WasmRuntime"); g_assert (klass); - MonoMethod *method = mono_class_get_method_from_name (klass, "TimeoutCallback", -1); + MonoMethod *method = mono_class_get_method_from_name_checked (klass, "TimeoutCallback", -1, 0, error); + mono_error_assert_ok (error); g_assert (method); gpointer params[1] = { &id }; @@ -350,594 +333,3 @@ sem_timedwait (sem_t *sem, const struct timespec *abs_timeout) return 0; } - - -typedef struct { - //request data - MonoAssembly *assembly; - MonoMethod *method; - int il_offset; - - //bp id - int bp_id; - - - GPtrArray *children; -} BreakPointRequest; - -typedef struct { - long il_offset, native_offset; - guint8 *ip; - MonoJitInfo *ji; - MonoDomain *domain; -} BreakpointInstance; - - -//FIXME move all of those fields to the profiler object -static gboolean debugger_enabled; -static int bp_id_count; -static GHashTable *bp_locs; -static GPtrArray *active_breakpoints; - -static void -breakpoint_request_free (BreakPointRequest *bp) -{ - g_free (bp); -} - -static void -inplace_tolower (char *c) -{ - int i; - for (i = strlen (c) - 1; i >= 0; --i) - c [i] = tolower (c [i]); -} - -static BreakPointRequest * -breakpoint_request_new (MonoAssembly *assembly, MonoMethod *method, int il_offset) -{ - //dup and lower - BreakPointRequest *req = g_new0(BreakPointRequest, 1); - req->assembly = assembly; - req->method = method; - req->il_offset = il_offset; - - return req; -} - -static gboolean -breakpoint_matches (BreakPointRequest *bp, MonoMethod *method) -{ - if (!bp->method) - return FALSE; - if (method == bp->method) - return TRUE; - if (method->is_inflated && ((MonoMethodInflated*)method)->declaring == bp->method) - return TRUE; - //XXX we don't support setting a breakpoint on a specif ginst, so whatever - - return FALSE; -} -//LOCKING: loader lock must be held -static void -find_applicable_methods (BreakPointRequest *bp, GPtrArray *methods, GPtrArray *method_seq_points) -{ - GHashTableIter iter; - MonoMethod *method; - MonoSeqPointInfo *seq_points; - - mono_domain_lock (mono_get_root_domain ()); - g_hash_table_iter_init (&iter, domain_jit_info (mono_get_root_domain ())->seq_points); - while (g_hash_table_iter_next (&iter, (void**)&method, (void**)&seq_points)) { - if (breakpoint_matches (bp, method)) { - g_ptr_array_add (methods, method); - g_ptr_array_add (method_seq_points, seq_points); - } - } - mono_domain_unlock (mono_get_root_domain ()); -} - -static gboolean -insert_breakpoint (MonoSeqPointInfo *seq_points, MonoDomain *domain, MonoJitInfo *ji, BreakPointRequest *bp, MonoError *error) -{ - int count; - SeqPointIterator it; - gboolean it_has_sp = FALSE; - - error_init (error); - - DEBUG_PRINTF (1, "insert_breakpoint: JI [%p] method %s at %d SP %p\n", ji, jinfo_get_method (ji)->name, bp->il_offset, seq_points); - - mono_seq_point_iterator_init (&it, seq_points); - while (mono_seq_point_iterator_next (&it)) { - if (it.seq_point.il_offset == bp->il_offset) { - it_has_sp = TRUE; - break; - } - } - - if (!it_has_sp) { - /* - * The set of IL offsets with seq points doesn't completely match the - * info returned by CMD_METHOD_GET_DEBUG_INFO (#407). - */ - mono_seq_point_iterator_init (&it, seq_points); - while (mono_seq_point_iterator_next (&it)) { - if (it.seq_point.il_offset != METHOD_ENTRY_IL_OFFSET && - it.seq_point.il_offset != METHOD_EXIT_IL_OFFSET && - it.seq_point.il_offset + 1 == bp->il_offset) { - it_has_sp = TRUE; - break; - } - } - } - - if (!it_has_sp) { - DEBUG_PRINTF (1, "Unable to insert breakpoint at %s:%d. SeqPoint data:", mono_method_full_name (jinfo_get_method (ji), TRUE), bp->il_offset); - - mono_seq_point_iterator_init (&it, seq_points); - while (mono_seq_point_iterator_next (&it)) - DEBUG_PRINTF (1, "\t%d\n", it.seq_point.il_offset); - - DEBUG_PRINTF (1, "End of data\n"); - mono_error_set_error (error, MONO_ERROR_GENERIC, "Failed to find the SP for the given il offset"); - return FALSE; - } - - BreakpointInstance *inst = g_new0 (BreakpointInstance, 1); - inst->il_offset = it.seq_point.il_offset; - inst->native_offset = it.seq_point.native_offset; - inst->ip = (guint8*)ji->code_start + it.seq_point.native_offset; - inst->ji = ji; - inst->domain = mono_get_root_domain (); - - mono_loader_lock (); - - if (!bp->children) - bp->children = g_ptr_array_new (); - g_ptr_array_add (bp->children, inst); - - mono_loader_unlock (); - - // dbg_lock (); - count = GPOINTER_TO_INT (g_hash_table_lookup (bp_locs, inst->ip)); - g_hash_table_insert (bp_locs, inst->ip, GINT_TO_POINTER (count + 1)); - // dbg_unlock (); - - if (it.seq_point.native_offset == SEQ_POINT_NATIVE_OFFSET_DEAD_CODE) { - DEBUG_PRINTF (1, "Attempting to insert seq point at dead IL offset %d, ignoring.\n", (int)bp->il_offset); - } else if (count == 0) { - DEBUG_PRINTF (1, "ACTIVATING BREAKPOINT in %s\n", jinfo_get_method (ji)->name); - if (ji->is_interp) { - mini_get_interp_callbacks ()->set_breakpoint (ji, inst->ip); - } else { - g_error ("no idea how to deal with compiled code"); -#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED - mono_arch_set_breakpoint (ji, inst->ip); -#else - NOT_IMPLEMENTED; -#endif - } - } - - return TRUE; -} - -static gboolean -set_breakpoint (MonoMethod *method, MonoSeqPointInfo *seq_points, BreakPointRequest *bp, MonoError *error) -{ - MonoJitInfo *ji = NULL; - - error_init (error); - - MonoDomain *domain = mono_get_root_domain (); - gpointer code = mono_jit_find_compiled_method_with_jit_info (domain, method, &ji); - if (!code) { - /* Might be AOTed code */ - mono_class_init (method->klass); - code = mono_aot_get_method (domain, method, error); - if (code) { - mono_error_assert_ok (error); - ji = mono_jit_info_table_find (domain, code); - } else { - /* Might be interpreted */ - ji = mini_get_interp_callbacks ()->find_jit_info (domain, method); - } - g_assert (ji); - } - - return insert_breakpoint (seq_points, domain, ji, bp, error); -} - -static void -add_breakpoint (BreakPointRequest *bp) -{ - int i; - ERROR_DECL (error); - bp->bp_id = ++bp_id_count; - - error_init (error); - - GPtrArray *methods = g_ptr_array_new (); - GPtrArray *method_seq_points = g_ptr_array_new (); - - mono_loader_lock (); - - find_applicable_methods (bp, methods, method_seq_points); - - for (i = 0; i < methods->len; ++i) { - MonoMethod *method = (MonoMethod *)g_ptr_array_index (methods, i); - MonoSeqPointInfo *seq_points = (MonoSeqPointInfo *)g_ptr_array_index (method_seq_points, i); - - if (!set_breakpoint (method, seq_points, bp, error)) { - //FIXME don't swallow the error - DEBUG_PRINTF (1, "Error setting breaking due to %s\n", mono_error_get_message (error)); - mono_error_cleanup (error); - return; - } - } - - g_ptr_array_add (active_breakpoints, bp); - - mono_loader_unlock (); - - g_ptr_array_free (methods, TRUE); - g_ptr_array_free (method_seq_points, TRUE); -} - -static void -add_pending_breakpoints (MonoMethod *method, MonoJitInfo *ji) -{ - int i, j; - MonoSeqPointInfo *seq_points; - MonoDomain *domain; - MonoMethod *jmethod; - - if (!active_breakpoints) - return; - - domain = mono_domain_get (); - - mono_loader_lock (); - - for (i = 0; i < active_breakpoints->len; ++i) { - BreakPointRequest *bp = (BreakPointRequest *)g_ptr_array_index (active_breakpoints, i); - gboolean found = FALSE; - - if (!breakpoint_matches (bp, method)) - continue; - - for (j = 0; j < bp->children->len; ++j) { - BreakpointInstance *inst = (BreakpointInstance *)g_ptr_array_index (bp->children, j); - - if (inst->ji == ji) - found = TRUE; - } - - if (!found) { - ERROR_DECL (error); - MonoMethod *declaring = NULL; - - jmethod = jinfo_get_method (ji); - if (jmethod->is_inflated) - declaring = mono_method_get_declaring_generic_method (jmethod); - - mono_domain_lock (domain); - seq_points = (MonoSeqPointInfo *)g_hash_table_lookup (domain_jit_info (domain)->seq_points, jmethod); - if (!seq_points && declaring) - seq_points = (MonoSeqPointInfo *)g_hash_table_lookup (domain_jit_info (domain)->seq_points, declaring); - mono_domain_unlock (domain); - if (!seq_points) { - /* Could be AOT code */ - continue; - } - g_assert (seq_points); - - if (!insert_breakpoint (seq_points, domain, ji, bp, error)) { - DEBUG_PRINTF (1, "Failed to resolve pending BP due to %s\n", mono_error_get_message (error)); - mono_error_cleanup (error); - } - } - } - - mono_loader_unlock (); -} - -static void -jit_done (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo) -{ - add_pending_breakpoints (method, jinfo); -} - -void -mono_wasm_debugger_init (void) -{ - if (!debugger_enabled) - return; - - mono_debug_init (MONO_DEBUG_FORMAT_MONO); - mini_get_debug_options ()->gen_sdb_seq_points = TRUE; - mini_get_debug_options ()->mdb_optimizations = TRUE; - mono_disable_optimizations (MONO_OPT_LINEARS); - mini_get_debug_options ()->load_aot_jit_info_eagerly = TRUE; - - MonoProfilerHandle prof = mono_profiler_create (NULL); - mono_profiler_set_jit_done_callback (prof, jit_done); - - bp_locs = g_hash_table_new (NULL, NULL); - active_breakpoints = g_ptr_array_new (); -} - -MONO_API void -mono_wasm_enable_debugging (void) -{ - DEBUG_PRINTF (1, "DEBUGGING ENABLED"); - debugger_enabled = TRUE; -} - - -EMSCRIPTEN_KEEPALIVE int -mono_wasm_set_breakpoint (const char *assembly_name, int method_token, int il_offset) -{ - int i; - ERROR_DECL (error); - DEBUG_PRINTF (1, "SET BREAKPOINT: assembly %s method %x offset %x\n", assembly_name, method_token, il_offset); - - - //we get 'foo.dll' but mono_assembly_load expects 'foo' so we strip the last dot - char *lookup_name = g_strdup (assembly_name); - for (i = strlen (lookup_name) - 1; i >= 0; --i) { - if (lookup_name [i] == '.') { - lookup_name [i] = 0; - break; - } - } - - //resolve the assembly - MonoImageOpenStatus status; - MonoAssemblyName* aname = mono_assembly_name_new (lookup_name); - MonoAssembly *assembly = mono_assembly_load (aname, NULL, &status); - g_free (lookup_name); - if (!assembly) { - DEBUG_PRINTF (1, "Could not resolve assembly %s\n", assembly_name); - return -1; - } - - mono_assembly_name_free (aname); - - MonoMethod *method = mono_get_method_checked (assembly->image, MONO_TOKEN_METHOD_DEF | method_token, NULL, NULL, error); - if (!method) { - //FIXME don't swallow the error - DEBUG_PRINTF (1, "Could not find method due to %s\n", mono_error_get_message (error)); - mono_error_cleanup (error); - return -1; - } - - BreakPointRequest *req = breakpoint_request_new (assembly, method, il_offset); - - add_breakpoint (req); - return req->bp_id; -} - -//trampoline - -void -mono_sdb_single_step_trampoline (void) -{ - g_error ("mono_sdb_single_step_trampoline"); -} - -void -mono_wasm_breakpoint_hit (void) -{ - mono_wasm_fire_bp (); -} - -EMSCRIPTEN_KEEPALIVE int -mono_wasm_current_bp_id (void) -{ - int i, j; - - DEBUG_PRINTF (1, "COMPUTING breapoint ID\n"); - //FIXME handle compiled case - - /* Interpreter */ - MonoLMF *lmf = mono_get_lmf (); - - g_assert (((guint64)lmf->previous_lmf) & 2); - MonoLMFExt *ext = (MonoLMFExt*)lmf; - - g_assert (ext->kind == MONO_LMFEXT_INTERP_EXIT || ext->kind == MONO_LMFEXT_INTERP_EXIT_WITH_CTX); - MonoInterpFrameHandle *frame = ext->interp_exit_data; - MonoJitInfo *ji = mini_get_interp_callbacks ()->frame_get_jit_info (frame); - guint8 *ip = mini_get_interp_callbacks ()->frame_get_ip (frame); - - g_assert (ji && !ji->is_trampoline); - MonoMethod *method = jinfo_get_method (ji); - - /* Compute the native offset of the breakpoint from the ip */ - guint32 native_offset = ip - (guint8*)ji->code_start; - - MonoSeqPointInfo *info = NULL; - SeqPoint sp; - gboolean found_sp = mono_find_prev_seq_point_for_native_offset (mono_domain_get (), method, native_offset, &info, &sp); - if (!found_sp) - DEBUG_PRINTF (1, "Could not find SP\n"); - - for (i = 0; i < active_breakpoints->len; ++i) { - BreakPointRequest *bp = (BreakPointRequest *)g_ptr_array_index (active_breakpoints, i); - - if (!bp->method) - continue; - - for (j = 0; j < bp->children->len; ++j) { - BreakpointInstance *inst = (BreakpointInstance *)g_ptr_array_index (bp->children, j); - if (inst->ji == ji && inst->il_offset == sp.il_offset && inst->native_offset == sp.native_offset) { - DEBUG_PRINTF (1, "FOUND BREAKPOINT idx %d ID %d\n", i, bp->bp_id); - return bp->bp_id; - } - } - } - DEBUG_PRINTF (1, "BP NOT FOUND for method %s JI %p il_offset %d\n", method->name, ji, sp.il_offset); - - return -1; -} - -static gboolean -list_frames (MonoStackFrameInfo *info, MonoContext *ctx, gpointer data) -{ - SeqPoint sp; - MonoMethod *method; - - //skip wrappers - if (info->type != FRAME_TYPE_MANAGED && info->type != FRAME_TYPE_INTERP) - return FALSE; - - - if (info->ji) - method = jinfo_get_method (info->ji); - else - method = info->method; - - if (!method) - return FALSE; - - DEBUG_PRINTF (2, "Reporting method %s native_offset %d\n", method->name, info->native_offset); - - if (!mono_find_prev_seq_point_for_native_offset (mono_get_root_domain (), method, info->native_offset, NULL, &sp)) - DEBUG_PRINTF (1, "Failed to lookup sequence point\n"); - - while (method->is_inflated) - method = ((MonoMethodInflated*)method)->declaring; - - char *assembly_name = g_strdup (m_class_get_image (method->klass)->module_name); - inplace_tolower (assembly_name); - - if (method->wrapper_type == MONO_WRAPPER_NONE) { - DEBUG_PRINTF (2, "adding off %d token %d assembly name %s\n", sp.il_offset, mono_metadata_token_index (method->token), assembly_name); - mono_wasm_add_frame (sp.il_offset, mono_metadata_token_index (method->token), assembly_name); - } - - g_free (assembly_name); - - return FALSE; -} - -EMSCRIPTEN_KEEPALIVE void -mono_wasm_enum_frames (void) -{ - mono_walk_stack_with_ctx (list_frames, NULL, MONO_UNWIND_NONE, NULL); -} - -typedef struct { - int cur_frame; - int target_frame; - int variable; -} FrameDescData; - -static gboolean -describe_variable (MonoStackFrameInfo *info, MonoContext *ctx, gpointer ud) -{ - ERROR_DECL (error); - MonoMethodHeader *header = NULL; - - FrameDescData *data = ud; - - //skip wrappers - if (info->type != FRAME_TYPE_MANAGED && info->type != FRAME_TYPE_INTERP) { - return FALSE; - } - - if (data->cur_frame < data->target_frame) { - ++data->cur_frame; - return FALSE; - } - - InterpFrame *frame = info->interp_frame; - g_assert (frame); - MonoMethod *method = frame->imethod->method; - g_assert (method); - - MonoType *type = NULL; - gpointer addr = NULL; - int pos = data->variable; - if (pos < 0) { - pos = -pos - 1; - type = mono_method_signature (method)->params [pos]; - addr = mini_get_interp_callbacks ()->frame_get_arg (frame, pos); - } else { - header = mono_method_get_header_checked (method, error); - mono_error_assert_ok (error); /* FIXME report error */ - - type = header->locals [pos]; - addr = mini_get_interp_callbacks ()->frame_get_local (frame, pos); - } - - DEBUG_PRINTF (2, "adding val %p type [%p] %s\n", addr, type, mono_type_full_name (type)); - - switch (type->type) { - case MONO_TYPE_BOOLEAN: - mono_wasm_add_bool_var (*(gint8*)addr); - break; - case MONO_TYPE_I1: - case MONO_TYPE_U1: - mono_wasm_add_int_var (*(gint8*)addr); - break; - case MONO_TYPE_CHAR: - case MONO_TYPE_I2: - case MONO_TYPE_U2: - mono_wasm_add_int_var (*(gint16*)addr); - break; - case MONO_TYPE_I4: - case MONO_TYPE_U4: - case MONO_TYPE_I: - case MONO_TYPE_U: - mono_wasm_add_int_var (*(gint32*)addr); - break; - case MONO_TYPE_I8: - case MONO_TYPE_U8: - mono_wasm_add_long_var (*(gint32*)addr); - break; - case MONO_TYPE_R4: - mono_wasm_add_float_var (*(float*)addr); - break; - case MONO_TYPE_R8: - mono_wasm_add_float_var (*(double*)addr); - break; - case MONO_TYPE_STRING: { - MonoString *str_obj = *(MonoString **)addr; - if (!str_obj) - mono_wasm_add_string_var (NULL); - char *str = mono_string_to_utf8_checked (str_obj, error); - mono_error_assert_ok (error); /* FIXME report error */ - - mono_wasm_add_string_var (str); - g_free (str); - break; - } - default: { - char *type_name = mono_type_full_name (type); - char *msg = g_strdup_printf("can't handle type %s [%p, %x]", type_name, type, type->type); - mono_wasm_add_string_var (msg); - g_free (msg); - g_free (type_name); - } - } - mono_metadata_free_mh (header); - - return TRUE; -} - -//FIXME this doesn't support getting the return value pseudo-var -EMSCRIPTEN_KEEPALIVE void -mono_wasm_get_var_info (int scope, int pos) -{ - DEBUG_PRINTF (2, "getting var %d of scope %d\n", pos, scope); - - FrameDescData data; - data.cur_frame = 0; - data.target_frame = scope; - data.variable = pos; - - mono_walk_stack_with_ctx (describe_variable, NULL, MONO_UNWIND_NONE, &data); -} diff --git a/mono/mini/mini-wasm.h b/mono/mini/mini-wasm.h index 2df56bf30a..7a8a188307 100644 --- a/mono/mini/mini-wasm.h +++ b/mono/mini/mini-wasm.h @@ -58,4 +58,8 @@ void mono_wasm_enable_debugging (void); void mono_wasm_breakpoint_hit (void); void mono_wasm_set_timeout (int timeout, int id); +void mono_sdb_single_step_trampoline (void); +void mono_wasm_single_step_hit (void); +void mono_wasm_breakpoint_hit (void); + #endif /* __MONO_MINI_WASM_H__ */ diff --git a/mono/mini/mini-windows.c b/mono/mini/mini-windows.c index a10343f44e..6f6374eff7 100644 --- a/mono/mini/mini-windows.c +++ b/mono/mini/mini-windows.c @@ -245,7 +245,7 @@ mono_runtime_cleanup_handlers (void) #endif } - +#if G_HAVE_API_SUPPORT (HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) /* mono_chain_signal: * * Call the original signal handler for the signal given by the arguments, which @@ -260,6 +260,22 @@ MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal) return TRUE; } +#ifndef MONO_CROSS_COMPILE +void +mono_dump_native_crash_info (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info) +{ + //TBD +} + +void +mono_post_native_crash_handler (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info, gboolean crash_chaining) +{ + if (!crash_chaining) + abort (); +} +#endif /* !MONO_CROSS_COMPILE */ +#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */ + #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) static MMRESULT g_timer_event = 0; static HANDLE g_timer_main_thread = INVALID_HANDLE_VALUE; diff --git a/mono/mini/mini-x86.c.REMOVED.git-id b/mono/mini/mini-x86.c.REMOVED.git-id index 8183450f53..f9def54412 100644 --- a/mono/mini/mini-x86.c.REMOVED.git-id +++ b/mono/mini/mini-x86.c.REMOVED.git-id @@ -1 +1 @@ -ac88e5a80c124b8c6eacd15d9406438c0d5d43d0 \ No newline at end of file +ba5f3f673950c7e90479d726539b812ef95eabfe \ No newline at end of file diff --git a/mono/mini/mini.c.REMOVED.git-id b/mono/mini/mini.c.REMOVED.git-id index 8d5d783a06..db84276f83 100644 --- a/mono/mini/mini.c.REMOVED.git-id +++ b/mono/mini/mini.c.REMOVED.git-id @@ -1 +1 @@ -ff39e605cc28ca954b4724106f69ea9735d8c22e \ No newline at end of file +20807eb1b67f57319805064f50b7ce153a6bda66 \ No newline at end of file diff --git a/mono/mini/mini.h.REMOVED.git-id b/mono/mini/mini.h.REMOVED.git-id index 2383027dc4..f86ce6c5cf 100644 --- a/mono/mini/mini.h.REMOVED.git-id +++ b/mono/mini/mini.h.REMOVED.git-id @@ -1 +1 @@ -85d491f268d20c50330c06f6066525109e7161f8 \ No newline at end of file +971c91d40ee91dced84e3d74a60966636b8545ee \ No newline at end of file diff --git a/mono/mini/patch-info.h b/mono/mini/patch-info.h index dfae73591c..594f826dea 100644 --- a/mono/mini/patch-info.h +++ b/mono/mini/patch-info.h @@ -56,7 +56,6 @@ PATCH_INFO(GC_NURSERY_BITS, "gc_nursery_bits") PATCH_INFO(GSHAREDVT_IN_WRAPPER, "gsharedvt_in_wrapper") PATCH_INFO(ICALL_ADDR_CALL, "icall_addr_call") PATCH_INFO(GET_TLS_TRAMP, "get_tls_tramp") -PATCH_INFO(JIT_THREAD_ATTACH, "jit_thread_attach") PATCH_INFO(SET_TLS_TRAMP, "set_tls_tramp") /* * The address of a C function implementing a JIT icall. diff --git a/mono/mini/simd-intrinsics.c b/mono/mini/simd-intrinsics.c index dfaf3f9cbf..50c174aa7a 100644 --- a/mono/mini/simd-intrinsics.c +++ b/mono/mini/simd-intrinsics.c @@ -799,7 +799,7 @@ mono_simd_simplify_indirection (MonoCompile *cfg) MONO_INST_NEW (cfg, tmp, OP_XZERO); tmp->dreg = var->dreg; tmp->type = STACK_VTYPE; - tmp->klass = var->klass; + tmp->klass = var->klass; mono_bblock_insert_before_ins (target_bb [var->dreg], ins, tmp); break; } @@ -817,6 +817,96 @@ mono_simd_simplify_indirection (MonoCompile *cfg) g_free (target_bb); } +static gboolean +decompose_vtype_opt_uses_simd_intrinsics (MonoCompile *cfg, MonoInst *ins) +{ + if (cfg->uses_simd_intrinsics & MONO_CFG_USES_SIMD_INTRINSICS_DECOMPOSE_VTYPE) + return TRUE; + + switch (ins->opcode) { + case OP_XMOVE: + case OP_XZERO: + case OP_LOADX_MEMBASE: + case OP_LOADX_ALIGNED_MEMBASE: + case OP_STOREX_MEMBASE: + case OP_STOREX_ALIGNED_MEMBASE_REG: + return TRUE; + default: + return FALSE; + } +} + +static void +decompose_vtype_opt_load_arg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, guint32 *sreg) +{ + MonoInst *src_var = get_vreg_to_inst (cfg, *sreg); + if (src_var && src_var->opcode == OP_ARG && src_var->klass && MONO_CLASS_IS_SIMD (cfg, src_var->klass)) { + MonoInst *varload_ins, *load_ins; + NEW_VARLOADA (cfg, varload_ins, src_var, src_var->inst_vtype); + mono_bblock_insert_before_ins (bb, ins, varload_ins); + MONO_INST_NEW (cfg, load_ins, OP_LOADX_MEMBASE); + load_ins->klass = src_var->klass; + load_ins->type = STACK_VTYPE; + load_ins->sreg1 = varload_ins->dreg; + load_ins->dreg = alloc_xreg (cfg); + mono_bblock_insert_after_ins (bb, varload_ins, load_ins); + *sreg = load_ins->dreg; + } +} + +/* +* Windows x64 value type ABI uses reg/stack references (ArgValuetypeAddrInIReg/ArgValuetypeAddrOnStack) +* for function arguments. When using SIMD intrinsics arguments optimized into OP_ARG needs to be decomposed +* into correspondig SIMD LOADX/STOREX instructions. +*/ +#if defined(TARGET_WIN32) && defined(TARGET_AMD64) +void +mono_simd_decompose_intrinsic (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins) +{ + if (cfg->opt & MONO_OPT_SIMD && decompose_vtype_opt_uses_simd_intrinsics (cfg, ins)) { + decompose_vtype_opt_load_arg (cfg, bb, ins, &(ins->sreg1)); + decompose_vtype_opt_load_arg (cfg, bb, ins, &(ins->sreg2)); + decompose_vtype_opt_load_arg (cfg, bb, ins, &(ins->sreg3)); + MonoInst *dest_var = get_vreg_to_inst (cfg, ins->dreg); + if (dest_var && dest_var->opcode == OP_ARG && dest_var->klass && MONO_CLASS_IS_SIMD (cfg, dest_var->klass)) { + MonoInst *varload_ins, *store_ins; + ins->dreg = alloc_xreg (cfg); + NEW_VARLOADA (cfg, varload_ins, dest_var, dest_var->inst_vtype); + mono_bblock_insert_after_ins (bb, ins, varload_ins); + MONO_INST_NEW (cfg, store_ins, OP_STOREX_MEMBASE); + store_ins->klass = dest_var->klass; + store_ins->type = STACK_VTYPE; + store_ins->sreg1 = ins->dreg; + store_ins->dreg = varload_ins->dreg; + mono_bblock_insert_after_ins (bb, varload_ins, store_ins); + } + } +} + +void +mono_simd_decompose_intrinsics (MonoCompile *cfg) +{ + MonoBasicBlock *bb; + MonoInst *ins; + + for (bb = cfg->bb_entry; bb; bb = bb->next_bb) { + for (ins = bb->code; ins; ins = ins->next) { + mono_simd_decompose_intrinsic (cfg, bb, ins); + } + } +} +#else +void +mono_simd_decompose_intrinsic (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins) +{ +} + +void +mono_simd_decompose_intrinsics (MonoCompile *cfg) +{ +} +#endif /*defined(TARGET_WIN32) && defined(TARGET_AMD64)*/ + /* * This function expect that src be a value. */ @@ -1478,7 +1568,7 @@ simd_intrinsic_emit_long_getter (const SimdIntrinsic *intrinsic, MonoCompile *cf ins->backend.spill_var = get_double_spill_area (cfg); } else { ins->type = STACK_I8; - ins->dreg = alloc_lreg (cfg); + ins->dreg = alloc_lreg (cfg); } MONO_ADD_INS (cfg->cbb, ins); @@ -1490,7 +1580,7 @@ simd_intrinsic_emit_ctor (const SimdIntrinsic *intrinsic, MonoCompile *cfg, Mono { MonoInst *ins = NULL; int i, addr_reg; - gboolean is_ldaddr = args [0]->opcode == OP_LDADDR; + gboolean is_ldaddr = (args [0]->opcode == OP_LDADDR && args [0]->inst_left->opcode != OP_ARG); MonoMethodSignature *sig = mono_method_signature (cmethod); int store_op = mono_type_to_store_membase (cfg, sig->params [0]); int arg_size = mono_type_size (sig->params [0], &i); @@ -1516,7 +1606,6 @@ simd_intrinsic_emit_ctor (const SimdIntrinsic *intrinsic, MonoCompile *cfg, Mono ins->sreg1 = args [1]->dreg; ins->type = STACK_VTYPE; ins->dreg = dreg; - MONO_ADD_INS (cfg->cbb, ins); if (sig->params [0]->type == MONO_TYPE_R4) ins->backend.spill_var = mini_get_int_to_float_spill_area (cfg); @@ -1888,7 +1977,7 @@ mono_emit_vector_ldelema (MonoCompile *cfg, MonoType *array_type, MonoInst *arr, array_reg = arr->dreg; index_reg = index->dreg; -#if SIZEOF_VOID_P == 8 +#if TARGET_SIZEOF_VOID_P == 8 /* The array reg is 64 bits but the index reg is only 32 */ index2_reg = alloc_preg (cfg); MONO_EMIT_NEW_UNALU (cfg, OP_SEXT_I4, index2_reg, index_reg); @@ -1984,54 +2073,90 @@ MonoInst* mono_emit_simd_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) { const char *class_name; + MonoInst *simd_inst = NULL; - if (is_sys_numerics_assembly (m_class_get_image (cmethod->klass)->assembly)) - return emit_sys_numerics_intrinsics (cfg, cmethod, fsig, args); + if (is_sys_numerics_assembly (m_class_get_image (cmethod->klass)->assembly)) { + simd_inst = emit_sys_numerics_intrinsics (cfg, cmethod, fsig, args); + goto on_exit; + } - if (is_sys_numerics_vectors_assembly (m_class_get_image (cmethod->klass)->assembly)) - return emit_sys_numerics_vectors_intrinsics (cfg, cmethod, fsig, args); + if (is_sys_numerics_vectors_assembly (m_class_get_image (cmethod->klass)->assembly)) { + simd_inst = emit_sys_numerics_vectors_intrinsics (cfg, cmethod, fsig, args); + goto on_exit; + } if (strcmp ("Mono.Simd", m_class_get_image (cmethod->klass)->assembly->aname.name) || - strcmp ("Mono.Simd", m_class_get_name_space (cmethod->klass))) - return NULL; + strcmp ("Mono.Simd", m_class_get_name_space (cmethod->klass))) { + goto on_exit; + } class_name = m_class_get_name (cmethod->klass); - if (!strcmp ("SimdRuntime", class_name)) - return emit_simd_runtime_intrinsics (cfg, cmethod, fsig, args); + if (!strcmp ("SimdRuntime", class_name)) { + simd_inst = emit_simd_runtime_intrinsics (cfg, cmethod, fsig, args); + goto on_exit; + } - if (!strcmp ("ArrayExtensions", class_name)) - return emit_array_extension_intrinsics (cfg, cmethod, fsig, args); + if (!strcmp ("ArrayExtensions", class_name)) { + simd_inst = emit_array_extension_intrinsics (cfg, cmethod, fsig, args); + goto on_exit; + } if (!strcmp ("VectorOperations", class_name)) { if (!(cmethod->flags & METHOD_ATTRIBUTE_STATIC)) - return NULL; + goto on_exit; class_name = m_class_get_name (mono_class_from_mono_type (mono_method_signature (cmethod)->params [0])); } else if (!m_class_is_simd_type (cmethod->klass)) - return NULL; + goto on_exit; - cfg->uses_simd_intrinsics = 1; - if (!strcmp ("Vector2d", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector2d_intrinsics, sizeof (vector2d_intrinsics) / sizeof (SimdIntrinsic)); - if (!strcmp ("Vector4f", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector4f_intrinsics, sizeof (vector4f_intrinsics) / sizeof (SimdIntrinsic)); - if (!strcmp ("Vector2ul", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector2ul_intrinsics, sizeof (vector2ul_intrinsics) / sizeof (SimdIntrinsic)); - if (!strcmp ("Vector2l", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector2l_intrinsics, sizeof (vector2l_intrinsics) / sizeof (SimdIntrinsic)); - if (!strcmp ("Vector4ui", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector4ui_intrinsics, sizeof (vector4ui_intrinsics) / sizeof (SimdIntrinsic)); - if (!strcmp ("Vector4i", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector4i_intrinsics, sizeof (vector4i_intrinsics) / sizeof (SimdIntrinsic)); - if (!strcmp ("Vector8us", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector8us_intrinsics, sizeof (vector8us_intrinsics) / sizeof (SimdIntrinsic)); - if (!strcmp ("Vector8s", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector8s_intrinsics, sizeof (vector8s_intrinsics) / sizeof (SimdIntrinsic)); - if (!strcmp ("Vector16b", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector16b_intrinsics, sizeof (vector16b_intrinsics) / sizeof (SimdIntrinsic)); - if (!strcmp ("Vector16sb", class_name)) - return emit_intrinsics (cfg, cmethod, fsig, args, vector16sb_intrinsics, sizeof (vector16sb_intrinsics) / sizeof (SimdIntrinsic)); + cfg->uses_simd_intrinsics |= MONO_CFG_USES_SIMD_INTRINSICS_SIMPLIFY_INDIRECTION; + if (!strcmp ("Vector2d", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector2d_intrinsics, sizeof (vector2d_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } + if (!strcmp ("Vector4f", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector4f_intrinsics, sizeof (vector4f_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } + if (!strcmp ("Vector2ul", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector2ul_intrinsics, sizeof (vector2ul_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } + if (!strcmp ("Vector2l", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector2l_intrinsics, sizeof (vector2l_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } + if (!strcmp ("Vector4ui", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector4ui_intrinsics, sizeof (vector4ui_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } + if (!strcmp ("Vector4i", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector4i_intrinsics, sizeof (vector4i_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } + if (!strcmp ("Vector8us", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector8us_intrinsics, sizeof (vector8us_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } + if (!strcmp ("Vector8s", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector8s_intrinsics, sizeof (vector8s_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } + if (!strcmp ("Vector16b", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector16b_intrinsics, sizeof (vector16b_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } + if (!strcmp ("Vector16sb", class_name)) { + simd_inst = emit_intrinsics (cfg, cmethod, fsig, args, vector16sb_intrinsics, sizeof (vector16sb_intrinsics) / sizeof (SimdIntrinsic)); + goto on_exit; + } - return NULL; +on_exit: + if (simd_inst != NULL) { + cfg->uses_simd_intrinsics |= MONO_CFG_USES_SIMD_INTRINSICS; + cfg->uses_simd_intrinsics |= MONO_CFG_USES_SIMD_INTRINSICS_DECOMPOSE_VTYPE; + } + + return simd_inst; } static void @@ -2490,6 +2615,8 @@ emit_sys_numerics_vectors_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, Mon MonoInst* mono_emit_simd_field_load (MonoCompile *cfg, MonoClassField *field, MonoInst *addr) { + MonoInst * simd_inst = NULL; + if (is_sys_numerics_assembly (m_class_get_image (field->parent)->assembly)) { int index = -1; @@ -2511,20 +2638,20 @@ mono_emit_simd_field_load (MonoCompile *cfg, MonoClassField *field, MonoInst *ad if (cfg->verbose_level > 1) printf (" SIMD intrinsic field access: %s\n", field->name); - return simd_intrinsic_emit_getter_op (cfg, index, field->parent, mono_field_get_type (field), addr); + simd_inst = simd_intrinsic_emit_getter_op (cfg, index, field->parent, mono_field_get_type (field), addr); + goto on_exit; } } - return NULL; + +on_exit: + + if (simd_inst != NULL) { + cfg->uses_simd_intrinsics |= MONO_CFG_USES_SIMD_INTRINSICS; + cfg->uses_simd_intrinsics |= MONO_CFG_USES_SIMD_INTRINSICS_DECOMPOSE_VTYPE; + } + + return simd_inst; } #endif /* DISABLE_JIT */ - -#else - -MonoInst* -mono_emit_simd_field_load (MonoCompile *cfg, MonoClassField *field, MonoInst *addr) -{ - return NULL; -} - #endif /* MONO_ARCH_SIMD_INTRINSICS */ diff --git a/mono/mini/trace.c b/mono/mini/trace.c index c7e6c78623..9c512c7c50 100644 --- a/mono/mini/trace.c +++ b/mono/mini/trace.c @@ -61,8 +61,8 @@ MonoCallSpec *mono_trace_set_options (const char *options) } static -#ifdef HAVE_KW_THREAD -__thread +#ifdef MONO_KEYWORD_THREAD +MONO_KEYWORD_THREAD #endif int indent_level = 0; static guint64 start_time = 0; @@ -262,14 +262,15 @@ mono_trace_enter_method (MonoMethod *method, char *ebp) o = *arg_in_stack_slot(cpos, MonoObject *); if (o) { klass = o->vtable->klass; - + + gpointer data = mono_object_get_data (o); if (klass == mono_defaults.string_class) { char *as = string_to_utf8 ((MonoString*)o); printf ("[STRING:%p:%s], ", o, as); g_free (as); } else if (klass == mono_defaults.int32_class) { - printf ("[INT32:%p:%d], ", o, *(gint32 *)((char *)o + sizeof (MonoObject))); + printf ("[INT32:%p:%d], ", o, *(gint32 *)data); } else if (klass == mono_defaults.runtimetype_class) { printf ("[TYPE:%s], ", mono_type_full_name (((MonoReflectionType*)o)->type)); } else @@ -393,12 +394,13 @@ mono_trace_leave_method (MonoMethod *method, ...) MonoObject *o = va_arg (ap, MonoObject *); if (o) { + gpointer data = mono_object_get_data (o); if (o->vtable->klass == mono_defaults.boolean_class) { - printf ("[BOOLEAN:%p:%d]", o, *((guint8 *)o + sizeof (MonoObject))); + printf ("[BOOLEAN:%p:%d]", o, *(guint8 *)data); } else if (o->vtable->klass == mono_defaults.int32_class) { - printf ("[INT32:%p:%d]", o, *((gint32 *)((char *)o + sizeof (MonoObject)))); + printf ("[INT32:%p:%d]", o, *(gint32 *)data); } else if (o->vtable->klass == mono_defaults.int64_class) { - printf ("[INT64:%p:%lld]", o, (long long)*((gint64 *)((char *)o + sizeof (MonoObject)))); + printf ("[INT64:%p:%lld]", o, (long long)*(gint64 *)data); } else printf ("[%s.%s:%p]", m_class_get_name_space (mono_object_class (o)), m_class_get_name (mono_object_class (o)), o); } else diff --git a/mono/mini/tramp-amd64.c b/mono/mini/tramp-amd64.c index e9ee72523f..49492754b4 100644 --- a/mono/mini/tramp-amd64.c +++ b/mono/mini/tramp-amd64.c @@ -62,7 +62,7 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) unwind_ops = mono_arch_get_cie_program (); - amd64_alu_reg_imm (code, X86_ADD, this_reg, sizeof (MonoObject)); + amd64_alu_reg_imm (code, X86_ADD, this_reg, MONO_ABI_SIZEOF (MonoObject)); /* FIXME: Optimize this */ amd64_mov_reg_imm (code, AMD64_RAX, addr); amd64_jump_reg (code, AMD64_RAX); diff --git a/mono/mini/tramp-arm-gsharedvt.c b/mono/mini/tramp-arm-gsharedvt.c index 1c01b2fa45..39dbaa535a 100644 --- a/mono/mini/tramp-arm-gsharedvt.c +++ b/mono/mini/tramp-arm-gsharedvt.c @@ -210,10 +210,10 @@ mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) // ios abi compatible frame fp = ARMREG_R7; - cfa_offset = npushed * sizeof (gpointer); + cfa_offset = npushed * TARGET_SIZEOF_VOID_P; mono_add_unwind_op_def_cfa (unwind_ops, code, buf, ARMREG_SP, cfa_offset); ARM_PUSH (code, (1 << fp) | (1 << ARMREG_LR)); - cfa_offset += 2 * sizeof (gpointer); + cfa_offset += 2 * TARGET_SIZEOF_VOID_P; mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset); mono_add_unwind_op_offset (unwind_ops, code, buf, fp, (- cfa_offset)); mono_add_unwind_op_offset (unwind_ops, code, buf, ARMREG_LR, ((- cfa_offset) + 4)); @@ -234,7 +234,7 @@ mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) offset += 8 * 8; callee_freg_area_offset = -offset; - caller_reg_area_offset = cfa_offset - (npushed * sizeof (gpointer)); + caller_reg_area_offset = cfa_offset - (npushed * TARGET_SIZEOF_VOID_P); lr_offset = 4; /* Save info struct which is in r0 */ ARM_STR_IMM (code, arg_reg, fp, info_offset); @@ -244,7 +244,7 @@ mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) ARM_LDR_IMM (code, ARMREG_IP, arg_reg, MONO_STRUCT_OFFSET (GSharedVtCallInfo, stack_usage)); ARM_SUB_REG_REG (code, ARMREG_SP, ARMREG_SP, ARMREG_IP); /* Allocate callee register area just below the callee area so the slots are correct */ - ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 4 * sizeof (gpointer)); + ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 4 * TARGET_SIZEOF_VOID_P); if (mono_arm_is_hard_float ()) { /* Save caller fregs */ ARM_SUB_REG_IMM8 (code, ARMREG_IP, fp, -caller_freg_area_offset); @@ -264,12 +264,12 @@ mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) /* Call start_gsharedvt_call () */ /* 6 arguments, needs 2 stack slot, need to clean it up after the call */ - args_size = 2 * sizeof (gpointer); + args_size = 2 * TARGET_SIZEOF_VOID_P; ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, args_size); /* arg1 == info */ ARM_LDR_IMM (code, ARMREG_R0, fp, info_offset); /* arg2 == caller stack area */ - ARM_ADD_REG_IMM8 (code, ARMREG_R1, fp, cfa_offset - 4 * sizeof (gpointer)); + ARM_ADD_REG_IMM8 (code, ARMREG_R1, fp, cfa_offset - 4 * TARGET_SIZEOF_VOID_P); /* arg3 == callee stack area */ ARM_ADD_REG_IMM8 (code, ARMREG_R2, ARMREG_SP, args_size); /* arg4 == mrgctx reg */ @@ -311,7 +311,7 @@ mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) ARM_FLDD (code, i * 2, ARMREG_LR, (i * sizeof (double))); } /* Pop callee register area */ - ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 4 * sizeof (gpointer)); + ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, 4 * TARGET_SIZEOF_VOID_P); /* Load rgctx */ ARM_LDR_IMM (code, MONO_ARCH_RGCTX_REG, fp, mrgctx_offset); /* Make the call */ diff --git a/mono/mini/tramp-arm.c b/mono/mini/tramp-arm.c index e048218db6..49be8d5783 100644 --- a/mono/mini/tramp-arm.c +++ b/mono/mini/tramp-arm.c @@ -124,7 +124,7 @@ emit_bx (guint8* code, int reg) /* Stack size for trampoline function */ -#define STACK ALIGN_TO (sizeof (MonoLMF), MONO_ARCH_FRAME_ALIGNMENT) +#define STACK ALIGN_TO (MONO_ABI_SIZEOF (MonoLMF), MONO_ARCH_FRAME_ALIGNMENT) /* Method-specific trampoline code fragment size */ #define METHOD_TRAMPOLINE_SIZE 64 @@ -163,12 +163,12 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf */ /* The size of the area already allocated by the push in the specific trampoline */ - regsave_size = 14 * sizeof (mgreg_t); + regsave_size = 14 * sizeof (target_mgreg_t); /* The offset where lr was saved inside the regsave area */ - lr_offset = 13 * sizeof (mgreg_t); + lr_offset = 13 * sizeof (target_mgreg_t); // CFA = SP + (num registers pushed) * 4 - cfa_offset = 14 * sizeof (mgreg_t); + cfa_offset = 14 * sizeof (target_mgreg_t); mono_add_unwind_op_def_cfa (unwind_ops, code, buf, ARMREG_SP, cfa_offset); // PC saved at sp+LR_OFFSET mono_add_unwind_op_offset (unwind_ops, code, buf, ARMREG_LR, -4); @@ -205,7 +205,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf cfa_offset += STACK - regsave_size; mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset); /* V1 == lmf */ - code = mono_arm_emit_load_imm (code, ARMREG_R2, STACK - sizeof (MonoLMF)); + code = mono_arm_emit_load_imm (code, ARMREG_R2, STACK - MONO_ABI_SIZEOF (MonoLMF)); ARM_ADD_REG_REG (code, ARMREG_V1, ARMREG_SP, ARMREG_R2); /* ok, now we can continue with the MonoLMF setup, mostly untouched @@ -311,7 +311,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf * clobbered). This way we can just restore all the regs in one inst * and branch to IP. */ - ARM_STR_IMM (code, ARMREG_R0, ARMREG_V1, MONO_STRUCT_OFFSET (MonoLMF, iregs) + (ARMREG_R12 * sizeof (mgreg_t))); + ARM_STR_IMM (code, ARMREG_R0, ARMREG_V1, MONO_STRUCT_OFFSET (MonoLMF, iregs) + (ARMREG_R12 * sizeof (target_mgreg_t))); /* * Now we restore the MonoLMF (see emit_epilogue in mini-arm.c) @@ -375,18 +375,17 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf else code = emit_bx (code, ARMREG_IP); - constants = (gpointer*)code; - constants [0] = mono_get_lmf_addr; - constants [1] = (gpointer)mono_get_trampoline_func (tramp_type); - if (!aot) { + constants = (gpointer*)code; + constants [0] = mono_get_lmf_addr; + constants [1] = (gpointer)mono_get_trampoline_func (tramp_type); + /* backpatch by emitting the missing instructions skipped above */ ARM_LDR_IMM (load_get_lmf_addr, ARMREG_R0, ARMREG_PC, (code - load_get_lmf_addr - 8)); ARM_LDR_IMM (load_trampoline, ARMREG_IP, ARMREG_PC, (code + 4 - load_trampoline - 8)); + code += 8; } - code += 8; - /* Exception case */ arm_patch (labels [0], code); @@ -397,7 +396,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf * the trampoline frame and throw from the caller. */ /* Store the exception in place of IP */ - ARM_STR_IMM (code, ARMREG_R0, ARMREG_V1, MONO_STRUCT_OFFSET (MonoLMF, iregs) + (ARMREG_R12 * sizeof (mgreg_t))); + ARM_STR_IMM (code, ARMREG_R0, ARMREG_V1, MONO_STRUCT_OFFSET (MonoLMF, iregs) + (ARMREG_R12 * sizeof (target_mgreg_t))); ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, STACK - regsave_size); cfa_offset -= STACK - regsave_size; @@ -450,7 +449,7 @@ gpointer mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len) { guint8 *code, *buf, *tramp; - gpointer *constants; + guint32 *constants; guint32 short_branch = FALSE; guint32 size = SPEC_TRAMP_SIZE; @@ -484,18 +483,18 @@ mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_ty /* We save all the registers, except PC and SP */ ARM_PUSH (code, 0x5fff); if (short_branch) { - constants = (gpointer*)code; - constants [0] = GUINT_TO_POINTER (short_branch | (1 << 24)); - constants [1] = arg1; + constants = (guint32*)code; + constants [0] = short_branch | (1 << 24); + constants [1] = GPOINTER_TO_UINT (arg1); code += 8; } else { ARM_LDR_IMM (code, ARMREG_R1, ARMREG_PC, 8); /* temp reg */ ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_PC); code = emit_bx (code, ARMREG_R1); - constants = (gpointer*)code; - constants [0] = arg1; - constants [1] = tramp; + constants = (guint32*)code; + constants [0] = GPOINTER_TO_UINT (arg1); + constants [1] = GPOINTER_TO_UINT (tramp); code += 8; } @@ -533,7 +532,7 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) unwind_ops = mono_arch_get_cie_program (); ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 4); - ARM_ADD_REG_IMM8 (code, ARMREG_R0, ARMREG_R0, sizeof (MonoObject)); + ARM_ADD_REG_IMM8 (code, ARMREG_R0, ARMREG_R0, MONO_ABI_SIZEOF (MonoObject)); code = emit_bx (code, ARMREG_IP); *(guint32*)code = (guint32)addr; code += 4; @@ -624,7 +623,7 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info mrgctx = MONO_RGCTX_SLOT_IS_MRGCTX (slot); index = MONO_RGCTX_SLOT_INDEX (slot); if (mrgctx) - index += MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT / sizeof (gpointer); + index += MONO_SIZEOF_METHOD_RUNTIME_GENERIC_CONTEXT / TARGET_SIZEOF_VOID_P; for (depth = 0; ; ++depth) { int size = mono_class_rgctx_get_array_size (depth, mrgctx); @@ -675,7 +674,7 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info } /* fetch slot */ - code = mono_arm_emit_load_imm (code, ARMREG_R2, sizeof (gpointer) * (index + 1)); + code = mono_arm_emit_load_imm (code, ARMREG_R2, TARGET_SIZEOF_VOID_P * (index + 1)); ARM_LDR_REG_REG (code, ARMREG_R1, ARMREG_R1, ARMREG_R2); /* is the slot null? */ ARM_CMP_REG_IMM (code, ARMREG_R1, 0, 0); @@ -772,12 +771,12 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo * Construct the MonoContext structure on the stack. */ - frame_size = sizeof (MonoContext); + frame_size = MONO_ABI_SIZEOF (MonoContext); frame_size = ALIGN_TO (frame_size, MONO_ARCH_FRAME_ALIGNMENT); ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, frame_size); /* save ip, lr and pc into their correspodings ctx.regs slots. */ - ARM_STR_IMM (code, ARMREG_IP, ARMREG_SP, MONO_STRUCT_OFFSET (MonoContext, regs) + sizeof (mgreg_t) * ARMREG_IP); + ARM_STR_IMM (code, ARMREG_IP, ARMREG_SP, MONO_STRUCT_OFFSET (MonoContext, regs) + sizeof (target_mgreg_t) * ARMREG_IP); ARM_STR_IMM (code, ARMREG_LR, ARMREG_SP, MONO_STRUCT_OFFSET (MonoContext, regs) + 4 * ARMREG_LR); ARM_STR_IMM (code, ARMREG_LR, ARMREG_SP, MONO_STRUCT_OFFSET (MonoContext, regs) + 4 * ARMREG_PC); @@ -871,7 +870,7 @@ mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) ARM_MOV_REG_REG (code, fp_reg, ARMREG_SP); /* allocate space for saving the target addr and the call context and align stack */ - framesize = sizeof (mgreg_t) + ALIGN_TO (2 * sizeof (mgreg_t), MONO_ARCH_FRAME_ALIGNMENT); + framesize = sizeof (target_mgreg_t) + ALIGN_TO (2 * sizeof (target_mgreg_t), MONO_ARCH_FRAME_ALIGNMENT); ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, framesize); /* save CallContext* onto stack */ @@ -897,9 +896,9 @@ mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) ARM_B_COND (code, ARMCOND_EQ, 0); ARM_LDR_IMM (code, ARMREG_R2, ARMREG_R1, 0); ARM_STR_IMM (code, ARMREG_R2, ARMREG_R0, 0); - ARM_ADD_REG_IMM8 (code, ARMREG_R0, ARMREG_R0, sizeof (mgreg_t)); - ARM_ADD_REG_IMM8 (code, ARMREG_R1, ARMREG_R1, sizeof (mgreg_t)); - ARM_SUB_REG_IMM8 (code, ARMREG_R3, ARMREG_R3, sizeof (mgreg_t)); + ARM_ADD_REG_IMM8 (code, ARMREG_R0, ARMREG_R0, sizeof (target_mgreg_t)); + ARM_ADD_REG_IMM8 (code, ARMREG_R1, ARMREG_R1, sizeof (target_mgreg_t)); + ARM_SUB_REG_IMM8 (code, ARMREG_R3, ARMREG_R3, sizeof (target_mgreg_t)); ARM_B (code, 0); arm_patch (code - 4, label_start_copy); arm_patch (label_exit_copy, code); @@ -907,7 +906,7 @@ mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) ARM_LDR_IMM (code, ARMREG_IP, fp_reg, off_methodargs); /* set all general purpose registers from CallContext */ for (i = 0; i < PARAM_REGS; i++) - ARM_LDR_IMM (code, i, ARMREG_IP, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); + ARM_LDR_IMM (code, i, ARMREG_IP, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (target_mgreg_t)); /* set all floating registers from CallContext */ for (i = 0; i < FP_PARAM_REGS; i++) @@ -924,7 +923,7 @@ mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) /* set all general purpose registers to CallContext */ for (i = 0; i < PARAM_REGS; i++) - ARM_STR_IMM (code, i, ARMREG_IP, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); + ARM_STR_IMM (code, i, ARMREG_IP, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (target_mgreg_t)); /* set all floating registers to CallContext */ for (i = 0; i < FP_PARAM_REGS; i++) @@ -966,7 +965,7 @@ mono_arch_get_native_to_interp_trampoline (MonoTrampInfo **info) /* iOS ABI */ ARM_PUSH (code, (1 << fp_reg) | (1 << ARMREG_LR)); - mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, 2 * sizeof (mgreg_t)); + mono_add_unwind_op_def_cfa_offset (unwind_ops, code, start, 2 * sizeof (target_mgreg_t)); mono_add_unwind_op_offset (unwind_ops, code, start, ARMREG_LR, -4); mono_add_unwind_op_offset (unwind_ops, code, start, fp_reg, -8); @@ -974,19 +973,19 @@ mono_arch_get_native_to_interp_trampoline (MonoTrampInfo **info) mono_add_unwind_op_def_cfa_reg (unwind_ops, code, start, fp_reg); /* allocate the CallContext on the stack */ - framesize = ALIGN_TO (sizeof (CallContext), MONO_ARCH_FRAME_ALIGNMENT); + framesize = ALIGN_TO (MONO_ABI_SIZEOF (CallContext), MONO_ARCH_FRAME_ALIGNMENT); ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, framesize); /* save all general purpose registers into the CallContext */ for (i = 0; i < PARAM_REGS; i++) - ARM_STR_IMM (code, i, ARMREG_SP, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); + ARM_STR_IMM (code, i, ARMREG_SP, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (target_mgreg_t)); /* save all floating registers into the CallContext */ for (i = 0; i < FP_PARAM_REGS; i++) ARM_FSTD (code, i * 2, ARMREG_SP, MONO_STRUCT_OFFSET (CallContext, fregs) + i * sizeof (double)); /* set the stack pointer to the value at call site */ - ARM_ADD_REG_IMM8 (code, ARMREG_R0, fp_reg, 2 * sizeof (mgreg_t)); + ARM_ADD_REG_IMM8 (code, ARMREG_R0, fp_reg, 2 * sizeof (target_mgreg_t)); ARM_STR_IMM (code, ARMREG_R0, ARMREG_SP, MONO_STRUCT_OFFSET (CallContext, stack)); /* call interp_entry with the ccontext and rmethod as arguments */ @@ -997,7 +996,7 @@ mono_arch_get_native_to_interp_trampoline (MonoTrampInfo **info) /* load the return values from the context */ for (i = 0; i < PARAM_REGS; i++) - ARM_LDR_IMM (code, i, ARMREG_SP, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); + ARM_LDR_IMM (code, i, ARMREG_SP, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (target_mgreg_t)); for (i = 0; i < FP_PARAM_REGS; i++) ARM_FLDD (code, i * 2, ARMREG_SP, MONO_STRUCT_OFFSET (CallContext, fregs) + i * sizeof (double)); diff --git a/mono/mini/tramp-arm64.c b/mono/mini/tramp-arm64.c index 2201937cc2..925026e586 100644 --- a/mono/mini/tramp-arm64.c +++ b/mono/mini/tramp-arm64.c @@ -354,7 +354,7 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) start = code = mono_domain_code_reserve (domain, size); code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)addr); - arm_addx_imm (code, ARMREG_R0, ARMREG_R0, sizeof (MonoObject)); + arm_addx_imm (code, ARMREG_R0, ARMREG_R0, MONO_ABI_SIZEOF (MonoObject)); arm_brx (code, ARMREG_IP0); g_assert ((code - start) <= size); diff --git a/mono/mini/tramp-mips.c b/mono/mini/tramp-mips.c index 104e66f437..fd754349e8 100644 --- a/mono/mini/tramp-mips.c +++ b/mono/mini/tramp-mips.c @@ -46,7 +46,7 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) mips_load (code, mips_t9, addr); /* The this pointer is kept in a0 */ - mips_addiu (code, mips_a0, mips_a0, sizeof (MonoObject)); + mips_addiu (code, mips_a0, mips_a0, MONO_ABI_SIZEOF (MonoObject)); mips_jr (code, mips_t9); mips_nop (code); diff --git a/mono/mini/tramp-ppc.c b/mono/mini/tramp-ppc.c index b331d8a4cb..413dbf1c2d 100644 --- a/mono/mini/tramp-ppc.c +++ b/mono/mini/tramp-ppc.c @@ -95,12 +95,12 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) mono_domain_unlock (domain); if (short_branch) { - ppc_addi (code, this_pos, this_pos, sizeof (MonoObject)); + ppc_addi (code, this_pos, this_pos, MONO_ABI_SIZEOF (MonoObject)); ppc_emit32 (code, short_branch); } else { ppc_load_ptr (code, ppc_r0, addr); ppc_mtctr (code, ppc_r0); - ppc_addi (code, this_pos, this_pos, sizeof (MonoObject)); + ppc_addi (code, this_pos, this_pos, MONO_ABI_SIZEOF (MonoObject)); ppc_bcctr (code, 20, 0); } mono_arch_flush_icache (start, code - start); diff --git a/mono/mini/tramp-s390x.c b/mono/mini/tramp-s390x.c index 1df02896fc..37859bfbeb 100644 --- a/mono/mini/tramp-s390x.c +++ b/mono/mini/tramp-s390x.c @@ -103,7 +103,7 @@ mono_arch_get_unbox_trampoline (MonoMethod *method, gpointer addr) start = code = mono_domain_code_reserve (domain, 28); S390_SET (code, s390_r1, addr); - s390_aghi (code, this_pos, sizeof(MonoObject)); + s390_aghi (code, this_pos, MONO_ABI_SIZEOF (MonoObject)); s390_br (code, s390_r1); g_assert ((code - start) <= 28); diff --git a/mono/mini/tramp-sparc.c b/mono/mini/tramp-sparc.c index 55e5e7215c..5885d5f4e0 100644 --- a/mono/mini/tramp-sparc.c +++ b/mono/mini/tramp-sparc.c @@ -39,7 +39,7 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) start = code = mono_domain_code_reserve (mono_domain_get (), 36); /* This executes in the context of the caller, hence o0 */ - sparc_add_imm (code, 0, sparc_o0, sizeof (MonoObject), sparc_o0); + sparc_add_imm (code, 0, sparc_o0, MONO_ABI_SIZEOF (MonoObject), sparc_o0); #ifdef SPARCV9 reg = sparc_g4; #else diff --git a/mono/mini/tramp-wasm.c b/mono/mini/tramp-wasm.c index 1ee321f854..25486b6d4e 100644 --- a/mono/mini/tramp-wasm.c +++ b/mono/mini/tramp-wasm.c @@ -52,7 +52,7 @@ gpointer mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { if (info) - *info = mono_tramp_info_create ("interp_to_native_trampoline", mono_wasm_interp_to_native_trampoline, 1, NULL, NULL); + *info = mono_tramp_info_create ("interp_to_native_trampoline", (guint8*)mono_wasm_interp_to_native_trampoline, 1, NULL, NULL); return mono_wasm_interp_to_native_trampoline; } diff --git a/mono/mini/tramp-x86.c b/mono/mini/tramp-x86.c index 4dbda55ea4..3c04690aa4 100644 --- a/mono/mini/tramp-x86.c +++ b/mono/mini/tramp-x86.c @@ -49,7 +49,7 @@ mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) unwind_ops = mono_arch_get_cie_program (); - x86_alu_membase_imm (code, X86_ADD, X86_ESP, this_pos, sizeof (MonoObject)); + x86_alu_membase_imm (code, X86_ADD, X86_ESP, this_pos, MONO_ABI_SIZEOF (MonoObject)); x86_jump_code (code, addr); g_assert ((code - start) < size); @@ -158,26 +158,26 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf */ /* Compute frame offsets relative to the frame pointer %ebp */ - arg_offset = sizeof (mgreg_t); - caller_ip_offset = 2 * sizeof (mgreg_t); + arg_offset = sizeof (target_mgreg_t); + caller_ip_offset = 2 * sizeof (target_mgreg_t); offset = 0; offset += sizeof (MonoLMF); lmf_offset = -offset; - offset += X86_NREG * sizeof (mgreg_t); + offset += X86_NREG * sizeof (target_mgreg_t); regarray_offset = -offset; /* Argument area */ - offset += 4 * sizeof (mgreg_t); + offset += 4 * sizeof (target_mgreg_t); frame_size = ALIGN_TO (offset, MONO_ARCH_FRAME_ALIGNMENT); /* ret addr and arg are on the stack */ - cfa_offset = 2 * sizeof (mgreg_t); + cfa_offset = 2 * sizeof (target_mgreg_t); mono_add_unwind_op_def_cfa (unwind_ops, code, buf, X86_ESP, cfa_offset); // IP saved at CFA - 4 mono_add_unwind_op_offset (unwind_ops, code, buf, X86_NREG, -4); /* Allocate frame */ x86_push_reg (code, X86_EBP); - cfa_offset += sizeof (mgreg_t); + cfa_offset += sizeof (target_mgreg_t); mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset); mono_add_unwind_op_offset (unwind_ops, code, buf, X86_EBP, -cfa_offset); @@ -185,7 +185,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf mono_add_unwind_op_def_cfa_reg (unwind_ops, code, buf, X86_EBP); /* There are three words on the stack, adding + 4 aligns the stack to 16, which is needed on osx */ - x86_alu_reg_imm (code, X86_SUB, X86_ESP, frame_size + sizeof (mgreg_t)); + x86_alu_reg_imm (code, X86_SUB, X86_ESP, frame_size + sizeof (target_mgreg_t)); /* Save all registers */ for (i = X86_EAX; i <= X86_EDI; ++i) { @@ -194,46 +194,46 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf if (i == X86_EBP) { /* Save original ebp */ /* EAX is already saved */ - x86_mov_reg_membase (code, X86_EAX, X86_EBP, 0, sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, 0, sizeof (target_mgreg_t)); reg = X86_EAX; } else if (i == X86_ESP) { /* Save original esp */ /* EAX is already saved */ x86_mov_reg_reg (code, X86_EAX, X86_EBP); /* Saved ebp + trampoline arg + return addr */ - x86_alu_reg_imm (code, X86_ADD, X86_EAX, 3 * sizeof (mgreg_t)); + x86_alu_reg_imm (code, X86_ADD, X86_EAX, 3 * sizeof (target_mgreg_t)); reg = X86_EAX; } - x86_mov_membase_reg (code, X86_EBP, regarray_offset + (i * sizeof (mgreg_t)), reg, sizeof (mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, regarray_offset + (i * sizeof (target_mgreg_t)), reg, sizeof (target_mgreg_t)); } /* Setup LMF */ /* eip */ if (tramp_type == MONO_TRAMPOLINE_JUMP) { - x86_mov_membase_imm (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, eip), 0, sizeof (mgreg_t)); + x86_mov_membase_imm (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, eip), 0, sizeof (target_mgreg_t)); } else { - x86_mov_reg_membase (code, X86_EAX, X86_EBP, caller_ip_offset, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, eip), X86_EAX, sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, caller_ip_offset, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, eip), X86_EAX, sizeof (target_mgreg_t)); } /* method */ if ((tramp_type == MONO_TRAMPOLINE_JIT) || (tramp_type == MONO_TRAMPOLINE_JUMP)) { - x86_mov_reg_membase (code, X86_EAX, X86_EBP, arg_offset, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, method), X86_EAX, sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, arg_offset, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, method), X86_EAX, sizeof (target_mgreg_t)); } else { - x86_mov_membase_imm (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, method), 0, sizeof (mgreg_t)); + x86_mov_membase_imm (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, method), 0, sizeof (target_mgreg_t)); } /* esp */ - x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_ESP * sizeof (mgreg_t)), sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, esp), X86_EAX, sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_ESP * sizeof (target_mgreg_t)), sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, esp), X86_EAX, sizeof (target_mgreg_t)); /* callee save registers */ - x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_EBX * sizeof (mgreg_t)), sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, ebx), X86_EAX, sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_EDI * sizeof (mgreg_t)), sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, edi), X86_EAX, sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_ESI * sizeof (mgreg_t)), sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, esi), X86_EAX, sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_EBP * sizeof (mgreg_t)), sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, ebp), X86_EAX, sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_EBX * sizeof (target_mgreg_t)), sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, ebx), X86_EAX, sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_EDI * sizeof (target_mgreg_t)), sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, edi), X86_EAX, sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_ESI * sizeof (target_mgreg_t)), sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, esi), X86_EAX, sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, regarray_offset + (X86_EBP * sizeof (target_mgreg_t)), sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, ebp), X86_EAX, sizeof (target_mgreg_t)); /* Push LMF */ /* get the address of lmf for the current thread */ @@ -244,33 +244,33 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf x86_call_code (code, mono_get_lmf_addr); } /* lmf->lmf_addr = lmf_addr (%eax) */ - x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, lmf_addr), X86_EAX, sizeof (mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, lmf_addr), X86_EAX, sizeof (target_mgreg_t)); /* lmf->previous_lmf = *(lmf_addr) */ - x86_mov_reg_membase (code, X86_ECX, X86_EAX, 0, sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_ECX, X86_EAX, 0, sizeof (target_mgreg_t)); /* Signal to mono_arch_unwind_frame () that this is a trampoline frame */ x86_alu_reg_imm (code, X86_ADD, X86_ECX, 1); - x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, previous_lmf), X86_ECX, sizeof (mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, previous_lmf), X86_ECX, sizeof (target_mgreg_t)); /* *lmf_addr = lmf */ x86_lea_membase (code, X86_ECX, X86_EBP, lmf_offset); - x86_mov_membase_reg (code, X86_EAX, 0, X86_ECX, sizeof (mgreg_t)); + x86_mov_membase_reg (code, X86_EAX, 0, X86_ECX, sizeof (target_mgreg_t)); /* Call trampoline function */ /* Arg 1 - registers */ x86_lea_membase (code, X86_EAX, X86_EBP, regarray_offset); - x86_mov_membase_reg (code, X86_ESP, (0 * sizeof (mgreg_t)), X86_EAX, sizeof (mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, (0 * sizeof (target_mgreg_t)), X86_EAX, sizeof (target_mgreg_t)); /* Arg2 - calling code */ if (tramp_type == MONO_TRAMPOLINE_JUMP) { - x86_mov_membase_imm (code, X86_ESP, (1 * sizeof (mgreg_t)), 0, sizeof (mgreg_t)); + x86_mov_membase_imm (code, X86_ESP, (1 * sizeof (target_mgreg_t)), 0, sizeof (target_mgreg_t)); } else { - x86_mov_reg_membase (code, X86_EAX, X86_EBP, caller_ip_offset, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_ESP, (1 * sizeof (mgreg_t)), X86_EAX, sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, caller_ip_offset, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, (1 * sizeof (target_mgreg_t)), X86_EAX, sizeof (target_mgreg_t)); } /* Arg3 - trampoline argument */ - x86_mov_reg_membase (code, X86_EAX, X86_EBP, arg_offset, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_ESP, (2 * sizeof (mgreg_t)), X86_EAX, sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, arg_offset, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, (2 * sizeof (target_mgreg_t)), X86_EAX, sizeof (target_mgreg_t)); /* Arg4 - trampoline address */ // FIXME: - x86_mov_membase_imm (code, X86_ESP, (3 * sizeof (mgreg_t)), 0, sizeof (mgreg_t)); + x86_mov_membase_imm (code, X86_ESP, (3 * sizeof (target_mgreg_t)), 0, sizeof (target_mgreg_t)); #ifdef __APPLE__ /* check the stack is aligned after the ret ip is pushed */ @@ -299,10 +299,10 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf x86_mov_membase_reg (code, X86_EBP, arg_offset, X86_EAX, 4); /* Restore LMF */ - x86_mov_reg_membase (code, X86_EAX, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, lmf_addr), sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_ECX, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, previous_lmf), sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, lmf_addr), sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_ECX, X86_EBP, lmf_offset + G_STRUCT_OFFSET (MonoLMF, previous_lmf), sizeof (target_mgreg_t)); x86_alu_reg_imm (code, X86_SUB, X86_ECX, 1); - x86_mov_membase_reg (code, X86_EAX, 0, X86_ECX, sizeof (mgreg_t)); + x86_mov_membase_reg (code, X86_EAX, 0, X86_ECX, sizeof (target_mgreg_t)); /* Check for interruptions */ if (aot) { @@ -347,7 +347,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf } else { x86_mov_reg_imm (code, X86_ECX, (guint8*)mono_get_throw_exception_addr ()); } - x86_mov_reg_membase (code, X86_ECX, X86_ECX, 0, sizeof(gpointer)); + x86_mov_reg_membase (code, X86_ECX, X86_ECX, 0, sizeof(target_mgreg_t)); x86_jump_reg (code, X86_ECX); /* Normal case */ @@ -364,7 +364,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf /* Restore frame */ x86_leave (code); - cfa_offset -= sizeof (mgreg_t); + cfa_offset -= sizeof (target_mgreg_t); mono_add_unwind_op_def_cfa (unwind_ops, code, buf, X86_ESP, cfa_offset); mono_add_unwind_op_same_value (unwind_ops, code, buf, X86_EBP); @@ -373,7 +373,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf x86_mov_reg_membase (code, X86_EAX, X86_ESP, 0, 4); /* The trampoline returns normally, pop the trampoline argument */ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 4); - cfa_offset -= sizeof (mgreg_t); + cfa_offset -= sizeof (target_mgreg_t); mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, cfa_offset); x86_ret (code); } else { @@ -633,7 +633,7 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo framesize = 0; /* Argument area */ - framesize += sizeof (mgreg_t); + framesize += sizeof (target_mgreg_t); framesize = ALIGN_TO (framesize, 8); ctx_offset = framesize; @@ -658,23 +658,23 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo x86_alu_reg_imm (code, X86_SUB, X86_ESP, framesize + 8); /* Initialize a MonoContext structure on the stack */ - x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, eax), X86_EAX, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ebx), X86_EBX, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ecx), X86_ECX, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, edx), X86_EDX, sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_EAX, X86_EBP, 0, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ebp), X86_EAX, sizeof (mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, eax), X86_EAX, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ebx), X86_EBX, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ecx), X86_ECX, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, edx), X86_EDX, sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, 0, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ebp), X86_EAX, sizeof (target_mgreg_t)); x86_mov_reg_reg (code, X86_EAX, X86_EBP); x86_alu_reg_imm (code, X86_ADD, X86_EAX, cfa_offset); - x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, esp), X86_ESP, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, esi), X86_ESI, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, edi), X86_EDI, sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_EAX, X86_EBP, 4, sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, eip), X86_EAX, sizeof (mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, esp), X86_ESP, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, esi), X86_ESI, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, edi), X86_EDI, sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_EBP, 4, sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, eip), X86_EAX, sizeof (target_mgreg_t)); /* Call the single step/breakpoint function in sdb */ x86_lea_membase (code, X86_EAX, X86_ESP, ctx_offset); - x86_mov_membase_reg (code, X86_ESP, 0, X86_EAX, sizeof (mgreg_t)); + x86_mov_membase_reg (code, X86_ESP, 0, X86_EAX, sizeof (target_mgreg_t)); if (aot) { x86_breakpoint (code); @@ -687,20 +687,20 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo /* Restore registers from ctx */ /* Overwrite the saved ebp */ - x86_mov_reg_membase (code, X86_EAX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ebp), sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_EBP, 0, X86_EAX, sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ebp), sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, 0, X86_EAX, sizeof (target_mgreg_t)); /* Overwrite saved eip */ - x86_mov_reg_membase (code, X86_EAX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, eip), sizeof (mgreg_t)); - x86_mov_membase_reg (code, X86_EBP, 4, X86_EAX, sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_EAX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, eax), sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_EBX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ebx), sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_ECX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ecx), sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_EDX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, edx), sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_ESI, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, esi), sizeof (mgreg_t)); - x86_mov_reg_membase (code, X86_EDI, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, edi), sizeof (mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, eip), sizeof (target_mgreg_t)); + x86_mov_membase_reg (code, X86_EBP, 4, X86_EAX, sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_EAX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, eax), sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_EBX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ebx), sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_ECX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, ecx), sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_EDX, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, edx), sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_ESI, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, esi), sizeof (target_mgreg_t)); + x86_mov_reg_membase (code, X86_EDI, X86_ESP, ctx_offset + G_STRUCT_OFFSET (MonoContext, edi), sizeof (target_mgreg_t)); x86_leave (code); - cfa_offset -= sizeof (mgreg_t); + cfa_offset -= sizeof (target_mgreg_t); mono_add_unwind_op_def_cfa (unwind_ops, code, buf, X86_ESP, cfa_offset); x86_ret (code); diff --git a/mono/mini/type-checking.c b/mono/mini/type-checking.c index f710398518..085c880f8c 100644 --- a/mono/mini/type-checking.c +++ b/mono/mini/type-checking.c @@ -34,7 +34,7 @@ emit_cached_check_args (MonoCompile *cfg, MonoInst *obj, MonoClass *klass, int c cache_ins = mini_emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_CAST_CACHE); /* klass - it's the second element of the cache entry*/ - EMIT_NEW_LOAD_MEMBASE (cfg, args [1], OP_LOAD_MEMBASE, alloc_preg (cfg), cache_ins->dreg, sizeof (gpointer)); + EMIT_NEW_LOAD_MEMBASE (cfg, args [1], OP_LOAD_MEMBASE, alloc_preg (cfg), cache_ins->dreg, TARGET_SIZEOF_VOID_P); args [2] = cache_ins; /* cache */ } else { @@ -115,7 +115,7 @@ mini_emit_isninst_cast_inst (MonoCompile *cfg, int klass_reg, MonoClass *klass, MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBLT_UN, false_target); } MONO_EMIT_NEW_LOAD_MEMBASE (cfg, stypes_reg, klass_reg, m_class_offsetof_supertypes ()); - MONO_EMIT_NEW_LOAD_MEMBASE (cfg, stype, stypes_reg, ((m_class_get_idepth (klass) - 1) * SIZEOF_VOID_P)); + MONO_EMIT_NEW_LOAD_MEMBASE (cfg, stype, stypes_reg, ((m_class_get_idepth (klass) - 1) * TARGET_SIZEOF_VOID_P)); if (klass_ins) { MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, -1, stype, klass_ins->dreg); } else if (cfg->compile_aot) { @@ -345,7 +345,7 @@ mini_emit_castclass_inst (MonoCompile *cfg, int obj_reg, int klass_reg, MonoClas MONO_EMIT_NEW_COND_EXC (cfg, LT_UN, "InvalidCastException"); } MONO_EMIT_NEW_LOAD_MEMBASE (cfg, stypes_reg, klass_reg, m_class_offsetof_supertypes ()); - MONO_EMIT_NEW_LOAD_MEMBASE (cfg, stype, stypes_reg, ((m_class_get_idepth (klass) - 1) * SIZEOF_VOID_P)); + MONO_EMIT_NEW_LOAD_MEMBASE (cfg, stype, stypes_reg, ((m_class_get_idepth (klass) - 1) * TARGET_SIZEOF_VOID_P)); mini_emit_class_check_inst (cfg, stype, klass, klass_inst); } } diff --git a/mono/mini/version.h b/mono/mini/version.h index cc560c3bd4..a4ca2ff400 100644 --- a/mono/mini/version.h +++ b/mono/mini/version.h @@ -1 +1 @@ -#define FULL_VERSION "explicit/ab3c897" +#define FULL_VERSION "explicit/e257971" diff --git a/mono/mini/wasm_m2n_invoke.g.h b/mono/mini/wasm_m2n_invoke.g.h index e9a13056d7..8e9e1ebdd2 100644 --- a/mono/mini/wasm_m2n_invoke.g.h +++ b/mono/mini/wasm_m2n_invoke.g.h @@ -341,6 +341,16 @@ wasm_invoke_iillli (void *target_func, InterpMethodArguments *margs) } +static void +wasm_invoke_idiii (void *target_func, InterpMethodArguments *margs) +{ + int (*func)(double arg_0, int arg_1, int arg_2, int arg_3) = target_func; + + int res = func (margs->fargs [FIDX (0)], (int)margs->iargs [0], (int)margs->iargs [1], (int)margs->iargs [2]); + *(int*)margs->retval = res; + +} + static void wasm_invoke_lii (void *target_func, InterpMethodArguments *margs) { @@ -510,6 +520,8 @@ icall_trampoline_dispatch (const char *cookie, void *target_func, InterpMethodAr wasm_invoke_iili (target_func, margs); else if (!strcmp ("IILLLI", cookie)) wasm_invoke_iillli (target_func, margs); + else if (!strcmp ("IDIII", cookie)) + wasm_invoke_idiii (target_func, margs); else if (!strcmp ("LII", cookie)) wasm_invoke_lii (target_func, margs); else if (!strcmp ("VID", cookie)) diff --git a/mono/profiler/Makefile.in b/mono/profiler/Makefile.in index fd01e19278..59dd82177a 100644 --- a/mono/profiler/Makefile.in +++ b/mono/profiler/Makefile.in @@ -343,6 +343,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -358,6 +360,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -398,11 +401,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/profiler/aot.c b/mono/profiler/aot.c index 9d7da9cc08..57cd15edf9 100644 --- a/mono/profiler/aot.c +++ b/mono/profiler/aot.c @@ -341,9 +341,9 @@ add_class (MonoProfiler *prof, MonoClass *klass) MonoClass *klass_nested_in = mono_class_get_nesting_type (klass); if (klass_nested_in) - name = g_strdup_printf ("%s.%s/%s", mono_class_get_namespace (klass_nested_in), mono_class_get_name (klass_nested_in), mono_class_get_name (klass)); + name = g_strdup_printf ("%s.%s/%s", m_class_get_name_space (klass_nested_in), m_class_get_name (klass_nested_in), m_class_get_name (klass)); else - name = g_strdup_printf ("%s.%s", mono_class_get_namespace (klass), mono_class_get_name (klass)); + name = g_strdup_printf ("%s.%s", m_class_get_name_space (klass), m_class_get_name (klass)); id = prof->id ++; emit_record (prof, AOTPROF_RECORD_TYPE, id); diff --git a/mono/profiler/coverage.c b/mono/profiler/coverage.c index 4939402935..51f3d63666 100644 --- a/mono/profiler/coverage.c +++ b/mono/profiler/coverage.c @@ -59,6 +59,7 @@ #include #include +#include #include #include #include @@ -277,7 +278,7 @@ dump_method (gpointer key, gpointer value, gpointer userdata) image_name = mono_image_get_name (image); method_signature = mono_signature_get_desc (mono_method_signature (method), TRUE); - class_name = parse_generic_type_names (mono_type_get_name (mono_class_get_type (klass))); + class_name = parse_generic_type_names (mono_type_get_name (m_class_get_byval_arg (klass))); method_name = mono_method_get_name (method); if (coverage_profiler.data->len != 0) { @@ -352,7 +353,7 @@ dump_classes_for_image (gpointer key, gpointer value, gpointer userdata) if (!image_name || strcmp (image_name, mono_image_get_name (((MonoImage*) userdata))) != 0) return; - class_name = mono_type_get_name (mono_class_get_type (klass)); + class_name = mono_type_get_name (m_class_get_byval_arg (klass)); number_of_methods = mono_class_num_methods (klass); @@ -412,7 +413,7 @@ static void dump_assembly (gpointer key, gpointer value, gpointer userdata) { MonoAssembly *assembly = (MonoAssembly *)value; - MonoImage *image = mono_assembly_get_image (assembly); + MonoImage *image = mono_assembly_get_image_internal (assembly); const char *image_name, *image_guid, *image_filename; char *escaped_image_name, *escaped_image_filename; int number_of_methods = 0, partially_covered = 0; @@ -483,7 +484,7 @@ consider_class (MonoImage *image, MonoClass *klass) if (mono_conc_hashtable_lookup (coverage_profiler.filtered_classes, klass)) return FALSE; - char *classname = mono_type_get_name (mono_class_get_type (klass)); + char *classname = mono_type_get_name (m_class_get_byval_arg (klass)); char *fqn = g_strdup_printf ("[%s]%s", mono_image_get_name (image), classname); // Check positive filters first @@ -646,7 +647,7 @@ assembly_loaded (MonoProfiler *prof, MonoAssembly *assembly) return; } - MonoImage *image = mono_assembly_get_image (assembly); + MonoImage *image = mono_assembly_get_image_internal (assembly); if (!consider_image (image)) return; @@ -946,7 +947,7 @@ parse_args (const char *desc) const char *p; gboolean in_quotes = FALSE; char quote_char = '\0'; - char *buffer = malloc (strlen (desc)); + char *buffer = g_malloc (strlen (desc) + 1); int buffer_pos = 0; for (p = desc; *p; p++){ diff --git a/mono/profiler/log-args.c b/mono/profiler/log-args.c index ccd0935d2c..e4e183acdb 100644 --- a/mono/profiler/log-args.c +++ b/mono/profiler/log-args.c @@ -185,7 +185,7 @@ proflog_parse_args (ProfilerConfig *config, const char *desc) const char *p; gboolean in_quotes = FALSE; char quote_char = '\0'; - char *buffer = malloc (strlen (desc)); + char *buffer = g_malloc (strlen (desc) + 1); int buffer_pos = 0; load_args_from_env_or_default (config); diff --git a/mono/profiler/log.c.REMOVED.git-id b/mono/profiler/log.c.REMOVED.git-id index 0d7874a701..a225e37d47 100644 --- a/mono/profiler/log.c.REMOVED.git-id +++ b/mono/profiler/log.c.REMOVED.git-id @@ -1 +1 @@ -02087435568e05eadaa323842bd962c6ee0117a4 \ No newline at end of file +a248b0bc22b1bda3ccc785b7a9be156dc1ac3799 \ No newline at end of file diff --git a/mono/profiler/vtune.c b/mono/profiler/vtune.c index e372724393..82ae9d2109 100644 --- a/mono/profiler/vtune.c +++ b/mono/profiler/vtune.c @@ -84,7 +84,7 @@ method_jit_done (MonoProfiler *prof, MonoMethod *method, MonoJitInfo* jinfo) MonoClass *klass = mono_method_get_class (method); char *signature = mono_signature_get_desc (mono_method_signature (method), TRUE); char *name = g_strdup_printf ("%s(%s)", mono_method_get_name (method), signature); - char *classname = g_strdup_printf ("%s%s%s", mono_class_get_namespace (klass), mono_class_get_namespace (klass)[0] != 0 ? "::" : "", mono_class_get_name (klass)); + char *classname = g_strdup_printf ("%s%s%s", m_class_get_name_space (klass), m_class_get_name_space (klass)[0] != 0 ? "::" : "", m_class_get_name (klass)); gpointer code_start = mono_jit_info_get_code_start (jinfo); int code_size = mono_jit_info_get_code_size (jinfo); diff --git a/mono/sgen/Makefile.am b/mono/sgen/Makefile.am index f06b0608be..e52897a9ed 100644 --- a/mono/sgen/Makefile.am +++ b/mono/sgen/Makefile.am @@ -63,3 +63,5 @@ monosgen_sources = \ libmonosgen_la_SOURCES = $(monosgen_sources) libmonosgen_la_CFLAGS = $(SGEN_DEFINES) + +CFLAGS := $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @CXX_ADD_CFLAGS@ diff --git a/mono/sgen/Makefile.in b/mono/sgen/Makefile.in index eb6efe4c7e..63e0bf02a4 100644 --- a/mono/sgen/Makefile.in +++ b/mono/sgen/Makefile.in @@ -212,7 +212,7 @@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ +CFLAGS := $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @CXX_ADD_CFLAGS@ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ CMAKE = @CMAKE@ CPP = @CPP@ @@ -222,6 +222,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -237,6 +239,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -277,11 +280,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/sgen/sgen-cardtable.c b/mono/sgen/sgen-cardtable.c index 360ad4a9c4..bbd0dfd67b 100644 --- a/mono/sgen/sgen-cardtable.c +++ b/mono/sgen/sgen-cardtable.c @@ -474,6 +474,26 @@ sgen_get_card_table_configuration (int *shift_bits, gpointer *mask) #endif } +guint8* +sgen_get_target_card_table_configuration (int *shift_bits, gpointer *mask) +{ +#ifndef MANAGED_WBARRIER + return NULL; +#else + if (!sgen_cardtable) + return NULL; + + *shift_bits = CARD_BITS; +#ifdef SGEN_TARGET_HAVE_OVERLAPPING_CARDS + *mask = (gpointer)CARD_MASK; +#else + *mask = NULL; +#endif + + return sgen_cardtable; +#endif +} + #if 0 void sgen_card_table_dump_obj_card (GCObject *object, size_t size, void *dummy) diff --git a/mono/sgen/sgen-cardtable.h b/mono/sgen/sgen-cardtable.h index ad2e23a3ad..0ed55279b4 100644 --- a/mono/sgen/sgen-cardtable.h +++ b/mono/sgen/sgen-cardtable.h @@ -28,6 +28,7 @@ void sgen_card_table_update_mod_union (guint8 *dest, char *obj, mword obj_size, void sgen_card_table_preclean_mod_union (guint8 *cards, guint8 *cards_preclean, size_t num_cards); guint8* sgen_get_card_table_configuration (int *shift_bits, gpointer *mask); +guint8* sgen_get_target_card_table_configuration (int *shift_bits, gpointer *mask); void sgen_card_table_init (SgenRememberedSet *remset); @@ -48,6 +49,10 @@ void sgen_card_table_init (SgenRememberedSet *remset); #define SGEN_HAVE_OVERLAPPING_CARDS 1 #endif +#if TARGET_SIZEOF_VOID_P * 8 > CARD_TABLE_BITS +#define SGEN_TARGET_HAVE_OVERLAPPING_CARDS 1 +#endif + extern guint8 *sgen_cardtable; diff --git a/mono/sgen/sgen-conf.h b/mono/sgen/sgen-conf.h index 47173bc29c..a955a46ab5 100644 --- a/mono/sgen/sgen-conf.h +++ b/mono/sgen/sgen-conf.h @@ -22,7 +22,14 @@ typedef guint32 mword; typedef guint64 mword; #endif -typedef mword SgenDescriptor; +#if TARGET_SIZEOF_VOID_P == 4 +typedef guint32 target_mword; +#else +typedef guint64 target_mword; +#endif + +/* This neeeds to be target specific since its embedded in vtables */ +typedef target_mword SgenDescriptor; #define SGEN_DESCRIPTOR_NULL 0 /* @@ -168,6 +175,15 @@ typedef mword SgenDescriptor; #define SGEN_MAX_NURSERY_WASTE 512 +/* + * Max nursery size that we support. + * + * We depend on an array of longs to mark empty sections and we only support 4 byte indexes + */ +#if SIZEOF_VOID_P == 8 +#define SGEN_MAX_NURSERY_SIZE ((mword)1 << 35) +#endif + /* * Minimum allowance for nursery allocations, as a multiple of the size of nursery. * diff --git a/mono/sgen/sgen-gc.c.REMOVED.git-id b/mono/sgen/sgen-gc.c.REMOVED.git-id index 3edc2d689d..72c0632f30 100644 --- a/mono/sgen/sgen-gc.c.REMOVED.git-id +++ b/mono/sgen/sgen-gc.c.REMOVED.git-id @@ -1 +1 @@ -cd76d578a783e685388886cfaeccd896493e9457 \ No newline at end of file +2c5e5579c73c90847069c21016680e84c7e149f8 \ No newline at end of file diff --git a/mono/sgen/sgen-protocol-def.h b/mono/sgen/sgen-protocol-def.h index 7406ab2c5b..ecb12f857f 100644 --- a/mono/sgen/sgen-protocol-def.h +++ b/mono/sgen/sgen-protocol-def.h @@ -332,7 +332,7 @@ IS_VTABLE_MATCH (FALSE) END_PROTOCOL_ENTRY_HEAVY BEGIN_PROTOCOL_ENTRY_HEAVY3 (binary_protocol_dislink_update, TYPE_POINTER, link, TYPE_POINTER, obj, TYPE_BOOL, track) -CUSTOM_PRINT(entry->obj ? printf ("link 0x%"MWORD_FORMAT_SPEC_P" obj 0x%"MWORD_FORMAT_SPEC_P" track %d", entry->link, entry->obj, entry->track) : printf ("link 0x%"MWORD_FORMAT_SPEC_P" obj 0x%"MWORD_FORMAT_SPEC_P, entry->link, entry->obj)) +CUSTOM_PRINT(entry->obj ? printf ("link 0x%" MWORD_FORMAT_SPEC_P " obj 0x%" MWORD_FORMAT_SPEC_P " track %d", entry->link, entry->obj, entry->track) : printf ("link 0x%" MWORD_FORMAT_SPEC_P " obj 0x%" MWORD_FORMAT_SPEC_P, entry->link, entry->obj)) IS_ALWAYS_MATCH (FALSE) MATCH_INDEX (ptr == entry->link ? 0 : ptr == entry->obj ? 1 : BINARY_PROTOCOL_NO_MATCH) IS_VTABLE_MATCH (FALSE) diff --git a/mono/tests/Makefile.am.REMOVED.git-id b/mono/tests/Makefile.am.REMOVED.git-id index 1ce66cd68c..2ff9eafd61 100644 --- a/mono/tests/Makefile.am.REMOVED.git-id +++ b/mono/tests/Makefile.am.REMOVED.git-id @@ -1 +1 @@ -e865f2eae0c1c690cd99dbd3869081542bb71605 \ No newline at end of file +2af4f8fd531da459d7aace1036f49f39244be71a \ No newline at end of file diff --git a/mono/tests/Makefile.in.REMOVED.git-id b/mono/tests/Makefile.in.REMOVED.git-id index 7efab42dc4..3a3a89c982 100644 --- a/mono/tests/Makefile.in.REMOVED.git-id +++ b/mono/tests/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -6dd3eca708dad012afdca952dcd6fafcf6daedfc \ No newline at end of file +1cd5898751c8a28c29969382fc2f4417204cb83e \ No newline at end of file diff --git a/mono/tests/array-coop-1.cs b/mono/tests/array-coop-1.cs new file mode 100644 index 0000000000..c0d3476b74 --- /dev/null +++ b/mono/tests/array-coop-1.cs @@ -0,0 +1,31 @@ +/* +array-coop-*.cs + +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +This gets coverage of metadata/icall.c changes for coop conversion. +Some of these functions are inlined by the JIT, so reflection is used. + +Using delegates/ldftn might also be possible -- but we cannot form delegates +to internal non-public functions. + +As well, there is printf in the implementation to verify coverage. + +System.Array.GetValue (int index) => ves_icall_System_Array_GetValueImpl +int System.Rank => GetRank () => ves_icall_System_Array_GetRank +System.Array.Clear (array, index, length) => ves_icall_System_Array_ClearInternal +System.Array.SetGenericValueImpl => ves_icall_System_Array_SetGenericValueImpl +System.Array.GetGenericValueImpl => ves_icall_System_Array_GetGenericValueImpl + +See +https://docs.microsoft.com/en-us/dotnet/api/system.reflection.methodinfo.makegenericmethod?view=netframework-4.7.1. +https://msdn.microsoft.com/en-us/library/system.array.rank(v=vs.110).aspx +https://stackoverflow.com/questions/1067312/how-to-use-methodinfo-invoke-to-set-property-value +*/ + +using System; +using System.Reflection; diff --git a/mono/tests/array-coop-2.cs b/mono/tests/array-coop-2.cs new file mode 100644 index 0000000000..8e5442aa0b --- /dev/null +++ b/mono/tests/array-coop-2.cs @@ -0,0 +1,272 @@ + static bool slow_or_reflection = true; // FIXME test both + //static bool slow_or_reflection = false; // FIXME test both + + t [] array1 = new t [10]{ + newt (1), newt (2), newt (3), newt (4), newt (5), + newt (6), newt (7), newt (8), newt (9), newt (10) + }; + + t [,] array2 = new t [10, 3] { + {newt (10), newt (20), newt (30)}, + {newt (100), newt (200), newt (300)}, + {newt (1000), newt (2000), newt (3000)}, + {newt (10000), newt (20000), newt (30000)}, + {newt (100000), newt (200000), newt (300000)}, + {newt (11), newt (21), newt (31)}, + {newt (101), newt (201), newt (301)}, + {newt (1001), newt (2001), newt (3001)}, + {newt (10001), newt (20001), newt (30001)}, + {newt (100001), newt (200001), newt (300001)} + }; + + t [][] array3 = new t [10][] { + new t [1]{newt (2)}, new t [1]{newt (3)}, new t [1]{newt (4)}, new t [1]{newt (5)}, new t [1]{newt (6)}, + new t [1]{newt (7)}, new t [1]{newt (8)}, new t [1]{newt (9)}, new t [1]{newt (10)}, new t [1]{newt (11)} + }; + + static void assert (bool expr) + { + if (expr) + return; + System.Console.WriteLine ("failure"); + Environment.Exit (1); + } + + void test_clear () + { + int [] a = new int [100]; // This not System.Array.Clear. + + t [] array1 = new t [10] { + newt (1), newt (2), newt (3), newt (4), newt (5), + newt (6), newt (7), newt (8), newt (9), newt (10) + }; + var dt0 = newt (0); + + assert (array1 [0] != dt0); + assert (array1 [1] != dt0); + assert (array1 [2] != dt0); + assert (array1 [3] != dt0); + System.Array.Clear (array1, 0, 2); + assert (array1 [0] == dt0); + assert (array1 [1] == dt0); + assert (array1 [2] != dt0); + assert (array1 [3] != dt0); + System.Array.Clear (array1, 3, 1); + assert (array1 [0] == dt0); + assert (array1 [1] == dt0); + assert (array1 [2] != dt0); + assert (array1 [3] == dt0); + + t [][] array3 = new t [10][] { + new t [1]{newt (2)}, new t [1]{newt (3)}, new t [1]{newt (4)}, new t [1]{newt (5)}, new t [1]{newt (6)}, + new t [1]{newt (7)}, new t [1]{newt (8)}, new t [1]{newt (9)}, new t [1]{newt (10)}, new t [1]{newt (11)} + }; + + assert (array3 [0] != null); + assert (array3 [1] != null); + assert (array3 [2] != null); + assert (array3 [3] != null); + System.Array.Clear (array3, 1, 2); + assert (array3 [0] != null); + assert (array3 [1] == null); + assert (array3 [2] == null); + assert (array3 [3] != null); + } + + void test_get_value () + { + // Fast tests, should not print. + assert (array1 [0] != array1 [1]); + assert (array1 [2] != array1 [3]); + + if (!slow_or_reflection) + return; + + // While these are not reflecton, this is still presumed + // ok to be slow. + assert ((t)array1.GetValue (0) == array1 [0]); + assert ((t)array1.GetValue (3) == array1 [3]); + + Type type = typeof (System.Array); + MethodInfo mi = type.GetMethod ("GetValue", new Type [] { typeof(int) } ); + assert (mi != null); + assert ((t)mi.Invoke (array1, new object [ ] { 0 }) == array1 [0]); + assert ((t)mi.Invoke (array1, new object [ ] { 3 }) == array1 [3]); + } + + void test_get_rank () + { + // Fast tests, should not print. + assert (array1.Rank != array2.Rank); + assert (array2.Rank != array3.Rank); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("Rank"); + assert ((int)pi.GetValue (array1) == array1.Rank); + assert ((int)pi.GetValue (array2) == array2.Rank); + assert ((int)pi.GetValue (array3) == array3.Rank); + assert ((int)pi.GetValue (array3 [0]) == array3 [0].Rank); + } + + void test_get_length () + { + // Fast tests, should not print. + assert (array1.Length != array2.Length); + assert (array2.Length != array3.Length); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("Length"); + assert ((int)pi.GetValue (array1) == array1.Length); + assert ((int)pi.GetValue (array2) == array2.Length); + assert ((int)pi.GetValue (array3) == array3.Length); + } + + void test_get_longlength () + { + // Fast tests, should not print. + assert (array1.LongLength != array2.LongLength); + assert (array2.LongLength != array3.LongLength); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("LongLength"); + assert ((long)pi.GetValue (array1) == array1.LongLength); + assert ((long)pi.GetValue (array2) == array2.LongLength); + assert ((long)pi.GetValue (array3) == array3.LongLength); + } + + void test_get_lower_bound_and_get_value_with_bounds () + { + // This test also goes overboard in testing slow paths. + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1"); + + var lengths = new int [ ] {1, 2, 3, 4}; + var lower_bounds = new int [ ] {3, 2, 1, 0}; + var a = (t[,,,])System.Array.CreateInstance (typeof (t), lengths, lower_bounds); + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.1"); + a [3, 2, 1, 0] = newt (-1); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.2"); + a [3, 3, 2, 1] = newt (-2); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.3"); + + MethodInfo mi = null; + if (slow_or_reflection) { + Type type = typeof (System.Array); + mi = type.GetMethod ("GetLowerBound", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mi != null); + } + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds2"); + + for (int b = 0; b < 3; ++b) + { + assert (a.GetLowerBound (b) == lower_bounds [b]); + if (slow_or_reflection) + assert ((int)mi.Invoke (a, new object [ ] { b }) == lower_bounds [b]); + } + + var a2 = new t [1]; + assert (a2 .GetLowerBound (0) == 0); + assert (array1.GetLowerBound (0) == 0); + assert (array2.GetLowerBound (0) == 0); + assert (array3.GetLowerBound (0) == 0); + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds3"); + + if (slow_or_reflection) { + assert ((int)mi.Invoke (a2, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array1, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array2, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array3, new object [ ] { 0 }) == 0); + } + assert ((t)a.GetValue (new int [ ] {3, 2, 1, 0}) == newt (-1)); + assert ((t)a.GetValue (new int [ ] {3, 3, 2, 1}) == newt (-2)); + } + + void test_get_generic_value () + { + return; // fails for FullAOT, or even with AOT runtime, but not with full JIT that CI does not run + + if (!slow_or_reflection) + return; + + Type type = typeof (System.Array); + MethodInfo mig = type.GetMethod ("GetGenericValueImpl", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mig != null); + MethodInfo mi = mig.MakeGenericMethod (typeof (t)); + assert (mi != null); + + var args = new object [2]; + for (int i = 0; i < array1.Length; ++i) { + args [0] = i; + args [1] = null; + mi.Invoke (array1, args); + assert (array1 [i] == (t)args [1]); + } + } + + void test_set_generic_value () + { + if (!slow_or_reflection) + return; + + t [] array2 = new t [10]; + + for (int i = 0; i < array1.Length; ++i) + assert (array1 [i] != array2 [i]); + + Type type = typeof (System.Array); + MethodInfo mig = type.GetMethod ("SetGenericValueImpl", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mig != null); + MethodInfo mi = mig.MakeGenericMethod (typeof (t)); + assert (mi != null); + + var args = new object [2]; + for (int i = 0; i < array1.Length; ++i) { + args [0] = i; + args [1] = newt (i + 1); + mi.Invoke (array2, args); + } + + for (int i = 0; i < array1.Length; ++i) + assert (array1 [i] == array2 [i]); + } + + void main () + { + Console.WriteLine ("test_set_generic_value"); + try { + test_set_generic_value (); + } + catch (System.Reflection.TargetInvocationException) // for FullAOT + { + Console.WriteLine ("test_set_generic_value raise exception"); + } + Console.WriteLine ("test_get_generic_value"); + test_get_generic_value (); + Console.WriteLine ("test_clear"); + test_clear (); + Console.WriteLine ("test_get_value"); + test_get_value (); + Console.WriteLine ("test_get_rank"); + test_get_rank (); + Console.WriteLine ("test_get_length"); + test_get_length (); + Console.WriteLine ("test_get_longlength"); + test_get_longlength (); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds"); + test_get_lower_bound_and_get_value_with_bounds (); + } + + public static void Main (string[] args) + { + new test ().main (); + } +} diff --git a/mono/tests/array-coop-bigvt.cs b/mono/tests/array-coop-bigvt.cs new file mode 100644 index 0000000000..3f0ec120a3 --- /dev/null +++ b/mono/tests/array-coop-bigvt.cs @@ -0,0 +1,324 @@ +/* +array-coop-*.cs + +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +This gets coverage of metadata/icall.c changes for coop conversion. +Some of these functions are inlined by the JIT, so reflection is used. + +Using delegates/ldftn might also be possible -- but we cannot form delegates +to internal non-public functions. + +As well, there is printf in the implementation to verify coverage. + +System.Array.GetValue (int index) => ves_icall_System_Array_GetValueImpl +int System.Rank => GetRank () => ves_icall_System_Array_GetRank +System.Array.Clear (array, index, length) => ves_icall_System_Array_ClearInternal +System.Array.SetGenericValueImpl => ves_icall_System_Array_SetGenericValueImpl +System.Array.GetGenericValueImpl => ves_icall_System_Array_GetGenericValueImpl + +See +https://docs.microsoft.com/en-us/dotnet/api/system.reflection.methodinfo.makegenericmethod?view=netframework-4.7.1. +https://msdn.microsoft.com/en-us/library/system.array.rank(v=vs.110).aspx +https://stackoverflow.com/questions/1067312/how-to-use-methodinfo-invoke-to-set-property-value +*/ + +using System; +using System.Reflection; + +struct t +{ + public t (int aa) + { + a = b = c = d = e = f = g = h = i = j = k = l = m = n = o = p = q = r = s = u = v = w = x = y = z = aa; + } + + public static bool operator == (t a, t b) { return a.i == b.i; } + public static bool operator != (t a, t b) { return a.i != b.i; } + override public bool Equals (object a) { return i == ((t)a).i; } + override public int GetHashCode () { return (int)i; } + + long a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, u, v, w, x, y, z; +} + +class test +{ + // FIXME? Can this line be the same for valuetypes and int? + static t newt (int aa) { return new t (aa); } + + static bool slow_or_reflection = true; // FIXME test both + //static bool slow_or_reflection = false; // FIXME test both + + t [] array1 = new t [10]{ + newt (1), newt (2), newt (3), newt (4), newt (5), + newt (6), newt (7), newt (8), newt (9), newt (10) + }; + + t [,] array2 = new t [10, 3] { + {newt (10), newt (20), newt (30)}, + {newt (100), newt (200), newt (300)}, + {newt (1000), newt (2000), newt (3000)}, + {newt (10000), newt (20000), newt (30000)}, + {newt (100000), newt (200000), newt (300000)}, + {newt (11), newt (21), newt (31)}, + {newt (101), newt (201), newt (301)}, + {newt (1001), newt (2001), newt (3001)}, + {newt (10001), newt (20001), newt (30001)}, + {newt (100001), newt (200001), newt (300001)} + }; + + t [][] array3 = new t [10][] { + new t [1]{newt (2)}, new t [1]{newt (3)}, new t [1]{newt (4)}, new t [1]{newt (5)}, new t [1]{newt (6)}, + new t [1]{newt (7)}, new t [1]{newt (8)}, new t [1]{newt (9)}, new t [1]{newt (10)}, new t [1]{newt (11)} + }; + + static void assert (bool expr) + { + if (expr) + return; + System.Console.WriteLine ("failure"); + Environment.Exit (1); + } + + void test_clear () + { + int [] a = new int [100]; // This not System.Array.Clear. + + t [] array1 = new t [10] { + newt (1), newt (2), newt (3), newt (4), newt (5), + newt (6), newt (7), newt (8), newt (9), newt (10) + }; + var dt0 = newt (0); + + assert (array1 [0] != dt0); + assert (array1 [1] != dt0); + assert (array1 [2] != dt0); + assert (array1 [3] != dt0); + System.Array.Clear (array1, 0, 2); + assert (array1 [0] == dt0); + assert (array1 [1] == dt0); + assert (array1 [2] != dt0); + assert (array1 [3] != dt0); + System.Array.Clear (array1, 3, 1); + assert (array1 [0] == dt0); + assert (array1 [1] == dt0); + assert (array1 [2] != dt0); + assert (array1 [3] == dt0); + + t [][] array3 = new t [10][] { + new t [1]{newt (2)}, new t [1]{newt (3)}, new t [1]{newt (4)}, new t [1]{newt (5)}, new t [1]{newt (6)}, + new t [1]{newt (7)}, new t [1]{newt (8)}, new t [1]{newt (9)}, new t [1]{newt (10)}, new t [1]{newt (11)} + }; + + assert (array3 [0] != null); + assert (array3 [1] != null); + assert (array3 [2] != null); + assert (array3 [3] != null); + System.Array.Clear (array3, 1, 2); + assert (array3 [0] != null); + assert (array3 [1] == null); + assert (array3 [2] == null); + assert (array3 [3] != null); + } + + void test_get_value () + { + // Fast tests, should not print. + assert (array1 [0] != array1 [1]); + assert (array1 [2] != array1 [3]); + + if (!slow_or_reflection) + return; + + // While these are not reflecton, this is still presumed + // ok to be slow. + assert ((t)array1.GetValue (0) == array1 [0]); + assert ((t)array1.GetValue (3) == array1 [3]); + + Type type = typeof (System.Array); + MethodInfo mi = type.GetMethod ("GetValue", new Type [] { typeof(int) } ); + assert (mi != null); + assert ((t)mi.Invoke (array1, new object [ ] { 0 }) == array1 [0]); + assert ((t)mi.Invoke (array1, new object [ ] { 3 }) == array1 [3]); + } + + void test_get_rank () + { + // Fast tests, should not print. + assert (array1.Rank != array2.Rank); + assert (array2.Rank != array3.Rank); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("Rank"); + assert ((int)pi.GetValue (array1) == array1.Rank); + assert ((int)pi.GetValue (array2) == array2.Rank); + assert ((int)pi.GetValue (array3) == array3.Rank); + assert ((int)pi.GetValue (array3 [0]) == array3 [0].Rank); + } + + void test_get_length () + { + // Fast tests, should not print. + assert (array1.Length != array2.Length); + assert (array2.Length != array3.Length); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("Length"); + assert ((int)pi.GetValue (array1) == array1.Length); + assert ((int)pi.GetValue (array2) == array2.Length); + assert ((int)pi.GetValue (array3) == array3.Length); + } + + void test_get_longlength () + { + // Fast tests, should not print. + assert (array1.LongLength != array2.LongLength); + assert (array2.LongLength != array3.LongLength); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("LongLength"); + assert ((long)pi.GetValue (array1) == array1.LongLength); + assert ((long)pi.GetValue (array2) == array2.LongLength); + assert ((long)pi.GetValue (array3) == array3.LongLength); + } + + void test_get_lower_bound_and_get_value_with_bounds () + { + // This test also goes overboard in testing slow paths. + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1"); + + var lengths = new int [ ] {1, 2, 3, 4}; + var lower_bounds = new int [ ] {3, 2, 1, 0}; + var a = (t[,,,])System.Array.CreateInstance (typeof (t), lengths, lower_bounds); + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.1"); + a [3, 2, 1, 0] = newt (-1); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.2"); + a [3, 3, 2, 1] = newt (-2); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.3"); + + MethodInfo mi = null; + if (slow_or_reflection) { + Type type = typeof (System.Array); + mi = type.GetMethod ("GetLowerBound", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mi != null); + } + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds2"); + + for (int b = 0; b < 3; ++b) + { + assert (a.GetLowerBound (b) == lower_bounds [b]); + if (slow_or_reflection) + assert ((int)mi.Invoke (a, new object [ ] { b }) == lower_bounds [b]); + } + + var a2 = new t [1]; + assert (a2 .GetLowerBound (0) == 0); + assert (array1.GetLowerBound (0) == 0); + assert (array2.GetLowerBound (0) == 0); + assert (array3.GetLowerBound (0) == 0); + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds3"); + + if (slow_or_reflection) { + assert ((int)mi.Invoke (a2, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array1, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array2, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array3, new object [ ] { 0 }) == 0); + } + assert ((t)a.GetValue (new int [ ] {3, 2, 1, 0}) == newt (-1)); + assert ((t)a.GetValue (new int [ ] {3, 3, 2, 1}) == newt (-2)); + } + + void test_get_generic_value () + { + return; // fails for FullAOT, or even with AOT runtime, but not with full JIT that CI does not run + + if (!slow_or_reflection) + return; + + Type type = typeof (System.Array); + MethodInfo mig = type.GetMethod ("GetGenericValueImpl", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mig != null); + MethodInfo mi = mig.MakeGenericMethod (typeof (t)); + assert (mi != null); + + var args = new object [2]; + for (int i = 0; i < array1.Length; ++i) { + args [0] = i; + args [1] = null; + mi.Invoke (array1, args); + assert (array1 [i] == (t)args [1]); + } + } + + void test_set_generic_value () + { + if (!slow_or_reflection) + return; + + t [] array2 = new t [10]; + + for (int i = 0; i < array1.Length; ++i) + assert (array1 [i] != array2 [i]); + + Type type = typeof (System.Array); + MethodInfo mig = type.GetMethod ("SetGenericValueImpl", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mig != null); + MethodInfo mi = mig.MakeGenericMethod (typeof (t)); + assert (mi != null); + + var args = new object [2]; + for (int i = 0; i < array1.Length; ++i) { + args [0] = i; + args [1] = newt (i + 1); + mi.Invoke (array2, args); + } + + for (int i = 0; i < array1.Length; ++i) + assert (array1 [i] == array2 [i]); + } + + void main () + { + Console.WriteLine ("test_set_generic_value"); + try { + test_set_generic_value (); + } + catch (System.Reflection.TargetInvocationException) // for FullAOT + { + Console.WriteLine ("test_set_generic_value raise exception"); + } + Console.WriteLine ("test_get_generic_value"); + test_get_generic_value (); + Console.WriteLine ("test_clear"); + test_clear (); + Console.WriteLine ("test_get_value"); + test_get_value (); + Console.WriteLine ("test_get_rank"); + test_get_rank (); + Console.WriteLine ("test_get_length"); + test_get_length (); + Console.WriteLine ("test_get_longlength"); + test_get_longlength (); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds"); + test_get_lower_bound_and_get_value_with_bounds (); + } + + public static void Main (string[] args) + { + new test ().main (); + } +} diff --git a/mono/tests/array-coop-bigvt.sh b/mono/tests/array-coop-bigvt.sh new file mode 100755 index 0000000000..1ac291f7f0 --- /dev/null +++ b/mono/tests/array-coop-bigvt.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +cat "$1/array-coop-1.cs" + +cat < ves_icall_System_Array_GetValueImpl +int System.Rank => GetRank () => ves_icall_System_Array_GetRank +System.Array.Clear (array, index, length) => ves_icall_System_Array_ClearInternal +System.Array.SetGenericValueImpl => ves_icall_System_Array_SetGenericValueImpl +System.Array.GetGenericValueImpl => ves_icall_System_Array_GetGenericValueImpl + +See +https://docs.microsoft.com/en-us/dotnet/api/system.reflection.methodinfo.makegenericmethod?view=netframework-4.7.1. +https://msdn.microsoft.com/en-us/library/system.array.rank(v=vs.110).aspx +https://stackoverflow.com/questions/1067312/how-to-use-methodinfo-invoke-to-set-property-value +*/ + +using System; +using System.Reflection; +using t = System.Int32; + +class test +{ + // FIXME? Can this line be the same for valuetypes and int? + static t newt (int aa) { return aa; } + + static bool slow_or_reflection = true; // FIXME test both + //static bool slow_or_reflection = false; // FIXME test both + + t [] array1 = new t [10]{ + newt (1), newt (2), newt (3), newt (4), newt (5), + newt (6), newt (7), newt (8), newt (9), newt (10) + }; + + t [,] array2 = new t [10, 3] { + {newt (10), newt (20), newt (30)}, + {newt (100), newt (200), newt (300)}, + {newt (1000), newt (2000), newt (3000)}, + {newt (10000), newt (20000), newt (30000)}, + {newt (100000), newt (200000), newt (300000)}, + {newt (11), newt (21), newt (31)}, + {newt (101), newt (201), newt (301)}, + {newt (1001), newt (2001), newt (3001)}, + {newt (10001), newt (20001), newt (30001)}, + {newt (100001), newt (200001), newt (300001)} + }; + + t [][] array3 = new t [10][] { + new t [1]{newt (2)}, new t [1]{newt (3)}, new t [1]{newt (4)}, new t [1]{newt (5)}, new t [1]{newt (6)}, + new t [1]{newt (7)}, new t [1]{newt (8)}, new t [1]{newt (9)}, new t [1]{newt (10)}, new t [1]{newt (11)} + }; + + static void assert (bool expr) + { + if (expr) + return; + System.Console.WriteLine ("failure"); + Environment.Exit (1); + } + + void test_clear () + { + int [] a = new int [100]; // This not System.Array.Clear. + + t [] array1 = new t [10] { + newt (1), newt (2), newt (3), newt (4), newt (5), + newt (6), newt (7), newt (8), newt (9), newt (10) + }; + var dt0 = newt (0); + + assert (array1 [0] != dt0); + assert (array1 [1] != dt0); + assert (array1 [2] != dt0); + assert (array1 [3] != dt0); + System.Array.Clear (array1, 0, 2); + assert (array1 [0] == dt0); + assert (array1 [1] == dt0); + assert (array1 [2] != dt0); + assert (array1 [3] != dt0); + System.Array.Clear (array1, 3, 1); + assert (array1 [0] == dt0); + assert (array1 [1] == dt0); + assert (array1 [2] != dt0); + assert (array1 [3] == dt0); + + t [][] array3 = new t [10][] { + new t [1]{newt (2)}, new t [1]{newt (3)}, new t [1]{newt (4)}, new t [1]{newt (5)}, new t [1]{newt (6)}, + new t [1]{newt (7)}, new t [1]{newt (8)}, new t [1]{newt (9)}, new t [1]{newt (10)}, new t [1]{newt (11)} + }; + + assert (array3 [0] != null); + assert (array3 [1] != null); + assert (array3 [2] != null); + assert (array3 [3] != null); + System.Array.Clear (array3, 1, 2); + assert (array3 [0] != null); + assert (array3 [1] == null); + assert (array3 [2] == null); + assert (array3 [3] != null); + } + + void test_get_value () + { + // Fast tests, should not print. + assert (array1 [0] != array1 [1]); + assert (array1 [2] != array1 [3]); + + if (!slow_or_reflection) + return; + + // While these are not reflecton, this is still presumed + // ok to be slow. + assert ((t)array1.GetValue (0) == array1 [0]); + assert ((t)array1.GetValue (3) == array1 [3]); + + Type type = typeof (System.Array); + MethodInfo mi = type.GetMethod ("GetValue", new Type [] { typeof(int) } ); + assert (mi != null); + assert ((t)mi.Invoke (array1, new object [ ] { 0 }) == array1 [0]); + assert ((t)mi.Invoke (array1, new object [ ] { 3 }) == array1 [3]); + } + + void test_get_rank () + { + // Fast tests, should not print. + assert (array1.Rank != array2.Rank); + assert (array2.Rank != array3.Rank); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("Rank"); + assert ((int)pi.GetValue (array1) == array1.Rank); + assert ((int)pi.GetValue (array2) == array2.Rank); + assert ((int)pi.GetValue (array3) == array3.Rank); + assert ((int)pi.GetValue (array3 [0]) == array3 [0].Rank); + } + + void test_get_length () + { + // Fast tests, should not print. + assert (array1.Length != array2.Length); + assert (array2.Length != array3.Length); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("Length"); + assert ((int)pi.GetValue (array1) == array1.Length); + assert ((int)pi.GetValue (array2) == array2.Length); + assert ((int)pi.GetValue (array3) == array3.Length); + } + + void test_get_longlength () + { + // Fast tests, should not print. + assert (array1.LongLength != array2.LongLength); + assert (array2.LongLength != array3.LongLength); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("LongLength"); + assert ((long)pi.GetValue (array1) == array1.LongLength); + assert ((long)pi.GetValue (array2) == array2.LongLength); + assert ((long)pi.GetValue (array3) == array3.LongLength); + } + + void test_get_lower_bound_and_get_value_with_bounds () + { + // This test also goes overboard in testing slow paths. + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1"); + + var lengths = new int [ ] {1, 2, 3, 4}; + var lower_bounds = new int [ ] {3, 2, 1, 0}; + var a = (t[,,,])System.Array.CreateInstance (typeof (t), lengths, lower_bounds); + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.1"); + a [3, 2, 1, 0] = newt (-1); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.2"); + a [3, 3, 2, 1] = newt (-2); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.3"); + + MethodInfo mi = null; + if (slow_or_reflection) { + Type type = typeof (System.Array); + mi = type.GetMethod ("GetLowerBound", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mi != null); + } + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds2"); + + for (int b = 0; b < 3; ++b) + { + assert (a.GetLowerBound (b) == lower_bounds [b]); + if (slow_or_reflection) + assert ((int)mi.Invoke (a, new object [ ] { b }) == lower_bounds [b]); + } + + var a2 = new t [1]; + assert (a2 .GetLowerBound (0) == 0); + assert (array1.GetLowerBound (0) == 0); + assert (array2.GetLowerBound (0) == 0); + assert (array3.GetLowerBound (0) == 0); + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds3"); + + if (slow_or_reflection) { + assert ((int)mi.Invoke (a2, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array1, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array2, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array3, new object [ ] { 0 }) == 0); + } + assert ((t)a.GetValue (new int [ ] {3, 2, 1, 0}) == newt (-1)); + assert ((t)a.GetValue (new int [ ] {3, 3, 2, 1}) == newt (-2)); + } + + void test_get_generic_value () + { + return; // fails for FullAOT, or even with AOT runtime, but not with full JIT that CI does not run + + if (!slow_or_reflection) + return; + + Type type = typeof (System.Array); + MethodInfo mig = type.GetMethod ("GetGenericValueImpl", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mig != null); + MethodInfo mi = mig.MakeGenericMethod (typeof (t)); + assert (mi != null); + + var args = new object [2]; + for (int i = 0; i < array1.Length; ++i) { + args [0] = i; + args [1] = null; + mi.Invoke (array1, args); + assert (array1 [i] == (t)args [1]); + } + } + + void test_set_generic_value () + { + if (!slow_or_reflection) + return; + + t [] array2 = new t [10]; + + for (int i = 0; i < array1.Length; ++i) + assert (array1 [i] != array2 [i]); + + Type type = typeof (System.Array); + MethodInfo mig = type.GetMethod ("SetGenericValueImpl", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mig != null); + MethodInfo mi = mig.MakeGenericMethod (typeof (t)); + assert (mi != null); + + var args = new object [2]; + for (int i = 0; i < array1.Length; ++i) { + args [0] = i; + args [1] = newt (i + 1); + mi.Invoke (array2, args); + } + + for (int i = 0; i < array1.Length; ++i) + assert (array1 [i] == array2 [i]); + } + + void main () + { + Console.WriteLine ("test_set_generic_value"); + try { + test_set_generic_value (); + } + catch (System.Reflection.TargetInvocationException) // for FullAOT + { + Console.WriteLine ("test_set_generic_value raise exception"); + } + Console.WriteLine ("test_get_generic_value"); + test_get_generic_value (); + Console.WriteLine ("test_clear"); + test_clear (); + Console.WriteLine ("test_get_value"); + test_get_value (); + Console.WriteLine ("test_get_rank"); + test_get_rank (); + Console.WriteLine ("test_get_length"); + test_get_length (); + Console.WriteLine ("test_get_longlength"); + test_get_longlength (); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds"); + test_get_lower_bound_and_get_value_with_bounds (); + } + + public static void Main (string[] args) + { + new test ().main (); + } +} diff --git a/mono/tests/array-coop-int.sh b/mono/tests/array-coop-int.sh new file mode 100755 index 0000000000..e82f5932a1 --- /dev/null +++ b/mono/tests/array-coop-int.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +cat "$1/array-coop-1.cs" + +cat < ves_icall_System_Array_GetValueImpl +int System.Rank => GetRank () => ves_icall_System_Array_GetRank +System.Array.Clear (array, index, length) => ves_icall_System_Array_ClearInternal +System.Array.SetGenericValueImpl => ves_icall_System_Array_SetGenericValueImpl +System.Array.GetGenericValueImpl => ves_icall_System_Array_GetGenericValueImpl + +See +https://docs.microsoft.com/en-us/dotnet/api/system.reflection.methodinfo.makegenericmethod?view=netframework-4.7.1. +https://msdn.microsoft.com/en-us/library/system.array.rank(v=vs.110).aspx +https://stackoverflow.com/questions/1067312/how-to-use-methodinfo-invoke-to-set-property-value +*/ + +using System; +using System.Reflection; +struct t +{ + public t (int aa) + { + i = aa; + } + public static bool operator == (t a, t b) { return a.i == b.i; } + public static bool operator != (t a, t b) { return a.i != b.i; } + override public bool Equals (object a) { return i == ((t)a).i; } + override public int GetHashCode () { return (int)i; } + + int i; +} + +class test +{ + // FIXME? Can this line be the same for valuetypes and int? + static t newt (int aa) { return new t (aa); } + + static bool slow_or_reflection = true; // FIXME test both + //static bool slow_or_reflection = false; // FIXME test both + + t [] array1 = new t [10]{ + newt (1), newt (2), newt (3), newt (4), newt (5), + newt (6), newt (7), newt (8), newt (9), newt (10) + }; + + t [,] array2 = new t [10, 3] { + {newt (10), newt (20), newt (30)}, + {newt (100), newt (200), newt (300)}, + {newt (1000), newt (2000), newt (3000)}, + {newt (10000), newt (20000), newt (30000)}, + {newt (100000), newt (200000), newt (300000)}, + {newt (11), newt (21), newt (31)}, + {newt (101), newt (201), newt (301)}, + {newt (1001), newt (2001), newt (3001)}, + {newt (10001), newt (20001), newt (30001)}, + {newt (100001), newt (200001), newt (300001)} + }; + + t [][] array3 = new t [10][] { + new t [1]{newt (2)}, new t [1]{newt (3)}, new t [1]{newt (4)}, new t [1]{newt (5)}, new t [1]{newt (6)}, + new t [1]{newt (7)}, new t [1]{newt (8)}, new t [1]{newt (9)}, new t [1]{newt (10)}, new t [1]{newt (11)} + }; + + static void assert (bool expr) + { + if (expr) + return; + System.Console.WriteLine ("failure"); + Environment.Exit (1); + } + + void test_clear () + { + int [] a = new int [100]; // This not System.Array.Clear. + + t [] array1 = new t [10] { + newt (1), newt (2), newt (3), newt (4), newt (5), + newt (6), newt (7), newt (8), newt (9), newt (10) + }; + var dt0 = newt (0); + + assert (array1 [0] != dt0); + assert (array1 [1] != dt0); + assert (array1 [2] != dt0); + assert (array1 [3] != dt0); + System.Array.Clear (array1, 0, 2); + assert (array1 [0] == dt0); + assert (array1 [1] == dt0); + assert (array1 [2] != dt0); + assert (array1 [3] != dt0); + System.Array.Clear (array1, 3, 1); + assert (array1 [0] == dt0); + assert (array1 [1] == dt0); + assert (array1 [2] != dt0); + assert (array1 [3] == dt0); + + t [][] array3 = new t [10][] { + new t [1]{newt (2)}, new t [1]{newt (3)}, new t [1]{newt (4)}, new t [1]{newt (5)}, new t [1]{newt (6)}, + new t [1]{newt (7)}, new t [1]{newt (8)}, new t [1]{newt (9)}, new t [1]{newt (10)}, new t [1]{newt (11)} + }; + + assert (array3 [0] != null); + assert (array3 [1] != null); + assert (array3 [2] != null); + assert (array3 [3] != null); + System.Array.Clear (array3, 1, 2); + assert (array3 [0] != null); + assert (array3 [1] == null); + assert (array3 [2] == null); + assert (array3 [3] != null); + } + + void test_get_value () + { + // Fast tests, should not print. + assert (array1 [0] != array1 [1]); + assert (array1 [2] != array1 [3]); + + if (!slow_or_reflection) + return; + + // While these are not reflecton, this is still presumed + // ok to be slow. + assert ((t)array1.GetValue (0) == array1 [0]); + assert ((t)array1.GetValue (3) == array1 [3]); + + Type type = typeof (System.Array); + MethodInfo mi = type.GetMethod ("GetValue", new Type [] { typeof(int) } ); + assert (mi != null); + assert ((t)mi.Invoke (array1, new object [ ] { 0 }) == array1 [0]); + assert ((t)mi.Invoke (array1, new object [ ] { 3 }) == array1 [3]); + } + + void test_get_rank () + { + // Fast tests, should not print. + assert (array1.Rank != array2.Rank); + assert (array2.Rank != array3.Rank); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("Rank"); + assert ((int)pi.GetValue (array1) == array1.Rank); + assert ((int)pi.GetValue (array2) == array2.Rank); + assert ((int)pi.GetValue (array3) == array3.Rank); + assert ((int)pi.GetValue (array3 [0]) == array3 [0].Rank); + } + + void test_get_length () + { + // Fast tests, should not print. + assert (array1.Length != array2.Length); + assert (array2.Length != array3.Length); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("Length"); + assert ((int)pi.GetValue (array1) == array1.Length); + assert ((int)pi.GetValue (array2) == array2.Length); + assert ((int)pi.GetValue (array3) == array3.Length); + } + + void test_get_longlength () + { + // Fast tests, should not print. + assert (array1.LongLength != array2.LongLength); + assert (array2.LongLength != array3.LongLength); + + if (!slow_or_reflection) + return; + Type type = typeof (System.Array); + PropertyInfo pi = type.GetProperty ("LongLength"); + assert ((long)pi.GetValue (array1) == array1.LongLength); + assert ((long)pi.GetValue (array2) == array2.LongLength); + assert ((long)pi.GetValue (array3) == array3.LongLength); + } + + void test_get_lower_bound_and_get_value_with_bounds () + { + // This test also goes overboard in testing slow paths. + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1"); + + var lengths = new int [ ] {1, 2, 3, 4}; + var lower_bounds = new int [ ] {3, 2, 1, 0}; + var a = (t[,,,])System.Array.CreateInstance (typeof (t), lengths, lower_bounds); + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.1"); + a [3, 2, 1, 0] = newt (-1); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.2"); + a [3, 3, 2, 1] = newt (-2); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds1.3"); + + MethodInfo mi = null; + if (slow_or_reflection) { + Type type = typeof (System.Array); + mi = type.GetMethod ("GetLowerBound", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mi != null); + } + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds2"); + + for (int b = 0; b < 3; ++b) + { + assert (a.GetLowerBound (b) == lower_bounds [b]); + if (slow_or_reflection) + assert ((int)mi.Invoke (a, new object [ ] { b }) == lower_bounds [b]); + } + + var a2 = new t [1]; + assert (a2 .GetLowerBound (0) == 0); + assert (array1.GetLowerBound (0) == 0); + assert (array2.GetLowerBound (0) == 0); + assert (array3.GetLowerBound (0) == 0); + + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds3"); + + if (slow_or_reflection) { + assert ((int)mi.Invoke (a2, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array1, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array2, new object [ ] { 0 }) == 0); + assert ((int)mi.Invoke (array3, new object [ ] { 0 }) == 0); + } + assert ((t)a.GetValue (new int [ ] {3, 2, 1, 0}) == newt (-1)); + assert ((t)a.GetValue (new int [ ] {3, 3, 2, 1}) == newt (-2)); + } + + void test_get_generic_value () + { + return; // fails for FullAOT, or even with AOT runtime, but not with full JIT that CI does not run + + if (!slow_or_reflection) + return; + + Type type = typeof (System.Array); + MethodInfo mig = type.GetMethod ("GetGenericValueImpl", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mig != null); + MethodInfo mi = mig.MakeGenericMethod (typeof (t)); + assert (mi != null); + + var args = new object [2]; + for (int i = 0; i < array1.Length; ++i) { + args [0] = i; + args [1] = null; + mi.Invoke (array1, args); + assert (array1 [i] == (t)args [1]); + } + } + + void test_set_generic_value () + { + if (!slow_or_reflection) + return; + + t [] array2 = new t [10]; + + for (int i = 0; i < array1.Length; ++i) + assert (array1 [i] != array2 [i]); + + Type type = typeof (System.Array); + MethodInfo mig = type.GetMethod ("SetGenericValueImpl", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + assert (mig != null); + MethodInfo mi = mig.MakeGenericMethod (typeof (t)); + assert (mi != null); + + var args = new object [2]; + for (int i = 0; i < array1.Length; ++i) { + args [0] = i; + args [1] = newt (i + 1); + mi.Invoke (array2, args); + } + + for (int i = 0; i < array1.Length; ++i) + assert (array1 [i] == array2 [i]); + } + + void main () + { + Console.WriteLine ("test_set_generic_value"); + try { + test_set_generic_value (); + } + catch (System.Reflection.TargetInvocationException) // for FullAOT + { + Console.WriteLine ("test_set_generic_value raise exception"); + } + Console.WriteLine ("test_get_generic_value"); + test_get_generic_value (); + Console.WriteLine ("test_clear"); + test_clear (); + Console.WriteLine ("test_get_value"); + test_get_value (); + Console.WriteLine ("test_get_rank"); + test_get_rank (); + Console.WriteLine ("test_get_length"); + test_get_length (); + Console.WriteLine ("test_get_longlength"); + test_get_longlength (); + Console.WriteLine ("test_get_lower_bound_and_get_value_with_bounds"); + test_get_lower_bound_and_get_value_with_bounds (); + } + + public static void Main (string[] args) + { + new test ().main (); + } +} diff --git a/mono/tests/array-coop-smallvt.sh b/mono/tests/array-coop-smallvt.sh new file mode 100755 index 0000000000..730cc8e67b --- /dev/null +++ b/mono/tests/array-coop-smallvt.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +cat "$1/array-coop-1.cs" + +cat <.GetPtr(); + } +} + +unsafe class Generic where T : unmanaged +{ + public static T* GetPtr() + { + return (T*)null; + } +} diff --git a/mono/tests/install_eh_callback.cs b/mono/tests/install_eh_callback.cs index 26fd88dea8..95fcf43ce9 100644 --- a/mono/tests/install_eh_callback.cs +++ b/mono/tests/install_eh_callback.cs @@ -10,8 +10,15 @@ public class Tests { [DllImport ("libtest")] public static extern void mono_test_setjmp_and_call (VoidVoidDelegate del, out IntPtr handle); + + [DllImport ("libtest")] + public static extern void mono_test_setup_ftnptr_eh_callback (VoidVoidDelegate del, VoidHandleHandleOutDelegate inside_eh_callback); + + [DllImport ("libtest")] + public static extern void mono_test_cleanup_ftptr_eh_callback (); public delegate void VoidVoidDelegate (); + public delegate void VoidHandleHandleOutDelegate (uint handle, out int exception_handle); public class SpecialExn : Exception { } @@ -35,7 +42,7 @@ public class Tests { } [MonoPInvokeCallback (typeof (VoidVoidDelegate))] - public static void M () { + public static void M1 () { try { callee (ref called); throw new Exception ("unexpected return from callee"); @@ -44,13 +51,22 @@ public class Tests { finally_called = true; } } + + [MonoPInvokeCallback (typeof (VoidVoidDelegate))] + public static void M2 () { + try { + callee (ref called); + throw new Exception ("unexpected return from callee"); + } catch (SomeOtherExn) { + } + } } public static int test_0_setjmp_exn_handler () { IntPtr res; Caller.Setup (); - VoidVoidDelegate f = new VoidVoidDelegate (Caller.M); + VoidVoidDelegate f = new VoidVoidDelegate (Caller.M1); try { mono_test_setjmp_and_call (f, out res); @@ -84,7 +100,71 @@ public class Tests { return 6; } } + + public class Caller2 { + public static bool rethrow_called; + public static bool exception_caught; + public static bool return_from_inner_managed_callback; + + public static void Setup () { + rethrow_called = false; + exception_caught = false; + return_from_inner_managed_callback = false; + } + + public static void RethrowException (uint original_exception) { + var e = (Exception) GCHandle.FromIntPtr ((IntPtr) original_exception).Target; + rethrow_called = true; + System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture (e).Throw (); + } + + [MonoPInvokeCallback (typeof (VoidHandleHandleOutDelegate))] + public static void Del2 (uint original_exception, out int exception_handle) { + exception_handle = 0; + try { + RethrowException (original_exception); + } catch (Exception ex) { + var handle = GCHandle.Alloc (ex, GCHandleType.Normal); + exception_handle = GCHandle.ToIntPtr (handle).ToInt32 (); + exception_caught = true; + } + return_from_inner_managed_callback = true; + } + } + public static int test_0_throw_and_raise_exception () + { + Caller.Setup (); + Caller2.Setup (); + VoidVoidDelegate f = new VoidVoidDelegate (Caller.M2); + VoidHandleHandleOutDelegate del2 = new VoidHandleHandleOutDelegate (Caller2.Del2); + bool outer_managed_callback = false; + try { + mono_test_setup_ftnptr_eh_callback (f, del2); + } catch (Exception e) { + outer_managed_callback = true; + } + + if (!outer_managed_callback) { + Console.Error.WriteLine ("outer managed callback did not throw exception"); + return 1; + } + if (!Caller2.rethrow_called) { + Console.Error.WriteLine ("exception was not rethrown by eh callback"); + return 2; + } + if (!Caller2.exception_caught) { + Console.Error.WriteLine ("rethrown exception was not caught"); + return 3; + } + if (!Caller2.return_from_inner_managed_callback) { + Console.Error.WriteLine ("managed callback called from native eh callback did not return"); + return 4; + } + + mono_test_cleanup_ftptr_eh_callback (); + return 0; + } static int Main () { diff --git a/mono/tests/libtest.c.REMOVED.git-id b/mono/tests/libtest.c.REMOVED.git-id index 99556dc651..51f2421106 100644 --- a/mono/tests/libtest.c.REMOVED.git-id +++ b/mono/tests/libtest.c.REMOVED.git-id @@ -1 +1 @@ -a43846ad7605ffbf73caa0e5311eec752e36c867 \ No newline at end of file +cd8be28c44cbfa14048e49dc6cd38abbc51382a8 \ No newline at end of file diff --git a/mono/tests/marshal2.cs b/mono/tests/marshal2.cs index 7707b32dbb..7216cb0855 100644 --- a/mono/tests/marshal2.cs +++ b/mono/tests/marshal2.cs @@ -35,7 +35,8 @@ public class Tests { public SimpleObj emb2; public string s2; public double x; - [MarshalAs (UnmanagedType.ByValArray, SizeConst=2)] public char[] a2; + [MarshalAs (UnmanagedType.ByValArray, SizeConst=2)] + public char[] a2; } [StructLayout (LayoutKind.Sequential, CharSet=CharSet.Ansi)] diff --git a/mono/tests/pinvoke2.cs b/mono/tests/pinvoke2.cs index 69b16ccab2..c13ba4434b 100644 --- a/mono/tests/pinvoke2.cs +++ b/mono/tests/pinvoke2.cs @@ -172,6 +172,13 @@ public unsafe class Tests { } } + [StructLayout(LayoutKind.Sequential)] + public struct BStrStruct + { + [MarshalAs(UnmanagedType.BStr)] + public string bstr; + } + [DllImport ("libnot-found", EntryPoint="not_found")] public static extern int mono_library_not_found (); @@ -2091,5 +2098,17 @@ public unsafe class Tests { return 2; return 0; } + + [DllImport ("libtest", EntryPoint="mono_test_marshal_bstr")] + public static extern int mono_test_marshal_bstr ([In] ref BStrStruct p); + + public static int test_0_bstr () { + var p = new BStrStruct { bstr = "Hello" }; + + mono_test_marshal_bstr (ref p); + + return 0; + } + } diff --git a/mono/tests/sgen-toggleref.cs b/mono/tests/sgen-toggleref.cs index 9e5738078f..372263f908 100644 --- a/mono/tests/sgen-toggleref.cs +++ b/mono/tests/sgen-toggleref.cs @@ -37,7 +37,7 @@ class Driver { static WeakReference root, child; [DllImport ("__Internal", EntryPoint="mono_gc_toggleref_add")] - static extern int mono_gc_toggleref_add (IntPtr ptr, bool strong_ref); + static extern void mono_gc_toggleref_add (IntPtr ptr, bool strong_ref); static void Register (object obj) { diff --git a/mono/tests/split-tailcall-interface-conservestack.cpp b/mono/tests/split-tailcall-interface-conservestack.cpp new file mode 100644 index 0000000000..10e38b73c9 --- /dev/null +++ b/mono/tests/split-tailcall-interface-conservestack.cpp @@ -0,0 +1,89 @@ +// This program is used to split tailcall-interface-conservestack.il into separate tests. +// +// Algorithm is just to split on special inserted markers. +// +// mkdir tailcall/interface-conservestack +// rm tailcall-interface-conservestack-* +// git rm tailcall-interface-conservestack-* +// g++ split-tailcall-interface-conservestack.cpp && ./a.out < tailcall-interface-conservestack.il +// git add tailcall/interface-conservestack/*.il +// +// Note This is valid C++98 for use with older compilers, where C++11 would be desirable. +#include +#include +#include +#include +#include +#include +using namespace std; +#include +#ifdef _WIN32 +#include +#endif + +typedef vector strings_t; +struct test_t +{ + strings_t content; +}; +typedef vector tests_t; + +static void +CreateDir (const char *a) +{ +#ifdef _WIN32 + _mkdir (a); +#else + mkdir (a, 0777); +#endif +} + +int main() +{ + string line; + strings_t prefix; + tests_t tests; + test_t test_dummy; + test_t *test = &test_dummy; + strings_t suffix; + + while (getline(cin, line) && line != "// test-split-prefix do not remove or edit this line") + prefix.push_back(line); + + while (getline (cin, line)) + { + if (!line.length()) // tests are delimited by empty lines + { + tests.resize(tests.size() + 1); + test = &tests.back(); + assert(getline(cin, line)); + if (line == "// test-split-suffix do not remove or edit this line") + break; + } + test->content.push_back(line); + } + while (getline (cin, line)) + suffix.push_back(line); + + int i = 0; + + CreateDir ("tailcall"); + CreateDir ("tailcall/interface-conservestack"); + + for (tests_t::iterator test = tests.begin(); test != tests.end(); ++test) + { + char buffer[99]; + sprintf(buffer, "%d", ++i); + //printf("%s\n", buffer); + FILE* output = fopen((string("tailcall/interface-conservestack/") + buffer + ".il").c_str(), "w"); + for (strings_t::const_iterator s = prefix.begin(); s != prefix.end(); ++s) + fprintf(output, "%s\n", s->c_str()); + fputs("\n", output); + for (strings_t::const_iterator s = test->content.begin(); s != test->content.end(); ++s) + fprintf(output, "%s\n", s->c_str()); + fputs("\n", output); + for (strings_t::const_iterator s = suffix.begin(); s != suffix.end(); ++s) + fprintf(output, "%s\n", s->c_str()); + fclose(output); + } +} diff --git a/mono/tests/tailcall-interface-conservestack.il b/mono/tests/tailcall-interface-conservestack.il index 0b760777fa..d709d47d4a 100644 --- a/mono/tests/tailcall-interface-conservestack.il +++ b/mono/tests/tailcall-interface-conservestack.il @@ -18,16 +18,17 @@ extends [mscorlib]System.ValueType .field public int32 x .field public int32 y } + .class interface private abstract I1 { .method public newslot abstract virtual instance void perturb_interface_offset1() { } -.method public newslot abstract virtual instance int32 F1(class I2 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } -.method public newslot abstract virtual instance int32 GF1(class I2 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } @@ -44,15 +45,15 @@ extends [mscorlib]System.ValueType { } -.method public newslot abstract virtual instance int32 F1(class GI2`1 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } -.method public newslot abstract virtual instance int32 GF1(class GI2`1 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } -.method public newslot abstract virtual instance int32 HF1(class GI2`1 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } } @@ -65,11 +66,11 @@ extends [mscorlib]System.ValueType .method public newslot abstract virtual instance void perturb_interface_offset3() { } -.method public newslot abstract virtual instance int32 F2(class I1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } -.method public newslot abstract virtual instance int32 GF2(class I1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } @@ -94,21 +95,21 @@ extends [mscorlib]System.ValueType { } -.method public newslot abstract virtual instance int32 F2(class GI1`1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } -.method public newslot abstract virtual instance int32 GF2(class GI1`1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } -.method public newslot abstract virtual instance int32 HF2(class GI1`1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { } } .class public C1 implements I1 { -.field private static int32 i -.field public static int32 errors +.field static int64 i +.field public static int64 errors .method private newslot virtual final instance void I1.perturb_interface_offset1() { @@ -116,99 +117,125 @@ extends [mscorlib]System.ValueType ret } -.method public static int32 check(int64 stack1, int64 stack2) +.method public static void check(int64 stack1, int64 stack2) { -.locals init (int32 V_0) -ldsfld int32 C1::i -ldc.i4.1 +ldsfld int64 C1::i +ldc.i8 1 add -stsfld int32 C1::i -ldarg.0 -ldarg.1 -bne.un.s IL_0013 -ldc.i4.0 -br.s IL_0014 -IL_0013: -ldc.i4.1 -IL_0014: -stloc.0 -ldloc.0 -brtrue.s IL_001a -ldc.i4.0 +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) ret -IL_001a: -ldsfld int32 C1::errors -ldc.i4.1 +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 add -stsfld int32 C1::errors -ldstr "{0} tailcall failure" -ldsfld int32 C1::i -box [mscorlib]System.Int32 -call void [mscorlib]System.Console::WriteLine(string, object) -ldloc.0 +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) ret } -.method private newslot virtual final instance int32 I1.F1(class I2 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { .override I1::F1 -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 I2::F2(class I1, int32, int64, int64) +callvirt instance void I2::F2(class I1, int64, int64, int64) ret + IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 C1::check(int64, int64) +ldarg current_stack +call void C1::check(int64, int64) ret } -.method private newslot virtual final instance int32 I1.GF1(class I2 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { .override I1::GF1 -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 I2::GF2(class I1, int32, int64, int64) +callvirt instance void I2::GF2(class I1, int64, int64, int64) ret + IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 C1::check(int64, int64) +ldarg current_stack +call void C1::check(int64, int64) ret } .method public instance void .ctor() { -ldarg.0 -tail. +ldarg 0 call instance void [mscorlib]System.Object::.ctor() ret } @@ -226,111 +253,104 @@ ret .override method instance void class GI1`1::perturb_interface_offset2() ret } -.method public static int32 check(int64 stack1, int64 stack2) +.method public static void check(int64 stack1, int64 stack2) { -ldarg.0 -ldarg.1 -tail. -call int32 C1::check(int64, int64) +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) ret } -.method private newslot virtual final instance int32 'GI1.F1'(class GI2`1 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { -.override method instance int32 class GI1`1::F1(class GI2`1, -int32, -int64, -int64) -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 class GI2`1::F2(class GI1`1, int32, int64, int64) +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) ret + IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 class GC1`1::check(int64, int64) +ldarg current_stack +call void class GC1`1::check(int64, int64) ret } -.method private newslot virtual final instance int32 'GI1.GF1'(class GI2`1 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { -.override method instance int32 class GI1`1::GF1<[1]>(class GI2`1, -int32, -int64, -int64) -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 class GI2`1::GF2(class GI1`1, int32, int64, int64) +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) ret + IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 class GC1`1::check(int64, int64) +ldarg current_stack +call void class GC1`1::check(int64, int64) ret } -.method private newslot virtual final instance int32 'GI1.HF1'(class GI2`1 i2, int32 counter, int64 initial_stack, int64 current_stack) noinlining + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining { -.override method instance int32 class GI1`1::HF1<[1]>(class GI2`1, -int32, -int64, -int64) -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 class GI2`1::HF2(class GI1`1, int32, int64, int64) +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) ret + IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 class GC1`1::check(int64, int64) +ldarg current_stack +call void class GC1`1::check(int64, int64) ret } + .method public instance void .ctor() { -ldarg.0 -tail. +ldarg 0 call instance void [mscorlib]System.Object::.ctor() ret } @@ -353,74 +373,74 @@ ret .override I2::perturb_interface_offset3 ret } -.method private static int32 check(int64 stack1, int64 stack2) + +.method private static void check(int64 stack1, int64 stack2) { -ldarg.0 -ldarg.1 -tail. -call int32 C1::check(int64, int64) +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) ret } -.method private newslot virtual final instance int32 I2.F2(class I1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { .override I2::F2 -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 I1::F1(class I2, int32, int64, int64) +callvirt instance void I1::F1(class I2, int64, int64, int64) ret + IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 C2::check(int64, int64) +ldarg current_stack +call void C2::check(int64, int64) ret } -.method private newslot virtual final instance int32 I2.GF2(class I1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { .override I2::GF2 -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 I1::GF1(class I2, int32, int64, int64) +callvirt instance void I1::GF1(class I2, int64, int64, int64) ret IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 C2::check(int64, int64) +ldarg current_stack +call void C2::check(int64, int64) ret } .method public instance void .ctor() { -ldarg.0 -tail. +ldarg 0 call instance void [mscorlib]System.Object::.ctor() ret } @@ -448,111 +468,102 @@ ret .override method instance void class GI2`1::perturb_interface_offset4() ret } -.method public static int32 check(int64 stack1, int64 stack2) +.method public static void check(int64 stack1, int64 stack2) { -ldarg.0 -ldarg.1 -tail. -call int32 C1::check(int64, int64) +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) ret } -.method private newslot virtual final instance int32 'GI2.F2'(class GI1`1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { -.override method instance int32 class GI2`1::F2(class GI1`1, -int32, -int64, -int64) -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 class GI1`1::F1(class GI2`1, int32, int64, int64) +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) ret + IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 class GC2`1::check(int64, int64) +ldarg current_stack +call void class GC2`1::check(int64, int64) ret } -.method private newslot virtual final instance int32 'GI2.GF2'(class GI1`1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { -.override method instance int32 class GI2`1::GF2<[1]>(class GI1`1, -int32, -int64, -int64) -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) ret + IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 class GC2`1::check(int64, int64) +ldarg current_stack +call void class GC2`1::check(int64, int64) ret } -.method private newslot virtual final instance int32 'GI2.HF2'(class GI1`1 i1, int32 counter, int64 initial_stack, int64 current_stack) noinlining +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining { -.override method instance int32 class GI2`1::HF2<[1]>(class GI1`1, -int32, -int64, -int64) -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0014 -ldarg.1 -ldarg.0 -ldarg.2 -ldc.i4.1 +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 sub -ldarg.3 -ldloca.s V_0 +ldarg 3 +ldarga counter conv.u conv.u8 tail. -callvirt instance int32 class GI1`1::HF1(class GI2`1, int32, int64, int64) +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) ret + IL_0014: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.s current_stack -tail. -call int32 class GC2`1::check(int64, int64) +ldarg current_stack +call void class GC2`1::check(int64, int64) ret } .method public instance void .ctor() { -ldarg.0 -tail. +ldarg 0 call instance void [mscorlib]System.Object::.ctor() ret } @@ -561,8 +572,7 @@ ret { .method public instance void .ctor() { -ldarg.0 -tail. +ldarg 0 call instance void [mscorlib]System.Object::.ctor() ret } @@ -571,27 +581,26 @@ ret { .method public instance void .ctor() { -ldarg.0 -tail. +ldarg 0 call instance void [mscorlib]System.Object::.ctor() ret } } .class interface private abstract IC { -.method public newslot abstract virtual instance !!T cast1(object o, int32 counter, int64 stack) noinlining +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining { } -.method public newslot abstract virtual instance class B cast2(object o, int32 counter, int64 stack) noinlining +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining { } -.method public newslot abstract virtual instance !!T cast3(object o, int32 counter, int64 stack) noinlining +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining { } -.method public newslot abstract virtual instance class B[] cast4(object o, int32 counter, int64 stack) noinlining +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining { } -.method public newslot abstract virtual instance !!T[] cast5(object o, int32 counter, int64 stack) noinlining +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining { } } @@ -599,171 +608,171 @@ ret { .method public static void check(int64 stack1, int64 stack2) noinlining { -ldarg.0 -ldarg.1 -call int32 C1::check(int64, int64) -pop +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) ret } -.method public instance !!T cast1(object o, int32 counter, int64 stack) noinlining + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance !!0 C::cast1(object, int32, int64) +call instance !!0 C::cast1(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void C::check(int64, int64) -ldarg.1 +ldarg 1 unbox.any !!T ret } -.method public instance class B cast2(object o, int32 counter, int64 stack) noinlining +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance class B C::cast2(object, int32, int64) +call instance class B C::cast2(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void C::check(int64, int64) -ldarg.0 -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call instance !!0 C::cast1(object, int32, int64) +call instance !!0 C::cast1(object, int64, int64) ret } -.method public instance !!T cast3(object o, int32 counter, int64 stack) noinlining +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance !!0 C::cast3(object, int32, int64) +call instance !!0 C::cast3(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void C::check(int64, int64) -ldarg.0 -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call instance !!0 C::cast1(object, int32, int64) +call instance !!0 C::cast1(object, int64, int64) ret } -.method public instance class B[] cast4(object o, int32 counter, int64 stack) noinlining +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance class B[] C::cast4(object, int32, int64) +call instance class B[] C::cast4(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void C::check(int64, int64) -ldarg.0 -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call instance !!0 C::cast1(object, int32, int64) +call instance !!0 C::cast1(object, int64, int64) ret } -.method public instance !!T[] cast5(object o, int32 counter, int64 stack) noinlining +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance !!0[] C::cast5(object, int32, int64) +call instance !!0[] C::cast5(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void C::check(int64, int64) -ldarg.0 -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call instance !!0 C::cast1(object, int32, int64) +call instance !!0 C::cast1(object, int64, int64) ret } .method public instance void .ctor() { -ldarg.0 -tail. +ldarg 0 call instance void [mscorlib]System.Object::.ctor() ret } @@ -772,942 +781,846 @@ ret { .method public static void check(int64 stack1, int64 stack2) noinlining { -ldarg.0 -ldarg.1 -tail. +ldarg 0 +ldarg 1 call void C::check(int64, int64) ret } -.method public static !!T cast1(object o, int32 counter, int64 stack) noinlining +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.1 -ldc.i4.0 -ble.s IL_0012 -ldarg.0 -ldarg.1 -ldc.i4.1 +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call !!0 class D`1::cast1(object, int32, int64) +call !!0 class D`1::cast1(object, int64, int64) ret + IL_0012: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.2 +ldarg 2 call void class D`1::check(int64, int64) -ldarg.0 +ldarg 0 unbox.any !!T ret } -.method public instance class B cast2(object o, int32 counter, int64 stack) noinlining +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance class B class D`1::cast2(object, int32, int64) +call instance class B class D`1::cast2(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void class D`1::check(int64, int64) -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call !!0 class D`1::cast1(object, int32, int64) +call !!0 class D`1::cast1(object, int64, int64) ret } -.method public instance !!T cast3(object o, int32 counter, int64 stack) noinlining +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance !!0 class D`1::cast3(object, int32, int64) +call instance !!0 class D`1::cast3(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void class D`1::check(int64, int64) -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call !!0 class D`1::cast1(object, int32, int64) +call !!0 class D`1::cast1(object, int64, int64) ret } -.method public instance class B[] cast4(object o, int32 counter, int64 stack) noinlining +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance class B[] class D`1::cast4(object, int32, int64) +call instance class B[] class D`1::cast4(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void class D`1::check(int64, int64) -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call !!0 class D`1::cast1(object, int32, int64) +call !!0 class D`1::cast1(object, int64, int64) ret } -.method public instance !!T[] cast5(object o, int32 counter, int64 stack) noinlining +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance !!0[] class D`1::cast5(object, int32, int64) +call instance !!0[] class D`1::cast5(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void class D`1::check(int64, int64) -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call !!0 class D`1::cast1(object, int32, int64) +call !!0 class D`1::cast1(object, int64, int64) ret } -.method public instance !T1 cast6(object o, int32 counter, int64 stack) noinlining +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance !0 class D`1::cast6(object, int32, int64) +call instance !0 class D`1::cast6(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void class D`1::check(int64, int64) -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call !!0 class D`1::cast1(object, int32, int64) +call !!0 class D`1::cast1(object, int64, int64) ret } -.method public instance !T1 cast7(object o, int32 counter, int64 stack) noinlining +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance !0 class D`1::cast7(object, int32, int64) +call instance !0 class D`1::cast7(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void class D`1::check(int64, int64) -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call !!0 class D`1::cast1(object, int32, int64) +call !!0 class D`1::cast1(object, int64, int64) ret } -.method public instance !T1[] cast8(object o, int32 counter, int64 stack) noinlining +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance !0[] class D`1::cast8(object, int32, int64) +call instance !0[] class D`1::cast8(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void class D`1::check(int64, int64) -ldarg.0 -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call instance !!0 class D`1::cast3(object, int32, int64) +call instance !!0 class D`1::cast3(object, int64, int64) ret } -.method public instance !T1[] cast9(object o, int32 counter, int64 stack) noinlining +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining { -.locals init (int32 V_0) -ldarg.2 -ldc.i4.0 -ble.s IL_0013 -ldarg.0 -ldarg.1 -ldarg.2 -ldc.i4.1 +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 sub -ldloca.s V_0 +ldarga counter conv.u conv.u8 tail. -call instance !0[] class D`1::cast9(object, int32, int64) +call instance !0[] class D`1::cast9(object, int64, int64) ret + IL_0013: -ldloca.s V_0 +ldarga counter conv.u conv.u8 -ldarg.3 +ldarg 3 call void class D`1::check(int64, int64) -ldarg.0 -ldarg.1 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 tail. -call instance !!0 class D`1::cast3(object, int32, int64) +call instance !!0 class D`1::cast3(object, int64, int64) ret } .method public instance void .ctor() { -ldarg.0 -tail. +ldarg 0 call instance void [mscorlib]System.Object::.ctor() ret } } .class private C3 { -.field private int32 i -.method private instance void print(object o) noinlining +.method static void print() noinlining { -ldarg.0 -ldarg.0 -ldfld int32 C3::i -ldc.i4.1 -add -stfld int32 C3::i ret } -.method public instance void Main() noinlining + +.method static void print(object o) noinlining { -.locals init (class D`1 V_0, class D`1 V_1, class D`1 V_2, class C V_3, class B V_4, class B[] V_5, int32 V_6, class I1 V_7, class I2 V_8, int32 V_9, class GI1`1 V_10, class GI1`1 V_11, class GI1`1 V_12, class GI1`1 V_13, class GI1`1 V_14, class GI1`1 V_15, class GI2`1 V_16, class GI2`1 V_17, class GI2`1 V_18, class GI2`1 V_19, class GI2`1 V_20, class GI2`1 V_21) -newobj instance void class D`1::.ctor() -stloc.0 -newobj instance void class D`1::.ctor() -stloc.1 -newobj instance void class D`1::.ctor() -stloc.2 -newobj instance void C::.ctor() -stloc.3 -newobj instance void B::.ctor() -stloc.s V_4 -ldc.i4.1 -newarr B -stloc.s V_5 - -newobj instance void C1::.ctor() -stloc.s V_7 -newobj instance void C2::.ctor() -stloc.s V_8 - -newobj instance void class GC1`1::.ctor() -stloc.s V_10 -newobj instance void class GC1`1::.ctor() -stloc.s V_11 -newobj instance void class GC1`1::.ctor() -stloc.s V_12 -newobj instance void class GC1`1::.ctor() -stloc.s V_13 -newobj instance void class GC1`1::.ctor() -stloc.s V_14 -newobj instance void class GC1`1::.ctor() -stloc.s V_15 -newobj instance void class GC2`1::.ctor() -stloc.s V_16 -newobj instance void class GC2`1::.ctor() -stloc.s V_17 -newobj instance void class GC2`1::.ctor() -stloc.s V_18 -newobj instance void class GC2`1::.ctor() -stloc.s V_19 -newobj instance void class GC2`1::.ctor() -stloc.s V_20 -newobj instance void class GC2`1::.ctor() -stloc.s V_21 - -ldc.i4.0 -stloc.s V_9 - -ldarg.0 -ldloc.0 -ldloc.s V_4 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance class B class D`1::cast2(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.0 -ldloc.s V_4 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !!0 class D`1::cast3(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.0 -ldloc.s V_5 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !!0 class D`1::cast3(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.0 -ldloc.s V_5 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance class B[] class D`1::cast4(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.0 -ldloc.s V_5 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !!0[] class D`1::cast5(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.1 -ldloc.s V_4 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !0 class D`1::cast6(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.1 -ldloc.s V_4 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !0 class D`1::cast7(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.2 -ldloc.s V_5 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !0 class D`1::cast7(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.1 -ldloc.s V_5 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !0[] class D`1::cast8(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.1 -ldloc.s V_5 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !0[] class D`1::cast9(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.3 -ldloc.s V_4 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance class B C::cast2(object, int32, int64) -call instance void C3::print(object) - - -ldc.i4.0 - - -ldarg.0 -ldloc.3 -ldloc.s V_4 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !!0 C::cast3(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.3 -ldloc.s V_5 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !!0 C::cast3(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.3 -ldloc.s V_5 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance class B[] C::cast4(object, int32, int64) -call instance void C3::print(object) - -ldarg.0 -ldloc.3 -ldloc.s V_5 -ldc.i4.s 100 -ldc.i4.0 -conv.i8 -callvirt instance !!0[] C::cast5(object, int32, int64) -call instance void C3::print(object) - -ldloc.s V_7 -ldloc.s V_8 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 I1::F1(class I2, int32, int64, int64) -add - -ldloc.s V_7 -ldloc.s V_8 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 I1::GF1(class I2, int32, int64, int64) -add - -ldloc.s V_7 -ldloc.s V_8 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 I1::GF1(class I2, int32, int64, int64) -add - -ldloc.s V_7 -ldloc.s V_8 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 I1::GF1(class I2, int32, int64, int64) -add - -ldloc.s V_7 -ldloc.s V_8 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 I1::GF1(class I2, int32, int64, int64) -add - -ldloc.s V_7 -ldloc.s V_8 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 I1::GF1(class I2, int32, int64, int64) -add - -// This is the only failure on desktop. -ldloc.s V_10 -ldloc.s V_16 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::F1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_10 -ldloc.s V_16 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_10 -ldloc.s V_16 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_10 -ldloc.s V_16 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_10 -ldloc.s V_16 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_10 -ldloc.s V_16 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_11 -ldloc.s V_17 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_11 -ldloc.s V_17 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_11 -ldloc.s V_17 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_11 -ldloc.s V_17 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_11 -ldloc.s V_17 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_12 -ldloc.s V_18 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_12 -ldloc.s V_18 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_12 -ldloc.s V_18 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_12 -ldloc.s V_18 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_12 -ldloc.s V_18 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_13 -ldloc.s V_19 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_13 -ldloc.s V_19 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_13 -ldloc.s V_19 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_13 -ldloc.s V_19 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_13 -ldloc.s V_19 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_14 -ldloc.s V_20 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_14 -ldloc.s V_20 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_14 -ldloc.s V_20 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_14 -ldloc.s V_20 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_14 -ldloc.s V_20 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_15 -ldloc.s V_21 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_15 -ldloc.s V_21 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_15 -ldloc.s V_21 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_15 -ldloc.s V_21 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldloc.s V_15 -ldloc.s V_21 -ldc.i4.s 100 -ldloca.s V_6 -conv.u -conv.u8 -ldc.i4.0 -conv.i8 -callvirt instance int32 class GI1`1::GF1(class GI2`1, int32, int64, int64) -add - -ldsfld int32 C1::errors -add -dup -stloc.s V_9 -brfalse.s IL_0591 - -ldstr "failure {0}" -br.s IL_0596 - -IL_0591: -ldstr "success" - -IL_0596: -ldloc.s V_9 -box [mscorlib]System.Int32 -call void [mscorlib]System.Console::WriteLine(string, object) -ldloc.s V_9 -tail. -call void [mscorlib]System.Environment::Exit(int32) +call void C3::print() ret } .method public static void Main(string[] args) noinlining { .entrypoint -newobj instance void C3::.ctor() -tail. -call instance void C3::Main() +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + +// test-split-prefix do not remove or edit this line + +ldloc 0 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance class B class D`1::cast2(object, int64, int64) +call void C3::print(object) + +ldloc 0 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance !!0 class D`1::cast3(object, int64, int64) +call void C3::print(object) + +ldloc 0 +ldloc V_5 +ldloc depth +ldc.i8 0 +conv.i8 +callvirt instance !!0 class D`1::cast3(object, int64, int64) +call void C3::print(object) + +ldloc 0 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance class B[] class D`1::cast4(object, int64, int64) +call void C3::print(object) + +ldloc 0 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !!0[] class D`1::cast5(object, int64, int64) +call void C3::print(object) + +ldloc 1 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance !0 class D`1::cast6(object, int64, int64) +call void C3::print(object) + +ldloc 1 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance !0 class D`1::cast7(object, int64, int64) +call void C3::print(object) + +ldloc 2 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !0 class D`1::cast7(object, int64, int64) +call void C3::print(object) + +ldloc 1 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !0[] class D`1::cast8(object, int64, int64) +call void C3::print(object) + +ldloc 1 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !0[] class D`1::cast9(object, int64, int64) +call void C3::print(object) + +ldloc 3 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance class B C::cast2(object, int64, int64) +call void C3::print(object) + +ldloc 3 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance !!0 C::cast3(object, int64, int64) +call void C3::print(object) + +ldloc 3 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !!0 C::cast3(object, int64, int64) +call void C3::print(object) + +ldloc 3 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance class B[] C::cast4(object, int64, int64) +call void C3::print(object) + +ldloc 3 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !!0[] C::cast5(object, int64, int64) +call void C3::print(object) + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::F1(class I2, int64, int64, int64) + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + +// This is the only failure on desktop. +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + +// test-split-suffix do not remove or edit this line + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) ret } -.method public instance void .ctor() -{ -ldarg.0 -tail. -call instance void [mscorlib]System.Object::.ctor() -ret -} } diff --git a/mono/tests/tailcall-interface.cs b/mono/tests/tailcall-interface.cs index 59c8541875..8575599bc0 100644 --- a/mono/tests/tailcall-interface.cs +++ b/mono/tests/tailcall-interface.cs @@ -20,10 +20,10 @@ interface I1 void perturb_interface_offset1 ( ); [MethodImpl (NoInlining)] - int F1 (I2 i2, int counter, long initial_stack, long current_stack = 0); + int F1 (I2 i2, long counter, long initial_stack, long current_stack = 0); [MethodImpl (NoInlining)] - int GF1 (I2 i2, int counter, long initial_stack, long current_stack = 0); + int GF1 (I2 i2, long counter, long initial_stack, long current_stack = 0); } interface GI1 @@ -32,13 +32,13 @@ interface GI1 void perturb_interface_offset2 ( ); [MethodImpl (NoInlining)] - int F1 (GI2 i2, int counter, long initial_stack, long current_stack = 0); + int F1 (GI2 i2, long counter, long initial_stack, long current_stack = 0); [MethodImpl (NoInlining)] - int GF1 (GI2 i2, int counter, long initial_stack, long current_stack = 0); + int GF1 (GI2 i2, long counter, long initial_stack, long current_stack = 0); [MethodImpl (NoInlining)] - int HF1 (GI2 i2, int counter, long initial_stack, long current_stack = 0); + int HF1 (GI2 i2, long counter, long initial_stack, long current_stack = 0); } interface I2 @@ -48,10 +48,10 @@ interface I2 void perturb_interface_offset3 ( ); [MethodImpl (NoInlining)] - int F2 (I1 i1, int counter, long initial_stack, long current_stack = 0); + int F2 (I1 i1, long counter, long initial_stack, long current_stack = 0); [MethodImpl (NoInlining)] - int GF2 (I1 i1, int counter, long initial_stack, long current_stack = 0); + int GF2 (I1 i1, long counter, long initial_stack, long current_stack = 0); } interface GI2 @@ -62,13 +62,13 @@ interface GI2 void perturb_interface_offset4 ( ); [MethodImpl (NoInlining)] - int F2 (GI1 i1, int counter, long initial_stack, long current_stack = 0); + int F2 (GI1 i1, long counter, long initial_stack, long current_stack = 0); [MethodImpl (NoInlining)] - int GF2 (GI1 i1, int counter, long initial_stack, long current_stack = 0); + int GF2 (GI1 i1, long counter, long initial_stack, long current_stack = 0); [MethodImpl (NoInlining)] - int HF2 (GI1 i1, int counter, long initial_stack, long current_stack = 0); + int HF2 (GI1 i1, long counter, long initial_stack, long current_stack = 0); } unsafe public class C1 : I1 @@ -93,21 +93,19 @@ unsafe public class C1 : I1 } [MethodImpl (NoInlining)] - int I1.F1 (I2 i2, int counter, long initial_stack, long current_stack) + int I1.F1 (I2 i2, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i2.F2 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i2.F2 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } [MethodImpl (NoInlining)] - int I1.GF1 (I2 i2, int counter, long initial_stack, long current_stack) + int I1.GF1 (I2 i2, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i2.GF2 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i2.GF2 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } } @@ -122,30 +120,27 @@ unsafe public class GC1 : GI1 } [MethodImpl (NoInlining)] - int GI1.F1 (GI2 i2, int counter, long initial_stack, long current_stack) + int GI1.F1 (GI2 i2, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i2.F2 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i2.F2 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } [MethodImpl (NoInlining)] - int GI1.GF1 (GI2 i2, int counter, long initial_stack, long current_stack) + int GI1.GF1 (GI2 i2, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i2.GF2 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i2.GF2 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } [MethodImpl (NoInlining)] - int GI1.HF1 (GI2 i2, int counter, long initial_stack, long current_stack) + int GI1.HF1 (GI2 i2, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i2.HF2 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i2.HF2 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } } @@ -161,21 +156,19 @@ unsafe public class C2 : I2 } [MethodImpl (NoInlining)] - int I2.F2 (I1 i1, int counter, long initial_stack, long current_stack) + int I2.F2 (I1 i1, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i1.F1 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i1.F1 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } [MethodImpl (NoInlining)] - int I2.GF2 (I1 i1, int counter, long initial_stack, long current_stack) + int I2.GF2 (I1 i1, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i1.GF1 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i1.GF1 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } } @@ -192,30 +185,27 @@ unsafe public class GC2 : GI2 } [MethodImpl (NoInlining)] - int GI2.F2 (GI1 i1, int counter, long initial_stack, long current_stack) + int GI2.F2 (GI1 i1, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i1.F1 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i1.F1 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } [MethodImpl (NoInlining)] - int GI2.GF2 (GI1 i1, int counter, long initial_stack, long current_stack) + int GI2.GF2 (GI1 i1, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i1.GF1 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i1.GF1 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } [MethodImpl (NoInlining)] - int GI2.HF2 (GI1 i1, int counter, long initial_stack, long current_stack) + int GI2.HF2 (GI1 i1, long counter, long initial_stack, long current_stack) { - int local; if (counter > 0) - return i1.HF1 (this, counter - 1, initial_stack, (long)&local); - return check ((long)&local, current_stack); + return i1.HF1 (this, counter - 1, initial_stack, (long)&counter); + return check ((long)&counter, current_stack); } } @@ -226,19 +216,19 @@ public class B { } interface IC { [MethodImpl (NoInlining)] - T cast1 (object o, int counter = 100, long stack = 0); + T cast1 (object o, long counter = 100, long stack = 0); [MethodImpl (NoInlining)] - B cast2 (object o, int counter = 100, long stack = 0); + B cast2 (object o, long counter = 100, long stack = 0); [MethodImpl (NoInlining)] - T cast3 (object o, int counter = 100, long stack = 0); + T cast3 (object o, long counter = 100, long stack = 0); [MethodImpl (NoInlining)] - B[] cast4 (object o, int counter = 100, long stack = 0); + B[] cast4 (object o, long counter = 100, long stack = 0); [MethodImpl (NoInlining)] - T[] cast5 (object o, int counter = 100, long stack = 0); + T[] cast5 (object o, long counter = 100, long stack = 0); } unsafe public class C @@ -250,52 +240,47 @@ unsafe public class C } [MethodImpl (NoInlining)] - public T cast1 (object o, int counter = 100, long stack = 0) + public T cast1 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast1 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast1 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return (T)o; } [MethodImpl (NoInlining)] - public B cast2 (object o, int counter = 100, long stack = 0) + public B cast2 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast2 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast2 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } [MethodImpl (NoInlining)] - public T cast3 (object o, int counter = 100, long stack = 0) + public T cast3 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast3 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast3 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } [MethodImpl (NoInlining)] - public B[] cast4 (object o, int counter = 100, long stack = 0) + public B[] cast4 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast4 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast4 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } [MethodImpl (NoInlining)] - public T[] cast5 (object o, int counter = 100, long stack = 0) + public T[] cast5 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast5 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast5 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } } @@ -309,92 +294,83 @@ unsafe public class D } [MethodImpl (NoInlining)] - public static T cast1 (object o, int counter = 100, long stack = 0) + public static T cast1 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast1 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast1 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return (T)o; } [MethodImpl (NoInlining)] - public B cast2 (object o, int counter = 100, long stack = 0) + public B cast2 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast2 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast2 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } [MethodImpl (NoInlining)] - public T cast3 (object o, int counter = 100, long stack = 0) + public T cast3 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast3 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast3 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } [MethodImpl (NoInlining)] - public B[] cast4 (object o, int counter = 100, long stack = 0) + public B[] cast4 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast4 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast4 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } [MethodImpl (NoInlining)] - public T[] cast5 (object o, int counter = 100, long stack = 0) + public T[] cast5 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast5 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast5 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } [MethodImpl (NoInlining)] - public T1 cast6 (object o, int counter = 100, long stack = 0) + public T1 cast6 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast6 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast6 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } [MethodImpl (NoInlining)] - public T1 cast7 (object o, int counter = 100, long stack = 0) + public T1 cast7 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast7 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast7 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast1 (o); } [MethodImpl (NoInlining)] - public T1[] cast8 (object o, int counter = 100, long stack = 0) + public T1[] cast8 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast8 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast8 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast3 (o); } [MethodImpl (NoInlining)] - public T1[] cast9 (object o, int counter = 100, long stack = 0) + public T1[] cast9 (object o, long counter = 100, long stack = 0) { - int local; if (counter > 0) - return cast9 (o, counter - 1, (long)&local); - check ((long)&local, stack); + return cast9 (o, counter - 1, (long)&counter); + check ((long)&counter, stack); return cast3 (o); } } diff --git a/mono/tests/tailcall-rgctxb-static.il b/mono/tests/tailcall-rgctxb-static.il index 69f4e91c12..b9422fb735 100644 --- a/mono/tests/tailcall-rgctxb-static.il +++ b/mono/tests/tailcall-rgctxb-static.il @@ -37,9 +37,9 @@ unsafe struct A static public int f1 (int counter, long initial_stack, long current_stack) { int local; - object a = new T[101]; if (counter > 0) return f2 (counter - 1, initial_stack, (long)&local); + object a = new T[10]; return check ((long)&local, current_stack); } @@ -47,9 +47,9 @@ unsafe struct A static public int f2 (int counter, long initial_stack, long current_stack) { int local; - object a = new T[101]; if (counter > 0) return f1 (counter - 1, initial_stack, (long)&local); + object a = new T[11]; return check ((long)&local, current_stack); } } diff --git a/mono/tests/tailcall/fsharp-deeptail.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail.il.REMOVED.git-id index dd97cf929b..179276418d 100644 --- a/mono/tests/tailcall/fsharp-deeptail.il.REMOVED.git-id +++ b/mono/tests/tailcall/fsharp-deeptail.il.REMOVED.git-id @@ -1 +1 @@ -24dcd35ba163f472c93456cbf5d0b3b11713e156 \ No newline at end of file +73a4b5f40358073db584602cd2b2ced6cdebb4eb \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/Seq.filter-length1.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/Seq.filter-length1.il.REMOVED.git-id new file mode 100644 index 0000000000..7ed5e5eb9e --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/Seq.filter-length1.il.REMOVED.git-id @@ -0,0 +1 @@ +0712e8bf9319e5d1d382aad59fd7e9901f6010c2 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/Seq.filter-length2.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/Seq.filter-length2.il.REMOVED.git-id new file mode 100644 index 0000000000..43ac0d90d2 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/Seq.filter-length2.il.REMOVED.git-id @@ -0,0 +1 @@ +f8cd6706becbb1b2dfa484644ef04490d93a55d3 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/Seq.filter-length3.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/Seq.filter-length3.il.REMOVED.git-id new file mode 100644 index 0000000000..b0f35ef02d --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/Seq.filter-length3.il.REMOVED.git-id @@ -0,0 +1 @@ +5f1ffd388b9cb92da7801e7dfb95b6c81ea364d1 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/StaticTailCallLoop_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/StaticTailCallLoop_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..6954e52844 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/StaticTailCallLoop_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +9c136197f800fef280a6d1d6871e761ed98b581f \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/StaticTailCallLoop_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/StaticTailCallLoop_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..d1043c074e --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/StaticTailCallLoop_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +64cbce03d362939907a4aab4a466a1e767357261 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..bb74978441 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +fbbdd819eec4d4046708145acb7bf91a373560b7 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..c50cd35395 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +ab568e6e5b6950a51535e8f0d25a39a7856c27e2 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..29a76dda81 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +10ef944b27903e81a81a8169d1170f5db3495e90 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..0f1d5b72f4 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DateTime_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +6da6957c185b18ff73920a967843acae9837b05a \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DatstringeTime_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DatstringeTime_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..4dd1ee6528 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_DatstringeTime_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +3f6d2c9a3becbf534785543177a8645aea9e481d \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..20a46da79b --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +9a8a9e8be0e36985858b1171cefe0dcc213db9fd \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..0f26722ee1 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +8881b9412ef66f454b7aa07e0f56c1e382ae5402 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..0c07b7aa70 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +02b66abcd81294a530323b84b553ea9bd6064f18 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..26884ae128 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_byte_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +76b99158ed541ce44239fd4b445cf7d1d6803d8a \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..52af9751d3 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +d96617c485f81cacf2ec9e978035faddf0bc3707 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..1d1b6549d7 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +33b4743d637b631a7bc62669bded66a6929d46a4 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..4faebecca9 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +1da09f7c45e70127fba9e67f5fcff85c11118990 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..13ba5bfb0a --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_int_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +438cb25b1396fbf3b290e987325f3c1c1d9f4d96 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..3a396d4db4 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +c96c7ce5a99813122d1cad163ed1df7582204042 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..d57260c5aa --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +ed771d7484a0c3e06af2f5c24eec0ef218006690 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..f8aaf27913 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractClass_string_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +5e00dff48ea5679fcbfe12b814e627b395b582fc \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..cea29aef9d --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +30cf4b54839a33e2e005dfbb007731297578739b \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..af4f14f2a0 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +37a125159b1fbafdd9f81a654f127e9d42d10dea \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..6f3df9b1a5 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +e109da4215b832346a40f36acdb8e6f493e9f3ef \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..88bf44bd70 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DateTime_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +fd3208ea8135e1eec0727083ab01e57de64c9276 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DatstringeTime_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DatstringeTime_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..586575377f --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_DatstringeTime_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +a322b35196ab31dfe266e567351247cdc869ff04 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..abc8079a24 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +5971e3727818038b1fd3fe9b20d86078607fe70e \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..1c8a55612c --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +868891c0d8528aa199d3d3c56d4dca9d44f32651 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..6e70025d13 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +188864d17432dc4a16f6b6faf107e592d9109938 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..1b77fa43ed --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_byte_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +f50275b03151bf777798a75a9ed0a1292245068b \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..7771dc175c --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +e7072a259183cc0be3abf37e63447eed7a30df07 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..acbea38c18 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +3487704c0e35b31008350808b79bbc674f7801e5 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..c474bc6ffe --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +55cefd4a125fbd8f3f4c5a3a04ca5546d56d8ab5 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..b72479ec1c --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_int_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +b5f8e08dd312fbd4745979ede0ee170cc1e36645 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..bb48bc6090 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +e8b6f1afa7b84f279d88f836f2abeea45d16e925 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..20378c1a3f --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +476d601a6169cac7ecd989b791ad714bea0a1510 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..384403a22f --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethodAbstractInterface_string_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +5cbc34bbc7533636977c2e431bd53acfc625b244 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..6581646fd1 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +650df247c3f92f4335080a35ff167f0823717619 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..c82a1a03c2 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +acddb47148255a676f756964e08acf022a5149f0 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..66ab18494d --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +d0b708823ba9be059f851114bb4dd7daae49ff4e \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..5a24a25fa8 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_DateTime_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +3cfc23f6d48d1bc0ef911682eeef67d627260190 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..ef93e4820b --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +6cfa2775934b0e0d887f1368e379580a607b5a3f \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..50289e0937 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +8560318dd619facf5795d6ff0e84fe3cf53b3ca1 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..03f0b095d5 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +51eea16008e9edc8b3343f9c069b534ce0d3bacf \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..20788a2ff2 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_byte_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +8d5b2b3fa187cdfbb373feebc76fe2a6e2df2a19 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..f76d90669b --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +1f4e481d9d5c6289a3fc544fd800cdad98630251 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..2ce0ddc788 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +2795136fb49f3692aa88e28866b640e0ef731c2e \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..b91fca386f --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +5c0c3bc044e9701dfee32958cb8cc235493cd934 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..5bc719925a --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_int_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +15a31ea834e6e8ca4d666f6ee9701a0967dd2e7c \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..4caa670262 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +f791d4f180636709e119570c42b138c2e447ce7f \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_byte_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_byte_.il.REMOVED.git-id new file mode 100644 index 0000000000..22f8746dc7 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_byte_.il.REMOVED.git-id @@ -0,0 +1 @@ +856cfc0503e9a2ed37aa620924020ed63d995399 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..7da91b28f5 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +03211098623d97d7b09eaebc6a17ebfe808b115d \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..57e1e51b8b --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClassAndMethod_string_.Method1_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +af8d8e47c9bafb52ddfe9c79e0387e856a711319 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..ed2d212435 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +5460cf7c3b44c5dc1879df11403cd3444cb4d1c8 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..fcd03aa1a8 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +6ea7b9bfeb0cb7f326b22a0ef508a76df6fe26eb \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_string_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_string_.il.REMOVED.git-id new file mode 100644 index 0000000000..dd2a3bcd04 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoopGenericClass_string_.il.REMOVED.git-id @@ -0,0 +1 @@ +076c01eef0bd480aec943ab589de566b78d65862 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoop_DateTime_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoop_DateTime_.il.REMOVED.git-id new file mode 100644 index 0000000000..e88157e6a7 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoop_DateTime_.il.REMOVED.git-id @@ -0,0 +1 @@ +c6cb1a21103976ab6489661eadd8aa547760db5c \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/TailCallLoop_int_.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/TailCallLoop_int_.il.REMOVED.git-id new file mode 100644 index 0000000000..b7c969b7de --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/TailCallLoop_int_.il.REMOVED.git-id @@ -0,0 +1 @@ +27f739d6f6e1c03b71dfb01c9a16107384bee1e4 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/mutualTail1IsEven.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/mutualTail1IsEven.il.REMOVED.git-id new file mode 100644 index 0000000000..82fc9dac92 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/mutualTail1IsEven.il.REMOVED.git-id @@ -0,0 +1 @@ +9026c34cfa16db5e07dd32059104d6f085159f8e \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/mutualTail1IsOdd.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/mutualTail1IsOdd.il.REMOVED.git-id new file mode 100644 index 0000000000..0795be10cc --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/mutualTail1IsOdd.il.REMOVED.git-id @@ -0,0 +1 @@ +5067b597c2cd02fef23e276ce6c3e59d7f9308d3 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/simpleTail1.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/simpleTail1.il.REMOVED.git-id new file mode 100644 index 0000000000..11bbe745c4 --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/simpleTail1.il.REMOVED.git-id @@ -0,0 +1 @@ +ea5486a1f9cded13118b80774b121b48ce3a7e03 \ No newline at end of file diff --git a/mono/tests/tailcall/fsharp-deeptail/simpleTail2.il.REMOVED.git-id b/mono/tests/tailcall/fsharp-deeptail/simpleTail2.il.REMOVED.git-id new file mode 100644 index 0000000000..08a499ceda --- /dev/null +++ b/mono/tests/tailcall/fsharp-deeptail/simpleTail2.il.REMOVED.git-id @@ -0,0 +1 @@ +e0713a3e4bfc1a35c8ea09ea2dc3786486d9c786 \ No newline at end of file diff --git a/mono/tests/tailcall/interface-conservestack/1.il b/mono/tests/tailcall/interface-conservestack/1.il new file mode 100644 index 0000000000..4569c1159d --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/1.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 0 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance class B class D`1::cast2(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/10.il b/mono/tests/tailcall/interface-conservestack/10.il new file mode 100644 index 0000000000..77a7425bd0 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/10.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 1 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !0[] class D`1::cast9(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/11.il b/mono/tests/tailcall/interface-conservestack/11.il new file mode 100644 index 0000000000..42dbaeb8ad --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/11.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 3 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance class B C::cast2(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/12.il b/mono/tests/tailcall/interface-conservestack/12.il new file mode 100644 index 0000000000..3384470d3d --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/12.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 3 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance !!0 C::cast3(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/13.il b/mono/tests/tailcall/interface-conservestack/13.il new file mode 100644 index 0000000000..b3f1c5b612 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/13.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 3 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !!0 C::cast3(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/14.il b/mono/tests/tailcall/interface-conservestack/14.il new file mode 100644 index 0000000000..73290caf84 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/14.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 3 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance class B[] C::cast4(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/15.il b/mono/tests/tailcall/interface-conservestack/15.il new file mode 100644 index 0000000000..cad48fe9bf --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/15.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 3 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !!0[] C::cast5(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/16.il b/mono/tests/tailcall/interface-conservestack/16.il new file mode 100644 index 0000000000..25f95f1e1b --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/16.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::F1(class I2, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/17.il b/mono/tests/tailcall/interface-conservestack/17.il new file mode 100644 index 0000000000..b48dc93b3e --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/17.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/18.il b/mono/tests/tailcall/interface-conservestack/18.il new file mode 100644 index 0000000000..a6b6899358 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/18.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/19.il b/mono/tests/tailcall/interface-conservestack/19.il new file mode 100644 index 0000000000..3b4e00030f --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/19.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/2.il b/mono/tests/tailcall/interface-conservestack/2.il new file mode 100644 index 0000000000..5508e25ce7 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/2.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 0 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance !!0 class D`1::cast3(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/20.il b/mono/tests/tailcall/interface-conservestack/20.il new file mode 100644 index 0000000000..6c2b948629 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/20.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/21.il b/mono/tests/tailcall/interface-conservestack/21.il new file mode 100644 index 0000000000..98f976c5a8 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/21.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_7 +ldloc V_8 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void I1::GF1(class I2, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/22.il b/mono/tests/tailcall/interface-conservestack/22.il new file mode 100644 index 0000000000..d606d280f3 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/22.il @@ -0,0 +1,1194 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +// This is the only failure on desktop. +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/23.il b/mono/tests/tailcall/interface-conservestack/23.il new file mode 100644 index 0000000000..38659a932b --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/23.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/24.il b/mono/tests/tailcall/interface-conservestack/24.il new file mode 100644 index 0000000000..ccfdba67ee --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/24.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/25.il b/mono/tests/tailcall/interface-conservestack/25.il new file mode 100644 index 0000000000..261f4b4de6 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/25.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/26.il b/mono/tests/tailcall/interface-conservestack/26.il new file mode 100644 index 0000000000..851b4b5697 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/26.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/27.il b/mono/tests/tailcall/interface-conservestack/27.il new file mode 100644 index 0000000000..43e9332f17 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/27.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_10 +ldloc V_16 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/28.il b/mono/tests/tailcall/interface-conservestack/28.il new file mode 100644 index 0000000000..c079263025 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/28.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/29.il b/mono/tests/tailcall/interface-conservestack/29.il new file mode 100644 index 0000000000..bfd311d02e --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/29.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/3.il b/mono/tests/tailcall/interface-conservestack/3.il new file mode 100644 index 0000000000..e30fb4bd4b --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/3.il @@ -0,0 +1,1192 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 0 +ldloc V_5 +ldloc depth +ldc.i8 0 +conv.i8 +callvirt instance !!0 class D`1::cast3(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/30.il b/mono/tests/tailcall/interface-conservestack/30.il new file mode 100644 index 0000000000..058e38bf64 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/30.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/31.il b/mono/tests/tailcall/interface-conservestack/31.il new file mode 100644 index 0000000000..9955bbf023 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/31.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/32.il b/mono/tests/tailcall/interface-conservestack/32.il new file mode 100644 index 0000000000..5d9a535d66 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/32.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_11 +ldloc V_17 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/33.il b/mono/tests/tailcall/interface-conservestack/33.il new file mode 100644 index 0000000000..3514c452ff --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/33.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/34.il b/mono/tests/tailcall/interface-conservestack/34.il new file mode 100644 index 0000000000..4a9317096b --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/34.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/35.il b/mono/tests/tailcall/interface-conservestack/35.il new file mode 100644 index 0000000000..0b1d599d76 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/35.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/36.il b/mono/tests/tailcall/interface-conservestack/36.il new file mode 100644 index 0000000000..83d6111bc4 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/36.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/37.il b/mono/tests/tailcall/interface-conservestack/37.il new file mode 100644 index 0000000000..eb296831f0 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/37.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_12 +ldloc V_18 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/38.il b/mono/tests/tailcall/interface-conservestack/38.il new file mode 100644 index 0000000000..b616dd0d34 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/38.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/39.il b/mono/tests/tailcall/interface-conservestack/39.il new file mode 100644 index 0000000000..7a08686e2e --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/39.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/4.il b/mono/tests/tailcall/interface-conservestack/4.il new file mode 100644 index 0000000000..8bba8c4ffb --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/4.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 0 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance class B[] class D`1::cast4(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/40.il b/mono/tests/tailcall/interface-conservestack/40.il new file mode 100644 index 0000000000..28c6b1b1fe --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/40.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/41.il b/mono/tests/tailcall/interface-conservestack/41.il new file mode 100644 index 0000000000..da6601084a --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/41.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/42.il b/mono/tests/tailcall/interface-conservestack/42.il new file mode 100644 index 0000000000..f76e928b0a --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/42.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_13 +ldloc V_19 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/43.il b/mono/tests/tailcall/interface-conservestack/43.il new file mode 100644 index 0000000000..9286431b2a --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/43.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/44.il b/mono/tests/tailcall/interface-conservestack/44.il new file mode 100644 index 0000000000..de8a64bb0c --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/44.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/45.il b/mono/tests/tailcall/interface-conservestack/45.il new file mode 100644 index 0000000000..310ced8829 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/45.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/46.il b/mono/tests/tailcall/interface-conservestack/46.il new file mode 100644 index 0000000000..7bd3b97fbe --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/46.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/47.il b/mono/tests/tailcall/interface-conservestack/47.il new file mode 100644 index 0000000000..219711bd5e --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/47.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_14 +ldloc V_20 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/48.il b/mono/tests/tailcall/interface-conservestack/48.il new file mode 100644 index 0000000000..51e16451d8 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/48.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/49.il b/mono/tests/tailcall/interface-conservestack/49.il new file mode 100644 index 0000000000..733ed49dd8 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/49.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/5.il b/mono/tests/tailcall/interface-conservestack/5.il new file mode 100644 index 0000000000..bc55a333c8 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/5.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 0 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !!0[] class D`1::cast5(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/50.il b/mono/tests/tailcall/interface-conservestack/50.il new file mode 100644 index 0000000000..6c8b731b3f --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/50.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/51.il b/mono/tests/tailcall/interface-conservestack/51.il new file mode 100644 index 0000000000..bb35b2cc9d --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/51.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/52.il b/mono/tests/tailcall/interface-conservestack/52.il new file mode 100644 index 0000000000..c3ba1c8853 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/52.il @@ -0,0 +1,1193 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc V_15 +ldloc V_21 +ldloc depth +ldloca V_6 +conv.u +conv.u8 +ldc.i8 0 +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/53.il b/mono/tests/tailcall/interface-conservestack/53.il new file mode 100644 index 0000000000..147aad353b --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/53.il @@ -0,0 +1,1185 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/6.il b/mono/tests/tailcall/interface-conservestack/6.il new file mode 100644 index 0000000000..81bfcdf24a --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/6.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 1 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance !0 class D`1::cast6(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/7.il b/mono/tests/tailcall/interface-conservestack/7.il new file mode 100644 index 0000000000..3d88e16030 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/7.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 1 +ldloc V_4 +ldloc depth +ldc.i8 0 +callvirt instance !0 class D`1::cast7(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/8.il b/mono/tests/tailcall/interface-conservestack/8.il new file mode 100644 index 0000000000..4c97ee5f51 --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/8.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 2 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !0 class D`1::cast7(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/interface-conservestack/9.il b/mono/tests/tailcall/interface-conservestack/9.il new file mode 100644 index 0000000000..602498782f --- /dev/null +++ b/mono/tests/tailcall/interface-conservestack/9.il @@ -0,0 +1,1191 @@ +/* +Author: + Jay Krell (jaykrell@microsoft.com) + +Copyright 2018 Microsoft +Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Derived from tailcall-interface.cs. +*/ + +.assembly extern mscorlib { } + +.assembly 'tailcall-interface-conservestack' { } + +.class public sequential sealed Point +extends [mscorlib]System.ValueType +{ +.field public int32 x +.field public int32 y +} + +.class interface private abstract I1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI1`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void F1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void HF1(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class interface private abstract I2 +{ +.method public newslot abstract virtual instance void perturb_interface_offset1() { } + +.method public newslot abstract virtual instance void perturb_interface_offset2() { } + +.method public newslot abstract virtual instance void perturb_interface_offset3() { } + +.method public newslot abstract virtual instance void F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +.method public newslot abstract virtual instance void GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} + +} + +.class interface private abstract GI2`1 +{ + +.method public newslot abstract virtual instance void perturb_interface_offset1() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset2() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset3() +{ +} + +.method public newslot abstract virtual instance void perturb_interface_offset4() +{ +} + +.method public newslot abstract virtual instance void F2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void GF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +.method public newslot abstract virtual instance void HF2(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +} +} + +.class public C1 implements I1 +{ +.field static int64 i +.field public static int64 errors + +.method private newslot virtual final instance void I1.perturb_interface_offset1() +{ +.override I1::perturb_interface_offset1 +ret +} + +.method public static void check(int64 stack1, int64 stack2) +{ +ldsfld int64 C1::i +ldc.i8 1 +add +stsfld int64 C1::i + +ldarg 0 +ldarg 1 +bne.un IL_0013 + +//ldstr "{0}" +//ldsfld int64 C1::i +//box [mscorlib]System.Int64 +//call void [mscorlib]System.Console::WriteLine(string, object) +ret + +IL_0013: +ldsfld int64 C1::errors +ldc.i8 1 +add +stsfld int64 C1::errors + +ldstr "{0} tailcall failure stack1:{1:X} stack2:{2:X} delta:{3}" + +ldc.i4 4 +newarr [mscorlib]System.Object + +dup +ldc.i4 0 +ldsfld int64 C1::i +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 1 +ldarg 0 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 2 +ldarg 1 +box [mscorlib]System.Int64 +stelem.ref + +dup +ldc.i4 3 +ldarg 0 +ldarg 1 +sub +box [mscorlib]System.Int64 +stelem.ref + +call void class [mscorlib]System.Console::WriteLine(string, object[]) +ret +} +.method private newslot virtual final instance void I1.F1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::F1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::F2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I1.GF1(class I2 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I1::GF1 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I2::GF2(class I1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC1`1 +implements class GI1`1 +{ +.method private newslot virtual final instance void 'GI1.perturb_interface_offset1'() +{ +.override method instance void class GI1`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI1.perturb_interface_offset2'() +{ +.override method instance void class GI1`1::perturb_interface_offset2() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.F1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::F1(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::F2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI1.GF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::GF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::GF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void 'GI1.HF1'(class GI2`1 i2, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI1`1::HF1<[1]>(class GI2`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI2`1::HF2(class GI1`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC1`1::check(int64, int64) +ret +} + +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public C2 +implements I2 +{ +.method private newslot virtual final instance void I2.perturb_interface_offset1() +{ +.override I2::perturb_interface_offset1 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset2() +{ +.override I2::perturb_interface_offset2 +ret +} +.method private newslot virtual final instance void I2.perturb_interface_offset3() +{ +.override I2::perturb_interface_offset3 +ret +} + +.method private static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method private newslot virtual final instance void I2.F2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::F2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::F1(class I2, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method private newslot virtual final instance void I2.GF2(class I1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override I2::GF2 + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void I1::GF1(class I2, int64, int64, int64) +ret +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void C2::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public GC2`1 +implements class GI2`1 +{ +.method private newslot virtual final instance void 'GI2.perturb_interface_offset1'() +{ +.override method instance void class GI2`1::perturb_interface_offset1() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset2'() +{ +.override method instance void class GI2`1::perturb_interface_offset2() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset3'() +{ +.override method instance void class GI2`1::perturb_interface_offset3() +ret +} +.method private newslot virtual final instance void 'GI2.perturb_interface_offset4'() +{ +.override method instance void class GI2`1::perturb_interface_offset4() +ret +} +.method public static void check(int64 stack1, int64 stack2) +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.F2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::F2(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::F1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.GF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::GF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 + +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::GF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method private newslot virtual final instance void 'GI2.HF2'(class GI1`1 i1, int64 counter, int64 initial_stack, int64 current_stack) noinlining +{ +.override method instance void class GI2`1::HF2<[1]>(class GI1`1, int64, int64, int64) + +ldarg 2 +ldc.i8 0 +ble IL_0014 +ldarg 1 +ldarg 0 +ldarg 2 +ldc.i8 1 +sub +ldarg 3 +ldarga counter +conv.u +conv.u8 +tail. +callvirt instance void class GI1`1::HF1(class GI2`1, int64, int64, int64) +ret + +IL_0014: +ldarga counter +conv.u +conv.u8 +ldarg current_stack +call void class GC2`1::check(int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public A +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public B +{ +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class interface private abstract IC +{ +.method public newslot abstract virtual instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +} +.method public newslot abstract virtual instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +} +} +.class public C +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C1::check(int64, int64) +ret +} + +.method public instance !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 1 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B C::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 C::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] C::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] C::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void C::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 C::cast1(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class public D`1 +{ +.method public static void check(int64 stack1, int64 stack2) noinlining +{ +ldarg 0 +ldarg 1 +call void C::check(int64, int64) +ret +} +.method public static !!T cast1(object o, int64 counter, int64 stack) noinlining +{ +ldarg 1 +ldc.i8 0 +ble IL_0012 + +ldarg 0 +ldarg 1 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret + +IL_0012: +ldarga counter +conv.u +conv.u8 +ldarg 2 +call void class D`1::check(int64, int64) +ldarg 0 +unbox.any !!T +ret +} +.method public instance class B cast2(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B class D`1::cast2(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T cast3(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance class B[] cast4(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance class B[] class D`1::cast4(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !!T[] cast5(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !!0[] class D`1::cast5(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast6(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast6(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1 cast7(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0 class D`1::cast7(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call !!0 class D`1::cast1(object, int64, int64) +ret +} +.method public instance !T1[] cast8(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast8(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance !T1[] cast9(object o, int64 counter, int64 stack) noinlining +{ +ldarg 2 +ldc.i8 0 +ble IL_0013 + +ldarg 0 +ldarg 1 +ldarg 2 +ldc.i8 1 +sub +ldarga counter +conv.u +conv.u8 +tail. +call instance !0[] class D`1::cast9(object, int64, int64) +ret + +IL_0013: +ldarga counter +conv.u +conv.u8 +ldarg 3 +call void class D`1::check(int64, int64) +ldarg 0 +ldarg 1 +ldc.i8 99 +ldc.i8 0 +tail. +call instance !!0 class D`1::cast3(object, int64, int64) +ret +} +.method public instance void .ctor() +{ +ldarg 0 +call instance void [mscorlib]System.Object::.ctor() +ret +} +} +.class private C3 +{ +.method static void print() noinlining +{ +ret +} + +.method static void print(object o) noinlining +{ +call void C3::print() +ret +} + +.method public static void Main(string[] args) noinlining +{ +.entrypoint +.locals init ( + class D`1 V_0, + class D`1 V_1, + class D`1 V_2, + class C V_3, + class B V_4, + class B[] V_5, + int64 V_6, + class I1 V_7, + class I2 V_8, + int64 V_9, + class GI1`1 V_10, + class GI1`1 V_11, + class GI1`1 V_12, + class GI1`1 V_13, + class GI1`1 V_14, + class GI1`1 V_15, + class GI2`1 V_16, + class GI2`1 V_17, + class GI2`1 V_18, + class GI2`1 V_19, + class GI2`1 V_20, + class GI2`1 V_21, + int64 depth + ) + +ldc.i8 9999999 +stloc depth +newobj instance void class D`1::.ctor() +stloc 0 +newobj instance void class D`1::.ctor() +stloc 1 +newobj instance void class D`1::.ctor() +stloc 2 +newobj instance void C::.ctor() +stloc 3 +newobj instance void B::.ctor() +stloc V_4 +ldc.i8 1 +newarr B +stloc V_5 + +newobj instance void C1::.ctor() +stloc V_7 +newobj instance void C2::.ctor() +stloc V_8 + +newobj instance void class GC1`1::.ctor() +stloc V_10 +newobj instance void class GC1`1::.ctor() +stloc V_11 +newobj instance void class GC1`1::.ctor() +stloc V_12 +newobj instance void class GC1`1::.ctor() +stloc V_13 +newobj instance void class GC1`1::.ctor() +stloc V_14 +newobj instance void class GC1`1::.ctor() +stloc V_15 +newobj instance void class GC2`1::.ctor() +stloc V_16 +newobj instance void class GC2`1::.ctor() +stloc V_17 +newobj instance void class GC2`1::.ctor() +stloc V_18 +newobj instance void class GC2`1::.ctor() +stloc V_19 +newobj instance void class GC2`1::.ctor() +stloc V_20 +newobj instance void class GC2`1::.ctor() +stloc V_21 + + +ldloc 1 +ldloc V_5 +ldloc depth +ldc.i8 0 +callvirt instance !0[] class D`1::cast8(object, int64, int64) +call void C3::print(object) + + +ldsfld int64 C1::errors +dup +stloc V_9 +brfalse IL_0591 + +ldstr "failure {0}" +br IL_0596 + +IL_0591: +ldstr "success" + +IL_0596: +ldloc V_9 +box [mscorlib]System.Int64 +call void [mscorlib]System.Console::WriteLine(string, object) +ldloc V_9 +conv.i4 +call void [mscorlib]System.Environment::Exit(int32) +ret +} + +} diff --git a/mono/tests/tailcall/split-fsharp.cpp b/mono/tests/tailcall/split-fsharp.cpp new file mode 100644 index 0000000000..35e0900141 --- /dev/null +++ b/mono/tests/tailcall/split-fsharp.cpp @@ -0,0 +1,175 @@ +// +// This program is used to split fsharp-deeptail.il into separate tests. +// +// Algorithm is just to split on the newline delimited ldstr opcodes +// within the main@ function, and generate file names from the ldstr, +// replacing special characters with underscores. +// +// git rm fsharp-deeptail-* +// rm fsharp-deeptail-* +// g++ split-fsharp.cpp && ./a.out < fsharp-deeptail.il +// git add fsharp-deeptail/* +// +// Note This is valid C++98 for use with older compilers, where C++11 would be desirable. +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; +#include +#ifdef _WIN32 +#include +#endif + +typedef vector strings_t; + +struct test_t +{ + string name; + strings_t content; +}; + +typedef vector tests_t; + +static void +CreateDir (const char *a) +{ +#ifdef _WIN32 + _mkdir (a); +#else + mkdir (a, 0777); +#endif +} + +int main () +{ + typedef set names_t; // consider map> tests; + names_t names; + string line; + strings_t prefix; + tests_t tests; + test_t test_dummy; + test_t *test = &test_dummy; + strings_t suffix; + + while (getline (cin, line)) + { + prefix.push_back (line); + if (line == ".entrypoint") + break; + } + + CreateDir ("tailcall"); + CreateDir ("tailcall/fsharp-deeptail"); + + const string marker_ldstr = "ldstr \""; // start of each test, and contains name + const string marker_ldc_i4_0 = "ldc.i4.0"; // start of suffix + + while (getline (cin, line)) + { + // tests are delimited by empty lines + if (line.length() == 0) + { + if (tests.size() && tests.back().name.length()) + { + names_t::iterator a = names.find(tests.back().name); + if (a != names.end()) + { + fprintf(stderr, "duplicate %s\n", a->c_str()); + exit(1); + } + names.insert(names.end(), tests.back().name); + } + tests.resize (tests.size () + 1); + test = &tests.back (); + assert (getline (cin, line)); + // tests start with ldstr + //printf("%s\n", line.c_str()); + const bool ldstr = line.length () >= marker_ldstr.length () && memcmp(line.c_str (), marker_ldstr.c_str (), marker_ldstr.length ()) == 0; + const bool ldc_i4_0 = line.length () >= marker_ldc_i4_0.length () && memcmp(line.c_str (), marker_ldc_i4_0.c_str (), marker_ldc_i4_0.length ()) == 0; + assert (ldstr || ldc_i4_0); + if (ldc_i4_0) + { + suffix.push_back (line); + break; + } + string name1 = &line [marker_ldstr.length ()]; + *strchr ((char*)name1.c_str (), '"') = 0; // truncate at quote + test->name = name1.c_str (); +#if 1 + // Change some chars to underscores. + for (string::iterator c = test->name.begin(); c != test->name.end(); ++c) + if (strchr("<>", *c)) + *c = '_'; +#else + // remove some chars + while (true) + { + size_t c; + if ((c = test->name.find('<')) != string::npos) + { + test->name = test->name.replace(c, 1, "_"); + continue; + } + if ((c = test->name.find('>')) != string::npos) + { + test->name = test->name.replace(c, 1, "_"); + continue; + } + if ((c = test->name.find("..")) != string::npos) + { + test->name = test->name.replace(c, 2, "_"); + continue; + } + if ((c = test->name.find("__")) != string::npos) + { + test->name = test->name.replace(c, 2, "_"); + continue; + } + if ((c = test->name.find('.')) != string::npos) + { + test->name = test->name.replace(c, 1, "_"); + continue; + } + break; + } +#endif + //printf("%s\n", test->name.c_str()); + } + test->content.push_back (line); + } + while (getline (cin, line)) + suffix.push_back (line); + + for (tests_t::const_iterator t = tests.begin(); t != tests.end(); ++t) + { + if (t->name.length() == 0) + continue; + //printf("%s\n", t->name.c_str()); + FILE* output = fopen(("tailcall/fsharp-deeptail/" + t->name + ".il").c_str(), "w"); + for (strings_t::const_iterator a = prefix.begin(); a != prefix.end(); ++a) + fprintf(output, "%s\n", a->c_str()); + fputs("\n", output); + for (strings_t::const_iterator a = t->content.begin(); a != t->content.end(); ++a) + fprintf(output, "%s\n", a->c_str()); + fputs("\n", output); + for (strings_t::const_iterator a = suffix.begin(); a != suffix.end(); ++a) + fprintf(output, "%s\n", a->c_str()); + fclose(output); + } +#if 0 + for (names_t::const_iterator t = names.begin(); t != names.end(); ++t) + fputs(("\ttailcall/fsharp-deeptail/" + *t + ".il \\\n").c_str(), stdout); + for (names_t::const_iterator t = names.begin(); t != names.end(); ++t) + fputs(("INTERP_DISABLED_TESTS += tailcall/fsharp-deeptail/" + *t + ".exe\n").c_str(), stdout); + for (names_t::const_iterator t = names.begin(); t != names.end(); ++t) + fputs(("#PLATFORM_DISABLED_TESTS += tailcall/fsharp-deeptail/" + *t + ".exe\n").c_str(), stdout); + for (names_t::const_iterator t = names.begin(); t != names.end(); ++t) + fputs(("PLATFORM_DISABLED_TESTS += tailcall/fsharp-deeptail/" + *t + ".exe\n").c_str(), stdout); +#endif +} diff --git a/mono/tests/testing_gac/Makefile.in b/mono/tests/testing_gac/Makefile.in index 077bfc5d2d..08bf5b0731 100644 --- a/mono/tests/testing_gac/Makefile.in +++ b/mono/tests/testing_gac/Makefile.in @@ -153,6 +153,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -168,6 +170,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -208,11 +211,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/tests/thread7.cs b/mono/tests/thread7.cs new file mode 100644 index 0000000000..80ee63921b --- /dev/null +++ b/mono/tests/thread7.cs @@ -0,0 +1,57 @@ +// +// Subset of thread6.cs, just to watch for the hang at end. +// Note this test does not indicate success or failure well, +// it just runs quickly or slowly. +// +using System; +using System.Threading; + +public class Tests { + + public static int Main() { + return test_0_regress_4413(); + } + + public static int test_0_regress_4413 () { + // Check that thread abort exceptions originating in another thread are not automatically rethrown + object o = new object (); + Thread t = null; + bool waiting = false; + Action a = delegate () { + t = Thread.CurrentThread; + while (true) { + lock (o) { + if (waiting) { + Monitor.Pulse (o); + break; + } + } + + Thread.Sleep (10); + } + while (true) { + Thread.Sleep (1000); + } + }; + var ar = a.BeginInvoke (null, null); + lock (o) { + waiting = true; + Monitor.Wait (o); + } + + t.Abort (); + + try { + try { + a.EndInvoke (ar); + } catch (ThreadAbortException) { + } + } catch (ThreadAbortException) { + // This will fail + Thread.ResetAbort (); + return 1; + } + + return 0; + } +} diff --git a/mono/tests/verbose.cs b/mono/tests/verbose.cs new file mode 100644 index 0000000000..2c609567db --- /dev/null +++ b/mono/tests/verbose.cs @@ -0,0 +1,157 @@ +using System; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Text.RegularExpressions; + +public class MainClass +{ + class TestCase + { + public string MethodSpec; + public string[] ExpectedMethods; + } + + public static int Main (string[] args) + { + var testCase = new TestCase { + MethodSpec = "*:Method", + ExpectedMethods = new[] { + "N1.Test:Method ()", + "N2.Test:Method ()", + "N2.Test:Method (int)", + "N2.Test:Method (int,string[])", + }, + }; + if (!RunTest (testCase)) + return 1; + + testCase = new TestCase { + MethodSpec = "*:Method (int)", + ExpectedMethods = new[] { + "N2.Test:Method (int)", + }, + }; + if (!RunTest (testCase)) + return 2; + + testCase = new TestCase + { + MethodSpec = "N1.Test:Method", + ExpectedMethods = new[] { + "N1.Test:Method ()", + }, + }; + if (!RunTest (testCase)) + return 3; + + testCase = new TestCase { + MethodSpec = "Test:Method", + ExpectedMethods = new[] { + "N1.Test:Method ()", + "N2.Test:Method ()", + "N2.Test:Method (int)", + "N2.Test:Method (int,string[])", + }, + }; + if (!RunTest (testCase)) + return 4; + + testCase = new TestCase { + MethodSpec = "*:Method(int,string[])", + ExpectedMethods = new[] { + "N2.Test:Method (int,string[])", + }, + }; + if (!RunTest (testCase)) + return 5; + + testCase = new TestCase { + MethodSpec = "*:Method();N2.*:Method(int,string[])", + ExpectedMethods = new[] { + "N1.Test:Method ()", + "N2.Test:Method ()", + "N2.Test:Method (int,string[])", + }, + }; + if (!RunTest (testCase)) + return 6; + + return 0; + } + + static bool RunTest (TestCase testCase) + { + var thisProcess = typeof (MainClass).Assembly.Location; + + var process = StartCompileAssemblyProcess (thisProcess, testCase.MethodSpec); + var output = process.StandardOutput.ReadToEnd (); + process.WaitForExit (); + + var lines = output.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + foreach (var expectedMethod in testCase.ExpectedMethods) { + var sortedExpectedMethods = testCase.ExpectedMethods.OrderBy (x => x).ToArray (); + + var regex = new Regex ("converting method void (?.*)"); + var matches = regex.Matches (output); + var sortedJittedMethods = matches.Cast ().Select (x => x.Groups["methodName"]) + .SelectMany (x => x.Captures.Cast ()) + .Select (x => x.Value) + .OrderBy (x => x) + .ToArray (); + + if (sortedJittedMethods.Length != sortedExpectedMethods.Length) + return false; + + for (int i = 0; i < sortedJittedMethods.Length; ++i) { + if (sortedJittedMethods[i] != sortedExpectedMethods[i]) + return false; + } + + } + + return true; + } + + static Process StartCompileAssemblyProcess (string process, string methodSpec) + { + var psi = new ProcessStartInfo (process) { + UseShellExecute = false, + RedirectStandardOutput = true, + }; + psi.EnvironmentVariables["MONO_ENV_OPTIONS"] = "--compile-all"; + psi.EnvironmentVariables["MONO_VERBOSE_METHOD"] = methodSpec; + + return Process.Start (psi); + } +} + +namespace N1 +{ + public class Test + { + public static void Method () + { + } + } +} + +namespace N2 +{ + public class Test + { + public static void Method (int n) + { + } + + public static void Method () + { + } + + public static void Method (int n, string[] args) + { + } + } +} + + diff --git a/mono/unit-tests/Makefile.in b/mono/unit-tests/Makefile.in index d88d5016be..b42c8d0541 100644 --- a/mono/unit-tests/Makefile.in +++ b/mono/unit-tests/Makefile.in @@ -127,12 +127,10 @@ am__test_conc_hashtable_SOURCES_DIST = test-conc-hashtable.c @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@am_test_conc_hashtable_OBJECTS = test_conc_hashtable-test-conc-hashtable.$(OBJEXT) test_conc_hashtable_OBJECTS = $(am_test_conc_hashtable_OBJECTS) am__DEPENDENCIES_1 = -@LOADED_LLVM_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \ -@LOADED_LLVM_FALSE@ $(am__DEPENDENCIES_1) -am__DEPENDENCIES_3 = libtestlib.la $(am__DEPENDENCIES_1) $(glib_libs) \ - $(am__DEPENDENCIES_2) +am__DEPENDENCIES_2 = libtestlib.la $(am__DEPENDENCIES_1) $(glib_libs) \ + $(am__DEPENDENCIES_1) @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_conc_hashtable_DEPENDENCIES = \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_2) test_conc_hashtable_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(test_conc_hashtable_CFLAGS) $(CFLAGS) \ @@ -141,7 +139,7 @@ am__test_memfuncs_SOURCES_DIST = test-memfuncs.c @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@am_test_memfuncs_OBJECTS = test_memfuncs-test-memfuncs.$(OBJEXT) test_memfuncs_OBJECTS = $(am_test_memfuncs_OBJECTS) @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_memfuncs_DEPENDENCIES = \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_2) test_memfuncs_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_memfuncs_CFLAGS) \ $(CFLAGS) $(test_memfuncs_LDFLAGS) $(LDFLAGS) -o $@ @@ -156,7 +154,7 @@ am__test_mono_handle_SOURCES_DIST = test-mono-handle.c @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@am_test_mono_handle_OBJECTS = test_mono_handle-test-mono-handle.$(OBJEXT) test_mono_handle_OBJECTS = $(am_test_mono_handle_OBJECTS) @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_handle_DEPENDENCIES = \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_2) test_mono_handle_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(test_mono_handle_CFLAGS) $(CFLAGS) \ @@ -167,7 +165,7 @@ am__test_mono_linked_list_set_SOURCES_DIST = \ test_mono_linked_list_set_OBJECTS = \ $(am_test_mono_linked_list_set_OBJECTS) @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_linked_list_set_DEPENDENCIES = \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_2) test_mono_linked_list_set_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(test_mono_linked_list_set_CFLAGS) $(CFLAGS) \ @@ -176,7 +174,7 @@ am__test_mono_string_SOURCES_DIST = test-mono-string.c @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@am_test_mono_string_OBJECTS = test_mono_string-test-mono-string.$(OBJEXT) test_mono_string_OBJECTS = $(am_test_mono_string_OBJECTS) @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_string_DEPENDENCIES = \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_2) \ @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(mini_libs) \ @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(sgen_libs) test_mono_string_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ @@ -187,7 +185,7 @@ am__test_sgen_qsort_SOURCES_DIST = test-sgen-qsort.c @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@am_test_sgen_qsort_OBJECTS = test_sgen_qsort-test-sgen-qsort.$(OBJEXT) test_sgen_qsort_OBJECTS = $(am_test_sgen_qsort_OBJECTS) @CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_sgen_qsort_DEPENDENCIES = \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_2) test_sgen_qsort_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(test_sgen_qsort_CFLAGS) $(CFLAGS) $(test_sgen_qsort_LDFLAGS) \ @@ -500,6 +498,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -515,6 +515,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -555,11 +556,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/mono/unit-tests/test-mono-callspec.c b/mono/unit-tests/test-mono-callspec.c index df877210a4..a31fea84c1 100644 --- a/mono/unit-tests/test-mono-callspec.c +++ b/mono/unit-tests/test-mono-callspec.c @@ -183,7 +183,7 @@ main (void) mono_callspec_set_assembly(assembly); - prog_image = mono_assembly_get_image (assembly); + prog_image = mono_assembly_get_image_internal (assembly); prog_klass = test_mono_class_from_name (prog_image, "Baz", "Foo"); if (!prog_klass) { diff --git a/mono/utils/Makefile.am b/mono/utils/Makefile.am index 1bece61040..e7b6c2436a 100644 --- a/mono/utils/Makefile.am +++ b/mono/utils/Makefile.am @@ -2,7 +2,31 @@ include $(top_srcdir)/mk/common.mk noinst_LTLIBRARIES = libmonoutils.la -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS) +if ENABLE_LLVM + if INTERNAL_LLVM + llvm_config=$(monodir)/llvm/usr/bin/llvm-config + else + llvm_config=$(EXTERNAL_LLVM_CONFIG) + endif + + llvm_api_version_from_config=$(shell $(llvm_config) --mono-api-version 2>/dev/null) + llvm_api_version=$(shell if [ -z "$(llvm_api_version_from_config)" ]; then echo "0"; else echo "$(llvm_api_version_from_config)"; fi) + LLVM_CFLAGS=-DLLVM_API_VERSION=$(llvm_api_version) +endif + +if ENABLE_LLVM +if INTERNAL_LLVM +llvm_config=$(monodir)/llvm/usr/bin/llvm-config +else +llvm_config=$(EXTERNAL_LLVM_CONFIG) +endif + +llvm_api_version_from_config=$(shell $(llvm_config) --mono-api-version 2>/dev/null) +llvm_api_version=$(shell if [ -z "$(llvm_api_version_from_config)" ]; then echo "0"; else echo "$(llvm_api_version_from_config)"; fi) +LLVM_CFLAGS=-DLLVM_API_VERSION=$(llvm_api_version) +endif + +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS) $(LLVM_CFLAGS) if ENABLE_DTRACE @@ -50,6 +74,7 @@ monoutils_sources = \ mono-log-posix.c \ mono-log-android.c \ mono-log-darwin.c \ + mono-log-flight-recorder.c \ mono-merp.c \ mono-merp.h \ mono-state.h \ @@ -68,6 +93,8 @@ monoutils_sources = \ mono-mmap-windows-internals.h \ mono-os-mutex.h \ mono-os-mutex.c \ + mono-flight-recorder.h \ + mono-flight-recorder.c \ mono-os-wait.h \ mono-coop-mutex.h \ mono-once.h \ @@ -152,6 +179,8 @@ monoutils_sources = \ mono-threads-api.h \ mono-threads-coop.c \ mono-threads-coop.h \ + mono-utility-thread.c \ + mono-utility-thread.h \ mono-tls.h \ mono-tls.c \ mono-utils-debug.c \ @@ -179,7 +208,6 @@ monoutils_sources = \ mono-rand.c \ mono-rand-windows.c \ mono-rand.h \ - mono-rand-windows-internals.h \ memfuncs.c \ memfuncs.h \ parse.c \ @@ -275,6 +303,9 @@ libmonoutils_la_CFLAGS = $(JEMALLOC_CFLAGS) libmonoutils_la_LDFLAGS = $(JEMALLOC_LDFLAGS) libmonoutilsincludedir = $(includedir)/mono-$(API_VER)/mono/utils +# These are public headers. +# They should not use glib.h, G_BEGIN_DECLS, guint, etc. +# They should be wrapped in MONO_BEGIN_DECLS / MONO_END_DECLS. libmonoutilsinclude_HEADERS = \ mono-logger.h \ mono-error.h \ @@ -290,3 +321,5 @@ DIST_SUBDIRS = jemalloc if MONO_JEMALLOC_ENABLED SUBDIRS = jemalloc endif + +CFLAGS := $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @CXX_ADD_CFLAGS@ diff --git a/mono/utils/Makefile.in.REMOVED.git-id b/mono/utils/Makefile.in.REMOVED.git-id index 261abb182c..d99cf04024 100644 --- a/mono/utils/Makefile.in.REMOVED.git-id +++ b/mono/utils/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -38cb4afb8e19f45b1895afcf74545902baab7d5b \ No newline at end of file +3823cf113bebc2c58050be45202d28aff1d460eb \ No newline at end of file diff --git a/mono/utils/checked-build.c b/mono/utils/checked-build.c index 0e643404ef..a7e5ef8fe5 100644 --- a/mono/utils/checked-build.c +++ b/mono/utils/checked-build.c @@ -308,7 +308,7 @@ checked_build_thread_transition (const char *transition, void *info, int from_st } void -mono_fatal_with_history (const char *msg, ...) +mono_fatal_with_history (const char * volatile msg, ...) { GString* err = g_string_sized_new (100); diff --git a/mono/utils/gc_wrapper.h b/mono/utils/gc_wrapper.h index 0bc7a45d22..da17b3eaf7 100644 --- a/mono/utils/gc_wrapper.h +++ b/mono/utils/gc_wrapper.h @@ -26,8 +26,9 @@ * We had to fix a bug with include order in libgc, so only do * it if it is the included one. */ +#ifndef HOST_WIN32 // FIXME? +# if defined(MONO_KEYWORD_THREAD) && !defined(__powerpc__) -# if defined(HAVE_KW_THREAD) && !defined(__powerpc__) /* The local alloc stuff is in pthread_support.c, but solaris uses solaris_threads.c */ /* It is also disabled on solaris/x86 by libgc/configure.ac */ /* @@ -38,6 +39,7 @@ # define GC_REDIRECT_TO_LOCAL # endif # endif +#endif // HOST_WIN32 # define GC_INSIDE_DLL # include diff --git a/mono/utils/jemalloc/Makefile.in b/mono/utils/jemalloc/Makefile.in index bb9bf36804..d4df85308f 100644 --- a/mono/utils/jemalloc/Makefile.in +++ b/mono/utils/jemalloc/Makefile.in @@ -158,6 +158,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -173,6 +175,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -213,11 +216,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ @@ -625,7 +624,7 @@ reset-$(1):: echo "*** git fetch `basename $$($(2)_PATH)`" && (cd $($(2)_PATH) && git fetch); \ fi; \ else \ - echo "*** git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2))" && (cd `dirname $($(2)_PATH)` && git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2)) || exit 1 ); \ + echo "*** git clone $(MODULE_$(2)) -b $(NEEDED_$(2)_BRANCH) --recursive $(DIRECTORY_$(2))" && (cd `dirname $($(2)_PATH)` && git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2)) || exit 1 ); \ fi @if test x$$(IGNORE_$(2)_VERSION) = "x"; then \ echo "*** [$(1)] git checkout -f" $(NEEDED_$(2)_BRANCH) && (cd $($(2)_PATH) ; git checkout -f $(NEEDED_$(2)_BRANCH) || git checkout -f -b $($(2)_BRANCH_AND_REMOTE)); \ diff --git a/mono/utils/lock-free-alloc.c b/mono/utils/lock-free-alloc.c index 4f154d2a50..18ed45656a 100644 --- a/mono/utils/lock-free-alloc.c +++ b/mono/utils/lock-free-alloc.c @@ -142,6 +142,7 @@ alloc_sb (Descriptor *desc) mono_valloc (NULL, desc->block_size, prot_flags_for_activate (TRUE), desc->heap->account_type) : mono_valloc_aligned (desc->block_size, desc->block_size, prot_flags_for_activate (TRUE), desc->heap->account_type); + g_assertf (sb_header, "Failed to allocate memory for the lock free allocator"); g_assert (sb_header == sb_header_for_addr (sb_header, desc->block_size)); *(Descriptor**)sb_header = desc; @@ -181,6 +182,7 @@ desc_alloc (MonoMemAccountType type) int i; desc = (Descriptor *) mono_valloc (NULL, desc_size * NUM_DESC_BATCH, prot_flags_for_activate (TRUE), type); + g_assertf (desc, "Failed to allocate memory for the lock free allocator"); /* Organize into linked list. */ d = desc; diff --git a/mono/utils/mono-codeman.c b/mono/utils/mono-codeman.c index 4738808880..698a21f670 100644 --- a/mono/utils/mono-codeman.c +++ b/mono/utils/mono-codeman.c @@ -63,7 +63,7 @@ static MonoCodeManagerCallbacks code_manager_callbacks; #define ARCH_MAP_FLAGS 0 #endif -#define MONO_PROT_RWX (MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_EXEC) +#define MONO_PROT_RWX (MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_EXEC|MONO_MMAP_JIT) typedef struct _CodeChunck CodeChunk; diff --git a/mono/utils/mono-compiler.h b/mono/utils/mono-compiler.h index 772b1b4b9b..92d33b852d 100644 --- a/mono/utils/mono-compiler.h +++ b/mono/utils/mono-compiler.h @@ -89,7 +89,7 @@ typedef SSIZE_T ssize_t; #if !defined(_MSC_VER) && !defined(HOST_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN #if MONO_LLVM_LOADED -#define MONO_LLVM_INTERNAL MONO_API +#define MONO_LLVM_INTERNAL MONO_API_NO_EXTERN_C #else #define MONO_LLVM_INTERNAL #endif @@ -100,6 +100,9 @@ typedef SSIZE_T ssize_t; /* Used to mark internal functions used by the profiler modules */ #define MONO_PROFILER_API MONO_API +/* Used to mark internal functions used by the CoreFX PAL library */ +#define MONO_PAL_API MONO_API + #ifdef __GNUC__ #define MONO_ALWAYS_INLINE __attribute__ ((__always_inline__)) #elif defined(_MSC_VER) diff --git a/mono/utils/mono-conc-hashtable.c b/mono/utils/mono-conc-hashtable.c index bfb94b7af9..6d6012453c 100644 --- a/mono/utils/mono-conc-hashtable.c +++ b/mono/utils/mono-conc-hashtable.c @@ -27,11 +27,34 @@ typedef struct { key_value_pair *kvs; } conc_table; +/* +Design notes: + +This is a single-writer, lock-free reader hash table. It's implemented using classical linear open addressing. + +Reads are made concurrent by employing hazzard pointers to avoid dangling pointer and by carefully coordinating +table access between writer and readers - writer stores value before key and readers checks keys before values. + +External locking/synchronization is required by all write operations. Additionally, this DS don't try to provide +any coordination/guarantee of key/values liveness outside of this DS. This means that a search will see dangling +memory if a concurrent thread removes&free after the search succeeded. + +Deletion is done using tombstones, which increase the number of non-null elements and can lead to slow or infinite +searches as null keys are the termination condition used by lookup. We handle it by rehashing in case the number of +null values drops below what the load factor allows. + +Possible improvements: + +Experiment with KVM relocation during lookup as would reduce search length. The trick is coordinate which thread +won a tomstone and which thread won the relation of a given key. + +*/ struct _MonoConcurrentHashTable { volatile conc_table *table; /* goes to HP0 */ GHashFunc hash_func; GEqualFunc equal_func; - int element_count; + int element_count; //KVP + tombstones + int tombstone_count; //just tombstones int overflow_count; GDestroyNotify key_destroy_func; GDestroyNotify value_destroy_func; @@ -92,10 +115,10 @@ insert_one_local (conc_table *table, GHashFunc hash_func, gpointer key, gpointer /* LOCKING: Must be called holding hash_table->mutex */ static void -expand_table (MonoConcurrentHashTable *hash_table) +rehash_table (MonoConcurrentHashTable *hash_table, int multiplier) { conc_table *old_table = (conc_table*)hash_table->table; - conc_table *new_table = conc_table_new (old_table->table_size * 2); + conc_table *new_table = conc_table_new (old_table->table_size * multiplier); key_value_pair *kvs = old_table->kvs; int i; @@ -109,6 +132,19 @@ expand_table (MonoConcurrentHashTable *hash_table) conc_table_lf_free (old_table); } +static void +check_table_size (MonoConcurrentHashTable *hash_table) +{ + if (hash_table->element_count >= hash_table->overflow_count) { + //if we have more tombstones than KVP we rehash to the same size + if (hash_table->tombstone_count > hash_table->element_count / 2) + rehash_table (hash_table, 1); + else + rehash_table (hash_table, 2); + } +} + + MonoConcurrentHashTable* mono_conc_hashtable_new (GHashFunc hash_func, GEqualFunc key_equal_func) @@ -245,13 +281,14 @@ mono_conc_hashtable_remove (MonoConcurrentHashTable *hash_table, gpointer key) kvs [i].value = NULL; mono_memory_barrier (); kvs [i].key = TOMBSTONE; - --hash_table->element_count; + ++hash_table->tombstone_count; if (hash_table->key_destroy_func != NULL) (*hash_table->key_destroy_func) (key); if (hash_table->value_destroy_func != NULL) (*hash_table->value_destroy_func) (value); + check_table_size (hash_table); return value; } i = (i + 1) & table_mask; @@ -269,11 +306,14 @@ mono_conc_hashtable_remove (MonoConcurrentHashTable *hash_table, gpointer key) kvs [i].value = NULL; mono_memory_barrier (); kvs [i].key = TOMBSTONE; + ++hash_table->tombstone_count; if (hash_table->key_destroy_func != NULL) (*hash_table->key_destroy_func) (old_key); if (hash_table->value_destroy_func != NULL) (*hash_table->value_destroy_func) (value); + + check_table_size (hash_table); return value; } @@ -298,8 +338,7 @@ mono_conc_hashtable_insert (MonoConcurrentHashTable *hash_table, gpointer key, g hash = mix_hash (hash_table->hash_func (key)); - if (hash_table->element_count >= hash_table->overflow_count) - expand_table (hash_table); + check_table_size (hash_table); table = (conc_table*)hash_table->table; kvs = table->kvs; @@ -313,7 +352,11 @@ mono_conc_hashtable_insert (MonoConcurrentHashTable *hash_table, gpointer key, g /* The write to values must happen after the write to keys */ mono_memory_barrier (); kvs [i].key = key; - ++hash_table->element_count; + if (kvs [i].key == TOMBSTONE) + --hash_table->tombstone_count; + else + ++hash_table->element_count; + return NULL; } if (key == kvs [i].key) { @@ -330,7 +373,10 @@ mono_conc_hashtable_insert (MonoConcurrentHashTable *hash_table, gpointer key, g /* The write to values must happen after the write to keys */ mono_memory_barrier (); kvs [i].key = key; - ++hash_table->element_count; + if (kvs [i].key == TOMBSTONE) + --hash_table->tombstone_count; + else + ++hash_table->element_count; return NULL; } if (equal (key, kvs [i].key)) { @@ -379,8 +425,9 @@ mono_conc_hashtable_foreach_steal (MonoConcurrentHashTable *hash_table, GHRFunc kvs [i].value = NULL; mono_memory_barrier (); kvs [i].key = TOMBSTONE; - --hash_table->element_count; + ++hash_table->tombstone_count; } } } + check_table_size (hash_table); } diff --git a/mono/utils/mono-coop-mutex.h b/mono/utils/mono-coop-mutex.h index 5f309d7e65..d10f91e5e0 100644 --- a/mono/utils/mono-coop-mutex.h +++ b/mono/utils/mono-coop-mutex.h @@ -109,13 +109,27 @@ mono_coop_cond_timedwait (MonoCoopCond *cond, MonoCoopMutex *mutex, guint32 time static inline void mono_coop_cond_signal (MonoCoopCond *cond) { + /* + * On glibc using NTPL (ie Linux with an underlying futex), signaling a + * condition variable can block in the __condvar_quiesce_and_switch_g1 + * operation. So switch to GC Safe mode here. + */ + MONO_ENTER_GC_SAFE; mono_os_cond_signal (&cond->c); + MONO_EXIT_GC_SAFE; } static inline void mono_coop_cond_broadcast (MonoCoopCond *cond) { + /* + * On glibc using NTPL (ie Linux with an underlying futex), signaling a + * condition variable can block in the __condvar_quiesce_and_switch_g1 + * operation. So switch to GC Safe mode here. + */ + MONO_ENTER_GC_SAFE; mono_os_cond_broadcast (&cond->c); + MONO_EXIT_GC_SAFE; } G_END_DECLS diff --git a/mono/utils/mono-dl.c b/mono/utils/mono-dl.c index c605ce6e41..ab7acf0b61 100644 --- a/mono/utils/mono-dl.c +++ b/mono/utils/mono-dl.c @@ -13,6 +13,7 @@ #include "mono/utils/mono-dl.h" #include "mono/utils/mono-embed.h" #include "mono/utils/mono-path.h" +#include "mono/utils/mono-threads-api.h" #include #include @@ -337,10 +338,10 @@ mono_dl_build_path (const char *directory, const char *name, void **iter) MonoDlFallbackHandler * mono_dl_fallback_register (MonoDlFallbackLoad load_func, MonoDlFallbackSymbol symbol_func, MonoDlFallbackClose close_func, void *user_data) { - MonoDlFallbackHandler *handler; - - g_return_val_if_fail (load_func != NULL, NULL); - g_return_val_if_fail (symbol_func != NULL, NULL); + MonoDlFallbackHandler *handler = NULL; + MONO_ENTER_GC_UNSAFE; + if (load_func == NULL || symbol_func == NULL) + goto leave; handler = g_new (MonoDlFallbackHandler, 1); handler->load_func = load_func; @@ -350,6 +351,8 @@ mono_dl_fallback_register (MonoDlFallbackLoad load_func, MonoDlFallbackSymbol sy fallback_handlers = g_slist_prepend (fallback_handlers, handler); +leave: + MONO_EXIT_GC_UNSAFE; return handler; } diff --git a/mono/utils/mono-error-internals.h b/mono/utils/mono-error-internals.h index 2baacc2f73..97360549d2 100644 --- a/mono/utils/mono-error-internals.h +++ b/mono/utils/mono-error-internals.h @@ -164,7 +164,10 @@ void mono_error_set_out_of_memory (MonoError *error, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(2,3); void -mono_error_set_argument (MonoError *error, const char *argument, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4); +mono_error_set_argument_format (MonoError *error, const char *argument, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4); + +void +mono_error_set_argument (MonoError *error, const char *argument, const char *msg); void mono_error_set_argument_null (MonoError *oerror, const char *argument, const char *msg_format, ...) MONO_ATTR_FORMAT_PRINTF(3,4); diff --git a/mono/utils/mono-error.c b/mono/utils/mono-error.c index 74fa559658..e5b8622256 100644 --- a/mono/utils/mono-error.c +++ b/mono/utils/mono-error.c @@ -484,7 +484,7 @@ mono_error_set_out_of_memory (MonoError *oerror, const char *msg_format, ...) } void -mono_error_set_argument (MonoError *oerror, const char *argument, const char *msg_format, ...) +mono_error_set_argument_format (MonoError *oerror, const char *argument, const char *msg_format, ...) { MonoErrorInternal *error = (MonoErrorInternal*)oerror; mono_error_prepare (error); @@ -495,6 +495,18 @@ mono_error_set_argument (MonoError *oerror, const char *argument, const char *ms set_error_message (); } +void +mono_error_set_argument (MonoError *oerror, const char *argument, const char *msg) +{ + MonoErrorInternal *error = (MonoErrorInternal*)oerror; + mono_error_prepare (error); + + error->error_code = MONO_ERROR_ARGUMENT; + error->first_argument = argument; + if (msg && msg [0] && !(error->full_message = g_strdup (msg))) + error->flags |= MONO_ERROR_INCOMPLETE; +} + void mono_error_set_argument_null (MonoError *oerror, const char *argument, const char *msg_format, ...) { @@ -524,23 +536,24 @@ mono_error_set_not_verifiable (MonoError *oerror, MonoMethod *method, const char /* Used by mono_error_prepare_exception - it sets its own error on mono_string_new_checked failure. */ -static MonoString* +static MonoStringHandle string_new_cleanup (MonoDomain *domain, const char *text) { - ERROR_DECL_VALUE (ignored_err); - MonoString *result = mono_string_new_checked (domain, text, &ignored_err); - mono_error_cleanup (&ignored_err); + ERROR_DECL (ignored_err); + MonoStringHandle result = mono_string_new_handle (domain, text, ignored_err); + mono_error_cleanup (ignored_err); return result; } -static MonoString* +static MonoStringHandle get_type_name_as_mono_string (MonoErrorInternal *error, MonoDomain *domain, MonoError *error_out) { - MonoString* res = NULL; + HANDLE_FUNCTION_ENTER (); + + MonoStringHandle res = NULL_HANDLE_STRING; if (error->type_name) { res = string_new_cleanup (domain, error->type_name); - } else { MonoClass *klass = get_class (error); if (klass) { @@ -551,43 +564,38 @@ get_type_name_as_mono_string (MonoErrorInternal *error, MonoDomain *domain, Mono } } } - if (!res) + if (MONO_HANDLE_IS_NULL (res)) mono_error_set_out_of_memory (error_out, "Could not allocate type name"); - return res; -} - -static void -set_message_on_exception (MonoException *exception, MonoErrorInternal *error, MonoError *error_out) -{ - MonoString *msg = string_new_cleanup (mono_domain_get (), error->full_message); - if (msg) - MONO_OBJECT_SETREF (exception, message, msg); - else - mono_error_set_out_of_memory (error_out, "Could not allocate exception object"); + HANDLE_FUNCTION_RETURN_REF (MonoString, res); } static MonoExceptionHandle mono_error_prepare_exception_handle (MonoError *oerror, MonoError *error_out) // Can fail with out-of-memory { - return MONO_HANDLE_NEW (MonoException, mono_error_prepare_exception (oerror, error_out)); + HANDLE_FUNCTION_ENTER (); + MonoExceptionHandle ex = MONO_HANDLE_NEW (MonoException, mono_error_prepare_exception (oerror, error_out)); + HANDLE_FUNCTION_RETURN_REF (MonoException, ex); } /*Can fail with out-of-memory*/ MonoException* mono_error_prepare_exception (MonoError *oerror, MonoError *error_out) { + HANDLE_FUNCTION_ENTER (); + MonoErrorInternal *error = (MonoErrorInternal*)oerror; - MonoException* exception = NULL; - MonoString *assembly_name = NULL, *type_name = NULL; + MonoExceptionHandle exception = MONO_HANDLE_CAST (MonoException, mono_new_null ()); MonoDomain *domain = mono_domain_get (); + char *type_name = NULL; + char *message = NULL; error_init (error_out); switch (error->error_code) { case MONO_ERROR_NONE: - return NULL; + goto exit; case MONO_ERROR_MISSING_METHOD: exception = mono_corlib_exception_new_with_args ("System", "MissingMethodException", error->full_message, error->first_argument, error_out); @@ -602,10 +610,13 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out) exception = mono_corlib_exception_new_with_args ("System", "MissingFieldException", error->full_message, error->first_argument, error_out); break; case MONO_ERROR_MEMBER_ACCESS: - exception = mono_exception_from_name_msg (mono_defaults.corlib, "System", "MemberAccessException", error->full_message); + exception = mono_exception_new_by_name_msg (mono_defaults.corlib, "System", "MemberAccessException", error->full_message, error_out); break; - case MONO_ERROR_TYPE_LOAD: + case MONO_ERROR_TYPE_LOAD: { + MonoStringHandle assembly_name; + MonoStringHandle type_name; + if ((error->type_name && error->assembly_name) || error->exn.klass) { type_name = get_type_name_as_mono_string (error, domain, error_out); if (!mono_error_ok (error_out)) @@ -613,88 +624,97 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out) if (error->assembly_name) { assembly_name = string_new_cleanup (domain, error->assembly_name); - if (!assembly_name) { + if (MONO_HANDLE_IS_NULL (assembly_name)) { mono_error_set_out_of_memory (error_out, "Could not allocate assembly name"); break; } } else { - assembly_name = mono_string_empty (domain); + assembly_name = mono_string_empty_handle (domain); } exception = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", "TypeLoadException", type_name, assembly_name, error_out); - if (exception && error->full_message != NULL && strcmp (error->full_message, "")) - set_message_on_exception (exception, error, error_out); + if (!MONO_HANDLE_IS_NULL (exception)) { + const char *full_message = error->full_message; + if (full_message && full_message [0]) { + MonoStringHandle msg = string_new_cleanup (mono_domain_get (), full_message); + if (!MONO_HANDLE_IS_NULL (msg)) + MONO_HANDLE_SET (exception, message, msg); + else + mono_error_set_out_of_memory (error_out, "Could not allocate exception object"); + } + } } else { - exception = mono_exception_from_name_msg (mono_defaults.corlib, "System", "TypeLoadException", error->full_message); + exception = mono_exception_new_by_name_msg (mono_defaults.corlib, "System", "TypeLoadException", error->full_message, error_out); } - break; + } + break; case MONO_ERROR_OUT_OF_MEMORY: if (domain) - exception = domain->out_of_memory_ex; - if (!exception) - exception = mono_get_exception_out_of_memory (); + exception = MONO_HANDLE_NEW (MonoException, domain->out_of_memory_ex); + if (MONO_HANDLE_IS_NULL (exception)) + exception = mono_get_exception_out_of_memory_handle (); break; case MONO_ERROR_ARGUMENT: - exception = mono_get_exception_argument (error->first_argument, error->full_message); + exception = mono_exception_new_argument (error->first_argument, error->full_message, error_out); break; case MONO_ERROR_ARGUMENT_NULL: - exception = mono_get_exception_argument_null (error->first_argument); + exception = mono_exception_new_argument_null (error->first_argument, error_out); break; - case MONO_ERROR_NOT_VERIFIABLE: { - char *type_name = NULL, *message; + case MONO_ERROR_NOT_VERIFIABLE: if (error->exn.klass) { type_name = mono_type_get_full_name (error->exn.klass); - if (!type_name) { - mono_error_set_out_of_memory (error_out, "Could not allocate message"); - break; - } + if (!type_name) + goto out_of_memory; } message = g_strdup_printf ("Error in %s:%s %s", type_name, error->member_name, error->full_message); - if (!message) { - g_free (type_name); - mono_error_set_out_of_memory (error_out, "Could not allocate message"); - break; - } - exception = mono_exception_from_name_msg (mono_defaults.corlib, "System.Security", "VerificationException", message); - g_free (message); - g_free (type_name); + if (!message) + goto out_of_memory; + exception = mono_exception_new_by_name_msg (mono_defaults.corlib, "System.Security", "VerificationException", message, error_out); break; - } + case MONO_ERROR_GENERIC: if (!error->exception_name_space || !error->exception_name) mono_error_set_execution_engine (error_out, "MonoError with generic error but no exception name was supplied"); else - exception = mono_exception_from_name_msg (mono_defaults.corlib, error->exception_name_space, error->exception_name, error->full_message); + exception = mono_exception_new_by_name_msg (mono_defaults.corlib, error->exception_name_space, error->exception_name, error->full_message, error_out); break; case MONO_ERROR_EXCEPTION_INSTANCE: - exception = (MonoException*) mono_gchandle_get_target (error->exn.instance_handle); + exception = MONO_HANDLE_CAST (MonoException, mono_gchandle_get_target_handle (error->exn.instance_handle)); break; case MONO_ERROR_CLEANUP_CALLED_SENTINEL: mono_error_set_execution_engine (error_out, "MonoError reused after mono_error_cleanup"); break; - case MONO_ERROR_INVALID_PROGRAM: { - gboolean lacks_message = error->flags & MONO_ERROR_INCOMPLETE; - if (lacks_message) - return mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", ""); - else - return mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", error->full_message); - } + case MONO_ERROR_INVALID_PROGRAM: + exception = mono_exception_new_by_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", + (error->flags & MONO_ERROR_INCOMPLETE) ? "" : error->full_message, error_out); + break; + default: mono_error_set_execution_engine (error_out, "Invalid error-code %d", error->error_code); } if (!mono_error_ok (error_out)) - return NULL; - if (!exception) + goto return_null; + + if (MONO_HANDLE_IS_NULL (exception)) mono_error_set_out_of_memory (error_out, "Could not allocate exception object"); - return exception; + goto exit; +out_of_memory: + mono_error_set_out_of_memory (error_out, "Could not allocate message"); + goto exit; +return_null: + exception = MONO_HANDLE_CAST (MonoException, mono_new_null ()); +exit: + g_free (message); + g_free (type_name); + HANDLE_FUNCTION_RETURN_OBJ (exception); } /* diff --git a/mono/utils/mono-error.h b/mono/utils/mono-error.h index 4bbc4a0ec5..ffcaba5f3c 100644 --- a/mono/utils/mono-error.h +++ b/mono/utils/mono-error.h @@ -66,8 +66,7 @@ typedef struct _MonoErrorBoxed MonoErrorBoxed; MONO_BEGIN_DECLS -MONO_RT_EXTERNAL_ONLY -MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_error_init (MonoError *error); MONO_API void diff --git a/mono/utils/mono-flight-recorder.c b/mono/utils/mono-flight-recorder.c new file mode 100644 index 0000000000..9246c5b545 --- /dev/null +++ b/mono/utils/mono-flight-recorder.c @@ -0,0 +1,153 @@ +/** + * \file + * A lightweight log storage medium with limited history + * + * Author: + * Alexander Kyte (alkyte@microsoft.com) + * + * (C) 2018 Microsoft, Inc. + * + */ + +#include +#include + +// Need to make lockless because mutex is really slow +// at each log statement. +// +// Better/concurrent design: +// - Make thread for flight recorder +// - Send messages to flight recorder using utils/lock-free-queue.h +// - Flight recorder doesn't share memory, all owned by thread + + + +#define MONO_FLIGHT_RECORDER_SENTINEL -1 + +// Mutex has to be held when called +void +mono_flight_recorder_iter_init (MonoFlightRecorder *recorder, MonoFlightRecorderIter *iter) +{ + // Make sure we are initialized + g_assert (recorder->max_count > 0); + + iter->recorder = recorder; + if (recorder->cursor == MONO_FLIGHT_RECORDER_SENTINEL) { + iter->lowest_index = MONO_FLIGHT_RECORDER_SENTINEL; + iter->highest_index = MONO_FLIGHT_RECORDER_SENTINEL; + } else if (recorder->cursor >= recorder->max_count) { + // Ring buffer has wrapped around + // So the item *after* the highest index is the lowest index + iter->highest_index = (recorder->cursor + 1) % recorder->max_count; + iter->lowest_index = (iter->highest_index + 1) % recorder->max_count; + } else { + iter->lowest_index = 0; + iter->highest_index = recorder->cursor + 1; + } +} + +void +mono_flight_recorder_iter_destroy (MonoFlightRecorderIter *iter) +{ + // Does nothing now, but might want to in future with iterator + return; +} + +// Mutex has to be held when called +gboolean +mono_flight_recorder_iter_next (MonoFlightRecorderIter *iter, MonoFlightRecorderHeader *header, gpointer *payload) +{ + gboolean empty_log = (iter->lowest_index == MONO_FLIGHT_RECORDER_SENTINEL) && (iter->lowest_index == MONO_FLIGHT_RECORDER_SENTINEL); + if (empty_log || (iter->lowest_index == iter->highest_index)) + return FALSE; + + g_assert (iter->lowest_index >= 0); + g_assert (iter->lowest_index < iter->recorder->max_count); + + // Reference to the variably-sized logging payload + memcpy (payload, (gpointer *) &iter->recorder->items [iter->lowest_index]->payload, iter->recorder->payload_size); + memcpy (header, (gpointer *) &iter->recorder->items [iter->lowest_index]->header, sizeof (MonoFlightRecorderHeader)); + iter->lowest_index++; + + if (iter->lowest_index >= iter->recorder->max_count) + iter->lowest_index = iter->lowest_index % iter->recorder->max_count; + + return TRUE; +} + +MonoCoopMutex * +mono_flight_recorder_mutex (MonoFlightRecorder *recorder) +{ + return &recorder->mutex; +} + +static size_t +mono_flight_recorder_item_size (size_t payload_size) +{ + return offsetof(MonoFlightRecorderItem, payload) + payload_size; +} + +MonoFlightRecorder * +mono_flight_recorder_init (size_t max_count, size_t payload_size) +{ + size_t item_size = mono_flight_recorder_item_size (payload_size); + size_t size_of_items = item_size * max_count; + size_t size_of_item_ptrs = sizeof (gpointer) * max_count; + size_t size_of_recorder_prefix = offsetof(MonoFlightRecorder, items); + MonoFlightRecorder *recorder = g_malloc0 (size_of_recorder_prefix + size_of_item_ptrs + size_of_items); + intptr_t end_of_memory = ((intptr_t) recorder) + (size_of_recorder_prefix + size_of_item_ptrs + size_of_items); + + recorder->max_count = max_count; + recorder->cursor = MONO_FLIGHT_RECORDER_SENTINEL; + recorder->payload_size = payload_size; + + // First byte after end of pointer array is the flexible-shape memory + intptr_t memory = (intptr_t) &recorder->items[recorder->max_count]; + for (int i=0; i < recorder->max_count; i++) { + recorder->items [i] = (MonoFlightRecorderItem *) (memory + (item_size * i)); + g_assert ((intptr_t) recorder->items [i] < end_of_memory); + } + + mono_coop_mutex_init (&recorder->mutex); + + return recorder; +} + +void +mono_flight_recorder_free (MonoFlightRecorder *recorder) +{ + // FIXME: use hazard pointers here + // Currently we push burden of making sure not used after freed to caller + g_free (recorder); +} + +void +mono_flight_recorder_append (MonoFlightRecorder *recorder, gpointer payload) +{ + MonoFlightRecorderItem *item; + + mono_coop_mutex_lock (&recorder->mutex); + + if (G_UNLIKELY(recorder->cursor == MONO_FLIGHT_RECORDER_SENTINEL)) { + item = recorder->items [0]; + item->header.counter = 0; + recorder->cursor = 0; + } else { + // cursor points to the field that was just filled out + MonoFlightRecorderItem *old_item = recorder->items [recorder->cursor % recorder->max_count]; + + item = recorder->items [(recorder->cursor + 1) % recorder->max_count]; + item->header.counter = old_item->header.counter + 1; + + recorder->cursor++; + } + + memcpy ((gpointer *) &item->payload, payload, recorder->payload_size); + + // Memcpy has to happen in lock in case of contention, + // can't have two threads writing to same memory block + // if the index loops around + + mono_coop_mutex_unlock (&recorder->mutex); +} + diff --git a/mono/utils/mono-flight-recorder.h b/mono/utils/mono-flight-recorder.h new file mode 100644 index 0000000000..092c8be222 --- /dev/null +++ b/mono/utils/mono-flight-recorder.h @@ -0,0 +1,66 @@ +/** + * \file + * A lightweight log storage medium with limited history + * + * Author: + * Alexander Kyte (alkyte@microsoft.com) + * + * (C) 2018 Microsoft, Inc. + * + */ +#ifndef __MONO_FLIGHT_RECORDER__ +#define __MONO_FLIGHT_RECORDER__ + +#include +#include + +typedef struct { + long counter; // The number of messages allocated thus far, acts like a global, monotonic clock +} MonoFlightRecorderHeader; + +typedef struct { + MonoFlightRecorderHeader header; + gpointer payload [MONO_ZERO_LEN_ARRAY]; // We have a variably-sized payload +} MonoFlightRecorderItem; + +typedef struct { + intptr_t cursor; // Signed, for sentinel value of -1 + size_t max_count; // Maximum number of items in logger + size_t payload_size; // Size of data reserved for logging message + MonoCoopMutex mutex; // Not owned exclusively by us, used by api consumers too + MonoFlightRecorderItem *items [MONO_ZERO_LEN_ARRAY]; // The data of the history +} MonoFlightRecorder; + +MonoCoopMutex * +mono_flight_recorder_mutex (MonoFlightRecorder *recorder); + +MonoFlightRecorder * +mono_flight_recorder_init (size_t max_size, size_t payload_size); + +void +mono_flight_recorder_free (MonoFlightRecorder *recorder); + +void +mono_flight_recorder_append (MonoFlightRecorder *recorder, gpointer payload); + +// Used to traverse the ring buffer in order of oldest to newest message + +typedef struct { + intptr_t lowest_index; + intptr_t highest_index; + MonoFlightRecorder *recorder; +} MonoFlightRecorderIter; + +// Mutex has to be held when called +void +mono_flight_recorder_iter_init (MonoFlightRecorder *recorder, MonoFlightRecorderIter *iter); + +// Mutex has to be held when called +void +mono_flight_recorder_iter_destroy (MonoFlightRecorderIter *iter); + +// Mutex has to be held when called +gboolean +mono_flight_recorder_iter_next (MonoFlightRecorderIter *iter, MonoFlightRecorderHeader *header, gpointer *payload); + +#endif diff --git a/mono/utils/mono-internal-hash.c b/mono/utils/mono-internal-hash.c index 93bc0c8b6e..56b837db4a 100644 --- a/mono/utils/mono-internal-hash.c +++ b/mono/utils/mono-internal-hash.c @@ -106,7 +106,7 @@ mono_internal_hash_table_insert (MonoInternalHashTable *table, resize_if_needed (table); } -void +gboolean mono_internal_hash_table_remove (MonoInternalHashTable *table, gpointer key) { gint hash = HASH (key, table->hash_func, table->size); @@ -119,9 +119,9 @@ mono_internal_hash_table_remove (MonoInternalHashTable *table, gpointer key) { *value = *(table->next_value (*value)); --table->num_entries; - return; + return TRUE; } } - g_assert (0); + return FALSE; } diff --git a/mono/utils/mono-internal-hash.h b/mono/utils/mono-internal-hash.h index 65fac641a5..40d44ffbc0 100644 --- a/mono/utils/mono-internal-hash.h +++ b/mono/utils/mono-internal-hash.h @@ -71,7 +71,7 @@ void mono_internal_hash_table_insert (MonoInternalHashTable *table, gpointer key, gpointer value); -void +gboolean mono_internal_hash_table_remove (MonoInternalHashTable *table, gpointer key); #endif diff --git a/mono/utils/mono-log-flight-recorder.c b/mono/utils/mono-log-flight-recorder.c new file mode 100644 index 0000000000..e9cfa13525 --- /dev/null +++ b/mono/utils/mono-log-flight-recorder.c @@ -0,0 +1,225 @@ +/** + * \file + * A lightweight log storage medium with limited history + * + * Author: + * Alexander Kyte (alkyte@microsoft.com) + * + * (C) 2018 Microsoft, Inc. + * + */ + +#include +#include "mono-logger-internals.h" +#include +#include + +#define MAX_RECORDER_LOG_LEN 500 +#define MAX_RECORDER_MSG_LEN 500 + +typedef struct { + gchar message [MAX_RECORDER_MSG_LEN]; +} LogMessage; + +typedef struct { + LogMessage *messages; + size_t num_messages; + size_t max_num_messages; +} LogQueueDumpRequest; + +typedef enum { + MONO_FLIGHT_RECORDER_INVALID = 0, + MONO_FLIGHT_RECORDER_APPEND = 1, + MONO_FLIGHT_RECORDER_DUMP = 2, +} LogQueueCommand; + +typedef struct { + LogQueueCommand command; + union { + LogMessage message; + LogQueueDumpRequest *dump; + }; +} LogQueueEntry; + +static void +mono_log_dump_recorder_internal (MonoFlightRecorder *recorder, LogQueueDumpRequest *req); + +static void +init (gpointer *out) +{ + MonoFlightRecorder *recorder = mono_flight_recorder_init (MAX_RECORDER_LOG_LEN, sizeof (LogMessage)); + *out = (gpointer) recorder; +} + +static void +handle_command (gpointer state, gpointer payload, gboolean at_shutdown) +{ + MonoFlightRecorder *recorder = (MonoFlightRecorder *) state; + LogQueueEntry *entry = (LogQueueEntry *) payload; + + switch (entry->command) { + case MONO_FLIGHT_RECORDER_APPEND: + mono_flight_recorder_append (recorder, &entry->message); + +#if 0 + // Dump all messages on each append. This is an aggressive, slow + // debugging method. + + LogMessage messages [MAX_RECORDER_LOG_LEN]; + LogQueueDumpRequest dump; + dump.messages = (LogMessage *) messages; + dump.num_messages = 0; + dump.max_num_messages = MAX_RECORDER_LOG_LEN; + mono_log_dump_recorder_internal (recorder, &dump); + fprintf (stderr, "%zu messages\n", dump.num_messages); + + for (int i=0; i < dump.num_messages; i++) + fprintf (stderr, "\t(%d): %s\n", i, dump.messages [i].message); +#endif + + break; + case MONO_FLIGHT_RECORDER_DUMP: + fprintf (stderr, "Log received dump\n"); + mono_log_dump_recorder_internal (recorder, entry->dump); + break; + default: + g_assert_not_reached (); + } +} + +static void +cleanup (gpointer state) +{ + mono_flight_recorder_free ((MonoFlightRecorder *) state); +} + +static MonoUtilityThread *logger_thread; + + +/** + * mono_log_open_recorder: + * \param path Unused + * \param userData Unused + * Open access to recorder + */ +void +mono_log_open_recorder (const char *path, void *userData) +{ + MonoUtilityThreadCallbacks callbacks; + callbacks.early_init = NULL; + callbacks.init = init; + callbacks.command = handle_command; + callbacks.cleanup = cleanup; + logger_thread = mono_utility_thread_launch (sizeof (LogMessage), &callbacks, MONO_MEM_ACCOUNT_OTHER); +} + +/** + * mono_log_write_recorder: + * \param domain Identifier string + * \param level Logging level flags + * \param format \c printf format string + * \param vargs Variable argument list + * Write data to recorder. + */ +void +mono_log_write_recorder (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message) +{ + int small_id = mono_thread_info_get_small_id (); + if (small_id < 0) { +#if MONO_PRINT_DROPPED_MESSAGES + fprintf (stderr, "Dropping message because thread not attached yet:\n\t%s\n", message); +#endif + return; + } else if (level & G_LOG_LEVEL_ERROR) { + fprintf (stderr, "\nFatal Error Occured: %s\n\nHistory:\n", message); + mono_log_dump_recorder (); + abort(); + } else if (!logger_thread->run_thread) { +#if MONO_PRINT_DROPPED_MESSAGES + fprintf (stderr, "Dropping message because thread killed:\n\t%s\n", message); +#endif + return; + } + + LogQueueEntry entry; + entry.command = MONO_FLIGHT_RECORDER_APPEND; + g_snprintf ((gchar *) &entry.message.message, MAX_RECORDER_MSG_LEN, message); + mono_utility_thread_send (logger_thread, &entry); +} + +/** + * mono_log_close_recorder + * + * Close access to recorder + */ +void +mono_log_close_recorder (void) +{ + int small_id = mono_thread_info_get_small_id (); + if (small_id < 0) { +#if MONO_PRINT_DROPPED_MESSAGES + fprintf (stderr, "Dropping attempt to close recorder, thread not attached yet\n"); +#endif + return; + } else if (!logger_thread->run_thread) { + return; + } + + fprintf (stderr, "\nFlight recorder closed (pre dump):\n"); + + mono_log_dump_recorder (); + + fprintf (stderr, "\nFlight recorder closed (post dump):\n"); + + mono_utility_thread_stop (logger_thread); +} + +void +mono_log_dump_recorder (void) +{ + int small_id = mono_thread_info_get_small_id (); + if (small_id < 0) { +#if MONO_PRINT_DROPPED_MESSAGES + fprintf (stderr, "Dropping attempt to dump recorder, thread not attached yet\n"); +#endif + return; + } + + LogMessage messages [MAX_RECORDER_LOG_LEN]; + LogQueueDumpRequest dump; + dump.messages = (LogMessage *) messages; + dump.num_messages = 0; + dump.max_num_messages = MAX_RECORDER_LOG_LEN; + + LogQueueEntry entry; + entry.command = MONO_FLIGHT_RECORDER_DUMP; + entry.dump = &dump; + + gboolean success = mono_utility_thread_send_sync (logger_thread, &entry); + + if (success) { + fprintf (stderr, "Recent Logs Inserted\n"); + fprintf (stderr, "%zu messages\n", dump.num_messages); + + for (int i=0; i < dump.num_messages; i++) + fprintf (stderr, "\t(%d): %s\n", i, dump.messages [i].message); + } +} + +static void +mono_log_dump_recorder_internal (MonoFlightRecorder *recorder, LogQueueDumpRequest *req) +{ + MonoFlightRecorderIter diter; + MonoFlightRecorderHeader header; + int index = 0; + + mono_flight_recorder_iter_init (recorder, &diter); + while (mono_flight_recorder_iter_next (&diter, &header, (gpointer *) &req->messages [index++])); + mono_flight_recorder_iter_destroy (&diter); + + // FIXME: do something with header/counter? + + req->num_messages = index - 1; +} + + diff --git a/mono/utils/mono-logger-internals.h b/mono/utils/mono-logger-internals.h index 9be63c69bf..5c24a217e1 100644 --- a/mono/utils/mono-logger-internals.h +++ b/mono/utils/mono-logger-internals.h @@ -29,10 +29,11 @@ typedef enum { MONO_TRACE_IO_LAYER_MUTEX = 1 << 14, MONO_TRACE_IO_LAYER_HANDLE = 1 << 15, MONO_TRACE_TAILCALL = 1 << 16, + MONO_TRACE_PROFILER = 1 << 17, } MonoTraceMask; -MONO_API extern GLogLevelFlags mono_internal_current_level; -MONO_API extern MonoTraceMask mono_internal_current_mask; +MONO_API_DATA GLogLevelFlags mono_internal_current_level; +MONO_API_DATA MonoTraceMask mono_internal_current_mask; MONO_API void mono_trace_init (void); @@ -153,9 +154,13 @@ void mono_log_close_logcat (void); void mono_log_open_asl (const char *path, void *userData); void mono_log_write_asl (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message); void mono_log_close_asl (void); - #endif +void mono_log_open_recorder (const char *path, void *userData); +void mono_log_write_recorder (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message); +void mono_log_close_recorder (void); +void mono_log_dump_recorder (void); + G_END_DECLS #endif /* __MONO_LOGGER_INTERNAL_H__ */ diff --git a/mono/utils/mono-logger.c b/mono/utils/mono-logger.c index 7589f8d52f..02a77ac65c 100644 --- a/mono/utils/mono-logger.c +++ b/mono/utils/mono-logger.c @@ -23,12 +23,7 @@ static GQueue *level_stack = NULL; static const char *mono_log_domain = "Mono"; static MonoPrintCallback print_callback, printerr_callback; -static MonoLogCallParm logCallback = { - .opener = NULL, - .writer = NULL, - .closer = NULL, - .header = FALSE -}; +static MonoLogCallParm logCallback; typedef struct { MonoLogCallback legacy_callback; @@ -165,18 +160,29 @@ mono_trace_set_logdest_string (const char *dest) logger.closer = mono_log_close_asl; logger.dest = (char*) dest; #else - if ((dest == NULL) || (strcmp("syslog", dest) != 0)) { - logger.opener = mono_log_open_logfile; - logger.writer = mono_log_write_logfile; - logger.closer = mono_log_close_logfile; + if (dest && !strcmp("flight-recorder", dest)) { + logger.opener = mono_log_open_recorder; + logger.writer = mono_log_write_recorder; + logger.closer = mono_log_close_recorder; logger.dest = (char *) dest; - } else { + + // Increase log level with flight recorder + if (mono_internal_current_level == G_LOG_LEVEL_ERROR || mono_internal_current_level == G_LOG_LEVEL_CRITICAL) + mono_trace_set_level (G_LOG_LEVEL_WARNING); + + } else if (dest && !strcmp("syslog", dest)) { logger.opener = mono_log_open_syslog; logger.writer = mono_log_write_syslog; logger.closer = mono_log_close_syslog; logger.dest = (char *) dest; + } else { + logger.opener = mono_log_open_logfile; + logger.writer = mono_log_write_logfile; + logger.closer = mono_log_close_logfile; + logger.dest = (char *) dest; } #endif + mono_trace_set_log_handler_internal(&logger, NULL); } @@ -305,6 +311,7 @@ mono_trace_set_mask_string (const char *value) | MONO_TRACE_IO_LAYER_HANDLE }, { "w32handle", MONO_TRACE_IO_LAYER_HANDLE }, { "tailcall", MONO_TRACE_TAILCALL }, + { "profiler", MONO_TRACE_PROFILER }, { "all", ~((MonoTraceMask)0) }, { NULL, 0 }, }; diff --git a/mono/utils/mono-machine.h b/mono/utils/mono-machine.h index a5026fef79..dc180c91d2 100644 --- a/mono/utils/mono-machine.h +++ b/mono/utils/mono-machine.h @@ -26,6 +26,12 @@ typedef gint32 mgreg_t; typedef gint64 mgreg_t; #endif +#if TARGET_SIZEOF_VOID_P == 4 +typedef gint32 target_mgreg_t; +#else +typedef gint64 target_mgreg_t; +#endif + /* Alignment for MonoArray.vector */ #if defined(_AIX) /* diff --git a/mono/utils/mono-merp.c b/mono/utils/mono-merp.c index 348d4d94fa..42e2740556 100644 --- a/mono/utils/mono-merp.c +++ b/mono/utils/mono-merp.c @@ -344,9 +344,7 @@ mono_init_merp (const intptr_t crashed_pid, const char *signal, MonoStackHash *h merp->moduleOffset = 0; - ERROR_DECL (error); - merp->uiLidArg = ves_icall_System_Threading_Thread_current_lcid (error); - mono_error_assert_ok (error); + merp->uiLidArg = ves_icall_System_Threading_Thread_current_lcid (); merp->osVersion = os_version_string (); diff --git a/mono/utils/mono-mmap-windows.c b/mono/utils/mono-mmap-windows.c index 2759862bbe..cd267194e4 100644 --- a/mono/utils/mono-mmap-windows.c +++ b/mono/utils/mono-mmap-windows.c @@ -18,7 +18,7 @@ #include #include -static void *malloced_shared_area = NULL; +static void *malloced_shared_area; int mono_pagesize (void) @@ -66,14 +66,14 @@ mono_mmap_win_prot_from_flags (int flags) void* mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type) { + if (!mono_valloc_can_alloc (length)) + return NULL; + void *ptr; int mflags = MEM_RESERVE|MEM_COMMIT; int prot = mono_mmap_win_prot_from_flags (flags); /* translate the flags */ - if (!mono_valloc_can_alloc (length)) - return NULL; - ptr = VirtualAlloc (addr, length, mflags, prot); mono_account_mem (type, (ssize_t)length); @@ -122,14 +122,26 @@ mono_vfree (void *addr, size_t length, MonoMemAccountType type) return 0; } -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) -void* -mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle) +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) + +static void +remove_trailing_whitespace_utf16 (wchar_t *s) { - void *ptr; - int mflags = 0; - HANDLE file, mapping; - int prot = mono_mmap_win_prot_from_flags (flags); + gsize length = wcslen (s); + gsize const original_length = length; + while (length > 0 && iswspace (s [length - 1])) + --length; + if (length != original_length) + s [length] = 0; +} + +void* +mono_file_map_error (size_t length, int flags, int fd, guint64 offset, void **ret_handle, + const char *filepath, char **error_message) +{ + void *ptr = NULL; + HANDLE mapping = NULL; + int const prot = mono_mmap_win_prot_from_flags (flags); /* translate the flags */ /*if (flags & MONO_MMAP_PRIVATE) mflags |= MAP_PRIVATE; @@ -141,36 +153,73 @@ mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_hand mflags |= MAP_FIXED; if (flags & MONO_MMAP_32BIT) mflags |= MAP_32BIT;*/ + int const mflags = (flags & MONO_MMAP_WRITE) ? FILE_MAP_COPY : FILE_MAP_READ; + HANDLE const file = (HANDLE)_get_osfhandle (fd); + const char *failed_function = NULL; - mflags = FILE_MAP_READ; - if (flags & MONO_MMAP_WRITE) - mflags = FILE_MAP_COPY; - - file = (HANDLE) _get_osfhandle (fd); - - mapping = CreateFileMapping (file, NULL, prot, 0, 0, NULL); +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) + failed_function = "CreateFileMapping"; + mapping = CreateFileMappingW (file, NULL, prot, (DWORD)(length >> 31 >> 1), (DWORD)length, NULL); if (mapping == NULL) - return NULL; + goto exit; - ptr = MapViewOfFile (mapping, mflags, 0, offset, length); + failed_function = "MapViewOfFile"; + ptr = MapViewOfFile (mapping, mflags, (DWORD)(offset >> 32), (DWORD)offset, length); + if (ptr == NULL) + goto exit; - if (ptr == NULL) { - CloseHandle (mapping); - return NULL; +#elif G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) + + failed_function = "CreateFileMappingFromApp"; + mapping = CreateFileMappingFromApp (file, NULL, prot, length, NULL); + if (mapping == NULL) + goto exit; + + failed_function = "MapViewOfFileFromApp"; + ptr = MapViewOfFileFromApp (mapping, mflags, offset, length); + if (ptr == NULL) + goto exit; + +#else +#error unknown Windows variant +#endif + +exit: + if (!ptr && (mapping || error_message)) { + int const win32_error = GetLastError (); + if (mapping) + CloseHandle (mapping); + if (error_message) { + WCHAR win32_error_string [100] = { 0 }; // FIXME LocalFree not initially in UWP but it is now. + FormatMessageW (FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + 0, win32_error, 0, win32_error_string, 99, NULL); + // Win32 error messages end with an unsightly newline. + remove_trailing_whitespace_utf16 (win32_error_string); + *error_message = g_strdup_printf ("%s failed file:%s length:0x%IX offset:0x%I64X function:%s error:%ls(0x%X)\n", + __func__, filepath ? filepath : "", length, offset, failed_function, win32_error_string, win32_error); + } + SetLastError (win32_error); } - *ret_handle = (void*)mapping; + *ret_handle = mapping; return ptr; } +void* +mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle) +{ + return mono_file_map_error (length, flags, fd, offset, ret_handle, NULL, NULL); +} + int mono_file_unmap (void *addr, void *handle) { UnmapViewOfFile (addr); - CloseHandle ((HANDLE)handle); + CloseHandle (handle); return 0; } -#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ + +#endif // G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) || G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) int mono_mprotect (void *addr, size_t length, int flags) @@ -220,4 +269,4 @@ mono_shared_area_instances (void **array, int count) return 0; } -#endif +#endif // HOST_WIN32 diff --git a/mono/utils/mono-mmap.c b/mono/utils/mono-mmap.c index dc802c4697..0fbdb3355e 100644 --- a/mono/utils/mono-mmap.c +++ b/mono/utils/mono-mmap.c @@ -19,6 +19,9 @@ #if HAVE_SYS_MMAN_H #include #endif +#ifdef HAVE_SYS_SYSCTL_H +#include +#endif #ifdef HAVE_SIGNAL_H #include #endif @@ -197,6 +200,29 @@ prot_from_flags (int flags) return prot; } +#if defined(__APPLE__) + +#define DARWIN_VERSION_MOJAVE 18 + +static guint32 +get_darwin_version (void) +{ + static guint32 version; + + /* This doesn't need locking */ + if (!version) { + char str[256] = {0}; + size_t size = sizeof(str); + int err = sysctlbyname("kern.osrelease", str, &size, NULL, 0); + g_assert (err == 0); + err = sscanf (str, "%d", &version); + g_assert (err == 1); + g_assert (version > 0); + } + return version; +} +#endif + /** * mono_valloc: * \param addr memory address @@ -224,6 +250,13 @@ mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type) mflags |= MAP_FIXED; if (flags & MONO_MMAP_32BIT) mflags |= MAP_32BIT; +#if defined(__APPLE__) && defined(MAP_JIT) + if (flags & MONO_MMAP_JIT) { + if (get_darwin_version () >= DARWIN_VERSION_MOJAVE) { + mflags |= MAP_JIT; + } + } +#endif mflags |= MAP_ANONYMOUS; mflags |= MAP_PRIVATE; @@ -306,6 +339,13 @@ mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_hand return ptr; } +void* +mono_file_map_error (size_t length, int flags, int fd, guint64 offset, void **ret_handle, + const char *filepath, char **error_message) +{ + return mono_file_map (length, flags, fd, offset, ret_handle); +} + /** * mono_file_unmap: * \param addr memory address returned by mono_file_map () diff --git a/mono/utils/mono-mmap.h b/mono/utils/mono-mmap.h index 2e2c7cdf03..d6270c2c13 100644 --- a/mono/utils/mono-mmap.h +++ b/mono/utils/mono-mmap.h @@ -21,7 +21,8 @@ enum { MONO_MMAP_SHARED = 1 << 5, MONO_MMAP_ANON = 1 << 6, MONO_MMAP_FIXED = 1 << 7, - MONO_MMAP_32BIT = 1 << 8 + MONO_MMAP_32BIT = 1 << 8, + MONO_MMAP_JIT = 1 << 9 }; typedef enum { @@ -58,6 +59,14 @@ MONO_API void* mono_valloc (void *addr, size_t length, int flags, MonoMemAcc MONO_API void* mono_valloc_aligned (size_t length, size_t alignment, int flags, MonoMemAccountType type); MONO_API int mono_vfree (void *addr, size_t length, MonoMemAccountType type); MONO_API void* mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle); +// Last two parameters are optional. +// This is mono_file_map but with optionally returning an error message. +// See https://github.com/mono/mono/issues/8225. +#ifdef HOST_WIN32 +MONO_API +#endif +void* +mono_file_map_error (size_t length, int flags, int fd, guint64 offset, void **ret_handle, const char *filepath, char **error_message); MONO_API int mono_file_unmap (void *addr, void *handle); #ifndef HOST_WIN32 MONO_API void* mono_file_map_fileio (size_t length, int flags, int fd, guint64 offset, void **ret_handle); diff --git a/mono/utils/mono-os-wait-win32.c b/mono/utils/mono-os-wait-win32.c index 8ec2163de6..160f4048a7 100644 --- a/mono/utils/mono-os-wait-win32.c +++ b/mono/utils/mono-os-wait-win32.c @@ -93,19 +93,17 @@ DWORD mono_win32_sleep_ex (DWORD timeout, BOOL alertable) { DWORD result = WAIT_FAILED; - MonoThreadInfo *info = mono_thread_info_current_unchecked (); + MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL; - if (alertable && info) { + if (info) enter_alertable_wait (info); - } result = SleepEx (timeout, alertable); // NOTE, leave_alertable_wait should not affect GetLastError but // if changed, GetLastError needs to be preserved and reset before returning. - if (alertable && info) { + if (info) leave_alertable_wait (info); - } return result; } @@ -114,11 +112,10 @@ DWORD mono_win32_wait_for_single_object_ex (HANDLE handle, DWORD timeout, BOOL alertable) { DWORD result = WAIT_FAILED; - MonoThreadInfo *info = mono_thread_info_current_unchecked (); + MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL; - if (alertable && info) { + if (info) enter_alertable_wait (info); - } result = WaitForSingleObjectEx (handle, timeout, alertable); @@ -135,19 +132,17 @@ DWORD mono_win32_wait_for_multiple_objects_ex (DWORD count, CONST HANDLE *handles, BOOL waitAll, DWORD timeout, BOOL alertable) { DWORD result = WAIT_FAILED; - MonoThreadInfo *info = mono_thread_info_current_unchecked (); + MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL; - if (alertable && info) { + if (info) enter_alertable_wait (info); - } result = WaitForMultipleObjectsEx (count, handles, waitAll, timeout, alertable); // NOTE, leave_alertable_wait should not affect GetLastError but // if changed, GetLastError needs to be preserved and reset before returning. - if (alertable && info) { + if (info) leave_alertable_wait (info); - } return result; } @@ -158,19 +153,17 @@ DWORD mono_win32_signal_object_and_wait (HANDLE toSignal, HANDLE toWait, DWORD timeout, BOOL alertable) { DWORD result = WAIT_FAILED; - MonoThreadInfo *info = mono_thread_info_current_unchecked (); + MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL; - if (alertable && info) { + if (info) enter_alertable_wait (info); - } result = SignalObjectAndWait (toSignal, toWait, timeout, alertable); // NOTE, leave_alertable_wait should not affect GetLastError but // if changed, GetLastError needs to be preserved and reset before returning. - if (alertable && info) { + if (info) leave_alertable_wait (info); - } return result; } @@ -182,20 +175,18 @@ DWORD mono_win32_msg_wait_for_multiple_objects_ex (DWORD count, CONST HANDLE *handles, DWORD timeout, DWORD wakeMask, DWORD flags) { DWORD result = WAIT_FAILED; - MonoThreadInfo *info = mono_thread_info_current_unchecked (); BOOL alertable = flags & MWMO_ALERTABLE; + MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL; - if (alertable && info) { + if (info) enter_alertable_wait (info); - } result = MsgWaitForMultipleObjectsEx (count, handles, timeout, wakeMask, flags); // NOTE, leave_alertable_wait should not affect GetLastError but // if changed, GetLastError needs to be preserved and reset before returning. - if (alertable && info) { + if (info) leave_alertable_wait (info); - } return result; } @@ -205,19 +196,17 @@ DWORD mono_win32_wsa_wait_for_multiple_events (DWORD count, const WSAEVENT FAR *handles, BOOL waitAll, DWORD timeout, BOOL alertable) { DWORD result = WAIT_FAILED; - MonoThreadInfo *info = mono_thread_info_current_unchecked (); + MonoThreadInfo * const info = alertable ? mono_thread_info_current_unchecked () : NULL; - if (alertable && info) { + if (info) enter_alertable_wait (info); - } result = WSAWaitForMultipleEvents (count, handles, waitAll, timeout, alertable); // NOTE, leave_alertable_wait should not affect GetLastError but // if changed, GetLastError needs to be preserved and reset before returning. - if (alertable && info) { + if (info) leave_alertable_wait (info); - } return result; } diff --git a/mono/utils/mono-proclib.c b/mono/utils/mono-proclib.c index 191ee1dc1f..328f84a333 100644 --- a/mono/utils/mono-proclib.c +++ b/mono/utils/mono-proclib.c @@ -39,6 +39,9 @@ #if defined(__HAIKU__) #include #endif +#if defined(_AIX) +#include +#endif #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #include #if defined(__APPLE__) @@ -176,6 +179,44 @@ mono_process_list (int *size) *size = i; return buf; +#elif defined(_AIX) + void **buf = NULL; + struct procentry64 *procs = NULL; + int count = 0; + int i = 0; + pid_t pid = 1; // start at 1, 0 is a null process (???) + + // count number of procs + compensate for new ones forked in while we do it. + // (it's not an atomic operation) 1000000 is the limit IBM ps seems to use + // when I inspected it under truss. the second call we do to getprocs64 will + // then only allocate what we need, instead of allocating some obscenely large + // array on the heap. + count = getprocs64(NULL, sizeof (struct procentry64), NULL, 0, &pid, 1000000); + if (count < 1) + goto cleanup; + count += 10; + pid = 1; // reset the pid cookie + + // 5026 bytes is the ideal size for the C struct. you may not like it, but + // this is what peak allocation looks like + procs = g_calloc (count, sizeof (struct procentry64)); + // the man page recommends you do this in a loop, but you can also just do it + // in one shot; again, like what ps does. let the returned count (in case it's + // less) be what we then allocate the array of pids from (in case of ANOTHER + // system-wide race condition with processes) + count = getprocs64 (procs, sizeof (struct procentry64), NULL, 0, &pid, count); + if (count < 1 || procs == NULL) + goto cleanup; + buf = g_calloc (count, sizeof (void*)); + for (i = 0; i < count; i++) { + buf[i] = GINT_TO_POINTER (procs[i].pi_pid); + } + *size = i; + +cleanup: + if (procs) + g_free (procs); + return buf; #else const char *name; void **buf = NULL; @@ -308,6 +349,14 @@ mono_process_get_name (gpointer pid, char *buf, int len) if (sysctl_kinfo_proc (pid, &processi)) memcpy (buf, processi.kinfo_name_member, len - 1); + return buf; +#elif defined(_AIX) + struct procentry64 proc; + pid_t newpid = GPOINTER_TO_INT (pid); + + if (getprocs64 (&proc, sizeof (struct procentry64), NULL, 0, &newpid, 1) == 1) { + g_strlcpy (buf, proc.pi_comm, len - 1); + } return buf; #else char fname [128]; diff --git a/mono/utils/mono-publib.h b/mono/utils/mono-publib.h index ccf71d191c..d902e0dc66 100644 --- a/mono/utils/mono-publib.h +++ b/mono/utils/mono-publib.h @@ -59,12 +59,30 @@ typedef unsigned __int64 uint64_t; #include -#if defined(MONO_DLL_EXPORT) - #define MONO_API MONO_API_EXPORT -#elif defined(MONO_DLL_IMPORT) - #define MONO_API MONO_API_IMPORT +#ifdef __cplusplus +#define MONO_EXTERN_C extern "C" #else - #define MONO_API +#define MONO_EXTERN_C /* nothing */ +#endif + +#if defined(MONO_DLL_EXPORT) + #define MONO_API_NO_EXTERN_C MONO_API_EXPORT +#elif defined(MONO_DLL_IMPORT) + #define MONO_API_NO_EXTERN_C MONO_API_IMPORT +#else + #define MONO_API_NO_EXTERN_C /* nothing */ +#endif + +#define MONO_API MONO_EXTERN_C MONO_API_NO_EXTERN_C + +// extern "C" extern int c; // warning: duplicate 'extern' declaration specifier [-Wduplicate-decl-specifier] +// +// Therefore, remove extern on functions as always meaningless/redundant, +// and provide MONO_API_DATA for data, that always has one and only one extern. +#ifdef __cplusplus +#define MONO_API_DATA MONO_API +#else +#define MONO_API_DATA extern MONO_API #endif typedef int32_t mono_bool; diff --git a/mono/utils/mono-rand-windows-internals.h b/mono/utils/mono-rand-windows-internals.h deleted file mode 100644 index 143a457f0b..0000000000 --- a/mono/utils/mono-rand-windows-internals.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * \file - */ - -#ifndef _MONO_UTILS_RAND_WINDOWS_H_ -#define _MONO_UTILS_RAND_WINDOWS_H_ - -#include -#include - -#ifdef HOST_WIN32 - -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) -#include -#define MONO_WIN32_CRYPT_PROVIDER_HANDLE HCRYPTPROV - -#else - -#include -#define MONO_WIN32_CRYPT_PROVIDER_HANDLE BCRYPT_ALG_HANDLE -#endif - -MONO_WIN32_CRYPT_PROVIDER_HANDLE -mono_rand_win_open_provider (void); - -gboolean -mono_rand_win_gen (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *buffer, size_t buffer_size); - -gboolean -mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, size_t seed_size); - -void -mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider); - -#endif /* HOST_WIN32 */ -#endif /* _MONO_UTILS_RAND_WINDOWS_H_ */ - diff --git a/mono/utils/mono-rand-windows.c b/mono/utils/mono-rand-windows.c index 638f8b38ed..2f0ef958c1 100644 --- a/mono/utils/mono-rand-windows.c +++ b/mono/utils/mono-rand-windows.c @@ -7,62 +7,18 @@ */ #include #include +#ifdef HOST_WIN32 #include "mono-error.h" #include "mono-error-internals.h" #include "mono-rand.h" - -#if defined(HOST_WIN32) #include -#include "mono/utils/mono-rand-windows-internals.h" +#include +#include -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) -#ifndef PROV_INTEL_SEC -#define PROV_INTEL_SEC 22 -#endif -#ifndef CRYPT_VERIFY_CONTEXT -#define CRYPT_VERIFY_CONTEXT 0xF0000000 -#endif +// This implementation requires Windows 7 or newer. -MONO_WIN32_CRYPT_PROVIDER_HANDLE -mono_rand_win_open_provider (void) -{ - MONO_WIN32_CRYPT_PROVIDER_HANDLE provider = 0; - - /* There is no need to create a container for just random data, - * so we can use CRYPT_VERIFY_CONTEXT (one call) see: - * http://blogs.msdn.com/dangriff/archive/2003/11/19/51709.aspx */ - - /* We first try to use the Intel PIII RNG if drivers are present */ - if (!CryptAcquireContext (&provider, NULL, NULL, PROV_INTEL_SEC, CRYPT_VERIFY_CONTEXT)) { - /* not a PIII or no drivers available, use default RSA CSP */ - if (!CryptAcquireContext (&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFY_CONTEXT)) { - /* exception will be thrown in managed code */ - provider = 0; - } - } - - return provider; -} - -void -mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider) -{ - CryptReleaseContext (provider, 0); -} - -gboolean -mono_rand_win_gen (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *buffer, size_t buffer_size) -{ - return CryptGenRandom (provider, (DWORD) buffer_size, buffer); -} - -gboolean -mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, size_t seed_size) -{ - /* add seeding material to the RNG */ - return CryptGenRandom (provider, (DWORD) seed_size, seed); -} -#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ +#define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002 +const static char mono_rand_provider [ ] = "BCryptGenRandom"; /** * mono_rand_open: @@ -74,7 +30,7 @@ mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, siz gboolean mono_rand_open (void) { - return FALSE; + return TRUE; } /** @@ -85,29 +41,10 @@ mono_rand_open (void) * \returns On success, a non-NULL handle which can be used to fetch random data from \c mono_rand_try_get_bytes. On failure, NULL. */ gpointer -mono_rand_init (guchar *seed, gint seed_size) +mono_rand_init (const guchar *seed, gssize seed_size) { - MONO_WIN32_CRYPT_PROVIDER_HANDLE provider = 0; - - /* try to open crypto provider. */ - provider = mono_rand_win_open_provider (); - - /* seed the CSP with the supplied buffer (if present) */ - if (provider != 0 && seed != NULL) { - /* the call we replace the seed with random - this isn't what is - * expected from the class library user */ - guchar *data = g_malloc (seed_size); - if (data != NULL) { - memcpy (data, seed, seed_size); - /* add seeding material to the RNG */ - mono_rand_win_seed (provider, data, seed_size); - /* zeroize and free */ - memset (data, 0, seed_size); - g_free (data); - } - } - - return (gpointer) provider; + // NULL will be interpreted as failure; return arbitrary nonzero pointer + return (gpointer)mono_rand_provider; } /** @@ -120,37 +57,26 @@ mono_rand_init (guchar *seed, gint seed_size) * \returns FALSE on failure and sets \p error, TRUE on success. */ gboolean -mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, MonoError *error) +mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gssize buffer_size, MonoError *error) { - MONO_WIN32_CRYPT_PROVIDER_HANDLE provider; - + g_assert (buffer || !buffer_size); error_init (error); - g_assert (handle); - provider = (MONO_WIN32_CRYPT_PROVIDER_HANDLE) *handle; - - /* generate random bytes */ - if (!mono_rand_win_gen (provider, buffer, buffer_size)) { - mono_rand_win_close_provider (provider); - /* we may have lost our context with CryptoAPI, but all hope isn't lost yet! */ - provider = mono_rand_win_open_provider (); - if (provider != 0) { - - /* retry generate of random bytes */ - if (!mono_rand_win_gen (provider, buffer, buffer_size)) { - /* failure, close provider */ - mono_rand_win_close_provider (provider); - provider = 0; - } - } - - /* make sure client gets new opened provider handle or NULL on failure */ - *handle = (gpointer) provider; - if (*handle == 0) { - /* exception will be thrown in managed code */ - mono_error_set_execution_engine (error, "Failed to gen random bytes (%d)", GetLastError ()); + gpointer const handle_value = *handle; + g_assert (handle_value == 0 || handle_value == mono_rand_provider); + if (!handle_value) + return FALSE; + while (buffer_size > 0) { + ULONG const size = (ULONG)MIN (buffer_size, ULONG_MAX); + NTSTATUS const status = BCryptGenRandom (0, buffer, size, BCRYPT_USE_SYSTEM_PREFERRED_RNG); + if (!BCRYPT_SUCCESS (status)) { + mono_error_set_execution_engine (error, "Failed to gen random bytes (%ld)", status); + // failure, clear provider for future attempts + *handle = 0; return FALSE; } + buffer += size; + buffer_size -= size; } return TRUE; } @@ -163,6 +89,6 @@ mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, Mon void mono_rand_close (gpointer handle) { - mono_rand_win_close_provider ((MONO_WIN32_CRYPT_PROVIDER_HANDLE) handle); + g_assert (handle == 0 || handle == mono_rand_provider); } #endif /* HOST_WIN32 */ diff --git a/mono/utils/mono-rand.c b/mono/utils/mono-rand.c index 1f4ee02688..89d15f08d5 100644 --- a/mono/utils/mono-rand.c +++ b/mono/utils/mono-rand.c @@ -53,26 +53,23 @@ static gint file = -1; - Return -1 on error getrandom() is retried if it failed with EINTR: interrupted by a signal. */ static gint -mono_getrandom (guchar *buffer, gint buffer_size, gint flags, MonoError *error) +mono_getrandom (guchar *buffer, gssize buffer_size, gint flags, MonoError *error) { - static gint getrandom_works = 1; - gint count = 0; - gint err; + g_assert (buffer || !buffer_size); - if (!getrandom_works) { + static gboolean getrandom_fail; + + if (getrandom_fail) return 0; - } - - error_init (error); /* Read until the buffer is filled. This may block if random pool isn't initialized. */ - do { - err = getrandom (buffer + count, buffer_size - count, flags); + while (buffer_size > 0) { + gssize const err = getrandom (buffer, buffer_size, flags); if (err < 0) { if (errno == EINTR) continue; if (errno == ENOSYS || errno == EPERM) { - getrandom_works = 0; + getrandom_fail = TRUE; return 0; } g_warning ("Entropy error! Error in getrandom (%s).", strerror (errno)); @@ -80,8 +77,9 @@ mono_getrandom (guchar *buffer, gint buffer_size, gint flags, MonoError *error) mono_error_set_execution_engine (error, "Entropy error! Error in getrandom (%s).", strerror (errno)); return -1; } - count += err; - } while (count < buffer_size); + buffer_size -= err; + buffer += err; + } return 1; } #endif /* HAVE_GETRANDOM */ @@ -93,32 +91,24 @@ mono_getrandom (guchar *buffer, gint buffer_size, gint flags, MonoError *error) - Return -1 on error getentropy() is retried if it failed with EINTR: interrupted by a signal. */ static gint -mono_getentropy (guchar *buffer, gint buffer_size, MonoError *error) +mono_getentropy (guchar *buffer, gssize buffer_size, MonoError *error) { - static gint getentropy_works = 1; - gint count = 0; - gint len; - gint err; + g_assert (buffer || !buffer_size); - if (!getentropy_works) { + static gboolean getentropy_fail; + + if (getentropy_fail) return 0; - } - - error_init (error); /* Read until the buffer is filled. This may block if random pool isn't initialized. */ while (buffer_size > 0) { - if (buffer_size > 256) { - len = 256; - } else { - len = buffer_size; - } - err = getentropy (buffer + count, len); + gssize const len = MIN (buffer_size, 256); + gint const err = getentropy (buffer, len); if (err < 0) { if (errno == EINTR) continue; if (errno == ENOSYS || errno == EPERM) { - getentropy_works = 0; + getentropy_fail = TRUE; return 0; } g_warning ("Entropy error! Error in getentropy (%s).", strerror (errno)); @@ -126,7 +116,7 @@ mono_getentropy (guchar *buffer, gint buffer_size, MonoError *error) mono_error_set_execution_engine (error, "Entropy error! Error in getentropy (%s).", strerror (errno)); return -1; } - count += len; + buffer += len; buffer_size -= len; } return 1; @@ -134,15 +124,15 @@ mono_getentropy (guchar *buffer, gint buffer_size, MonoError *error) #endif /* HAVE_GETENTROPY */ static void -get_entropy_from_egd (const char *path, guchar *buffer, int buffer_size, MonoError *error) +get_entropy_from_egd (const char *path, guchar *buffer, gssize buffer_size, MonoError *error) { + g_assert (buffer || !buffer_size); + struct sockaddr_un egd_addr; gint socket_fd; gint ret; guint offset = 0; int err = 0; - - error_init (error); socket_fd = socket (PF_UNIX, SOCK_STREAM, 0); if (socket_fd < 0) { @@ -212,7 +202,7 @@ get_entropy_from_egd (const char *path, guchar *buffer, int buffer_size, MonoErr gboolean mono_rand_open (void) { - static gint32 status = 0; + static gint32 status; if (status != 0 || mono_atomic_cas_i32 (&status, 1, 0) != 0) { while (status != 2) mono_thread_info_yield (); @@ -235,28 +225,25 @@ mono_rand_open (void) } gpointer -mono_rand_init (guchar *seed, gint seed_size) +mono_rand_init (const guchar *seed, gssize seed_size) { // file < 0 is expected in the egd case return (!use_egd && file < 0) ? NULL : GINT_TO_POINTER (file); } gboolean -mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, MonoError *error) +mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gssize buffer_size, MonoError *error) { -#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) - gint res; -#endif - + g_assert (buffer || !buffer_size); g_assert (handle); error_init (error); #if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) #ifdef HAVE_GETRANDOM - res = mono_getrandom (buffer, buffer_size, 0, error); + gint const res = mono_getrandom (buffer, buffer_size, 0, error); #else - res = mono_getentropy (buffer, buffer_size, error); + gint const res = mono_getentropy (buffer, buffer_size, error); #endif if (res < 0) return FALSE; @@ -279,11 +266,8 @@ mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, Mon g_free (socket_path); } else { /* Read until the buffer is filled. This may block if using NAME_DEV_RANDOM. */ - gint count = 0; - gint err; - - do { - err = read (file, buffer + count, buffer_size - count); + while (buffer_size > 0) { + gssize const err = read (file, buffer, buffer_size); if (err < 0) { if (errno == EINTR) continue; @@ -292,8 +276,9 @@ mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, Mon mono_error_set_execution_engine (error, "Entropy error! Error in read (%s).", strerror (errno)); return FALSE; } - count += err; - } while (count < buffer_size); + buffer += err; + buffer_size -= err; + } } return TRUE; } @@ -311,7 +296,7 @@ mono_rand_close (gpointer provider) gboolean mono_rand_open (void) { - static gint32 status = 0; + static gint32 status; if (status != 0 || mono_atomic_cas_i32 (&status, 1, 0) != 0) { while (status != 2) mono_thread_info_yield (); @@ -326,33 +311,36 @@ mono_rand_open (void) } gpointer -mono_rand_init (guchar *seed, gint seed_size) +mono_rand_init (const guchar *seed, gssize seed_size) { return "srand"; // NULL will be interpreted as failure; return arbitrary nonzero pointer } gboolean -mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, MonoError *error) +mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gssize buffer_size, MonoError *error) { - gint count = 0; + // This functions is not used on any mainstream platform, perhaps not at all. + + g_assert (buffer || !buffer_size); error_init (error); + + g_assert (RAND_MAX >= 0xFF); // FIXME static_assert when compilers catch up. - do { - if (buffer_size - count >= sizeof (gint32) && RAND_MAX >= 0xFFFFFFFF) { - *(gint32*) buffer = rand(); - count += sizeof (gint32); - buffer += sizeof (gint32) / sizeof (guchar); - } else if (buffer_size - count >= sizeof (gint16) && RAND_MAX >= 0xFFFF) { - *(gint16*) buffer = rand(); - count += sizeof (gint16); - buffer += sizeof (gint16) / sizeof (guchar); - } else if (buffer_size - count >= sizeof (gint8) && RAND_MAX >= 0xFF) { - *(gint8*) buffer = rand(); - count += sizeof (gint8); - buffer += sizeof (gint8) / sizeof (guchar); + while (buffer_size > 0) { + int const i = rand (); + int j; + if (buffer_size >= (j = 4) && RAND_MAX >= 0xFFFFFFFF) + *(gint32*) buffer = i; + else if (buffer_size >= (j = 2) && RAND_MAX >= 0xFFFF) + *(gint16*) buffer = i; + else { + j = 1; + *(gint8*) buffer = i; } - } while (count < buffer_size); + buffer += j; + buffer_size -= j; + } return TRUE; } diff --git a/mono/utils/mono-rand.h b/mono/utils/mono-rand.h index 383ffd565b..2f3b6aaa36 100644 --- a/mono/utils/mono-rand.h +++ b/mono/utils/mono-rand.h @@ -12,12 +12,16 @@ gboolean mono_rand_open (void); + gpointer -mono_rand_init (guchar *seed, gint seed_size); +mono_rand_init (const guchar *seed, gssize seed_size); + gboolean -mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, MonoError *error); +mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gssize buffer_size, MonoError *error); + gboolean mono_rand_try_get_uint32 (gpointer *handle, guint32 *val, guint32 min, guint32 max, MonoError *error); + void mono_rand_close (gpointer handle); diff --git a/mono/utils/mono-state.c b/mono/utils/mono-state.c index 023f5f187f..c52b5f4a08 100644 --- a/mono/utils/mono-state.c +++ b/mono/utils/mono-state.c @@ -11,9 +11,10 @@ #include #include #include +#include #include -#ifdef TARGET_OSX +#ifndef DISABLE_CRASH_REPORTING extern GCStats mono_gc_stats; @@ -271,11 +272,11 @@ mono_native_state_add_version (JsonWriter *writer) mono_json_writer_indent (writer); mono_json_writer_object_key(writer, "tlc"); -#ifdef HAVE_KW_THREAD +#ifdef MONO_KEYWORD_THREAD mono_json_writer_printf (writer, "\"__thread\",\n"); #else mono_json_writer_printf (writer, "\"normal\",\n"); -#endif /* HAVE_KW_THREAD */ +#endif /* MONO_KEYWORD_THREAD */ mono_json_writer_indent (writer); mono_json_writer_object_key(writer, "sigsgev"); @@ -339,12 +340,18 @@ mono_native_state_add_version (JsonWriter *writer) mono_json_writer_object_key(writer, "llvm_support"); #ifdef MONO_ARCH_LLVM_SUPPORTED #ifdef ENABLE_LLVM - mono_json_writer_printf (writer, "\"%s\"\n", LLVM_VERSION); + mono_json_writer_printf (writer, "\"%d\",\n", LLVM_API_VERSION); #else - mono_json_writer_printf (writer, "\"disabled\"\n"); + mono_json_writer_printf (writer, "\"disabled\",\n"); #endif #endif + const char *susp_policy = mono_threads_suspend_policy_name (); + mono_json_writer_indent (writer); + mono_json_writer_object_key (writer, "suspend"); + mono_json_writer_printf (writer, "\"%s\"\n", susp_policy); + + mono_json_writer_indent_pop (writer); mono_json_writer_indent (writer); mono_json_writer_object_end (writer); @@ -426,11 +433,15 @@ mono_native_state_add_prologue (JsonWriter *writer) mono_json_writer_indent (writer); mono_json_writer_object_key(writer, "assertion_message"); - char *pos; + size_t length; + const char *pos; if ((pos = strchr (assertion_msg, '\n')) != NULL) - *pos = '\0'; + length = (size_t)(pos - assertion_msg); + else + length = strlen (assertion_msg); + length = MIN (length, INT_MAX); - mono_json_writer_printf (writer, "\"%s\",\n", assertion_msg); + mono_json_writer_printf (writer, "\"%.*s\",\n", (int)length, assertion_msg); } // Start threads array @@ -501,7 +512,6 @@ mono_summarize_native_state_add_thread (MonoThreadSummary *thread, MonoContext * not_first_thread = TRUE; } - void mono_crash_dump (const char *jsonFile, MonoStackHash *hashes) { @@ -538,4 +548,4 @@ mono_crash_dump (const char *jsonFile, MonoStackHash *hashes) return; } -#endif // TARGET_OSX +#endif // DISABLE_CRASH_REPORTING diff --git a/mono/utils/mono-state.h b/mono/utils/mono-state.h index a4195c4856..0c646ca000 100644 --- a/mono/utils/mono-state.h +++ b/mono/utils/mono-state.h @@ -11,7 +11,7 @@ #ifndef __MONO_UTILS_NATIVE_STATE__ #define __MONO_UTILS_NATIVE_STATE__ -#ifdef TARGET_OSX +#ifndef DISABLE_CRASH_REPORTING #include #include @@ -55,6 +55,6 @@ void mono_crash_dump (const char *jsonFile, MonoStackHash *hashes); MONO_END_DECLS -#endif // TARGET_OSX +#endif // DISABLE_CRASH_REPORTING #endif // MONO_UTILS_NATIVE_STATE diff --git a/mono/utils/mono-threads-api.h b/mono/utils/mono-threads-api.h index 258fe68bbf..3b66251b25 100644 --- a/mono/utils/mono-threads-api.h +++ b/mono/utils/mono-threads-api.h @@ -43,13 +43,13 @@ mono_stackdata_get_stackpointer (const MonoStackData *stackdata) return stackdata->stackpointer; } -MONO_RT_EXTERNAL_ONLY MONO_API gpointer +MONO_API MONO_RT_EXTERNAL_ONLY gpointer mono_threads_enter_gc_unsafe_region (gpointer* stackdata); gpointer mono_threads_enter_gc_unsafe_region_internal (MonoStackData *stackdata); -MONO_RT_EXTERNAL_ONLY MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_threads_exit_gc_unsafe_region (gpointer cookie, gpointer* stackdata); void @@ -67,16 +67,16 @@ mono_threads_exit_gc_unsafe_region_unbalanced (gpointer cookie, gpointer* stackd void mono_threads_exit_gc_unsafe_region_unbalanced_internal (gpointer cookie, MonoStackData *stackdata); -MONO_RT_EXTERNAL_ONLY MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_threads_assert_gc_unsafe_region (void); -MONO_RT_EXTERNAL_ONLY MONO_API gpointer +MONO_API MONO_RT_EXTERNAL_ONLY gpointer mono_threads_enter_gc_safe_region (gpointer *stackdata); MONO_PROFILER_API gpointer mono_threads_enter_gc_safe_region_internal (MonoStackData *stackdata); -MONO_RT_EXTERNAL_ONLY MONO_API void +MONO_API MONO_RT_EXTERNAL_ONLY void mono_threads_exit_gc_safe_region (gpointer cookie, gpointer *stackdata); MONO_PROFILER_API void diff --git a/mono/utils/mono-threads-coop.c b/mono/utils/mono-threads-coop.c index ab8f3e793b..0d42f556ce 100644 --- a/mono/utils/mono-threads-coop.c +++ b/mono/utils/mono-threads-coop.c @@ -508,43 +508,166 @@ mono_threads_assert_gc_unsafe_region (void) MONO_REQ_GC_UNSAFE_MODE; } +static MonoThreadsSuspendPolicy +threads_suspend_policy_default (void) +{ +#if defined (ENABLE_COOP_SUSPEND) + return MONO_THREADS_SUSPEND_FULL_COOP; +#else +#if defined (ENABLE_HYBRID_SUSPEND) + return MONO_THREADS_SUSPEND_HYBRID; +#else + return 0; /* unset */ +#endif +#endif +} + +/* Look up whether an env var is set, warn that it's obsolete and offer a new + * alternative + */ +static gboolean +hasenv_obsolete (const char *name, const char* newval) +{ + // If they already set MONO_THREADS_SUSPEND to something, maybe they're keeping + // the old var set for compatability with old Mono - in that case don't nag. + // FIXME: but maybe nag if MONO_THREADS_SUSPEND isn't set to "newval"? + static int quiet = -1; + if (g_hasenv (name)) { + if (G_UNLIKELY (quiet == -1)) + quiet = g_hasenv ("MONO_THREADS_SUSPEND"); + if (!quiet) + g_warning ("%s environment variable is obsolete. Use MONO_THREADS_SUSPEND=%s", name, newval); + return TRUE; + } + return FALSE; +} + +static MonoThreadsSuspendPolicy +threads_suspend_policy_getenv_compat (void) +{ + MonoThreadsSuspendPolicy policy = 0; + if (hasenv_obsolete ("MONO_ENABLE_COOP", "coop") || hasenv_obsolete ("MONO_ENABLE_COOP_SUSPEND", "coop")) { + g_assertf (!hasenv_obsolete ("MONO_ENABLE_HYBRID_SUSPEND", "hybrid"), + "Environment variables set to enable both hybrid and cooperative suspend simultaneously"); + policy = MONO_THREADS_SUSPEND_FULL_COOP; + } else if (hasenv_obsolete ("MONO_ENABLE_HYBRID_SUSPEND", "hybrid")) + policy = MONO_THREADS_SUSPEND_HYBRID; + return policy; +} + +static MonoThreadsSuspendPolicy +threads_suspend_policy_getenv (void) +{ + MonoThreadsSuspendPolicy policy = 0; + if (g_hasenv ("MONO_THREADS_SUSPEND")) { + gchar *str = g_getenv ("MONO_THREADS_SUSPEND"); + if (!strcmp (str, "coop")) + policy = MONO_THREADS_SUSPEND_FULL_COOP; + else if (!strcmp (str, "hybrid")) + policy = MONO_THREADS_SUSPEND_HYBRID; + else if (!strcmp (str, "preemptive")) + policy = MONO_THREADS_SUSPEND_FULL_PREEMPTIVE; + else + g_error ("MONO_THREADS_SUSPEND environment variable set to '%s', must be one of coop, hybrid, preemptive.", str); + g_free (str); + } + return policy; +} + +static MonoThreadsSuspendPolicy threads_suspend_policy = -1; + +static MonoThreadsSuspendPolicy +mono_threads_suspend_policy (void) +{ + MonoThreadsSuspendPolicy policy = threads_suspend_policy; + if (G_UNLIKELY (policy == -1)) { + // thread suspend policy: + // if the MONO_THREADS_SUSPEND env is set, use it. + // otherwise if there's a compiled-in default, use it. + // otherwise if one of the old environment variables is set, use that. + // otherwise use full preemptive suspend. + MonoThreadsSuspendPolicy env_policy = threads_suspend_policy_getenv (); + MonoThreadsSuspendPolicy default_policy = threads_suspend_policy_default (); + MonoThreadsSuspendPolicy env_compat_policy = threads_suspend_policy_getenv_compat (); + if (env_policy) + policy = env_policy; + else if (default_policy) + policy = default_policy; + else if (env_compat_policy) + policy = env_compat_policy; + else + policy = MONO_THREADS_SUSPEND_FULL_PREEMPTIVE; + + g_assert (policy > 0); + threads_suspend_policy = policy; + } + return policy; +} + +/** + * mono_threads_suspend_override_policy: + * + * Don't use this. Provides a last resort escape hatch to override configure + * and environment settings and use the given thread suspend policy. + * + */ +void +mono_threads_suspend_override_policy (MonoThreadsSuspendPolicy new_policy) +{ + threads_suspend_policy = new_policy; + g_warning ("Overriding suspend policy. Using %s suspend.", mono_threads_suspend_policy_name ()); +} + +const char* +mono_threads_suspend_policy_name (void) +{ + MonoThreadsSuspendPolicy policy = mono_threads_suspend_policy (); + switch (policy) { + case MONO_THREADS_SUSPEND_FULL_COOP: + return "cooperative"; + case MONO_THREADS_SUSPEND_FULL_PREEMPTIVE: + return "preemptive"; + case MONO_THREADS_SUSPEND_HYBRID: + return "hybrid"; + default: + g_assert_not_reached (); + } +} + gboolean mono_threads_is_cooperative_suspension_enabled (void) { -#if defined(ENABLE_COOP_SUSPEND) - return TRUE; -#else - static int is_coop_enabled = -1; - if (G_UNLIKELY (is_coop_enabled == -1)) - is_coop_enabled = (g_hasenv ("MONO_ENABLE_COOP") || g_hasenv ("MONO_ENABLE_COOP_SUSPEND")) ? 1 : 0; - return is_coop_enabled == 1; -#endif + return (mono_threads_suspend_policy () == MONO_THREADS_SUSPEND_FULL_COOP); } gboolean mono_threads_is_blocking_transition_enabled (void) { -#if defined(ENABLE_COOP_SUSPEND) || defined(ENABLE_HYBRID_SUSPEND) - return TRUE; -#else static int is_blocking_transition_enabled = -1; - if (G_UNLIKELY (is_blocking_transition_enabled == -1)) - is_blocking_transition_enabled = (g_hasenv ("MONO_ENABLE_COOP") || g_hasenv ("MONO_ENABLE_COOP_SUSPEND") || g_hasenv ("MONO_ENABLE_HYBRID_SUSPEND") || g_hasenv ("MONO_ENABLE_BLOCKING_TRANSITION")) ? 1 : 0; + if (G_UNLIKELY (is_blocking_transition_enabled == -1)) { + if (g_hasenv ("MONO_ENABLE_BLOCKING_TRANSITION")) + is_blocking_transition_enabled = 1; + else { + switch (mono_threads_suspend_policy ()) { + case MONO_THREADS_SUSPEND_FULL_COOP: + case MONO_THREADS_SUSPEND_HYBRID: + is_blocking_transition_enabled = 1; + break; + case MONO_THREADS_SUSPEND_FULL_PREEMPTIVE: + is_blocking_transition_enabled = 0; + break; + default: + g_assert_not_reached (); + } + } + } return is_blocking_transition_enabled == 1; -#endif } gboolean mono_threads_is_hybrid_suspension_enabled (void) { -#if defined(ENABLE_HYBRID_SUSPEND) - return TRUE; -#else - static int is_hybrid_suspension_enabled = -1; - if (G_UNLIKELY (is_hybrid_suspension_enabled == -1)) - is_hybrid_suspension_enabled = (g_hasenv ("MONO_ENABLE_HYBRID_SUSPEND")) ? 1 : 0; - return is_hybrid_suspension_enabled == 1; -#endif + return (mono_threads_suspend_policy () == MONO_THREADS_SUSPEND_HYBRID); } diff --git a/mono/utils/mono-threads-coop.h b/mono/utils/mono-threads-coop.h index d1ce93c46b..d86c8b4ad8 100644 --- a/mono/utils/mono-threads-coop.h +++ b/mono/utils/mono-threads-coop.h @@ -28,6 +28,9 @@ extern volatile size_t mono_polling_required; void mono_threads_state_poll (void); +const char* +mono_threads_suspend_policy_name (void); + gboolean mono_threads_is_blocking_transition_enabled (void); @@ -50,6 +53,20 @@ mono_threads_safepoint (void) mono_threads_state_poll (); } +/* -1 and 0 also used: + * -1 means uninitialized + * 0 means unset + */ +typedef enum { + MONO_THREADS_SUSPEND_FULL_PREEMPTIVE = 1, + MONO_THREADS_SUSPEND_FULL_COOP, + MONO_THREADS_SUSPEND_HYBRID +} MonoThreadsSuspendPolicy; + +/* Don't use this. */ +void mono_threads_suspend_override_policy (MonoThreadsSuspendPolicy new_policy); + + /* * The following are used when detaching a thread. We need to pass the MonoThreadInfo* * as a paramater as the thread info TLS key is being destructed, meaning that diff --git a/mono/utils/mono-threads-mach-helper.c b/mono/utils/mono-threads-mach-helper.c index db1e5b9fce..b01b0668bf 100644 --- a/mono/utils/mono-threads-mach-helper.c +++ b/mono/utils/mono-threads-mach-helper.c @@ -8,14 +8,14 @@ * (C) 2014 Xamarin Inc */ -#include "config.h" - #if defined(__MACH__) - +#include "config.h" +#include #include #include #include #include +#include /* * We cannot include mono-threads.h as this includes io-layer internal types @@ -24,7 +24,8 @@ */ void mono_threads_init_dead_letter (void); void mono_threads_install_dead_letter (void); -void mono_thread_info_detach (void); +MONO_API void +mono_thread_info_detach (void); static Class nsobject, nsthread, mono_dead_letter_class; static SEL dealloc, release, currentThread, threadDictionary, init, alloc, objectForKey, setObjectForKey; @@ -57,7 +58,11 @@ mono_dead_letter_dealloc (id self, SEL _cmd) { struct objc_super super; super.receiver = self; +#if !defined(__cplusplus) && !__OBJC2__ super.class = nsobject; +#else + super.super_class = nsobject; +#endif objc_msgSendSuper (&super, dealloc); mono_thread_info_detach (); diff --git a/mono/utils/mono-threads-mach.c b/mono/utils/mono-threads-mach.c index 1507c97ed8..0afd75cc73 100644 --- a/mono/utils/mono-threads-mach.c +++ b/mono/utils/mono-threads-mach.c @@ -24,6 +24,7 @@ #include #include #include +#include #include void @@ -75,13 +76,18 @@ mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interru if (ret != KERN_SUCCESS) return FALSE; - /* We're in the middle of a self-suspend, resume and register */ if (!mono_threads_transition_finish_async_suspend (info)) { + /* We raced with self-suspend and lost. Resume the native + * thread. It is still self-suspended, waiting to be resumed. + * So suspend can continue. + */ do { ret = thread_resume (info->native_handle); } while (ret == KERN_ABORTED); g_assert (ret == KERN_SUCCESS); - THREADS_SUSPEND_DEBUG ("FAILSAFE RESUME/1 %p -> %d\n", (gpointer)(gsize)info->native_handle, 0); + info->suspend_can_continue = TRUE; + THREADS_SUSPEND_DEBUG ("\tlost race with self suspend %p\n", (gpointer)(gsize)info->native_handle); + g_assert (mono_threads_is_hybrid_suspension_enabled ()); //XXX interrupt_kernel doesn't make sense in this case as the target is not in a syscall return TRUE; } diff --git a/mono/utils/mono-threads-posix.c b/mono/utils/mono-threads-posix.c index 5c5d8d9116..ee1f82f446 100644 --- a/mono/utils/mono-threads-posix.c +++ b/mono/utils/mono-threads-posix.c @@ -129,7 +129,7 @@ mono_threads_platform_exit (gsize exit_code) } int -ves_icall_System_Threading_Thread_SystemMaxStackSize (MonoError *error) +mono_thread_info_get_system_max_stack_size (void) { struct rlimit lim; diff --git a/mono/utils/mono-threads-state-machine.c b/mono/utils/mono-threads-state-machine.c index 7a44d6b2a9..39e04aa0d5 100644 --- a/mono/utils/mono-threads-state-machine.c +++ b/mono/utils/mono-threads-state-machine.c @@ -265,6 +265,47 @@ STATE_ASYNC_SUSPEND_REQUESTED: Since there can only be one async suspend in prog } +/* +Peek at the thread state and return whether it's BLOCKING_SUSPEND_REQUESTED or not. + +Assumes that it is called in the second phase of a two-phase suspend, so the +thread is either some flavor of suspended or else blocking suspend requested. +All other states can't happen. + */ +gboolean +mono_threads_transition_peek_blocking_suspend_requested (MonoThreadInfo *info) +{ + int raw_state, cur_state, suspend_count; + g_assert (info != mono_thread_info_current ()); + + UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info); + + switch (cur_state) { + case STATE_ASYNC_SUSPENDED: + case STATE_SELF_SUSPENDED: + return FALSE; /*ReqPeekBlockingSuspendRequestedRunningSuspended;*/ + case STATE_BLOCKING_SELF_SUSPENDED: + case STATE_BLOCKING_ASYNC_SUSPENDED: + case STATE_BLOCKING_SUSPEND_REQUESTED: + if (!(suspend_count > 0 && suspend_count < THREAD_SUSPEND_COUNT_MAX)) + mono_fatal_with_history ("suspend_count = %d, but should be > 0 and < THREAD_SUSPEND_COUNT_MAX", suspend_count); + if (cur_state == STATE_BLOCKING_SUSPEND_REQUESTED) + return TRUE; /*ReqPeekBlockingSuspendRequestedBlockingSuspendRequested;*/ + else + return FALSE; /*ReqPeekBlockingSuspendRequestedBlockingSuspended;*/ +/* + STATE_RUNNING: + Can't happen - should have been suspended in the first phase. + STATE_ASYNC_SUSPEND_REQUESTED + Can't happen - first phase should've waited until the thread self-suspended + STATE_BLOCKING: + Can't happen - should've had a suspension request in the first phase. + */ + default: + mono_fatal_with_history ("Thread %p in unexpected state %s with PEEK_BLOCKING_SUSPEND_REQUESTED", mono_thread_info_get_tid (info), state_name (cur_state)); + } +} + /* Check the current state of the thread and try to init a self suspend. This must be called with self state saved. @@ -580,11 +621,11 @@ retry_state_change: UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info); switch (cur_state) { case STATE_RUNNING: //thread already in runnable state - trace_state_change_with_func ("ABORT_BLOCKING", info, raw_state, cur_state, 0, func); + trace_state_change_sigsafe ("ABORT_BLOCKING", info, raw_state, cur_state, 0, func); return AbortBlockingIgnore; case STATE_ASYNC_SUSPEND_REQUESTED: //thread is runnable and have a pending suspend - trace_state_change_with_func ("ABORT_BLOCKING", info, raw_state, cur_state, 0, func); + trace_state_change_sigsafe ("ABORT_BLOCKING", info, raw_state, cur_state, 0, func); return AbortBlockingIgnoreAndPoll; case STATE_BLOCKING: diff --git a/mono/utils/mono-threads-wasm.c b/mono/utils/mono-threads-wasm.c index e0528f67ce..8c8347e3ff 100644 --- a/mono/utils/mono-threads-wasm.c +++ b/mono/utils/mono-threads-wasm.c @@ -34,7 +34,7 @@ wasm_get_stack_size (void) int -ves_icall_System_Threading_Thread_SystemMaxStackSize (MonoError *error) +mono_thread_info_get_system_max_stack_size (void) { return wasm_get_stack_size (); } diff --git a/mono/utils/mono-threads-windows.c b/mono/utils/mono-threads-windows.c index 1ddf9009ee..1d40263552 100644 --- a/mono/utils/mono-threads-windows.c +++ b/mono/utils/mono-threads-windows.c @@ -13,6 +13,7 @@ #if defined(USE_WINDOWS_BACKEND) #include +#include #include #include #include @@ -50,11 +51,16 @@ mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interru return FALSE; } - /* We're in the middle of a self-suspend, resume and register */ if (!mono_threads_transition_finish_async_suspend (info)) { + /* We raced with self-suspend and lost. Resume the native + * thread. It is still self-suspended, waiting to be resumed. + * So suspend can continue. + */ result = ResumeThread (handle); g_assert (result == 1); - THREADS_SUSPEND_DEBUG ("FAILSAFE RESUME/1 %p -> %d\n", (void*)id, 0); + info->suspend_can_continue = TRUE; + THREADS_SUSPEND_DEBUG ("\tlost race with self suspend %p\n", (void*)id); + g_assert (mono_threads_is_hybrid_suspension_enabled ()); //XXX interrupt_kernel doesn't make sense in this case as the target is not in a syscall return TRUE; } @@ -363,7 +369,7 @@ mono_threads_platform_exit (gsize exit_code) } int -ves_icall_System_Threading_Thread_SystemMaxStackSize (MonoError *error) +mono_thread_info_get_system_max_stack_size (void) { //FIXME return INT_MAX; diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index b18824558c..21a28132e7 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -65,8 +65,8 @@ static size_t thread_info_size; static MonoThreadInfoCallbacks threads_callbacks; static MonoThreadInfoRuntimeCallbacks runtime_callbacks; static MonoNativeTlsKey thread_info_key, thread_exited_key; -#ifdef HAVE_KW_THREAD -static __thread gint32 tls_small_id = -1; +#ifdef MONO_KEYWORD_THREAD +static MONO_KEYWORD_THREAD gint32 tls_small_id = -1; #else static MonoNativeTlsKey small_id_key; #endif @@ -152,7 +152,7 @@ begin_suspend_for_running_thread (MonoThreadInfo *info, gboolean interrupt_kerne } static BeginSuspendResult -begin_suspend_for_blocking_thread (MonoThreadInfo *info, gboolean interrupt_kernel, gboolean *did_interrupt) +begin_suspend_for_blocking_thread (MonoThreadInfo *info, gboolean interrupt_kernel, MonoThreadSuspendPhase phase, gboolean *did_interrupt) { // if a thread can't transition to blocking, we certainly shouldn't be // trying to suspend it like it's blocking. @@ -163,7 +163,18 @@ begin_suspend_for_blocking_thread (MonoThreadInfo *info, gboolean interrupt_kern if (did_interrupt) { *did_interrupt = interrupt_kernel; } - return begin_preemptive_suspend (info, interrupt_kernel); + switch (phase) { + case MONO_THREAD_SUSPEND_PHASE_INITIAL: + /* In hybrid suspend, in the first phase, a thread in + * blocking can continue running (and possibly + * self-suspend). We'll preemptively suspend it in the + * second phase. */ + return BeginSuspendOkNoWait; + case MONO_THREAD_SUSPEND_PHASE_MOPUP: + return begin_preemptive_suspend (info, interrupt_kernel); + default: + g_assert_not_reached (); + } } else { if (did_interrupt) *did_interrupt = FALSE; @@ -176,12 +187,6 @@ begin_suspend_for_blocking_thread (MonoThreadInfo *info, gboolean interrupt_kern static gboolean check_async_suspend (MonoThreadInfo *info, BeginSuspendResult result) { - if (mono_threads_is_cooperative_suspension_enabled () && !mono_threads_is_hybrid_suspension_enabled ()) { - /* Async suspend can't async fail on coop */ - g_assert (result == BeginSuspendOkCooperative); - return TRUE; - } - switch (result) { case BeginSuspendOkCooperative: return TRUE; @@ -267,14 +272,15 @@ dump_threads (void) MOSTLY_ASYNC_SAFE_PRINTF ("STATE CUE CARD: (? means a positive number, usually 1 or 2, * means any number)\n"); MOSTLY_ASYNC_SAFE_PRINTF ("\t0x0\t- starting (GOOD, unless the thread is running managed code)\n"); - MOSTLY_ASYNC_SAFE_PRINTF ("\t0x1\t- running (BAD, unless it's the gc thread)\n"); - MOSTLY_ASYNC_SAFE_PRINTF ("\t0x2\t- detached (GOOD, unless the thread is running managed code)\n"); + MOSTLY_ASYNC_SAFE_PRINTF ("\t0x1\t- detached (GOOD, unless the thread is running managed code)\n"); + MOSTLY_ASYNC_SAFE_PRINTF ("\t0x2\t- running (BAD, unless it's the gc thread)\n"); MOSTLY_ASYNC_SAFE_PRINTF ("\t0x?03\t- async suspended (GOOD)\n"); MOSTLY_ASYNC_SAFE_PRINTF ("\t0x?04\t- self suspended (GOOD)\n"); MOSTLY_ASYNC_SAFE_PRINTF ("\t0x?05\t- async suspend requested (BAD)\n"); - MOSTLY_ASYNC_SAFE_PRINTF ("\t0x?06\t- self suspend requested (BAD)\n"); - MOSTLY_ASYNC_SAFE_PRINTF ("\t0x*07\t- blocking (GOOD)\n"); - MOSTLY_ASYNC_SAFE_PRINTF ("\t0x?08\t- blocking with pending suspend (GOOD)\n"); + MOSTLY_ASYNC_SAFE_PRINTF ("\t0x6\t- blocking (BAD, unless there's no suspend initiator)\n"); + MOSTLY_ASYNC_SAFE_PRINTF ("\t0x?07\t- blocking async suspended (GOOD)\n"); + MOSTLY_ASYNC_SAFE_PRINTF ("\t0x?08\t- blocking self suspended (GOOD)\n"); + MOSTLY_ASYNC_SAFE_PRINTF ("\t0x?09\t- blocking suspend requested (BAD in coop; GOOD in hybrid)\n"); FOREACH_THREAD_SAFE_ALL (info) { #ifdef TARGET_MACH @@ -406,7 +412,7 @@ mono_thread_info_register_small_id (void) return small_id; small_id = mono_thread_small_id_alloc (); -#ifdef HAVE_KW_THREAD +#ifdef MONO_KEYWORD_THREAD tls_small_id = small_id; #else mono_native_tls_set_value (small_id_key, GUINT_TO_POINTER (small_id + 1)); @@ -521,7 +527,7 @@ unregister_thread (void *arg) * TLS destruction order is not reliable so small_id might be cleaned up * before us. */ -#ifndef HAVE_KW_THREAD +#ifndef MONO_KEYWORD_THREAD mono_native_tls_set_value (small_id_key, GUINT_TO_POINTER (info->small_id + 1)); #endif @@ -640,7 +646,7 @@ mono_thread_info_current (void) int mono_thread_info_get_small_id (void) { -#ifdef HAVE_KW_THREAD +#ifdef MONO_KEYWORD_THREAD return tls_small_id; #else gpointer val = mono_native_tls_get_value (small_id_key); @@ -791,6 +797,85 @@ mono_thread_info_set_flags (MonoThreadInfoFlags flags) threads_callbacks.thread_flags_changed (old, flags); } +struct GSList { + gpointer data; + GSList *next; +}; + +#define MONO_END_INIT_CB GINT_TO_POINTER(-1) +static GSList *init_callbacks; + +void +mono_thread_info_wait_inited (void) +{ + MonoSemType cb; + mono_os_sem_init (&cb, 0); + gpointer old = init_callbacks; + + GSList wait_request; + wait_request.data = &cb; + wait_request.next = old; + + while (mono_threads_inited != TRUE) { + gpointer old_read = mono_atomic_cas_ptr ((gpointer *) &init_callbacks, &wait_request, old); + + // Queued up waiter, need to be unstuck + if (old_read == old) { + break; + } else if (old_read == GINT_TO_POINTER (MONO_END_INIT_CB)) { + // Is inited + return; + } else { + // We raced with another writer + wait_request.next = (GSList *) old_read; + old = old_read; + } + } + + while (mono_threads_inited != TRUE) { + gboolean timedout = mono_os_sem_timedwait (&cb, 1000, MONO_SEM_FLAGS_NONE) == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT; + if (!timedout) + break; + } + + g_assert (mono_threads_inited); + return; +} + +static void +mono_thread_info_set_inited (void) +{ + mono_threads_inited = TRUE; + mono_memory_barrier (); + + GSList *old = init_callbacks; + + while (TRUE) { + gpointer old_read = mono_atomic_cas_ptr ((gpointer *) &init_callbacks, MONO_END_INIT_CB, (gpointer) old); + if (old == old_read) + break; + else + old = old_read; + } + if (old == MONO_END_INIT_CB) { + // Try not to use g_error / g_warning because this machinery used by logging + // Don't want to loop back into it. + fprintf (stderr, "Global threads inited twice"); + exit (1); + return; + } + + while (old != NULL) { + GSList *curr = (GSList *) old; + GSList *next = old->next; + + mono_os_sem_post (curr->data); + old = next; + } + + return; +} + void mono_thread_info_init (size_t info_size) { @@ -807,7 +892,7 @@ mono_thread_info_init (size_t info_size) g_assert (res); -#ifndef HAVE_KW_THREAD +#ifndef MONO_KEYWORD_THREAD res = mono_native_tls_alloc (&small_id_key, NULL); #endif g_assert (res); @@ -833,7 +918,7 @@ mono_thread_info_init (size_t info_size) mono_threads_coop_init (); mono_threads_platform_init (); - mono_threads_inited = TRUE; + mono_thread_info_set_inited (); g_assert (sizeof (MonoNativeThreadId) <= sizeof (uintptr_t)); } @@ -919,37 +1004,111 @@ cleanup: return result; } -gboolean -mono_thread_info_begin_suspend (MonoThreadInfo *info) +static MonoThreadBeginSuspendResult +begin_suspend_request_suspension_cordially (MonoThreadInfo *info); + +static MonoThreadBeginSuspendResult +begin_suspend_peek_and_preempt (MonoThreadInfo *info); + + +MonoThreadBeginSuspendResult +mono_thread_info_begin_suspend (MonoThreadInfo *info, MonoThreadSuspendPhase phase) { + if (phase == MONO_THREAD_SUSPEND_PHASE_MOPUP && mono_threads_is_hybrid_suspension_enabled ()) + return begin_suspend_peek_and_preempt (info); + else + return begin_suspend_request_suspension_cordially (info); +} + +MonoThreadBeginSuspendResult +begin_suspend_request_suspension_cordially (MonoThreadInfo *info) +{ + /* Ask the thread nicely to suspend. In hybrid suspend, blocking + * threads are transitioned to blocking_suspend_requested, but not + * preemptively suspend in the current phase. + */ switch (mono_threads_transition_request_suspension (info)) { case ReqSuspendAlreadySuspended: - return TRUE; + return MONO_THREAD_BEGIN_SUSPEND_SUSPENDED; case ReqSuspendAlreadySuspendedBlocking: - // This state should not be possible if we're using preemptive - // suspend on a blocking thread - there can only be a single - // suspend initiator at a time (guarded by - // mono_thread_info_suspend_lock), and we expect the victim - // thread to finish the two-phase preemptive suspension - // procedure (and reach the ReqSuspendAlreadySuspended stage) - // before the next suspend initiator can begin. - g_assert (mono_threads_is_blocking_transition_enabled () && !mono_threads_is_hybrid_suspension_enabled ()); + if (mono_threads_is_hybrid_suspension_enabled ()) { + /* This should only happen in the second phase of + * hybrid suspend. It means that the first phase asked + * the thread to suspend but did not signal it to + * suspend preemptively. */ + g_assert_not_reached (); + } else { + // This state should not be possible if we're using preemptive + // suspend on a blocking thread - there can only be a single + // suspend initiator at a time (guarded by + // mono_thread_info_suspend_lock), and we expect the victim + // thread to finish the two-phase preemptive suspension + // procedure (and reach the ReqSuspendAlreadySuspended stage) + // before the next suspend initiator can begin. + g_assert (mono_threads_is_blocking_transition_enabled ()); - return TRUE; + return MONO_THREAD_BEGIN_SUSPEND_SUSPENDED; + } case ReqSuspendInitSuspendBlocking: // in full cooperative mode just leave BLOCKING // threads running until they try to return to RUNNING, so // nothing to do, in hybrid coop preempt the thread. - return begin_suspend_for_blocking_thread (info, FALSE, NULL) != BeginSuspendFail; + switch (begin_suspend_for_blocking_thread (info, FALSE, MONO_THREAD_SUSPEND_PHASE_INITIAL, NULL)) { + case BeginSuspendFail: + return MONO_THREAD_BEGIN_SUSPEND_SKIP; + case BeginSuspendOkNoWait: + if (mono_threads_is_hybrid_suspension_enabled ()) + return MONO_THREAD_BEGIN_SUSPEND_NEXT_PHASE; + else { + g_assert (mono_threads_is_cooperative_suspension_enabled ()); + return MONO_THREAD_BEGIN_SUSPEND_SUSPENDED; + } + case BeginSuspendOkPreemptive: + case BeginSuspendOkCooperative: + return MONO_THREAD_BEGIN_SUSPEND_SUSPENDED; + default: + g_assert_not_reached (); + } case ReqSuspendInitSuspendRunning: // in full preemptive mode this should be a preemptive suspend // in full and hybrid cooperative modes this should be a coop suspend - return begin_suspend_for_running_thread (info, FALSE) != BeginSuspendFail; + if (begin_suspend_for_running_thread (info, FALSE) != BeginSuspendFail) + return MONO_THREAD_BEGIN_SUSPEND_SUSPENDED; + else + return MONO_THREAD_BEGIN_SUSPEND_SKIP; default: g_assert_not_reached (); } } +MonoThreadBeginSuspendResult +begin_suspend_peek_and_preempt (MonoThreadInfo *info) +{ + /* This only makes sense for two-phase hybrid suspension: + * requires that a suspension request transition was already performed for 'info', + * and if it is still in blocking_suspend_requested, preemptively suspends it. + */ + g_assert (mono_threads_is_hybrid_suspension_enabled ()); + if (mono_threads_transition_peek_blocking_suspend_requested (info)) { + // in full cooperative mode just leave BLOCKING + // threads running until they try to return to RUNNING, so + // nothing to do, in hybrid coop preempt the thread. + switch (begin_suspend_for_blocking_thread (info, FALSE, MONO_THREAD_SUSPEND_PHASE_MOPUP, NULL)) { + case BeginSuspendFail: + return MONO_THREAD_BEGIN_SUSPEND_SKIP; + case BeginSuspendOkNoWait: + case BeginSuspendOkCooperative: + /* can't happen - should've suspended in the previous phase */ + g_assert_not_reached (); + case BeginSuspendOkPreemptive: + return MONO_THREAD_BEGIN_SUSPEND_SUSPENDED; + default: + g_assert_not_reached (); + } + } else + return MONO_THREAD_BEGIN_SUSPEND_SUSPENDED; +} + gboolean mono_thread_info_begin_resume (MonoThreadInfo *info) { @@ -1052,7 +1211,7 @@ suspend_sync (MonoNativeThreadId tid, gboolean interrupt_kernel) return info; case ReqSuspendInitSuspendBlocking: { gboolean did_interrupt = FALSE; - suspend_result = begin_suspend_for_blocking_thread (info, interrupt_kernel, &did_interrupt); + suspend_result = begin_suspend_for_blocking_thread (info, interrupt_kernel, MONO_THREAD_SUSPEND_PHASE_MOPUP, &did_interrupt); if (suspend_result == BeginSuspendFail) { mono_hazard_pointer_clear (hp, 1); return NULL; @@ -1061,6 +1220,13 @@ suspend_sync (MonoNativeThreadId tid, gboolean interrupt_kernel) if (suspend_result != BeginSuspendOkNoWait) mono_threads_wait_pending_operations (); + if (!check_async_suspend (info, suspend_result)) { + mono_thread_info_core_resume (info); + mono_threads_wait_pending_operations (); + mono_hazard_pointer_clear (hp, 1); + return NULL; + } + // if we tried to preempt the thread already, do nothing. // otherwise (if it's running in blocking mode) try to abort the syscall. if (interrupt_kernel && !did_interrupt) @@ -1708,7 +1874,7 @@ mono_thread_info_self_interrupt (void) /* Clear the interrupted flag of the current thread, set with * mono_thread_info_self_interrupt, so it can wait again */ void -mono_thread_info_clear_self_interrupt () +mono_thread_info_clear_self_interrupt (void) { MonoThreadInfo *info; MonoThreadInfoInterruptToken *previous_token; @@ -1835,3 +2001,4 @@ mono_thread_info_get_tools_data (void) return info ? info->tools_data : NULL; } + diff --git a/mono/utils/mono-threads.h b/mono/utils/mono-threads.h index 932a8f9364..3766796e0f 100644 --- a/mono/utils/mono-threads.h +++ b/mono/utils/mono-threads.h @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include #include @@ -175,7 +177,7 @@ typedef enum { MONO_THREAD_INFO_FLAGS_NO_SAMPLE = 2, } MonoThreadInfoFlags; -typedef struct { +typedef struct _MonoThreadInfo { MonoLinkedListSetNode node; guint32 small_id; /*Used by hazard pointers */ MonoNativeThreadHandle native_handle; /* Valid on mach, android and Windows */ @@ -363,6 +365,7 @@ mono_thread_info_set_tid (THREAD_INFO_TYPE *info, MonoNativeThreadId tid) ((MonoThreadInfo*) info)->node.key = (uintptr_t) MONO_NATIVE_THREAD_ID_TO_UINT (tid); } + /* * @thread_info_size is sizeof (GcThreadInfo), a struct the GC defines to make it possible to have * a single block with info from both camps. @@ -370,6 +373,12 @@ mono_thread_info_set_tid (THREAD_INFO_TYPE *info, MonoNativeThreadId tid) void mono_thread_info_init (size_t thread_info_size); +/* + * Wait for the above mono_thread_info_init to be called + */ +void +mono_thread_info_wait_inited (void); + void mono_thread_info_callbacks_init (MonoThreadInfoCallbacks *callbacks); @@ -470,10 +479,10 @@ mono_thread_info_tls_set (THREAD_INFO_TYPE *info, MonoTlsKey key, gpointer value void mono_thread_info_exit (gsize exit_code); -void +MONO_PAL_API void mono_thread_info_install_interrupt (void (*callback) (gpointer data), gpointer data, gboolean *interrupted); -void +MONO_PAL_API void mono_thread_info_uninstall_interrupt (gboolean *interrupted); MonoThreadInfoInterruptToken* @@ -498,7 +507,7 @@ gboolean mono_thread_info_is_live (THREAD_INFO_TYPE *info); int -ves_icall_System_Threading_Thread_SystemMaxStackSize (MonoError *error); +mono_thread_info_get_system_max_stack_size (void); MonoThreadHandle* mono_threads_open_thread_handle (MonoThreadHandle *handle); @@ -661,6 +670,8 @@ gboolean mono_threads_transition_finish_async_suspend (THREAD_INFO_TYPE* info); MonoDoBlockingResult mono_threads_transition_do_blocking (THREAD_INFO_TYPE* info, const char* func); MonoDoneBlockingResult mono_threads_transition_done_blocking (THREAD_INFO_TYPE* info, const char* func); MonoAbortBlockingResult mono_threads_transition_abort_blocking (THREAD_INFO_TYPE* info, const char* func); +gboolean mono_threads_transition_peek_blocking_suspend_requested (THREAD_INFO_TYPE* info); + MonoThreadUnwindState* mono_thread_info_get_suspend_state (THREAD_INFO_TYPE *info); @@ -677,8 +688,38 @@ int mono_thread_info_current_state (THREAD_INFO_TYPE *info); const char* mono_thread_state_name (int state); gboolean mono_thread_is_gc_unsafe_mode (void); +/* Suspend phases: + * + * In a full coop or full preemptive suspend, there is only a single phase. In + * the initial phase, all threads are either cooperatively or preemptively + * suspended, respectively. + * + * In hybrid suspend, there may be two phases. In the initial phase, threads + * are invited to cooperatively suspend. Running threads are expected to + * finish cooperatively suspending (the phase waits for them), but blocking + * threads need not. + * + * If any blocking thread was encountered in the initial phase, a second + * "mop-up" phase runs which checks whether the blocking threads self-suspended + * (in which case nothing more needs to be done) or if they're still in the + * BLOCKING_SUSPEND_REQUESTED state, in which case they are preemptively + * suspended. + */ +typedef enum { + MONO_THREAD_SUSPEND_PHASE_INITIAL = 0, + MONO_THREAD_SUSPEND_PHASE_MOPUP = 1, + // number of phases + MONO_THREAD_SUSPEND_PHASE_COUNT = 2, +} MonoThreadSuspendPhase; + +typedef enum { + MONO_THREAD_BEGIN_SUSPEND_SKIP = 0, + MONO_THREAD_BEGIN_SUSPEND_SUSPENDED = 1, + MONO_THREAD_BEGIN_SUSPEND_NEXT_PHASE = 2, +} MonoThreadBeginSuspendResult; + gboolean mono_thread_info_in_critical_location (THREAD_INFO_TYPE *info); -gboolean mono_thread_info_begin_suspend (THREAD_INFO_TYPE *info); +MonoThreadBeginSuspendResult mono_thread_info_begin_suspend (THREAD_INFO_TYPE *info, MonoThreadSuspendPhase phase); gboolean mono_thread_info_begin_resume (THREAD_INFO_TYPE *info); void mono_threads_add_to_pending_operation_set (THREAD_INFO_TYPE* info); //XXX rename to something to reflect the fact that this is used for both suspend and resume diff --git a/mono/utils/mono-time.h b/mono/utils/mono-time.h index 2dc35dbe2a..7af8080da7 100644 --- a/mono/utils/mono-time.h +++ b/mono/utils/mono-time.h @@ -7,7 +7,6 @@ #include #include - #ifdef HAVE_SYS_TIME_H #include #endif diff --git a/mono/utils/mono-tls.c b/mono/utils/mono-tls.c index c83fb10d53..2c7342c4ba 100644 --- a/mono/utils/mono-tls.c +++ b/mono/utils/mono-tls.c @@ -13,9 +13,10 @@ #include "mono-tls.h" /* - * On all platforms we should be able to use either __thread or pthread/TlsGetValue. + * On all platforms we should be able to use either __thread or __declspec (thread) + * or pthread/TlsGetValue. * Certain platforms will support fast tls only when using one of the thread local - * storage backends. By default this is __thread if we have HAVE_KW_THREAD defined. + * storage backends. By default this is __thread if we have MONO_KEYWORD_THREAD defined. * * By default all platforms will call into these native getters whenever they need * to get a tls value. On certain platforms we can try to be faster than this and @@ -35,7 +36,7 @@ * So far, we never supported inlined fast tls on full-aot systems. */ -#ifdef USE_KW_THREAD +#ifdef MONO_KEYWORD_THREAD /* tls attribute */ #if HAVE_TLS_MODEL_ATTR @@ -159,12 +160,12 @@ /* Tls variables for each MonoTlsKey */ -static __thread gpointer mono_tls_thread MONO_TLS_FAST; -static __thread gpointer mono_tls_jit_tls MONO_TLS_FAST; -static __thread gpointer mono_tls_domain MONO_TLS_FAST; -static __thread gpointer mono_tls_lmf MONO_TLS_FAST; -static __thread gpointer mono_tls_sgen_thread_info MONO_TLS_FAST; -static __thread gpointer mono_tls_lmf_addr MONO_TLS_FAST; +static MONO_KEYWORD_THREAD gpointer mono_tls_thread MONO_TLS_FAST; +static MONO_KEYWORD_THREAD gpointer mono_tls_jit_tls MONO_TLS_FAST; +static MONO_KEYWORD_THREAD gpointer mono_tls_domain MONO_TLS_FAST; +static MONO_KEYWORD_THREAD gpointer mono_tls_lmf MONO_TLS_FAST; +static MONO_KEYWORD_THREAD gpointer mono_tls_sgen_thread_info MONO_TLS_FAST; +static MONO_KEYWORD_THREAD gpointer mono_tls_lmf_addr MONO_TLS_FAST; #else @@ -186,7 +187,7 @@ static MonoNativeTlsKey mono_tls_key_lmf_addr; static gint32 tls_offsets [TLS_KEY_NUM]; -#ifdef USE_KW_THREAD +#ifdef MONO_KEYWORD_THREAD #define MONO_TLS_GET_VALUE(tls_var,tls_key) (tls_var) #define MONO_TLS_SET_VALUE(tls_var,tls_key,value) (tls_var = value) #else @@ -197,7 +198,7 @@ static gint32 tls_offsets [TLS_KEY_NUM]; void mono_tls_init_gc_keys (void) { -#ifdef USE_KW_THREAD +#ifdef MONO_KEYWORD_THREAD MONO_THREAD_VAR_OFFSET (mono_tls_sgen_thread_info, tls_offsets [TLS_KEY_SGEN_THREAD_INFO]); #else mono_native_tls_alloc (&mono_tls_key_sgen_thread_info, NULL); @@ -208,7 +209,7 @@ mono_tls_init_gc_keys (void) void mono_tls_init_runtime_keys (void) { -#ifdef USE_KW_THREAD +#ifdef MONO_KEYWORD_THREAD MONO_THREAD_VAR_OFFSET (mono_tls_thread, tls_offsets [TLS_KEY_THREAD]); MONO_THREAD_VAR_OFFSET (mono_tls_jit_tls, tls_offsets [TLS_KEY_JIT_TLS]); MONO_THREAD_VAR_OFFSET (mono_tls_domain, tls_offsets [TLS_KEY_DOMAIN]); @@ -228,7 +229,7 @@ mono_tls_init_runtime_keys (void) void mono_tls_free_keys (void) { -#ifndef USE_KW_THREAD +#ifndef MONO_KEYWORD_THREAD mono_native_tls_free (mono_tls_key_thread); mono_native_tls_free (mono_tls_key_jit_tls); mono_native_tls_free (mono_tls_key_domain); diff --git a/mono/utils/mono-tls.h b/mono/utils/mono-tls.h index a7950d8f5b..1b864a187c 100644 --- a/mono/utils/mono-tls.h +++ b/mono/utils/mono-tls.h @@ -28,10 +28,6 @@ typedef enum { TLS_KEY_NUM = 5 } MonoTlsKey; -#ifdef HAVE_KW_THREAD -#define USE_KW_THREAD -#endif - #ifdef HOST_WIN32 #include diff --git a/mono/utils/mono-utility-thread.c b/mono/utils/mono-utility-thread.c new file mode 100644 index 0000000000..1943467d24 --- /dev/null +++ b/mono/utils/mono-utility-thread.c @@ -0,0 +1,192 @@ +/** + * \file + * A lightweight worker thread with lockless messaging + * + * Author: + * Alexander Kyte (alkyte@microsoft.com) + * + * (C) 2018 Microsoft, Inc. + * + */ + +#include + +typedef struct { + MonoLockFreeQueueNode node; + + // For cleanup metadata + MonoUtilityThread *thread; + + // For synch calls + gboolean *finished; + MonoSemType *response_sem; + + // Variably-sized, size is thread->payload_size + gpointer payload [MONO_ZERO_LEN_ARRAY]; +} UtilityThreadQueueEntry; + +static void +free_queue_entry (gpointer p) +{ + UtilityThreadQueueEntry *util = (UtilityThreadQueueEntry *) p; + mono_lock_free_free (p, util->thread->message_block_size); +} + +static gboolean +utility_thread_handle_inbox (MonoUtilityThread *thread, gboolean at_shutdown) +{ + UtilityThreadQueueEntry *entry = (UtilityThreadQueueEntry *) mono_lock_free_queue_dequeue (&thread->work_queue); + if (!entry) + return FALSE; + + thread->callbacks.command (thread->state_ptr, &entry->payload, at_shutdown); + if (entry->response_sem) { + *entry->finished = TRUE; + mono_os_sem_post (entry->response_sem); + } + + mono_thread_hazardous_try_free (entry, free_queue_entry); + + return TRUE; +} + +static void * +utility_thread (void *arg) +{ + MonoUtilityThread *thread = (MonoUtilityThread *) arg; + if (thread->callbacks.early_init) + thread->callbacks.early_init (&thread->state_ptr); + + mono_thread_info_wait_inited (); + mono_thread_info_attach (); + + thread->callbacks.init (&thread->state_ptr); + + while (mono_atomic_load_i32 (&thread->run_thread)) { + MONO_ENTER_GC_SAFE; + mono_os_sem_timedwait (&thread->work_queue_sem, 1000, MONO_SEM_FLAGS_NONE); + MONO_EXIT_GC_SAFE; + utility_thread_handle_inbox (thread, FALSE); + } + + /* Drain any remaining entries on shutdown. */ + while (utility_thread_handle_inbox (thread, TRUE)); + + mono_os_sem_destroy (&thread->work_queue_sem); + + thread->callbacks.cleanup (thread->state_ptr); + + return NULL; +} + +MonoUtilityThread * +mono_utility_thread_launch (size_t payload_size, MonoUtilityThreadCallbacks *callbacks, MonoMemAccountType accountType) +{ + MonoUtilityThread *thread = g_malloc0 (sizeof (MonoUtilityThread)); + size_t entry_size = offsetof (UtilityThreadQueueEntry, payload) + payload_size; + + thread->message_block_size = mono_pagesize (); + thread->payload_size = payload_size; + thread->callbacks = *callbacks; + + mono_lock_free_queue_init (&thread->work_queue); + mono_lock_free_allocator_init_size_class (&thread->message_size_class, entry_size, thread->message_block_size); + mono_lock_free_allocator_init_allocator (&thread->message_allocator, &thread->message_size_class, accountType); + mono_os_sem_init (&thread->work_queue_sem, 0); + mono_atomic_store_i32 (&thread->run_thread, 1); + + if (!mono_native_thread_create (&thread->thread_id, utility_thread, thread)) + g_error ("Could not create utility thread"); + + return thread; +} + +static void +mono_utility_thread_send_internal (MonoUtilityThread *thread, UtilityThreadQueueEntry *entry) +{ + mono_lock_free_queue_node_init (&entry->node, FALSE); + mono_lock_free_queue_enqueue (&thread->work_queue, &entry->node); + mono_os_sem_post (&thread->work_queue_sem); +} + +void +mono_utility_thread_send (MonoUtilityThread *thread, gpointer message) +{ + int small_id = mono_thread_info_get_small_id (); + if (small_id < 0) { +#if MONO_PRINT_DROPPED_MESSAGES + fprintf (stderr, "Dropping message send because thread not attached yet\n"); +#endif + return; + } else if (!thread->run_thread) { +#if MONO_PRINT_DROPPED_MESSAGES + fprintf (stderr, "Dropping message send because thread killed\n"); +#endif + return; + } + + UtilityThreadQueueEntry *entry = mono_lock_free_alloc (&thread->message_allocator); + entry->response_sem = NULL; + entry->thread = thread; + memcpy (entry->payload, message, thread->payload_size); + mono_utility_thread_send_internal (thread, entry); +} + +gboolean +mono_utility_thread_send_sync (MonoUtilityThread *thread, gpointer message) +{ + int small_id = mono_thread_info_get_small_id (); + if (small_id < 0) { +#if MONO_PRINT_DROPPED_MESSAGES + fprintf (stderr, "Dropping message send because thread not attached yet\n"); +#endif + return FALSE; + } else if (!thread->run_thread) { +#if MONO_PRINT_DROPPED_MESSAGES + fprintf (stderr, "Dropping message send because thread killed\n"); +#endif + return FALSE; + } + + MonoSemType sem; + mono_os_sem_init (&sem, 0); + + UtilityThreadQueueEntry *entry = mono_lock_free_alloc (&thread->message_allocator); + gboolean done; + + entry->finished = &done; + entry->response_sem = &sem; + entry->thread = thread; + memcpy (entry->payload, message, thread->payload_size); + mono_utility_thread_send_internal (thread, entry); + + while (thread->run_thread && !done) { + // After returns, the entry is filled out with results + gboolean timedout = mono_os_sem_timedwait (&sem, 1000, MONO_SEM_FLAGS_NONE) == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT; + if (!timedout) + break; + mono_os_sem_post (&thread->work_queue_sem); + } + + mono_os_sem_destroy (&sem); + + // Return whether we ended successfully + return done; +} + +void +mono_utility_thread_stop (MonoUtilityThread *thread) +{ + int small_id = mono_thread_info_get_small_id (); + if (small_id < 0) { +#if MONO_PRINT_DROPPED_MESSAGES + fprintf (stderr, "Dropping attempt to stop thread, calling thread not attached yet\n"); +#endif + return; + } else if (!thread->run_thread) { + return; + } + + mono_atomic_store_i32 (&thread->run_thread, 0); + mono_os_sem_post (&thread->work_queue_sem); +} diff --git a/mono/utils/mono-utility-thread.h b/mono/utils/mono-utility-thread.h new file mode 100644 index 0000000000..380047a1cf --- /dev/null +++ b/mono/utils/mono-utility-thread.h @@ -0,0 +1,58 @@ +/** + * \file + * A lightweight worker thread with lockless messaging + * + * Author: + * Alexander Kyte (alkyte@microsoft.com) + * + * (C) 2018 Microsoft, Inc. + * + */ +#ifndef __MONO_UTILITY_THREAD_H__ +#define __MONO_UTILITY_THREAD_H__ + +#include +#include +#include +#include +#include + +#define MONO_PRINT_DROPPED_MESSAGES 0 + +typedef struct { + void (*early_init) (gpointer *state_ptr); + void (*init) (gpointer *state_ptr); + void (*command) (gpointer state_ptr, gpointer message_ptr, gboolean at_shutdown); + void (*cleanup) (gpointer state_ptr); +} MonoUtilityThreadCallbacks; + +typedef struct { + MonoNativeThreadId thread_id; + + MonoLockFreeQueue work_queue; + MonoSemType work_queue_sem; + gboolean run_thread; + + MonoLockFreeAllocator message_allocator; + MonoLockFreeAllocSizeClass message_size_class; + + size_t message_block_size; + size_t payload_size; + + gpointer state_ptr; + MonoUtilityThreadCallbacks callbacks; +} MonoUtilityThread; + +MonoUtilityThread * +mono_utility_thread_launch (size_t payload_size, MonoUtilityThreadCallbacks *callbacks, MonoMemAccountType accountType); + +void +mono_utility_thread_send (MonoUtilityThread *thread, gpointer message); + +gboolean +mono_utility_thread_send_sync (MonoUtilityThread *thread, gpointer message); + +void +mono_utility_thread_stop (MonoUtilityThread *thread); + +#endif /* __MONO_UTILITY_THREAD_H__ */ diff --git a/mono/utils/networking-posix.c b/mono/utils/networking-posix.c index 7ccf6bf66e..85a6eba551 100644 --- a/mono/utils/networking-posix.c +++ b/mono/utils/networking-posix.c @@ -75,7 +75,7 @@ mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInf /* Some ancient libc don't define AI_ADDRCONFIG */ #ifdef AI_ADDRCONFIG if (flags & MONO_HINT_CONFIGURED_ONLY) - hints.ai_flags = AI_ADDRCONFIG; + hints.ai_flags |= AI_ADDRCONFIG; #endif sprintf (service_name, "%d", port); diff --git a/mono/utils/strenc.h b/mono/utils/strenc.h index ce15c38904..0f99953124 100644 --- a/mono/utils/strenc.h +++ b/mono/utils/strenc.h @@ -14,10 +14,10 @@ #include #include -extern MONO_API gunichar2 *mono_unicode_from_external (const gchar *in, gsize *bytes); -extern MONO_API gchar *mono_utf8_from_external (const gchar *in); -extern MONO_API gchar *mono_unicode_to_external (const gunichar2 *uni); -extern MONO_API gboolean mono_utf8_validate_and_len (const gchar *source, glong* oLength, const gchar** oEnd); -extern MONO_API gboolean mono_utf8_validate_and_len_with_bounds (const gchar *source, glong max_bytes, glong* oLength, const gchar** oEnd); +MONO_API gunichar2 *mono_unicode_from_external (const gchar *in, gsize *bytes); +MONO_API gchar *mono_utf8_from_external (const gchar *in); +MONO_API gchar *mono_unicode_to_external (const gunichar2 *uni); +MONO_API gboolean mono_utf8_validate_and_len (const gchar *source, glong* oLength, const gchar** oEnd); +MONO_API gboolean mono_utf8_validate_and_len_with_bounds (const gchar *source, glong max_bytes, glong* oLength, const gchar** oEnd); #endif /* _MONO_STRENC_H_ */ diff --git a/msvc/Makefile.in b/msvc/Makefile.in index fca586101e..390e393075 100644 --- a/msvc/Makefile.in +++ b/msvc/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/msvc/genmdesc.vcxproj b/msvc/genmdesc.vcxproj index e89ff36571..e6aa957065 100644 --- a/msvc/genmdesc.vcxproj +++ b/msvc/genmdesc.vcxproj @@ -147,7 +147,7 @@ Disabled $(MONO_DIR);$(MONO_INCLUDE_DIR);$(MONO_LIBGC_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR);%(AdditionalIncludeDirectories) - _DEBUG;__x86_64__;TARGET_AMD64;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;_CONSOLE;HAVE_CONFIG_H;WINVER=0x0600;_WIN32_WINNT=0x0600;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) + _DEBUG;__x86_64__;TARGET_AMD64;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;_CONSOLE;HAVE_CONFIG_H;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) true @@ -231,7 +231,7 @@ $(MONO_DIR);$(MONO_INCLUDE_DIR);$(MONO_LIBGC_INCLUDE_DIR);$(MONO_EGLIB_SOURCE_DIR);%(AdditionalIncludeDirectories) - NDEBUG;__x86_64__;TARGET_AMD64;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;_CONSOLE;HAVE_CONFIG_H;WINVER=0x0600;_WIN32_WINNT=0x0600;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) + NDEBUG;__x86_64__;TARGET_AMD64;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;_CONSOLE;HAVE_CONFIG_H;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) true diff --git a/msvc/libgc.vcxproj b/msvc/libgc.vcxproj index 5f9fe4a265..9d4116721e 100644 --- a/msvc/libgc.vcxproj +++ b/msvc/libgc.vcxproj @@ -80,7 +80,7 @@ Disabled $(MONO_LIBGC_INCLUDE_DIR);%(AdditionalIncludeDirectories) - _DEBUG;__i386__;TARGET_X86;i386;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;__STDC__;PACKAGE_NAME="libgc-mono";PACKAGE_TARNAME="libgc-mono";PACKAGE_VERSION="6.6";PACKAGE_STRING="libgc-mono 6.6";PACKAGE_BUGREPORT="Hans_Boehm%40hp.com";GC_WIN32_THREADS=1;NO_GETENV=1;GC_INSIDE_DLL=1;GC_NOT_DLL=1;STDC_HEADERS=1;HAVE_SYS_TYPES_H=1;HAVE_SYS_STAT_H=1;HAVE_STDLIB_H=1;HAVE_STRING_H=1;HAVE_MEMORY_H=1;HAVE_STRINGS_H=1;HAVE_INTTYPES_H=1;HAVE_STDINT_H=1;HAVE_UNISTD_H=1;SILENT=1;NO_SIGNALS=1;NO_EXECUTE_PERMISSION=1;JAVA_FINALIZATION=1;GC_GCJ_SUPPORT=1;ATOMIC_UNCOLLECTABLE=1;_IN_LIBGC=1;WINVER=0x0600;_WIN32_WINNT=0x0600;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) + _DEBUG;__i386__;TARGET_X86;i386;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;__STDC__;PACKAGE_NAME="libgc-mono";PACKAGE_TARNAME="libgc-mono";PACKAGE_VERSION="6.6";PACKAGE_STRING="libgc-mono 6.6";PACKAGE_BUGREPORT="Hans_Boehm%40hp.com";GC_WIN32_THREADS=1;NO_GETENV=1;GC_INSIDE_DLL=1;GC_NOT_DLL=1;STDC_HEADERS=1;HAVE_SYS_TYPES_H=1;HAVE_SYS_STAT_H=1;HAVE_STDLIB_H=1;HAVE_STRING_H=1;HAVE_MEMORY_H=1;HAVE_STRINGS_H=1;HAVE_INTTYPES_H=1;HAVE_STDINT_H=1;HAVE_UNISTD_H=1;SILENT=1;NO_SIGNALS=1;NO_EXECUTE_PERMISSION=1;JAVA_FINALIZATION=1;GC_GCJ_SUPPORT=1;ATOMIC_UNCOLLECTABLE=1;_IN_LIBGC=1;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) true @@ -93,7 +93,7 @@ $(MONO_LIBGC_INCLUDE_DIR);%(AdditionalIncludeDirectories) - NDEBUG;__i386__;TARGET_X86;i386;i386;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;__STDC__;PACKAGE_NAME="libgc-mono";PACKAGE_TARNAME="libgc-mono";PACKAGE_VERSION="6.6";PACKAGE_STRING="libgc-mono 6.6";PACKAGE_BUGREPORT="Hans_Boehm%40hp.com";GC_WIN32_THREADS=1;NO_GETENV=1;GC_INSIDE_DLL=1;GC_NOT_DLL=1;STDC_HEADERS=1;HAVE_SYS_TYPES_H=1;HAVE_SYS_STAT_H=1;HAVE_STDLIB_H=1;HAVE_STRING_H=1;HAVE_MEMORY_H=1;HAVE_STRINGS_H=1;HAVE_INTTYPES_H=1;HAVE_STDINT_H=1;HAVE_UNISTD_H=1;SILENT=1;NO_SIGNALS=1;NO_EXECUTE_PERMISSION=1;JAVA_FINALIZATION=1;GC_GCJ_SUPPORT=1;ATOMIC_UNCOLLECTABLE=1;_IN_LIBGC=1;WINVER=0x0600;_WIN32_WINNT=0x0600;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) + NDEBUG;__i386__;TARGET_X86;i386;i386;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;__STDC__;PACKAGE_NAME="libgc-mono";PACKAGE_TARNAME="libgc-mono";PACKAGE_VERSION="6.6";PACKAGE_STRING="libgc-mono 6.6";PACKAGE_BUGREPORT="Hans_Boehm%40hp.com";GC_WIN32_THREADS=1;NO_GETENV=1;GC_INSIDE_DLL=1;GC_NOT_DLL=1;STDC_HEADERS=1;HAVE_SYS_TYPES_H=1;HAVE_SYS_STAT_H=1;HAVE_STDLIB_H=1;HAVE_STRING_H=1;HAVE_MEMORY_H=1;HAVE_STRINGS_H=1;HAVE_INTTYPES_H=1;HAVE_STDINT_H=1;HAVE_UNISTD_H=1;SILENT=1;NO_SIGNALS=1;NO_EXECUTE_PERMISSION=1;JAVA_FINALIZATION=1;GC_GCJ_SUPPORT=1;ATOMIC_UNCOLLECTABLE=1;_IN_LIBGC=1;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) $(IntDir)$(TargetName).pdb @@ -110,7 +110,7 @@ Disabled $(MONO_LIBGC_INCLUDE_DIR);%(AdditionalIncludeDirectories) - _DEBUG;__x86_64__;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;__STDC__;PACKAGE_NAME="libgc-mono";PACKAGE_TARNAME="libgc-mono";PACKAGE_VERSION="6.6";PACKAGE_STRING="libgc-mono 6.6";PACKAGE_BUGREPORT="Hans_Boehm%40hp.com";GC_WIN32_THREADS=1;NO_GETENV=1;GC_INSIDE_DLL=1;GC_NOT_DLL=1;STDC_HEADERS=1;HAVE_SYS_TYPES_H=1;HAVE_SYS_STAT_H=1;HAVE_STDLIB_H=1;HAVE_STRING_H=1;HAVE_MEMORY_H=1;HAVE_STRINGS_H=1;HAVE_INTTYPES_H=1;HAVE_STDINT_H=1;HAVE_UNISTD_H=1;SILENT=1;NO_SIGNALS=1;NO_EXECUTE_PERMISSION=1;JAVA_FINALIZATION=1;GC_GCJ_SUPPORT=1;ATOMIC_UNCOLLECTABLE=1;_IN_LIBGC=1;WINVER=0x0600;_WIN32_WINNT=0x0600;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024 + _DEBUG;__x86_64__;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;__STDC__;PACKAGE_NAME="libgc-mono";PACKAGE_TARNAME="libgc-mono";PACKAGE_VERSION="6.6";PACKAGE_STRING="libgc-mono 6.6";PACKAGE_BUGREPORT="Hans_Boehm%40hp.com";GC_WIN32_THREADS=1;NO_GETENV=1;GC_INSIDE_DLL=1;GC_NOT_DLL=1;STDC_HEADERS=1;HAVE_SYS_TYPES_H=1;HAVE_SYS_STAT_H=1;HAVE_STDLIB_H=1;HAVE_STRING_H=1;HAVE_MEMORY_H=1;HAVE_STRINGS_H=1;HAVE_INTTYPES_H=1;HAVE_STDINT_H=1;HAVE_UNISTD_H=1;SILENT=1;NO_SIGNALS=1;NO_EXECUTE_PERMISSION=1;JAVA_FINALIZATION=1;GC_GCJ_SUPPORT=1;ATOMIC_UNCOLLECTABLE=1;_IN_LIBGC=1;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024 true @@ -126,7 +126,7 @@ $(MONO_LIBGC_INCLUDE_DIR);%(AdditionalIncludeDirectories) - NDEBUG;__x86_64__;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;__STDC__;PACKAGE_NAME="libgc-mono";PACKAGE_TARNAME="libgc-mono";PACKAGE_VERSION="6.6";PACKAGE_STRING="libgc-mono 6.6";PACKAGE_BUGREPORT="Hans_Boehm%40hp.com";GC_WIN32_THREADS=1;NO_GETENV=1;GC_INSIDE_DLL=1;GC_NOT_DLL=1;STDC_HEADERS=1;HAVE_SYS_TYPES_H=1;HAVE_SYS_STAT_H=1;HAVE_STDLIB_H=1;HAVE_STRING_H=1;HAVE_MEMORY_H=1;HAVE_STRINGS_H=1;HAVE_INTTYPES_H=1;HAVE_STDINT_H=1;HAVE_UNISTD_H=1;SILENT=1;NO_SIGNALS=1;NO_EXECUTE_PERMISSION=1;JAVA_FINALIZATION=1;GC_GCJ_SUPPORT=1;ATOMIC_UNCOLLECTABLE=1;_IN_LIBGC=1;WINVER=0x0600;_WIN32_WINNT=0x0600;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) + NDEBUG;__x86_64__;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;__STDC__;PACKAGE_NAME="libgc-mono";PACKAGE_TARNAME="libgc-mono";PACKAGE_VERSION="6.6";PACKAGE_STRING="libgc-mono 6.6";PACKAGE_BUGREPORT="Hans_Boehm%40hp.com";GC_WIN32_THREADS=1;NO_GETENV=1;GC_INSIDE_DLL=1;GC_NOT_DLL=1;STDC_HEADERS=1;HAVE_SYS_TYPES_H=1;HAVE_SYS_STAT_H=1;HAVE_STDLIB_H=1;HAVE_STRING_H=1;HAVE_MEMORY_H=1;HAVE_STRINGS_H=1;HAVE_INTTYPES_H=1;HAVE_STDINT_H=1;HAVE_UNISTD_H=1;SILENT=1;NO_SIGNALS=1;NO_EXECUTE_PERMISSION=1;JAVA_FINALIZATION=1;GC_GCJ_SUPPORT=1;ATOMIC_UNCOLLECTABLE=1;_IN_LIBGC=1;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_THREADS;FD_SETSIZE=1024;%(PreprocessorDefinitions) $(IntDir)$(TargetName).pdb diff --git a/msvc/mono.props b/msvc/mono.props index 4c93b8dc47..6098d6bf22 100644 --- a/msvc/mono.props +++ b/msvc/mono.props @@ -111,7 +111,7 @@ - __default_codegen__;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;GC_NOT_DLL;WIN32_THREADS;WINVER=0x0600;_WIN32_WINNT=0x0600;_WIN32_IE=0x0501;_UNICODE;UNICODE;FD_SETSIZE=1024;NVALGRIND;$(MONO_ADDITIONAL_PREPROCESSOR_DEFINITIONS) + __default_codegen__;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;GC_NOT_DLL;WIN32_THREADS;WINVER=0x0601;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;_UNICODE;UNICODE;FD_SETSIZE=1024;NVALGRIND;$(MONO_ADDITIONAL_PREPROCESSOR_DEFINITIONS) @@ -122,7 +122,7 @@ $(MONO_C_RUNTIME) - Mswsock.lib;ws2_32.lib;ole32.lib;oleaut32.lib;psapi.lib;version.lib;advapi32.lib;winmm.lib;kernel32.lib;%(AdditionalDependencies) + bcrypt.lib;Mswsock.lib;ws2_32.lib;ole32.lib;oleaut32.lib;psapi.lib;version.lib;advapi32.lib;winmm.lib;kernel32.lib;%(AdditionalDependencies) $(MONO_BUILD_DIR_PREFIX)$(Platform)/lib/$(Configuration) diff --git a/msvc/monoposixhelper.vcxproj b/msvc/monoposixhelper.vcxproj index 9d026fc835..4c05e7374c 100644 --- a/msvc/monoposixhelper.vcxproj +++ b/msvc/monoposixhelper.vcxproj @@ -85,7 +85,7 @@ Disabled - _DEBUG;__i386__;TARGET_X86;_WIN32_WINNT=0x0600;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + _DEBUG;__i386__;TARGET_X86;_WIN32_WINNT=0x0601;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) true @@ -110,7 +110,7 @@ Disabled - _DEBUG;__x86_64__;_WIN32_WINNT=0x0600;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + _DEBUG;__x86_64__;_WIN32_WINNT=0x0601;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) true @@ -129,7 +129,7 @@ - NDEBUG;__i386__;TARGET_X86;i386;_WIN32_WINNT=0x0600;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + NDEBUG;__i386__;TARGET_X86;i386;_WIN32_WINNT=0x0601;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) Level3 @@ -154,7 +154,7 @@ X64 - NDEBUG;__x86_64__;_WIN32_WINNT=0x0600;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + NDEBUG;__x86_64__;_WIN32_WINNT=0x0601;WIN64;_WIN64;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions) Level3 diff --git a/msvc/winsetup.bat b/msvc/winsetup.bat index a8359cd4ca..af5330e9fd 100755 --- a/msvc/winsetup.bat +++ b/msvc/winsetup.bat @@ -1,35 +1,76 @@ @ECHO off +SetLocal -SET CONFIG_H=..\config.h -SET CYG_CONFIG_H=..\cygconfig.h -SET WIN_CONFIG_H=..\winconfig.h -SET CONFIGURE_AC=..\configure.ac -SET VERSION_H=..\mono\mini\version.h - +SET CONFIG_H="%~dp0..\config.h" +SET CYG_CONFIG_H="%~dp0..\cygconfig.h" +SET WIN_CONFIG_H="%~dp0..\winconfig.h" +SET CONFIGURE_AC="%~dp0..\configure.ac" +SET VERSION_H="%~dp0..\mono\mini\version.h" ECHO Setting up Mono configuration headers... +:: generate unique temp file path +uuidgen 2>nul || goto no_uuidgen +for /f %%a in ('uuidgen') do set monotemp=%%a +goto :got_temp + +:no_uuidgen +:: Random isn't very random or unique. %time% and %date% is not random but fairly unique. +set monotemp=%~n0%random%%time%%date% + +:got_temp +:: Remove special characters. +set monotemp=%monotemp:-=% +set monotemp=%monotemp:\=% +set monotemp=%monotemp:/=% +set monotemp=%monotemp::=% +set monotemp=%monotemp: =% +set monotemp=%monotemp:.=% +set monotemp=%temp%\monotemp%monotemp% +mkdir "%monotemp%\.." 2>nul +set monotemp="%monotemp%" +echo %monotemp% + REM Backup existing config.h into cygconfig.h if its not already replaced. -%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File backup-config-files.ps1 %CONFIG_H% %CYG_CONFIG_H% 2>&1 +findstr /i /r /c:"#include *\"cygconfig.h\"" %config_h% >nul || copy /y %config_h% %cyg_config_h% -%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %WIN_CONFIG_H% %CONFIG_H% %CONFIGURE_AC% 2>&1 - -IF NOT %ERRORLEVEL% == 0 ( - ECHO copy %WIN_CONFIG_H% %CONFIG_H% - copy %WIN_CONFIG_H% %CONFIG_H% - %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "(Get-Content %CONFIG_H%) -replace '#MONO_VERSION#', (Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value | Set-Content %CONFIG_H%" 2>&1 - %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "$mono_version=[int[]](Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value.Split('.'); $corlib_counter=[int](Select-String -path %CONFIGURE_AC% -pattern 'MONO_CORLIB_COUNTER=(.*)').Matches[0].Groups[1].Value; (Get-Content %CONFIG_H%) -replace '#MONO_CORLIB_VERSION#',('1{0:00}{1:00}{2:00}{3:000}' -f $mono_version[0],$mono_version[1],0,$corlib_counter) | Set-Content %CONFIG_H%" 2>&1 +:: Extract MONO_VERSION from configure.ac. +for /f "delims=[] tokens=2" %%a in ('findstr /b /c:"AC_INIT(mono, [" %CONFIGURE_AC%') do ( + set MONO_VERSION=%%a ) -SET VERSION_CONTENT="#define FULL_VERSION \"Visual Studio built mono\"" -%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-content.ps1 %VERSION_CONTENT% %VERSION_H% 2>&1 - - -IF NOT %ERRORLEVEL% == 0 ( - ECHO Configure %VERSION_H% - ECHO #define FULL_VERSION "Visual Studio built mono"> %VERSION_H% +:: Split MONO_VERSION into three parts. +for /f "delims=. tokens=1-3" %%a in ('echo %MONO_VERSION%') do ( + set MONO_VERSION_MAJOR=%%a + set MONO_VERSION_MINOR=%%b + set MONO_VERSION_PATCH=%%c ) +:: configure.ac hardcodes this. +set MONO_VERSION_PATCH=00 + +:: Extract MONO_CORLIB_VERSION from configure.ac. +for /f "tokens=*" %%a in ('findstr /b /c:MONO_CORLIB_VERSION= %CONFIGURE_AC%') do set %%a + +:: Pad out version pieces to 2 characters with zeros on left. +if "%MONO_VERSION_MAJOR:~1%" == "" set MONO_VERSION_MAJOR=0%MONO_VERSION_MAJOR% +if "%MONO_VERSION_MINOR:~1%" == "" set MONO_VERSION_MINOR=0%MONO_VERSION_MINOR% + +:: Remove every define VERSION from config.h and add what we want. +findstr /v /b /i /c:"#define PACKAGE_VERSION " /c:"#define VERSION " /c:"#define MONO_CORLIB_VERSION " %win_config_h% > %monotemp% +echo #define PACKAGE_VERSION "%MONO_VERSION%" >> %monotemp% +echo #define VERSION "%MONO_VERSION%" >> %monotemp% +echo #define MONO_CORLIB_VERSION "%MONO_CORLIB_VERSION%" >> %monotemp% + +:: If the file is different, replace it. +fc %monotemp% %config_h% >nul || move /y %monotemp% %config_h% +del %monotemp% 2>nul + +echo #define FULL_VERSION "Visual Studio built mono" > %monotemp% +fc %monotemp% %version_h% || move /y %monotemp% %version_h% +del %monotemp% 2>nul + +:: Log environment variables that start "mono". +set MONO ECHO Successfully setup Mono configuration headers. - EXIT /b 0 diff --git a/po/Makefile.in b/po/Makefile.in index 18102df4e1..07cee47e60 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -211,6 +211,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -226,6 +228,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -266,11 +269,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/po/mcs/de.gmo b/po/mcs/de.gmo index a46b8939c90bef6a2b4b76d45372d003d6b4e645..31eb96351c8fec2dc863436fe8342467b8f880a7 100644 GIT binary patch delta 20 bcmbQIHBW29Q!aK(1p^B!1Cz~fxQw^}O1TDm delta 20 bcmbQIHBW29Q!aKh1p^B!1JliKxQw^}N}C3G diff --git a/po/mcs/de.po.REMOVED.git-id b/po/mcs/de.po.REMOVED.git-id index 08fcc29a11..cb79a8e8e6 100644 --- a/po/mcs/de.po.REMOVED.git-id +++ b/po/mcs/de.po.REMOVED.git-id @@ -1 +1 @@ -cf9e2e56626a8b6fba6902dccd5670c228b674ac \ No newline at end of file +47f068d9ed2b548bfb7cbbd6204b7e79035d24d8 \ No newline at end of file diff --git a/po/mcs/es.gmo b/po/mcs/es.gmo index e1728a49ebc494b1ee65e5ca4cf4c2c5fbc25827..c0e01aa4b70269abd78c179f3033967a5b351862 100644 GIT binary patch delta 20 bcmX?Ef3kjqo+7)Yf`NsVfyri5#VK+CQP~Eu delta 20 bcmX?Ef3kjqo+7)Mf`NsVf$3&b#VK+CQM(4O diff --git a/po/mcs/es.po.REMOVED.git-id b/po/mcs/es.po.REMOVED.git-id index bfca13120d..915d91edb6 100644 --- a/po/mcs/es.po.REMOVED.git-id +++ b/po/mcs/es.po.REMOVED.git-id @@ -1 +1 @@ -275d756effd5e5583f26d925b5e46bb51f48bc4e \ No newline at end of file +36ca5609525ece759b302af026a23b871df72be9 \ No newline at end of file diff --git a/po/mcs/ja.gmo b/po/mcs/ja.gmo index 0f1f05e7a4a425946b4b4d734582597a80f6fe87..03fc874f2ad7b16dfc74e21533722a76775adc77 100644 GIT binary patch delta 22 dcmeyri1Gg-#tj_m?3M}!7FGr(oB7oXv;bi%2MquK delta 22 dcmeyri1Gg-#tj_m>}CoE7FGtPoB7oXv;biZ2MYiI diff --git a/po/mcs/ja.po.REMOVED.git-id b/po/mcs/ja.po.REMOVED.git-id index a6388360e3..0293c9426e 100644 --- a/po/mcs/ja.po.REMOVED.git-id +++ b/po/mcs/ja.po.REMOVED.git-id @@ -1 +1 @@ -926e0b80854ca61dda893d9287ba6ecd06961913 \ No newline at end of file +d8e18aeccf22b4521dd21a2ebe3c0bb4a586601f \ No newline at end of file diff --git a/po/mcs/mcs.pot b/po/mcs/mcs.pot index bb689c39ef..98d249ef0d 100644 --- a/po/mcs/mcs.pot +++ b/po/mcs/mcs.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: mono 5.16.0.187\n" +"Project-Id-Version: mono 5.18.0.142\n" "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n" -"POT-Creation-Date: 2018-10-06 08:05+0000\n" +"POT-Creation-Date: 2018-10-09 08:04+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -97,36 +97,36 @@ msgid "" "`{0}': An anonymous type cannot have multiple properties with the same name" msgstr "" -#: mcs/mcs/argument.cs:110 +#: mcs/mcs/argument.cs:112 msgid "" "An expression tree cannot contain an invocation which uses optional parameter" msgstr "" -#: mcs/mcs/argument.cs:273 +#: mcs/mcs/argument.cs:275 msgid "An expression tree cannot contain named argument" msgstr "" -#: mcs/mcs/argument.cs:394 +#: mcs/mcs/argument.cs:396 #, csharp-format msgid "" "The method group `{0}' cannot be used as an argument of dynamic operation. " "Consider using parentheses to invoke the method" msgstr "" -#: mcs/mcs/argument.cs:398 +#: mcs/mcs/argument.cs:400 msgid "" "An anonymous method or lambda expression cannot be used as an argument of " "dynamic operation. Consider using a cast" msgstr "" -#: mcs/mcs/argument.cs:401 +#: mcs/mcs/argument.cs:403 #, csharp-format msgid "" "An expression of type `{0}' cannot be used as an argument of dynamic " "operation" msgstr "" -#: mcs/mcs/argument.cs:692 +#: mcs/mcs/argument.cs:694 #, csharp-format msgid "" "Reference to an implicitly typed out variable `{0}' is not permitted in the " @@ -1423,13 +1423,13 @@ msgstr "" msgid "The operation in question is undefined on void pointers" msgstr "" -#: mcs/mcs/ecore.cs:543 mcs/mcs/statement.cs:4094 mcs/mcs/statement.cs:4096 +#: mcs/mcs/ecore.cs:543 mcs/mcs/statement.cs:4101 mcs/mcs/statement.cs:4103 #, csharp-format msgid "Internal compiler error: {0}" msgstr "" -#: mcs/mcs/ecore.cs:605 mcs/mcs/expression.cs:1932 mcs/mcs/expression.cs:8182 -#: mcs/mcs/expression.cs:8190 +#: mcs/mcs/ecore.cs:605 mcs/mcs/expression.cs:1932 mcs/mcs/expression.cs:8188 +#: mcs/mcs/expression.cs:8196 msgid "A constant value is expected" msgstr "" @@ -2038,243 +2038,243 @@ msgid "" "define operator `{1}'" msgstr "" -#: mcs/mcs/expression.cs:6012 +#: mcs/mcs/expression.cs:6018 #, csharp-format msgid "" "A user-defined operator `{0}' must have each parameter type and return type " "of the same type in order to be applicable as a short circuit operator" msgstr "" -#: mcs/mcs/expression.cs:6022 +#: mcs/mcs/expression.cs:6028 #, csharp-format msgid "" "The type `{0}' must have operator `true' and operator `false' defined when " "`{1}' is used as a short circuit operator" msgstr "" -#: mcs/mcs/expression.cs:6400 +#: mcs/mcs/expression.cs:6406 #, csharp-format msgid "" "Type of conditional expression cannot be determined as `{0}' and `{1}' " "convert implicitly to each other" msgstr "" -#: mcs/mcs/expression.cs:6413 +#: mcs/mcs/expression.cs:6419 #, csharp-format msgid "" "Type of conditional expression cannot be determined because there is no " "implicit conversion between `{0}' and `{1}'" msgstr "" -#: mcs/mcs/expression.cs:6450 +#: mcs/mcs/expression.cs:6456 msgid "Both ref conditional operators must be ref values" msgstr "" -#: mcs/mcs/expression.cs:6455 +#: mcs/mcs/expression.cs:6461 #, csharp-format msgid "The ref conditional expression types `{0}' and `{1}' have to match" msgstr "" -#: mcs/mcs/expression.cs:6785 +#: mcs/mcs/expression.cs:6791 #, csharp-format msgid "Use of unassigned local variable `{0}'" msgstr "" -#: mcs/mcs/expression.cs:6808 +#: mcs/mcs/expression.cs:6814 #, csharp-format msgid "" "Cannot use fixed variable `{0}' inside an anonymous method, lambda " "expression or query expression" msgstr "" -#: mcs/mcs/expression.cs:6815 +#: mcs/mcs/expression.cs:6821 #, csharp-format msgid "" "Cannot use by-reference variable `{0}' inside an anonymous method, lambda " "expression, or query expression" msgstr "" -#: mcs/mcs/expression.cs:6834 +#: mcs/mcs/expression.cs:6840 #, csharp-format msgid "Cannot use uninitialized variable `{0}'" msgstr "" -#: mcs/mcs/expression.cs:7008 +#: mcs/mcs/expression.cs:7014 #, csharp-format msgid "" "Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' " "modifier" msgstr "" -#: mcs/mcs/expression.cs:7078 +#: mcs/mcs/expression.cs:7084 #, csharp-format msgid "Use of unassigned out parameter `{0}'" msgstr "" -#: mcs/mcs/expression.cs:7251 +#: mcs/mcs/expression.cs:7257 msgid "The syntax `var (...)' as an lvalue is reserved" msgstr "" -#: mcs/mcs/expression.cs:7332 +#: mcs/mcs/expression.cs:7338 #, csharp-format msgid "Cannot invoke a non-delegate type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:7343 +#: mcs/mcs/expression.cs:7349 #, csharp-format msgid "The member `{0}' cannot be used as method or delegate" msgstr "" -#: mcs/mcs/expression.cs:7365 +#: mcs/mcs/expression.cs:7371 msgid "" "Do not directly call your base class Finalize method. It is called " "automatically from your destructor" msgstr "" -#: mcs/mcs/expression.cs:7367 +#: mcs/mcs/expression.cs:7373 msgid "" "Destructors and object.Finalize cannot be called directly. Consider calling " "IDisposable.Dispose if available" msgstr "" -#: mcs/mcs/expression.cs:7400 +#: mcs/mcs/expression.cs:7406 #, csharp-format msgid "" "The base call to method `{0}' cannot be dynamically dispatched. Consider " "casting the dynamic arguments or eliminating the base access" msgstr "" -#: mcs/mcs/expression.cs:7495 +#: mcs/mcs/expression.cs:7501 #, csharp-format msgid "`{0}': cannot explicitly call operator or accessor" msgstr "" -#: mcs/mcs/expression.cs:7686 +#: mcs/mcs/expression.cs:7692 msgid "" "Tuple type cannot be used in an object creation expression. Use a tuple " "literal expression instead." msgstr "" -#: mcs/mcs/expression.cs:7696 +#: mcs/mcs/expression.cs:7702 #, csharp-format msgid "Unsafe type `{0}' cannot be used in an object creation expression" msgstr "" -#: mcs/mcs/expression.cs:7719 +#: mcs/mcs/expression.cs:7725 #, csharp-format msgid "" "Cannot create an instance of the variable type `{0}' because it does not " "have the new() constraint" msgstr "" -#: mcs/mcs/expression.cs:7725 +#: mcs/mcs/expression.cs:7731 #, csharp-format msgid "" "`{0}': cannot provide arguments when creating an instance of a variable type" msgstr "" -#: mcs/mcs/expression.cs:7734 +#: mcs/mcs/expression.cs:7740 #, csharp-format msgid "Cannot create an instance of the static class `{0}'" msgstr "" -#: mcs/mcs/expression.cs:7746 +#: mcs/mcs/expression.cs:7752 #, csharp-format msgid "Cannot create an instance of the abstract class or interface `{0}'" msgstr "" -#: mcs/mcs/expression.cs:8031 +#: mcs/mcs/expression.cs:8037 msgid "" "An implicitly typed local variable declarator cannot use an array initializer" msgstr "" -#: mcs/mcs/expression.cs:8196 mcs/mcs/expression.cs:8221 +#: mcs/mcs/expression.cs:8202 mcs/mcs/expression.cs:8227 #, csharp-format msgid "An array initializer of length `{0}' was expected" msgstr "" -#: mcs/mcs/expression.cs:8212 +#: mcs/mcs/expression.cs:8218 msgid "" "Array initializers can only be used in a variable or field initializer. Try " "using a new expression instead" msgstr "" -#: mcs/mcs/expression.cs:8229 +#: mcs/mcs/expression.cs:8235 msgid "A nested array initializer was expected" msgstr "" -#: mcs/mcs/expression.cs:8276 +#: mcs/mcs/expression.cs:8282 msgid "An expression tree cannot contain a multidimensional array initializer" msgstr "" -#: mcs/mcs/expression.cs:8312 +#: mcs/mcs/expression.cs:8318 msgid "Cannot create an array with a negative size" msgstr "" -#: mcs/mcs/expression.cs:8414 +#: mcs/mcs/expression.cs:8420 msgid "" "Can only use array initializer expressions to assign to array types. Try " "using a new expression instead" msgstr "" -#: mcs/mcs/expression.cs:8855 +#: mcs/mcs/expression.cs:8861 msgid "" "The type of an implicitly typed array cannot be inferred from the " "initializer. Try specifying array type explicitly" msgstr "" -#: mcs/mcs/expression.cs:9010 +#: mcs/mcs/expression.cs:9016 msgid "" "The `this' object cannot be used before all of its fields are assigned to" msgstr "" -#: mcs/mcs/expression.cs:9016 +#: mcs/mcs/expression.cs:9022 msgid "" "Keyword `this' is not valid in a static property, static method, or static " "field initializer" msgstr "" -#: mcs/mcs/expression.cs:9019 +#: mcs/mcs/expression.cs:9025 msgid "" "Anonymous methods inside structs cannot access instance members of `this'. " "Consider copying `this' to a local variable outside the anonymous method and " "using the local instead" msgstr "" -#: mcs/mcs/expression.cs:9022 +#: mcs/mcs/expression.cs:9028 msgid "Keyword `this' is not available in the current context" msgstr "" -#: mcs/mcs/expression.cs:9098 +#: mcs/mcs/expression.cs:9104 msgid "Cannot take the address of `this' because it is read-only" msgstr "" -#: mcs/mcs/expression.cs:9100 +#: mcs/mcs/expression.cs:9106 msgid "Cannot pass `this' as a ref or out argument because it is read-only" msgstr "" -#: mcs/mcs/expression.cs:9102 +#: mcs/mcs/expression.cs:9108 msgid "Cannot assign to `this' because it is read-only" msgstr "" -#: mcs/mcs/expression.cs:9170 +#: mcs/mcs/expression.cs:9176 msgid "The __arglist construct is valid only within a variable argument method" msgstr "" -#: mcs/mcs/expression.cs:9231 +#: mcs/mcs/expression.cs:9237 msgid "An expression tree cannot contain a method with variable arguments" msgstr "" -#: mcs/mcs/expression.cs:9505 +#: mcs/mcs/expression.cs:9511 msgid "The typeof operator cannot be used on the dynamic type" msgstr "" -#: mcs/mcs/expression.cs:9546 +#: mcs/mcs/expression.cs:9552 #, csharp-format msgid "`{0}': an attribute argument cannot use type parameters" msgstr "" -#: mcs/mcs/expression.cs:9761 +#: mcs/mcs/expression.cs:9767 #, csharp-format msgid "" "`{0}' does not have a predefined size, therefore sizeof can only be used in " @@ -2282,208 +2282,208 @@ msgid "" "SizeOf)" msgstr "" -#: mcs/mcs/expression.cs:9826 +#: mcs/mcs/expression.cs:9832 #, csharp-format msgid "Alias `{0}' not found" msgstr "" -#: mcs/mcs/expression.cs:9867 +#: mcs/mcs/expression.cs:9873 msgid "" "The namespace alias qualifier `::' cannot be used to invoke a method. " "Consider using `.' instead" msgstr "" -#: mcs/mcs/expression.cs:9957 +#: mcs/mcs/expression.cs:9963 msgid "Cannot perform member binding on `null' value" msgstr "" -#: mcs/mcs/expression.cs:10124 +#: mcs/mcs/expression.cs:10130 #, csharp-format msgid "" "`{0}': cannot reference a type through an expression. Consider using `{1}' " "instead" msgstr "" -#: mcs/mcs/expression.cs:10203 +#: mcs/mcs/expression.cs:10209 #, csharp-format msgid "A nested type cannot be specified through a type parameter `{0}'" msgstr "" -#: mcs/mcs/expression.cs:10211 +#: mcs/mcs/expression.cs:10217 #, csharp-format msgid "" "Alias `{0}' cannot be used with `::' since it denotes a type. Consider " "replacing `::' with `.'" msgstr "" -#: mcs/mcs/expression.cs:10280 +#: mcs/mcs/expression.cs:10286 #, csharp-format msgid "The nested type `{0}' does not exist in the type `{1}'" msgstr "" -#: mcs/mcs/expression.cs:10304 +#: mcs/mcs/expression.cs:10310 #, csharp-format msgid "" "Type `{0}' does not contain a definition for `{1}' and no extension method " "`{1}' of type `{0}' could be found. Are you missing {2}?" msgstr "" -#: mcs/mcs/expression.cs:10596 +#: mcs/mcs/expression.cs:10602 #, csharp-format msgid "Cannot apply indexing with [] to an expression of type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:10733 +#: mcs/mcs/expression.cs:10739 #, csharp-format msgid "Wrong number of indexes `{0}' inside [], expected `{1}'" msgstr "" -#: mcs/mcs/expression.cs:11171 +#: mcs/mcs/expression.cs:11177 msgid "" "The indexer base access cannot be dynamically dispatched. Consider casting " "the dynamic arguments or eliminating the base access" msgstr "" -#: mcs/mcs/expression.cs:11270 +#: mcs/mcs/expression.cs:11276 msgid "An expression tree may not contain a base access" msgstr "" -#: mcs/mcs/expression.cs:11288 +#: mcs/mcs/expression.cs:11294 msgid "Keyword `base' is not available in a static method" msgstr "" -#: mcs/mcs/expression.cs:11290 +#: mcs/mcs/expression.cs:11296 msgid "Keyword `base' is not available in the current context" msgstr "" -#: mcs/mcs/expression.cs:11328 +#: mcs/mcs/expression.cs:11334 msgid "" "A property, indexer or dynamic member access may not be passed as `ref' or " "`out' parameter" msgstr "" -#: mcs/mcs/expression.cs:11677 +#: mcs/mcs/expression.cs:11683 #, csharp-format msgid "Array elements cannot be of type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:11680 +#: mcs/mcs/expression.cs:11686 #, csharp-format msgid "Array elements cannot be of static type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:11900 +#: mcs/mcs/expression.cs:11906 msgid "Cannot use a negative size with stackalloc" msgstr "" -#: mcs/mcs/expression.cs:11904 +#: mcs/mcs/expression.cs:11910 msgid "Cannot use stackalloc in finally or catch" msgstr "" -#: mcs/mcs/expression.cs:11954 +#: mcs/mcs/expression.cs:11960 #, csharp-format msgid "Cannot convert a stackalloc expression of type `{0}' to type `{1}'" msgstr "" -#: mcs/mcs/expression.cs:12118 +#: mcs/mcs/expression.cs:12124 #, csharp-format msgid "" "Member `{0}' cannot be initialized. An object initializer may only be used " "for fields, or properties" msgstr "" -#: mcs/mcs/expression.cs:12126 +#: mcs/mcs/expression.cs:12132 #, csharp-format msgid "" "Static field or property `{0}' cannot be assigned in an object initializer" msgstr "" -#: mcs/mcs/expression.cs:12197 +#: mcs/mcs/expression.cs:12203 msgid "" "An expression tree cannot contain a collection initializer with extension " "method" msgstr "" -#: mcs/mcs/expression.cs:12235 +#: mcs/mcs/expression.cs:12241 msgid "Expression tree cannot contain a dictionary initializer" msgstr "" -#: mcs/mcs/expression.cs:12360 +#: mcs/mcs/expression.cs:12366 #, csharp-format msgid "" "A field or property `{0}' cannot be initialized with a collection object " "initializer because type `{1}' does not implement `{2}' interface" msgstr "" -#: mcs/mcs/expression.cs:12371 +#: mcs/mcs/expression.cs:12377 #, csharp-format msgid "Inconsistent `{0}' member declaration" msgstr "" -#: mcs/mcs/expression.cs:12379 +#: mcs/mcs/expression.cs:12385 #, csharp-format msgid "" "An object initializer includes more than one member `{0}' initialization" msgstr "" -#: mcs/mcs/expression.cs:12397 +#: mcs/mcs/expression.cs:12403 #, csharp-format msgid "Cannot initialize object of type `{0}' with a collection initializer" msgstr "" -#: mcs/mcs/expression.cs:12542 +#: mcs/mcs/expression.cs:12548 msgid "" "Object and collection initializers cannot be used to instantiate a delegate" msgstr "" -#: mcs/mcs/expression.cs:12761 +#: mcs/mcs/expression.cs:12767 msgid "Anonymous types cannot be used in this expression" msgstr "" -#: mcs/mcs/expression.cs:12855 +#: mcs/mcs/expression.cs:12861 #, csharp-format msgid "An anonymous type property `{0}' cannot be initialized with `{1}'" msgstr "" -#: mcs/mcs/expression.cs:13095 +#: mcs/mcs/expression.cs:13101 msgid "An expression tree cannot not contain a throw expression" msgstr "" -#: mcs/mcs/expression.cs:13169 +#: mcs/mcs/expression.cs:13175 msgid "" "An expression cannot be used in this context because it may not be returned " "by reference" msgstr "" -#: mcs/mcs/expression.cs:13194 +#: mcs/mcs/expression.cs:13200 #, csharp-format msgid "" "The expression must be of type `{0}' because it is being assigned by " "reference" msgstr "" -#: mcs/mcs/expression.cs:13226 +#: mcs/mcs/expression.cs:13232 msgid "" "An expression tree lambda cannot contain a call to a method, property, or " "indexer that returns by reference" msgstr "" -#: mcs/mcs/expression.cs:13271 +#: mcs/mcs/expression.cs:13277 #, csharp-format msgid "" "`await' cannot be used in an expression containing a call to `{0}' because " "it returns by reference" msgstr "" -#: mcs/mcs/expression.cs:13326 +#: mcs/mcs/expression.cs:13332 msgid "An expression tree cannot contain a discard" msgstr "" -#: mcs/mcs/expression.cs:13340 +#: mcs/mcs/expression.cs:13346 msgid "Cannot infer the type of implicitly-typed discard" msgstr "" -#: mcs/mcs/expression.cs:13346 +#: mcs/mcs/expression.cs:13352 msgid "Cannot assign void to a discard" msgstr "" @@ -3645,145 +3645,145 @@ msgstr "" msgid "Control cannot leave the body of a finally clause" msgstr "" -#: mcs/mcs/statement.cs:1180 +#: mcs/mcs/statement.cs:1179 #, csharp-format msgid "" "An object of a type convertible to `{0}' is required for the return statement" msgstr "" -#: mcs/mcs/statement.cs:1193 +#: mcs/mcs/statement.cs:1192 #, csharp-format msgid "" "`{0}': A return keyword must not be followed by any expression when method " "returns void" msgstr "" -#: mcs/mcs/statement.cs:1212 +#: mcs/mcs/statement.cs:1211 msgid "Cannot return an expression of type `void'" msgstr "" -#: mcs/mcs/statement.cs:1220 mcs/mcs/statement.cs:1253 +#: mcs/mcs/statement.cs:1219 mcs/mcs/statement.cs:1252 msgid "" "Anonymous function or lambda expression converted to a void returning " "delegate cannot return a value" msgstr "" -#: mcs/mcs/statement.cs:1230 +#: mcs/mcs/statement.cs:1229 msgid "" "Async lambda expression or anonymous method converted to a `Task' cannot " "return a value. Consider returning `Task'" msgstr "" -#: mcs/mcs/statement.cs:1233 +#: mcs/mcs/statement.cs:1232 #, csharp-format msgid "" "`{0}': A return keyword must not be followed by an expression when async " "method returns `Task'. Consider using `Task' return type" msgstr "" -#: mcs/mcs/statement.cs:1244 +#: mcs/mcs/statement.cs:1243 #, csharp-format msgid "" "`{0}': The return expression type of async method must be `{1}' rather than " "`Task<{1}>'" msgstr "" -#: mcs/mcs/statement.cs:1279 +#: mcs/mcs/statement.cs:1278 msgid "" "By-reference returns can only be used in methods that return by reference" msgstr "" -#: mcs/mcs/statement.cs:1287 +#: mcs/mcs/statement.cs:1286 msgid "By-reference return is required when method returns by reference" msgstr "" -#: mcs/mcs/statement.cs:1294 +#: mcs/mcs/statement.cs:1293 #, csharp-format msgid "" "The return by reference expression must be of type `{0}' because this method " "returns by reference" msgstr "" -#: mcs/mcs/statement.cs:1305 +#: mcs/mcs/statement.cs:1304 #, csharp-format msgid "" "Cannot convert `{0}' to delegate type `{1}' because some of the return types " "in the block are not implicitly convertible to the delegate return type" msgstr "" -#: mcs/mcs/statement.cs:1380 +#: mcs/mcs/statement.cs:1379 msgid "" "Cannot return a value from iterators. Use the yield return statement to " "return a value, or yield break to end the iteration" msgstr "" -#: mcs/mcs/statement.cs:1448 +#: mcs/mcs/statement.cs:1447 #, csharp-format msgid "" "The label `{0}:' could not be found within the scope of the goto statement" msgstr "" -#: mcs/mcs/statement.cs:1788 +#: mcs/mcs/statement.cs:1787 msgid "A goto case is only valid inside a switch statement" msgstr "" -#: mcs/mcs/statement.cs:1813 mcs/mcs/statement.cs:7016 +#: mcs/mcs/statement.cs:1812 mcs/mcs/statement.cs:7086 msgid "The type caught or thrown must be derived from System.Exception" msgstr "" -#: mcs/mcs/statement.cs:1824 +#: mcs/mcs/statement.cs:1823 msgid "" "A throw statement with no arguments is not allowed outside of a catch clause" msgstr "" -#: mcs/mcs/statement.cs:1829 +#: mcs/mcs/statement.cs:1828 msgid "" "A throw statement with no arguments is not allowed inside of a finally " "clause nested inside of the innermost catch clause" msgstr "" -#: mcs/mcs/statement.cs:2010 +#: mcs/mcs/statement.cs:2009 msgid "No enclosing loop out of which to break or continue" msgstr "" -#: mcs/mcs/statement.cs:2179 +#: mcs/mcs/statement.cs:2178 msgid "A fixed statement cannot use an implicitly typed local variable" msgstr "" -#: mcs/mcs/statement.cs:2184 +#: mcs/mcs/statement.cs:2183 msgid "An implicitly typed local variable cannot be a constant" msgstr "" -#: mcs/mcs/statement.cs:2189 +#: mcs/mcs/statement.cs:2188 msgid "" "An implicitly typed local variable declarator must include an initializer" msgstr "" -#: mcs/mcs/statement.cs:2194 +#: mcs/mcs/statement.cs:2193 msgid "" "An implicitly typed local variable declaration cannot include multiple " "declarators" msgstr "" -#: mcs/mcs/statement.cs:2238 +#: mcs/mcs/statement.cs:2237 #, csharp-format msgid "Cannot initialize a by-reference variable `{0}' with a value" msgstr "" -#: mcs/mcs/statement.cs:2243 +#: mcs/mcs/statement.cs:2242 msgid "Async methods cannot use by-reference variables" msgstr "" -#: mcs/mcs/statement.cs:2245 +#: mcs/mcs/statement.cs:2244 msgid "Iterators cannot use by-reference variables" msgstr "" -#: mcs/mcs/statement.cs:2250 +#: mcs/mcs/statement.cs:2249 #, csharp-format msgid "Cannot initialize a by-value variable `{0}' with a reference expression" msgstr "" -#: mcs/mcs/statement.cs:2902 +#: mcs/mcs/statement.cs:2909 #, csharp-format msgid "" "A local variable named `{0}' cannot be declared in this scope because it " @@ -3791,124 +3791,128 @@ msgid "" "scope to denote something else" msgstr "" -#: mcs/mcs/statement.cs:2914 +#: mcs/mcs/statement.cs:2921 #, csharp-format msgid "A local variable named `{0}' is already defined in this scope" msgstr "" -#: mcs/mcs/statement.cs:2921 +#: mcs/mcs/statement.cs:2928 #, csharp-format msgid "" "The type parameter name `{0}' is the same as local variable or parameter name" msgstr "" -#: mcs/mcs/statement.cs:3869 +#: mcs/mcs/statement.cs:3876 #, csharp-format msgid "" "The out parameter `{0}' must be assigned to before control leaves the " "current method" msgstr "" -#: mcs/mcs/statement.cs:4150 +#: mcs/mcs/statement.cs:4157 msgid "Async methods cannot have ref or out parameters" msgstr "" -#: mcs/mcs/statement.cs:4156 +#: mcs/mcs/statement.cs:4163 msgid "__arglist is not allowed in parameter list of async methods" msgstr "" -#: mcs/mcs/statement.cs:4162 +#: mcs/mcs/statement.cs:4169 msgid "Async methods cannot have unsafe parameters" msgstr "" -#: mcs/mcs/statement.cs:4359 +#: mcs/mcs/statement.cs:4366 #, csharp-format msgid "The label `{0}' is a duplicate" msgstr "" -#: mcs/mcs/statement.cs:4368 mcs/mcs/statement.cs:4379 +#: mcs/mcs/statement.cs:4375 mcs/mcs/statement.cs:4386 #, csharp-format msgid "" "The label `{0}' shadows another label by the same name in a contained scope" msgstr "" -#: mcs/mcs/statement.cs:4657 +#: mcs/mcs/statement.cs:4664 #, csharp-format msgid "`{0}': not all code paths return a value" msgstr "" -#: mcs/mcs/statement.cs:4789 +#: mcs/mcs/statement.cs:4796 #, csharp-format msgid "The label `{0}' already occurs in this switch statement" msgstr "" -#: mcs/mcs/statement.cs:4916 +#: mcs/mcs/statement.cs:4923 #, csharp-format msgid "" "Control cannot fall out of switch statement through final case label `{0}'" msgstr "" -#: mcs/mcs/statement.cs:4919 +#: mcs/mcs/statement.cs:4926 #, csharp-format msgid "Control cannot fall through from one case label `{0}' to another" msgstr "" -#: mcs/mcs/statement.cs:5356 +#: mcs/mcs/statement.cs:5363 #, csharp-format msgid "" "A switch expression of type `{0}' cannot be converted to an integral type, " "bool, char, string, enum or nullable type" msgstr "" -#: mcs/mcs/statement.cs:6215 +#: mcs/mcs/statement.cs:6222 #, csharp-format msgid "`{0}' is not a reference type as required by the lock statement" msgstr "" -#: mcs/mcs/statement.cs:6605 +#: mcs/mcs/statement.cs:6612 msgid "The type of locals declared in a fixed statement must be a pointer type" msgstr "" -#: mcs/mcs/statement.cs:6685 -msgid "" -"The right hand side of a fixed statement assignment may not be a cast " -"expression" -msgstr "" - -#: mcs/mcs/statement.cs:6690 +#: mcs/mcs/statement.cs:6693 msgid "" "You cannot use the fixed statement to take the address of an already fixed " "expression" msgstr "" -#: mcs/mcs/statement.cs:6876 +#: mcs/mcs/statement.cs:6702 +msgid "" +"The right hand side of a fixed statement assignment may not be a cast " +"expression" +msgstr "" + +#: mcs/mcs/statement.cs:6711 +msgid "The given expression cannot be used in a fixed statement" +msgstr "" + +#: mcs/mcs/statement.cs:6946 msgid "" "The `await' operator cannot be used in the filter expression of a catch " "clause" msgstr "" -#: mcs/mcs/statement.cs:7491 +#: mcs/mcs/statement.cs:7561 #, csharp-format msgid "" "A previous catch clause already catches all exceptions of this or a super " "type `{0}'" msgstr "" -#: mcs/mcs/statement.cs:7728 +#: mcs/mcs/statement.cs:7798 #, csharp-format msgid "" "`{0}': type used in a using statement must be implicitly convertible to " "`System.IDisposable'" msgstr "" -#: mcs/mcs/statement.cs:8144 +#: mcs/mcs/statement.cs:8214 #, csharp-format msgid "" "foreach statement requires that the return type `{0}' of `{1}' must have a " "suitable public MoveNext method and public Current property" msgstr "" -#: mcs/mcs/statement.cs:8188 +#: mcs/mcs/statement.cs:8258 #, csharp-format msgid "" "foreach statement cannot operate on variables of type `{0}' because it " @@ -3916,22 +3920,22 @@ msgid "" "implementation" msgstr "" -#: mcs/mcs/statement.cs:8209 +#: mcs/mcs/statement.cs:8279 msgid "Use of default literal is not valid in this context" msgstr "" -#: mcs/mcs/statement.cs:8212 +#: mcs/mcs/statement.cs:8282 #, csharp-format msgid "" "foreach statement cannot operate on variables of type `{0}' because it does " "not contain a definition for `{1}' or is inaccessible" msgstr "" -#: mcs/mcs/statement.cs:8450 +#: mcs/mcs/statement.cs:8520 msgid "Use of null is not valid in this context" msgstr "" -#: mcs/mcs/statement.cs:8462 +#: mcs/mcs/statement.cs:8532 #, csharp-format msgid "Foreach statement cannot operate on a `{0}'" msgstr "" diff --git a/po/mcs/pt_BR.gmo b/po/mcs/pt_BR.gmo index 1d13d643b84cf73ce5d37cf6889b4f1e97c4cb1f..23c700c6f4f86895a7807ca13b2d8b634b519088 100644 GIT binary patch delta 22 ecmaF1gXP%{mJM-J*)0_eEUXMnHm6QyYzF{tA_#*3 delta 22 ecmaF1gXP%{mJM-J+07ITEUXMnH>XZzYzF{t1PFlu diff --git a/po/mcs/pt_BR.po.REMOVED.git-id b/po/mcs/pt_BR.po.REMOVED.git-id index d7ecde408b..e6a61729bd 100644 --- a/po/mcs/pt_BR.po.REMOVED.git-id +++ b/po/mcs/pt_BR.po.REMOVED.git-id @@ -1 +1 @@ -caaffe22dd2f4534560267a441bbf325b490c902 \ No newline at end of file +2ed47baa91e0d1289a19e77b0c7b50a13bb16951 \ No newline at end of file diff --git a/runtime/Makefile.in b/runtime/Makefile.in index 2fdb490b79..cc6c0ede6a 100644 --- a/runtime/Makefile.in +++ b/runtime/Makefile.in @@ -175,6 +175,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -190,6 +192,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -230,11 +233,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/samples/Makefile.in b/samples/Makefile.in index 89e67e79bd..cd073bd867 100644 --- a/samples/Makefile.in +++ b/samples/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 5a502d7177..ab825fec8e 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -183,6 +183,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -198,6 +200,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -238,11 +241,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/scripts/submodules/versions.mk b/scripts/submodules/versions.mk index 899e368877..899b09de01 100644 --- a/scripts/submodules/versions.mk +++ b/scripts/submodules/versions.mk @@ -71,7 +71,7 @@ reset-$(1):: echo "*** git fetch `basename $$($(2)_PATH)`" && (cd $($(2)_PATH) && git fetch); \ fi; \ else \ - echo "*** git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2))" && (cd `dirname $($(2)_PATH)` && git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2)) || exit 1 ); \ + echo "*** git clone $(MODULE_$(2)) -b $(NEEDED_$(2)_BRANCH) --recursive $(DIRECTORY_$(2))" && (cd `dirname $($(2)_PATH)` && git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2)) || exit 1 ); \ fi @if test x$$(IGNORE_$(2)_VERSION) = "x"; then \ echo "*** [$(1)] git checkout -f" $(NEEDED_$(2)_BRANCH) && (cd $($(2)_PATH) ; git checkout -f $(NEEDED_$(2)_BRANCH) || git checkout -f -b $($(2)_BRANCH_AND_REMOTE)); \ diff --git a/support/Makefile.in b/support/Makefile.in index e684010201..56b212c33b 100644 --- a/support/Makefile.in +++ b/support/Makefile.in @@ -269,6 +269,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -284,6 +286,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -324,11 +327,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/support/zlib-helper.c b/support/zlib-helper.c index 9dcebc7e96..e822fe63d8 100644 --- a/support/zlib-helper.c +++ b/support/zlib-helper.c @@ -208,7 +208,9 @@ ReadZStream (ZStream *stream, guchar *buffer, gint length) stream->eof = TRUE; break; } else if (status == Z_BUF_ERROR && stream->total_in == zs->total_in) { - stream->eof = TRUE; + if (zs->avail_in != 0) { + stream->eof = TRUE; + } break; } else if (status != Z_OK) { return status; diff --git a/tools/Makefile.in b/tools/Makefile.in index 4a2a4a8207..9cb04bbcd3 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -211,6 +211,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -226,6 +228,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -266,11 +269,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/tools/locale-builder/Makefile.in b/tools/locale-builder/Makefile.in index c51d1c21c1..ac23b393c9 100644 --- a/tools/locale-builder/Makefile.in +++ b/tools/locale-builder/Makefile.in @@ -151,6 +151,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -166,6 +168,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -206,11 +209,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/tools/monograph/Makefile.in b/tools/monograph/Makefile.in index 40a2c4f03a..a512193ef4 100644 --- a/tools/monograph/Makefile.in +++ b/tools/monograph/Makefile.in @@ -100,9 +100,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) monograph_SOURCES = monograph.c monograph_OBJECTS = monograph.$(OBJEXT) -am__DEPENDENCIES_1 = -monograph_DEPENDENCIES = $(runtime_lib) $(glib_libs) \ - $(am__DEPENDENCIES_1) +monograph_DEPENDENCIES = $(runtime_lib) $(glib_libs) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -203,6 +201,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -218,6 +218,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -258,11 +259,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/tools/pedump/Makefile.in b/tools/pedump/Makefile.in index 3803838827..80ad230552 100644 --- a/tools/pedump/Makefile.in +++ b/tools/pedump/Makefile.in @@ -100,12 +100,10 @@ am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_pedump_OBJECTS = pedump.$(OBJEXT) pedump_OBJECTS = $(am_pedump_OBJECTS) -am__DEPENDENCIES_1 = pedump_DEPENDENCIES = \ $(top_builddir)/mono/metadata/libmonoruntimesgen.la \ $(top_builddir)/mono/sgen/libmonosgen.la \ - $(top_builddir)/mono/utils/libmonoutils.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) $(glib_libs) + $(top_builddir)/mono/utils/libmonoutils.la $(glib_libs) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -206,6 +204,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -221,6 +221,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -261,11 +262,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/tools/sgen/Makefile.in b/tools/sgen/Makefile.in index 57ad08b8f7..a53054a5b9 100644 --- a/tools/sgen/Makefile.in +++ b/tools/sgen/Makefile.in @@ -230,6 +230,8 @@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXX_ADD_CFLAGS = @CXX_ADD_CFLAGS@ +CXX_REMOVE_CFLAGS = @CXX_REMOVE_CFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_PROFILE = @DEFAULT_PROFILE@ DEFS = @DEFS@ @@ -245,6 +247,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +EXTERNAL_LLVM_CONFIG = @EXTERNAL_LLVM_CONFIG@ FGREP = @FGREP@ GDKX11 = @GDKX11@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ @@ -285,11 +288,7 @@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ -LLVM_CFLAGS = @LLVM_CFLAGS@ -LLVM_CONFIG = @LLVM_CONFIG@ -LLVM_CXXFLAGS = @LLVM_CXXFLAGS@ -LLVM_LDFLAGS = @LLVM_LDFLAGS@ -LLVM_LIBS = @LLVM_LIBS@ +LLVM_CODEGEN_LIBS = @LLVM_CODEGEN_LIBS@ LN_S = @LN_S@ LTCOMPILE = @LTCOMPILE@ LTCXXCOMPILE = @LTCXXCOMPILE@ diff --git a/winconfig.h b/winconfig.h index 51444d567b..178fb00894 100644 --- a/winconfig.h +++ b/winconfig.h @@ -1,3 +1,5 @@ +#pragma once + #ifndef _MSC_VER #include "cygconfig.h" #else @@ -19,9 +21,9 @@ #include -#if _WIN32_WINNT < 0x0600 -#error "Mono requires Windows Vista or later" -#endif /* _WIN32_WINNT < 0x0600 */ +#if _WIN32_WINNT < 0x0601 +#error "Mono requires Windows 7 or later." +#endif /* _WIN32_WINNT < 0x0601 */ #ifndef HAVE_WINAPI_FAMILY_SUPPORT @@ -81,6 +83,9 @@ /* Disable support debug logging */ /* #undef DISABLE_LOGGING */ +/* Disable runtime state dumping */ +#define DISABLE_CRASH_REPORTING 1 + /* Disable P/Invoke support */ /* #undef DISABLE_PINVOKE */ @@ -287,7 +292,11 @@ /* #undef HAVE_KQUEUE */ /* Have __thread keyword */ -/* #undef HAVE_KW_THREAD */ +#ifdef _MSC_VER +#define MONO_KEYWORD_THREAD __declspec (thread) +#else +#define MONO_KEYWORD_THREAD __thread +#endif /* Have large file support */ /* #undef HAVE_LARGE_FILE_SUPPORT */ @@ -662,8 +671,10 @@ /* The size of a `void *', as computed by sizeof. */ #ifdef _WIN64 #define SIZEOF_VOID_P 8 +#define TARGET_SIZEOF_VOID_P 8 #else #define SIZEOF_VOID_P 4 +#define TARGET_SIZEOF_VOID_P 4 #endif #define SIZEOF_REGISTER SIZEOF_VOID_P @@ -696,3 +707,34 @@ #define MONO_CORLIB_VERSION #MONO_CORLIB_VERSION# #endif + +#ifdef _MSC_VER +// FIXME This is all questionable but the logs are flooded and nothing else is fixing them. +#define _CRT_SECURE_NO_WARNINGS 1 +#pragma warning(disable:4013) // function undefined; assuming extern returning int +#pragma warning(disable:4018) // signed/unsigned mismatch +#pragma warning(disable:4022) // call and prototype disagree +#pragma warning(disable:4047) // call and prototype disagree +#pragma warning(disable:4090) // const problem +#pragma warning(disable:4098) // void return returns a value +#pragma warning(disable:4101) // unreferenced local variable +#pragma warning(disable:4113) // call and prototype disagree +#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned +#pragma warning(disable:4172) // returning address of local variable or temporary +#pragma warning(disable:4189) // local variable is initialized but not referenced +#pragma warning(disable:4197) // top-level volatile in cast is ignored +#pragma warning(disable:4244) // integer conversion, possible loss of data +#pragma warning(disable:4245) // signed/unsigned mismatch +#pragma warning(disable:4267) // integer conversion, possible loss of data +#pragma warning(disable:4273) // inconsistent dll linkage +#pragma warning(disable:4293) // shift count negative or too big, undefined behavior +#pragma warning(disable:4305) // truncation from 'double' to 'float' +#pragma warning(disable:4312) // 'type cast': conversion from 'MonoNativeThreadId' to 'gpointer' of greater size +#pragma warning(disable:4389) // signed/unsigned mismatch +#pragma warning(disable:4456) // declaration of 'j' hides previous local declaration +#pragma warning(disable:4457) // declaration of 'text' hides function parameter +#pragma warning(disable:4702) // unreachable code +#pragma warning(disable:4706) // assignment within conditional expression +#pragma warning(disable:4715) // 'keyword' not all control paths return a value +#pragma warning(disable:4996) // deprecated function GetVersion GetVersionExW fopen inet_addr mktemp sprintf strcat strcpy strtok unlink etc. +#endif